diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java index dff2e539..bbdfd029 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java @@ -560,7 +560,9 @@ public class IoOrderDetailBizController extends BaseController { @Log(title = "发票管理", businessType = BusinessType.DELETE) public BaseResponse deleteById(@RequestBody IoOrderInvoiceEntity ioOrderInvoiceEntity) { - ioOrderInvoiceService.deleteByInvId(ioOrderInvoiceEntity.getId()+""); + + IoOrderInvoiceResponse ioOrderInvoiceResponse = orderDetailBizService.selectByinvoiceId(ioOrderInvoiceEntity.getId()); + //更改 登记状态 IoOrderDetailCodeEntity ioOrderDetailBizEntity = new IoOrderDetailCodeEntity(); @@ -570,10 +572,11 @@ public class IoOrderDetailBizController extends BaseController { ioOrderDetailBizEntity.setOrderIdFk(ioOrderInvoiceEntity.getOrderIdFk()); - ioOrderDetailBizEntity.setId(ioOrderInvoiceEntity.getRegId()); + ioOrderDetailBizEntity.setId(ioOrderInvoiceResponse.getBizIdFk().intValue()); + ioOrderInvoiceService.deleteByInvId(ioOrderInvoiceEntity.getId()+""); List list = orderDetailBizService.filterListInv(filterOrderDetailBizRequest); - if(list == null && list.size()==0){ + if(list.size()==0){ ioOrderDetailBizEntity.setRegStatus(false); } orderDetailCodeService.updateOrderDetailBiz(ioOrderDetailBizEntity); diff --git a/src/main/java/com/glxp/api/controller/sync/SpsSyncDownloadController.java b/src/main/java/com/glxp/api/controller/sync/SpsSyncDownloadController.java index e13194c3..7b04b999 100644 --- a/src/main/java/com/glxp/api/controller/sync/SpsSyncDownloadController.java +++ b/src/main/java/com/glxp/api/controller/sync/SpsSyncDownloadController.java @@ -13,6 +13,7 @@ import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.constant.*; +import com.glxp.api.constant.Constant; import com.glxp.api.dao.auth.*; import com.glxp.api.dao.basic.*; import com.glxp.api.dao.inout.*; @@ -26,6 +27,7 @@ import com.glxp.api.entity.inout.*; import com.glxp.api.entity.purchase.*; import com.glxp.api.entity.sync.BasicDownloadStatusEntity; import com.glxp.api.entity.sync.BasicExportStatusEntity; +import com.glxp.api.entity.sync.SyncDataBustypeEntity; import com.glxp.api.entity.system.*; import com.glxp.api.entity.thrsys.*; import com.glxp.api.req.sync.SpsSyncDataRequest; @@ -42,10 +44,8 @@ import com.glxp.api.service.purchase.PurOrderService; import com.glxp.api.service.sync.BasicDownloadService; import com.glxp.api.service.sync.BasicExportService; import com.glxp.api.service.sync.SpsSyncDownloadService; -import com.glxp.api.util.CustomUtil; -import com.glxp.api.util.DateUtil; -import com.glxp.api.util.FileUtils; -import com.glxp.api.util.JsonUtils; +import com.glxp.api.service.sync.SyncDataBustypeService; +import com.glxp.api.util.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -606,6 +606,8 @@ public class SpsSyncDownloadController { IBasicBussinessTypeService basicBussinessTypeService; @Resource InvWarehouseService invWarehouseService; + @Resource + SyncDataBustypeService syncDataBustypeService; //接收中继服务、UDI管理系统上传单据 @AuthRuleAnnotation("sps/sync/order/upload") @@ -624,10 +626,21 @@ public class SpsSyncDownloadController { if (CollUtil.isNotEmpty(syncDataResponse.getOrderEntities())) { List orderEntities = syncDataResponse.getOrderEntities(); for (IoOrderEntity orderEntity : orderEntities) { + + SyncDataBustypeEntity syncDataBustypeEntity = syncDataBustypeService.findByAction(orderEntity.getAction(), 2); orderEntity.setUpdateTime(null); orderEntity.setFromType(ConstantStatus.FROM_UDISP); orderEntity.setProcessStatus(ConstantStatus.ORDER_DEAL_POST); orderEntity.setStatus(ConstantStatus.ORDER_STATUS_PROCESS); + if (syncDataBustypeEntity != null) { + if (IntUtil.value(syncDataBustypeEntity.getSyncStatus()) == 1) { + orderEntity.setProcessStatus(ConstantStatus.ORDER_DEAL_DRAFT); + orderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE); + } + if (syncDataBustypeEntity.isSyncChange()) { + orderEntity.setOutChangeEnable(syncDataBustypeEntity.isSyncChange()); + } + } IoOrderEntity temp = orderService.findById(orderEntity.getBillNo()); @@ -712,10 +725,12 @@ public class SpsSyncDownloadController { } orderEntity = orderService.findByBillNo(orderEntity.getBillNo()); - addInoutService.dealProcess(orderEntity); - orderEntity = orderService.findByBillNo(orderEntity.getBillNo()); - if (orderEntity.getStatus() != ConstantStatus.ORDER_STATS_ERROR && !ioCheckInoutService.checkManual(orderEntity.getBillNo())) { - ioCheckInoutService.check(orderEntity.getBillNo()); + if (orderEntity.getStatus() != ConstantStatus.ORDER_STATUS_TEMP_SAVE) { + addInoutService.dealProcess(orderEntity); + orderEntity = orderService.findByBillNo(orderEntity.getBillNo()); + if (orderEntity.getStatus() != ConstantStatus.ORDER_STATS_ERROR && !ioCheckInoutService.checkManual(orderEntity.getBillNo())) { + ioCheckInoutService.check(orderEntity.getBillNo()); + } } } } diff --git a/src/main/java/com/glxp/api/dao/inout/IoOrderDetailBizDao.java b/src/main/java/com/glxp/api/dao/inout/IoOrderDetailBizDao.java index 2d5cceb1..b4e93ab5 100644 --- a/src/main/java/com/glxp/api/dao/inout/IoOrderDetailBizDao.java +++ b/src/main/java/com/glxp/api/dao/inout/IoOrderDetailBizDao.java @@ -24,6 +24,7 @@ public interface IoOrderDetailBizDao extends BaseMapperPlus getfilterList(FilterOrderDetailCodeRequest orderDetailBizRequest); List filterListInv(FilterOrderDetailBizRequest orderDetailBizRequest); + IoOrderInvoiceResponse selectByinvoiceId(Long id); /** * 查询单条单据业务详情 diff --git a/src/main/java/com/glxp/api/entity/basic/BasicBussinessTypeEntity.java b/src/main/java/com/glxp/api/entity/basic/BasicBussinessTypeEntity.java index cba8e55e..b4d1ccb3 100644 --- a/src/main/java/com/glxp/api/entity/basic/BasicBussinessTypeEntity.java +++ b/src/main/java/com/glxp/api/entity/basic/BasicBussinessTypeEntity.java @@ -408,4 +408,8 @@ public class BasicBussinessTypeEntity { private boolean advancePreIn; @TableField(value = "sortNum") private Integer sortNum; + + //是否按货位出库 0:不按货位出库,1:按货位出库 + @TableField(value = "spaceOut") + private int spaceOut; } diff --git a/src/main/java/com/glxp/api/entity/inout/IoOrderDetailCodeEntity.java b/src/main/java/com/glxp/api/entity/inout/IoOrderDetailCodeEntity.java index 36bb9008..2f7635e1 100644 --- a/src/main/java/com/glxp/api/entity/inout/IoOrderDetailCodeEntity.java +++ b/src/main/java/com/glxp/api/entity/inout/IoOrderDetailCodeEntity.java @@ -138,13 +138,13 @@ public class IoOrderDetailCodeEntity { * 单据数量 */ @TableField(value = "`count`") - private int count; + private Integer count; /** * 扫码数量 */ @TableField(value = "reCount") - private int reCount; + private Integer reCount; /** * 备注 diff --git a/src/main/java/com/glxp/api/entity/sync/SyncDataBustypeEntity.java b/src/main/java/com/glxp/api/entity/sync/SyncDataBustypeEntity.java index 12282bc6..bc2b9c7b 100644 --- a/src/main/java/com/glxp/api/entity/sync/SyncDataBustypeEntity.java +++ b/src/main/java/com/glxp/api/entity/sync/SyncDataBustypeEntity.java @@ -24,4 +24,9 @@ public class SyncDataBustypeEntity { private Integer orderStatus; //单据状态 @TableField(value = "`direct`") private int direct; //1:UDI管理系统->SPMS 2:SPMS->UDI管理系统 + + @TableField(value = "`syncStatus`") + private Integer syncStatus; //同步后单据状态 + @TableField(value = "`syncChange`") + private boolean syncChange; //同步后是否自动补单 } diff --git a/src/main/java/com/glxp/api/idc/controller/IdcController.java b/src/main/java/com/glxp/api/idc/controller/IdcController.java index adc2218d..8eac70e9 100644 --- a/src/main/java/com/glxp/api/idc/controller/IdcController.java +++ b/src/main/java/com/glxp/api/idc/controller/IdcController.java @@ -53,18 +53,18 @@ public class IdcController { @RequestParam("content") String content, @RequestParam(value = "files", required = false) MultipartFile[] files) { // - return idcService.receive( request, content, files); + return idcService.receive(request, content, files); } @RequestMapping(value = "/spssync/common/once") @ResponseBody - public BaseResponse once(HttpServletRequest request,@RequestBody Map params) { + public BaseResponse once(HttpServletRequest request, @RequestBody Map params) { // - boolean isUpload = params.get("isUpload")!=null && params.get("isUpload").equals("1") ? true : false ; - return idcService.onceSync( params.get("tableName").toString(), isUpload); + boolean isUpload = params.get("isUpload") != null && params.get("isUpload").equals("1") ? true : false; + return idcService.onceSync(params.get("tableName").toString(), isUpload); } - - + + //@Log("数据同步测试") @RequestMapping(value = "/spssync/common/test") public BaseResponse test(HttpServletRequest request, @RequestBody Map params) { @@ -85,17 +85,19 @@ public class IdcController { public BaseResponse download(HttpServletRequest request, @RequestBody Map params) { return idcService.download(request, params); } + @RequestMapping(value = "/spssync/common/uploadStatus") @ResponseBody public BaseResponse uploadStatus(HttpServletRequest request, @RequestBody Map params) { return idcService.uploadStatus(request, params); } - + @RequestMapping(value = "/spssync/common/downloadStatus") @ResponseBody public BaseResponse downloadStatus(HttpServletRequest request, @RequestBody Map params) { return idcService.downloadStatus(request, params); } + //@Log("数据同步任务根据任务ID,返回下载成功标记") @RequestMapping(value = "/spssync/common/success") @ResponseBody @@ -104,15 +106,15 @@ public class IdcController { } @RequestMapping(value = "/spssync/common/downloadFile") - public void downloadFile(HttpServletResponse response,@RequestParam String fileName) throws UnsupportedEncodingException { - if (fileName != null) { - response.setHeader("Content-disposition", "attachment; filename=" + URLEncoder.encode(fileName, "UTF-8")); - response.setContentType("application/force-download"); - idcService.downloadFile(fileName, response); - } - + public void downloadFile(HttpServletResponse response, @RequestParam String fileName) throws UnsupportedEncodingException { + if (fileName != null) { + response.setHeader("Content-disposition", "attachment; filename=" + URLEncoder.encode(fileName, "UTF-8")); + response.setContentType("application/force-download"); + idcService.downloadFile(fileName, response); + } + } - + @RequestMapping("/mapi/**") public Object mapi(HttpServletRequest request, HttpServletResponse httpServletResponse) { String uri = parseUri(request.getRequestURL().toString()); diff --git a/src/main/java/com/glxp/api/req/sync/BasicExportStatusRequest.java b/src/main/java/com/glxp/api/req/sync/BasicExportStatusRequest.java index 8ee5134e..713fab84 100644 --- a/src/main/java/com/glxp/api/req/sync/BasicExportStatusRequest.java +++ b/src/main/java/com/glxp/api/req/sync/BasicExportStatusRequest.java @@ -13,4 +13,5 @@ public class BasicExportStatusRequest extends ListPageRequest { public Integer createType; private String syncTime; private String receiveStatus; + private String orderBy; } diff --git a/src/main/java/com/glxp/api/res/basic/BasicBussinessTypeResponse.java b/src/main/java/com/glxp/api/res/basic/BasicBussinessTypeResponse.java index f1a5e85c..ee21da29 100644 --- a/src/main/java/com/glxp/api/res/basic/BasicBussinessTypeResponse.java +++ b/src/main/java/com/glxp/api/res/basic/BasicBussinessTypeResponse.java @@ -152,4 +152,7 @@ public class BasicBussinessTypeResponse { private String checkPreInOrders; private Boolean advancePreIn; private Integer sortNum; + + + private int spaceOut; } diff --git a/src/main/java/com/glxp/api/res/inout/IoOrderInvoiceResponse.java b/src/main/java/com/glxp/api/res/inout/IoOrderInvoiceResponse.java index fa94b7db..c9eab274 100644 --- a/src/main/java/com/glxp/api/res/inout/IoOrderInvoiceResponse.java +++ b/src/main/java/com/glxp/api/res/inout/IoOrderInvoiceResponse.java @@ -86,6 +86,7 @@ public class IoOrderInvoiceResponse { private String ggxh; private String licenseUrl; + private Long bizIdFk; public static final String COL_ID = "id"; diff --git a/src/main/java/com/glxp/api/service/auth/impl/InvSpaceServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/InvSpaceServiceImpl.java index a7ce29ae..a9b67d14 100644 --- a/src/main/java/com/glxp/api/service/auth/impl/InvSpaceServiceImpl.java +++ b/src/main/java/com/glxp/api/service/auth/impl/InvSpaceServiceImpl.java @@ -59,7 +59,7 @@ public class InvSpaceServiceImpl implements InvSpaceService { //获取当前仓库下的最大货位编码 String maxSpaceCode = invSpaceDao.getMaxSpaceCode(null); if (StrUtil.isBlank(maxSpaceCode)) { - maxSpaceCode = "0000"; + maxSpaceCode = "1000"; } String spaceCode = getSpaceCode(maxSpaceCode); invSpace.setCode(spaceCode); diff --git a/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java b/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java index a9b7ffb9..ffff4c70 100644 --- a/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java @@ -85,7 +85,9 @@ public class IoChangeInoutService { //普通出入库单据流转 public void genNewOrder(IoOrderEntity orderEntity, List invProductDetailEntities) { - + if (orderEntity.getFromType() == ConstantStatus.FROM_UDISP && (orderEntity.getOutChangeEnable() != null && !orderEntity.getOutChangeEnable())) { + return; + } BasicBusTypePreEntity basicBusTypePreEntity = basicBusTypePreService.findByOriginAction(orderEntity.getAction()); List codeEnttities = codeService.findByOrderId(orderEntity.getBillNo()); if (basicBusTypePreEntity.getSupplementAll()) {//全量补单 diff --git a/src/main/java/com/glxp/api/service/inout/IoOrderDetailBizService.java b/src/main/java/com/glxp/api/service/inout/IoOrderDetailBizService.java index 12879fad..7d96ecf1 100644 --- a/src/main/java/com/glxp/api/service/inout/IoOrderDetailBizService.java +++ b/src/main/java/com/glxp/api/service/inout/IoOrderDetailBizService.java @@ -43,6 +43,7 @@ public interface IoOrderDetailBizService { List checkOrderList(String orderId); List filterListInv(FilterOrderDetailBizRequest orderDetailBizRequest); + IoOrderInvoiceResponse selectByinvoiceId(Long id); Boolean updateOrderDetailBiz(IoOrderDetailBizEntity ioOrderDetailBizEntity); diff --git a/src/main/java/com/glxp/api/service/inout/impl/IoOrderDetailBizServiceImpl.java b/src/main/java/com/glxp/api/service/inout/impl/IoOrderDetailBizServiceImpl.java index 2e8d29aa..f24865ca 100644 --- a/src/main/java/com/glxp/api/service/inout/impl/IoOrderDetailBizServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inout/impl/IoOrderDetailBizServiceImpl.java @@ -178,6 +178,11 @@ public class IoOrderDetailBizServiceImpl implements IoOrderDetailBizService { return ioOrderDetailBizDao.filterListInv(orderDetailBizRequest); } + @Override + public IoOrderInvoiceResponse selectByinvoiceId(Long id) { + return ioOrderDetailBizDao.selectByinvoiceId(id); + } + @Override public Boolean updateOrderDetailBiz(IoOrderDetailBizEntity ioOrderDetailBizEntity) { return ioOrderDetailBizDao.updateById(ioOrderDetailBizEntity) > 0; diff --git a/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java b/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java index b417ef87..f2470cf4 100644 --- a/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java @@ -8,6 +8,7 @@ import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.github.pagehelper.PageHelper; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; @@ -140,7 +141,8 @@ public class IoOrderServiceImpl implements IoOrderService { @Override public List findByStatus(String action, Integer status, Date lastUpdateTime) { - return orderDao.selectList(new QueryWrapper().eq("action", action).eq("status", status).gt("updateTime", lastUpdateTime)); + return orderDao.selectList(Wrappers.lambdaQuery(IoOrderEntity.class).eq(IoOrderEntity::getAction, action).eq(IoOrderEntity::getStatus, status) + .between(IoOrderEntity::getUpdateTime, lastUpdateTime, cn.hutool.core.date.DateUtil.date())); } @@ -721,7 +723,9 @@ public class IoOrderServiceImpl implements IoOrderService { //查询往来单位名称 if (StrUtil.isNotBlank(order.getFromCorp())) { BasicCorpEntity corpEntity = basicCorpDao.selectByErpId(order.getFromCorp()); - response.setFromCorpName(corpEntity.getName()); + if (corpEntity != null) + response.setFromCorpName(corpEntity.getName()); + } else if (StrUtil.isNotBlank(order.getFromInvCode())) { String fromInvName = invWarehouseDao.selectNameByCode(order.getFromInvCode()); response.setFromCorpName(fromInvName); diff --git a/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java b/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java index 75dc6e39..17549878 100644 --- a/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java +++ b/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java @@ -200,11 +200,11 @@ public class SpsSyncDownloadService { } break; case DOCUMENT_TYPE_DATA: - if (needExec(info.getTypeBus(), info.getTypeScan(), info.getTypeThird())) { - basicExportInfoCreate(exportType, now - , x -> x.generateDocumentTypeDataFile(info, now, false, syncTime) - , x -> x.generateDocumentTypeDataFile(info, now, true, syncTime)); - } +// if (needExec(info.getTypeBus(), info.getTypeScan(), info.getTypeThird())) { +// basicExportInfoCreate(exportType, now +// , x -> x.generateDocumentTypeDataFile(info, now, false, syncTime) +// , x -> x.generateDocumentTypeDataFile(info, now, true, syncTime)); +// } break; } } @@ -286,20 +286,19 @@ public class SpsSyncDownloadService { StringBuffer remark = new StringBuffer(); Map syncTimeMap = new WeakHashMap<>(3); syncTimeMap.put("isNew", true); + boolean ge = false; + if (syncTime != null) { + ge = true; + } try { //确认有开启物资字典由外向内同步 if (needExec(info.getBasicProducts())) { - Map map; - if (syncTime == null) { - map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.BASIC_PRODUCTS, createFile); - } else { - map = syncTimeMap; - now = syncTime; - } + Map map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.BASIC_PRODUCTS, createFile); totalTimeMap.put(BasicExportStatusTimeEnum.BASIC_PRODUCTS, map); List hospTypeList = hospTypeService.list(Wrappers.lambdaQuery(BasicHospTypeEntity.class) - .le((boolean) map.get("isNew"), BasicHospTypeEntity::getUpdateTime, now) - .between(!(boolean) map.get("isNew"), BasicHospTypeEntity::getUpdateTime + .le(!ge && (boolean) map.get("isNew"), BasicHospTypeEntity::getUpdateTime, now) + .between(ge, BasicHospTypeEntity::getUpdateTime, syncTime, now) + .between(!ge && !(boolean) map.get("isNew"), BasicHospTypeEntity::getUpdateTime , map.get("oldDate"), now) ); if (CollectionUtil.isNotEmpty(hospTypeList)) { @@ -307,8 +306,9 @@ public class SpsSyncDownloadService { remark.append("物资字典分类信息:").append(hospTypeList.size()).append("条\n"); } List udiRelevanceList = udiRelevanceService.list(Wrappers.lambdaQuery(UdiRelevanceEntity.class) - .le((boolean) map.get("isNew"), UdiRelevanceEntity::getUpdateTime, now) - .between(!(boolean) map.get("isNew"), UdiRelevanceEntity::getUpdateTime + .le(!ge && (boolean) map.get("isNew"), UdiRelevanceEntity::getUpdateTime, now) + .between(ge, UdiRelevanceEntity::getUpdateTime, syncTime, now) + .between(!ge && !(boolean) map.get("isNew"), UdiRelevanceEntity::getUpdateTime , map.get("oldDate"), now) ); if (CollectionUtil.isNotEmpty(udiRelevanceList)) { @@ -316,8 +316,9 @@ public class SpsSyncDownloadService { remark.append("物资字典主表信息:").append(udiRelevanceList.size()).append("条\n"); } List productsList = basicProductsDao.selectList(Wrappers.lambdaQuery(BasicProductsEntity.class) - .le((boolean) map.get("isNew"), BasicProductsEntity::getUpdateTime, now) - .between(!(boolean) map.get("isNew"), BasicProductsEntity::getUpdateTime + .le(!ge && (boolean) map.get("isNew"), BasicProductsEntity::getUpdateTime, now) + .between(ge, BasicProductsEntity::getUpdateTime, syncTime, now) + .between(!ge && !(boolean) map.get("isNew"), BasicProductsEntity::getUpdateTime , map.get("oldDate"), now) ); if (CollectionUtil.isNotEmpty(productsList)) { @@ -325,8 +326,9 @@ public class SpsSyncDownloadService { jsonMap.put(BasicProductsEntity.class.getSimpleName(), productsList); } List relevanceList = relevanceService.list(Wrappers.lambdaQuery(CompanyProductRelevanceEntity.class) - .le((boolean) map.get("isNew"), CompanyProductRelevanceEntity::getUpdateTime, now) - .between(!(boolean) map.get("isNew"), CompanyProductRelevanceEntity::getUpdateTime + .le(!ge && (boolean) map.get("isNew"), CompanyProductRelevanceEntity::getUpdateTime, now) + .between(ge, CompanyProductRelevanceEntity::getUpdateTime, syncTime, now) + .between(!ge && !(boolean) map.get("isNew"), CompanyProductRelevanceEntity::getUpdateTime , map.get("oldDate"), now) ); if (CollectionUtil.isNotEmpty(relevanceList)) { @@ -336,17 +338,12 @@ public class SpsSyncDownloadService { } //确认有开启往来单位字典同步 if (needExec(info.getBasicCorp())) { - Map map; - if (syncTime == null) { - map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.BASIC_CORP, createFile); - } else { - map = syncTimeMap; - now = syncTime; - } + Map map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.BASIC_CORP, createFile); totalTimeMap.put(BasicExportStatusTimeEnum.BASIC_CORP, map); List corpList = corpService.list(Wrappers.lambdaQuery(BasicCorpEntity.class) - .le((boolean) map.get("isNew"), BasicCorpEntity::getUpdateTime, now) - .between(!(boolean) map.get("isNew"), BasicCorpEntity::getUpdateTime + .le(!ge && (boolean) map.get("isNew"), BasicCorpEntity::getUpdateTime, now) + .between(ge, BasicCorpEntity::getUpdateTime, syncTime, now) + .between(!ge && !(boolean) map.get("isNew"), BasicCorpEntity::getUpdateTime , map.get("oldDate"), now) ); if (CollectionUtil.isNotEmpty(corpList)) { @@ -357,18 +354,13 @@ public class SpsSyncDownloadService { //确认有开启首营资质同步 if (needExec(info.getSupCert())) { - Map map; - if (syncTime == null) { - map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.SUP_CERT, createFile); - } else { - map = syncTimeMap; - now = syncTime; - } + Map map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.SUP_CERT, createFile); totalTimeMap.put(BasicExportStatusTimeEnum.SUP_CERT, map); List supCertList = supCertService.list(Wrappers.lambdaQuery(SupCertEntity.class) - .le((boolean) map.get("isNew"), SupCertEntity::getUpdateTime, now) .eq(SupCertEntity::getAuditStatus, ConstantStatus.AUDIT_PASS) - .between(!(boolean) map.get("isNew"), SupCertEntity::getUpdateTime + .le(!ge && (boolean) map.get("isNew"), SupCertEntity::getUpdateTime, now) + .between(ge, SupCertEntity::getUpdateTime, syncTime, now) + .between(!ge && !(boolean) map.get("isNew"), SupCertEntity::getUpdateTime , map.get("oldDate"), now) ); if (CollectionUtil.isNotEmpty(supCertList)) { @@ -383,8 +375,9 @@ public class SpsSyncDownloadService { } } List supCertSetList = supCertSetService.list(Wrappers.lambdaQuery(SupCertSetEntity.class) - .le((boolean) map.get("isNew"), SupCertSetEntity::getUpdateTime, now) - .between(!(boolean) map.get("isNew"), SupCertSetEntity::getUpdateTime + .le(!ge && (boolean) map.get("isNew"), SupCertSetEntity::getUpdateTime, now) + .between(ge, SupCertSetEntity::getUpdateTime, syncTime, now) + .between(!ge && !(boolean) map.get("isNew"), SupCertSetEntity::getUpdateTime , map.get("oldDate"), now) ); if (CollectionUtil.isNotEmpty(supCertSetList)) { @@ -392,9 +385,10 @@ public class SpsSyncDownloadService { jsonMap.put(SupCertSetEntity.class.getSimpleName(), supCertSetList); } List supCompanyList = supCompanyService.list(Wrappers.lambdaQuery(SupCompanyEntity.class) - .le((boolean) map.get("isNew"), SupCompanyEntity::getUpdateTime, now) .eq(SupCompanyEntity::getAuditStatus, ConstantStatus.AUDIT_PASS) - .between(!(boolean) map.get("isNew"), SupCompanyEntity::getUpdateTime + .le(!ge && (boolean) map.get("isNew"), SupCompanyEntity::getUpdateTime, now) + .between(ge, SupCompanyEntity::getUpdateTime, syncTime, now) + .between(!ge && !(boolean) map.get("isNew"), SupCompanyEntity::getUpdateTime , map.get("oldDate"), now) ); if (CollectionUtil.isNotEmpty(supCompanyList)) { @@ -403,7 +397,9 @@ public class SpsSyncDownloadService { } List supManufacturerList = supManufacturerService.list(Wrappers.lambdaQuery(SupManufacturerEntity.class) .eq(SupManufacturerEntity::getAuditStatus, ConstantStatus.AUDIT_PASS) - .between(!(boolean) map.get("isNew"), SupManufacturerEntity::getUpdateTime + .le(!ge && (boolean) map.get("isNew"), SupManufacturerEntity::getUpdateTime, now) + .between(ge, SupManufacturerEntity::getUpdateTime, syncTime, now) + .between(!ge && !(boolean) map.get("isNew"), SupManufacturerEntity::getUpdateTime , map.get("oldDate"), now) ); if (CollectionUtil.isNotEmpty(supManufacturerList)) { @@ -412,8 +408,9 @@ public class SpsSyncDownloadService { } List supProductList = supProductService.list(Wrappers.lambdaQuery(SupProductEntity.class) .eq(SupProductEntity::getAuditStatus, ConstantStatus.AUDIT_PASS) - .le((boolean) map.get("isNew"), SupProductEntity::getUpdateTime, now) - .between(!(boolean) map.get("isNew"), SupProductEntity::getUpdateTime + .le(!ge && (boolean) map.get("isNew"), SupProductEntity::getUpdateTime, now) + .between(ge, SupProductEntity::getUpdateTime, syncTime, now) + .between(!ge && !(boolean) map.get("isNew"), SupProductEntity::getUpdateTime , map.get("oldDate"), now) ); if (CollectionUtil.isNotEmpty(supProductList)) { @@ -479,20 +476,19 @@ public class SpsSyncDownloadService { Map> totalTimeMap = new WeakHashMap<>(10); Map syncTimeMap = new WeakHashMap<>(3); syncTimeMap.put("isNew", true); + boolean ge = false; + if (syncTime != null) { + ge = true; + } try { //确认有开启物资字典由外向内同步 if (info.getUdiCodeLost() == 2) { - Map map; - if (syncTime == null) { - map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.IO_CODE_LOST, createFile); - } else { - map = syncTimeMap; - now = syncTime; - } + Map map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.IO_CODE_LOST, createFile); totalTimeMap.put(BasicExportStatusTimeEnum.IO_CODE_LOST, map); List ioCodeLostList = ioCodeLostService.list(Wrappers.lambdaQuery(IoCodeLostEntity.class) - .le((boolean) map.get("isNew"), IoCodeLostEntity::getUpdateTime, now) - .between(!(boolean) map.get("isNew"), IoCodeLostEntity::getUpdateTime + .le(!ge && (boolean) map.get("isNew"), IoCodeLostEntity::getUpdateTime, now) + .between(ge, IoCodeLostEntity::getUpdateTime, syncTime, now) + .between(!ge && !(boolean) map.get("isNew"), IoCodeLostEntity::getUpdateTime , map.get("oldDate"), now) ); if (CollectionUtil.isNotEmpty(ioCodeLostList)) { @@ -502,17 +498,12 @@ public class SpsSyncDownloadService { } //确认有开启udi关联关系同步 if (info.getUdiCodeRel() == 2) { - Map map; - if (syncTime == null) { - map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.IO_CODE_REL, createFile); - } else { - map = syncTimeMap; - now = syncTime; - } + Map map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.IO_CODE_REL, createFile); totalTimeMap.put(BasicExportStatusTimeEnum.IO_CODE_REL, map); List ioCodeRelList = ioCodeRelService.list(Wrappers.lambdaQuery(IoCodeRelEntity.class) - .le((boolean) map.get("isNew"), IoCodeRelEntity::getUpdateTime, now) - .between(!(boolean) map.get("isNew"), IoCodeRelEntity::getUpdateTime + .le(!ge && (boolean) map.get("isNew"), IoCodeRelEntity::getUpdateTime, now) + .between(ge, IoCodeRelEntity::getUpdateTime, syncTime, now) + .between(!ge && !(boolean) map.get("isNew"), IoCodeRelEntity::getUpdateTime , map.get("oldDate"), now) ); if (CollectionUtil.isNotEmpty(ioCodeRelList)) { @@ -525,8 +516,9 @@ public class SpsSyncDownloadService { Map map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.ORDER_INVOICE, createFile); totalTimeMap.put(BasicExportStatusTimeEnum.ORDER_INVOICE, map); List orderInvoiceEntities = orderInvoiceService.list(Wrappers.lambdaQuery(IoOrderInvoiceEntity.class) - .le((boolean) map.get("isNew"), IoOrderInvoiceEntity::getUpdateTime, now) - .between(!(boolean) map.get("isNew"), IoOrderInvoiceEntity::getUpdateTime + .le(!ge && (boolean) map.get("isNew"), IoOrderInvoiceEntity::getUpdateTime, now) + .between(ge, IoOrderInvoiceEntity::getUpdateTime, syncTime, now) + .between(!ge && !(boolean) map.get("isNew"), IoOrderInvoiceEntity::getUpdateTime , map.get("oldDate"), now) ); if (CollectionUtil.isNotEmpty(orderInvoiceEntities)) { @@ -600,20 +592,19 @@ public class SpsSyncDownloadService { Map> totalTimeMap = new WeakHashMap<>(10); Map syncTimeMap = new WeakHashMap<>(3); syncTimeMap.put("isNew", true); + boolean ge = false; + if (syncTime != null) { + ge = true; + } try { //确认有开启业务单据类型同步 if (needExec(info.getTypeBus())) { - Map map; - if (syncTime == null) { - map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.BASIC_BUSSINESS_TYPE, createFile); - } else { - map = syncTimeMap; - now = syncTime; - } + Map map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.BASIC_BUSSINESS_TYPE, createFile); totalTimeMap.put(BasicExportStatusTimeEnum.BASIC_BUSSINESS_TYPE, map); List bussinessTypeEntities = bussinessTypeService.list(Wrappers.lambdaQuery(BasicBussinessTypeEntity.class) - .le((boolean) map.get("isNew"), BasicBussinessTypeEntity::getUpdateTime, now) - .between(!(boolean) map.get("isNew"), BasicBussinessTypeEntity::getUpdateTime + .le(!ge && (boolean) map.get("isNew"), BasicBussinessTypeEntity::getUpdateTime, now) + .between(ge, BasicBussinessTypeEntity::getUpdateTime, syncTime, now) + .between(!ge && !(boolean) map.get("isNew"), BasicBussinessTypeEntity::getUpdateTime , map.get("oldDate"), now) ); if (CollectionUtil.isNotEmpty(bussinessTypeEntities)) { @@ -623,17 +614,12 @@ public class SpsSyncDownloadService { } //确认有开启扫码单据类型同步 if (needExec(info.getTypeScan())) { - Map map; - if (syncTime == null) { - map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.BASIC_BUSTYPE_CHANGE, createFile); - } else { - map = syncTimeMap; - now = syncTime; - } + Map map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.BASIC_BUSTYPE_CHANGE, createFile); totalTimeMap.put(BasicExportStatusTimeEnum.BASIC_BUSTYPE_CHANGE, map); List busTypeChangeEntities = busTypeChangeService.list(Wrappers.lambdaQuery(BasicBusTypeChangeEntity.class) - .le((boolean) map.get("isNew"), BasicBusTypeChangeEntity::getUpdateTime, now) - .between(!(boolean) map.get("isNew"), BasicBusTypeChangeEntity::getUpdateTime + .le(!ge && (boolean) map.get("isNew"), BasicBusTypeChangeEntity::getUpdateTime, now) + .between(ge, BasicBusTypeChangeEntity::getUpdateTime, syncTime, now) + .between(!ge && !(boolean) map.get("isNew"), BasicBusTypeChangeEntity::getUpdateTime , map.get("oldDate"), now) ); if (CollectionUtil.isNotEmpty(busTypeChangeEntities)) { @@ -643,17 +629,12 @@ public class SpsSyncDownloadService { } //确认有开启第三方单据类型同步 if (needExec(info.getTypeThird())) { - Map map; - if (syncTime == null) { - map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.THR_BUSTYPE_ORIGIN, createFile); - } else { - map = syncTimeMap; - now = syncTime; - } + Map map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.THR_BUSTYPE_ORIGIN, createFile); totalTimeMap.put(BasicExportStatusTimeEnum.THR_BUSTYPE_ORIGIN, map); List thrBusTypeOriginEntities = thrBusTypeOriginService.list(Wrappers.lambdaQuery(ThrBusTypeOriginEntity.class) - .le((boolean) map.get("isNew"), ThrBusTypeOriginEntity::getUpdateTime, now) - .between(!(boolean) map.get("isNew"), ThrBusTypeOriginEntity::getUpdateTime + .le(!ge && (boolean) map.get("isNew"), ThrBusTypeOriginEntity::getUpdateTime, now) + .between(ge, ThrBusTypeOriginEntity::getUpdateTime, syncTime, now) + .between(!ge && !(boolean) map.get("isNew"), ThrBusTypeOriginEntity::getUpdateTime , map.get("oldDate"), now) ); if (CollectionUtil.isNotEmpty(thrBusTypeOriginEntities)) { @@ -719,12 +700,12 @@ public class SpsSyncDownloadService { BasicExportStatusTimeEntity timeInfo = basicExportTimeService.getOne(Wrappers.lambdaQuery(BasicExportStatusTimeEntity.class) .eq(BasicExportStatusTimeEntity::getKey, exportStatusTimeEnum.getKey())); if (timeInfo == null) { - timeInfo = BasicExportStatusTimeEntity.builder() - .key(exportStatusTimeEnum.getKey()) - .lastUpdateTime(DateUtil.formatDateTime(date)) - .remark(exportStatusTimeEnum.getRemark()) - .build(); if (createFile) { + timeInfo = BasicExportStatusTimeEntity.builder() + .key(exportStatusTimeEnum.getKey()) + .lastUpdateTime(DateUtil.formatDateTime(date)) + .remark(exportStatusTimeEnum.getRemark()) + .build(); basicExportTimeService.save(timeInfo); } } else { diff --git a/src/main/java/com/glxp/api/service/sync/SyncDataBustypeService.java b/src/main/java/com/glxp/api/service/sync/SyncDataBustypeService.java index 9fdcc0b5..97ba06a4 100644 --- a/src/main/java/com/glxp/api/service/sync/SyncDataBustypeService.java +++ b/src/main/java/com/glxp/api/service/sync/SyncDataBustypeService.java @@ -9,6 +9,9 @@ public interface SyncDataBustypeService { List findAll(Integer direct); + SyncDataBustypeEntity findByAction(String action, Integer direct); + + boolean deleteAll(Integer direct); void inserts(List syncDataBustypeEntities); diff --git a/src/main/java/com/glxp/api/service/sync/impl/SyncDataBustypeServiceImpl.java b/src/main/java/com/glxp/api/service/sync/impl/SyncDataBustypeServiceImpl.java index 629ca552..e57aac3c 100644 --- a/src/main/java/com/glxp/api/service/sync/impl/SyncDataBustypeServiceImpl.java +++ b/src/main/java/com/glxp/api/service/sync/impl/SyncDataBustypeServiceImpl.java @@ -1,5 +1,6 @@ package com.glxp.api.service.sync.impl; +import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.glxp.api.dao.system.SyncDataBustypeDao; import com.glxp.api.entity.sync.SyncDataBustypeEntity; @@ -23,6 +24,17 @@ public class SyncDataBustypeServiceImpl implements SyncDataBustypeService { return syncDataBustypeDao.selectList(new QueryWrapper().eq("direct", direct)); } + @Override + public SyncDataBustypeEntity findByAction(String action, Integer direct) { + + + List syncDataBustypeEntities = syncDataBustypeDao.selectList(new QueryWrapper().eq(direct != null, "direct", direct).eq("action", action)); + if (CollUtil.isNotEmpty(syncDataBustypeEntities)) { + return syncDataBustypeEntities.get(0); + } + return null; + } + @Override public boolean deleteAll(Integer direct) { return syncDataBustypeDao.delete(new QueryWrapper().eq("direct", direct)) > 0 ? true : false; diff --git a/src/main/java/com/glxp/api/util/IntUtil.java b/src/main/java/com/glxp/api/util/IntUtil.java new file mode 100644 index 00000000..3971e233 --- /dev/null +++ b/src/main/java/com/glxp/api/util/IntUtil.java @@ -0,0 +1,18 @@ +package com.glxp.api.util; + +public class IntUtil { + + public static int value(Integer value) { + if (value == null) + return 0; + else return value.intValue(); + + } + + public static long value(Long value) { + if (value == null) + return 0l; + else return value.longValue(); + + } +} diff --git a/src/main/resources/mybatis/mapper/auth/InvSpaceDao.xml b/src/main/resources/mybatis/mapper/auth/InvSpaceDao.xml index 6b1bf84b..3d2086b9 100644 --- a/src/main/resources/mybatis/mapper/auth/InvSpaceDao.xml +++ b/src/main/resources/mybatis/mapper/auth/InvSpaceDao.xml @@ -1,8 +1,8 @@ - - + + @@ -35,9 +35,9 @@ insert into auth_space (code, `name`, type, invStorageCode, - invWarehouseCode, `status`, createTime, - updateTime, `createUser`, updateUser, - remark) + invWarehouseCode, `status`, createTime, + updateTime, `createUser`, updateUser, + remark) values (#{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{invStorageCode,jdbcType=VARCHAR}, #{invWarehouseCode,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, @@ -243,9 +243,9 @@ insert into auth_space - (code, `name`, type, invStorageCode, invWarehouseCode, `status`, createTime, updateTime, - `createUser`, updateUser, remark) - values + (code, `name`, type, invStorageCode, invWarehouseCode, `status`, createTime, updateTime, + `createUser`, updateUser, remark) + values (#{item.code,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.type,jdbcType=VARCHAR}, #{item.invStorageCode,jdbcType=VARCHAR}, @@ -257,13 +257,14 @@ - select s.*, w.name invStorageName, iws.name invSubStorageName from auth_space s - left join auth_dept w on s.invStorageCode = w.code - left join auth_warehouse iws on s.invWarehouseCode = iws.code + left join auth_dept w on s.invStorageCode = w.code + left join auth_warehouse iws on s.invWarehouseCode = iws.code AND s.invStorageCode = #{invStorageCode} @@ -306,8 +307,8 @@ select - + from auth_space @@ -389,7 +390,7 @@ diff --git a/src/main/resources/mybatis/mapper/inout/IoOrderDetailBizDao.xml b/src/main/resources/mybatis/mapper/inout/IoOrderDetailBizDao.xml index 0404938d..23f94082 100644 --- a/src/main/resources/mybatis/mapper/inout/IoOrderDetailBizDao.xml +++ b/src/main/resources/mybatis/mapper/inout/IoOrderDetailBizDao.xml @@ -73,6 +73,10 @@ GROUP BY ic.id + +