Commit 183671cd zshaohui

功能优化提交

1 个父辈 eaac156b
......@@ -430,7 +430,7 @@ public class LizhenController {
if (ObjectUtil.isNotEmpty(request.getDetailList())) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}料号明细列表不能为空", new String[]{""});
}
return ResultBean.newOkResult(LuxsanSpApi.spareInHourse(request));
return ResultBean.newOkResult("");
}
......
......@@ -8,6 +8,7 @@ import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.HttpHelper;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.api.listener.DefaultSmfApiListener;
import com.neotel.smfcore.core.inList.service.po.InList;
import com.neotel.smfcore.custom.luxsan_sp.api.bean.LuxsanSpApiResult;
import com.neotel.smfcore.custom.luxsan_sp.api.bean.request.*;
import com.neotel.smfcore.custom.luxsan_sp.api.bean.result.GetSpareNoResult;
......@@ -17,6 +18,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
@Slf4j
......@@ -46,7 +48,7 @@ public class LuxsanSpApi extends DefaultSmfApiListener {
}
// 备品仓退库查询接口的GET方法
public static GetReturnInventoryResult getReturnInventory(GetReturnInventoryRequest request) {
public static List<GetReturnInventoryResult> getReturnInventory(GetReturnInventoryRequest request) {
try {
// 记录请求日志
log.info("备品仓退库查询接口请求为: " + JSON.toJSONString(request));
......@@ -63,8 +65,10 @@ public class LuxsanSpApi extends DefaultSmfApiListener {
throw new Exception(String.format("备品仓退库查询接口请求失败, 错误代码[%d],错误原因[%s]",
lizhenApiResult.getCode(), lizhenApiResult.getMsg()));
}
GetReturnInventoryResult data = JSONObject.parseObject(lizhenApiResult.getData(), GetReturnInventoryResult.class);
return data;
List<GetReturnInventoryResult> resultList = JSONObject.parseArray(lizhenApiResult.getData(), GetReturnInventoryResult.class);
if (resultList != null && !resultList.isEmpty()){
return resultList;
}
}
} catch (Exception e) {
// 记录异常日志
......@@ -73,10 +77,10 @@ public class LuxsanSpApi extends DefaultSmfApiListener {
throw new ValidateException("smfcore.api.error", "接口请求失败[{0}]", new String[]{e.getMessage()});
}
// 如果没有成功返回结果,抛出异常
throw new ValidateException("smfcore.api.error", "接口请求失败[{0}]", new String[]{GetReturnInventory});
throw new ValidateException("smfcore.api.error", "接口请求失败[{0}]", new String[]{"未找到对应的退库单信息"});
}
public static GetUnclaimedResult getUnclaimedDetails(GetUnclaimedRequest request) {
public static List<GetUnclaimedResult> getUnclaimedDetails(GetUnclaimedRequest request) {
try {
log.info("预约待领取接口请求为:" + request);
String url = GetUnclaimedUrl + getQueryStr(request);
......@@ -88,19 +92,19 @@ public class LuxsanSpApi extends DefaultSmfApiListener {
lizhenApiResult.getCode(), lizhenApiResult.getMsg()));
}
String data = lizhenApiResult.getData();
GetUnclaimedResult getUnclaimedResult = JSONObject.parseObject(data, GetUnclaimedResult.class);
if (ObjectUtil.isNotNull(getUnclaimedResult)) {
return getUnclaimedResult;
List<GetUnclaimedResult> resultList = JSONObject.parseArray(data, GetUnclaimedResult.class);
if (resultList != null && !resultList.isEmpty()){
return resultList;
}
} catch (Exception e) {
log.info("getUnclaimedDetails请求失败:" + e.getMessage());
throw new ValidateException("smfcore.api.error", "接口请求失败[{0}]", new String[]{e.getMessage()});
}
throw new ValidateException("smfcore.api.error", "接口请求失败[{0}]", new String[]{GetUnclaimedUrl});
throw new ValidateException("smfcore.api.error", "接口请求失败[{0}]", new String[]{"未找到对应的预约单接口"});
}
public static SpareInHourseResult spareInHourse(SpareInHourseRequest request) {
public static void spareInHourse(SpareInHourseRequest request) {
try {
log.info("备品仓入库接口请求为:" + JSON.toJSONString(request));
String resJsonStr = HttpHelper.postJson(SpareInHourseUrl, request);
......@@ -110,19 +114,15 @@ public class LuxsanSpApi extends DefaultSmfApiListener {
throw new ApiException(String.format("备品仓入库接口请求失败, 错误代码[%d],错误原因[%s]",
lizhenApiResult.getCode(), lizhenApiResult.getMsg()));
}
SpareInHourseResult spareInHourseResult = JSONObject.parseObject(lizhenApiResult.getData(), SpareInHourseResult.class);
if (ObjectUtil.isNotNull(spareInHourseResult)) {
return spareInHourseResult;
}
} catch (ApiException e) {
log.info("备品仓入库接口请求失败:" + e.getMessage());
throw new ValidateException("smfcore.api.error", "接口请求失败[{0}]", new String[]{e.getMessage()});
}
throw new ValidateException("smfcore.api.error", "接口请求失败[{0}]", new String[]{SpareInHourseUrl});
//throw new ValidateException("smfcore.api.error", "接口请求失败[{0}]", new String[]{SpareInHourseUrl});
}
public static GetSpareNoResult getSpareNo(GetSpareNoRequest request) {
public static List<GetSpareNoResult> getSpareNo(GetSpareNoRequest request) {
try {
log.info("获取入库单号请求为:" + JSON.toJSONString(request));
String url = GetSpareNoUrl + getQueryStr(request);
......@@ -133,15 +133,15 @@ public class LuxsanSpApi extends DefaultSmfApiListener {
throw new Exception(String.format("获取入库单号接口请求失败, 错误代码[%d],错误原因[%s]",
lizhenApiResult.getCode(), lizhenApiResult.getMsg()));
}
GetSpareNoResult spareNoResult = JSONObject.parseObject(lizhenApiResult.getData(), GetSpareNoResult.class);
if (ObjectUtil.isNotNull(spareNoResult)) {
return spareNoResult;
List<GetSpareNoResult> resultList = JSONObject.parseArray(lizhenApiResult.getData(), GetSpareNoResult.class);
if (resultList != null && !resultList.isEmpty()) {
return resultList;
}
} catch (Exception e) {
log.info("getSpareNo请求失败:" + e.getMessage());
throw new ValidateException("smfcore.api.error", "接口请求失败[{0}]", new String[]{e.getMessage()});
}
throw new ValidateException("smfcore.api.error", "接口请求失败[{0}]", new String[]{GetSpareNoUrl});
throw new ValidateException("smfcore.api.error", "接口请求失败[{0}]", new String[]{"未找到入库单信息"});
}
......
package com.neotel.smfcore.custom.luxsan_sp.api.bean.request;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class GetSpareNoRequest {
//厂区
......
......@@ -10,4 +10,6 @@ public class GetSpareNoDetail {
private String partname;
private int inQty;
private int putInQty;
}
......@@ -12,6 +12,9 @@ public class SpareInHourseDetail {
/**
* 储位
*/
private String locationCode;
/**
* 数量
*/
......
package com.neotel.smfcore.custom.luxsan_sp.bean;
import com.neotel.smfcore.common.base.BasePo;
import com.neotel.smfcore.custom.luxsan_sp.api.bean.result.GetSpareNoDetail;
import lombok.Data;
import java.util.List;
@Data
public class SpareNo extends BasePo {
private String createBy;
//创建时间
private String createTime; // 使用Date或LocalDateTime等日期类型
//单据号
private String spareNo;
//仓库代码
private String whCode;
//0表示待入库
private String status;
//厂区id
private int deptId;
//料号明细
private List<GetSpareNoDetail> detailList;
//仓库描述
private String whDesc;
}
package com.neotel.smfcore.custom.luxsan_sp.controller;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("/returnInventory")
public class SpReturnInventoryController {
}
package com.neotel.smfcore.custom.luxsan_sp.controller;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.custom.luxsan_sp.api.LuxsanSpApi;
import com.neotel.smfcore.custom.luxsan_sp.api.bean.request.GetSpareNoRequest;
import com.neotel.smfcore.custom.luxsan_sp.api.bean.result.GetSpareNoResult;
import com.neotel.smfcore.custom.luxsan_sp.bean.SpareNo;
import com.neotel.smfcore.custom.luxsan_sp.service.manager.ISpareNoManager;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Slf4j
@RestController
@RequestMapping("/spareNo")
public class SpSpareNoController {
@Autowired
private ISpareNoManager spareNoManager;
@ApiOperation("获取入库单")
@RequestMapping("/getAllSpareNo")
@AnonymousAccess
public ResultBean getAllSpareNo(String deptId, String functionDept) {
List<GetSpareNoResult> resultList = LuxsanSpApi.getSpareNo(new GetSpareNoRequest(deptId, functionDept));
for (GetSpareNoResult result : resultList) {
SpareNo spareNo = spareNoManager.getBySpareNo(result.getSpareNo());
}
return ResultBean.newOkResult(resultList);
}
@ApiOperation("选中入库单")
@RequestMapping("/checkSpareNo")
@AnonymousAccess
public ResultBean checkSpareNo(String spareNo) {
return ResultBean.newOkResult("");
}
}
package com.neotel.smfcore.custom.luxsan_sp.service.dao;
import com.neotel.smfcore.common.base.IBaseDao;
public interface SpareNoDao extends IBaseDao {
}
package com.neotel.smfcore.custom.luxsan_sp.service.dao.impl;
import com.neotel.smfcore.common.base.AbstractBaseDao;
import com.neotel.smfcore.custom.luxsan_sp.bean.SpareNo;
import com.neotel.smfcore.custom.luxsan_sp.service.dao.SpareNoDao;
import org.springframework.stereotype.Service;
@Service
public class SpareNoDaoImpl extends AbstractBaseDao implements SpareNoDao {
@Override
public Class getEntityClass() {
return SpareNo.class;
}
}
package com.neotel.smfcore.custom.luxsan_sp.service.manager;
import com.neotel.smfcore.common.base.IBaseManager;
import com.neotel.smfcore.custom.luxsan_sp.bean.SpareNo;
public interface ISpareNoManager extends IBaseManager<SpareNo> {
SpareNo getBySpareNo(String spareNo);
}
package com.neotel.smfcore.custom.luxsan_sp.service.manager.impl;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.custom.luxsan_sp.bean.SpareNo;
import com.neotel.smfcore.custom.luxsan_sp.service.dao.SpareNoDao;
import com.neotel.smfcore.custom.luxsan_sp.service.manager.ISpareNoManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service
public class SpareNoManagerImpl implements ISpareNoManager {
@Autowired
private SpareNoDao spareNoDao;
@Override
public SpareNo get(String id) {
return null;
}
@Override
public SpareNo save(SpareNo object) throws ValidateException {
return null;
}
@Override
public void delete(SpareNo object) throws ValidateException {
}
@Override
public PageData<SpareNo> findByPage(Query query, Pageable pageable) {
return null;
}
@Override
public List<SpareNo> findByQuery(Query query) {
return null;
}
@Override
public SpareNo getBySpareNo(String spareNo) {
return null;
}
}
package com.neotel.smfcore.custom.luxsan_sp.util;
import com.neotel.smfcore.custom.luxsan_sp.bean.SpareNo;
import org.ehcache.impl.internal.concurrent.ConcurrentHashMap;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service
public class SpareNoCache {
Map<String, SpareNo> cacheMap = new ConcurrentHashMap<>();
public void addToMap(SpareNo spareNo){
cacheMap.put(spareNo.getSpareNo(),spareNo);
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!