[新增] 流程批量保存

This commit is contained in:
bupengxiang
2023-05-11 11:17:13 +08:00
parent a45fbd6242
commit d9778cb8e6
10 changed files with 128 additions and 15 deletions
@@ -71,7 +71,6 @@ public class IpowerApplyActServiceImpl extends ServiceImpl<PowerApplyActDao, Pow
*/ */
public void saveOrUpdateSingle(PowerApplyAct powerApplyAct) { public void saveOrUpdateSingle(PowerApplyAct powerApplyAct) {
if (StringUtils.isEmpty(powerApplyAct.getId())) { if (StringUtils.isEmpty(powerApplyAct.getId())) {
// powerApplyAct.setId(UUID.randomUUID().toString().replaceAll("-",""));
baseMapper.insert(powerApplyAct); baseMapper.insert(powerApplyAct);
} else { } else {
baseMapper.updateById(powerApplyAct); baseMapper.updateById(powerApplyAct);
@@ -50,8 +50,17 @@ public class ActivitDefineService {
if (StringUtils.isBlank(reportId)){ if (StringUtils.isBlank(reportId)){
reportId = UUID.randomUUID().toString().replace("-",""); reportId = UUID.randomUUID().toString().replace("-","");
} }
if ("1".equals(prcType)){ if ("".equals(prcType)){
//预览 // 保存到草稿 ,没有选择 要申请的权限
PowerApplyAct powerApplyAct = JSONObject.parseObject(dataJson, PowerApplyAct.class);
powerApplyAct.setDataId(reportId);
powerApplyAct.setTaskId(taskId);
powerApplyAct.setPrcId(prcId);
powerApplyAct.setDelFlag(0);
powerApplyAct.setCreateDate(new Date());
iPowerApplyActService.saveOrUpdateSingle(powerApplyAct);
} else if("1".equals(prcType)){
//预览 + 下载
PowerApplyAct powerApplyAct = JSONObject.parseObject(dataJson, PowerApplyAct.class); PowerApplyAct powerApplyAct = JSONObject.parseObject(dataJson, PowerApplyAct.class);
powerApplyAct.setDataId(reportId); powerApplyAct.setDataId(reportId);
powerApplyAct.setTaskId(taskId); powerApplyAct.setTaskId(taskId);
@@ -100,6 +109,29 @@ public class ActivitDefineService {
} }
iReportLabelService.saveBatch(labelList); iReportLabelService.saveBatch(labelList);
} }
}else if ("5".equals(prcType)){
// 编辑
TtReportManageAct ttReportManageAct = JSONObject.parseObject(dataJson, TtReportManageAct.class);
ttReportManageAct.setDataId(reportId);
ttReportManageAct.setTaskId(taskId);
ttReportManageAct.setPrcId(prcId);
ttReportManageAct.setDelFlag(0);
ttReportManageAct.setCreateDate(new Date());
ttReportManageActService.saveOrUpdateSingle(ttReportManageAct);
//插入报表标签关系表
//修改报表标签关系表(先删后增)
iReportLabelService.deleteReportLabelByReportId(new String[]{reportId});
if (CollectionUtils.isNotEmpty(ttReportManageAct.getLabelList())){
List<ReportLabelEntity> labelList = new ArrayList<>();
for (String label : ttReportManageAct.getLabelList()) {
JSONArray objects = JSONObject.parseArray(label);
String lastLabel =(String)objects.get(objects.size()-1);
ReportLabelEntity reportLabelEntity = new ReportLabelEntity(com.adc.da.util.utils.UUID.randomUUID10()
,ttReportManageAct.getDataId(), label,lastLabel);
labelList.add(reportLabelEntity);
}
iReportLabelService.saveBatch(labelList);
}
} }
return reportId; return reportId;
} }
@@ -492,8 +492,8 @@ public class TodoTaskController {
BusProcessNewVO busProcessNewVO = this.queryDetailDate(busProcessNew, prcType); BusProcessNewVO busProcessNewVO = this.queryDetailDate(busProcessNew, prcType);
//审批数据 //审批数据
List<BusProcessApprove> busProcessApproves1 = busProcessApproveMapper.selectEoByDataId(busProcessNewVO.getDataId()); List<BusProcessApprove> busProcessApproves1 = busProcessApproveMapper.selectEoByDataId(busProcessNewVO.getDataId());
BusProcessApprove busProcessApprove = busProcessApproves1.get(0); if (CollectionUtils.isNotEmpty(busProcessApproves1)){
if (busProcessApprove!=null){ BusProcessApprove busProcessApprove = busProcessApproves1.get(0);
String approveJson = busProcessApprove.getFromValsJson(); String approveJson = busProcessApprove.getFromValsJson();
busProcessNewVO.setSubmitJson(approveJson); busProcessNewVO.setSubmitJson(approveJson);
} }
@@ -605,7 +605,8 @@ public class TodoTaskController {
public Wrapper<String> saveTaskFirst(@RequestBody ApproveDataVO approveDataVO) { public Wrapper<String> saveTaskFirst(@RequestBody ApproveDataVO approveDataVO) {
String dataJson = approveDataVO.getDataJson(); String dataJson = approveDataVO.getDataJson();
String submitJson = approveDataVO.getSubmitJson(); String submitJson = approveDataVO.getSubmitJson();
String reportId = approveDataVO.getReportId(); // String reportId = approveDataVO.getReportId();
String reportId = UUID.randomUUID().toString().replace("-","");
String saveId = null; String saveId = null;
String dataId = null; String dataId = null;
if (approveDataVO.getId() != null && !approveDataVO.getId().equals("")) { if (approveDataVO.getId() != null && !approveDataVO.getId().equals("")) {
@@ -658,19 +659,105 @@ public class TodoTaskController {
//存储审批数据 //存储审批数据
if (StringUtils.isNotEmpty(submitJson)){ if (StringUtils.isNotEmpty(submitJson)){
List<BusProcessApprove> busProcessApproves = busProcessApproveMapper.selectEoByDataId(dataId); List<BusProcessApprove> busProcessApproves = busProcessApproveMapper.selectEoByDataId(dataId);
BusProcessApprove busProcessApprove = busProcessApproves.get(0); BusProcessApprove busProcessApprove = new BusProcessApprove();
if (busProcessApprove == null){ if(CollectionUtils.isNotEmpty(busProcessApproves)){
busProcessApprove = busProcessApproves.get(0);
busProcessApprove.setFromValsJson(submitJson);
}else {
busProcessApprove = new BusProcessApprove(); busProcessApprove = new BusProcessApprove();
busProcessApprove.setDataId(dataId); busProcessApprove.setDataId(dataId);
busProcessApprove.setCreateDate(new Date()); busProcessApprove.setCreateDate(new Date());
busProcessApprove.setFromValsJson(submitJson);
busProcessApprove.setCreateUserId(approveDataVO.getCreateUser()); busProcessApprove.setCreateUserId(approveDataVO.getCreateUser());
} }
busProcessApprove.setFromValsJson(submitJson);
ibusProcessApproveService.saveOrUpdate(busProcessApprove); ibusProcessApproveService.saveOrUpdate(busProcessApprove);
} }
return WrapMapper.ok(saveId); return WrapMapper.ok(saveId);
} }
/**
* 批量保存任务第一步
*/
@ApiOperation(value = "批量保存任务第一步")
@PostMapping("/batchSaveTaskFirst")
public Wrapper<String> batchSaveTaskFirst(@RequestBody List<ApproveDataVO> approveDataVOList) {
StringBuilder saveIdList = new StringBuilder();
for (ApproveDataVO approveDataVO : approveDataVOList) {
String dataJson = approveDataVO.getDataJson();
String submitJson = approveDataVO.getSubmitJson();
// String reportId = approveDataVO.getReportId();
String reportId = UUID.randomUUID().toString().replace("-","");
String saveId = null;
String dataId = null;
if (approveDataVO.getId() != null && !approveDataVO.getId().equals("")) {
saveId = approveDataVO.getId();
QueryWrapper<BusProcessName> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("CREAT_USER", approveDataVO.getCreateUser());
queryWrapper.eq("PRC_TYPE", approveDataVO.getPrcType());
queryWrapper.eq("ID", approveDataVO.getId());
queryWrapper.isNull("PRC_ID");
List<BusProcessName> list = iBusProcessNameService.list(queryWrapper);
if (list != null && list.size() > 0) {
BusProcessName busProcessName = list.get(0);
busProcessName.setPrcName(approveDataVO.getPrcName());
busProcessName.setSubmitStatus(SubmitStatusEnum.DRAFT.getValue());
if (StringUtils.isNotEmpty(dataJson)){
//根据业务情况 对业务数据进行saveOrupdate
dataId = activitDefineService.saveOrUpdateDate(approveDataVO.getPrcType(), dataJson, null,
null,reportId);
busProcessName.setDataId(dataId);
}
iBusProcessNameService.saveOrUpdate(busProcessName);
}
} else {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String time = sdf.format(new Date());
BusProcessName busProcessName = new BusProcessName();
if (StringUtils.isNotEmpty(dataJson)) {
//根据业务情况 对业务数据进行saveOrupdate
dataId = activitDefineService.saveOrUpdateDate(approveDataVO.getPrcType(), dataJson,
approveDataVO.getTaskId(),"",reportId);
busProcessName.setDataId(dataId);
}
busProcessName.setPrcType(approveDataVO.getPrcType());
busProcessName.setPrcName(approveDataVO.getPrcName());
busProcessName.setCreatUser(approveDataVO.getCreateUser());
busProcessName.setCreatTime(time);
busProcessName.setCreatUserName(approveDataVO.getCreateUserName());
busProcessName.setSubmitStatus(SubmitStatusEnum.DRAFT.getValue());
iBusProcessNameService.save(busProcessName);
QueryWrapper<BusProcessName> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("CREAT_TIME", time);
queryWrapper.eq("CREATE_USER_NAME", approveDataVO.getCreateUserName());
queryWrapper.eq("PRC_TYPE", approveDataVO.getPrcType());
queryWrapper.eq("CREAT_USER", approveDataVO.getCreateUser());
// BusProcessName one = iBusProcessNameService.getOne(queryWrapper);
saveId = busProcessName.getId();
saveIdList.append(","+saveId);
}
//存储审批数据
if (StringUtils.isNotEmpty(submitJson)){
List<BusProcessApprove> busProcessApproves = busProcessApproveMapper.selectEoByDataId(dataId);
BusProcessApprove busProcessApprove = new BusProcessApprove();
if(CollectionUtils.isNotEmpty(busProcessApproves)){
busProcessApprove = busProcessApproves.get(0);
busProcessApprove.setFromValsJson(submitJson);
}else {
busProcessApprove = new BusProcessApprove();
busProcessApprove.setDataId(dataId);
busProcessApprove.setCreateDate(new Date());
busProcessApprove.setFromValsJson(submitJson);
busProcessApprove.setCreateUserId(approveDataVO.getCreateUser());
}
ibusProcessApproveService.saveOrUpdate(busProcessApprove);
}
}
String saveIdstring = saveIdList.substring(1, saveIdList.length());
return WrapMapper.ok(saveIdstring);
}
/** /**
* 查询任务第一步 * 查询任务第一步
* *
@@ -9,6 +9,7 @@ public enum FlowTypeEnum {
YLXZSQ("2","预览+下载申请","QXSQ","预览+下载申请",""), YLXZSQ("2","预览+下载申请","QXSQ","预览+下载申请",""),
XZSQ("3","下载申请","QXSQ","下载申请",""), XZSQ("3","下载申请","QXSQ","下载申请",""),
SCBGLC("4","上传审批","SCBG","上传审批",""), SCBGLC("4","上传审批","SCBG","上传审批",""),
BJBGLC("5","编辑报告","BJBG","编辑报告",""),
; ;
private String value; private String value;
@@ -58,11 +58,5 @@ public class reEditAfter implements TaskListener {
//审批人 //审批人
delegateTask.setVariable("oneApprove",object.getString("oneApprove")); delegateTask.setVariable("oneApprove",object.getString("oneApprove"));
delegateTask.setVariable("twoApprove",object.getString("twoApprove")); delegateTask.setVariable("twoApprove",object.getString("twoApprove"));
// 1: 同意 2:退回
delegateTask.setVariable("flag",s);
if ("1".equals(s)){
iPowerApplyService.saveBatch(powerApplyActs);
}
} }
} }