安全承诺完成

pull/14/head
dearlin 2023-12-26 11:41:06 +08:00
parent ea0e12e364
commit 1894777d56
2 changed files with 123 additions and 54 deletions

View File

@ -2,6 +2,7 @@ package com.zcloud.controller.bus;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.aspect.DockAnnotation;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
@ -11,6 +12,7 @@ import com.zcloud.service.bus.CorpPromiseService;
import com.zcloud.service.bus.ImgFilesService;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.ReturnMap;
import com.zcloud.util.Tools;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -46,7 +48,13 @@ public class CorpPromiseController extends BaseController {
*/
@RequestMapping(value = "/add")
@ResponseBody
@DockAnnotation
public Object add() throws Exception {
PageData dockData = new PageData();
ArrayList<PageData> corpPromiseDetails = new ArrayList<>();
ArrayList<PageData> corpPromisePeoples = new ArrayList<>();
ArrayList<PageData> coverPeoples = new ArrayList<>();
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
@ -63,6 +71,7 @@ public class CorpPromiseController extends BaseController {
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //创建时间
pd.put("RELEASE_PLATFORM", "1");//企业端发布
corpPromiseService.save(pd);
dockData.put("corpPromiseSave",JSON.toJSONString(pd));
List<JSONObject> list = (List<JSONObject>) JSON.parse(pd.getString("DETAIL")); //副文内容
if (list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
@ -72,7 +81,9 @@ public class CorpPromiseController extends BaseController {
promise.put("COLLATERAL", list.get(i).get("value"));
promise.put("SORTINDEX", list.get(i).get("index"));
corpPromiseDetailsService.save(promise);
corpPromiseDetails.add(promise);
}
dockData.put("corpPromiseDetailsSave",JSON.toJSONString(corpPromiseDetails));
}
if (people.size() > 0) { //承诺人数据
int num = 0;
@ -90,12 +101,15 @@ public class CorpPromiseController extends BaseController {
promise.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
promise.put("ISPROMISE_PEOPLE", "0");
corpPromisePeopleService.save(promise);
corpPromisePeoples.add(promise);
num++;
}
dockData.put("corpPromisePeopleSave",JSON.toJSONString(corpPromisePeoples));
}
}
pd.put("PEOPLENUM_INVOLVED", num);
corpPromiseService.editpeople(pd);
dockData.put("editPeople",JSON.toJSONString(pd));
}
List<JSONObject> coverpeople = (List<JSONObject>) JSON.parse(pd.getString("coverpeople"));
if (coverpeople.size() > 0) { //被承诺人数据
@ -113,12 +127,14 @@ public class CorpPromiseController extends BaseController {
promise.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
promise.put("ISPROMISE_PEOPLE", "1");
corpPromisePeopleService.save(promise);
coverPeoples.add(promise);
}
dockData.put("coverPeopleList",JSON.toJSONString(coverPeoples));
}
}
}
}
map.put("result", errInfo);
map.put("dockData", JSON.toJSONString(dockData));
return map;
}
@ -169,13 +185,22 @@ public class CorpPromiseController extends BaseController {
*/
@RequestMapping(value = "/editdelete")
@ResponseBody
@DockAnnotation
public Object editdelete() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
if (Tools.notEmpty(pd.getString("dockData"))) {
// 咱们的对接流程 如有异常 使用 throw new BizException();
PageData dockData = JSON.parseObject(pd.getString("dockData"), PageData.class);
corpPromiseService.editdelete(dockData);
// 正常返回
return ReturnMap.ok();
}
corpPromiseService.editdelete(pd);
map.put("result", errInfo);
map.put("dockData", JSON.toJSONString(pd));
return map;
}
@ -244,12 +269,17 @@ public class CorpPromiseController extends BaseController {
*/
@RequestMapping(value = "/edit")
@ResponseBody
@DockAnnotation
public Object edit() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //创建时间
PageData dockData = new PageData();
ArrayList<PageData> corpPromiseDetails = new ArrayList<>();
ArrayList<PageData> corpPromisePeoples = new ArrayList<>();
ArrayList<PageData> coverPeoples = new ArrayList<>();
corpPromiseService.edit(pd);
corpPromiseDetailsService.deletePromiseId(pd);
List<JSONObject> list = (List<JSONObject>) JSON.parse(pd.getString("DETAIL"));
@ -261,9 +291,12 @@ public class CorpPromiseController extends BaseController {
promise.put("COLLATERAL", list.get(i).get("value"));
promise.put("SORTINDEX", list.get(i).get("index"));
corpPromiseDetailsService.save(promise);
corpPromiseDetails.add(promise);
}
dockData.put("corpPromiseDetails",JSON.toJSONString(corpPromiseDetails));
}
corpPromisePeopleService.deletePromiseId(pd); //先删除承诺人数据,再新增
dockData.put("baseData",JSON.toJSONString(pd));
List<JSONObject> people = (List<JSONObject>) JSON.parse(pd.getString("people"));
if (people.size() > 0) { //承诺人数据
int num = 0;
@ -282,11 +315,15 @@ public class CorpPromiseController extends BaseController {
promise.put("ISPROMISE_PEOPLE", "0");
corpPromisePeopleService.save(promise);
num++;
corpPromisePeoples.add(promise);
}
dockData.put("corpPromisePeoples",JSON.toJSONString(corpPromisePeoples));
}
}
pd.put("PEOPLENUM_INVOLVED", num);
corpPromiseService.editpeople(pd);
dockData.put("editData",JSON.toJSONString(pd));
}
List<JSONObject> coverpeople = (List<JSONObject>) JSON.parse(pd.getString("coverpeople"));
if (coverpeople.size() > 0) { //被承诺人数据
@ -304,11 +341,14 @@ public class CorpPromiseController extends BaseController {
promise.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
promise.put("ISPROMISE_PEOPLE", "1");
corpPromisePeopleService.save(promise);
coverPeoples.add(promise);
}
dockData.put("coverPeoples",JSON.toJSONString(coverPeoples));
}
}
}
map.put("result", errInfo);
map.put("dockData", JSON.toJSONString(dockData));
return map;
}
@ -432,18 +472,24 @@ public class CorpPromiseController extends BaseController {
*/
@RequestMapping(value = "/delete")
@ResponseBody
@DockAnnotation
public Object delete() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
PageData dockData = new PageData();
List<PageData> corpPromisePeopleList = new ArrayList<>();
List<PageData> promiseList = corpPromisePeopleService.getListAllByPromiseId(pd);
for (PageData pageData : promiseList) {
corpPromisePeopleService.delete(pageData);
corpPromisePeopleList.add(pageData);
}
corpPromiseService.delete(pd);
dockData.put("removeData",JSON.toJSONString(pd));
dockData.put("corpPromisePeopleList",JSON.toJSONString(corpPromisePeopleList));
map.put("result", errInfo);
map.put("dockData", JSON.toJSONString(dockData));
return map;
}
}

