diff --git a/src/main/java/com/glxp/api/aspect/AuthorizeAspect.java b/src/main/java/com/glxp/api/aspect/AuthorizeAspect.java index c01af5c1..5cc3b4c9 100644 --- a/src/main/java/com/glxp/api/aspect/AuthorizeAspect.java +++ b/src/main/java/com/glxp/api/aspect/AuthorizeAspect.java @@ -54,7 +54,8 @@ public class AuthorizeAspect { HttpServletRequest request = attributes.getRequest(); String id = request.getHeader("ADMIN_ID"); - if (StrUtil.isBlank(id)) { + String token = request.getHeader("ADMIN_TOKEN"); + if (StrUtil.isBlank(id) || StrUtil.isBlank(token)) { String apiKey = request.getHeader("api_key"); String secretKey = request.getHeader("secret_key"); AuthLicense authLicense = authLicenseDao.get(apiKey); @@ -72,7 +73,7 @@ public class AuthorizeAspect { throw new JsonException(ResultEnum.LOGIN_VERIFY_FALL); } - String token = request.getHeader("ADMIN_TOKEN"); + if (token == null) { throw new JsonException(ResultEnum.LOGIN_VERIFY_FALL); } diff --git a/src/main/java/com/glxp/api/constant/BasicExportTypeEnum.java b/src/main/java/com/glxp/api/constant/BasicExportTypeEnum.java index 9a58fba1..7aee7a80 100644 --- a/src/main/java/com/glxp/api/constant/BasicExportTypeEnum.java +++ b/src/main/java/com/glxp/api/constant/BasicExportTypeEnum.java @@ -50,6 +50,12 @@ public enum BasicExportTypeEnum { * 单据信息 */ IO_ORDER("io_order", "单据信息"), + + + /** + * 发票信息 + */ + ORDER_INVOICE("io_order_invoice", "扫码单据发票信息"), ; @EnumValue private String key; diff --git a/src/main/java/com/glxp/api/controller/basic/UdiRlSupController.java b/src/main/java/com/glxp/api/controller/basic/UdiRlSupController.java index 9e17c743..79096d18 100644 --- a/src/main/java/com/glxp/api/controller/basic/UdiRlSupController.java +++ b/src/main/java/com/glxp/api/controller/basic/UdiRlSupController.java @@ -1,6 +1,7 @@ package com.glxp.api.controller.basic; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import com.github.pagehelper.PageInfo; import com.glxp.api.annotation.AuthRuleAnnotation; @@ -212,13 +213,13 @@ public class UdiRlSupController extends BaseController { @Log(title = "单据管理", businessType = BusinessType.INSERT) public BaseResponse insertFilter(@RequestBody UdiInfoExportRequest udiInfoExportRequest) { CompanyEntity companyEntity = companyService.findCompany(udiInfoExportRequest.getCustomerId() + ""); - if(companyEntity != null){ - if("110".equals(companyEntity.getUnitIdFk())) { - udiInfoExportRequest.setUnitFk(null); - } else { - udiInfoExportRequest.setUnitFk(companyEntity.getUnitIdFk()); + if (companyEntity != null) { + if ("110".equals(companyEntity.getUnitIdFk())) { + udiInfoExportRequest.setUnitFk(null); + } else { + udiInfoExportRequest.setUnitFk(companyEntity.getUnitIdFk()); + } } - } //查询本企业有没有选择该产品有选择不能选择 CompanyProductRelevanceRequest companyProductRelevanceRequest = new CompanyProductRelevanceRequest(); companyProductRelevanceRequest.setCustomerId(udiInfoExportRequest.getCustomerId() + ""); @@ -244,6 +245,7 @@ public class UdiRlSupController extends BaseController { udiRelevanceService.updateUdiRelevance(udiRelevanceEntity); UdiProductEntity udiProductEntity = new UdiProductEntity(); BeanUtils.copyProperties(udiInfoExportRequest.getSupplementRequest(), udiProductEntity); + udiProductEntity.setId(IdUtil.getSnowflakeNextId()); udiProductService.insertUdiInfo(udiProductEntity); return ResultVOUtils.success("选入成功!"); } diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderReviewController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderReviewController.java index b2e04e38..4289a2d8 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderReviewController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderReviewController.java @@ -445,4 +445,19 @@ public class IoOrderReviewController extends BaseController { } + @AuthRuleAnnotation("") + @PostMapping("/udiwms/order/getSimpleOrder") + public BaseResponse getSimpleOrder(@RequestBody ReviewSpmsRequest reviewSpmsRequest) { + + getUser(); + if (StrUtil.isEmpty(reviewSpmsRequest.getBillNo())) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); + } + + IoOrderEntity orderEntity = orderService.findByBillNo(reviewSpmsRequest.getBillNo()); + return ResultVOUtils.success(orderEntity); + + } + + } diff --git a/src/main/java/com/glxp/api/controller/sync/SpsSyncExportStatusController.java b/src/main/java/com/glxp/api/controller/sync/SpsSyncExportStatusController.java index 36be3643..14de0022 100644 --- a/src/main/java/com/glxp/api/controller/sync/SpsSyncExportStatusController.java +++ b/src/main/java/com/glxp/api/controller/sync/SpsSyncExportStatusController.java @@ -264,10 +264,10 @@ public class SpsSyncExportStatusController { CompletableFuture future = CompletableFuture.runAsync(() -> { switch (req.getExportType()) { case IO_ORDER: - spsSyncDownloadService.syncOrderTask(); + spsSyncDownloadService.syncOrderTask(req.getSyncTime()); break; case COUNTRY_DI_DATA: - spsSyncDownloadService.syncDiProductsTask(); + spsSyncDownloadService.syncDiProductsTask(req.getSyncTime()); break; default: spsSyncDownloadService.syncData(syncDataSetEntity, req.getExportType(), req.getSyncTime()); diff --git a/src/main/java/com/glxp/api/controller/sync/SyncDataSetController.java b/src/main/java/com/glxp/api/controller/sync/SyncDataSetController.java index 65eace4a..386f3182 100644 --- a/src/main/java/com/glxp/api/controller/sync/SyncDataSetController.java +++ b/src/main/java/com/glxp/api/controller/sync/SyncDataSetController.java @@ -54,8 +54,7 @@ public class SyncDataSetController { @AuthRuleAnnotation("system/param/syncData/save") @PostMapping("/system/param/syncData/save") - public BaseResponse save(@RequestBody @Valid SyncDataSetResponse syncDataSetResponse - ) { + public BaseResponse save(@RequestBody @Valid SyncDataSetResponse syncDataSetResponse) { SyncDataSetEntity syncDataSetEntity = new SyncDataSetEntity(); BeanUtils.copyProperties(syncDataSetResponse, syncDataSetEntity); syncDataSetEntity.setUpdateTime(new Date()); 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 322b3350..27323dcf 100644 --- a/src/main/java/com/glxp/api/entity/basic/UdiProductEntity.java +++ b/src/main/java/com/glxp/api/entity/basic/UdiProductEntity.java @@ -83,7 +83,7 @@ public class UdiProductEntity { private Date updateTime; - private Integer relSupId; + private Long relSupId; public Boolean getAllowNoBatch() { diff --git a/src/main/java/com/glxp/api/entity/basic/UdiRlSupEntity.java b/src/main/java/com/glxp/api/entity/basic/UdiRlSupEntity.java index 86194d5e..3b7b032f 100644 --- a/src/main/java/com/glxp/api/entity/basic/UdiRlSupEntity.java +++ b/src/main/java/com/glxp/api/entity/basic/UdiRlSupEntity.java @@ -18,7 +18,7 @@ public class UdiRlSupEntity { @TableId(value = "id", type = IdType.AUTO) - private Integer id; + private Long id; /** * 客户ID diff --git a/src/main/java/com/glxp/api/res/basic/CompanyProductRelevanceResponse.java b/src/main/java/com/glxp/api/res/basic/CompanyProductRelevanceResponse.java index c123629d..f9f051b7 100644 --- a/src/main/java/com/glxp/api/res/basic/CompanyProductRelevanceResponse.java +++ b/src/main/java/com/glxp/api/res/basic/CompanyProductRelevanceResponse.java @@ -5,7 +5,7 @@ import lombok.Data; @Data public class CompanyProductRelevanceResponse { - private int id; + private Long id; private Integer rlId; private String thirdId; private String thirdName; diff --git a/src/main/java/com/glxp/api/res/basic/UdiRlSupResponse.java b/src/main/java/com/glxp/api/res/basic/UdiRlSupResponse.java index 19a1f2da..bd650b30 100644 --- a/src/main/java/com/glxp/api/res/basic/UdiRlSupResponse.java +++ b/src/main/java/com/glxp/api/res/basic/UdiRlSupResponse.java @@ -5,7 +5,7 @@ import lombok.Data; @Data public class UdiRlSupResponse { - private int id; + private Long id; private Integer rlId; private String thirdId; private String thirdName; diff --git a/src/main/java/com/glxp/api/service/basic/impl/CompanyProductRelevanceServiceImpl.java b/src/main/java/com/glxp/api/service/basic/impl/CompanyProductRelevanceServiceImpl.java index e5a3192d..238cfe69 100644 --- a/src/main/java/com/glxp/api/service/basic/impl/CompanyProductRelevanceServiceImpl.java +++ b/src/main/java/com/glxp/api/service/basic/impl/CompanyProductRelevanceServiceImpl.java @@ -1,6 +1,7 @@ package com.glxp.api.service.basic.impl; +import cn.hutool.core.util.IdUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.pagehelper.PageHelper; @@ -39,6 +40,8 @@ public class CompanyProductRelevanceServiceImpl extends ServiceImpl baseResponse = findOrder(getRequest(ConstantStatus.SYNC_DOWNLOAD_SCAN_ORDER)); + + SpsSyncDataRequest spsSyncDataRequest = getRequest(ConstantStatus.SYNC_DOWNLOAD_SCAN_ORDER); + if (lastUpdateTime != null) + spsSyncDataRequest.setLastUpdateTime(DateUtil.formatDateTime(lastUpdateTime)); + BaseResponse baseResponse = findOrder(spsSyncDataRequest); SpsSyncOrderResponse syncOrderResponse = baseResponse.getData(); // 2.查看是否有需要更新的数据 if (CollUtil.isNotEmpty(syncOrderResponse.getOrderEntities())) { @@ -117,7 +121,7 @@ public class SpsSyncDownloadService { } // 创建国家库同步任务 - public void syncDiProductsTask() { + public void syncDiProductsTask(Date lastUpdateTime) { BasicExportStatusEntity exportStatus = basicExportService.getOne(Wrappers.lambdaQuery(BasicExportStatusEntity.class) .eq(BasicExportStatusEntity::getType, NEW_ALL_UDIS) @@ -127,8 +131,10 @@ public class SpsSyncDownloadService { //首次任务or上次任务结束 if (exportStatus == null || BasicExportStatusEnum.COMPLETED.getCode().equals(exportStatus.getStatus())) { - - BaseResponse baseResponse = syncUdi(getRequest(ConstantStatus.SYNC_DI_PRODUCTS)); + SpsSyncDataRequest spsSyncDataRequest = getRequest(ConstantStatus.SYNC_DI_PRODUCTS); + if (lastUpdateTime != null) + spsSyncDataRequest.setLastUpdateTime(DateUtil.formatDateTime(lastUpdateTime)); + BaseResponse baseResponse = syncUdi(spsSyncDataRequest); SpSyncUdiResponse spSyncUdiResponse = baseResponse.getData(); if (CollUtil.isNotEmpty(spSyncUdiResponse.getProductInfoEntityList()) || CollUtil.isNotEmpty(spSyncUdiResponse.getUdiCompanyEntities())) { diff --git a/src/main/java/com/glxp/api/task/AsyncHeartTask.java b/src/main/java/com/glxp/api/task/AsyncHeartTask.java index 49f3cb43..48b9128d 100644 --- a/src/main/java/com/glxp/api/task/AsyncHeartTask.java +++ b/src/main/java/com/glxp/api/task/AsyncHeartTask.java @@ -65,7 +65,7 @@ public class AsyncHeartTask implements SchedulingConfigurer { redisUtil.set("SPS_SYNC_GEN_DATA", lastTime); } if (curTime - lastTime > timeInterval) { - spsSyncDownloadService.syncDiProductsTask(); + spsSyncDownloadService.syncDiProductsTask(null); // todo 生成任务都写在这 Arrays.stream(BasicExportTypeEnum.values()).forEach(i -> { spsSyncDownloadService.syncData(syncDataSetEntity, i, null); @@ -78,8 +78,8 @@ public class AsyncHeartTask implements SchedulingConfigurer { //定时同步单据最近更新数据至任务表,等待下载 - if (syncDataSetEntity.getOrderSyncTime() != null) { - long timeInterval = syncDataSetEntity.getOrderSyncTime() * 6 * 1000; + if (syncDataSetEntity.getOrderToInSyncTime() != null) { + long timeInterval = syncDataSetEntity.getOrderToInSyncTime() * 6 * 1000; long curTime = System.currentTimeMillis(); Long lastTime = (Long) redisUtil.get("SPS_ORDER_SYNC_GEN_DATA"); if (lastTime == null) { @@ -87,7 +87,7 @@ public class AsyncHeartTask implements SchedulingConfigurer { redisUtil.set("SPS_ORDER_SYNC_GEN_DATA", lastTime); } if (curTime - lastTime > timeInterval) { - spsSyncDownloadService.syncOrderTask(); + spsSyncDownloadService.syncOrderTask(null); redisUtil.set("SPS_ORDER_SYNC_GEN_DATA", curTime); } } diff --git a/src/main/java/com/glxp/api/util/DateUtil.java b/src/main/java/com/glxp/api/util/DateUtil.java index 18233bb0..67e220d3 100644 --- a/src/main/java/com/glxp/api/util/DateUtil.java +++ b/src/main/java/com/glxp/api/util/DateUtil.java @@ -60,7 +60,7 @@ public class DateUtil extends DateUtils { * 得到日期时间字符串,转换格式(yyyy-MM-dd HH:mm:ss) */ public static String formatDateTime(Date date) { - Date currentTime = new Date(); + Date currentTime = date; SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String dateString = formatter.format(currentTime); return dateString; diff --git a/src/main/java/com/glxp/api/util/udi/UdiInfoUtil.java b/src/main/java/com/glxp/api/util/udi/UdiInfoUtil.java index 3aba538c..8d82d9c6 100644 --- a/src/main/java/com/glxp/api/util/udi/UdiInfoUtil.java +++ b/src/main/java/com/glxp/api/util/udi/UdiInfoUtil.java @@ -1,6 +1,7 @@ package com.glxp.api.util.udi; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import com.glxp.api.constant.ConstantStatus; import com.glxp.api.entity.basic.UdiProductEntity; @@ -27,6 +28,9 @@ public class UdiInfoUtil { public static List initUdiInfoEntitys(List udiProductEntities) { if (CollUtil.isNotEmpty(udiProductEntities)) { for (UdiProductEntity udiProductEntity : udiProductEntities) { + if (udiProductEntity.getId() == null) { + udiProductEntity.setId(IdUtil.getSnowflakeNextId()); + } udiProductEntity.setUpdateTime(new Date()); udiProductEntity.setProductType(ConstantStatus.PRODUCT_TYPE_UDI); if (StrUtil.isNotEmpty(udiProductEntity.getScbssfbhph()) && "否".equals(udiProductEntity.getScbssfbhph())) { diff --git a/src/main/resources/mybatis/mapper/basic/CompanyProductRelevanceDao.xml b/src/main/resources/mybatis/mapper/basic/CompanyProductRelevanceDao.xml index 8004250e..ad5625ab 100644 --- a/src/main/resources/mybatis/mapper/basic/CompanyProductRelevanceDao.xml +++ b/src/main/resources/mybatis/mapper/basic/CompanyProductRelevanceDao.xml @@ -2,13 +2,13 @@ - replace - INTO company_product_relevance(customerId, productId, enterpriseId, registrationId, + INTO company_product_relevance(id, customerId, productId, enterpriseId, registrationId, createTime, updateTime, auditStatus, productUuid, udiRlIdFk, unitFk, price) - values (#{customerId}, + values (#{id}, #{customerId}, #{productId}, #{enterpriseId}, #{registrationId}, diff --git a/src/main/resources/mybatis/mapper/basic/UdiProductDao.xml b/src/main/resources/mybatis/mapper/basic/UdiProductDao.xml index 541b9614..60801132 100644 --- a/src/main/resources/mybatis/mapper/basic/UdiProductDao.xml +++ b/src/main/resources/mybatis/mapper/basic/UdiProductDao.xml @@ -165,7 +165,7 @@ replace INTO basic_products - (uuid, originUuid, nameCode, deviceRecordKey, packRatio, packLevel, packUnit, bhxjsl, bhzxxsbzsl, + (id, uuid, originUuid, nameCode, deviceRecordKey, packRatio, packLevel, packUnit, bhxjsl, bhzxxsbzsl, zxxsbzbhsydysl, bhxjcpbm, bzcj, cpmctymc, cplb, flbm, ggxh, qxlb, tyshxydm, ylqxzcrbarmc, zczbhhzbapzbh, ylqxzcrbarywmc, sydycpbs, sjcpbm, versionNumber, diType, ybbm, sptm, manufactory, measname, productType, scbssfbhph, scbssfbhxlh, scbssfbhscrq, scbssfbhsxrq, cpms, @@ -173,7 +173,7 @@ allowNoProduct, allowNoSerial, spmc, cplx, hchzsb, cpdls, price, basicPrductRemak1, basicPrductRemak2, basicPrductRemak3, basicPrductRemak4, basicPrductRemak5, basicPrductRemak6, basicPrductRemak7, basicPrductRemak8, updateTime) - values (#{uuid}, + values (#{id}, #{uuid}, #{originUuid}, #{nameCode}, #{deviceRecordKey}, diff --git a/src/main/resources/mybatis/mapper/inout/IoOrderDetailBizDao.xml b/src/main/resources/mybatis/mapper/inout/IoOrderDetailBizDao.xml index f24c4baf..aa1104ae 100644 --- a/src/main/resources/mybatis/mapper/inout/IoOrderDetailBizDao.xml +++ b/src/main/resources/mybatis/mapper/inout/IoOrderDetailBizDao.xml @@ -2,7 +2,7 @@ select io_order_detail_biz.*, - (select count(*) FROM io_order_invoice where io_order_invoice.orderIdFk=io_order_detail_biz.orderIdFk) as sucCount + (select count(*) + FROM io_order_invoice + where io_order_invoice.orderIdFk = io_order_detail_biz.orderIdFk) as sucCount from io_order_detail_biz - left join basic_udirel bu on bu.id = io_order_detail_biz.bindRlFk - left join basic_products bp on bu.uuid = bp.uuid + left join basic_udirel bu on bu.id = io_order_detail_biz.bindRlFk + left join basic_products bp on bu.uuid = bp.uuid AND orderIdFk = #{orderIdFk} @@ -47,7 +49,6 @@ -