安全交底人单选变多选功能模块更新

liujun-2024-05-23-接口漏洞修复
liujun 2024-02-03 15:29:39 +08:00
parent 9c2991ee8d
commit 01d0df7124
8 changed files with 425 additions and 35 deletions

View File

@ -1470,6 +1470,8 @@ public class AppHotworkCfdController extends BaseController {
PageData pd = new PageData();
pd = this.getPageData();
pd = hotworkCfdService.findById(pd); //根据ID读取
// created by liu jun 添加(交底人、项目主管部门负责人、安全措施确认人)
hotworkCfdService.addInfo(pd);
map.put("measuresList", hotworkCfdService.listAllMeasures(pd));
map.put("gasList", hotworkGasCfdService.listAll(pd));
map.put("imgList", hotworkAcceptUserCfdService.findByIds(pd));
@ -1555,4 +1557,25 @@ public class AppHotworkCfdController extends BaseController {
map.put("count", count);
return map;
}
/**
*/
@RequestMapping(value="/getSafetyCheckItem")
@ResponseBody
public Object getSafetyCheckItem() throws Exception {
Map<String, Object> response = new HashMap<String, Object>();
try {
PageData request = this.getPageData();
request.put("APPLY_STATUS", 1);
response.put("measuresList", hotworkCfdService.listAllMeasures(request));
response.put("result", "success");
return response;
} catch (Exception e) {
e.printStackTrace();
response.put("code", "500");
response.put("message", e.getMessage());
return response;
}
}
}

View File

@ -0,0 +1,28 @@
package com.zcloud.mapper.datasource.highriskwork;
import java.util.List;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
/**
* (BusHotworkCfdExamine)访
*
* @author liu jun
* @since 2024-02-01 14:27:03
*/
public interface BusHotworkCfdExamineMapper {
int save(PageData entity);
int delete(PageData entity);
int edit(PageData pd);
List<PageData> datalistPage(Page page);
PageData findById(PageData condition);
List<PageData> listAll(PageData condition);
List<PageData> findByCondition(PageData condition);
}

View File

@ -0,0 +1,25 @@
package com.zcloud.service.highriskwork;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
* (BusHotworkCfdExamine)
*
* @author liu jun
* @since 2024-02-01 14:33:21
*/
public interface BusHotworkCfdExamineService {
int save(PageData entity)throws Exception;
int delete(PageData entity)throws Exception;
int edit(PageData entity)throws Exception;
List<PageData> list(Page page)throws Exception;
List<PageData> listAll(PageData entity)throws Exception;
}

View File

@ -84,5 +84,7 @@ public interface HotworkCfdService {
PageData countCheck(PageData pd)throws Exception;
PageData getCode(PageData pd)throws Exception;
void addInfo(PageData pd) throws Exception;
}

View File

@ -0,0 +1,43 @@
package com.zcloud.service.highriskwork.impl;
import com.zcloud.mapper.datasource.highriskwork.BusHotworkCfdExamineMapper;
import com.zcloud.service.highriskwork.BusHotworkCfdExamineService;
import org.springframework.stereotype.Service;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import javax.annotation.Resource;
import java.util.List;
/**
* (BusHotworkCfdExamine)
*
* @author liu jun
* @since 2024-02-01 14:33:21
*/
@Service
public class BusHotworkCfdExamineServiceImpl implements BusHotworkCfdExamineService {
@Resource
private BusHotworkCfdExamineMapper busHotworkCfdExamineMapper;
public int save(PageData entity)throws Exception{
return busHotworkCfdExamineMapper.save(entity);
}
public int delete(PageData entity)throws Exception{
return busHotworkCfdExamineMapper.delete(entity);
}
public int edit(PageData entity)throws Exception{
return busHotworkCfdExamineMapper.edit(entity);
}
public List<PageData> list(Page page)throws Exception{
return busHotworkCfdExamineMapper.datalistPage(page);
}
public List<PageData> listAll(PageData entity)throws Exception{
return busHotworkCfdExamineMapper.listAll(entity);
}
}

View File

