Merge remote-tracking branch 'origin/czks1.0' into czks1.0

pull/14/head
dearlin 2023-12-26 08:45:56 +08:00
commit b9622c745f
8 changed files with 48 additions and 22 deletions

View File

@ -424,7 +424,6 @@ public class AppHiddenController extends BaseController {
pd.put("hiddenExamine", JSON.toJSONString(hiddenExamine)); pd.put("hiddenExamine", JSON.toJSONString(hiddenExamine));
PageData hiddenExaminePageData = new PageData(); PageData hiddenExaminePageData = new PageData();
hiddenExaminePageData.putAll(before); hiddenExaminePageData.putAll(before);
if (pd.get("RISKITEM_ID") != null && Tools.notEmpty(pd.get("RISKITEM_ID").toString())) { if (pd.get("RISKITEM_ID") != null && Tools.notEmpty(pd.get("RISKITEM_ID").toString())) {
if ("2".equals(pd.getString("SOURCE"))) { if ("2".equals(pd.getString("SOURCE"))) {
PageData item = new PageData(); PageData item = new PageData();

View File

@ -207,12 +207,13 @@ public class AppSafetyEnvironmentalController extends BaseController {
@RequestMapping(value="/explain") @RequestMapping(value="/explain")
//@RequiresPermissions("safetyenvironmental:edit") //@RequiresPermissions("safetyenvironmental:edit")
@ResponseBody @ResponseBody
@DockAnnotation @DockAnnotation(hasAnnex = true)
public Object explain(@RequestParam(value="FFILE",required=false) MultipartFile[] files) throws Exception{ public Object explain(@RequestParam(value="FFILE",required=false) MultipartFile[] files) throws Exception{
Map<String,Object> map = new HashMap<String,Object>(); Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success"; String errInfo = "success";
PageData pd = new PageData(); PageData pd = new PageData();
pd = this.getPageData(); pd = this.getPageData();
ArrayList<String> strings = new ArrayList<>();
if (files != null && files.length > 0) { if (files != null && files.length > 0) {
MultipartFile file = files[0]; MultipartFile file = files[0];
String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
@ -222,12 +223,11 @@ public class AppSafetyEnvironmentalController extends BaseController {
map.put("msg", "文件格式不正确!"); map.put("msg", "文件格式不正确!");
return map; return map;
} }
String ffile = DateUtil.getDays(); String ffile = DateUtil.getDays();
String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
pd.put("INSPECTION_ORIGINATOR_SIGN_IMG", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); pd.put("INSPECTION_ORIGINATOR_SIGN_IMG", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
strings.add(pd.getString("INSPECTION_ORIGINATOR_SIGN_IMG")+"@@"+fileName);
} }
PageData log = safetyenvironmentalService.explain(pd); PageData log = safetyenvironmentalService.explain(pd);
pd.put("log",JSON.toJSONString(log)); pd.put("log",JSON.toJSONString(log));
@ -235,6 +235,7 @@ public class AppSafetyEnvironmentalController extends BaseController {
noticeCorpUtil.FailPleadind(pd); noticeCorpUtil.FailPleadind(pd);
map.put("pd", pd); map.put("pd", pd);
map.put("result", errInfo); map.put("result", errInfo);
map.put("sendPicturesList",JSON.toJSONString(strings));
map.put("dockData",JSON.toJSONString(pd)); map.put("dockData",JSON.toJSONString(pd));
return map; return map;
} }

View File

@ -80,7 +80,7 @@ public class AppSafetyEnvironmentalExplainController extends BaseController {
*/ */
@RequestMapping(value = "/add") @RequestMapping(value = "/add")
@ResponseBody @ResponseBody
@DockAnnotation @DockAnnotation(hasAnnex = true)
public Object add(@RequestParam(value = "FFILE", required = false) MultipartFile file) throws Exception { public Object add(@RequestParam(value = "FFILE", required = false) MultipartFile file) throws Exception {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success"; String errInfo = "success";
@ -94,6 +94,7 @@ public class AppSafetyEnvironmentalExplainController extends BaseController {
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
pd.put("VALID","1"); pd.put("VALID","1");
pd.put("ISPASS","0"); pd.put("ISPASS","0");
ArrayList<String> strings = new ArrayList<>();
if (null != file && !file.isEmpty()) { if (null != file && !file.isEmpty()) {
String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) { if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
@ -106,12 +107,14 @@ public class AppSafetyEnvironmentalExplainController extends BaseController {
String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
pd.put("INSPECTED_SITEUSER_SIGN_IMG", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); pd.put("INSPECTED_SITEUSER_SIGN_IMG", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
strings.add(pd.getString("INSPECTED_SITEUSER_SIGN_IMG")+"@@"+fileName);
} }
PageData log = safetyenvironmentalexplainService.save(pd); PageData log = safetyenvironmentalexplainService.save(pd);
pd.put("logData", log); pd.put("logData", log);
noticeCorpUtil.SE_PleadingStepUtil(pd); noticeCorpUtil.SE_PleadingStepUtil(pd);
map.put("pd", pd); map.put("pd", pd);
map.put("result", errInfo); map.put("result", errInfo);
map.put("sendPicturesList",JSON.toJSONString(strings));
map.put("dockData", JSON.toJSONString(pd)); map.put("dockData", JSON.toJSONString(pd));
return map; return map;
} }

View File

@ -65,7 +65,7 @@ public class AppSafetyEnvironmentalInspectorController extends BaseController {
*/ */
@RequestMapping(value = "/verify") @RequestMapping(value = "/verify")
@ResponseBody @ResponseBody
@DockAnnotation @DockAnnotation(hasAnnex = true)
public Object verify(@RequestParam(value = "FFILE", required = false) MultipartFile[] files) throws Exception { public Object verify(@RequestParam(value = "FFILE", required = false) MultipartFile[] files) throws Exception {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success"; String errInfo = "success";
@ -78,6 +78,7 @@ public class AppSafetyEnvironmentalInspectorController extends BaseController {
uBean.put("OPERATOR", pd.getString("OPERATOR")); //修改人 uBean.put("OPERATOR", pd.getString("OPERATOR")); //修改人
uBean.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 uBean.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
uBean.put("ACTION_USER", pd.getString("ACTION_USER")); //操作人 uBean.put("ACTION_USER", pd.getString("ACTION_USER")); //操作人
ArrayList<String> strings = new ArrayList<>();
if (files != null && files.length > 0) { if (files != null && files.length > 0) {
MultipartFile file = files[0]; MultipartFile file = files[0];
String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
@ -91,14 +92,15 @@ public class AppSafetyEnvironmentalInspectorController extends BaseController {
String ffile = DateUtil.getDays(); String ffile = DateUtil.getDays();
String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
uBean.put("INSPECTION_USER_SIGN_IMG", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); uBean.put("INSPECTION_USER_SIGN_IMG", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
strings.add(uBean.getString("INSPECTION_USER_SIGN_IMG")+"@@"+fileName);
} }
pd.put("uBean", JSON.toJSONString(uBean)); pd.put("uBean", JSON.toJSONString(uBean));
PageData verify = safetyenvironmentalinspectorService.verify(uBean); PageData verify = safetyenvironmentalinspectorService.verify(uBean);
pd.put("verify",JSON.toJSONString(verify)); pd.put("verify",JSON.toJSONString(verify));
map.put("pd", pd); map.put("pd", pd);
map.put("result", errInfo); map.put("result", errInfo);
map.put("sendPicturesList",JSON.toJSONString(strings));
map.put("dockData", JSON.toJSONString(pd)); map.put("dockData", JSON.toJSONString(pd));
return map; return map;
} }

View File

@ -2181,6 +2181,7 @@ public class HiddenController extends BaseController {
List<PageData> deptHeadmanAllList = usersService.listUserBYids(deptHeadmanIds.split(",")); List<PageData> deptHeadmanAllList = usersService.listUserBYids(deptHeadmanIds.split(","));
if (deptHeadmanAllList.size() == 0) { if (deptHeadmanAllList.size() == 0) {
map.put("exception", "未查询到管理单位负责人需要重新维护"); map.put("exception", "未查询到管理单位负责人需要重新维护");
map.put("dockData",JSON.toJSONString(pd));
return map; return map;
} else { } else {
messageService.sendMessageByParameter("HIDDEN_MAIL_001", "友情提示:有一条隐患需要核实", messageService.sendMessageByParameter("HIDDEN_MAIL_001", "友情提示:有一条隐患需要核实",
@ -2268,7 +2269,7 @@ public class HiddenController extends BaseController {
} }
String ffile = DateUtil.getDays(); String ffile = DateUtil.getDays();
String fileName = this.get32UUID() + fileTwo.getOriginalFilename().substring(fileTwo.getOriginalFilename().lastIndexOf(".")); String fileName = this.get32UUID() + fileTwo.getOriginalFilename().substring(fileTwo.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(fileTwo, fileName, Const.FILEPATHYHTP + Jurisdiction.getCORPINFO_ID() + "/" + ffile,IMGFILES_ID,pd.getString("HIDDEN_ID"),pd.getString("TYPE")); Smb.sshSftp(fileTwo, fileName, Const.FILEPATHYHTP + Jurisdiction.getCORPINFO_ID() + "/" + ffile,IMGFILES_ID,pd.getString("HIDDEN_ID"),examine.getString("TYPE"));
examine.put("FILEPATH", Const.FILEPATHYHTP + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); examine.put("FILEPATH", Const.FILEPATHYHTP + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName);
imgFilesService.save(examine);//保存上传的PDF imgFilesService.save(examine);//保存上传的PDF
} }

View File

@ -8,6 +8,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.fastjson.JSON;
import com.zcloud.aspect.DockAnnotation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -48,6 +50,7 @@ public class QualificationsController extends BaseController {
@RequestMapping(value="/add") @RequestMapping(value="/add")
@RequiresPermissions("qualifications:add") @RequiresPermissions("qualifications:add")
@ResponseBody @ResponseBody
@DockAnnotation
public Object add() throws Exception{ public Object add() throws Exception{
Map<String,Object> map = new HashMap<String,Object>(); Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success"; String errInfo = "success";
@ -63,6 +66,7 @@ public class QualificationsController extends BaseController {
qualificationsService.save(pd); qualificationsService.save(pd);
map.put("pd", pd); map.put("pd", pd);
map.put("result", errInfo); map.put("result", errInfo);
map.put("dockData", JSON.toJSONString(pd));
return map; return map;
} }
@ -73,6 +77,7 @@ public class QualificationsController extends BaseController {
@RequestMapping(value="/delete") @RequestMapping(value="/delete")
@RequiresPermissions("qualifications:del") @RequiresPermissions("qualifications:del")
@ResponseBody @ResponseBody
@DockAnnotation
public Object delete() throws Exception{ public Object delete() throws Exception{
Map<String,String> map = new HashMap<String,String>(); Map<String,String> map = new HashMap<String,String>();
String errInfo = "success"; String errInfo = "success";
@ -103,6 +108,7 @@ public class QualificationsController extends BaseController {
@RequestMapping(value="/edit") @RequestMapping(value="/edit")
@RequiresPermissions("qualifications:edit") @RequiresPermissions("qualifications:edit")
@ResponseBody @ResponseBody
@DockAnnotation
public Object edit() throws Exception{ public Object edit() throws Exception{
Map<String,Object> map = new HashMap<String,Object>(); Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success"; String errInfo = "success";

View File

@ -8,6 +8,8 @@ import java.util.Map;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
import com.zcloud.aspect.DockAnnotation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -31,7 +33,7 @@ import com.zcloud.util.Tools;
import com.zcloud.entity.PageData; import com.zcloud.entity.PageData;
import com.zcloud.service.bus.RiskWarningService; import com.zcloud.service.bus.RiskWarningService;
/** /**
* *
* luoxiaobao * luoxiaobao
* 2021-04-27 * 2021-04-27
@ -40,10 +42,10 @@ import com.zcloud.service.bus.RiskWarningService;
@Controller @Controller
@RequestMapping("/riskwarning") @RequestMapping("/riskwarning")
public class RiskWarningController extends BaseController { public class RiskWarningController extends BaseController {
@Autowired @Autowired
private RiskWarningService riskwarningService; private RiskWarningService riskwarningService;
/** /**
* @param * @param
* @throws Exception * @throws Exception
@ -51,6 +53,7 @@ public class RiskWarningController extends BaseController {
@RequestMapping(value="/add") @RequestMapping(value="/add")
@RequiresPermissions("riskwarning:add") @RequiresPermissions("riskwarning:add")
@ResponseBody @ResponseBody
@DockAnnotation(hasAnnex = true)
public Object add(@RequestParam(value="FFILE",required=false) MultipartFile file) throws Exception{ public Object add(@RequestParam(value="FFILE",required=false) MultipartFile file) throws Exception{
Map<String,Object> map = new HashMap<String,Object>(); Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success"; String errInfo = "success";
@ -62,7 +65,8 @@ public class RiskWarningController extends BaseController {
pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人 pd.put("OPERATOR", Jurisdiction.getUsername()); //修改人
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
pd.put("ISDELETE", "0"); //是否删除 1-是 0-否 pd.put("ISDELETE", "0"); //是否删除 1-是 0-否
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
ArrayList<String> strings = new ArrayList<>();
if (null != file && !file.isEmpty()) { if (null != file && !file.isEmpty()) {
String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) { if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
@ -80,12 +84,15 @@ public class RiskWarningController extends BaseController {
//pd.put("FILESIZE", FileUtil.getFilesize(Const.HTTPFILEURL + Const.FILEPATHFXSST + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName)); //文件大小 //pd.put("FILESIZE", FileUtil.getFilesize(Const.HTTPFILEURL + Const.FILEPATHFXSST + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName)); //文件大小
pd.put("FILESIZE",size); pd.put("FILESIZE",size);
pd.put("FILEPATH", Const.FILEPATHFXSST + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); pd.put("FILEPATH", Const.FILEPATHFXSST + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName);
strings.add(pd.getString("FILEPATH")+"@@"+fileName);
} }
riskwarningService.save(pd); riskwarningService.save(pd);
map.put("result", errInfo); map.put("result", errInfo);
map.put("sendPicturesList", JSON.toJSONString(strings));
map.put("dockData",JSON.toJSONString(pd));
return map; return map;
} }
/** /**
* @param out * @param out
* @throws Exception * @throws Exception
@ -93,6 +100,7 @@ public class RiskWarningController extends BaseController {
@RequestMapping(value="/delete") @RequestMapping(value="/delete")
@RequiresPermissions("riskwarning:del") @RequiresPermissions("riskwarning:del")
@ResponseBody @ResponseBody
@DockAnnotation
public Object delete() throws Exception{ public Object delete() throws Exception{
Map<String,String> map = new HashMap<String,String>(); Map<String,String> map = new HashMap<String,String>();
String errInfo = "success"; String errInfo = "success";
@ -102,7 +110,7 @@ public class RiskWarningController extends BaseController {
map.put("result", errInfo); //返回结果 map.put("result", errInfo); //返回结果
return map; return map;
} }
/** /**
* @param * @param
* @throws Exception * @throws Exception
@ -119,7 +127,7 @@ public class RiskWarningController extends BaseController {
map.put("result", errInfo); map.put("result", errInfo);
return map; return map;
} }
/** /**
* @param page * @param page
* @throws Exception * @throws Exception
@ -134,7 +142,7 @@ public class RiskWarningController extends BaseController {
pd = this.getPageData(); pd = this.getPageData();
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件
if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim()); if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim());
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
page.setPd(pd); page.setPd(pd);
List<PageData> varList = riskwarningService.list(page); //列出RiskWarning列表 List<PageData> varList = riskwarningService.list(page); //列出RiskWarning列表
map.put("varList", varList); map.put("varList", varList);
@ -142,7 +150,7 @@ public class RiskWarningController extends BaseController {
map.put("result", errInfo); map.put("result", errInfo);
return map; return map;
} }
/** /**
* @param * @param
* @throws Exception * @throws Exception
@ -159,8 +167,8 @@ public class RiskWarningController extends BaseController {
map.put("pd", pd); map.put("pd", pd);
map.put("result", errInfo); map.put("result", errInfo);
return map; return map;
} }
/** /**
* @param * @param
* @throws Exception * @throws Exception
@ -171,7 +179,7 @@ public class RiskWarningController extends BaseController {
public Object deleteAll() throws Exception{ public Object deleteAll() throws Exception{
Map<String,Object> map = new HashMap<String,Object>(); Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success"; String errInfo = "success";
PageData pd = new PageData(); PageData pd = new PageData();
pd = this.getPageData(); pd = this.getPageData();
String DATA_IDS = pd.getString("DATA_IDS"); String DATA_IDS = pd.getString("DATA_IDS");
if(Tools.notEmpty(DATA_IDS)){ if(Tools.notEmpty(DATA_IDS)){
@ -184,7 +192,7 @@ public class RiskWarningController extends BaseController {
map.put("result", errInfo); //返回结果 map.put("result", errInfo); //返回结果
return map; return map;
} }
/** /**
* @param * @param
* @throws Exception * @throws Exception
@ -239,5 +247,5 @@ public class RiskWarningController extends BaseController {
mv = new ModelAndView(erv,dataMap); mv = new ModelAndView(erv,dataMap);
return mv; return mv;
} }
} }

View File

@ -2,6 +2,7 @@ package com.zcloud.controller.bus;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.zcloud.aspect.DockAnnotation;
import com.zcloud.controller.base.BaseController; import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page; import com.zcloud.entity.Page;
import com.zcloud.entity.PageData; import com.zcloud.entity.PageData;
@ -45,6 +46,7 @@ public class ShiftWorkRulesController extends BaseController {
@RequestMapping(value="/add") @RequestMapping(value="/add")
@RequiresPermissions("shiftworkrules:add") @RequiresPermissions("shiftworkrules:add")
@ResponseBody @ResponseBody
@DockAnnotation
public Object add() throws Exception{ public Object add() throws Exception{
Map<String,Object> map = new HashMap<String,Object>(); Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success"; String errInfo = "success";
@ -60,6 +62,7 @@ public class ShiftWorkRulesController extends BaseController {
if (Tools.notEmpty(pd.getString("ISCUSTOM")) && "1".equals(pd.getString("ISCUSTOM")) if (Tools.notEmpty(pd.getString("ISCUSTOM")) && "1".equals(pd.getString("ISCUSTOM"))
&& pd.get("periodList") != null && !pd.get("periodList").equals("")) { && pd.get("periodList") != null && !pd.get("periodList").equals("")) {
List<JSONObject> periodList = (List<JSONObject>) JSON.parse(pd.get("periodList").toString()); List<JSONObject> periodList = (List<JSONObject>) JSON.parse(pd.get("periodList").toString());
ArrayList<PageData> periodLists = new ArrayList<>();
for (int i = 0; i < periodList.size(); i++) { for (int i = 0; i < periodList.size(); i++) {
PageData period = new PageData(); PageData period = new PageData();
period.put("SHIFTWORKPERIOD_ID",this.get32UUID()); period.put("SHIFTWORKPERIOD_ID",this.get32UUID());
@ -74,11 +77,14 @@ public class ShiftWorkRulesController extends BaseController {
period.put("SHIFTWORKRULES_ID", pd.get("SHIFTWORKRULES_ID")); period.put("SHIFTWORKRULES_ID", pd.get("SHIFTWORKRULES_ID"));
period.put("SORT", i+1); period.put("SORT", i+1);
period.put("ISEND", i < periodList.size()-1 ? 0 : 1); period.put("ISEND", i < periodList.size()-1 ? 0 : 1);
periodLists.add(period);
shiftWorkPeriodService.save(period); shiftWorkPeriodService.save(period);
} }
pd.put("periodList",JSON.toJSONString(periodLists));
} }
shiftworkrulesService.save(pd); shiftworkrulesService.save(pd);
map.put("result", errInfo); map.put("result", errInfo);
map.put("dockData",JSON.toJSONString(pd));
return map; return map;
} }