From 43c64779ce0a3242393f1cd3b9f9a9ed7275a5ff Mon Sep 17 00:00:00 2001 From: zhaoqing <1670883518@qq.com> Date: Thu, 14 May 2026 11:11:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9businessId=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=20=20=E6=9F=A5=E7=9C=8B=E6=8A=A5=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessDocumentOrderApplicationService.java | 4 ++-- .../erpCountry/ErpCountryApplicationService.java | 16 ++++++++++------ .../ErpEnterpriseUnitApplicationService.java | 16 ++++++++++------ .../ExchangeRateApplicationService.java | 2 +- .../service/gwLog/GwLogApplicationService.java | 8 +++----- .../MaterialInfoApplicationService.java | 2 +- .../entity/ErpEnterpriseUnit.java | 3 +++ .../com/mhd/oms/domain/gwLog/entity/GwLog.java | 2 +- .../gwLog/repository/mapper/GwLogMapper.java | 4 ++-- 9 files changed, 33 insertions(+), 24 deletions(-) diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderApplicationService.java index cce878d46..bed7494c7 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderApplicationService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderApplicationService.java @@ -194,8 +194,8 @@ public class BusinessDocumentOrderApplicationService { // 2. 记录日志 GwLog gwLog = new GwLog(); - gwLog.setType("进出口原始单证-物料推送"); - gwLog.setBusinessId(pushData.getMaterialCode()); + gwLog.setType("进出口原始单证"); + gwLog.setBusinessId(Long.valueOf(pushData.getId())); gwLog.setRequestBody(JSONObject.toJSONString(body)); gwLog.setResponseBody(""); gwLog.setStatus(1); diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/erpCountry/ErpCountryApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/erpCountry/ErpCountryApplicationService.java index 9ffd5822f..8ad209ce9 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/erpCountry/ErpCountryApplicationService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/erpCountry/ErpCountryApplicationService.java @@ -102,6 +102,7 @@ public class ErpCountryApplicationService{ LoginUser loginUser = SecurityUtils.getLoginUser(); Long pushBy = loginUser != null ? loginUser.getUserid() : null; + String pushByName = loginUser != null ? loginUser.getUsername() : null; Long organizationId = loginUser != null ? loginUser.getUserPo().getOrganizationId() : null; Long topOrganizationId = loginUser != null ? loginUser.getUserPo().getTopOrganizationId() : null; String organizationName = loginUser != null ? loginUser.getUserPo().getOrganizationName() : null; @@ -117,7 +118,7 @@ public class ErpCountryApplicationService{ GwLog gwLog = new GwLog(); gwLog.setType("企业国别"); - gwLog.setBusinessId(String.valueOf(dto.getId())); + gwLog.setBusinessId(dto.getId()); gwLog.setRequestBody(JSONObject.toJSONString(body)); gwLog.setResponseBody(""); gwLog.setStatus(1); @@ -130,7 +131,7 @@ public class ErpCountryApplicationService{ gwLog.setDelFlag(1); gwLogMapper.insert(gwLog); - updatePushStatus(dto.getId(), 2, new Date(), pushBy); + updatePushStatus(dto.getId(), 2, new Date(), pushBy,pushByName); CloseableHttpClient httpClient = HttpClients.createDefault(); HttpPost httpPost = new HttpPost(PUSH_API_URL); @@ -146,12 +147,12 @@ public class ErpCountryApplicationService{ if (response.getStatusLine().getStatusCode() == 200) { gwLog.setStatus(2); - updatePushStatus(dto.getId(), 3, new Date(), pushBy); + updatePushStatus(dto.getId(), 3, new Date(), pushBy,pushByName); successCount++; } else { gwLog.setStatus(3); gwLog.setErrorMsg(responseString); - updatePushStatus(dto.getId(), 4, new Date(), pushBy); + updatePushStatus(dto.getId(), 4, new Date(), pushBy,pushByName); failCount++; failMsg.append("erpCountryCode:").append(dto.getErpCountryCode()).append("失败;"); } @@ -161,7 +162,7 @@ public class ErpCountryApplicationService{ gwLog.setStatus(3); gwLog.setErrorMsg(e.getMessage()); gwLogMapper.updateById(gwLog); - updatePushStatus(dto.getId(), 4, new Date(), pushBy); + updatePushStatus(dto.getId(), 4, new Date(), pushBy,pushByName); failCount++; failMsg.append("erpCountryCode:").append(dto.getErpCountryCode()).append("异常:").append(e.getMessage()).append(";"); log.error("企业国别推送异常: id={}, error={}", dto.getId(), e.getMessage()); @@ -181,7 +182,7 @@ public class ErpCountryApplicationService{ return AjaxResult.success(resultMsg); } - private void updatePushStatus(Long id, Integer pushStatus, Date pushTime, Long pushBy) { + private void updatePushStatus(Long id, Integer pushStatus, Date pushTime, Long pushBy,String pushByName) { ErpCountry entity = new ErpCountry(); entity.setId(id); entity.setPushStatus(pushStatus); @@ -191,6 +192,9 @@ public class ErpCountryApplicationService{ if (pushBy != null) { entity.setPushBy(pushBy); } + if (pushByName != null) { + entity.setPushByName(pushByName); + } erpCountryMapper.updateById(entity); } diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/erpEnterpriseUnit/ErpEnterpriseUnitApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/erpEnterpriseUnit/ErpEnterpriseUnitApplicationService.java index dd20c5960..7fe0ea1a7 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/erpEnterpriseUnit/ErpEnterpriseUnitApplicationService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/erpEnterpriseUnit/ErpEnterpriseUnitApplicationService.java @@ -98,6 +98,7 @@ public class ErpEnterpriseUnitApplicationService { LoginUser loginUser = SecurityUtils.getLoginUser(); Long pushBy = loginUser != null ? loginUser.getUserid() : null; + String pushByName = loginUser != null ? loginUser.getUsername() : null; Long organizationId = loginUser != null ? loginUser.getUserPo().getOrganizationId() : null; Long topOrganizationId = loginUser != null ? loginUser.getUserPo().getTopOrganizationId() : null; String organizationName = loginUser != null ? loginUser.getUserPo().getOrganizationName() : null; @@ -113,7 +114,7 @@ public class ErpEnterpriseUnitApplicationService { GwLog gwLog = new GwLog(); gwLog.setType("企业单位"); - gwLog.setBusinessId(String.valueOf(dto.getId())); + gwLog.setBusinessId(Long.valueOf(dto.getId())); gwLog.setRequestBody(JSONObject.toJSONString(body)); gwLog.setResponseBody(""); gwLog.setStatus(1); @@ -126,7 +127,7 @@ public class ErpEnterpriseUnitApplicationService { gwLog.setDelFlag(1); gwLogMapper.insert(gwLog); - updatePushStatus(dto.getId(), 2, new Date(), pushBy); + updatePushStatus(dto.getId(), 2, new Date(), pushBy,pushByName); CloseableHttpClient httpClient = HttpClients.createDefault(); HttpPost httpPost = new HttpPost(PUSH_API_URL); @@ -142,12 +143,12 @@ public class ErpEnterpriseUnitApplicationService { if (response.getStatusLine().getStatusCode() == 200) { gwLog.setStatus(2); - updatePushStatus(dto.getId(), 3, new Date(), pushBy); + updatePushStatus(dto.getId(), 3, new Date(), pushBy,pushByName); successCount++; } else { gwLog.setStatus(3); gwLog.setErrorMsg(responseString); - updatePushStatus(dto.getId(), 4, new Date(), pushBy); + updatePushStatus(dto.getId(), 4, new Date(), pushBy,pushByName); failCount++; failMsg.append("erpUnitCode:").append(dto.getErpCode()).append("失败;"); } @@ -157,7 +158,7 @@ public class ErpEnterpriseUnitApplicationService { gwLog.setStatus(3); gwLog.setErrorMsg(e.getMessage()); gwLogMapper.updateById(gwLog); - updatePushStatus(dto.getId(), 4, new Date(), pushBy); + updatePushStatus(dto.getId(), 4, new Date(), pushBy,pushByName); failCount++; failMsg.append("erpUnitCode:").append(dto.getErpCode()).append("异常:").append(e.getMessage()).append(";"); log.error("企业单位推送异常: id={}, error={}", dto.getId(), e.getMessage()); @@ -177,7 +178,7 @@ public class ErpEnterpriseUnitApplicationService { return AjaxResult.success(resultMsg); } - private void updatePushStatus(Long id, Integer pushStatus, Date pushTime, Long pushBy) { + private void updatePushStatus(Long id, Integer pushStatus, Date pushTime, Long pushBy ,String pushByName) { ErpEnterpriseUnit entity = new ErpEnterpriseUnit(); entity.setId(id); entity.setPushStatus(pushStatus); @@ -187,6 +188,9 @@ public class ErpEnterpriseUnitApplicationService { if (pushBy != null) { entity.setPushBy(String.valueOf(pushBy)); } + if (pushByName != null) { + entity.setPushByName((pushByName)); + } erpEnterpriseUnitMapper.updateById(entity); } diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/exchangeRate/ExchangeRateApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/exchangeRate/ExchangeRateApplicationService.java index 81d5af512..7a66e2eab 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/exchangeRate/ExchangeRateApplicationService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/exchangeRate/ExchangeRateApplicationService.java @@ -100,7 +100,7 @@ public class ExchangeRateApplicationService { GwLog gwLog = new GwLog(); gwLog.setType("汇率管理"); - gwLog.setBusinessId(String.valueOf(dto.getId())); + gwLog.setBusinessId(Long.valueOf(dto.getId())); gwLog.setRequestBody(JSONObject.toJSONString(body)); gwLog.setResponseBody(""); gwLog.setStatus(1); diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/gwLog/GwLogApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/gwLog/GwLogApplicationService.java index a029f9a7a..cea349b41 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/gwLog/GwLogApplicationService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/gwLog/GwLogApplicationService.java @@ -48,11 +48,9 @@ public class GwLogApplicationService { public GwLogPO selectByTypeAndId(GwLogDTO gwLogDTO) { GwLog gwLog =new GwLog(); - BeanUtils.copyProperties(gwLog,gwLogDTO); - GwLogPO po = gwLogMapper.selectByTypeAndId(gwLog); - GwLogPO po1 = gwLogMapper.selectByTypeAndId(gwLog); - // GwLogPO po2 = gwLogMapper.selectByTypeAndId(gwLogDTO); - // GwLogPO po3 = gwLogMapper.selectByTypeAndId(gwLogDTO); + BeanUtils.copyProperties(gwLogDTO,gwLog); + List po1 = gwLogMapper.selectByTypeAndId(gwLog); + GwLogPO po = po1.get(0); return po; } } diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/materialInfo/MaterialInfoApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/materialInfo/MaterialInfoApplicationService.java index 6eb33d6a4..81f50e552 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/materialInfo/MaterialInfoApplicationService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/materialInfo/MaterialInfoApplicationService.java @@ -95,7 +95,7 @@ public class MaterialInfoApplicationService { GwLog gwLog = new GwLog(); gwLog.setType("物料管理"); - gwLog.setBusinessId(String.valueOf(dto.getMaterialBaseInfoId())); + gwLog.setBusinessId(dto.getMaterialBaseInfoId()); gwLog.setRequestBody(JSONObject.toJSONString(body)); gwLog.setResponseBody(""); gwLog.setStatus(1); diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/erpEnterpriseUnit/entity/ErpEnterpriseUnit.java b/mhd_oms/src/main/java/com/mhd/oms/domain/erpEnterpriseUnit/entity/ErpEnterpriseUnit.java index aa41ceafa..132db5825 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/erpEnterpriseUnit/entity/ErpEnterpriseUnit.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/erpEnterpriseUnit/entity/ErpEnterpriseUnit.java @@ -38,6 +38,9 @@ public class ErpEnterpriseUnit { @ApiModelProperty(value = "推送人") private String pushBy; + @ApiModelProperty(value = "推送人姓名") + private String pushByName; + @ApiModelProperty(value = "所属组织ID") private Long organizationId; diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/gwLog/entity/GwLog.java b/mhd_oms/src/main/java/com/mhd/oms/domain/gwLog/entity/GwLog.java index de8e44b30..e44550fe3 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/gwLog/entity/GwLog.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/gwLog/entity/GwLog.java @@ -26,7 +26,7 @@ public class GwLog implements Serializable { private String type; @ApiModelProperty("业务ID") - private String businessId; + private Long businessId; @ApiModelProperty("请求报文") private String requestBody; diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/gwLog/repository/mapper/GwLogMapper.java b/mhd_oms/src/main/java/com/mhd/oms/domain/gwLog/repository/mapper/GwLogMapper.java index 8007d0446..b3871a637 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/gwLog/repository/mapper/GwLogMapper.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/gwLog/repository/mapper/GwLogMapper.java @@ -21,6 +21,6 @@ public interface GwLogMapper extends BaseMapper { */ List queryList(GwLogDTO gwLogDTO); - @Select("select * from gw_log where business_id = #{businessId} and type = #{type}") - GwLogPO selectByTypeAndId(@RequestBody GwLog gwLog); + @Select("select * from gw_log where business_id = #{businessId} and type = #{type} order by create_time desc") + List selectByTypeAndId(@RequestBody GwLog gwLog); }