|
@@ -13,15 +13,13 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.google.gson.GsonBuilder;
|
|
|
-import org.apache.commons.lang.StringUtils;
|
|
|
+import org.jeecg.common.constant.CommonConstant;
|
|
|
+import org.jeecg.common.system.util.JwtUtil;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
+import org.jeecg.common.util.RedisUtil;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
-import org.jeecg.modules.spapl.entity.SyPreAssembledPackingList;
|
|
|
-import org.jeecg.modules.spapl.entity.SyPreAssembledPackingListItem;
|
|
|
-import org.jeecg.modules.spapl.service.ISyPreAssembledPackingListItemService;
|
|
|
import org.jeecg.modules.spapl.service.ISyPreAssembledPackingListService;
|
|
|
-import org.jeecg.modules.spapl.vo.PackingHeaderVo;
|
|
|
import org.jeecg.modules.spapl.vo.SyPreAssembledPackingListVo;
|
|
|
import org.jeecg.modules.splt.vo.SyPackingListTailoringVo;
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
@@ -68,7 +66,8 @@ public class SyPackingListTailoringController {
|
|
|
private ISyPackingListTailoringService syPackingListTailoringService;
|
|
|
@Autowired
|
|
|
private ISyPackingListTailoringItemService syPackingListTailoringItemService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private RedisUtil redisUtil;
|
|
|
/**
|
|
|
* 分页列表查询
|
|
|
*
|
|
@@ -193,28 +192,82 @@ public class SyPackingListTailoringController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 编辑
|
|
|
- *
|
|
|
- * @param syPackingListTailoring
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "装箱单成衣-编辑")
|
|
|
- @ApiOperation(value="装箱单成衣-编辑", notes="装箱单成衣-编辑")
|
|
|
- @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
- public Result<SyPackingListTailoring> edit(@RequestBody SyPackingListTailoring syPackingListTailoring) {
|
|
|
- Result<SyPackingListTailoring> result=new Result<>();
|
|
|
- if(oConvertUtils.isEmpty(syPackingListTailoring)){
|
|
|
- result.setMessage("对象为空");
|
|
|
+ * 编辑
|
|
|
+ *
|
|
|
+ * @param syPackingListTailoring
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "装箱单成衣-编辑")
|
|
|
+ @ApiOperation(value="装箱单成衣-编辑", notes="装箱单成衣-编辑")
|
|
|
+ @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
+ public Result<SyPackingListTailoring> edit(@RequestBody SyPackingListTailoring syPackingListTailoring) {
|
|
|
+ Result<SyPackingListTailoring> result=new Result<>();
|
|
|
+ if(oConvertUtils.isEmpty(syPackingListTailoring)){
|
|
|
+ result.setMessage("对象为空");
|
|
|
+ result.setSuccess(false);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ syPackingListTailoringService.updateMain2(syPackingListTailoring);
|
|
|
+ result.setSuccess(true);
|
|
|
+ result.setMessage("编辑成功!");
|
|
|
+ result.setResult(syPackingListTailoring);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 提交
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "装箱单成衣-提交")
|
|
|
+ @ApiOperation(value="装箱单成衣-提交", notes="装箱单成衣-提交")
|
|
|
+ @RequestMapping(value = "/submit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
+ public Result<?> submit(@RequestBody String id) {
|
|
|
+ Result result=new Result();
|
|
|
+ if(oConvertUtils.isEmpty(id)){
|
|
|
+ result.setMessage("id为空");
|
|
|
+ result.setSuccess(false);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ SyPackingListTailoring syPackingListTailoring=syPackingListTailoringService.getById(id);
|
|
|
+ if(syPackingListTailoring==null){
|
|
|
+ result.setMessage("未查到id对应的数据");
|
|
|
result.setSuccess(false);
|
|
|
return result;
|
|
|
}
|
|
|
- syPackingListTailoringService.updateMain2(syPackingListTailoring);
|
|
|
- result.setSuccess(true);
|
|
|
- result.setMessage("编辑成功!");
|
|
|
- result.setResult(syPackingListTailoring);
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
+ syPackingListTailoring.setStatus("1");//修改为已提交
|
|
|
+ syPackingListTailoringService.updateById(syPackingListTailoring);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 取消提交
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "装箱单成衣-取消提交")
|
|
|
+ @ApiOperation(value="装箱单成衣-取消提交", notes="装箱单成衣-取消提交")
|
|
|
+ @RequestMapping(value = "/cancelSubmit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
+ public Result<?> cancelSubmit(@RequestBody String id) {
|
|
|
+ Result result=new Result();
|
|
|
+ if(oConvertUtils.isEmpty(id)){
|
|
|
+ result.setMessage("id为空");
|
|
|
+ result.setSuccess(false);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ SyPackingListTailoring syPackingListTailoring=syPackingListTailoringService.getById(id);
|
|
|
+ if(syPackingListTailoring==null){
|
|
|
+ result.setMessage("未查到id对应的数据");
|
|
|
+ result.setSuccess(false);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ syPackingListTailoring.setStatus("0");//修改为已保存
|
|
|
+ syPackingListTailoringService.updateById(syPackingListTailoring);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 通过id删除
|
|
|
*
|
|
@@ -370,7 +423,7 @@ public class SyPackingListTailoringController {
|
|
|
list.add(syPackingListTailoring);
|
|
|
Gson userGson = new GsonBuilder().create();
|
|
|
JSONObject jsonObjec=new JSONObject();
|
|
|
- jsonObjec.put("payload", userGson.toJson(JSONObject.toJSON(list)));
|
|
|
+ jsonObjec.put("splt", userGson.toJson(JSONObject.toJSON(list)));
|
|
|
return jsonObjec;
|
|
|
}
|
|
|
|
|
@@ -387,7 +440,7 @@ public class SyPackingListTailoringController {
|
|
|
//获取对象
|
|
|
JSONObject jsonObject = json.getJSONObject(i);
|
|
|
//获取json名
|
|
|
- String spapl = jsonObject.get("spapl").toString();
|
|
|
+ String spapl = jsonObject.get("splt").toString();
|
|
|
//转list
|
|
|
List<SyPackingListTailoring> syPackingListTailorings=JSONObject.parseArray(spapl,SyPackingListTailoring.class);
|
|
|
//生成数据
|
|
@@ -404,4 +457,28 @@ public class SyPackingListTailoringController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取token
|
|
|
+ *
|
|
|
+ * @param username,syspassword
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "获取token")
|
|
|
+ @ApiOperation(value="获取token", notes="获取token")
|
|
|
+ @RequestMapping(value = "/getToken", method = {RequestMethod.GET})
|
|
|
+ public Result getToken(String username,String syspassword) {
|
|
|
+ Result result=new Result();
|
|
|
+ if(redisUtil.get(CommonConstant.PREFIX_USER_TOKEN + "yungctest")!=null){
|
|
|
+ result.setTimestamp(redisUtil.getExpire(CommonConstant.PREFIX_USER_TOKEN + "yungctest"));
|
|
|
+ result.setResult(redisUtil.get(CommonConstant.PREFIX_USER_TOKEN + "yungctest"));
|
|
|
+ }else{
|
|
|
+ String token = JwtUtil.sign(username, syspassword);//生成token
|
|
|
+ redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + "yungctest", token);
|
|
|
+ redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + "yungctest", JwtUtil.EXPIRE_TIME * 2 / 1000);
|
|
|
+ result.setTimestamp(redisUtil.getExpire(CommonConstant.PREFIX_USER_TOKEN + "yungctest"));
|
|
|
+ result.setResult(redisUtil.get(CommonConstant.PREFIX_USER_TOKEN + "yungctest"));
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
}
|