feat:CRM接口bug修复
This commit is contained in:
@@ -58,6 +58,13 @@ public class VehicleTwoController {
|
||||
return new ResponseEntity<>(vehicleTwoService.returnIn(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/productionIn")
|
||||
@Log("生产入库")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> productionIn(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(vehicleTwoService.returnIn(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/reback")
|
||||
@Log("返检、改切入库")
|
||||
@SaIgnore
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package org.nl.modules.logging.aspect;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
@@ -12,7 +13,6 @@ import org.nl.modules.logging.annotation.ApiLog;
|
||||
import org.nl.system.service.sysapi.entity.SysApiLog;
|
||||
import org.nl.system.service.sysapi.service.ISysApiLogService;
|
||||
import org.slf4j.MDC;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
@@ -54,7 +54,8 @@ public class ApiLogAspect {
|
||||
logEntity.setBizDesc(apiLog.bizDesc());
|
||||
logEntity.setTraceId(MDC.get("traceId"));
|
||||
logEntity.setCreateTime(DateUtil.now());
|
||||
|
||||
Object result = null;
|
||||
Throwable businessException = null;
|
||||
try {
|
||||
if (attributes != null) {
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
@@ -63,51 +64,77 @@ public class ApiLogAspect {
|
||||
logEntity.setRequestIp(getIpAddress(request));
|
||||
logEntity.setRequestHeaders(JSONUtil.toJsonStr(getRequestHeaders(request)));
|
||||
}
|
||||
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
Object[] args = joinPoint.getArgs();
|
||||
logEntity.setRequestParams(buildRequestParams(method, args));
|
||||
|
||||
Object result = joinPoint.proceed();
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(JSONUtil.toJsonStr(result));
|
||||
JSONObject jsonObject1 = jsonObject.getJSONObject("body");
|
||||
if(null == jsonObject1){
|
||||
logEntity.setResponseStatus(400);
|
||||
logEntity.setStatus("FAIL");
|
||||
logEntity.setErrorMsg("返回信息为空,请确认!");
|
||||
logEntity.setResponseBody("返回信息为空,请确认!");
|
||||
}else{
|
||||
String rtype = jsonObject1.getString("RTYPE");
|
||||
if(rtype.equalsIgnoreCase("E")){
|
||||
logEntity.setResponseStatus(400);
|
||||
logEntity.setStatus("FAIL");
|
||||
logEntity.setErrorMsg(JSONUtil.toJsonStr(result));
|
||||
logEntity.setResponseBody(JSONUtil.toJsonStr(result));
|
||||
result = joinPoint.proceed();
|
||||
try {
|
||||
JSONObject jsonObject = JSONObject.parseObject(JSONUtil.toJsonStr(result));
|
||||
if(null != jsonObject && jsonObject.containsKey("status")){
|
||||
String status = jsonObject.getString("status");
|
||||
if ("E".equalsIgnoreCase(status)) {
|
||||
logEntity.setResponseStatus(400);
|
||||
logEntity.setStatus("FAIL");
|
||||
logEntity.setErrorMsg(JSONUtil.toJsonStr(result));
|
||||
logEntity.setResponseBody(JSONUtil.toJsonStr(result));
|
||||
} else {
|
||||
logEntity.setResponseStatus(200);
|
||||
logEntity.setStatus("SUCCESS");
|
||||
logEntity.setResponseBody(JSONUtil.toJsonStr(result));
|
||||
}
|
||||
}else{
|
||||
logEntity.setResponseStatus(200);
|
||||
logEntity.setStatus("SUCCESS");
|
||||
logEntity.setResponseBody(JSONUtil.toJsonStr(result));
|
||||
JSONObject jsonObject1 = jsonObject != null ? jsonObject.getJSONObject("body") : null;
|
||||
if (jsonObject1 == null) {
|
||||
logEntity.setResponseStatus(400);
|
||||
logEntity.setStatus("FAIL");
|
||||
logEntity.setErrorMsg("返回信息为空,请确认!");
|
||||
logEntity.setResponseBody(JSONUtil.toJsonStr(result));
|
||||
} else {
|
||||
String key = "";
|
||||
if (jsonObject1.containsKey("RTYPE")) {
|
||||
key = "RTYPE";
|
||||
} else if (jsonObject1.containsKey("TYPE")) {
|
||||
key = "TYPE";
|
||||
}
|
||||
String rtype = StrUtil.isNotBlank(key) ? jsonObject1.getString(key) : null;
|
||||
if ("E".equalsIgnoreCase(rtype)) {
|
||||
logEntity.setResponseStatus(400);
|
||||
logEntity.setStatus("FAIL");
|
||||
logEntity.setErrorMsg(JSONUtil.toJsonStr(result));
|
||||
logEntity.setResponseBody(JSONUtil.toJsonStr(result));
|
||||
} else {
|
||||
logEntity.setResponseStatus(200);
|
||||
logEntity.setStatus("SUCCESS");
|
||||
logEntity.setResponseBody(JSONUtil.toJsonStr(result));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("解析响应结果失败,记录原始响应", e);
|
||||
logEntity.setResponseStatus(200);
|
||||
logEntity.setStatus("SUCCESS");
|
||||
logEntity.setResponseBody(JSONUtil.toJsonStr(result));
|
||||
}
|
||||
|
||||
long costTime = System.currentTimeMillis() - startTime;
|
||||
logEntity.setCostTime(costTime);
|
||||
|
||||
return result;
|
||||
|
||||
} catch (Throwable throwable) {
|
||||
businessException = throwable;
|
||||
logEntity.setStatus("FAIL");
|
||||
String errorMsg = throwable.getMessage();
|
||||
logEntity.setErrorMsg(errorMsg != null && errorMsg.length() > 2000 ?
|
||||
errorMsg.substring(0, 2000) : errorMsg);
|
||||
} finally {
|
||||
long costTime = System.currentTimeMillis() - startTime;
|
||||
logEntity.setCostTime(costTime);
|
||||
logEntity.setStatus("FAIL");
|
||||
logEntity.setErrorMsg(throwable.getMessage());
|
||||
|
||||
throw throwable;
|
||||
|
||||
} finally {
|
||||
apiLogService.saveAsync(logEntity);
|
||||
try {
|
||||
apiLogService.saveAsync(logEntity);
|
||||
} catch (Exception e) {
|
||||
log.error("保存API日志失败,但不影响主业务", e);
|
||||
}
|
||||
if (businessException != null) {
|
||||
throw businessException;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private String getIpAddress(HttpServletRequest request) {
|
||||
|
||||
@@ -1534,7 +1534,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
|
||||
|
||||
if (ObjectUtil.isEmpty(jsonBox)) {
|
||||
throw new BadRequestException("此木箱不在库内:" + PackageBoxSN);
|
||||
throw new BadRequestException("此木箱不在库内:" + PackageBoxSN +"请检查是否已被出入库分配锁定");
|
||||
}
|
||||
storSet.add(jsonBox.getStor_code());
|
||||
}
|
||||
|
||||
@@ -125,6 +125,8 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
}
|
||||
result.put("TYPE", "S");
|
||||
result.put("MESSAGE", msg);
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", msg);
|
||||
log.info("getMaterialInfo的输出参数为:------------------------" + result.toString());
|
||||
return result;
|
||||
}
|
||||
@@ -223,7 +225,9 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
return result;
|
||||
}
|
||||
result.put("TYPE", "S");
|
||||
result.put("RTYPE", "S");
|
||||
result.put("MESSAGE", msg);
|
||||
result.put("RTMSG", msg);
|
||||
log.info("getReCutInfo的输出参数为:------------------------" + result.toString());
|
||||
return result;
|
||||
}
|
||||
@@ -261,6 +265,8 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
}
|
||||
result.put("TYPE", "S");
|
||||
result.put("MESSAGE", "推送成功!");
|
||||
result.put("RTYPE", "E");
|
||||
result.put("RTMSG", "推送成功!");
|
||||
log.info("getMaterialInfo的输出参数为:------------------------" + result.toString());
|
||||
return result;
|
||||
}
|
||||
@@ -327,6 +333,8 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
}
|
||||
result.put("TYPE", "S");
|
||||
result.put("MESSAGE", "物料同步成功!");
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", "物料同步成功!");
|
||||
log.info("getMaterialInfo的输出参数为:------------------------" + result.toString());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
IF 输入.flag = "1"
|
||||
QUERY
|
||||
SELECT
|
||||
distinct
|
||||
sub.product_name AS material_code,
|
||||
sub.product_description AS material_name,
|
||||
sub.sap_pcsn AS pcsn,
|
||||
@@ -72,24 +73,27 @@
|
||||
stor.ext_id AS warehouse_code,
|
||||
sub.date_of_production AS dateofproduction,
|
||||
sub.container_name,
|
||||
mmm.english_name,
|
||||
CONCAT(sub.un_plan_product_property1,sub.un_plan_product_property2,sub.un_plan_product_property3) AS unplanproductproperty
|
||||
FROM
|
||||
pdm_bi_subpackagerelation sub
|
||||
INNER JOIN st_ivt_structattr sa On sa.storagevehicle_code = sub.package_box_sn
|
||||
INNER JOIN st_ivt_bsrealstorattr stor ON stor.stor_id = sa.stor_id
|
||||
LEFT JOIN md_me_materialbase mmm on sub.product_name = mmm.material_code
|
||||
WHERE
|
||||
sub.package_box_sn IN (
|
||||
SELECT DISTINCT
|
||||
package_box_sn
|
||||
FROM
|
||||
pdm_bi_subpackagerelation sub
|
||||
LEFT JOIN md_me_materialbase mmm on sub.product_name = mmm.material_code
|
||||
WHERE
|
||||
sub.`status` = '2'
|
||||
OPTION 输入.material_code <> ""
|
||||
product_name = 输入.material_code
|
||||
sub.product_name = 输入.material_code
|
||||
ENDOPTION
|
||||
OPTION 输入.material_name <> ""
|
||||
product_description = 输入.material_name
|
||||
(sub.product_description = 输入.material_name OR mmm.english_name = 输入.material_name)
|
||||
ENDOPTION
|
||||
OPTION 输入.mfgordername <> ""
|
||||
SUBSTRING_INDEX(sale_order_name, "-", 1) IN 输入.mfgordername
|
||||
@@ -130,4 +134,4 @@
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
@@ -49,6 +49,8 @@ var config = {
|
||||
"mesErrorTitle": "MES Error"
|
||||
},
|
||||
"common": {
|
||||
"sectType": "Warehouse Area Type",
|
||||
"sectCapacity": "Warehouse Area Capacity",
|
||||
"charge_against":"charge against",
|
||||
"select_scrap_type":"select scrap type",
|
||||
"scrap_type":"scrap type",
|
||||
|
||||
@@ -48,6 +48,8 @@ var config = {
|
||||
"load_text5": "Hanya dapat mengunggah satu file excel!"
|
||||
},
|
||||
"common": {
|
||||
"sectType": "Tipe Area Gudang",
|
||||
"sectCapacity": "Kapasitas Area Gudang",
|
||||
"charge_against":"Penutupan",
|
||||
"select_scrap_type":"Silakan pilih jenis pembatalan",
|
||||
"scrap_type":"Jenis pembatalan",
|
||||
|
||||
@@ -93,6 +93,8 @@ var config = {
|
||||
"correspondingDeepLocationError": "对应的深货位错误!"
|
||||
},
|
||||
"common": {
|
||||
"sectType": "库区类型",
|
||||
"sectCapacity":"库区容量",
|
||||
"charge_against":"冲销",
|
||||
"select_scrap_type":"请选择报废类型",
|
||||
"scrap_type":"报废类型",
|
||||
|
||||
Reference in New Issue
Block a user