动火作业 service层方法

pull/4/head
fangjiakai 2024-01-24 09:59:54 +08:00
parent abeb80f88d
commit 25d0947d7f
1 changed files with 38 additions and 41 deletions

View File

@ -45,8 +45,8 @@ public class HotworkServiceImpl implements HotworkService {
@Autowired
private Smb smb;
private final static String primary_key = "HOTWORK_ID";
private final static String work_type = "HOTWORK";
private final String primary_key = "HOTWORK_ID";
private final String work_type = "HOTWORK";
@Override
@Transactional
public void save(PageData pd) throws Exception {
@ -105,44 +105,47 @@ public class HotworkServiceImpl implements HotworkService {
@Override
@Transactional
public void nextStep(PageData pd, MultipartFile[] files) throws Exception {
PageData work = this.findById(pd);
work.putAll(pd);
List<String> filePaths = new ArrayList<>();
for (int i = 0; i < files.length; i++) {
//保存签名文件
String ffile = DateUtil.getDays();
String fileName = UuidUtil.get32UUID() + files[i].getOriginalFilename().substring(files[i].getOriginalFilename().lastIndexOf("."));
smb.sshSftp(files[i], fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
filePaths.add(Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
smb.sshSftp(files[i], fileName, Const.FILEPATHFILE + work.getString("CORPINFO_ID") + "/" + ffile);
filePaths.add(Const.FILEPATHFILE + work.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
}
PageData flow = getStep(pd.get("TASK_ID"), pd.get("STEP_ID"));
pd.put("STEP_ID", flow.get("NEXT_STEP_ID"));
PageData flow = getStep(work.get("TASK_ID"), work.get("STEP_ID"));
work.put("STEP_ID", flow.get("NEXT_STEP_ID"));
//保存签名信息
PageData sign = new PageData();
sign.put(primary_key, pd.get(primary_key));
sign.put("STEP_ID", pd.get("STEP_ID"));
sign.put("SIGN_USER_ID", pd.get("USER_ID"));
sign.put("SIGN_TIME", pd.getString("SIGNTIME"));
sign.put(primary_key, work.get(primary_key));
sign.put("STEP_ID", work.get("STEP_ID"));
sign.put("SIGN_USER_ID", work.get("USER_ID"));
sign.put("SIGN_TIME", work.getString("SIGNTIME"));
sign.put("SIGN_PATH", String.join(",",filePaths));
sign.put("DESCR", pd.get("DESCR"));
sign.put("DESCR", work.get("DESCR"));
hotworkSignMapper.edit(sign);
if (pd.get("MEASURES") != null && !pd.get("MEASURES").equals("")) { //安全措施确认步骤
saveMeasures(pd);
if (work.get("MEASURES") != null && !work.get("MEASURES").equals("")) { //安全措施确认步骤
saveMeasures(work);
}
List<PageData> unsignedList = hotworkSignMapper.checkUnsigned(sign);//当前步骤未签名人列表
if(unsignedList == null || unsignedList.size() == 0){//如果没有未签人 则跳转下一步
hotworkMapper.editStep(pd);
hotworkMapper.editStep(work);
PageData currentflow = getStep(work.get("TASK_ID"), work.get("STEP_ID"));
if (pd.get("PREPARERS") != null && !pd.get("PREPARERS").equals("")) { //如果是设置安全措施确认人步骤
savePreparers(pd,flow);
if (work.get("PREPARERS") != null && !work.get("PREPARERS").equals("")) { //如果是设置安全措施确认人步骤
savePreparers(work,currentflow);
}
//保存日志
saveLog(pd,pd.getString(flow.get("ACTOR_FIELD")),"1");
saveLog(work,work.getString(flow.get("ACTOR_FIELD")),"1");
PageData currentflow = getStep(pd.get("TASK_ID"), pd.get("STEP_ID"));
saveNextSigner(pd,currentflow);
saveNextSigner(work,currentflow);
}
}
@ -271,19 +274,16 @@ public class HotworkServiceImpl implements HotworkService {
private void saveMeasures(PageData pd) {
List<JSONObject> list = (List<JSONObject>) JSON.parse(pd.get("PREPARERS").toString());
for (JSONObject json : list) {
if (json.get("DEPARTMENT_ID") != null && json.get("DEPARTMENT_ID") != "" && json.get("USER_ID") != null
&& json.get("USER_ID") != "") {
PageData measure = new PageData();
measure.put("HOTWORKTOMEASURES_ID",json.get("BUS_HOTWORK_MEASURES_ID"));
measure.put("STATUS", json.get("STATUS"));
measure.put("ANSWER1", json.get("ANSWER1"));
measure.put("ANSWER2", json.get("ANSWER2"));
measure.put("ANSWER3", json.get("ANSWER3"));
measure.put("ANSWER4", json.get("ANSWER4"));
measure.put("SIGN_PATH", json.get("SIGN_PATH"));
measure.put("IMG_PATH", json.get("IMG_PATH"));
hotworkToMeasuresMapper.edit(measure);
}
PageData measure = new PageData();
measure.put("HOTWORKTOMEASURES_ID",json.get("BUS_HOTWORK_MEASURES_ID"));
measure.put("STATUS", json.get("STATUS"));
measure.put("ANSWER1", json.get("ANSWER1"));
measure.put("ANSWER2", json.get("ANSWER2"));
measure.put("ANSWER3", json.get("ANSWER3"));
measure.put("ANSWER4", json.get("ANSWER4"));
measure.put("SIGN_PATH", json.get("SIGN_PATH"));
measure.put("IMG_PATH", json.get("IMG_PATH"));
hotworkToMeasuresMapper.edit(measure);
}
}
@ -291,15 +291,12 @@ public class HotworkServiceImpl implements HotworkService {
List<PageData> signers = new ArrayList<>();
List<JSONObject> list = (List<JSONObject>) JSON.parse(pd.get("PREPARERS").toString());
for (JSONObject json : list) {
if (json.get("DEPARTMENT_ID") != null && json.get("DEPARTMENT_ID") != "" && json.get("USER_ID") != null
&& json.get("USER_ID") != "") {
PageData preparer = new PageData();
preparer.put("HOTWORKTOMEASURES_ID", UuidUtil.get32UUID()); // 主键
preparer.put("HOTWORK_ID", pd.get("HOTWORK_ID"));
preparer.put("BUS_HOTWORK_MEASURES_ID", json.get("BUS_HOTWORK_MEASURES_ID"));
preparer.put("CONFIRM_ID", json.get("USER_ID"));
signers.add(preparer);
}
PageData preparer = new PageData();
preparer.put("HOTWORKTOMEASURES_ID", UuidUtil.get32UUID()); // 主键
preparer.put("HOTWORK_ID", pd.get("HOTWORK_ID"));
preparer.put("BUS_HOTWORK_MEASURES_ID", json.get("BUS_HOTWORK_MEASURES_ID"));
preparer.put("CONFIRM_ID", json.get("USER_ID"));
signers.add(preparer);
}
if(signers.size() > 0){
hotworkToMeasuresMapper.saveBatch(signers);