修改businessId字段 查看报文

This commit is contained in:
zhaoqing
2026-05-14 11:11:03 +08:00
parent 3867226d3f
commit 43c64779ce
9 changed files with 33 additions and 24 deletions
@@ -194,8 +194,8 @@ public class BusinessDocumentOrderApplicationService {
// 2. 记录日志 // 2. 记录日志
GwLog gwLog = new GwLog(); GwLog gwLog = new GwLog();
gwLog.setType("进出口原始单证-物料推送"); gwLog.setType("进出口原始单证");
gwLog.setBusinessId(pushData.getMaterialCode()); gwLog.setBusinessId(Long.valueOf(pushData.getId()));
gwLog.setRequestBody(JSONObject.toJSONString(body)); gwLog.setRequestBody(JSONObject.toJSONString(body));
gwLog.setResponseBody(""); gwLog.setResponseBody("");
gwLog.setStatus(1); gwLog.setStatus(1);
@@ -102,6 +102,7 @@ public class ErpCountryApplicationService{
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
Long pushBy = loginUser != null ? loginUser.getUserid() : null; Long pushBy = loginUser != null ? loginUser.getUserid() : null;
String pushByName = loginUser != null ? loginUser.getUsername() : null;
Long organizationId = loginUser != null ? loginUser.getUserPo().getOrganizationId() : null; Long organizationId = loginUser != null ? loginUser.getUserPo().getOrganizationId() : null;
Long topOrganizationId = loginUser != null ? loginUser.getUserPo().getTopOrganizationId() : null; Long topOrganizationId = loginUser != null ? loginUser.getUserPo().getTopOrganizationId() : null;
String organizationName = loginUser != null ? loginUser.getUserPo().getOrganizationName() : null; String organizationName = loginUser != null ? loginUser.getUserPo().getOrganizationName() : null;
@@ -117,7 +118,7 @@ public class ErpCountryApplicationService{
GwLog gwLog = new GwLog(); GwLog gwLog = new GwLog();
gwLog.setType("企业国别"); gwLog.setType("企业国别");
gwLog.setBusinessId(String.valueOf(dto.getId())); gwLog.setBusinessId(dto.getId());
gwLog.setRequestBody(JSONObject.toJSONString(body)); gwLog.setRequestBody(JSONObject.toJSONString(body));
gwLog.setResponseBody(""); gwLog.setResponseBody("");
gwLog.setStatus(1); gwLog.setStatus(1);
@@ -130,7 +131,7 @@ public class ErpCountryApplicationService{
gwLog.setDelFlag(1); gwLog.setDelFlag(1);
gwLogMapper.insert(gwLog); gwLogMapper.insert(gwLog);
updatePushStatus(dto.getId(), 2, new Date(), pushBy); updatePushStatus(dto.getId(), 2, new Date(), pushBy,pushByName);
CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(PUSH_API_URL); HttpPost httpPost = new HttpPost(PUSH_API_URL);
@@ -146,12 +147,12 @@ public class ErpCountryApplicationService{
if (response.getStatusLine().getStatusCode() == 200) { if (response.getStatusLine().getStatusCode() == 200) {
gwLog.setStatus(2); gwLog.setStatus(2);
updatePushStatus(dto.getId(), 3, new Date(), pushBy); updatePushStatus(dto.getId(), 3, new Date(), pushBy,pushByName);
successCount++; successCount++;
} else { } else {
gwLog.setStatus(3); gwLog.setStatus(3);
gwLog.setErrorMsg(responseString); gwLog.setErrorMsg(responseString);
updatePushStatus(dto.getId(), 4, new Date(), pushBy); updatePushStatus(dto.getId(), 4, new Date(), pushBy,pushByName);
failCount++; failCount++;
failMsg.append("erpCountryCode:").append(dto.getErpCountryCode()).append("失败;"); failMsg.append("erpCountryCode:").append(dto.getErpCountryCode()).append("失败;");
} }
@@ -161,7 +162,7 @@ public class ErpCountryApplicationService{
gwLog.setStatus(3); gwLog.setStatus(3);
gwLog.setErrorMsg(e.getMessage()); gwLog.setErrorMsg(e.getMessage());
gwLogMapper.updateById(gwLog); gwLogMapper.updateById(gwLog);
updatePushStatus(dto.getId(), 4, new Date(), pushBy); updatePushStatus(dto.getId(), 4, new Date(), pushBy,pushByName);
failCount++; failCount++;
failMsg.append("erpCountryCode:").append(dto.getErpCountryCode()).append("异常:").append(e.getMessage()).append(";"); failMsg.append("erpCountryCode:").append(dto.getErpCountryCode()).append("异常:").append(e.getMessage()).append(";");
log.error("企业国别推送异常: id={}, error={}", dto.getId(), e.getMessage()); log.error("企业国别推送异常: id={}, error={}", dto.getId(), e.getMessage());
@@ -181,7 +182,7 @@ public class ErpCountryApplicationService{
return AjaxResult.success(resultMsg); 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(); ErpCountry entity = new ErpCountry();
entity.setId(id); entity.setId(id);
entity.setPushStatus(pushStatus); entity.setPushStatus(pushStatus);
@@ -191,6 +192,9 @@ public class ErpCountryApplicationService{
if (pushBy != null) { if (pushBy != null) {
entity.setPushBy(pushBy); entity.setPushBy(pushBy);
} }
if (pushByName != null) {
entity.setPushByName(pushByName);
}
erpCountryMapper.updateById(entity); erpCountryMapper.updateById(entity);
} }
@@ -98,6 +98,7 @@ public class ErpEnterpriseUnitApplicationService {
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
Long pushBy = loginUser != null ? loginUser.getUserid() : null; Long pushBy = loginUser != null ? loginUser.getUserid() : null;
String pushByName = loginUser != null ? loginUser.getUsername() : null;
Long organizationId = loginUser != null ? loginUser.getUserPo().getOrganizationId() : null; Long organizationId = loginUser != null ? loginUser.getUserPo().getOrganizationId() : null;
Long topOrganizationId = loginUser != null ? loginUser.getUserPo().getTopOrganizationId() : null; Long topOrganizationId = loginUser != null ? loginUser.getUserPo().getTopOrganizationId() : null;
String organizationName = loginUser != null ? loginUser.getUserPo().getOrganizationName() : null; String organizationName = loginUser != null ? loginUser.getUserPo().getOrganizationName() : null;
@@ -113,7 +114,7 @@ public class ErpEnterpriseUnitApplicationService {
GwLog gwLog = new GwLog(); GwLog gwLog = new GwLog();
gwLog.setType("企业单位"); gwLog.setType("企业单位");
gwLog.setBusinessId(String.valueOf(dto.getId())); gwLog.setBusinessId(Long.valueOf(dto.getId()));
gwLog.setRequestBody(JSONObject.toJSONString(body)); gwLog.setRequestBody(JSONObject.toJSONString(body));
gwLog.setResponseBody(""); gwLog.setResponseBody("");
gwLog.setStatus(1); gwLog.setStatus(1);
@@ -126,7 +127,7 @@ public class ErpEnterpriseUnitApplicationService {
gwLog.setDelFlag(1); gwLog.setDelFlag(1);
gwLogMapper.insert(gwLog); gwLogMapper.insert(gwLog);
updatePushStatus(dto.getId(), 2, new Date(), pushBy); updatePushStatus(dto.getId(), 2, new Date(), pushBy,pushByName);
CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(PUSH_API_URL); HttpPost httpPost = new HttpPost(PUSH_API_URL);
@@ -142,12 +143,12 @@ public class ErpEnterpriseUnitApplicationService {
if (response.getStatusLine().getStatusCode() == 200) { if (response.getStatusLine().getStatusCode() == 200) {
gwLog.setStatus(2); gwLog.setStatus(2);
updatePushStatus(dto.getId(), 3, new Date(), pushBy); updatePushStatus(dto.getId(), 3, new Date(), pushBy,pushByName);
successCount++; successCount++;
} else { } else {
gwLog.setStatus(3); gwLog.setStatus(3);
gwLog.setErrorMsg(responseString); gwLog.setErrorMsg(responseString);
updatePushStatus(dto.getId(), 4, new Date(), pushBy); updatePushStatus(dto.getId(), 4, new Date(), pushBy,pushByName);
failCount++; failCount++;
failMsg.append("erpUnitCode:").append(dto.getErpCode()).append("失败;"); failMsg.append("erpUnitCode:").append(dto.getErpCode()).append("失败;");
} }
@@ -157,7 +158,7 @@ public class ErpEnterpriseUnitApplicationService {
gwLog.setStatus(3); gwLog.setStatus(3);
gwLog.setErrorMsg(e.getMessage()); gwLog.setErrorMsg(e.getMessage());
gwLogMapper.updateById(gwLog); gwLogMapper.updateById(gwLog);
updatePushStatus(dto.getId(), 4, new Date(), pushBy); updatePushStatus(dto.getId(), 4, new Date(), pushBy,pushByName);
failCount++; failCount++;
failMsg.append("erpUnitCode:").append(dto.getErpCode()).append("异常:").append(e.getMessage()).append(";"); failMsg.append("erpUnitCode:").append(dto.getErpCode()).append("异常:").append(e.getMessage()).append(";");
log.error("企业单位推送异常: id={}, error={}", dto.getId(), e.getMessage()); log.error("企业单位推送异常: id={}, error={}", dto.getId(), e.getMessage());
@@ -177,7 +178,7 @@ public class ErpEnterpriseUnitApplicationService {
return AjaxResult.success(resultMsg); 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(); ErpEnterpriseUnit entity = new ErpEnterpriseUnit();
entity.setId(id); entity.setId(id);
entity.setPushStatus(pushStatus); entity.setPushStatus(pushStatus);
@@ -187,6 +188,9 @@ public class ErpEnterpriseUnitApplicationService {
if (pushBy != null) { if (pushBy != null) {
entity.setPushBy(String.valueOf(pushBy)); entity.setPushBy(String.valueOf(pushBy));
} }
if (pushByName != null) {
entity.setPushByName((pushByName));
}
erpEnterpriseUnitMapper.updateById(entity); erpEnterpriseUnitMapper.updateById(entity);
} }
@@ -100,7 +100,7 @@ public class ExchangeRateApplicationService {
GwLog gwLog = new GwLog(); GwLog gwLog = new GwLog();
gwLog.setType("汇率管理"); gwLog.setType("汇率管理");
gwLog.setBusinessId(String.valueOf(dto.getId())); gwLog.setBusinessId(Long.valueOf(dto.getId()));
gwLog.setRequestBody(JSONObject.toJSONString(body)); gwLog.setRequestBody(JSONObject.toJSONString(body));
gwLog.setResponseBody(""); gwLog.setResponseBody("");
gwLog.setStatus(1); gwLog.setStatus(1);
@@ -48,11 +48,9 @@ public class GwLogApplicationService {
public GwLogPO selectByTypeAndId(GwLogDTO gwLogDTO) { public GwLogPO selectByTypeAndId(GwLogDTO gwLogDTO) {
GwLog gwLog =new GwLog(); GwLog gwLog =new GwLog();
BeanUtils.copyProperties(gwLog,gwLogDTO); BeanUtils.copyProperties(gwLogDTO,gwLog);
GwLogPO po = gwLogMapper.selectByTypeAndId(gwLog); List<GwLogPO> po1 = gwLogMapper.selectByTypeAndId(gwLog);
GwLogPO po1 = gwLogMapper.selectByTypeAndId(gwLog); GwLogPO po = po1.get(0);
// GwLogPO po2 = gwLogMapper.selectByTypeAndId(gwLogDTO);
// GwLogPO po3 = gwLogMapper.selectByTypeAndId(gwLogDTO);
return po; return po;
} }
} }
@@ -95,7 +95,7 @@ public class MaterialInfoApplicationService {
GwLog gwLog = new GwLog(); GwLog gwLog = new GwLog();
gwLog.setType("物料管理"); gwLog.setType("物料管理");
gwLog.setBusinessId(String.valueOf(dto.getMaterialBaseInfoId())); gwLog.setBusinessId(dto.getMaterialBaseInfoId());
gwLog.setRequestBody(JSONObject.toJSONString(body)); gwLog.setRequestBody(JSONObject.toJSONString(body));
gwLog.setResponseBody(""); gwLog.setResponseBody("");
gwLog.setStatus(1); gwLog.setStatus(1);
@@ -38,6 +38,9 @@ public class ErpEnterpriseUnit {
@ApiModelProperty(value = "推送人") @ApiModelProperty(value = "推送人")
private String pushBy; private String pushBy;
@ApiModelProperty(value = "推送人姓名")
private String pushByName;
@ApiModelProperty(value = "所属组织ID") @ApiModelProperty(value = "所属组织ID")
private Long organizationId; private Long organizationId;
@@ -26,7 +26,7 @@ public class GwLog implements Serializable {
private String type; private String type;
@ApiModelProperty("业务ID") @ApiModelProperty("业务ID")
private String businessId; private Long businessId;
@ApiModelProperty("请求报文") @ApiModelProperty("请求报文")
private String requestBody; private String requestBody;
@@ -21,6 +21,6 @@ public interface GwLogMapper extends BaseMapper<GwLog> {
*/ */
List<GwLogPO> queryList(GwLogDTO gwLogDTO); List<GwLogPO> queryList(GwLogDTO gwLogDTO);
@Select("select * from gw_log where business_id = #{businessId} and type = #{type}") @Select("select * from gw_log where business_id = #{businessId} and type = #{type} order by create_time desc")
GwLogPO selectByTypeAndId(@RequestBody GwLog gwLog); List<GwLogPO> selectByTypeAndId(@RequestBody GwLog gwLog);
} }