jindie:日志完善
job:返回结果处理
master
xs 4 months ago
parent 26d29e9fc4
commit 97a0b60001

@ -22,32 +22,32 @@ public interface RemoteJindieService {
/** 同步单位信息*/ /** 同步单位信息*/
@PostMapping("/jindie/syncUnitInfoFromErp") @PostMapping("/jindie/syncUnitInfoFromErp")
R<Integer> syncUnitInfoFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source); R<AjaxResult> syncUnitInfoFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/** 同步供应商*/ /** 同步供应商*/
@PostMapping("/jindie/syncSupplierInfoFromErp") @PostMapping("/jindie/syncSupplierInfoFromErp")
R<Integer> syncSupplierInfoFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source); R<AjaxResult> syncSupplierInfoFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/** 同步物料*/ /** 同步物料*/
@PostMapping("/jindie/syncMaterialInfoFromErp") @PostMapping("/jindie/syncMaterialInfoFromErp")
R<Integer> syncMaterialInfoFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source); R<AjaxResult> syncMaterialInfoFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/** 同步项目信息*/ /** 同步项目信息*/
@PostMapping("/jindie/syncProjectInfoFromErp") @PostMapping("/jindie/syncProjectInfoFromErp")
R<Integer> syncProjectInfoFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source); R<AjaxResult> syncProjectInfoFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/** 同步销售订单*/ /** 同步销售订单*/
@PostMapping("/jindie/syncSaleOrderFromErp") @PostMapping("/jindie/syncSaleOrderFromErp")
R<Integer> syncSaleOrderFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source); R<AjaxResult> syncSaleOrderFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/** 同步采购订单*/ /** 同步采购订单*/
@PostMapping("/jindie/syncPurchaseOrderFromErp") @PostMapping("/jindie/syncPurchaseOrderFromErp")
R<Integer> syncPurchaseOrderFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source); R<AjaxResult> syncPurchaseOrderFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/** 同步收料通知单*/ /** 同步收料通知单*/
@PostMapping("/jindie/syncPurchaseReceiveBillFromErp") @PostMapping("/jindie/syncPurchaseReceiveBillFromErp")
R<Integer> syncPurchaseReceiveBillFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source); R<AjaxResult> syncPurchaseReceiveBillFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/** 采购申请单excel导入*/ /** 采购申请单excel导入*/

