修改bug

20240109-yw
yuanwei 1 year ago
parent f6ecf859f9
commit 6957a05f03

@ -6,6 +6,7 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.beust.jcommander.internal.Lists;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@ -28,6 +29,7 @@ import com.glxp.api.entity.sup.UserCompanyEntity;
import com.glxp.api.entity.system.SysPdfTemplateRelevanceStatemenEntity;
import com.glxp.api.entity.system.SystemPDFTemplateEntity;
import com.glxp.api.exception.JsonException;
import com.glxp.api.req.auth.FilterUserComapanyRequest;
import com.glxp.api.req.basic.BasicManuYlqxzczhRequest;
import com.glxp.api.req.inout.InspectionPDFTemplateRequest;
import com.glxp.api.req.purchase.*;
@ -140,23 +142,6 @@ public class SupCertController extends BaseController {
supCertEntity.setId(IdUtil.getSnowflakeNextId());
supCertService.save(supCertEntity);
//默认给自己授权
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("productId",supCertEntity.getProductIdFk());
queryWrapper.eq("curCompanyId",getCompanyId());
List<SupProductAuthEntity> authList = supProductAuthService.list(queryWrapper);
if(CollectionUtil.isEmpty(authList)){
SupProductAuthEntity supProductAuth = new SupProductAuthEntity();
supProductAuth.setAuthCompanyId( getCompanyId());
supProductAuth.setProductId(supCertEntity.getProductIdFk());
supProductAuth.setCurCompanyId( getCompanyId());
supProductAuth.setCreateTime(new Date());
supProductAuth.setCreateUser( getCompanyId());
supProductAuth.setUpdateTime(new Date());
supProductAuth.setUpdateUser( getCompanyId());
supProductAuthService.save(supProductAuth);
}
return ResultVOUtils.success("添加成功!");
}
@ -184,6 +169,83 @@ public class SupCertController extends BaseController {
return ResultVOUtils.success("添加成功!");
}
@AuthRuleAnnotation("获取被授权的产品资质")
@GetMapping("/directToCpt/sup/cert/filterMyAuth")
public BaseResponse filterMyAuth(SupCertEntityRequest request) {
PageSimpleResponse<SupCertEntity> basicUdiRelResponsePageSimpleResponse = new PageSimpleResponse<>();
//判断是否有资质授权
QueryWrapper authWrapper = new QueryWrapper();
authWrapper.eq("productId",request.getProductIdFk());
authWrapper.eq("authCompanyId",getCompanyId());
List<SupProductAuthEntity> authList = supProductAuthService.list(authWrapper);
if(CollectionUtil.isEmpty(authList)){
return ResultVOUtils.success(basicUdiRelResponsePageSimpleResponse);
}
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("productIdFk",request.getProductIdFk());
queryWrapper.isNull("relationCertId");
int offset = (request.getPage() - 1) * request.getLimit();
Page<SupCertEntity> pages = PageHelper.offsetPage(offset, request.getLimit());
List<SupCertEntity> list = supCertService.filterList(queryWrapper);
queryWrapper = new QueryWrapper();
queryWrapper.eq("enabled", 1);
List<SupCertTypeEntity> typeList = supCertTypeService.list(queryWrapper);
Map<String,SupCertTypeEntity> typeMap = typeList.stream().collect(Collectors.toMap(SupCertTypeEntity::getCode, s->s, (l, r) -> l));
for(SupCertEntity supCertEntity:list){
SupCertTypeEntity supCertTypeEntity = typeMap.get(supCertEntity.getType());
if(supCertTypeEntity != null){
supCertEntity.setTypeName(supCertTypeEntity.getName());
}
}
basicUdiRelResponsePageSimpleResponse.setTotal(pages.getTotal());
basicUdiRelResponsePageSimpleResponse.setList(list);
for (SupCertEntity supCertEntity : list) {
Boolean isExit = supCertService.isExit(Long.parseLong(getCompanyId()),supCertEntity.getId());
if (isExit) {
supCertEntity.setCheck(true);
} else
supCertEntity.setCheck(false);
}
return ResultVOUtils.success(basicUdiRelResponsePageSimpleResponse);
}
@ApiOperation(value = "批量授权", response = BaseResponse.class)
@PostMapping("/directToCpt/sup/cert/batchAddAuth")
public BaseResponse batchAddAuth(@RequestBody SupProductAuthSelectRequest request) {
//判断是否有资质授权
QueryWrapper authWrapper = new QueryWrapper();
authWrapper.eq("productId",request.getProductId());
authWrapper.eq("authCompanyId",getCompanyId());
List<SupProductAuthEntity> authList = supProductAuthService.list(authWrapper);
if(CollectionUtil.isEmpty(authList)){
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL,"您没有权限!");
}
String userId = getCompanyId();
if (CollUtil.isNotEmpty(request.getIds())) {
for (String id : request.getIds()) {
if (!supCertService.isExit(Long.parseLong(getCompanyId()),Long.parseLong(id))) {
SupCertEntity oldSupCertEntity = supCertService.getById(id);
SupCertEntity supCertEntity = new SupCertEntity();
BeanUtils.copyProperties(oldSupCertEntity, supCertEntity);
supCertEntity.setRelationCertId(oldSupCertEntity.getId());
supCertEntity.setCreateTime(new Date());
supCertEntity.setCreateUser( getCompanyId());
supCertEntity.setUpdateTime(new Date());
supCertEntity.setUpdateUser( getCompanyId());
supCertEntity.setCompanyIdFk(Long.parseLong(userId));
supCertEntity.setId(IdUtil.getSnowflakeNextId());
supCertService.save(supCertEntity);
}
}
}
return ResultVOUtils.success("添加成功!");
}
public QueryWrapper<SupCertEntity> getQueryWrapper(SupCertEntityRequest request) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq(StringUtils.isNotEmpty(request.getYlqxzcrbarywmc()),"ylqxzcrbarywmc",request.getYlqxzcrbarywmc());
@ -191,10 +253,6 @@ public class SupCertController extends BaseController {
queryWrapper.eq(StringUtils.isNotEmpty(request.getProductName()),"productName",request.getProductName());
queryWrapper.eq(StringUtils.isNotEmpty(request.getStatus()),"status",request.getStatus());
queryWrapper.eq(StringUtils.isNotEmpty(request.getProductIdFk()),"productIdFk",request.getProductIdFk());
String companyId = getCompanyId();
queryWrapper.eq(StringUtils.isNotEmpty(companyId),"auth.curCompanyId",companyId);
return queryWrapper;
}

