动火作业

pull/4/head
fangjiakai 2024-01-23 08:29:43 +08:00
parent 3507bf61a9
commit 13e1b7442e
7 changed files with 239 additions and 107 deletions

View File

@ -8,6 +8,7 @@ import com.zcloud.dto.TenCorpDto;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.logs.LogAnno;
import com.zcloud.service.eightwork.HotworkGasService;
import com.zcloud.service.eightwork.HotworkService;
import com.zcloud.service.mq.SendMessageService;
import com.zcloud.util.DateUtil;
@ -33,7 +34,8 @@ public class AppHotworkController extends BaseController {
@Autowired
private HotworkService hotworkService;
@Autowired
private HotworkGasService hotworkGasService;
/**
*
* @param
@ -41,9 +43,7 @@ public class AppHotworkController extends BaseController {
*/
@RequestMapping(value = "/add")
@ResponseBody
@Transactional
@LogAnno(menuType = "手机", menuServer = "动火作业", instructionsOperate = "动火作业", instructionsType = "新增")
@SuppressWarnings("all")
public Object add() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
@ -54,6 +54,23 @@ public class AppHotworkController extends BaseController {
return map;
}
/**
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/edit")
@ResponseBody
@LogAnno(menuType = "手机", menuServer = "动火作业", instructionsOperate = "动火作业", instructionsType = "新增")
public Object edit() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
hotworkService.edit(pd);
map.put("result", errInfo);
return map;
}
/**
*
* @throws Exception
@ -103,7 +120,7 @@ public class AppHotworkController extends BaseController {
pd = this.getPageData();
pd = hotworkService.findById(pd);
map.put("result",errInfo);
map.put("page",pd);
map.put("pd",pd);
return map;
}
@ -123,12 +140,12 @@ public class AppHotworkController extends BaseController {
@RequestMapping("/nextStep")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "动火作业",instructionsOperate = "动火作业",instructionsType = "通过")
public Object nextStep(@RequestParam(value="file",required=false) MultipartFile file) throws Exception {
public Object nextStep(@RequestParam(value="files",required=false) MultipartFile[] files) throws Exception {
Map<String,Object> map = new HashMap<>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
hotworkService.nextStep(pd, file);
hotworkService.nextStep(pd, files);
map.put("result",errInfo);
return map;
}
@ -197,4 +214,56 @@ public class AppHotworkController extends BaseController {
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/gas/save")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "动火作业",instructionsOperate = "动火作业",instructionsType = "保存气体检测")
public Object gasSave(@RequestParam(value="file",required=false) MultipartFile file) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
hotworkService.saveGas(pd,file);
map.put("result", errInfo);
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/gas/list")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "动火作业",instructionsOperate = "动火作业",instructionsType = "去修改页面获取数据")
public Object gasList() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<PageData> varList = hotworkGasService.listAll(pd); //列出hotwork列表
map.put("varList", varList);
map.put("result", errInfo);
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/gas/delete")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "动火作业",instructionsOperate = "动火作业",instructionsType = "去修改页面获取数据")
public Object gasDel() throws Exception{
Map<String,String> map = new HashMap<String,String>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
hotworkGasService.delete(pd);
map.put("result", errInfo); //返回结果
return map;
}
}

View File

@ -15,6 +15,7 @@ public interface HotworkMapper {
void save(PageData pd);
void delete(PageData pd);
void edit(PageData pd);
void editGasTime(PageData pd);
void editStep(PageData pd);
List<PageData> datalistPage(Page page);
void cancel(PageData pd);

View File

@ -14,11 +14,13 @@ import net.sf.ehcache.constructs.nonstop.store.ExceptionOnTimeoutStore;
public interface HotworkService {
void save(PageData pd)throws Exception;
void edit(PageData pd)throws Exception;
void delete(PageData pd)throws Exception;
List<PageData> list(Page page) throws Exception;
void nextStep(PageData pd, MultipartFile file) throws Exception;
void nextStep(PageData pd, MultipartFile[] files) throws Exception;
void accept(PageData pd)throws Exception;
@ -36,4 +38,7 @@ public interface HotworkService {
//
// //获取所有签字完成的措施(bus_hotworktomeasures)
List<PageData> listSignFinishMeasures(PageData pd) throws Exception;
void saveGas(PageData pd,MultipartFile file) throws Exception;
}

View File

@ -41,6 +41,8 @@ public class HotworkServiceImpl implements HotworkService {
@Autowired
private HotworkToMeasuresMapper hotworkToMeasuresMapper;
@Autowired
private HotworkGasMapper hotworkGasMapper;
@Autowired
private Smb smb;
private final static String primary_key = "HOTWORK_ID";
@ -72,6 +74,21 @@ public class HotworkServiceImpl implements HotworkService {
}
}
@Override
@Transactional
public void edit(PageData pd) throws Exception {
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
hotworkMapper.edit(pd);
if (pd.get("APPLY_STATUS").equals("1")) {
pd.put("STEP_ID", 1);
hotworkMapper.editStep(pd);
PageData flow = getStep(pd.get("TASK_ID"),"1");
saveLog(pd,pd.getString("CREATOR"),"1");
saveNextSigner(pd,flow);
}
}
@Override
public void delete(PageData pd) throws Exception {
hotworkMapper.delete(pd);
@ -87,20 +104,25 @@ public class HotworkServiceImpl implements HotworkService {
*/
@Override
@Transactional
public void nextStep(PageData pd, MultipartFile file) throws Exception {
//保存签名文件
String ffile = DateUtil.getDays();
String fileName = UuidUtil.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
String filePath = Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName;
public void nextStep(PageData pd, MultipartFile[] files) throws Exception {
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);
}
PageData flow = getStep(pd.get("TASK_ID"), pd.get("STEP_ID"));
pd.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("SIGN_USER_ID"));
sign.put("SIGN_USER_ID", pd.get("USER_ID"));
sign.put("SIGN_TIME", DateUtil.date2Str(new Date()));
sign.put("SIGN_PATH", filePath);
sign.put("SIGN_PATH", String.join(",",filePaths));
sign.put("DESCR", pd.get("DESCR"));
hotworkSignMapper.edit(sign);
@ -111,17 +133,119 @@ public class HotworkServiceImpl implements HotworkService {
List<PageData> unsignedList = hotworkSignMapper.checkUnsigned(sign);//当前步骤未签名人列表
if(unsignedList == null || unsignedList.size() == 0){//如果没有未签人 则跳转下一步
PageData flow = getStep(pd.get("TASK_ID"), pd.get("STEP_ID"));
hotworkMapper.edit(pd);
if (pd.get("PREPARERS") != null && !pd.get("PREPARERS").equals("")) { //如果是设置安全措施确认人步骤
savePreparers(pd,flow);
}
saveNextSigner(pd,flow);
//保存日志
saveLog(pd,pd.getString(flow.get("ACTOR_FIELD")),"1");
saveNextSigner(pd,flow);
}
}
/**
*
*/
@Override
public void accept(PageData pd)throws Exception{
PageData flow = getStep(pd.get("TASK_ID"), 99);
hotworkMapper.edit(pd);
saveLog(pd,pd.getString(flow.get("ACTOR_FIELD")),"1");
}
/**
*
*/
@Override
@Transactional
public void cancel(PageData pd)throws Exception{
PageData flow = getStep(pd.get("TASK_ID"), pd.get("STEP_ID"));
saveLog(pd,pd.getString(flow.get("ACTOR_FIELD")),"-1");
pd.put("STEP_ID", -1);
hotworkMapper.editStep(pd);
}
@Override
public PageData findById(PageData pd) throws Exception {
PageData pageData = hotworkMapper.findById(pd);
return pageData;
}
@Override
public PageData checkWorkCount(PageData pd) {
PageData rpd = new PageData();
List<PageData> varList = hotworkMapper.checkWorkCount(pd);
if (varList != null && !varList.isEmpty()) {
Map<String, String> newMap = varList.stream()
.collect(Collectors.toMap(map -> map.getString("CODE"), map -> map.getString("COUNT")));
rpd.putAll(newMap);
}
return rpd;
}
@Override
public List<PageData> listAllMeasures() throws Exception {
return hotworkMapper.listAllMeasures();
}
@Override
public List<PageData> listAllMeasuresForSign(PageData pd) throws Exception {
return hotworkToMeasuresMapper.listAllMeasuresForSign(pd);
}
@Override
public List<PageData> listSignFinishMeasures(PageData pd) throws Exception {
return hotworkToMeasuresMapper.listSignFinishMeasures(pd);
}
@Override
@Transactional
public void saveGas(PageData pd,MultipartFile file) throws Exception {
PageData work = hotworkMapper.findById(pd);
String ffile = DateUtil.getDays();
String fileName = UuidUtil.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
String filePath = Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName;
pd.put("HOTWORKGAS_ID", UuidUtil.get32UUID()); //主键
pd.put("ISDELETE", "0"); //是否删除 1-是 0-否
pd.put("SIGN_PATH", filePath);
hotworkGasMapper.save(pd);
hotworkMapper.editGasTime(pd);//修改最后一次气体检测时间
PageData flow = getStep(work.get("TASK_ID"), work.get("STEP_ID"));
if (pd.get("APPLY_STATUS").equals("1")) { //如果通过
if(flow.get("NEXT_STEP_ID") != null && flow.getString("NEXT_STEP_ID").equals("2")){//如果为气体检测步骤,则保存日志并跳转下一步
PageData sign = new PageData();
sign.put(primary_key, work.get(primary_key));
sign.put("STEP_ID", 2);
sign.put("SIGN_USER_ID", pd.get("USER_ID"));
sign.put("SIGN_TIME", DateUtil.date2Str(new Date()));
sign.put("SIGN_PATH", filePath);
sign.put("DESCR", pd.get("DESCR"));
hotworkSignMapper.edit(sign);
work.put("STEP_ID", flow.get("NEXT_STEP_ID"));
hotworkMapper.editStep(work);
//保存日志
saveLog(work,work.getString(flow.get("ACTOR_FIELD")),"1");
//预存下一步
PageData currentflow = getStep(work.get("TASK_ID"), work.get("STEP_ID"));
saveNextSigner(work,currentflow);
}
}else{
saveLog(work,pd.getString("USER_ID"),"-2");
work.put("STEP_ID", -1);
hotworkMapper.editStep(work);
}
}
@ -202,65 +326,6 @@ public class HotworkServiceImpl implements HotworkService {
}
}
/**
*
*/
@Override
public void accept(PageData pd)throws Exception{
PageData flow = getStep(pd.get("TASK_ID"), 99);
hotworkMapper.edit(pd);
saveLog(pd,pd.getString(flow.get("ACTOR_FIELD")),"1");
}
/**
*
*/
@Override
@Transactional
public void cancel(PageData pd)throws Exception{
PageData flow = getStep(pd.get("TASK_ID"), pd.get("STEP_ID"));
saveLog(pd,pd.getString(flow.get("ACTOR_FIELD")),"-1");
pd.put("STEP_ID", -1);
hotworkMapper.edit(pd);
}
@Override
public PageData findById(PageData pd) throws Exception {
PageData pageData = hotworkMapper.findById(pd);
return pageData;
}
@Override
public PageData checkWorkCount(PageData pd) {
PageData rpd = new PageData();
List<PageData> varList = hotworkMapper.checkWorkCount(pd);
if (varList != null && !varList.isEmpty()) {
Map<String, String> newMap = varList.stream()
.collect(Collectors.toMap(map -> map.getString("CODE"), map -> map.getString("COUNT")));
rpd.putAll(newMap);
}
return rpd;
}
@Override
public List<PageData> listAllMeasures() throws Exception {
return hotworkMapper.listAllMeasures();
}
@Override
public List<PageData> listAllMeasuresForSign(PageData pd) throws Exception {
return hotworkToMeasuresMapper.listAllMeasuresForSign(pd);
}
@Override
public List<PageData> listSignFinishMeasures(PageData pd) throws Exception {
return hotworkToMeasuresMapper.listSignFinishMeasures(pd);
}
private PageData getStep(Object TASK_ID, Object STEP_ID) throws Exception {
PageData flow = new PageData();
flow.put("TASK_ID", TASK_ID);

View File

@ -237,20 +237,18 @@
HOTWORK_ID = #{HOTWORK_ID}
</update>
<update id="editGasTime" parameterType="pd">
update
<include refid="tableName"></include>
set
ANALYZE_TIME = #{ANALYZE_TIME}
where
HOTWORK_ID = #{HOTWORK_ID}
</update>
<select id="findById" parameterType="pd" resultType="pd">
SELECT
f.HOTWORK_ID,
f.CORPINFO_ID,
f.TASK_ID,
f.STEP_ID,
f.ISDELETE,
f.CREATTIME,
f.CREATOR,
f.OPERATTIME,
f.OPERATOR,
f.CHECK_NO,
f.WORK_CONTENT,
f.WORK_PLACE,
<include refid="Field"></include>,
appo.`NAME` as APPLY_DEPARTMENT_NAME,
appu.`NAME` as APPLY_USER_NAME,
f.WORK_LEVEL,
@ -333,7 +331,7 @@
update
<include refid="tableName"></include>
set
STEP_ID = #{pd.STEP_ID}
STEP_ID = #{STEP_ID}
where
HOTWORK_ID = #{HOTWORK_ID}
</update>
@ -412,7 +410,8 @@
left join oa_department as endo on f.WORK_END_DEPARTMENT_ID = endo.DEPARTMENT_ID
left join sys_user as endu on f.WORK_END_USER_ID = endu.USER_ID
left join (select log.* from vi_eightwork_flow_log log order by log.ACT_TIME desc limit 1) log on log.WORK_ID = f.HOTWORK_ID
left join (select * from(select * from vi_eightwork_flow_log log having 1 order by log.ACT_TIME desc
) tmp group by tmp.WORK_ID) log on log.WORK_ID = f.HOTWORK_ID
where f.ISDELETE = '0'
<if test="pd.STEP_NAME != null and pd.STEP_NAME != ''"><!-- 关键词检索 -->
and exists (
@ -428,7 +427,7 @@
and f.CREATOR = #{pd.CREATOR}
</if>
<if test="pd.GASCHECK != null and pd.GASCHECK != ''"><!-- 关键词检索 -->
and f.
and f.STEP_ID &gt; 0 and f.STEP_ID != 100 and f.ANALYZE_USER_ID = #{pd.GASCHECK}
</if>
</select>

View File

@ -21,7 +21,7 @@
f.ANALYZE_USER,
f.ISDELETE,
f.HOTWORKGAS_ID,
f.ANALYZE_PATH
f.SIGN_PATH
</sql>
<!-- 字段用于新增 -->
@ -33,7 +33,7 @@
ANALYZE_USER,
ISDELETE,
HOTWORKGAS_ID,
ANALYZE_PATH
SIGN_PATH
</sql>
<!-- 字段值 -->
@ -45,7 +45,7 @@
#{ANALYZE_USER},
#{ISDELETE},
#{HOTWORKGAS_ID},
#{ANALYZE_PATH}
#{SIGN_PATH}
</sql>
<!-- 新增-->
@ -81,7 +81,7 @@
ANALYZE_USER = #{ANALYZE_USER},
ISDELETE = #{ISDELETE},
HOTWORKGAS_ID = HOTWORKGAS_ID,
ANALYZE_PATH = #{ANALYZE_PATH}
SIGN_PATH = #{SIGN_PATH}
where
HOTWORKGAS_ID = #{HOTWORKGAS_ID}
</update>
@ -103,15 +103,8 @@
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
<!-- and-->
<!-- (-->
<!-- &lt;!&ndash; 根据需求自己加检索条件-->
<!-- 字段1 LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')-->
<!-- or-->
<!-- 字段2 LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')-->
<!-- &ndash;&gt;-->
<!-- )-->
<if test="pd.HOTWORK_ID != null and pd.HOTWORK_ID != ''"><!-- 关键词检索 -->
and f.HOTWORK_ID = #{pd.HOTWORK_ID}
</if>
ORDER BY f.ANALYZE_TIME desc
</select>

View File

@ -85,7 +85,7 @@
set
DESCR = #{DESCR},
SIGN_PATH = #{SIGN_PATH},
SIGN_TIME= #{SIGN_TIME},
SIGN_TIME= #{SIGN_TIME}
where
HOTWORK_ID = #{HOTWORK_ID} and SIGN_USER_ID = #{SIGN_USER_ID} and STEP_ID = #{STEP_ID}
</update>