@ -2,13 +2,20 @@ package com.zcloud.service.highriskwork.impl;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.highriskwork.BusHotworkCfdExamineMapper;
import com.zcloud.mapper.datasource.highriskwork.HotworkCfdMapper;
import com.zcloud.mapper.datasource.system.DepartmentMapper;
import com.zcloud.service.bus.CorpInfoService;
import com.zcloud.service.highriskwork.HotworkCfdService;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Warden;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
*
@ -20,31 +27,141 @@ import java.util.List;
@Transactional //开启事物
public class HotworkCfdServiceImpl implements HotworkCfdService {
@Autowired
@Resource
private HotworkCfdMapper hotworkCfdMapper;
@Resource
private BusHotworkCfdExamineMapper busHotworkCfdExamineMapper;
@Resource
private CorpInfoService corpInfoService;
@Resource
private DepartmentMapper departmentMapper;
/**
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception{
@Transactional
public void save(PageData pd)throws Exception {
hotworkCfdMapper.save(pd);
// created by liu jun 2024/02/01 保存动火交底人
this.saveConfess(pd.getString("confessList"), pd);
}
private void saveConfess(String json, PageData info) throws Exception{
List<PageData> list = Warden.getList(json);
String flowsId = Warden.get32UUID();
String time = DateUtil.getTime();
PageData condition = new PageData();
// 保存安全交底人
for (PageData x : list) {
PageData entity = new PageData();
entity.put("HOTWORK_EXAMINE_ID", Warden.get32UUID());
entity.put("HOTWORK_ID", info.getString("HOTWORK_ID"));
entity.put("FLOW_ID", flowsId);// 流程id
entity.put("USER_ID", x.get("CONFESS_USER_ID"));
entity.put("USER_NAME", x.get("CONFESS_USER_NAME"));
entity.put("DEPARTMENT_ID", x.get("CONFESS_DEPARTMENT_ID"));
entity.put("DEPARTMENT_NAME", x.get("CONFESS_DEPARTMENT_NAME"));
this.getCorpInfo(entity);
entity.put("TYPE", "0");
entity.put("TYPE_NAME", "动火交底人");
entity.put("APPROVAL_OPINIONS","");
entity.put("STATUS", "0");
entity.put("CREATE_TIME", time);
entity.put("VALID_FLAG", "1");
entity.put("IS_DELETE", "0");
busHotworkCfdExamineMapper.save(entity);
}
// 保存项目主管部门
PageData belonging = new PageData();
belonging.put("HOTWORK_EXAMINE_ID", Warden.get32UUID());
belonging.put("HOTWORK_ID", info.getString("HOTWORK_ID"));
belonging.put("FLOW_ID", flowsId);// 流程id
belonging.put("USER_ID", info.get("BELONGING_USER_ID"));
belonging.put("USER_NAME", info.get("BELONGING_USER_NAME"));
belonging.put("DEPARTMENT_ID", info.get("BELONGING_DEPARTMENT_ID"));
belonging.put("DEPARTMENT_NAME", info.get("BELONGING_DEPARTMENT_NAME"));
this.getCorpInfo(belonging);
belonging.put("TYPE", "1");
belonging.put("TYPE_NAME", "项目主管部门负责人");
belonging.put("APPROVAL_OPINIONS","");
belonging.put("STATUS", "0");
belonging.put("CREATE_TIME", time);
belonging.put("VALID_FLAG", "1");
belonging.put("IS_DELETE", "0");
busHotworkCfdExamineMapper.save(belonging);
// 保存安全项检查人
PageData safety = new PageData();
safety.put("HOTWORK_EXAMINE_ID", Warden.get32UUID());
safety.put("HOTWORK_ID", info.getString("HOTWORK_ID"));
safety.put("FLOW_ID", flowsId);// 流程id
safety.put("USER_ID", info.get("SAFETY_USER_ID"));
safety.put("USER_NAME", info.get("SAFETY_USER_NAME"));
safety.put("DEPARTMENT_ID", info.get("SAFETY_DEPARTMENT_ID"));
safety.put("DEPARTMENT_NAME", info.get("SAFETY_DEPARTMENT_NAME"));
this.getCorpInfo(safety);
safety.put("TYPE", "2");
safety.put("TYPE_NAME", "安全项检查人");
safety.put("APPROVAL_OPINIONS","");
safety.put("STATUS", "0");
safety.put("CREATE_TIME", time);
safety.put("VALID_FLAG", "1");
safety.put("IS_DELETE", "0");
busHotworkCfdExamineMapper.save(safety);
}
private void getCorpInfo(PageData entity) throws Exception {
PageData condition = new PageData();
condition.put("DEPARTMENT_ID", entity.getString("DEPARTMENT_ID"));
PageData dept = departmentMapper.findById(condition);
if (dept != null) {
condition.clear();
condition.put("CORPINFO_ID", dept.get("CORPINFO_ID"));
PageData corp = corpInfoService.findById(condition);
if (corp != null) {
entity.put("CORP_ID", corp.get("CORPINFO_ID"));
entity.put("CORP_NAME", corp.get("CORP_NAME"));
}
}
}
/**
* @param pd
* @throws Exception
*/
@Transactional
public void delete(PageData pd)throws Exception{
hotworkCfdMapper.delete(pd);
PageData condition = new PageData();
condition.put("HOTWORK_ID", pd.getString("HOTWORK_ID"));
List<PageData> oldEntity = busHotworkCfdExamineMapper.listAll(condition);
for (PageData entity : oldEntity) {
entity.put("IS_DELETE", "1");
busHotworkCfdExamineMapper.edit(entity);
}
}
/**
* @param pd
* @throws Exception
*/
@Transactional
public void edit(PageData pd)throws Exception{
hotworkCfdMapper.edit(pd);
// 删除原有的动火交底人
PageData condition = new PageData();
condition.put("HOTWORK_ID", pd.getString("HOTWORK_ID"));
List<PageData> oldEntity = busHotworkCfdExamineMapper.listAll(condition);
for (PageData entity : oldEntity) {
entity.put("IS_DELETE", "1");
busHotworkCfdExamineMapper.edit(entity);
}
// created by liu jun 2024/02/01 保存动火交底人
this.saveConfess(pd.getString("confessList"), pd);
}
/**
@ -146,5 +263,37 @@ public class HotworkCfdServiceImpl implements HotworkCfdService {
public PageData getCode(PageData pd)throws Exception{
return hotworkCfdMapper.getCode(pd);
}
@Override
public void addInfo(PageData pd) throws Exception {
PageData condition = new PageData();
condition.put("HOTWORK_ID", pd.getString("HOTWORK_ID"));
condition.put("IS_DELETE", "0");
condition.put("VALID_FLAG", "1");
List<PageData> approvalInfos = busHotworkCfdExamineMapper.findByCondition(condition);
if(approvalInfos == null || approvalInfos.size() == 0) throw new RuntimeException("未找到审批信息");
// 动火交底人
List<PageData> confess = approvalInfos.stream().filter(x -> "0".equals(x.getString("TYPE"))).collect(Collectors.toList());
for (PageData x : confess) {
x.put("CONFESS_USER_ID", x.get("USER_ID"));
x.put("CONFESS_USER_NAME", x.get("USER_NAME"));
x.put("CONFESS_DEPARTMENT_ID", x.get("DEPARTMENT_ID"));
x.put("CONFESS_DEPARTMENT_NAME", x.get("DEPARTMENT_NAME"));
}
pd.put("confessList", confess);
// 项目责任负责人
PageData belong = approvalInfos.stream().filter(x -> "1".equals(x.getString("TYPE"))).findFirst().orElse(null);
pd.put("BELONGING_USER_ID", belong.getString("USER_ID"));
pd.put("BELONGING_USER_NAME", belong.getString("USER_NAME"));
pd.put("BELONGING_DEPARTMENT_ID", belong.getString("DEPARTMENT_ID"));
pd.put("BELONGING_DEPARTMENT_NAME", belong.getString("DEPARTMENT_NAME"));
// 安全项检查人
PageData safety = approvalInfos.stream().filter(x -> "2".equals(x.getString("TYPE"))).findFirst().orElse(null);
pd.put("SAFETY_USER_ID", safety.getString("USER_ID"));
pd.put("SAFETY_USER_NAME", safety.getString("USER_NAME"));
pd.put("SAFETY_DEPARTMENT_ID", safety.getString("DEPARTMENT_ID"));
pd.put("SAFETY_DEPARTMENT_NAME", safety.getString("DEPARTMENT_NAME"));
}
}

View File

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.mapper.datasource.highriskwork.BusHotworkCfdExamineMapper">
<sql id="tableName">
bus_hotwork_cfd_examine
</sql>
<sql id="Field">
f.HOTWORK_EXAMINE_ID,
f.HOTWORK_ID,
f.CORP_ID,
f.CORP_NAME,
f.USER_ID,
f.USER_NAME,
f.DEPARTMENT_ID,
f.DEPARTMENT_NAME,
f.TYPE,
f.TYPE_NAME,
f.APPROVAL_OPINIONS,
f.APPROVAL_SIGNATURE,
f.APPROVAL_SIGNATURE_TIME,
f.FLOW_ID,
f.VALID_FLAG,
f.STATUS,
f.IS_DELETE,
f.CREATE_TIME,
f.REMARK
</sql>
<sql id="Field2">
HOTWORK_EXAMINE_ID,
HOTWORK_ID,
CORP_ID,
CORP_NAME,
USER_ID,
USER_NAME,
DEPARTMENT_ID,
DEPARTMENT_NAME,
TYPE,
TYPE_NAME,
APPROVAL_OPINIONS,
APPROVAL_SIGNATURE,
APPROVAL_SIGNATURE_TIME,
FLOW_ID,
VALID_FLAG,
STATUS,
IS_DELETE,
CREATE_TIME,
REMARK
</sql>
<sql id="FieldValue">
#{HOTWORK_EXAMINE_ID},
#{HOTWORK_ID},
#{CORP_ID},
#{CORP_NAME},
#{USER_ID},
#{USER_NAME},
#{DEPARTMENT_ID},
#{DEPARTMENT_NAME},
#{TYPE},
#{TYPE_NAME},
#{APPROVAL_OPINIONS},
#{APPROVAL_SIGNATURE},
#{APPROVAL_SIGNATURE_TIME},
#{FLOW_ID},
#{VALID_FLAG},
#{STATUS},
#{IS_DELETE},
#{CREATE_TIME},
#{REMARK}
</sql>
<!-- 新增 -->
<insert id="save" parameterType="pd">
insert into bus_hotwork_cfd_examine (<include refid="Field2"></include>) values (<include refid="FieldValue"></include>)
</insert>
<!-- 删除 -->
<delete id="delete" parameterType="pd">
delete from bus_hotwork_cfd_examine where HOTWORK_EXAMINE_ID = #{HOTWORK_EXAMINE_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update bus_hotwork_cfd_examine set
HOTWORK_EXAMINE_ID = #{HOTWORK_EXAMINE_ID},
HOTWORK_ID = #{HOTWORK_ID},
CORP_ID = #{CORP_ID},
CORP_NAME = #{CORP_NAME},
USER_ID = #{USER_ID},
USER_NAME = #{USER_NAME},
DEPARTMENT_ID = #{DEPARTMENT_ID},
DEPARTMENT_NAME = #{DEPARTMENT_NAME},
TYPE = #{TYPE},
TYPE_NAME = #{TYPE_NAME},
APPROVAL_OPINIONS = #{APPROVAL_OPINIONS},
APPROVAL_SIGNATURE = #{APPROVAL_SIGNATURE},
APPROVAL_SIGNATURE_TIME = #{APPROVAL_SIGNATURE_TIME},
FLOW_ID = #{FLOW_ID},
VALID_FLAG = #{VALID_FLAG},
STATUS = #{STATUS},
IS_DELETE = #{IS_DELETE},
CREATE_TIME = #{CREATE_TIME},
REMARK = #{REMARK}
where HOTWORK_EXAMINE_ID = #{HOTWORK_EXAMINE_ID}
</update>
<!-- 分页查询 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select * from bus_hotwork_cfd_examine a where a.IS_DELETE = '0'
</select>
<select id="findById" parameterType="pd" resultType="pd">
select * from bus_hotwork_cfd_examine a where a.HOTWORK_EXAMINE_ID = #{HOTWORK_EXAMINE_ID}
</select>
<select id="listAll" parameterType="pd" resultType="pd">
select * from bus_hotwork_cfd_examine f
</select>
<select id="findByCondition" resultType="com.zcloud.entity.PageData">
select * from bus_hotwork_cfd_examine f
<where>
<if test="HOTWORK_ID != null and HOTWORK_ID != ''">
and f.HOTWORK_ID = #{HOTWORK_ID}
</if>
<if test="CORP_ID != null and CORP_ID != ''">
and f.CORP_ID = #{CORP_ID}
</if>
<if test="USER_ID != null and USER_ID != ''">
and f.USER_ID = #{USER_ID}
</if>
<if test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''">
and f.DEPARTMENT_ID = #{DEPARTMENT_ID}
</if>
<if test="TYPE != null and TYPE != ''">
and f.TYPE = #{TYPE}
</if>
<if test="STATUS != null and STATUS != ''">
and f.STATUS = #{STATUS}
</if>
<if test="VALID_FLAG != null and VALID_FLAG != ''">
and f.VALID_FLAG = #{VALID_FLAG}
</if>
</where>
</select>
</mapper>

View File

@ -88,12 +88,7 @@
f.ACCEPT_CONFESS_USER_ID,
f.ACCEPT_CONFESS_USER_SIGNER_PATH,
f.ACCEPT_CONFESS_USER_SIGNER_TIME,
f.ANALYZE_TIME,
f.BELONGING_DEPARTMENT_ID,
f.BELONGING_USER_ID,
f.BELONGING_USER_SIGNER_PATH,
f.BELONGING_USER_SIGNER_TIME,
f.BELONGING_CONTENT
f.ANALYZE_TIME
</sql>
<!-- 字段用于新增 -->
@ -172,12 +167,7 @@
ACCEPT_CONFESS_USER_ID,
ACCEPT_CONFESS_USER_SIGNER_PATH,
ACCEPT_CONFESS_USER_SIGNER_TIME,
ANALYZE_TIME,
BELONGING_DEPARTMENT_ID,
BELONGING_USER_ID,
BELONGING_USER_SIGNER_PATH,
BELONGING_USER_SIGNER_TIME,
BELONGING_CONTENT
ANALYZE_TIME
</sql>
<!-- 字段值 -->
@ -256,12 +246,7 @@
#{ACCEPT_CONFESS_USER_ID},
#{ACCEPT_CONFESS_USER_SIGNER_PATH},
#{ACCEPT_CONFESS_USER_SIGNER_TIME},
#{ANALYZE_TIME},
#{BELONGING_DEPARTMENT_ID},
#{BELONGING_USER_ID},
#{BELONGING_USER_SIGNER_PATH},
#{BELONGING_USER_SIGNER_TIME},
#{BELONGING_CONTENT}
#{ANALYZE_TIME}
</sql>
<!-- 新增-->
@ -370,11 +355,6 @@
ACCEPT_CONFESS_USER_ID = #{ACCEPT_CONFESS_USER_ID},
ACCEPT_CONFESS_USER_SIGNER_PATH = #{ACCEPT_CONFESS_USER_SIGNER_PATH},
ACCEPT_CONFESS_USER_SIGNER_TIME = #{ACCEPT_CONFESS_USER_SIGNER_TIME},
BELONGING_DEPARTMENT_ID = #{BELONGING_DEPARTMENT_ID},
BELONGING_USER_ID = #{BELONGING_USER_ID},
BELONGING_USER_SIGNER_PATH = #{BELONGING_USER_SIGNER_PATH},
BELONGING_USER_SIGNER_TIME = #{BELONGING_USER_SIGNER_TIME},
BELONGING_CONTENT = #{BELONGING_CONTENT},
HOTWORK_ID = HOTWORK_ID
where
HOTWORK_ID = #{HOTWORK_ID}
@ -593,14 +573,7 @@
aacu.NAME as ACCEPT_CONFESS_USER_NAME,
anad.NAME as ANALYZE_DEPARTMENT_NAME,
anau.NAME as ANALYZE_USER_NAME,
f.BELONGING_DEPARTMENT_ID,
belong.NAME as BELONGING_DEPARTMENT_NAME,
f.BELONGING_USER_ID,
belongU.NAME as BELONGING_USER_NAME,
f.BELONGING_USER_SIGNER_PATH,
f.BELONGING_USER_SIGNER_TIME,
f.BELONGING_CONTENT
anau.NAME as ANALYZE_USER_NAME
from
<include refid="tableName"></include> f
left join OA_DEPARTMENT ad on ad.DEPARTMENT_ID = f.APPLY_DEPARTMENT_ID
@ -636,8 +609,6 @@
left join OA_DEPARTMENT anad on anad.DEPARTMENT_ID = f.ANALYZE_DEPARTMENT_ID
left join SYS_USER anau on anau.USER_ID = f.ANALYZE_USER_ID
left join OA_DEPARTMENT belong on belong.DEPARTMENT_ID = f.BELONGING_DEPARTMENT_ID
left join SYS_USER belongU on belongU.USER_ID = f.BELONGING_USER_ID
where
f.HOTWORK_ID = #{HOTWORK_ID}
</select>