@ -114,6 +114,7 @@ public class SupProductAuthController extends BaseController {
@GetMapping("/filterRel")
public BaseResponse filterGroupRel(FilterUserComapanyRequest request) {
request.setExitId(getCompanyId());
List<UserCompanyEntity> list = userCompanyService.filterCompanyName(request);
PageInfo<UserCompanyEntity> basicUdiRelResponsePageInfo = new PageInfo<>(list);
PageSimpleResponse<UserCompanyEntity> basicUdiRelResponsePageSimpleResponse = new PageSimpleResponse<>();
@ -139,7 +140,6 @@ public class SupProductAuthController extends BaseController {
String companyId = getCompanyId();
queryWrapper.eq(StringUtils.isNotEmpty(companyId),"auth.curCompanyId",companyId);
queryWrapper.ne(StringUtils.isNotEmpty(companyId),"auth.authCompanyId",companyId);
return queryWrapper;
}

@ -186,6 +186,7 @@ public class SupProductController extends BaseController {
productInfoFilterRequest.setDiType("1");
}
try {
productInfoFilterRequest.setCompanyIdFk(Long.parseLong(getCompanyId()));
BaseResponse<PageSimpleResponse<UdiProductGroupResponse>> udiDlDeviceResponse = syncUdiService.filterUdiGroup(productInfoFilterRequest);
if (udiDlDeviceResponse.getCode() == 20000) {
if (filterUdiRelRequest.getIsCheck() != null && filterUdiRelRequest.getIsCheck()) {

@ -107,6 +107,7 @@ public class UserCertAuthController extends BaseController {
@GetMapping("/filterRel")
public BaseResponse filterGroupRel(FilterUserComapanyRequest request) {
request.setExitId(getCompanyId());
List<UserCompanyEntity> list = userCompanyService.filterCompanyName(request);
PageInfo<UserCompanyEntity> basicUdiRelResponsePageInfo = new PageInfo<>(list);
PageSimpleResponse<UserCompanyEntity> basicUdiRelResponsePageSimpleResponse = new PageSimpleResponse<>();
@ -128,11 +129,10 @@ public class UserCertAuthController extends BaseController {
queryWrapper.eq(StringUtils.isNotEmpty(request.getCompanyName()),"com.companyName",request.getCompanyName());
queryWrapper.eq(StringUtils.isNotEmpty(request.getCreditNum()),"com.creditNum",request.getCreditNum());
queryWrapper.eq(StringUtils.isNotEmpty(request.getStatus()),"com.status",request.getStatus());
queryWrapper.eq(StringUtils.isNotEmpty(request.getProductIdFk()),"productId",request.getProductIdFk());
queryWrapper.eq(StringUtils.isNotEmpty(request.getCorpId()),"corpId",request.getCorpId());
String companyId = getCompanyId();
queryWrapper.eq(StringUtils.isNotEmpty(companyId),"auth.curCompanyId",companyId);
queryWrapper.ne(StringUtils.isNotEmpty(companyId),"auth.authCompanyId",companyId);
return queryWrapper;
}

@ -116,26 +116,10 @@ public class UserCertController extends BaseController {
userCertEntity.setCreateUser( getCompanyId());
userCertEntity.setUpdateTime(new Date());
userCertEntity.setUpdateUser( getCompanyId());
userCertEntity.setCustomerId(getCompanyId());
userCertEntity.setId(IdUtil.getSnowflakeNextId());
userCertService.save(userCertEntity);
//默认给自己授权
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("corpId",userCertEntity.getBusinessId());
queryWrapper.eq("curCompanyId",getCompanyId());
List<SupProductAuthEntity> authList = userCertAuthService.list(queryWrapper);
if(CollectionUtil.isEmpty(authList)){
UserCertAuthEntity userCertAuthEntity = new UserCertAuthEntity();
userCertAuthEntity.setAuthCompanyId( getCompanyId());
userCertAuthEntity.setCorpId(userCertEntity.getBusinessId()+"");
userCertAuthEntity.setCurCompanyId( getCompanyId());
userCertAuthEntity.setCreateTime(new Date());
userCertAuthEntity.setCreateUser( getCompanyId());
userCertAuthEntity.setUpdateTime(new Date());
userCertAuthEntity.setUpdateUser( getCompanyId());
userCertAuthService.save(userCertAuthEntity);
}
return ResultVOUtils.success("添加成功!");
}
@ -163,6 +147,85 @@ public class UserCertController extends BaseController {
return ResultVOUtils.success("添加成功!");
}
@AuthRuleAnnotation("获取被授权的产品资质")
@GetMapping("/directToCpt/user/cert/filterMyAuth")
public BaseResponse filterMyAuth(UserCertEntityRequest request) {
PageSimpleResponse<UserCertEntity> basicUdiRelResponsePageSimpleResponse = new PageSimpleResponse<>();
//判断是否有资质授权
QueryWrapper authWrapper = new QueryWrapper();
authWrapper.eq("corpId",request.getBusinessId());
authWrapper.eq("authCompanyId",getCompanyId());
List<UserCertAuthEntity> authList = userCertAuthService.list(authWrapper);
if(CollectionUtil.isEmpty(authList)){
return ResultVOUtils.success(basicUdiRelResponsePageSimpleResponse);
}
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("businessId",request.getBusinessId());
queryWrapper.isNull("relationCertId");
int offset = (request.getPage() - 1) * request.getLimit();
Page<UserCertEntity> pages = PageHelper.offsetPage(offset, request.getLimit());
List<UserCertEntity> list = userCertService.filterList(queryWrapper);
queryWrapper = new QueryWrapper();
queryWrapper.eq("enabled", 1);
List<SupCertTypeEntity> typeList = supCertTypeService.list(queryWrapper);
Map<String,SupCertTypeEntity> typeMap = typeList.stream().collect(Collectors.toMap(SupCertTypeEntity::getCode, s->s, (l, r) -> l));
for(UserCertEntity userCertEntity:list){
SupCertTypeEntity supCertTypeEntity = typeMap.get(userCertEntity.getType());
if(supCertTypeEntity != null){
userCertEntity.setTypeName(supCertTypeEntity.getName());
}
}
basicUdiRelResponsePageSimpleResponse.setTotal(pages.getTotal());
basicUdiRelResponsePageSimpleResponse.setList(list);
for (UserCertEntity userCertEntity : list) {
Boolean isExit = userCertService.isExit(Long.parseLong(getCompanyId()),userCertEntity.getId());
if (isExit) {
userCertEntity.setCheck(true);
} else
userCertEntity.setCheck(false);
}
return ResultVOUtils.success(basicUdiRelResponsePageSimpleResponse);
}
@ApiOperation(value = "批量授权", response = BaseResponse.class)
@PostMapping("/directToCpt/user/cert/batchAddAuth")
public BaseResponse batchAddAuth(@RequestBody UserCertAuthSelectRequest request) {
//判断是否有资质授权
QueryWrapper authWrapper = new QueryWrapper();
authWrapper.eq("corpId",request.getCorpId());
authWrapper.eq("authCompanyId",getCompanyId());
List<UserCertAuthEntity> authList = userCertAuthService.list(authWrapper);
if(CollectionUtil.isEmpty(authList)){
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL,"您没有权限!");
}
String userId = getCompanyId();
if (CollUtil.isNotEmpty(request.getIds())) {
for (String id : request.getIds()) {
if (!userCertService.isExit(Long.parseLong(getCompanyId()),Long.parseLong(id))) {
UserCertEntity oldCertEntity = userCertService.getById(id);
UserCertEntity userCertEntity = new UserCertEntity();
BeanUtils.copyProperties(oldCertEntity, userCertEntity);
userCertEntity.setRelationCertId(oldCertEntity.getId());
userCertEntity.setCreateTime(new Date());
userCertEntity.setCreateUser( getCompanyId());
userCertEntity.setUpdateTime(new Date());
userCertEntity.setUpdateUser( getCompanyId());
userCertEntity.setCustomerId(userId);
userCertEntity.setId(IdUtil.getSnowflakeNextId());
userCertService.save(userCertEntity);
}
}
}
return ResultVOUtils.success("添加成功!");
}
public QueryWrapper<UserCertEntity> getQueryWrapper(UserCertEntityRequest request) {
QueryWrapper queryWrapper = new QueryWrapper();

@ -153,6 +153,9 @@ public class SupCertEntity {
@TableField("companyIdFk")
private Long companyIdFk;
@TableField("relationCertId")
private Long relationCertId;
/**
*
*/
@ -173,4 +176,9 @@ public class SupCertEntity {
@ApiModelProperty(value = "企业类型 1生产企业,2流通企业,3,医疗机构.4.监管机构")
@TableField(exist = false)
private String bussinessStatus;
//自定义字典
@ApiModelProperty(value = "自定义字典")
@TableField(exist = false)
private boolean check;
}

@ -149,12 +149,18 @@ public class UserCertEntity implements Serializable {
private String customerId;
@TableField("relationCertId")
private Long relationCertId;
/**
* 1:2.3.
*/
@TableField("type")
private String type;
//自定义字典
@ApiModelProperty(value = "自定义字典")
@TableField(exist = false)
private boolean check;
/**
*

@ -34,4 +34,7 @@ public class FilterUserComapanyRequest extends ListPageRequest {
@ApiModelProperty(value = "往来单位ID")
private String corpId;
@ApiModelProperty(value = "排除id")
private String exitId;
}

@ -15,6 +15,9 @@ public class SupProductAuthRequest extends ListPageRequest {
@ApiModelProperty(value = "产品ID")
private String productIdFk;
@ApiModelProperty(value = "往来单位ID")
private String corpId;
@ApiModelProperty(value = "关键字查询")
private String searchKey;

@ -54,4 +54,6 @@ public interface SupCertService extends IService<SupCertEntity> {
List<SupCertEntity> filterList(QueryWrapper queryWrapper);
Boolean isExit(Long companyIdFk,Long relationCertId);
}

@ -13,6 +13,7 @@ import com.glxp.api.req.purchase.FilterSupCertRequest;
import com.glxp.api.req.purchase.certRequest;
import com.glxp.api.req.purchase.purPlanPrintRequest;
import com.glxp.api.service.purchase.SupCertService;
import com.glxp.api.util.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -31,6 +32,15 @@ public class SupCertServiceImpl extends ServiceImpl<SupCertDao, SupCertEntity> i
public List<SupCertEntity> filterList(QueryWrapper queryWrapper){
return this.baseMapper.filterList(queryWrapper);
}
@Override
public Boolean isExit(Long companyIdFk, Long relationCertId) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq(companyIdFk != null,"companyIdFk",companyIdFk);
queryWrapper.eq(relationCertId != null,"relationCertId",relationCertId);
return this.baseMapper.exists(queryWrapper);
}
@Override
public List<SupCertEntity> selectBybId(certRequest certRequest) {

@ -19,10 +19,10 @@ public class UserCertAuthService extends ServiceImpl<UserCertAuthMapper, UserCer
return this.baseMapper.filterList(queryWrapper);
}
public boolean isExit(String authCompanyId,String productId){
public boolean isExit(String authCompanyId,String corpId){
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq(StringUtils.isNotEmpty(authCompanyId),"authCompanyId",authCompanyId);
queryWrapper.eq(StringUtils.isNotEmpty(productId),"productId",productId);
queryWrapper.eq(StringUtils.isNotEmpty(corpId),"corpId",corpId);
return this.baseMapper.exists(queryWrapper);
}
}

@ -24,4 +24,6 @@ public interface UserCertService extends IService<UserCertEntity>{
List<UserCertEntity> filterList(QueryWrapper queryWrapper);
Boolean isExit(Long companyIdFk,Long relationCertId);
}

@ -21,6 +21,14 @@ import com.glxp.api.service.sup.UserCertService;
public class UserCertServiceImpl extends ServiceImpl<UserCertMapper, UserCertEntity> implements UserCertService {
@Resource
UserCertMapper userCertDao;
@Override
public Boolean isExit(Long companyIdFk, Long relationCertId) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq(companyIdFk != null,"customerId",companyIdFk);
queryWrapper.eq(relationCertId != null,"relationCertId",relationCertId);
return this.baseMapper.exists(queryWrapper);
}
@Override
public List<UserCertEntity> selectByRegisterId(String registerId) {
return userCertDao.selectByRegisterId(registerId);

@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@ -111,6 +113,13 @@ public class uploadController {
if (file.isEmpty()) {
return ResultVOUtils.error(ResultEnum.DATA_ERROR, "上传文件不能为空");
}
try {
BufferedImage image = ImageIO.read(file.getInputStream());
System.out.println(image.getWidth());
System.out.println(image.getHeight());
} catch (IOException e) {
e.printStackTrace();
}
if (StringUtils.isBlank(type)) {
return ResultVOUtils.error(ResultEnum.DATA_ERROR, "上传文件类型不能为空");
}

@ -6,7 +6,6 @@
resultType="com.glxp.api.entity.purchase.SupCertEntity">
SELECT O.*,uc.companyName,uc.bussinessStatus,uc.creditNum
FROM sup_cert o left join user_company uc on o.companyIdFk = uc.id
left join sup_product_auth auth on o.productIdFk = auth.productId
<where>
${ew.sqlSegment}
</where>

@ -25,7 +25,6 @@
resultType="com.glxp.api.entity.sup.UserCertEntity">
SELECT O.*
FROM user_cert o left join basic_corp uc on o.businessId = uc.id
left join user_cert_auth auth on uc.id = auth.corpId
<where>
${ew.sqlSegment}
</where>

@ -9,6 +9,9 @@
<if test="id != '' and id != null">
and id = #{id}
</if>
<if test="exitId != '' and exitId != null">
and id != #{exitId}
</if>
<if test="companyName != '' and companyName != null">
AND companyName LIKE concat('%', #{companyName}, '%')
</if>

Loading…
Cancel
Save