优化R的调用返回

This commit is contained in:
徐晨晨 2021-11-24 09:02:33 +08:00
parent 8e46276be0
commit 7312fb765b
7 changed files with 32 additions and 30 deletions

View File

@ -53,7 +53,7 @@ public class ApmsController extends BaseController {
@PostMapping(value = "apmsPostOrder") @PostMapping(value = "apmsPostOrder")
@ApiOperation(value = "接收APMS推送订单信息") @ApiOperation(value = "接收APMS推送订单信息")
public R apmsPostOrder(@Validated @RequestBody OrderParamForApms apmsPostOrderParam) { public R<String> apmsPostOrder(@Validated @RequestBody OrderParamForApms apmsPostOrderParam) {
CommunicationLog communicationLog = new CommunicationLog(); CommunicationLog communicationLog = new CommunicationLog();
communicationLog.setCode("APMS" + System.currentTimeMillis()); communicationLog.setCode("APMS" + System.currentTimeMillis());
communicationLog.setLogName("WMS接收APMS订单"); communicationLog.setLogName("WMS接收APMS订单");
@ -66,7 +66,7 @@ public class ApmsController extends BaseController {
@PostMapping(value = "apmsVoidOrder") @PostMapping(value = "apmsVoidOrder")
@ApiOperation(value = "APMS作废订单") @ApiOperation(value = "APMS作废订单")
public R apmsVoidOrder(@Validated @RequestBody String idenCardNum) { public R<String> apmsVoidOrder(@Validated @RequestBody String idenCardNum) {
CommunicationLog communicationLog = new CommunicationLog(); CommunicationLog communicationLog = new CommunicationLog();
communicationLog.setCode("APMS" + System.currentTimeMillis()); communicationLog.setCode("APMS" + System.currentTimeMillis());
communicationLog.setLogName("APMS作废订单"); communicationLog.setLogName("APMS作废订单");
@ -79,7 +79,7 @@ public class ApmsController extends BaseController {
@PostMapping(value = "apmsCompleteOrder") @PostMapping(value = "apmsCompleteOrder")
@ApiOperation(value = "APMS完成订单,返回加工单检验结果") @ApiOperation(value = "APMS完成订单,返回加工单检验结果")
public R apmsCompleteOrder(@Validated @RequestBody ApmsCompleteOrder apmsCompleteOrder) { public R<String> apmsCompleteOrder(@Validated @RequestBody ApmsCompleteOrder apmsCompleteOrder) {
CommunicationLog communicationLog = new CommunicationLog(); CommunicationLog communicationLog = new CommunicationLog();
communicationLog.setCode("APMS" + System.currentTimeMillis()); communicationLog.setCode("APMS" + System.currentTimeMillis());
communicationLog.setLogName("APMS完成订单,返回WMS加工单检验结果"); communicationLog.setLogName("APMS完成订单,返回WMS加工单检验结果");
@ -93,7 +93,7 @@ public class ApmsController extends BaseController {
@PostMapping(value = "createProcessSheet") @PostMapping(value = "createProcessSheet")
@ApiOperation(value = "通知APMS创建生产单接口") @ApiOperation(value = "通知APMS创建生产单接口")
public R createProcessSheet(@Validated @RequestBody ApmsCreateProcessSheet apmsCreateProcess) { public R<ApmsCreateProcessSheetVo> createProcessSheet(@Validated @RequestBody ApmsCreateProcessSheet apmsCreateProcess) {
checkToken(); checkToken();
String paramJson = JSONUtil.toJsonStr(apmsCreateProcess); String paramJson = JSONUtil.toJsonStr(apmsCreateProcess);
HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/createProcessSheet") HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/createProcessSheet")
@ -110,7 +110,7 @@ public class ApmsController extends BaseController {
@PostMapping(value = "startProcess") @PostMapping(value = "startProcess")
@ApiOperation(value = "通知APMS生产单开始处理") @ApiOperation(value = "通知APMS生产单开始处理")
public R startProcess(@Validated @RequestBody ApmsStartProcess apmsStartProcess) { public R<ApmsStartProcess> startProcess(@Validated @RequestBody ApmsStartProcess apmsStartProcess) {
checkToken(); checkToken();
String paramJson = JSONUtil.toJsonStr(apmsStartProcess); String paramJson = JSONUtil.toJsonStr(apmsStartProcess);
HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/startProcess") HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/startProcess")
@ -127,7 +127,7 @@ public class ApmsController extends BaseController {
@PostMapping(value = "endProcess") @PostMapping(value = "endProcess")
@ApiOperation(value = "通知APMS生产单结束处理") @ApiOperation(value = "通知APMS生产单结束处理")
public R endProcess(@Validated @RequestBody ApmsEndProcess apmsEndProcess) { public R<ApmsEndProcessVo> endProcess(@Validated @RequestBody ApmsEndProcess apmsEndProcess) {
checkToken(); checkToken();
String paramJson = JSONUtil.toJsonStr(apmsEndProcess); String paramJson = JSONUtil.toJsonStr(apmsEndProcess);
HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/endProcess") HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/endProcess")
@ -144,7 +144,7 @@ public class ApmsController extends BaseController {
@PostMapping(value = "finishProcessSheet") @PostMapping(value = "finishProcessSheet")
@ApiOperation(value = "通知APMS完成生产单接口") @ApiOperation(value = "通知APMS完成生产单接口")
public R finishProcessSheet(@Validated @RequestBody ApmsFinishProcessSheet apmsFinishProcessSheet) { public R<ApmsFinishProcessSheetVo> finishProcessSheet(@Validated @RequestBody ApmsFinishProcessSheet apmsFinishProcessSheet) {
checkToken(); checkToken();
String paramJson = JSONUtil.toJsonStr(apmsFinishProcessSheet); String paramJson = JSONUtil.toJsonStr(apmsFinishProcessSheet);
HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/finishProcessSheet") HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/finishProcessSheet")
@ -161,7 +161,7 @@ public class ApmsController extends BaseController {
@PostMapping(value = "getApmsToken") @PostMapping(value = "getApmsToken")
@ApiOperation(value = "获取APMS Token") @ApiOperation(value = "获取APMS Token")
public R getApmsToken() { public R<String> getApmsToken() {
HashMap<String, Object> paramMap = new HashMap<>(); HashMap<String, Object> paramMap = new HashMap<>();
paramMap.put("apiKey", "7ee8f59bbaeae27e"); paramMap.put("apiKey", "7ee8f59bbaeae27e");
paramMap.put("platFormCode", "CUC"); paramMap.put("platFormCode", "CUC");
@ -183,7 +183,7 @@ public class ApmsController extends BaseController {
@PostMapping(value = "getStoveCodeByWorkShopCode") @PostMapping(value = "getStoveCodeByWorkShopCode")
@ApiOperation(value = "APMS通过车间编码获取炉号信息") @ApiOperation(value = "APMS通过车间编码获取炉号信息")
public R getStoveCodeByWorkShopCode(String workShopCode) { public R<ApmsStoveVo> getStoveCodeByWorkShopCode(String workShopCode) {
checkToken(); checkToken();
HashMap<String, Object> paramMap = new HashMap<>(); HashMap<String, Object> paramMap = new HashMap<>();
paramMap.put("workShopCode", workShopCode); paramMap.put("workShopCode", workShopCode);

View File

@ -48,5 +48,5 @@ public interface CurrTaskService {
* @param param id * @param param id
* @return 结果 * @return 结果
*/ */
R completeTask(IdParam param); R<String> completeTask(IdParam param);
} }

View File

@ -21,7 +21,7 @@ public interface OrderInfoService {
* @param apmsPostOrderParam 订单参数 * @param apmsPostOrderParam 订单参数
* @return 操作结果 * @return 操作结果
*/ */
R apmsPostOrder(OrderParamForApms apmsPostOrderParam); R<String> apmsPostOrder(OrderParamForApms apmsPostOrderParam);
/** /**
* 查询当前订单列表 * 查询当前订单列表
@ -30,13 +30,15 @@ public interface OrderInfoService {
* @return 分页结果集 * @return 分页结果集
*/ */
R<PageVo<OrderInfoVo>> page(OrderInfoBasePageParam orderInfoBasePageParam); R<PageVo<OrderInfoVo>> page(OrderInfoBasePageParam orderInfoBasePageParam);
/** /**
* 人工创建订单 * 人工创建订单
* *
* @param orderInfoPersonCreateParam 人工订单参数 * @param orderInfoPersonCreateParam 人工订单参数
* @return 结果 * @return 结果
*/ */
R personCreateOrder(OrderInfoPersonCreateParam orderInfoPersonCreateParam); R<String> personCreateOrder(OrderInfoPersonCreateParam orderInfoPersonCreateParam);
/** /**
* 获取详细单条信息 * 获取详细单条信息
* *
@ -65,7 +67,7 @@ public interface OrderInfoService {
* @param idParam id号 * @param idParam id号
* @return 结果 * @return 结果
*/ */
R completeOrder(IdParam idParam); R<String> completeOrder(IdParam idParam);
/** /**
* 作废订单 * 作废订单
@ -73,7 +75,7 @@ public interface OrderInfoService {
* @param idParam id号 * @param idParam id号
* @return 结果 * @return 结果
*/ */
R voidOrder(IdParam idParam); R<String> voidOrder(IdParam idParam);
/** /**
* APMS作废订单 * APMS作废订单
@ -81,7 +83,7 @@ public interface OrderInfoService {
* @param idenCardNum 标识卡号 * @param idenCardNum 标识卡号
* @return 结果 * @return 结果
*/ */
R apmsVoidOrder(String idenCardNum); R<String> apmsVoidOrder(String idenCardNum);
/** /**
* APMS返回订单结果 * APMS返回订单结果
@ -89,6 +91,6 @@ public interface OrderInfoService {
* @param apmsCompleteOrder 订单检验结果 * @param apmsCompleteOrder 订单检验结果
* @return 结果 * @return 结果
*/ */
R apmsCompleteOrder(ApmsCompleteOrder apmsCompleteOrder); R<String> apmsCompleteOrder(ApmsCompleteOrder apmsCompleteOrder);
} }

View File

@ -22,7 +22,7 @@ public interface TaskDetHisService {
* @param taskDetHis 任务详情历史 * @param taskDetHis 任务详情历史
* @return 结果 * @return 结果
*/ */
R save(TaskDetHis taskDetHis); R<String> save(TaskDetHis taskDetHis);
/** /**
* 保存任务详情历史list * 保存任务详情历史list
@ -30,7 +30,7 @@ public interface TaskDetHisService {
* @param taskDetHis 任务详情历史 * @param taskDetHis 任务详情历史
* @return 结果 * @return 结果
*/ */
R saveList(List<TaskDetHis> taskDetHis); R<String> saveList(List<TaskDetHis> taskDetHis);
/** /**
* 保存任务详情历史list * 保存任务详情历史list

View File

@ -81,7 +81,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
} }
@Override @Override
public R completeTask(IdParam param) { public R<String> completeTask(IdParam param) {
CurrTask byId = currTaskServiceBiz.getById(param.getId()); CurrTask byId = currTaskServiceBiz.getById(param.getId());
TaskHis taskHis = new TaskHis(); TaskHis taskHis = new TaskHis();
BeanUtils.copyProperties(byId, taskHis); BeanUtils.copyProperties(byId, taskHis);

View File

@ -79,7 +79,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
ApmsController apmsControl; ApmsController apmsControl;
@Override @Override
public R apmsPostOrder(OrderParamForApms apmsPostOrderParam) { public R<String> apmsPostOrder(OrderParamForApms apmsPostOrderParam) {
OrderInfo orderInfo = new OrderInfo(); OrderInfo orderInfo = new OrderInfo();
BeanUtils.copyProperties(apmsPostOrderParam, orderInfo); BeanUtils.copyProperties(apmsPostOrderParam, orderInfo);
setCommonField(orderInfo); setCommonField(orderInfo);
@ -102,13 +102,13 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
} }
@Override @Override
public R personCreateOrder(OrderInfoPersonCreateParam orderInfoPersonCreateParam) { public R<String> personCreateOrder(OrderInfoPersonCreateParam orderInfoPersonCreateParam) {
OrderInfo orderInfo = new OrderInfo(); OrderInfo orderInfo = new OrderInfo();
BeanUtils.copyProperties(orderInfoPersonCreateParam,orderInfo); BeanUtils.copyProperties(orderInfoPersonCreateParam, orderInfo);
setCommonField(orderInfo); setCommonField(orderInfo);
//设定来源信息为人工 //设定来源信息为人工
orderInfo.setOrderSource(OrderSourceEnum.PERSON.getValue()); orderInfo.setOrderSource(OrderSourceEnum.PERSON.getValue());
orderInfo.setInterCode("PERSONAL"+System.currentTimeMillis()); orderInfo.setInterCode("PERSONAL" + System.currentTimeMillis());
orderInfoService.save(orderInfo); orderInfoService.save(orderInfo);
return successful("人工创建订单成功。"); return successful("人工创建订单成功。");
} }
@ -173,7 +173,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
} }
@Override @Override
public R completeOrder(IdParam idParam) { public R<String> completeOrder(IdParam idParam) {
OrderInfo byId = orderInfoService.getById(idParam.getId()); OrderInfo byId = orderInfoService.getById(idParam.getId());
orderInfoHisService.save(byId); orderInfoHisService.save(byId);
byId.setValid(0); byId.setValid(0);
@ -183,7 +183,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
} }
@Override @Override
public R voidOrder(IdParam idParam) { public R<String> voidOrder(IdParam idParam) {
OrderInfo byId = orderInfoService.getById(idParam.getId()); OrderInfo byId = orderInfoService.getById(idParam.getId());
byId.setValid(0); byId.setValid(0);
orderInfoService.updateById(byId); orderInfoService.updateById(byId);
@ -191,7 +191,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
} }
@Override @Override
public R apmsVoidOrder(String idenCardNum) { public R<String> apmsVoidOrder(String idenCardNum) {
OrderInfo byId = orderInfoService.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, idenCardNum)); OrderInfo byId = orderInfoService.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, idenCardNum));
//确定是否有订单在生产 //确定是否有订单在生产
List<CurrTaskDet> taskDetailsByIdenCardNum = currTaskDetService.getTaskDetailsByIdenCardNum(idenCardNum); List<CurrTaskDet> taskDetailsByIdenCardNum = currTaskDetService.getTaskDetailsByIdenCardNum(idenCardNum);
@ -206,7 +206,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
} }
@Override @Override
public R apmsCompleteOrder(ApmsCompleteOrder apmsCompleteOrder) { public R<String> apmsCompleteOrder(ApmsCompleteOrder apmsCompleteOrder) {
//通过标识卡号与生产单号进行更新检验结果 //通过标识卡号与生产单号进行更新检验结果
ApmsCheckResult one = apmsCheckResultServiceBiz.getOne(new QueryWrapper<ApmsCheckResult>().eq(ApmsCheckResult.IDEN_CARD_NUM, apmsCompleteOrder.getIdenCardNum()).eq(ApmsCheckResult.SHEET_NO, apmsCompleteOrder.getSheetNo())); ApmsCheckResult one = apmsCheckResultServiceBiz.getOne(new QueryWrapper<ApmsCheckResult>().eq(ApmsCheckResult.IDEN_CARD_NUM, apmsCompleteOrder.getIdenCardNum()).eq(ApmsCheckResult.SHEET_NO, apmsCompleteOrder.getSheetNo()));
one.setMetallography(apmsCompleteOrder.getMetallographic()); one.setMetallography(apmsCompleteOrder.getMetallographic());

View File

@ -33,15 +33,15 @@ public class TaskDetHisServiceImpl extends BaseService implements TaskDetHisServ
@Override @Override
public R save(TaskDetHis taskDetHis) { public R<String> save(TaskDetHis taskDetHis) {
taskDetHisServiceBiz.save(taskDetHis); taskDetHisServiceBiz.save(taskDetHis);
return successful("操作成功"); return successful("操作成功");
} }
@Override @Override
public R saveList(List<TaskDetHis> taskDetHis) { public R<String> saveList(List<TaskDetHis> taskDetHis) {
taskDetHisServiceBiz.saveBatch(taskDetHis); taskDetHisServiceBiz.saveBatch(taskDetHis);
return null; return successful("操作成功");
} }
@Override @Override