View File

@ -1,10 +1,8 @@
package com.zcloud.controller.bus;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import com.zcloud.aspect.DockAnnotation;
import com.zcloud.util.Jurisdiction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -38,54 +36,63 @@ public class PromiseController extends BaseController {
@Autowired
private CorpPromisePeopleService corpPromisePeopleService;
/**
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value="/add")
@RequestMapping(value = "/add")
@ResponseBody
public Object add() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
@DockAnnotation
public Object add() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("PROMISE_ID", this.get32UUID()); //主键
pd.put("ISDELETE",0);
pd.put("ISDELETE", 0);
pd.put("CREATOR", "admin"); //创建人
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //创建时间
pd.put("OPERATOR", "admin"); //创建人
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //创建时间
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
promiseService.save(pd);
ArrayList<PageData> promiseDetailList = new ArrayList<>();
List<JSONObject> list = (List<JSONObject>) JSON.parse(pd.getString("DETAIL"));
if(list.size()>0){
for (int i=0;i<list.size();i++) {
if (list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
PageData promise = new PageData();
promise.put("PROMISEDETAIL_ID", this.get32UUID()); //主键
promise.put("PROMISE_ID", pd.getString("PROMISE_ID")); //外键ID
promise.put("COLLATERAL",list.get(i).get("value"));
promise.put("SORTINDEX",list.get(i).get("index"));
promise.put("COLLATERAL", list.get(i).get("value"));
promise.put("SORTINDEX", list.get(i).get("index"));
promiseDetailsService.save(promise);
promiseDetailList.add(promise);
}
pd.put("promiseDetailList", JSON.toJSONString(promiseDetailList));
}
map.put("result", errInfo);
map.put("dockData", JSON.toJSONString(pd));
return map;
}
/**
/**
*
*
* @param page
* @throws Exception
*/
@RequestMapping(value="/list")
@RequestMapping(value = "/list")
@ResponseBody
public Object list(Page page) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
public Object list(Page page) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
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());
page.setPd(pd);
List<PageData> varList = promiseService.list(page); //列出Notice列表
@ -95,92 +102,108 @@ public class PromiseController extends BaseController {
return map;
}
/**
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value="/editdelete")
@RequestMapping(value = "/editdelete")
@ResponseBody
public Object editdelete() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
@DockAnnotation
public Object editdelete() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
promiseService.editdelete(pd);
map.put("result", errInfo);
map.put("dockData", JSON.toJSONString(pd));
return map;
}
/**
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value="/goEdit")
@RequestMapping(value = "/goEdit")
@ResponseBody
public Object goEdit() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
public Object goEdit() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
PageData promise = promiseService.findById(pd);
List<PageData> promistDetail = promiseDetailsService.findByPromiseId(pd);
map.put("promistDetail",promistDetail);
map.put("promistDetail", promistDetail);
map.put("varList", promise);
map.put("result", errInfo);
return map;
}
/**
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value="/edit")
@RequestMapping(value = "/edit")
@ResponseBody
public Object edit() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
@DockAnnotation
public Object edit() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //创建时间
promiseService.edit(pd);
promiseDetailsService.deletePromiseId(pd);
ArrayList<PageData> promiseDetailList = new ArrayList<>();
List<JSONObject> list = (List<JSONObject>) JSON.parse(pd.getString("DETAIL"));
if(list.size()>0){
for (int i=0;i<list.size();i++) {
if (list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
PageData promise = new PageData();
promise.put("PROMISEDETAIL_ID", this.get32UUID()); //主键
promise.put("PROMISE_ID", pd.getString("PROMISE_ID")); //外键ID
promise.put("COLLATERAL",list.get(i).get("value"));
promise.put("SORTINDEX",list.get(i).get("index"));
promise.put("COLLATERAL", list.get(i).get("value"));
promise.put("SORTINDEX", list.get(i).get("index"));
promiseDetailsService.save(promise);
promiseDetailList.add(promise);
}
}
pd.put("promiseDetailList",JSON.toJSONString(promiseDetailList));
map.put("result", errInfo);
map.put("dockData", JSON.toJSONString(pd));
return map;
}
/**
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value="/delete")
@RequestMapping(value = "/delete")
@ResponseBody
public Object delete() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
public Object delete() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
// b3f6c82e51774b4b82e2a87363c8f1cf
List<PageData> coverpeople = corpPromisePeopleService.findByCoverPromiseId(pd); //被承诺人
List<PageData> people = corpPromisePeopleService.findByPromiseId(pd);//承诺人
if(coverpeople.size()>0){
if (coverpeople.size() > 0) {
map.put("result", "fail");
map.put("msg", "该承诺书有被承诺人,删除失败!");
return map;
}else if(people.size()>0){
} else if (people.size() > 0) {
map.put("result", "fail");
map.put("msg", "该承诺书有承诺人,删除失败!");
return map;
}else{
} else {
promiseService.delete(pd); // 删除
}
map.put("result", errInfo);