From 9f7f39ea5e0ee874d280b4abc1bf24a1d61786be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=98=8E=E6=A2=81?= <2429105222@qq.com> Date: Fri, 17 Mar 2023 16:54:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E4=BA=A7=E5=93=81?= =?UTF-8?q?=E7=BB=B4=E6=8A=A4=E5=92=8C=E9=85=8D=E9=80=81=E4=BA=A7=E5=93=81?= =?UTF-8?q?=E6=95=B4=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thrsys/ThrProductsAddController.java | 44 +-------- .../thrsys/ThrProductsAddDiController.java | 69 +++++++++++++- .../api/dao/thrsys/ThrProductsAddDiDao.java | 3 + .../entity/thrsys/ThrProductsAddDiEntity.java | 30 +++++++ .../api/service/basic/UdiContrastService.java | 2 +- .../thrsys/ThrProductsAddDiService.java | 2 + .../impl/ThrProductsAddDiServiceImpl.java | 23 +++++ .../mapper/thrsys/ThrProductsAddDiDao.xml | 89 ++++++++++++------- 8 files changed, 183 insertions(+), 79 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/thrsys/ThrProductsAddController.java b/src/main/java/com/glxp/api/controller/thrsys/ThrProductsAddController.java index 582dcdc5..06c4499e 100644 --- a/src/main/java/com/glxp/api/controller/thrsys/ThrProductsAddController.java +++ b/src/main/java/com/glxp/api/controller/thrsys/ThrProductsAddController.java @@ -8,6 +8,7 @@ import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.entity.auth.AuthAdmin; import com.glxp.api.entity.basic.UdiRelevanceEntity; +import com.glxp.api.entity.thrsys.ThrProductsAddDiEntity; import com.glxp.api.entity.thrsys.ThrProductsAddEntity; import com.glxp.api.entity.thrsys.ThrProductsEntity; import com.glxp.api.exception.JsonException; @@ -155,49 +156,6 @@ public class ThrProductsAddController { @Resource UdiRelevanceService udiRelevanceService; - /** - * 新增第三方产品信息 - * - * @return - */ - @AuthRuleAnnotation("") - @PostMapping("/udiwms/thrsys/addThrAddProducts") - public BaseResponse saveProduct(@RequestBody ThrProductsAddEntity thrProductsAddEntity) { - if (null == thrProductsAddEntity) - return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); - - if (thrProductsService.isExit(thrProductsAddEntity.getCode(), thrProductsAddEntity.getThirdSysFk())) { - return ResultVOUtils.error(500, "已存在相同产品编码,无法添加!"); - } - - - String customerId = getCustomerId() + ""; - if (customerId.equals("110")) { - ThrProductsEntity thrProductsEntity = new ThrProductsEntity(); - BeanUtils.copyProperties(thrProductsAddEntity, thrProductsEntity); - thrProductsService.insertThrProducts(thrProductsEntity); - } else { - if (StrUtil.isEmpty(thrProductsAddEntity.getThirdSysFk())) { - thrProductsAddEntity.setThirdSysFk("thirdId"); - } - if (StrUtil.isNotEmpty(thrProductsAddEntity.getRelId())) { - UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectGroupById(Long.valueOf(thrProductsAddEntity.getRelId())); - if (udiRelevanceResponse != null) { - BeanUtils.copyProperties(udiRelevanceResponse, thrProductsAddEntity); - thrProductsAddEntity.setName(udiRelevanceResponse.getCpmctymc()); - thrProductsAddEntity.setManufactory(udiRelevanceResponse.getYlqxzcrbarmc()); - thrProductsAddEntity.setSpec(udiRelevanceResponse.getGgxh()); - thrProductsAddEntity.setRegisterNo(udiRelevanceResponse.getZczbhhzbapzbh()); - } - } - thrProductsAddEntity.setCustomerId(customerId); - thrProductsAddEntity.setCheckStatus(1); - thrProductsAddEntity.setUpdateTime(new Date()); - thrProductsAddService.insertThrProducts(thrProductsAddEntity); - } - - return ResultVOUtils.success(); - } } diff --git a/src/main/java/com/glxp/api/controller/thrsys/ThrProductsAddDiController.java b/src/main/java/com/glxp/api/controller/thrsys/ThrProductsAddDiController.java index 71f92a6f..61a43e7e 100644 --- a/src/main/java/com/glxp/api/controller/thrsys/ThrProductsAddDiController.java +++ b/src/main/java/com/glxp/api/controller/thrsys/ThrProductsAddDiController.java @@ -15,6 +15,7 @@ import com.glxp.api.entity.basic.CompanyProductRelevanceEntity; import com.glxp.api.entity.basic.UdiProductEntity; import com.glxp.api.entity.basic.UdiRelevanceEntity; import com.glxp.api.entity.thrsys.ThrProductsAddDiEntity; +import com.glxp.api.entity.thrsys.ThrProductsEntity; import com.glxp.api.exception.JsonException; import com.glxp.api.req.basic.SupplementRequest; import com.glxp.api.req.basic.UdiCombineRequest; @@ -22,13 +23,17 @@ import com.glxp.api.req.system.DeleteRequest; import com.glxp.api.req.thrsys.AddThrDiProductsRequest; import com.glxp.api.req.thrsys.FilterThrProductsRequest; import com.glxp.api.res.PageSimpleResponse; +import com.glxp.api.res.basic.UdiRelevanceResponse; import com.glxp.api.res.thrsys.ThrProductsAddDiResponse; import com.glxp.api.res.thrsys.UdiInfoResponse; import com.glxp.api.service.auth.AuthAdminService; import com.glxp.api.service.auth.CustomerService; import com.glxp.api.service.basic.*; import com.glxp.api.service.thrsys.ThrProductsAddDiService; +import com.glxp.api.service.thrsys.ThrProductsService; +import com.glxp.api.util.CustomUtil; import com.glxp.api.util.SupplementVailUtil; +import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.validation.BindingResult; @@ -56,7 +61,8 @@ public class ThrProductsAddDiController { private ThrProductsAddDiService thrProductsAddDiService; @Resource private UdiContrastService udiContrastService; - + @Resource + private ThrProductsService thrProductsService; @Resource UdiRelevanceService udiRelevanceService; @@ -75,6 +81,7 @@ public class ThrProductsAddDiController { CustomerService customerService; + /** * 查询DI产品信息列表 * @@ -157,11 +164,22 @@ public class ThrProductsAddDiController { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } + + thrProductsAddDiEntity.setAuditTime(new Date()); thrProductsAddDiEntity.setAuditUser(customerService.getUserId()+""); thrProductsAddDiService.updateDiProduct(thrProductsAddDiEntity); thrProductsAddDiEntity = thrProductsAddDiService.selecById(thrProductsAddDiEntity.getId()); + + //自增的数据就再到第三方产品里面 + if(thrProductsAddDiEntity.getType()==2){ + ThrProductsEntity thrProductsEntity=new ThrProductsEntity(); + BeanUtils.copyProperties(thrProductsAddDiEntity,thrProductsEntity); + thrProductsService.insertThrProducts(thrProductsEntity); + } + + ThrProductsAddDiResponse thrProductsAddDiResponse = thrProductsAddDiService.selecById(thrProductsAddDiEntity.getId()); if (thrProductsAddDiEntity.getStatus() == 2) { //审核通过 @@ -178,6 +196,7 @@ public class ThrProductsAddDiController { UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(udiRelIdFk); //更新产品信息 UdiProductEntity udiProductEntity = udiProductService.findByUuid(udiRelevanceEntity.getUuid()); + udiProductEntity.setSptm(thrProductsAddDiResponse.getSptm()); udiProductEntity.setYbbm(thrProductsAddDiResponse.getYbbm()); udiProductEntity.setMeasname(thrProductsAddDiResponse.getMeasname()); @@ -266,4 +285,52 @@ public class ThrProductsAddDiController { return ResultVOUtils.success(udiInfoResponse); } + /** + * 新增第三方产品信息 + * + * @return + */ + @AuthRuleAnnotation("") + @PostMapping("/udiwms/thrsys/addThrAddProducts") + public BaseResponse saveProduct(@RequestBody ThrProductsAddDiEntity thrProductsAdddiEntity) { + if (null == thrProductsAdddiEntity) + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); + + if (thrProductsService.isExit(thrProductsAdddiEntity.getCode(), thrProductsAdddiEntity.getThirdSysFk())) { + return ResultVOUtils.error(500, "已存在相同产品编码,无法添加!"); + } + + + String customerId = getCustomerId() + ""; + if (customerId.equals("110")) { + ThrProductsEntity thrProductsEntity = new ThrProductsEntity(); + BeanUtils.copyProperties(thrProductsAdddiEntity, thrProductsEntity); + thrProductsService.insertThrProducts(thrProductsEntity); + + } else { + if (StrUtil.isEmpty(thrProductsAdddiEntity.getThirdSysFk())) { + thrProductsAdddiEntity.setThirdSysFk("thirdId"); + } + if (StrUtil.isNotEmpty(thrProductsAdddiEntity.getRelId())) { + UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectGroupById(Long.valueOf(thrProductsAdddiEntity.getRelId())); + if (udiRelevanceResponse != null) { + BeanUtils.copyProperties(udiRelevanceResponse, thrProductsAdddiEntity); + thrProductsAdddiEntity.setName(udiRelevanceResponse.getCpmctymc()); + thrProductsAdddiEntity.setManufactory(udiRelevanceResponse.getYlqxzcrbarmc()); + thrProductsAdddiEntity.setSpec(udiRelevanceResponse.getGgxh()); + thrProductsAdddiEntity.setRegisterNo(udiRelevanceResponse.getZczbhhzbapzbh()); + } + } + thrProductsAdddiEntity.setUuid(CustomUtil.getUUId()); + thrProductsAdddiEntity.setCreateTime(new Date()); + thrProductsAdddiEntity.setStatus(1); //未审核 + thrProductsAdddiEntity.setType(2); + thrProductsAdddiEntity.setCustomerId(customerId); + thrProductsAdddiEntity.setUpdateTime(new Date()); + thrProductsAddDiService.insertThrProducts(thrProductsAdddiEntity); + } + + return ResultVOUtils.success(); + } + } diff --git a/src/main/java/com/glxp/api/dao/thrsys/ThrProductsAddDiDao.java b/src/main/java/com/glxp/api/dao/thrsys/ThrProductsAddDiDao.java index 23073a37..a6fccd0e 100644 --- a/src/main/java/com/glxp/api/dao/thrsys/ThrProductsAddDiDao.java +++ b/src/main/java/com/glxp/api/dao/thrsys/ThrProductsAddDiDao.java @@ -38,4 +38,7 @@ public interface ThrProductsAddDiDao { /** 根据ID查询 */ ThrProductsAddDiEntity filterThrProductsGetId(@Param("id") Integer id); ThrProductsAddDiEntity filterThrProductsGetUuid(@Param("uuid") String uuid); + + + boolean insert(ThrProductsAddDiEntity thrProductsAddDiEntity); } diff --git a/src/main/java/com/glxp/api/entity/thrsys/ThrProductsAddDiEntity.java b/src/main/java/com/glxp/api/entity/thrsys/ThrProductsAddDiEntity.java index eb4b5f16..889f4602 100644 --- a/src/main/java/com/glxp/api/entity/thrsys/ThrProductsAddDiEntity.java +++ b/src/main/java/com/glxp/api/entity/thrsys/ThrProductsAddDiEntity.java @@ -68,4 +68,34 @@ public class ThrProductsAddDiEntity { private String basicPrductRemak7; private String basicPrductRemak8; + + + private String name; + private String spec; + private String registerNo; + private String thirdName; + private String cplb; + private String flbm; + private String qxlb; + private String tyshxydm; + private String zczbhhzbapzbh; + private String ylqxzcrbarmc; + private String ylqxzcrbarywmc; + private Date updateTime; + private String supName; + private boolean isChecked; + private String corpName; + + //添加字段 + private String model; //型号 + private String standard; //规格型号,二合一字段 + private String qtbm; //其他编码 + private String zczyxqz; //注册有效期截止时间 + private Integer checkStatus; + private String thirdSys; + private String relId; + private String nameCode; + private Integer type; + + } diff --git a/src/main/java/com/glxp/api/service/basic/UdiContrastService.java b/src/main/java/com/glxp/api/service/basic/UdiContrastService.java index 3992a4be..c6965b63 100644 --- a/src/main/java/com/glxp/api/service/basic/UdiContrastService.java +++ b/src/main/java/com/glxp/api/service/basic/UdiContrastService.java @@ -205,7 +205,7 @@ public class UdiContrastService { public void insertUdiInfos(List udiInfoEntities) { if (CollUtil.isNotEmpty(udiInfoEntities)) { UdiProductEntity udiProductEntity = udiProductService.findByUuid(udiInfoEntities.get(0).getUuid()); - if (udiProductEntity == null) { + if (udiProductEntity != null) { udiProductService.insertUdiInfos(UdiInfoUtil.initUdiInfoEntitys(udiInfoEntities)); } } diff --git a/src/main/java/com/glxp/api/service/thrsys/ThrProductsAddDiService.java b/src/main/java/com/glxp/api/service/thrsys/ThrProductsAddDiService.java index b5697033..a3f0c248 100644 --- a/src/main/java/com/glxp/api/service/thrsys/ThrProductsAddDiService.java +++ b/src/main/java/com/glxp/api/service/thrsys/ThrProductsAddDiService.java @@ -32,4 +32,6 @@ public interface ThrProductsAddDiService { /** 根据ID查询 */ ThrProductsAddDiEntity filterThrProductsGetId( Integer id); + + boolean insertThrProducts(ThrProductsAddDiEntity thrProductsAddDiEntity); } diff --git a/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsAddDiServiceImpl.java b/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsAddDiServiceImpl.java index 0fd3a365..b967c061 100644 --- a/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsAddDiServiceImpl.java +++ b/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsAddDiServiceImpl.java @@ -5,11 +5,13 @@ import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import com.github.pagehelper.PageHelper; import com.glxp.api.dao.thrsys.ThrProductsAddDiDao; +import com.glxp.api.entity.basic.ProductInfoEntity; import com.glxp.api.entity.thrsys.ThrProductsAddDiEntity; import com.glxp.api.req.thrsys.AddThrDiProductsRequest; import com.glxp.api.req.thrsys.FilterThrProductsRequest; import com.glxp.api.res.thrsys.ThrProductsAddDiResponse; import com.glxp.api.res.thrsys.UdiInfoResponse; +import com.glxp.api.service.basic.ProductInfoService; import com.glxp.api.service.thrsys.ThrProductsAddDiService; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -26,6 +28,8 @@ public class ThrProductsAddDiServiceImpl implements ThrProductsAddDiService { @Resource private ThrProductsAddDiDao thrProductsAddDiDao; + @Resource + private ProductInfoService productInfoService; @Override public List filterThrProductsList(FilterThrProductsRequest filterThrProductsRequest) { @@ -80,11 +84,25 @@ public class ThrProductsAddDiServiceImpl implements ThrProductsAddDiService { List list = new ArrayList<>(uuids.size()); Date date = new Date(); for (String uuid : uuids) { + ProductInfoEntity productInfoEntity=productInfoService.selectByUuid(uuid).get(0); ThrProductsAddDiEntity thrProductsAddDiEntity = new ThrProductsAddDiEntity(); BeanUtils.copyProperties(thrDiProductsRequest, thrProductsAddDiEntity); thrProductsAddDiEntity.setCustomerId(customerId+""); thrProductsAddDiEntity.setUuid(uuid); + thrProductsAddDiEntity.setType(1); + thrProductsAddDiEntity.setYlqxzcrbarywmc(productInfoEntity.getYlqxzcrbarywmc()); + thrProductsAddDiEntity.setCplb(productInfoEntity.getCplb()); + thrProductsAddDiEntity.setCpms(productInfoEntity.getCpms()); + thrProductsAddDiEntity.setFlbm(productInfoEntity.getFlbm()); + thrProductsAddDiEntity.setQxlb(productInfoEntity.getQxlb()); + thrProductsAddDiEntity.setTyshxydm(productInfoEntity.getTyshxydm()); + thrProductsAddDiEntity.setCode(productInfoEntity.getNameCode()); + thrProductsAddDiEntity.setName(productInfoEntity.getCpmctymc()); + thrProductsAddDiEntity.setStandard(productInfoEntity.getGgxh()); + thrProductsAddDiEntity.setYlqxzcrbarmc(productInfoEntity.getYlqxzcrbarmc()); + thrProductsAddDiEntity.setZczbhhzbapzbh(productInfoEntity.getZczbhhzbapzbh()); thrProductsAddDiEntity.setCreateTime(date); + thrProductsAddDiEntity.setUpdateTime(new Date()); thrProductsAddDiEntity.setStatus(1); //未审核 thrProductsAddDiEntity.setSelectThridSysStr(JSONUtil.toJsonStr(thrDiProductsRequest.getSelectThirdSys())); list.add(thrProductsAddDiEntity); @@ -107,4 +125,9 @@ public class ThrProductsAddDiServiceImpl implements ThrProductsAddDiService { public ThrProductsAddDiEntity filterThrProductsGetId(Integer id) { return thrProductsAddDiDao.filterThrProductsGetId(id); } + + @Override + public boolean insertThrProducts(ThrProductsAddDiEntity thrProductsAddDiEntity) { + return thrProductsAddDiDao.insert(thrProductsAddDiEntity); + } } diff --git a/src/main/resources/mybatis/mapper/thrsys/ThrProductsAddDiDao.xml b/src/main/resources/mybatis/mapper/thrsys/ThrProductsAddDiDao.xml index 1c991111..8f919f9b 100644 --- a/src/main/resources/mybatis/mapper/thrsys/ThrProductsAddDiDao.xml +++ b/src/main/resources/mybatis/mapper/thrsys/ThrProductsAddDiDao.xml @@ -4,10 +4,20 @@ - insert into thr_products_add_di (uuid, customerId, createTime, auditTime, remark, auditUser, `status` - , thirdSysFk, code, sptm, ybbm, measname,manufactory,spmc,cpms,selectThridSysStr,price, - basicPrductRemak1,basicPrductRemak2,basicPrductRemak3,basicPrductRemak4, - basicPrductRemak5,basicPrductRemak6,basicPrductRemak7,basicPrductRemak8 + insert into thr_products_add_di (uuid, customerId, createTime, + auditTime, remark, auditUser, + `status`, thirdSysFk, code, + sptm, ybbm, measname, + manufactory, spmc, cpms, + price, selectThridSysStr, basicPrductRemak1, + basicPrductRemak2, basicPrductRemak3, basicPrductRemak4, + basicPrductRemak5, basicPrductRemak6, basicPrductRemak7, + basicPrductRemak8, `name`, spec, + registerNo, cplb, flbm, + qxlb, tyshxydm, zczbhhzbapzbh, + ylqxzcrbarmc, ylqxzcrbarywmc, updateTime, + supName, model, `standard`, + qtbm, zczyxqz, relId,type ) values @@ -25,9 +35,13 @@ #{item.measname}, #{item.manufactory}, #{item.spmc}, - #{item.cpms},#{item.selectThridSysStr},#{item.price} + #{item.cpms},#{item.price},#{item.selectThridSysStr} ,#{item.basicPrductRemak1},#{item.basicPrductRemak2},#{item.basicPrductRemak3},#{item.basicPrductRemak4} ,#{item.basicPrductRemak5},#{item.basicPrductRemak6},#{item.basicPrductRemak7},#{item.basicPrductRemak8} + ,#{item.name},#{item.spec},#{item.registerNo},#{item.cplb} + ,#{item.flbm},#{item.qxlb},#{item.tyshxydm},#{item.zczbhhzbapzbh} + ,#{item.ylqxzcrbarmc},#{item.ylqxzcrbarywmc},#{item.updateTime},#{item.supName},#{item.model} + ,#{item.standard},#{item.qtbm} ,#{item.standard},#{item.zczyxqz},#{item.type} ) @@ -88,15 +102,8 @@ + + + insert into thr_products_add_di (uuid, customerId, createTime, + auditTime, remark, auditUser, + `status`, thirdSysFk, code, + sptm, ybbm, measname, + manufactory, spmc, cpms, + price, selectThridSysStr, basicPrductRemak1, + basicPrductRemak2, basicPrductRemak3, basicPrductRemak4, + basicPrductRemak5, basicPrductRemak6, basicPrductRemak7, + basicPrductRemak8, `name`, spec, + registerNo, cplb, flbm, + qxlb, tyshxydm, zczbhhzbapzbh, + ylqxzcrbarmc, ylqxzcrbarywmc, updateTime, + supName, model, `standard`, + qtbm, zczyxqz, relId,type + ) + values (#{uuid,jdbcType=VARCHAR}, #{customerId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, + #{auditTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, #{auditUser,jdbcType=VARCHAR}, + #{status,jdbcType=INTEGER}, #{thirdSysFk,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, + #{sptm,jdbcType=VARCHAR}, #{ybbm,jdbcType=VARCHAR}, #{measname,jdbcType=VARCHAR}, + #{manufactory,jdbcType=VARCHAR}, #{spmc,jdbcType=VARCHAR}, #{cpms,jdbcType=VARCHAR}, + #{price,jdbcType=VARCHAR}, #{selectThridSysStr,jdbcType=VARCHAR}, #{basicPrductRemak1,jdbcType=VARCHAR}, + #{basicPrductRemak2,jdbcType=VARCHAR}, #{basicPrductRemak3,jdbcType=VARCHAR}, #{basicPrductRemak4,jdbcType=VARCHAR}, + #{basicPrductRemak5,jdbcType=VARCHAR}, #{basicPrductRemak6,jdbcType=VARCHAR}, #{basicPrductRemak7,jdbcType=VARCHAR}, + #{basicPrductRemak8,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{spec,jdbcType=VARCHAR}, + #{registerNo,jdbcType=VARCHAR}, #{cplb,jdbcType=VARCHAR}, #{flbm,jdbcType=VARCHAR}, + #{qxlb,jdbcType=VARCHAR}, #{tyshxydm,jdbcType=VARCHAR}, #{zczbhhzbapzbh,jdbcType=VARCHAR}, + #{ylqxzcrbarmc,jdbcType=VARCHAR}, #{ylqxzcrbarywmc,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, + #{supName,jdbcType=VARCHAR}, #{model,jdbcType=VARCHAR}, #{standard,jdbcType=VARCHAR}, + #{qtbm,jdbcType=VARCHAR}, #{zczyxqz,jdbcType=VARCHAR}, #{relId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR} + ) + + + \ No newline at end of file