|
@@ -1,6 +1,8 @@
|
|
|
package com.steerinfo.ems.emsprodplanweightadjustment.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.steerinfo.auth.utils.JwtUtil;
|
|
|
+import com.steerinfo.ems.Utils.WebSocket;
|
|
|
import com.steerinfo.ems.emsgmpcjh.mapper.EmsGmPcJhMapper;
|
|
|
import com.steerinfo.ems.emsgmpcjh.model.EmsGmPcJh;
|
|
|
import com.steerinfo.ems.emsprodplanweightadjustment.mapper.EmsProdplanWeightAdjustmentMapper;
|
|
@@ -44,7 +46,8 @@ public class EmsProdplanWeightAdjustmentController extends BaseRESTfulController
|
|
|
EmsProdplanWeightAdjustmentMapper emsProdplanWeightAdjustmentMapper;
|
|
|
@Autowired
|
|
|
EmsGmPcJhMapper emsGmPcJhMapper;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private WebSocket webSocket;
|
|
|
@ApiOperation(value="获取列表", notes="分页查询")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
|
|
@@ -119,93 +122,183 @@ public class EmsProdplanWeightAdjustmentController extends BaseRESTfulController
|
|
|
@PutMapping(value = "/submitaudit",produces = "application/json;charset=UTF-8")
|
|
|
public RESTfulResult submitaudit(@RequestBody EmsProdplanWeightAdjustment[] models){
|
|
|
String userId = JwtUtil.getUseridByToken();
|
|
|
+ String soketMessage="国贸订单编号";
|
|
|
+ boolean result = false;
|
|
|
for (EmsProdplanWeightAdjustment model : models) {
|
|
|
EmsProdplanWeightAdjustment emsProdplanWeightAdjustment = emsProdplanWeightAdjustmentMapper.selectByPrimaryKey(model.getId());
|
|
|
if (emsProdplanWeightAdjustment.getAuditStatus().equals("1")) {
|
|
|
- return failed(null,"领导部门还未审批,请勿重复操作");
|
|
|
+ return failed(null,"编号为"+emsProdplanWeightAdjustment.getId()+",已经提交申请,请勿重复操作");
|
|
|
}
|
|
|
if (emsProdplanWeightAdjustment.getAuditStatus().equals("2")) {
|
|
|
- return failed(null,"该计划领导部门已经审批,请勿重复操作");
|
|
|
+ return failed(null,"编号为"+emsProdplanWeightAdjustment.getId()+",领导部门已经审批,请勿重复操作");
|
|
|
}
|
|
|
if (emsProdplanWeightAdjustment.getAuditStatus().equals("3")) {
|
|
|
- return failed(null,"该计划生产部已经同意,请勿重复操作");
|
|
|
+ return failed(null,"编号为"+emsProdplanWeightAdjustment.getId()+",生产部已经同意,请勿重复操作");
|
|
|
}
|
|
|
emsProdplanWeightAdjustment.setSubmitter(userId);
|
|
|
- emsProdplanWeightAdjustment.setReviewerTime(new Date());
|
|
|
+ emsProdplanWeightAdjustment.setSubmitTime(new Date());
|
|
|
emsProdplanWeightAdjustment.setAuditStatus(model.getAuditStatus());
|
|
|
emsProdplanWeightAdjustment.setRecordWeight(emsProdplanWeightAdjustment.getPlanWeight());
|
|
|
emsProdplanWeightAdjustment.setPlanWeight(model.getPlanWeight());
|
|
|
emsProdplanWeightAdjustmentMapper.updateByPrimaryKey(emsProdplanWeightAdjustment);
|
|
|
+ result = true;
|
|
|
+ soketMessage+=model.getId()+",";
|
|
|
+ if(result){
|
|
|
+ soketMessage += "已提交审核,请注意接收";
|
|
|
+ String[] roles = {"生产部-生产处"};
|
|
|
+ Map <String, Object> map = new HashMap<String,Object>();
|
|
|
+ map.put("role",roles);
|
|
|
+ map.put("title","销售订单调整");
|
|
|
+ map.put("message",soketMessage);
|
|
|
+ map.put("tips","您好,有新的销售订单需要进行重量调整,请注意接收。");
|
|
|
+ soketMessage= JSON.toJSONString(map);
|
|
|
+ webSocket.sendAllMessage(soketMessage);
|
|
|
+ }
|
|
|
}
|
|
|
return success(null,"提交成功");
|
|
|
}
|
|
|
-
|
|
|
@ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的emsProdplanWeightAdjustment信息来更新详细信息")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "emsProdplanWeightAdjustment", value = "详细实体emsProdplanWeightAdjustment", required = true, dataType = "EmsProdplanWeightAdjustment")
|
|
|
})
|
|
|
- @PutMapping(value = "approval/{id}", produces = "application/json;charset=UTF-8")
|
|
|
- public RESTfulResult approval(@PathVariable String id){
|
|
|
- EmsProdplanWeightAdjustment emsProdplanWeightAdjustment = emsProdplanWeightAdjustmentMapper.selectByPrimaryKey(id);
|
|
|
- if (emsProdplanWeightAdjustment != null ) {
|
|
|
- if (emsProdplanWeightAdjustment.getAuditStatus().equals("2")) {
|
|
|
- return failed(null,"该计划领导部门已经审批,请勿重复操作");
|
|
|
- }
|
|
|
- if (emsProdplanWeightAdjustment.getAuditStatus().equals("3")) {
|
|
|
- return failed(null,"该计划生产部已经审批,请勿重复操作");
|
|
|
- }
|
|
|
- if(emsProdplanWeightAdjustment.getAuditStatus().equals("4")){
|
|
|
- return failed(null,"该计划审核失败,请勿重复操作");
|
|
|
- }
|
|
|
- emsProdplanWeightAdjustment.setAuditStatus("2");
|
|
|
- emsProdplanWeightAdjustmentMapper.updateByPrimaryKey(emsProdplanWeightAdjustment);
|
|
|
+ @PutMapping(value = "approval", produces = "application/json;charset=UTF-8")
|
|
|
+ public RESTfulResult approval(@RequestBody EmsProdplanWeightAdjustment[] models ){
|
|
|
+ String userId = JwtUtil.getUseridByToken();
|
|
|
+ for (EmsProdplanWeightAdjustment model : models) {
|
|
|
+ EmsProdplanWeightAdjustment emsProdplanWeightAdjustment = emsProdplanWeightAdjustmentMapper.selectByPrimaryKey(model.getId());
|
|
|
+ if (emsProdplanWeightAdjustment != null ) {
|
|
|
+ if (emsProdplanWeightAdjustment.getAuditStatus().equals("2")) {
|
|
|
+ return failed(null,"计划编号为:"+emsProdplanWeightAdjustment.getId()+",部门已经审批,请勿重复操作");
|
|
|
+ }
|
|
|
+ if (emsProdplanWeightAdjustment.getAuditStatus().equals("0")) {
|
|
|
+ return failed(null,"计划编号为:"+emsProdplanWeightAdjustment.getId()+",先提交审核,请勿重复操作");
|
|
|
+ }
|
|
|
+ if (emsProdplanWeightAdjustment.getAuditStatus().equals("3")) {
|
|
|
+ return failed(null,"计划编号为:"+emsProdplanWeightAdjustment.getId()+",生产部已经审批,请勿重复操作");
|
|
|
+ }
|
|
|
+ if(emsProdplanWeightAdjustment.getAuditStatus().equals("4")){
|
|
|
+ return failed(null,"计划编号为:"+emsProdplanWeightAdjustment.getId()+",计划审核失败,请勿重复操作");
|
|
|
+ }
|
|
|
+ emsProdplanWeightAdjustment.setAuditStatus("2");
|
|
|
+ emsProdplanWeightAdjustment.setGmReviewer(userId);
|
|
|
+ emsProdplanWeightAdjustment.setGmReviewerTime(new Date());
|
|
|
+ emsProdplanWeightAdjustmentMapper.updateByPrimaryKey(emsProdplanWeightAdjustment);
|
|
|
+ }
|
|
|
}
|
|
|
return success();
|
|
|
}
|
|
|
|
|
|
- @PutMapping(value = "agreement/{id}", produces = "application/json;charset=UTF-8")
|
|
|
- public RESTfulResult agreement(@PathVariable String id){
|
|
|
- EmsProdplanWeightAdjustment emsProdplanWeightAdjustment = emsProdplanWeightAdjustmentMapper.selectByPrimaryKey(id);
|
|
|
- if (emsProdplanWeightAdjustment != null ) {
|
|
|
- if (emsProdplanWeightAdjustment.getAuditStatus().equals("0")) {
|
|
|
- return failed(null,"该计划还未走审批流程,操作失败");
|
|
|
- }
|
|
|
- if (emsProdplanWeightAdjustment.getAuditStatus().equals("1")) {
|
|
|
- return failed(null,"领导部门还未审批,操作失败");
|
|
|
- }
|
|
|
- if (emsProdplanWeightAdjustment.getAuditStatus().equals("3")) {
|
|
|
- return failed(null,"该计划生产部已经审批,请勿重复操作");
|
|
|
+ @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的emsProdplanWeightAdjustment信息来更新详细信息")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "emsProdplanWeightAdjustment", value = "详细实体emsProdplanWeightAdjustment", required = true, dataType = "EmsProdplanWeightAdjustment")
|
|
|
+ })
|
|
|
+ @PutMapping(value = "nopass", produces = "application/json;charset=UTF-8")
|
|
|
+ public RESTfulResult nopass(@RequestBody EmsProdplanWeightAdjustment[] models ){
|
|
|
+ String userId = JwtUtil.getUseridByToken();
|
|
|
+ String soketMessage="国贸订单编号";
|
|
|
+ boolean result = false;
|
|
|
+ for (EmsProdplanWeightAdjustment model : models) {
|
|
|
+ EmsProdplanWeightAdjustment emsProdplanWeightAdjustment = emsProdplanWeightAdjustmentMapper.selectByPrimaryKey(model.getId());
|
|
|
+ if (emsProdplanWeightAdjustment != null ) {
|
|
|
+ if (emsProdplanWeightAdjustment.getAuditStatus().equals("3")) {
|
|
|
+ return failed(null,"计划编号为:"+emsProdplanWeightAdjustment.getId()+",生产部已经审批,请勿重复操作");
|
|
|
+ }
|
|
|
+ if(emsProdplanWeightAdjustment.getAuditStatus().equals("4")){
|
|
|
+ return failed(null,"计划编号为:"+emsProdplanWeightAdjustment.getId()+",计划审核失败,请勿重复操作");
|
|
|
+ }
|
|
|
+ emsProdplanWeightAdjustment.setGmReviewer(userId);
|
|
|
+ emsProdplanWeightAdjustment.setGmReviewerTime(new Date());
|
|
|
+ emsProdplanWeightAdjustment.setAuditStatus("0");
|
|
|
+ emsProdplanWeightAdjustmentMapper.updateByPrimaryKey(emsProdplanWeightAdjustment);
|
|
|
+ result = true;
|
|
|
+ soketMessage+=model.getId()+",";
|
|
|
+ if(result){
|
|
|
+ soketMessage += "不通过,请注意查看";
|
|
|
+ String[] roles = {"国贸-业务人员"};
|
|
|
+ Map <String, Object> map = new HashMap<String,Object>();
|
|
|
+ map.put("role",roles);
|
|
|
+ map.put("title","销售订单重量调整");
|
|
|
+ map.put("message",soketMessage);
|
|
|
+ map.put("tips","您好,有提交的订单不通过,请注意查看。");
|
|
|
+ soketMessage= JSON.toJSONString(map);
|
|
|
+ webSocket.sendAllMessage(soketMessage);
|
|
|
+ }
|
|
|
}
|
|
|
- if(emsProdplanWeightAdjustment.getAuditStatus().equals("4")){
|
|
|
- return failed(null,"该计划审核失败,请勿重复操作");
|
|
|
+ }
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping(value = "agreement", produces = "application/json;charset=UTF-8")
|
|
|
+ public RESTfulResult agreement(@RequestBody EmsProdplanWeightAdjustment[] models){
|
|
|
+ String userId = JwtUtil.getUseridByToken();
|
|
|
+// String soketMessage="国贸订单编号";
|
|
|
+// boolean result = false;
|
|
|
+ for (EmsProdplanWeightAdjustment model : models) {
|
|
|
+ EmsProdplanWeightAdjustment emsProdplanWeightAdjustment = emsProdplanWeightAdjustmentMapper.selectByPrimaryKey(model.getId());
|
|
|
+ if (emsProdplanWeightAdjustment != null ) {
|
|
|
+ if (emsProdplanWeightAdjustment.getAuditStatus().equals("0")) {
|
|
|
+ return failed(null,"计划编号为:"+emsProdplanWeightAdjustment.getId()+",还未走审批流程,操作失败");
|
|
|
+ }
|
|
|
+ if (emsProdplanWeightAdjustment.getAuditStatus().equals("1")) {
|
|
|
+ return failed(null,"计划编号为:"+emsProdplanWeightAdjustment.getId()+",领导部门还未审批,操作失败");
|
|
|
+ }
|
|
|
+ if (emsProdplanWeightAdjustment.getAuditStatus().equals("3")) {
|
|
|
+ return failed(null,"计划编号为:"+emsProdplanWeightAdjustment.getId()+",该计划生产部已经审批,请勿重复操作");
|
|
|
+ }
|
|
|
+ if(emsProdplanWeightAdjustment.getAuditStatus().equals("4")){
|
|
|
+ return failed(null,"计划编号为:"+emsProdplanWeightAdjustment.getId()+",审核失败,请勿重复操作");
|
|
|
+ }
|
|
|
+ EmsGmPcJh emsGmPcJh = emsGmPcJhMapper.selectByPrimaryKey(model.getId());
|
|
|
+ emsGmPcJh.setPlanWeight(emsProdplanWeightAdjustment.getPlanWeight());
|
|
|
+ emsProdplanWeightAdjustment.setReviewer(userId);
|
|
|
+ emsProdplanWeightAdjustment.setReviewerTime(new Date());
|
|
|
+ emsProdplanWeightAdjustment.setAuditStatus("3");
|
|
|
+ emsProdplanWeightAdjustment.setPlanWeightOld(emsProdplanWeightAdjustment.getRecordWeight());
|
|
|
+ emsProdplanWeightAdjustmentMapper.updateByPrimaryKey(emsProdplanWeightAdjustment);
|
|
|
+ emsGmPcJhMapper.updateByPrimaryKey(emsGmPcJh);
|
|
|
+// result = true;
|
|
|
+// soketMessage+=model.getId()+",";
|
|
|
+// if(result){
|
|
|
+// soketMessage += "已通过,请注意查看";
|
|
|
+// String[] roles = {"国贸-部门领导"};
|
|
|
+// Map <String, Object> map = new HashMap<String,Object>();
|
|
|
+// map.put("role",roles);
|
|
|
+// map.put("title","销售订单重量调整");
|
|
|
+// map.put("message",soketMessage);
|
|
|
+// map.put("tips","您好,有提交的订单不通过,请注意查看。");
|
|
|
+// soketMessage= JSON.toJSONString(map);
|
|
|
+// webSocket.sendAllMessage(soketMessage);
|
|
|
+// }
|
|
|
}
|
|
|
- EmsGmPcJh emsGmPcJh = emsGmPcJhMapper.selectByPrimaryKey(id);
|
|
|
- emsGmPcJh.setPlanWeight(emsProdplanWeightAdjustment.getPlanWeight());
|
|
|
- emsProdplanWeightAdjustment.setAuditStatus("3");
|
|
|
- emsProdplanWeightAdjustment.setPlanWeightOld(emsProdplanWeightAdjustment.getRecordWeight());
|
|
|
- emsProdplanWeightAdjustmentMapper.updateByPrimaryKey(emsProdplanWeightAdjustment);
|
|
|
- emsGmPcJhMapper.updateByPrimaryKey(emsGmPcJh);
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
return success();
|
|
|
}
|
|
|
- @PutMapping(value = "rejected/{id}", produces = "application/json;charset=UTF-8")
|
|
|
- public RESTfulResult rejected(@PathVariable String id){
|
|
|
- EmsProdplanWeightAdjustment emsProdplanWeightAdjustment = emsProdplanWeightAdjustmentMapper.selectByPrimaryKey(id);
|
|
|
- if (emsProdplanWeightAdjustment != null ) {
|
|
|
- if (emsProdplanWeightAdjustment.getAuditStatus().equals("0")) {
|
|
|
- return failed(null,"该计划还未走审批流程,操作失败");
|
|
|
- }
|
|
|
- if (emsProdplanWeightAdjustment.getAuditStatus().equals("1")) {
|
|
|
- return failed(null, "领导部门还未审批,操作失败");
|
|
|
- }
|
|
|
- if(emsProdplanWeightAdjustment.getAuditStatus().equals("4")){
|
|
|
- return failed(null,"该计划审核失败,请勿重复操作");
|
|
|
+ @PutMapping(value = "rejected", produces = "application/json;charset=UTF-8")
|
|
|
+ public RESTfulResult rejected(@RequestBody EmsProdplanWeightAdjustment[] models){
|
|
|
+ String userId = JwtUtil.getUseridByToken();
|
|
|
+ for (EmsProdplanWeightAdjustment model : models) {
|
|
|
+ EmsProdplanWeightAdjustment emsProdplanWeightAdjustment = emsProdplanWeightAdjustmentMapper.selectByPrimaryKey(model.getId());
|
|
|
+ if (emsProdplanWeightAdjustment != null ) {
|
|
|
+ if (emsProdplanWeightAdjustment.getAuditStatus().equals("0")) {
|
|
|
+ return failed(null,"计划编号为:"+emsProdplanWeightAdjustment.getId()+",还未走审批流程,操作失败");
|
|
|
+ }
|
|
|
+ if (emsProdplanWeightAdjustment.getAuditStatus().equals("1")) {
|
|
|
+ return failed(null, "计划编号为:"+emsProdplanWeightAdjustment.getId()+",领导部门还未审批,操作失败");
|
|
|
+ }
|
|
|
+ if(emsProdplanWeightAdjustment.getAuditStatus().equals("4")){
|
|
|
+ return failed(null,"计划编号为:"+emsProdplanWeightAdjustment.getId()+",审核失败,请勿重复操作");
|
|
|
+ }
|
|
|
+ emsProdplanWeightAdjustment.setPlanWeight(emsProdplanWeightAdjustment.getPlanWeightOld());
|
|
|
+ emsProdplanWeightAdjustment.setReviewer(userId);
|
|
|
+ emsProdplanWeightAdjustment.setReviewerTime(new Date());
|
|
|
+ emsProdplanWeightAdjustment.setAuditStatus("4");
|
|
|
+ emsProdplanWeightAdjustmentMapper.updateByPrimaryKey(emsProdplanWeightAdjustment);
|
|
|
+
|
|
|
}
|
|
|
- emsProdplanWeightAdjustment.setPlanWeight(emsProdplanWeightAdjustment.getPlanWeightOld());
|
|
|
- emsProdplanWeightAdjustment.setAuditStatus("4");
|
|
|
- emsProdplanWeightAdjustmentMapper.updateByPrimaryKey(emsProdplanWeightAdjustment);
|
|
|
}
|
|
|
- return success();
|
|
|
+ return success();
|
|
|
}
|
|
|
|
|
|
}
|