From 287b8e762ad79525ad99fa56fe1b023297cb27c4 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Fri, 16 Jun 2023 09:26:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E4=BF=A1=E6=81=AF=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/inout/IoCodeController.java | 2 +- .../com/glxp/api/dao/basic/UdiProductDao.java | 3 + .../api/entity/basic/ProductInfoEntity.java | 1 + .../api/entity/basic/UdiProductEntity.java | 10 + .../api/res/basic/UdiRelevanceResponse.java | 10 + .../api/service/basic/UdiProductService.java | 4 +- .../basic/impl/UdiProductServiceImpl.java | 5 + .../com/glxp/api/task/AsyncDiDlService.java | 111 ++++ .../mybatis/mapper/basic/ProductInfoDao.xml | 616 +++++++++++------- .../mybatis/mapper/basic/UdiProductDao.xml | 134 +++- .../mybatis/mapper/basic/UdiRelevanceDao.xml | 66 +- .../mybatis/mapper/basic/UdiRlSupDao.xml | 63 +- .../mybatis/mapper/inout/IoOrderDao.xml | 6 +- src/main/resources/schemas/schema_v2.1.sql | 14 +- 14 files changed, 757 insertions(+), 288 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/inout/IoCodeController.java b/src/main/java/com/glxp/api/controller/inout/IoCodeController.java index 0d66f9ff..ecc17afe 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoCodeController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoCodeController.java @@ -69,7 +69,7 @@ public class IoCodeController extends BaseController { } /** - * 单据编辑,查询条码列表 + * 单据编辑,+ * * @param filterCodeRequest * @return diff --git a/src/main/java/com/glxp/api/dao/basic/UdiProductDao.java b/src/main/java/com/glxp/api/dao/basic/UdiProductDao.java index cca4b942..20dc16b7 100644 --- a/src/main/java/com/glxp/api/dao/basic/UdiProductDao.java +++ b/src/main/java/com/glxp/api/dao/basic/UdiProductDao.java @@ -20,6 +20,9 @@ public interface UdiProductDao { List findByUuids(@Param("uuid") String uuid); + List findByOriginUuid(@Param("originUuid") String originUuid); + + UdiProductEntity findById(@Param("id") String id); boolean insertUdiInfo(UdiProductEntity udiProductEntity); diff --git a/src/main/java/com/glxp/api/entity/basic/ProductInfoEntity.java b/src/main/java/com/glxp/api/entity/basic/ProductInfoEntity.java index b34a1a3d..63dabf87 100644 --- a/src/main/java/com/glxp/api/entity/basic/ProductInfoEntity.java +++ b/src/main/java/com/glxp/api/entity/basic/ProductInfoEntity.java @@ -66,6 +66,7 @@ public class ProductInfoEntity { private String syqsfxyjxmj; private String qtxxdwzlj; private String mjfs; + private String categoryName; //自定义字典 diff --git a/src/main/java/com/glxp/api/entity/basic/UdiProductEntity.java b/src/main/java/com/glxp/api/entity/basic/UdiProductEntity.java index 691db4b3..e514a549 100644 --- a/src/main/java/com/glxp/api/entity/basic/UdiProductEntity.java +++ b/src/main/java/com/glxp/api/entity/basic/UdiProductEntity.java @@ -65,6 +65,16 @@ public class UdiProductEntity { private String price; + private String sfwblztlcp; + private String cgzmraqxgxx; + private String sfbjwycxsy; + private String zdcfsycs; + private String sfwwjbz; + private String syqsfxyjxmj; + private String mjfs; + private String categoryName; + + //本地生成信息 private String batchNo; private String produceDate; diff --git a/src/main/java/com/glxp/api/res/basic/UdiRelevanceResponse.java b/src/main/java/com/glxp/api/res/basic/UdiRelevanceResponse.java index cae21f03..c9c732a0 100644 --- a/src/main/java/com/glxp/api/res/basic/UdiRelevanceResponse.java +++ b/src/main/java/com/glxp/api/res/basic/UdiRelevanceResponse.java @@ -111,6 +111,15 @@ public class UdiRelevanceResponse { private String certIdFk; + private String sfwblztlcp; + private String cgzmraqxgxx; + private String sfbjwycxsy; + private String zdcfsycs; + private String sfwwjbz; + private String syqsfxyjxmj; + private String mjfs; + private String categoryName; + public int getBhzxxsbzsl() { if (bhzxxsbzsl == null || bhzxxsbzsl == 0) { @@ -137,6 +146,7 @@ public class UdiRelevanceResponse { return false; return allowNoProduct; } + public Boolean getAllowNoSerial() { if (allowNoSerial == null) return false; diff --git a/src/main/java/com/glxp/api/service/basic/UdiProductService.java b/src/main/java/com/glxp/api/service/basic/UdiProductService.java index ee4ecdc9..b6cd3edb 100644 --- a/src/main/java/com/glxp/api/service/basic/UdiProductService.java +++ b/src/main/java/com/glxp/api/service/basic/UdiProductService.java @@ -23,12 +23,14 @@ public interface UdiProductService { UdiProductEntity findByNameCode(String nameCode); - UdiProductEntity findById(@Param("id") String id); + UdiProductEntity findById(String id); UdiProductEntity findByUuid(String uuid); List findByUuids(String uuid); + List findByOriginUuid(String originUuid); + boolean insertUdiInfo(UdiProductEntity udiProductEntity); boolean insertUdiInfos(List udiInfoEntities); diff --git a/src/main/java/com/glxp/api/service/basic/impl/UdiProductServiceImpl.java b/src/main/java/com/glxp/api/service/basic/impl/UdiProductServiceImpl.java index d3e834ff..5e674487 100644 --- a/src/main/java/com/glxp/api/service/basic/impl/UdiProductServiceImpl.java +++ b/src/main/java/com/glxp/api/service/basic/impl/UdiProductServiceImpl.java @@ -96,6 +96,11 @@ public class UdiProductServiceImpl implements UdiProductService { return udiProductDao.findByUuids(uuid); } + @Override + public List findByOriginUuid(String originUuid) { + return udiProductDao.findByOriginUuid(originUuid); + } + @Override public boolean insertUdiInfo(UdiProductEntity udiProductEntity) { udiProductEntity.setUpdateTime(new Date()); diff --git a/src/main/java/com/glxp/api/task/AsyncDiDlService.java b/src/main/java/com/glxp/api/task/AsyncDiDlService.java index cf917322..1cf176a5 100644 --- a/src/main/java/com/glxp/api/task/AsyncDiDlService.java +++ b/src/main/java/com/glxp/api/task/AsyncDiDlService.java @@ -1,9 +1,13 @@ package com.glxp.api.task; +import cn.hutool.core.exceptions.ExceptionUtil; +import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONArray; import com.glxp.api.constant.AsyncDiDlHelper; import com.glxp.api.entity.basic.ProductInfoEntity; +import com.glxp.api.entity.basic.UdiProductEntity; import com.glxp.api.service.basic.ProductInfoService; +import com.glxp.api.service.basic.UdiProductService; import com.glxp.api.util.CustomUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -25,8 +29,12 @@ public class AsyncDiDlService { ProductInfoService productInfoService; @Resource AsyncDiDlHelper asyncDiDlHelper; + @Resource + UdiProductService udiProductService; + private static final Logger logger = LoggerFactory.getLogger(AsyncDiDlService.class); + @Async public void asyncDiByTime(String updateTime) { int page = 1; @@ -35,6 +43,109 @@ public class AsyncDiDlService { logger.info("更新时间:" + updateTime + "----" + page + "----" + limit); List productInfoEntityList = asyncDiDlHelper.dlByTime(udiUrl, page, limit, updateTime); if (productInfoEntityList != null && productInfoEntityList.size() > 0) { + + try { + for (ProductInfoEntity productInfoEntity : productInfoEntityList) { + UdiProductEntity udiProductEntity = udiProductService.findByNameCode(productInfoEntity.getNameCode()); + //更新物资字典基础信息 + if (StrUtil.isNotEmpty(productInfoEntity.getPackRatio())) + udiProductEntity.setPackRatio(productInfoEntity.getPackRatio()); + if (StrUtil.isNotEmpty(productInfoEntity.getPackLevel())) + udiProductEntity.setPackLevel(productInfoEntity.getPackLevel()); + if (productInfoEntity.getBhxjsl() != null) + udiProductEntity.setBhxjsl(productInfoEntity.getBhxjsl()); + if (productInfoEntity.getBhzxxsbzsl() != null) + udiProductEntity.setBhzxxsbzsl(productInfoEntity.getBhzxxsbzsl()); + if (productInfoEntity.getZxxsbzbhsydysl() != null) + udiProductEntity.setZxxsbzbhsydysl(productInfoEntity.getZxxsbzbhsydysl()); + if (StrUtil.isNotEmpty(productInfoEntity.getBhxjcpbm())) + udiProductEntity.setBhxjcpbm(productInfoEntity.getBhxjcpbm()); + if (StrUtil.isNotEmpty(productInfoEntity.getSjcpbm())) + udiProductEntity.setSjcpbm(productInfoEntity.getSjcpbm()); + if (StrUtil.isNotEmpty(productInfoEntity.getBzcj())) + udiProductEntity.setBzcj(productInfoEntity.getBzcj()); + if (StrUtil.isNotEmpty(productInfoEntity.getCpmctymc())) + udiProductEntity.setCpmctymc(productInfoEntity.getCpmctymc()); + if (StrUtil.isNotEmpty(productInfoEntity.getCplb())) + udiProductEntity.setCplb(productInfoEntity.getCplb()); + if (StrUtil.isNotEmpty(productInfoEntity.getFlbm())) + udiProductEntity.setFlbm(productInfoEntity.getFlbm()); + if (StrUtil.isNotEmpty(productInfoEntity.getGgxh())) + udiProductEntity.setGgxh(productInfoEntity.getGgxh()); + if (StrUtil.isNotEmpty(productInfoEntity.getQxlb())) + udiProductEntity.setQxlb(productInfoEntity.getQxlb()); + if (StrUtil.isNotEmpty(productInfoEntity.getTyshxydm())) + udiProductEntity.setTyshxydm(productInfoEntity.getTyshxydm()); + if (StrUtil.isNotEmpty(productInfoEntity.getYlqxzcrbarmc())) + udiProductEntity.setYlqxzcrbarmc(productInfoEntity.getYlqxzcrbarmc()); + if (StrUtil.isNotEmpty(productInfoEntity.getYlqxzcrbarywmc())) + udiProductEntity.setYlqxzcrbarywmc(productInfoEntity.getYlqxzcrbarywmc()); + if (StrUtil.isNotEmpty(productInfoEntity.getSydycpbs())) + udiProductEntity.setSydycpbs(productInfoEntity.getSydycpbs()); + if (productInfoEntity.getVersionNumber() != null) + udiProductEntity.setVersionNumber(productInfoEntity.getVersionNumber()); + if (StrUtil.isNotEmpty(productInfoEntity.getScbssfbhph())) { + udiProductEntity.setScbssfbhph(productInfoEntity.getScbssfbhph()); + if (productInfoEntity.getScbssfbhph().equals("是")) { + udiProductEntity.setAllowNoBatch(false); + } else { + udiProductEntity.setAllowNoBatch(true); + } + } + if (StrUtil.isNotEmpty(productInfoEntity.getScbssfbhscrq())) { + udiProductEntity.setScbssfbhscrq(productInfoEntity.getScbssfbhscrq()); + if (productInfoEntity.getScbssfbhscrq().equals("是")) { + udiProductEntity.setAllowNoProduct(false); + } else { + udiProductEntity.setAllowNoProduct(true); + } + } + if (StrUtil.isNotEmpty(productInfoEntity.getScbssfbhsxrq())) { + udiProductEntity.setScbssfbhsxrq(productInfoEntity.getScbssfbhsxrq()); + if (productInfoEntity.getScbssfbhsxrq().equals("是")) { + udiProductEntity.setAllowNoExpire(false); + } else { + udiProductEntity.setAllowNoExpire(true); + } + } + if (StrUtil.isNotEmpty(productInfoEntity.getScbssfbhxlh())) { + udiProductEntity.setScbssfbhxlh(productInfoEntity.getScbssfbhxlh()); + if (productInfoEntity.getScbssfbhxlh().equals("是")) { + udiProductEntity.setAllowNoSerial(false); + } else { + udiProductEntity.setAllowNoSerial(true); + } + } + if (StrUtil.isNotEmpty(productInfoEntity.getYbbm())) + udiProductEntity.setYbbm(productInfoEntity.getYbbm()); + if (StrUtil.isNotEmpty(productInfoEntity.getCplx())) + udiProductEntity.setCplx(productInfoEntity.getCplx()); + if (StrUtil.isNotEmpty(productInfoEntity.getHchzsb())) + udiProductEntity.setHchzsb(productInfoEntity.getHchzsb()); + if (StrUtil.isNotEmpty(productInfoEntity.getSfwblztlcp())) + udiProductEntity.setSfwblztlcp(productInfoEntity.getSfwblztlcp()); + if (StrUtil.isNotEmpty(productInfoEntity.getCgzmraqxgxx())) + udiProductEntity.setCgzmraqxgxx(productInfoEntity.getCgzmraqxgxx()); + if (StrUtil.isNotEmpty(productInfoEntity.getSfbjwycxsy())) + udiProductEntity.setSfbjwycxsy(productInfoEntity.getSfbjwycxsy()); + if (StrUtil.isNotEmpty(productInfoEntity.getZdcfsycs())) + udiProductEntity.setZdcfsycs(productInfoEntity.getZdcfsycs()); + if (StrUtil.isNotEmpty(productInfoEntity.getSfwwjbz())) + udiProductEntity.setSfwwjbz(productInfoEntity.getSfwwjbz()); + if (StrUtil.isNotEmpty(productInfoEntity.getSyqsfxyjxmj())) + udiProductEntity.setSyqsfxyjxmj(productInfoEntity.getSyqsfxyjxmj()); + if (StrUtil.isNotEmpty(productInfoEntity.getMjfs())) + udiProductEntity.setMjfs(productInfoEntity.getMjfs()); + if (StrUtil.isNotEmpty(productInfoEntity.getCategoryName())) + udiProductEntity.setCategoryName(productInfoEntity.getCategoryName()); + udiProductService.updateUdiInfoById(udiProductEntity); + } + + } catch (Exception e) { + e.printStackTrace(); + logger.error(ExceptionUtil.getMessage(e)); + } + productInfoService.insertProductInfos(productInfoEntityList); if (productInfoEntityList.size() < limit) { break; diff --git a/src/main/resources/mybatis/mapper/basic/ProductInfoDao.xml b/src/main/resources/mybatis/mapper/basic/ProductInfoDao.xml index f1d68927..83aa43b3 100644 --- a/src/main/resources/mybatis/mapper/basic/ProductInfoDao.xml +++ b/src/main/resources/mybatis/mapper/basic/ProductInfoDao.xml @@ -2,19 +2,19 @@ - - select * from productinfo + select * + from productinfo AND tyshxydm = #{tyshxydm} - AND cpmctymc LIKE concat(#{cpmctymc},'%') + AND cpmctymc LIKE concat(#{cpmctymc}, '%') - AND nameCode LIKE concat(#{nameCode},'%') + AND nameCode LIKE concat(#{nameCode}, '%') AND uuid = #{uuid} - - = DATE_FORMAT(#{updateTime}, '%Y-%m-%d %H:%i:%S') ]]> + + = DATE_FORMAT(#{updateTime}, '%Y-%m-%d %H:%i:%S') + ]]> GROUP BY cpmctymc @@ -94,23 +99,26 @@ - select * from productinfo where - uuid in ( + select * + from productinfo where + uuid in ( #{item} @@ -137,27 +146,27 @@ - - SELECT * FROM productinfo + SELECT * + FROM productinfo AND tyshxydm = #{tyshxydm} - AND cpmctymc LIKE concat(#{cpmctymc},'%') + AND cpmctymc LIKE concat(#{cpmctymc}, '%') - AND nameCode LIKE concat(#{nameCode},'%') + AND nameCode LIKE concat(#{nameCode}, '%') AND uuid = #{uuid} @@ -191,72 +200,73 @@ @@ -368,24 +378,23 @@ SELECT uuid from device - group by uuid limit #{page}, #{limit} + group by uuid + limit #{page}, #{limit} + + + select count(*) FROM company_product_relevance - inner JOIN basic_udirel - ON company_product_relevance.udiRlIdFk = basic_udirel.id - inner JOIN basic_products ON basic_udirel.uuid = basic_products.uuid + inner JOIN basic_udirel + ON company_product_relevance.udiRlIdFk = basic_udirel.id + inner JOIN basic_products ON basic_udirel.uuid = basic_products.uuid AND nameCode LIKE concat(#{nameCode}, '%') diff --git a/src/main/resources/mybatis/mapper/inout/IoOrderDao.xml b/src/main/resources/mybatis/mapper/inout/IoOrderDao.xml index 4cf820cb..9ef6ab5e 100644 --- a/src/main/resources/mybatis/mapper/inout/IoOrderDao.xml +++ b/src/main/resources/mybatis/mapper/inout/IoOrderDao.xml @@ -128,14 +128,14 @@ #{item} - and status = 7) + and (status = 7 or status = 10)) ) - - order by ${orderBy} ${sort} + + order by ${orderBy} ${sort} order by updateTime desc diff --git a/src/main/resources/schemas/schema_v2.1.sql b/src/main/resources/schemas/schema_v2.1.sql index b66b8c10..3ada65ab 100644 --- a/src/main/resources/schemas/schema_v2.1.sql +++ b/src/main/resources/schemas/schema_v2.1.sql @@ -367,9 +367,9 @@ CALL Pro_Temp_ColumnWork('auth_role', 'isCustomer', 'int', 1); CALL Pro_Temp_ColumnWork('sync_data_bustypes', 'id', 'bigint', 2); CALL Pro_Temp_ColumnWork('sync_data_set', 'orderInvoice', 'tinyint', 1); -CALL Pro_Temp_ColumnWork('io_order_invoice', 'id', 'bigint ', 2); +CALL Pro_Temp_ColumnWork('io_order_invoice', 'id', 'bigint', 2); -CALL Pro_Temp_ColumnWork('io_order_detail_code', 'regStatus', 'varchar(255) ', 1); +CALL Pro_Temp_ColumnWork('io_order_detail_code', 'regStatus', 'varchar(255)', 1); CALL Pro_Temp_ColumnWork('io_order', 'reviewSp', 'tinyint', 1); CALL Pro_Temp_ColumnWork('sync_data_bustypes', 'syncStatus', 'tinyint', 1); @@ -418,3 +418,13 @@ CALL Pro_Temp_ColumnWork('io_order_detail_biz', 'updateTime', 'datetime ', 1); call Modify_index('basic_products', 'uuid', 'idx_uuid', 'BTREE'); + +CALL Pro_Temp_ColumnWork('basic_products', 'sfwblztlcp', 'varchar(255)', 1); +CALL Pro_Temp_ColumnWork('basic_products', 'cgzmraqxgxx', 'varchar(255)', 1); +CALL Pro_Temp_ColumnWork('basic_products', 'sfbjwycxsy', 'varchar(255)', 1); +CALL Pro_Temp_ColumnWork('basic_products', 'zdcfsycs', 'varchar(255)', 1); +CALL Pro_Temp_ColumnWork('basic_products', 'sfwwjbz', 'varchar(255)', 1); +CALL Pro_Temp_ColumnWork('basic_products', 'syqsfxyjxmj', 'varchar(255)', 1); +CALL Pro_Temp_ColumnWork('basic_products', 'mjfs', 'varchar(255)', 1); +CALL Pro_Temp_ColumnWork('basic_products', 'categoryName', 'varchar(255)', 1); +