|
@@ -1,13 +1,15 @@
|
|
package com.steerinfo.ems.emsgmpcjh.controller;
|
|
package com.steerinfo.ems.emsgmpcjh.controller;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
import com.steerinfo.auth.utils.JwtUtil;
|
|
import com.steerinfo.auth.utils.JwtUtil;
|
|
import com.steerinfo.ems.Utils.DateUtils;
|
|
import com.steerinfo.ems.Utils.DateUtils;
|
|
|
|
+import com.steerinfo.ems.Utils.WebSocket;
|
|
import com.steerinfo.ems.emsgmpcjh.mapper.EmsGmPcJhMapper;
|
|
import com.steerinfo.ems.emsgmpcjh.mapper.EmsGmPcJhMapper;
|
|
import com.steerinfo.ems.emsgmpcjh.model.EmsGmPcJh;
|
|
import com.steerinfo.ems.emsgmpcjh.model.EmsGmPcJh;
|
|
|
|
+import com.steerinfo.ems.emsgmpcjh.service.IEmsGmPcJhService;
|
|
import com.steerinfo.framework.controller.BaseRESTfulController;
|
|
import com.steerinfo.framework.controller.BaseRESTfulController;
|
|
import com.steerinfo.framework.controller.RESTfulResult;
|
|
import com.steerinfo.framework.controller.RESTfulResult;
|
|
import com.steerinfo.framework.service.pagehelper.PageList;
|
|
import com.steerinfo.framework.service.pagehelper.PageList;
|
|
-import com.steerinfo.ems.emsgmpcjh.service.IEmsGmPcJhService;
|
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -15,8 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
-import java.rmi.MarshalledObject;
|
|
|
|
-import java.util.*;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* EmsGmPcJh RESTful接口:
|
|
* EmsGmPcJh RESTful接口:
|
|
@@ -43,6 +46,8 @@ public class EmsGmPcJhController extends BaseRESTfulController {
|
|
IEmsGmPcJhService emsGmPcJhService;
|
|
IEmsGmPcJhService emsGmPcJhService;
|
|
@Autowired
|
|
@Autowired
|
|
EmsGmPcJhMapper emsGmPcJhMapper;
|
|
EmsGmPcJhMapper emsGmPcJhMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private WebSocket webSocket;
|
|
|
|
|
|
@ApiOperation(value="获取列表", notes="分页查询")
|
|
@ApiOperation(value="获取列表", notes="分页查询")
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
@@ -170,17 +175,34 @@ public class EmsGmPcJhController extends BaseRESTfulController {
|
|
@PutMapping(value = "/updatestate", produces = "application/json;charset=UTF-8")
|
|
@PutMapping(value = "/updatestate", produces = "application/json;charset=UTF-8")
|
|
public RESTfulResult updatestate(@RequestBody EmsGmPcJh[] models){
|
|
public RESTfulResult updatestate(@RequestBody EmsGmPcJh[] models){
|
|
String userId = JwtUtil.getUseridByToken();
|
|
String userId = JwtUtil.getUseridByToken();
|
|
|
|
+ String soketMessage="国贸订单编号";
|
|
|
|
+ boolean result = false;
|
|
for (EmsGmPcJh model : models) {
|
|
for (EmsGmPcJh model : models) {
|
|
EmsGmPcJh emsGmPcJh = this.emsGmPcJhMapper.selectByPrimaryKey(model.getId());
|
|
EmsGmPcJh emsGmPcJh = this.emsGmPcJhMapper.selectByPrimaryKey(model.getId());
|
|
if(emsGmPcJh.getState().equals("2")) {
|
|
if(emsGmPcJh.getState().equals("2")) {
|
|
return failed(null,"操作失败,编号为"+emsGmPcJh.getId()+"已经接收");
|
|
return failed(null,"操作失败,编号为"+emsGmPcJh.getId()+"已经接收");
|
|
}
|
|
}
|
|
|
|
+ if(emsGmPcJh.getState().equals("0")) {
|
|
|
|
+ result = true;
|
|
|
|
+ soketMessage+=emsGmPcJh.getId()+",";
|
|
|
|
+ }
|
|
model.setYxfWeight(new BigDecimal("0"));
|
|
model.setYxfWeight(new BigDecimal("0"));
|
|
model.setKxfWeight(model.getPlanWeight());
|
|
model.setKxfWeight(model.getPlanWeight());
|
|
model.setUpdateTime(new Date());
|
|
model.setUpdateTime(new Date());
|
|
model.setUpdateMan(userId);
|
|
model.setUpdateMan(userId);
|
|
emsGmPcJhService.updateState(model);
|
|
emsGmPcJhService.updateState(model);
|
|
}
|
|
}
|
|
|
|
+ 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();
|
|
return success();
|
|
}
|
|
}
|
|
@ApiOperation(value="获取列表", notes="分页模糊查询")
|
|
@ApiOperation(value="获取列表", notes="分页模糊查询")
|