@ -17,37 +17,37 @@ public class RemoteJindieFallbackFactory implements FallbackFactory<RemoteJindie
public RemoteJindieService create(Throwable throwable) { public RemoteJindieService create(Throwable throwable) {
return new RemoteJindieService() { return new RemoteJindieService() {
@Override @Override
public R<Integer> syncUnitInfoFromErp(ErpSyncInfoVo erpSyncInfoVo, String source) { public R<AjaxResult> syncUnitInfoFromErp(ErpSyncInfoVo erpSyncInfoVo, String source) {
return R.fail("同步单位信息失败:" + throwable.getMessage()); return R.fail("同步单位信息失败:" + throwable.getMessage());
} }
@Override @Override
public R<Integer> syncSupplierInfoFromErp(ErpSyncInfoVo erpSyncInfoVo,String source) { public R<AjaxResult> syncSupplierInfoFromErp(ErpSyncInfoVo erpSyncInfoVo,String source) {
return R.fail("同步供应商信息失败:" + throwable.getMessage()); return R.fail("同步供应商信息失败:" + throwable.getMessage());
} }
@Override @Override
public R<Integer> syncMaterialInfoFromErp(ErpSyncInfoVo erpSyncInfoVo,String source) { public R<AjaxResult> syncMaterialInfoFromErp(ErpSyncInfoVo erpSyncInfoVo,String source) {
return R.fail("同步物料信息失败:" + throwable.getMessage()); return R.fail("同步物料信息失败:" + throwable.getMessage());
} }
@Override @Override
public R<Integer> syncProjectInfoFromErp(ErpSyncInfoVo erpSyncInfoVo,String source) { public R<AjaxResult> syncProjectInfoFromErp(ErpSyncInfoVo erpSyncInfoVo,String source) {
return R.fail("同步项目信息失败:" + throwable.getMessage()); return R.fail("同步项目信息失败:" + throwable.getMessage());
} }
@Override @Override
public R<Integer> syncSaleOrderFromErp(ErpSyncInfoVo erpSyncInfoVo,String source) { public R<AjaxResult> syncSaleOrderFromErp(ErpSyncInfoVo erpSyncInfoVo,String source) {
return R.fail("同步销售订单信息失败:" + throwable.getMessage()); return R.fail("同步销售订单信息失败:" + throwable.getMessage());
} }
@Override @Override
public R<Integer> syncPurchaseOrderFromErp(ErpSyncInfoVo erpSyncInfoVo,String source) { public R<AjaxResult> syncPurchaseOrderFromErp(ErpSyncInfoVo erpSyncInfoVo,String source) {
return R.fail("同步采购订单信息失败:" + throwable.getMessage()); return R.fail("同步采购订单信息失败:" + throwable.getMessage());
} }
@Override @Override
public R<Integer> syncPurchaseReceiveBillFromErp(ErpSyncInfoVo erpSyncInfoVo, String source) { public R<AjaxResult> syncPurchaseReceiveBillFromErp(ErpSyncInfoVo erpSyncInfoVo, String source) {
return R.fail("同步收料通知单信息失败:" + throwable.getMessage()); return R.fail("同步收料通知单信息失败:" + throwable.getMessage());
} }

@ -36,14 +36,14 @@ public class KingdeeErpSyncController {
* erpMES * erpMES
*/ */
@PostMapping("/syncDeptInfoFromErp") @PostMapping("/syncDeptInfoFromErp")
@Log(title = "ERP部门信息", businessType = BusinessType.INSERT) // @Log(title = "ERP部门信息", businessType = BusinessType.INSERT)
// @InnerAuth // @InnerAuth
public AjaxResult syncDeptInfoFromErp() { public AjaxResult syncDeptInfoFromErp() {
try { try {
return AjaxResult.success(kingdeeErpSyncService.syncDeptInfoFromErp(0)); return AjaxResult.success(kingdeeErpSyncService.syncDeptInfoFromErp(0));
} catch (Exception e) { } catch (Exception e) {
logger.error("同步部门信息错误:" + e.getMessage()); logger.error("同步部门信息错误:" + e.getMessage());
return AjaxResult.error(); return AjaxResult.error(e.getMessage());
} }
} }
@ -51,14 +51,14 @@ public class KingdeeErpSyncController {
* erpMES * erpMES
*/ */
@PostMapping("/syncUnitInfoFromErp") @PostMapping("/syncUnitInfoFromErp")
@Log(title = "ERP单位信息", businessType = BusinessType.INSERT) // @Log(title = "ERP单位信息", businessType = BusinessType.INSERT)
// @InnerAuth // @InnerAuth
public AjaxResult syncUnitInfoFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo) { public AjaxResult syncUnitInfoFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo) {
try { try {
return AjaxResult.success(kingdeeErpSyncService.syncUnitInfoFromErp(0, erpSyncInfoVo)); return AjaxResult.success(kingdeeErpSyncService.syncUnitInfoFromErp(0, erpSyncInfoVo));
} catch (Exception e) { } catch (Exception e) {
logger.error("同步单位信息错误:" + e.getMessage()); logger.error("同步单位信息错误:" + e.getMessage());
return AjaxResult.error(); return AjaxResult.error(e.getMessage());
} }
} }
@ -66,14 +66,14 @@ public class KingdeeErpSyncController {
* erpMES * erpMES
*/ */
@PostMapping("/syncSupplierInfoFromErp") @PostMapping("/syncSupplierInfoFromErp")
@Log(title = "ERP供应商信息", businessType = BusinessType.INSERT) // @Log(title = "ERP供应商信息", businessType = BusinessType.INSERT)
@InnerAuth @InnerAuth
public AjaxResult syncSupplierInfoFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo) { public AjaxResult syncSupplierInfoFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo) {
try { try {
return AjaxResult.success(kingdeeErpSyncService.syncSupplierInfoFromErp(0, erpSyncInfoVo)); return AjaxResult.success(kingdeeErpSyncService.syncSupplierInfoFromErp(0, erpSyncInfoVo));
} catch (Exception e) { } catch (Exception e) {
logger.error("同步供应商信息错误:" + e.getMessage()); logger.error("同步供应商信息错误:" + e.getMessage());
return AjaxResult.error(); return AjaxResult.error(e.getMessage());
} }
} }
@ -88,7 +88,7 @@ public class KingdeeErpSyncController {
return AjaxResult.success(kingdeeErpSyncService.syncMaterialInfoFromErp(0, erpSyncInfoVo)); return AjaxResult.success(kingdeeErpSyncService.syncMaterialInfoFromErp(0, erpSyncInfoVo));
} catch (Exception e) { } catch (Exception e) {
logger.error("同步物料信息错误:" + e.getMessage()); logger.error("同步物料信息错误:" + e.getMessage());
return AjaxResult.error(); return AjaxResult.error(e.getMessage());
} }
} }
@ -98,14 +98,14 @@ public class KingdeeErpSyncController {
* ERPMES * ERPMES
*/ */
@PostMapping("/syncProjectInfoFromErp") @PostMapping("/syncProjectInfoFromErp")
@Log(title = "ERP项目信息", businessType = BusinessType.INSERT) // @Log(title = "ERP项目信息", businessType = BusinessType.INSERT)
@InnerAuth @InnerAuth
public AjaxResult syncProjectInfoFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo) { public AjaxResult syncProjectInfoFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo) {
try { try {
return AjaxResult.success(kingdeeErpSyncService.syncProjectInfoFromErp(0, erpSyncInfoVo)); return AjaxResult.success(kingdeeErpSyncService.syncProjectInfoFromErp(0, erpSyncInfoVo));
} catch (Exception e) { } catch (Exception e) {
logger.error("同步项目信息错误:" + e.getMessage()); logger.error("同步项目信息错误:" + e.getMessage());
return AjaxResult.error(); return AjaxResult.error(e.getMessage());
} }
} }
@ -113,14 +113,14 @@ public class KingdeeErpSyncController {
* ERPERP * ERPERP
*/ */
@PostMapping("/syncSaleOrderFromErp") @PostMapping("/syncSaleOrderFromErp")
@Log(title = "ERP销售订单", businessType = BusinessType.INSERT) // @Log(title = "ERP销售订单", businessType = BusinessType.INSERT)
// @InnerAuth // @InnerAuth
public AjaxResult syncSaleOrderFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo) { public AjaxResult syncSaleOrderFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo) {
try { try {
return AjaxResult.success(kingdeeErpSyncService.syncSaleOrderFromErp(0, erpSyncInfoVo)); return AjaxResult.success(kingdeeErpSyncService.syncSaleOrderFromErp(0, erpSyncInfoVo));
} catch (Exception e) { } catch (Exception e) {
logger.error("同步销售订单信息错误:" + e.getMessage()); logger.error("同步销售订单信息错误:" + e.getMessage());
return AjaxResult.error(); return AjaxResult.error(e.getMessage());
} }
} }
@ -129,14 +129,14 @@ public class KingdeeErpSyncController {
* ERPMES * ERPMES
*/ */
@PostMapping("/syncPurchaseOrderFromErp") @PostMapping("/syncPurchaseOrderFromErp")
@Log(title = "ERP采购订单", businessType = BusinessType.INSERT) // @Log(title = "ERP采购订单", businessType = BusinessType.INSERT)
@InnerAuth @InnerAuth
public AjaxResult syncPurchaseOrderFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo) { public AjaxResult syncPurchaseOrderFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo) {
try { try {
return AjaxResult.success(kingdeeErpSyncService.syncPurchaseOrderFromErp(0, erpSyncInfoVo)); return AjaxResult.success(kingdeeErpSyncService.syncPurchaseOrderFromErp(0, erpSyncInfoVo));
} catch (Exception e) { } catch (Exception e) {
logger.error("同步采购订单信息错误:" + e.getMessage()); logger.error("同步采购订单信息错误:" + e.getMessage());
return AjaxResult.error(); return AjaxResult.error(e.getMessage());
} }
} }
@ -150,8 +150,8 @@ public class KingdeeErpSyncController {
try { try {
return AjaxResult.success(kingdeeErpSyncService.syncPurchaseReceiveBillFromErp(0, erpSyncInfoVo)); return AjaxResult.success(kingdeeErpSyncService.syncPurchaseReceiveBillFromErp(0, erpSyncInfoVo));
} catch (Exception e) { } catch (Exception e) {
logger.error("同步采购单信息错误:" + e.getMessage()); logger.error("同步采购收料单信息错误:" + e.getMessage());
return AjaxResult.error(); return AjaxResult.error(e.getMessage());
} }
} }
@ -163,7 +163,7 @@ public class KingdeeErpSyncController {
* @return {"msg": "{"IsSuccess": true,"Errors": [],"SuccessEntitys": [{"Id": "154898","Number": "CGSQ010785","DIndex": 0}]}", "code": 200} * @return {"msg": "{"IsSuccess": true,"Errors": [],"SuccessEntitys": [{"Id": "154898","Number": "CGSQ010785","DIndex": 0}]}", "code": 200}
*/ */
@PostMapping(("/singleSavePurchaseRequisition")) @PostMapping(("/singleSavePurchaseRequisition"))
@Log(title = "ERP采购申请单", businessType = BusinessType.INSERT) // @Log(title = "ERP采购申请单", businessType = BusinessType.INSERT)
@InnerAuth @InnerAuth
public AjaxResult singleSavePurchaseRequisition(@RequestBody String params) { public AjaxResult singleSavePurchaseRequisition(@RequestBody String params) {
try { try {

@ -121,7 +121,7 @@ public class KingdeeErpService {
Gson gson = new Gson(); Gson gson = new Gson();
//对返回结果进行解析和校验 //对返回结果进行解析和校验
RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class); RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class);
logger.info("singleSavePurchaseRequisition接口调用成功|请求参数:" + saveParams + "|返回结果:" + resultJson); logger.info("singleSavePurchaseRequisition请求参数:" + saveParams + "|返回结果:" + resultJson);
RepoStatus responseStatus = repoRet.getResult().getResponseStatus(); RepoStatus responseStatus = repoRet.getResult().getResponseStatus();
List<SysOperLog> sysOperLogList = new ArrayList<>(); List<SysOperLog> sysOperLogList = new ArrayList<>();
Date currentDate = new Date(); Date currentDate = new Date();

@ -2,14 +2,18 @@ package com.hw.jindie.service.impl;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.hw.common.core.constant.MesConstants; import com.hw.common.core.constant.MesConstants;
import com.hw.common.core.constant.SecurityConstants; import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.SystemConstants; import com.hw.common.core.constant.SystemConstants;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils; import com.hw.common.core.utils.StringUtils;
import com.hw.common.log.enums.BusinessType; import com.hw.common.log.enums.BusinessType;
import com.hw.jindie.api.domain.vo.ErpSyncInfoVo; import com.hw.jindie.api.domain.vo.ErpSyncInfoVo;
import com.hw.jindie.config.KingdeeConfig; import com.hw.jindie.config.KingdeeConfig;
import com.hw.jindie.controller.KingdeeErpSyncController;
import com.hw.jindie.domain.*; import com.hw.jindie.domain.*;
import com.hw.jindie.mapper.*; import com.hw.jindie.mapper.*;
import com.hw.jindie.service.IKingdeeErpSyncService; import com.hw.jindie.service.IKingdeeErpSyncService;
@ -18,6 +22,9 @@ import com.hw.system.api.RemoteSysCommonService;
import com.hw.system.api.domain.SysOperLog; import com.hw.system.api.domain.SysOperLog;
import com.hw.system.api.domain.common.SysPointRouter; import com.hw.system.api.domain.common.SysPointRouter;
import com.kingdee.bos.webapi.sdk.K3CloudApi; import com.kingdee.bos.webapi.sdk.K3CloudApi;
import com.mysql.cj.log.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -36,6 +43,8 @@ import java.util.List;
*/ */
@Service @Service
public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService { public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
private static final Logger logger = LoggerFactory.getLogger(KingdeeErpSyncController.class);
@Autowired @Autowired
private MesBaseMaterialInfoMapper mesBaseMaterialInfoMapper; private MesBaseMaterialInfoMapper mesBaseMaterialInfoMapper;
@Autowired @Autowired
@ -223,7 +232,16 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
} }
// System.out.println(queryJson.toString()); // System.out.println(queryJson.toString());
String result = api.billQuery(queryJson.toString()); String result = api.billQuery(queryJson.toString());
JsonElement element = JsonParser.parseString(result);
if (element.isJsonObject()) {
logger.error("Sync BD_Unit query parameter:"+queryJson.toString()+"\nresult:"+result);
throw new ServiceException(result);
}
logger.info("Sync BD_Unit query parameter:"+queryJson.toString()+"\nresult:"+result);
if (StringUtils.isEmpty(result)) { if (StringUtils.isEmpty(result)) {
return 1; return 1;
} }
@ -355,8 +373,15 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
// "FieldKeys": "FNumber,FName,FBaseUnitId,FSpecification,FNETWEIGHT,FGROSSWEIGHT,FCreateDate,FModifyDate,FApproveDate", // "FieldKeys": "FNumber,FName,FBaseUnitId,FSpecification,FNETWEIGHT,FGROSSWEIGHT,FCreateDate,FModifyDate,FApproveDate",
// "FilterString": "FDocumentStatus='C' AND FCreateDate>'2022-01-01' and FMaterialGroup.FNUMBER IN ('28')", // "FilterString": "FDocumentStatus='C' AND FCreateDate>'2022-01-01' and FMaterialGroup.FNUMBER IN ('28')",
String result = api.billQuery(queryJson.toString()); String result = api.billQuery(queryJson.toString());
JsonElement element = JsonParser.parseString(result);
if (element.isJsonObject()) {
logger.error("Sync BD_Supplier query parameter:"+queryJson.toString()+"\nresult:"+result);
throw new ServiceException(result);
}
logger.info("Sync BD_Supplier query parameter:"+queryJson.toString()+"\nresult:"+result);
if (StringUtils.isEmpty(result)) { if (StringUtils.isEmpty(result)) {
return 1; return 1;
} }
@ -509,7 +534,15 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
System.out.println(queryJson.toString()); System.out.println(queryJson.toString());
String result = api.billQuery(queryJson.toString()); String result = api.billQuery(queryJson.toString());
JsonElement element = JsonParser.parseString(result);
if (element.isJsonObject()) {
logger.error("Sync BD_Material query parameter:"+queryJson.toString()+"\nresult:"+result);
throw new ServiceException(result);
}
logger.info("Sync BD_Material query parameter:"+queryJson.toString()+"\nresult:"+result);
if (StringUtils.isEmpty(result)) { if (StringUtils.isEmpty(result)) {
return 1; return 1;
} }
@ -704,8 +737,15 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
queryJson.put("FilterString", filterStringBuilder.toString()); queryJson.put("FilterString", filterStringBuilder.toString());
System.out.println(queryJson.toString()); System.out.println(queryJson.toString());
String result = api.billQuery(queryJson.toString()); String result = api.billQuery(queryJson.toString());
JsonElement element = JsonParser.parseString(result);
if (element.isJsonObject()) {
logger.error("Sync SAL_SaleOrder query parameter:"+queryJson.toString()+"\nresult:"+result);
throw new ServiceException(result);
}
logger.info("Sync SAL_SaleOrder query parameter:"+queryJson.toString()+"\nresult:"+result);
JSONArray resultArray = JSONArray.parseArray(result); JSONArray resultArray = JSONArray.parseArray(result);
System.out.println(resultArray.size()); System.out.println(resultArray.size());
System.out.println("销售订单单据查询接口: " + result); System.out.println("销售订单单据查询接口: " + result);
@ -894,6 +934,14 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
System.out.println(queryJson.toString()); System.out.println(queryJson.toString());
String result = api.billQuery(queryJson.toString()); String result = api.billQuery(queryJson.toString());
JsonElement element = JsonParser.parseString(result);
if (element.isJsonObject()) {
logger.error("Sync TOND_ProjectFile query parameter:"+queryJson.toString()+"\nresult:"+result);
throw new ServiceException(result);
}
logger.info("Sync TOND_ProjectFile query parameter:"+queryJson.toString()+"\nresult:"+result);
JSONArray resultArray = JSONArray.parseArray(result); JSONArray resultArray = JSONArray.parseArray(result);
System.out.println(resultArray.size()); System.out.println(resultArray.size());
System.out.println("项目信息单据查询接口: " + result); System.out.println("项目信息单据查询接口: " + result);
@ -1047,6 +1095,14 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
// System.out.println(queryJson.toString()); // System.out.println(queryJson.toString());
String result = api.billQuery(queryJson.toString()); String result = api.billQuery(queryJson.toString());
JsonElement element = JsonParser.parseString(result);
if (element.isJsonObject()) {
logger.error("Sync PUR_PurchaseOrder query parameter:"+queryJson.toString()+"\nresult:"+result);
throw new ServiceException(result);
}
logger.info("Sync PUR_PurchaseOrder query parameter:"+queryJson.toString()+"\nresult:"+result);
JSONArray resultArray = JSONArray.parseArray(result); JSONArray resultArray = JSONArray.parseArray(result);
// System.out.println(resultArray.size()); // System.out.println(resultArray.size());
// System.out.println("采购订单单据查询接口: " + result); // System.out.println("采购订单单据查询接口: " + result);
@ -1211,7 +1267,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
/** /**
* @throws Exception * @throws Exception
* @DescrptionERP * @DescrptionERP
*/ */
public int syncPurchaseReceiveBillFromErp(int startRow, String maxErpModifyDate) throws Exception { public int syncPurchaseReceiveBillFromErp(int startRow, String maxErpModifyDate) throws Exception {
// maxErpModifyDate = "2022-03-23 11:30:57"; // maxErpModifyDate = "2022-03-23 11:30:57";
@ -1256,6 +1312,14 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
// System.out.println(queryJson.toString()); // System.out.println(queryJson.toString());
String result = api.billQuery(queryJson.toString()); String result = api.billQuery(queryJson.toString());
JsonElement element = JsonParser.parseString(result);
if (element.isJsonObject()) {
logger.error("Sync PUR_ReceiveBill query parameter:"+queryJson.toString()+"\nresult:"+result);
throw new ServiceException(result);
}
logger.info("Sync PUR_ReceiveBill query parameter:"+queryJson.toString()+"\nresult:"+result);
JSONArray resultArray = JSONArray.parseArray(result); JSONArray resultArray = JSONArray.parseArray(result);
// System.out.println(resultArray.size()); // System.out.println(resultArray.size());
// System.out.println("采购订单单据查询接口: " + result); // System.out.println("采购订单单据查询接口: " + result);

@ -1,7 +1,10 @@
package com.hw.job.task; package com.hw.job.task;
import com.hw.common.core.constant.SecurityConstants; import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.domain.R;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.dms.api.RemoteDmsService; import com.hw.dms.api.RemoteDmsService;
import com.hw.ems.api.RemoteEmsService; import com.hw.ems.api.RemoteEmsService;
import com.hw.jindie.api.RemoteJindieService; import com.hw.jindie.api.RemoteJindieService;
@ -22,8 +25,7 @@ import java.util.Date;
* @author ruoyi * @author ruoyi
*/ */
@Component("ryTask") @Component("ryTask")
public class RyTask public class RyTask {
{
@Autowired @Autowired
private RemoteEmsService remoteEmsService; private RemoteEmsService remoteEmsService;
@Autowired @Autowired
@ -37,133 +39,174 @@ public class RyTask
@Autowired @Autowired
private RemoteSysCommonService remoteSysCommonService; private RemoteSysCommonService remoteSysCommonService;
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
{
System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i)); System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
} }
public void ryParams(String params) public void ryParams(String params) {
{
System.out.println("执行有参方法:" + params); System.out.println("执行有参方法:" + params);
} }
public void ryNoParams() public void ryNoParams() {
{
System.out.println("执行无参方法"); System.out.println("执行无参方法");
} }
public void deviceOfflineTimingTask(){
public void deviceOfflineTimingTask() {
System.out.println("++设备离线告警+开始++deviceOfflineTimingTask+++++"); System.out.println("++设备离线告警+开始++deviceOfflineTimingTask+++++");
remoteEmsService.deviceOfflineTimingTask(SecurityConstants.INNER); remoteEmsService.deviceOfflineTimingTask(SecurityConstants.INNER);
} }
public void thresholdTimingTask(){ public void thresholdTimingTask() {
System.out.println("++计量设备阈值告警+开始++thresholdTimingTask+++++"); System.out.println("++计量设备阈值告警+开始++thresholdTimingTask+++++");
remoteEmsService.thresholdTimingTask(SecurityConstants.INNER); remoteEmsService.thresholdTimingTask(SecurityConstants.INNER);
} }
public void dnthAlarmTask(){ public void dnthAlarmTask() {
System.out.println("++能源报警任务+开始++thresholdTimingTask+++++"); System.out.println("++能源报警任务+开始++thresholdTimingTask+++++");
remoteEmsService.dnthAlarmTask(SecurityConstants.INNER); remoteEmsService.dnthAlarmTask(SecurityConstants.INNER);
} }
public void getDnbInstantByJob(){ public void getDnbInstantByJob() {
System.out.println("++电整点数据获取+开始++getDnbInstantByJob+++++"); System.out.println("++电整点数据获取+开始++getDnbInstantByJob+++++");
remoteEmsService.getDnbInstantByJob(SecurityConstants.INNER); remoteEmsService.getDnbInstantByJob(SecurityConstants.INNER);
} }
public void getDmsRepairInstance(String planRepairId){
public void getDmsRepairInstance(String planRepairId) {
System.out.println("++创建检修工单++getDmsRepairInstance"); System.out.println("++创建检修工单++getDmsRepairInstance");
remoteDmsService.getDmsRepairInstance(SecurityConstants.INNER, planRepairId); remoteDmsService.getDmsRepairInstance(SecurityConstants.INNER, planRepairId);
} }
public void getDmsBillsInstance(String dmsBillsInstanceId){
public void getDmsBillsInstance(String dmsBillsInstanceId) {
System.out.println("++创建巡检工单++getDmsRepairInstance"); System.out.println("++创建巡检工单++getDmsRepairInstance");
remoteDmsService.getDmsBillsInstance(SecurityConstants.INNER, dmsBillsInstanceId); remoteDmsService.getDmsBillsInstance(SecurityConstants.INNER, dmsBillsInstanceId);
} }
public void getDmsBillsLube(String planLubeCode){
public void getDmsBillsLube(String planLubeCode) {
System.out.println("++创建润滑工单++getDmsLubeInstance"); System.out.println("++创建润滑工单++getDmsLubeInstance");
remoteDmsService.getDmsBillsLube(SecurityConstants.INNER, planLubeCode); remoteDmsService.getDmsBillsLube(SecurityConstants.INNER, planLubeCode);
} }
public void getDmsBillsMaint(String planMaintCode){
public void getDmsBillsMaint(String planMaintCode) {
System.out.println("++创建保养工单++getDmsMaintInstance"); System.out.println("++创建保养工单++getDmsMaintInstance");
remoteDmsService.getDmsBillsMaintInstance(SecurityConstants.INNER,planMaintCode); remoteDmsService.getDmsBillsMaintInstance(SecurityConstants.INNER, planMaintCode);
} }
public void syncUnitInfoFromErp(String maxErpModifyDate){ public void syncUnitInfoFromErp(String maxErpModifyDate) {
ErpSyncInfoVo erpSyncInfoVo = new ErpSyncInfoVo(); ErpSyncInfoVo erpSyncInfoVo = new ErpSyncInfoVo();
erpSyncInfoVo.setMaxErpModifyDate(maxErpModifyDate); erpSyncInfoVo.setMaxErpModifyDate(maxErpModifyDate);
System.out.println("++同步ERP中物料供应商++ErpSupplierInfo"); System.out.println("++同步ERP中物料供应商++ErpSupplierInfo");
remoteJindieService.syncUnitInfoFromErp(erpSyncInfoVo,SecurityConstants.INNER); R<AjaxResult> resultR = remoteJindieService.syncUnitInfoFromErp(erpSyncInfoVo, SecurityConstants.INNER);
if (resultR.getCode() == 500) {
throw new ServiceException("同步物料失败:"+resultR.getMsg());
}
} }
public void syncSupplierInfoFromErp(String maxErpModifyDate){ public void syncSupplierInfoFromErp(String maxErpModifyDate) {
ErpSyncInfoVo erpSyncInfoVo = new ErpSyncInfoVo(); ErpSyncInfoVo erpSyncInfoVo = new ErpSyncInfoVo();
erpSyncInfoVo.setMaxErpModifyDate(maxErpModifyDate); erpSyncInfoVo.setMaxErpModifyDate(maxErpModifyDate);
System.out.println("++同步ERP中物料供应商++ErpSupplierInfo"); System.out.println("++同步ERP中物料供应商++ErpSupplierInfo");
remoteJindieService.syncSupplierInfoFromErp(erpSyncInfoVo,SecurityConstants.INNER); R<AjaxResult> resultR = remoteJindieService.syncSupplierInfoFromErp(erpSyncInfoVo, SecurityConstants.INNER);
if (resultR.getCode() == 500) {
throw new ServiceException("同步物料失败:"+resultR.getMsg());
}
} }
public void syncMaterialInfoFromErp(String maxErpModifyDate){
public void syncMaterialInfoFromErp(String maxErpModifyDate) {
ErpSyncInfoVo erpSyncInfoVo = new ErpSyncInfoVo(); ErpSyncInfoVo erpSyncInfoVo = new ErpSyncInfoVo();
erpSyncInfoVo.setMaxErpModifyDate(maxErpModifyDate); erpSyncInfoVo.setMaxErpModifyDate(maxErpModifyDate);
System.out.println("++同步ERP中物料信息++ErpMesMaterialInfo"); System.out.println("++同步ERP中物料信息++ErpMesMaterialInfo");
remoteJindieService.syncMaterialInfoFromErp(erpSyncInfoVo,SecurityConstants.INNER); R<AjaxResult> resultR = remoteJindieService.syncMaterialInfoFromErp(erpSyncInfoVo, SecurityConstants.INNER);
System.out.println("r"+resultR.getCode()+"=="+resultR.getData()+"--"+resultR.getMsg());
if (resultR.getCode() == 500) {
throw new ServiceException("同步物料失败:"+resultR.getMsg());
}
} }
public void syncProjectInfoFromErp(String maxErpModifyDate){ public void syncProjectInfoFromErp(String maxErpModifyDate) {
ErpSyncInfoVo erpSyncInfoVo = new ErpSyncInfoVo(); ErpSyncInfoVo erpSyncInfoVo = new ErpSyncInfoVo();
erpSyncInfoVo.setMaxErpModifyDate(maxErpModifyDate); erpSyncInfoVo.setMaxErpModifyDate(maxErpModifyDate);
System.out.println("++同步ERP中项目信息++ErpProjectInfo"); System.out.println("++同步ERP中项目信息++ErpProjectInfo");
remoteJindieService.syncProjectInfoFromErp(erpSyncInfoVo,SecurityConstants.INNER); R<AjaxResult> resultR = remoteJindieService.syncProjectInfoFromErp(erpSyncInfoVo, SecurityConstants.INNER);
if (resultR.getCode() == 500) {
throw new ServiceException("同步物料失败:"+resultR.getMsg());
}
} }
public void syncSaleOrderFromErp(String maxErpModifyDate){ public void syncSaleOrderFromErp(String maxErpModifyDate) {
ErpSyncInfoVo erpSyncInfoVo = new ErpSyncInfoVo(); ErpSyncInfoVo erpSyncInfoVo = new ErpSyncInfoVo();
erpSyncInfoVo.setMaxErpModifyDate(maxErpModifyDate); erpSyncInfoVo.setMaxErpModifyDate(maxErpModifyDate);
System.out.println("++同步ERP中销售订单信息++ErpSaleOrder"); System.out.println("++同步ERP中销售订单信息++ErpSaleOrder");
remoteJindieService.syncSaleOrderFromErp(erpSyncInfoVo,SecurityConstants.INNER); R<AjaxResult> resultR =remoteJindieService.syncSaleOrderFromErp(erpSyncInfoVo, SecurityConstants.INNER);
if (resultR.getCode() == 500) {
throw new ServiceException("同步物料失败:"+resultR.getMsg());
}
} }
public void syncPurchaseOrderFromErp(String maxErpModifyDate){ public void syncPurchaseOrderFromErp(String maxErpModifyDate) {
ErpSyncInfoVo erpSyncInfoVo = new ErpSyncInfoVo(); ErpSyncInfoVo erpSyncInfoVo = new ErpSyncInfoVo();
erpSyncInfoVo.setMaxErpModifyDate(maxErpModifyDate); erpSyncInfoVo.setMaxErpModifyDate(maxErpModifyDate);
System.out.println("++同步ERP中采购订单信息++syncPurchaseOrderFromErp"); System.out.println("++同步ERP中采购订单信息++syncPurchaseOrderFromErp");
remoteJindieService.syncPurchaseOrderFromErp(erpSyncInfoVo,SecurityConstants.INNER); R<AjaxResult> resultR =remoteJindieService.syncPurchaseOrderFromErp(erpSyncInfoVo, SecurityConstants.INNER);
if (resultR.getCode() == 500) {
throw new ServiceException("同步物料失败:"+resultR.getMsg());
}
} }
public void syncPurchaseReceiveBillFromErp(String maxErpModifyDate){ public void syncPurchaseReceiveBillFromErp(String maxErpModifyDate) {
ErpSyncInfoVo erpSyncInfoVo = new ErpSyncInfoVo(); ErpSyncInfoVo erpSyncInfoVo = new ErpSyncInfoVo();
erpSyncInfoVo.setMaxErpModifyDate(maxErpModifyDate); erpSyncInfoVo.setMaxErpModifyDate(maxErpModifyDate);
System.out.println("++同步ERP中收料通知单信息++syncPurchaseReceiveBillFromErp"); System.out.println("++同步ERP中收料通知单信息++syncPurchaseReceiveBillFromErp");
remoteJindieService.syncPurchaseReceiveBillFromErp(erpSyncInfoVo,SecurityConstants.INNER); R<AjaxResult> resultR =remoteJindieService.syncPurchaseReceiveBillFromErp(erpSyncInfoVo, SecurityConstants.INNER);
if (resultR.getCode() == 500) {
throw new ServiceException("同步物料失败:"+resultR.getMsg());
}
} }
public void syncInventoryInformationToERP(){ public void syncInventoryInformationToERP() {
System.out.println(new Date()+"++定时同步原材料入库信息给ERP++syncInventoryInformationToERP"); System.out.println(new Date() + "++定时同步原材料入库信息给ERP++syncInventoryInformationToERP");
remoteWmsService.synchronizeInventoryInformationToERP(SecurityConstants.INNER); R<AjaxResult> resultR = remoteWmsService.synchronizeInventoryInformationToERP(SecurityConstants.INNER);
if (resultR.getCode() == 500) {
throw new ServiceException("同步物料失败:"+resultR.getMsg());
}
} }
public void syncRawMaterialDeliveryInformationToERP(){ public void syncRawMaterialDeliveryInformationToERP() {
System.out.println(new Date()+"++定时同步原材料出库信息给ERP++syncRawMaterialDeliveryInformationToERP"); System.out.println(new Date() + "++定时同步原材料出库信息给ERP++syncRawMaterialDeliveryInformationToERP");
remoteWmsService.synchronizeRawMaterialDeliveryInformationToERP(SecurityConstants.INNER); R<AjaxResult> resultR = remoteWmsService.synchronizeRawMaterialDeliveryInformationToERP(SecurityConstants.INNER);
if (resultR.getCode() == 500) {
throw new ServiceException("同步物料失败:"+resultR.getMsg());
}
} }
public void synchronizeRawReturnInformationToERP(){ public void synchronizeRawReturnInformationToERP() {
System.out.println(new Date()+"++定时同步原材料退库信息给ERP++syncRawMaterialDeliveryInformationToERP"); System.out.println(new Date() + "++定时同步原材料退库信息给ERP++syncRawMaterialDeliveryInformationToERP");
remoteWmsService.synchronizeRawReturnInformationToERP(SecurityConstants.INNER); R<AjaxResult> resultR = remoteWmsService.synchronizeRawReturnInformationToERP(SecurityConstants.INNER);
if (resultR.getCode() == 500) {
throw new ServiceException("同步物料失败:"+resultR.getMsg());
}
} }
public void synchronizeProductInstockInformationToERP(Integer days){ public void synchronizeProductInstockInformationToERP(Integer days) {
System.out.println(new Date()+"++定时同步成品入库信息给ERP++synchronizeProductInstockInformationToERP"); System.out.println(new Date() + "++定时同步成品入库信息给ERP++synchronizeProductInstockInformationToERP");
remoteWmsService.synchronizeProductInstockInformationToERP(days, SecurityConstants.INNER); R<AjaxResult> resultR =remoteWmsService.synchronizeProductInstockInformationToERP(days, SecurityConstants.INNER);
if (resultR.getCode() == 500) {
throw new ServiceException("同步物料失败:"+resultR.getMsg());
}
} }
public void synchronizeProductOutstockInformationToERP(Integer days){ public void synchronizeProductOutstockInformationToERP(Integer days) {
System.out.println(new Date()+"++定时同步成品出库信息给ERP++synchronizeProductOutstockInformationToERP"); System.out.println(new Date() + "++定时同步成品出库信息给ERP++synchronizeProductOutstockInformationToERP");
remoteWmsService.synchronizeProductOutstockInformationToERP(days, SecurityConstants.INNER); R<AjaxResult> resultR = remoteWmsService.synchronizeProductOutstockInformationToERP(days, SecurityConstants.INNER);
if (resultR.getCode() == 500) {
throw new ServiceException("同步物料失败:"+resultR.getMsg());
}
} }
public void getDmsAlarmNotificationScheduledTask(){ public void getDmsAlarmNotificationScheduledTask() {
System.out.println("++设备报警通知定时任务++getDmsAlarmNotificationScheduledTask"); System.out.println("++设备报警通知定时任务++getDmsAlarmNotificationScheduledTask");
remoteDmsService.getDmsAlarmNotificationScheduledTask(SecurityConstants.INNER); remoteDmsService.getDmsAlarmNotificationScheduledTask(SecurityConstants.INNER);
} }
@ -171,20 +214,21 @@ public class RyTask
/** /**
* *
*
* @param dateStr * @param dateStr
*/ */
public void autoOutstock(String dateStr){ public void autoOutstock(String dateStr) {
if (StringUtils.isEmpty(dateStr)) { if (StringUtils.isEmpty(dateStr)) {
dateStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, new Date()); dateStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, new Date());
} }
remoteMesService.autoOutstockLastPurchaseOrders(dateStr,SecurityConstants.INNER); remoteMesService.autoOutstockLastPurchaseOrders(dateStr, SecurityConstants.INNER);
} }
/** /**
* *
*/ */
public void generateProduceStatisticsDetail(){ public void generateProduceStatisticsDetail() {
remoteMesService.generateProduceStatisticsDetail(SecurityConstants.INNER); remoteMesService.generateProduceStatisticsDetail(SecurityConstants.INNER);
} }
@ -192,28 +236,28 @@ public class RyTask
/** /**
* syspointrouter * syspointrouter
*/ */
public void processActivityEmailNotify(){ public void processActivityEmailNotify() {
remoteSysCommonService.processActivityEmailNotify(SecurityConstants.INNER); remoteSysCommonService.processActivityEmailNotify(SecurityConstants.INNER);
} }
/** /**
* *
*/ */
public void saleOrderOverTimeAlarm(){ public void saleOrderOverTimeAlarm() {
remoteMesService.saleOrderOverTimeAlarm(SecurityConstants.INNER); remoteMesService.saleOrderOverTimeAlarm(SecurityConstants.INNER);
} }
/** /**
* *
*/ */
public void purchaseOrderOverTimeAlarm(){ public void purchaseOrderOverTimeAlarm() {
remoteMesService.purchaseOrderOverTimeAlarm(SecurityConstants.INNER); remoteMesService.purchaseOrderOverTimeAlarm(SecurityConstants.INNER);
} }
/** /**
* *
*/ */
public void stockAlarm(){ public void stockAlarm() {
remoteMesService.stockAlarm(SecurityConstants.INNER); remoteMesService.stockAlarm(SecurityConstants.INNER);
} }

@ -42,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d') and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if> </if>
</where> </where>
order by job_log_id desc
</select> </select>
<select id="selectJobLogAll" resultMap="SysJobLogResult"> <select id="selectJobLogAll" resultMap="SysJobLogResult">

Loading…
Cancel
Save