延时监火改为多人同时监火,在同一个部门中都可以查看和发布监火信息

cmt1.0
limingyu 2023-12-11 10:00:16 +08:00
parent 761630df77
commit 98dc83e051
13 changed files with 275 additions and 51 deletions

View File

@ -9,6 +9,7 @@ import com.zcloud.service.inspection.SafetyEnvironmentalInspectorService;
import com.zcloud.service.inspection.SafetyEnvironmentalService; import com.zcloud.service.inspection.SafetyEnvironmentalService;
import com.zcloud.service.keyProjects.KeyprojectHiddenService; import com.zcloud.service.keyProjects.KeyprojectHiddenService;
import com.zcloud.util.*; import com.zcloud.util.*;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -86,6 +87,24 @@ public class AppHomeController extends BaseController {
PageData myGasAnaly = new PageData(); PageData myGasAnaly = new PageData();
if(!Tools.isEmpty(pd.get("USER_ID"))){ if(!Tools.isEmpty(pd.get("USER_ID"))){
varList = hotworkapplicationService.getCountByMyApproval(pd.getString("USER_ID")); varList = hotworkapplicationService.getCountByMyApproval(pd.getString("USER_ID"));
PageData delayedCount = hotworkapplicationService.getCountByMyApprovalForDelayedHotWork(pd.getString("USER_ID"));
if (varList.size() > 0) {
boolean isDelayedExist = false;
for (PageData data : varList) {
if (StringUtils.equals(data.getString("STATE"),"10")) isDelayedExist = true;
}
if (isDelayedExist) {
for (PageData pageData : varList){
if (StringUtils.equals(pageData.getString("STATE"),"10")) {
pageData.put("count",delayedCount.getString("count"));
}
}
} else {
varList.add(delayedCount);
}
} else {
varList.add(delayedCount);
}
myGasAnaly = hotworkapplicationService.getCountByMyGasAnaly(pd.getString("USER_ID")); myGasAnaly = hotworkapplicationService.getCountByMyGasAnaly(pd.getString("USER_ID"));
} }
map.put("result", errInfo); map.put("result", errInfo);
@ -126,6 +145,24 @@ public class AppHomeController extends BaseController {
PageData myGasAnaly = new PageData(); PageData myGasAnaly = new PageData();
if(!Tools.isEmpty(pd.get("USER_ID"))){ if(!Tools.isEmpty(pd.get("USER_ID"))){
varList = hotworkapplicationService.getCountByMyApproval(pd.getString("USER_ID")); varList = hotworkapplicationService.getCountByMyApproval(pd.getString("USER_ID"));
PageData delayedCount = hotworkapplicationService.getCountByMyApprovalForDelayedHotWork(pd.getString("USER_ID"));
if (varList.size() > 0) {
boolean isDelayedExist = false;
for (PageData data : varList) {
if (StringUtils.equals(data.getString("STATE"),"10")) isDelayedExist = true;
}
if (isDelayedExist) {
for (PageData pageData : varList){
if (StringUtils.equals(pageData.getString("STATE"),"10")) {
pageData.put("count",delayedCount.getString("count"));
}
}
} else {
varList.add(delayedCount);
}
} else {
varList.add(delayedCount);
}
myGasAnaly = hotworkapplicationService.getCountByMyGasAnaly(pd.getString("USER_ID")); myGasAnaly = hotworkapplicationService.getCountByMyGasAnaly(pd.getString("USER_ID"));
} }

View File

@ -17,6 +17,7 @@ import com.zcloud.service.system.FHlogService;
import com.zcloud.util.*; import com.zcloud.util.*;
import com.zcloud.util.message.MessageService; import com.zcloud.util.message.MessageService;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.crypto.hash.SimpleHash; import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.xpath.SourceTree; import org.apache.xpath.SourceTree;
@ -806,12 +807,31 @@ public class AppHotWorkApplicationController extends BaseController {
hotUserPd.put("STATE",pd.get("STATE").toString()); // 哪一步 hotUserPd.put("STATE",pd.get("STATE").toString()); // 哪一步
hotUserPd.put("USER_ID",pd.getString("loginUserId"));// 登录人 hotUserPd.put("USER_ID",pd.getString("loginUserId"));// 登录人
List<PageData> hotUserList = hotWorkApplicationUserService.listAll(hotUserPd); // 找到这一笔的审批人 if ("10".equals(pd.get("STATE").toString())) {
if(hotUserList.size() != 1){ PageData hotWorkApplication = hotworkapplicationService.findById(pd);
if(!Tools.isEmpty(hotWorkApplication) && hotWorkApplication.getString("STATE").equals("11")){ // 判断此作业是否已归档
map.put("result", "error");
map.put("msg", "此作业已归档,请勿重复操作!");
return map;
}
}
List<PageData> hotUserList = new ArrayList<>();
if (!pd.getString("STATE").equals("10")) {
hotUserList = hotWorkApplicationUserService.listAll(hotUserPd); // 找到这一笔的审批人
if (hotUserList.size() != 1) {
map.put("result", "error"); map.put("result", "error");
map.put("msg", "获取审批人意见失败!请联系管理员"); map.put("msg", "获取审批人意见失败!请联系管理员");
return map; return map;
} }
} else {
hotUserList = hotWorkApplicationUserService.listByDepartment(hotUserPd); // 找到这一笔的审批人们
if (hotUserList.size() < 1) {
map.put("result", "error");
map.put("msg", "获取审批人意见失败!请联系管理员");
return map;
}
}
PageData hotUser = hotUserList.get(0); PageData hotUser = hotUserList.get(0);
@ -953,7 +973,8 @@ public class AppHotWorkApplicationController extends BaseController {
}else if("9".equals(pd.getString("STATE"))){ // 添加 临时监火 }else if("9".equals(pd.getString("STATE"))){ // 添加 临时监火
PageData leaderUser = new PageData(); PageData leaderUser = new PageData();
leaderUser.put("HOTWORKAPPLICATIONUSER_ID", UuidUtil.get32UUID()); leaderUser.put("HOTWORKAPPLICATIONUSER_ID", UuidUtil.get32UUID());
leaderUser.put("USER_ID",pd.get("TIME_LAPSE_FIREMAN_ID")); // leaderUser.put("USER_ID",pd.get("TIME_LAPSE_FIREMAN_ID"));
leaderUser.put("USER_ID",pd.get("TIME_LAPSE_FIREMAN_DEPARTMENT_ID"));
leaderUser.put("STATE","10"); leaderUser.put("STATE","10");
leaderUser.put("TYPE","-1"); leaderUser.put("TYPE","-1");
leaderUser.put("ISDELETE","0"); leaderUser.put("ISDELETE","0");
@ -1339,6 +1360,24 @@ public class AppHotWorkApplicationController extends BaseController {
PageData myGasAnaly = new PageData(); PageData myGasAnaly = new PageData();
if(!Tools.isEmpty(pd.get("USER_ID"))){ if(!Tools.isEmpty(pd.get("USER_ID"))){
varList = hotworkapplicationService.getCountByMyApproval(pd.getString("USER_ID")); varList = hotworkapplicationService.getCountByMyApproval(pd.getString("USER_ID"));
PageData delayedCount = hotworkapplicationService.getCountByMyApprovalForDelayedHotWork(pd.getString("USER_ID"));
if (varList.size() > 0) {
boolean isDelayedExist = false;
for (PageData data : varList) {
if (StringUtils.equals(data.getString("STATE"),"10")) isDelayedExist = true;
}
if (isDelayedExist) {
for (PageData pageData : varList){
if (StringUtils.equals(pageData.getString("STATE"),"10")) {
pageData.put("count",delayedCount.getString("count"));
}
}
} else {
varList.add(delayedCount);
}
} else {
varList.add(delayedCount);
}
myGasAnaly = hotworkapplicationService.getCountByMyGasAnaly(pd.getString("USER_ID")); myGasAnaly = hotworkapplicationService.getCountByMyGasAnaly(pd.getString("USER_ID"));
} }
map.put("varList", varList); map.put("varList", varList);

View File

@ -1,5 +1,10 @@
package com.zcloud.controller.app.highriskwork; package com.zcloud.controller.app.highriskwork;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
@ -22,6 +27,8 @@ import com.zcloud.entity.Page;
import com.zcloud.entity.PageData; import com.zcloud.entity.PageData;
import com.zcloud.service.highriskwork.HotWorkApplicationDelayedService; import com.zcloud.service.highriskwork.HotWorkApplicationDelayedService;
import javax.imageio.ImageIO;
/** /**
* *
* luoxiaobao * luoxiaobao
@ -62,9 +69,38 @@ public class AppHotWorkApplicationDelayedController extends BaseController {
map.put("msg", "文件格式不正确!"); map.put("msg", "文件格式不正确!");
return map; return map;
} }
Image srcImg = ImageIO.read(file.getInputStream());
//获取图片的宽
int srcImgWidth = srcImg.getWidth(null);
//获取图片的高
int srcImgHeight = srcImg.getHeight(null);
BufferedImage bufImg = new BufferedImage(srcImgWidth, srcImgHeight, BufferedImage.TYPE_INT_RGB);
// 加水印
//创建画笔
Graphics2D g = bufImg.createGraphics();
//srcImg 为上面获取到的原始图片的图片对象
g.drawImage(srcImg, 0, 0, srcImgWidth, srcImgHeight, null);
//根据图片的背景设置水印颜色
g.setColor(new Color(255,255,255,128));
//设置字体 画笔字体样式为微软雅黑加粗文字大小为60pt
g.setFont(new Font("微软雅黑", Font.BOLD, 20));
//设置水印的坐标
int x=(srcImgWidth - WaterMarkUtil.getWatermarkLength(DateUtil.date2Str(new Date()), g)) / 2;
int y=srcImgHeight / 2;
//画出水印 第一个参数是水印内容第二个参数是x轴坐标第三个参数是y轴坐标
g.drawString(DateUtil.date2Str(new Date()), x, y);
g.dispose();
//将加完水印的图片暂存到内存中
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ImageIO.write(bufImg, suffixName, bos);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
String ffile = DateUtil.getDays(); String ffile = DateUtil.getDays();
String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(file, fileName, Const.FILEPATHYHTP + corpInfoId + "/" + ffile); // Smb.sshSftp(file, fileName, Const.FILEPATHYHTP + corpInfoId + "/" + ffile);
//通过流的方式上传文件
Smb.sshSftpForInput(bis, fileName, Const.FILEPATHYHTP + corpInfoId + "/" + ffile);
pd.put("FILEPATH",Const.FILEPATHYHTP + corpInfoId + "/" + ffile + "/" + fileName); pd.put("FILEPATH",Const.FILEPATHYHTP + corpInfoId + "/" + ffile + "/" + fileName);
} }
hotworkapplicationdelayedService.save(pd); hotworkapplicationdelayedService.save(pd);

View File

@ -91,5 +91,7 @@ public interface HotWorkApplicationMapper{
* @throws Exception * @throws Exception
*/ */
void updateState4ids(PageData pageData); void updateState4ids(PageData pageData);
PageData getCountByMyApprovalForDelayedHotWork(PageData pageData);
} }

View File

@ -89,5 +89,7 @@ public interface HotWorkApplicationUserMapper{
List<PageData> getHotdelayed (PageData pd) throws Exception; List<PageData> getHotdelayed (PageData pd) throws Exception;
List<PageData> getHotGasanalysis (PageData pd) throws Exception; List<PageData> getHotGasanalysis (PageData pd) throws Exception;
List<PageData> listByDepartment(PageData hotUserPd) throws Exception;
} }

View File

@ -110,6 +110,8 @@ public interface HotWorkApplicationService{
public List<PageData> archivelist(Page page) throws Exception; public List<PageData> archivelist(Page page) throws Exception;
public void updateState4ids(PageData pageData); public void updateState4ids(PageData pageData);
PageData getCountByMyApprovalForDelayedHotWork(String user_id) throws Exception;
} }

View File

@ -112,5 +112,7 @@ public interface HotWorkApplicationUserService{
public List<PageData> getHotdelayed (PageData pd) throws Exception; public List<PageData> getHotdelayed (PageData pd) throws Exception;
public List<PageData> getHotGasanalysis (PageData pd) throws Exception; public List<PageData> getHotGasanalysis (PageData pd) throws Exception;
List<PageData> listByDepartment(PageData hotUserPd) throws Exception;
} }

View File

@ -105,6 +105,14 @@ public class HotWorkApplicationServiceImpl implements HotWorkApplicationService{
public void updateState4ids(PageData pageData){ public void updateState4ids(PageData pageData){
hotworkapplicationMapper.updateState4ids(pageData); hotworkapplicationMapper.updateState4ids(pageData);
} }
@Override
public PageData getCountByMyApprovalForDelayedHotWork(String user_id) throws Exception {
PageData pd = new PageData();
pd.put("USER_ID",user_id);
return hotworkapplicationMapper.getCountByMyApprovalForDelayedHotWork(pd);
}
/** /**
* 1.state =0 * 1.state =0
* @throws Exception * @throws Exception

View File

@ -370,5 +370,10 @@ public class HotWorkApplicationUserServiceImpl implements HotWorkApplicationUser
public List<PageData> getHotGasanalysis (PageData pd) throws Exception{ public List<PageData> getHotGasanalysis (PageData pd) throws Exception{
return hotworkapplicationuserMapper.getHotGasanalysis(pd); return hotworkapplicationuserMapper.getHotGasanalysis(pd);
} }
@Override
public List<PageData> listByDepartment(PageData hotUserPd) throws Exception {
return hotworkapplicationuserMapper.listByDepartment(hotUserPd);
}
} }

View File

@ -0,0 +1,15 @@
package com.zcloud.util;
import java.awt.*;
public class WaterMarkUtil {
/**
*
* @param waterMarkContent
* @param g
* @return
*/
public static int getWatermarkLength(String waterMarkContent, Graphics2D g) {
return g.getFontMetrics(g.getFont()).charsWidth(waterMarkContent.toCharArray(), 0, waterMarkContent.length());
}
}

View File

@ -70,3 +70,26 @@ smb.port=22
smb.user=root smb.user=root
smb.password=Zcloud@zcloud88888 smb.password=Zcloud@zcloud88888
smb.basePath=/mnt/qgfile/file/ smb.basePath=/mnt/qgfile/file/
#Mq\u914D\u7F6E
rocketmq.consumer.group2=edu-admin-edit
rocketmq.consumer.group1=edu-admin-add
#rocketmq.name-server=10.0.140.141:9876
#rocketmq.name-server=192.168.0.70:9876
rocketmq.name-server=192.168.151.57:9876
rocketmq.producer.group=libmiddle
rocketmq.producer.send-message-timeout=3000
rocketmq.producer.compress-message-body-threshold=4096
rocketmq.producer.max-message-size=4194304
rocketmq.producer.retry-times-when-send-failed=3
rocketmq.producer.retry-next-server=true
rocketmq.producer.retry-times-when-send-async-failed=3
## topic \u524D\u7F00
mq.topic.info=info
mq.topic.eightWork=eightWork
mq.group.info=scheduled_tasks
mq.group.eightWork=scheduled_tasks_eightWork
corp.default.pic-path=https://qgqy.qhdsafety.com/file/
corp.default.back-end-path=http://192.168.151.57:8092/

View File

@ -179,45 +179,19 @@
left join sys_user u on f.CREATOR = u.USER_ID left join sys_user u on f.CREATOR = u.USER_ID
left join oa_department d on d.DEPARTMENT_ID = u.DEPARTMENT_ID left join oa_department d on d.DEPARTMENT_ID = u.DEPARTMENT_ID
left join vi_user_all ua on ua.USER_ID = f.OPERATOR left join vi_user_all ua on ua.USER_ID = f.OPERATOR
where f.ISDELETE = '0' left join sys_user uu on uu.USER_ID = #{pd.loginUserId} and uu.DEPARTMENT_ID = fu.USER_ID
where
<if test="pd.STATE != null and pd.STATE != ''">
<if test='pd.STATE == "10"'>
(
</if>
</if> f.ISDELETE = '0'
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"> <if test="pd.KEYWORDS != null and pd.KEYWORDS != ''">
and and
( f.JOB_NUMBER LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%') ( f.JOB_NUMBER LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
or f.HOT_WORK_POSITION LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%') or f.HOT_WORK_POSITION LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
) )
</if> </if>
<if test="pd.STATE != null and pd.STATE != ''">
<choose>
<when test='pd.STATE == "0"'>
and f.CREATOR = #{pd.CREATOR} and f.state !='-4'
</when>
<when test='pd.STATE == "24"'>
and f.STATE in ('1','2','3','4','5','6'
,'7','8','9')
</when>
<when test='pd.STATE == "11"'>
and (f.STATE in ('11','-3'))
</when>
<!-- State为99时查询的是特级动火归档动火表查询已经完成特级动火流程的数据即回归普通动火流程的数据 -->
<when test='pd.STATE == "99"'>
and (
(
f.STATE &gt;= 1
and f.STATE &lt;= 11
)
or f.STATE = '-3'
)
</when>
<when test='pd.STATE == "98"'>
<!-- and (f.STATE &gt;= 1) -->
</when>
<otherwise>
and (f.STATE = #{pd.STATE})
</otherwise>
</choose>
</if>
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''"> <if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''">
and f.CORPINFO_ID = #{pd.CORPINFO_ID} and f.CORPINFO_ID = #{pd.CORPINFO_ID}
</if> </if>
@ -300,6 +274,40 @@
<if test="pd.keyApproveUserName != null and pd.keyApproveUserName != ''"><!-- 申请人 --> <if test="pd.keyApproveUserName != null and pd.keyApproveUserName != ''"><!-- 申请人 -->
and f.HOTWORKAPPLICATION_ID in (select FOREIGN_KEY from bus_hotworkapplicationuser houtUser LEFT JOIN sus_user u on u.user_id = houtUser.USER_ID where u.USERNAME = CONCAT(CONCAT('%', #{pd.keyApproveUserName}),'%') and STATE = '12') and f.HOTWORKAPPLICATION_ID in (select FOREIGN_KEY from bus_hotworkapplicationuser houtUser LEFT JOIN sus_user u on u.user_id = houtUser.USER_ID where u.USERNAME = CONCAT(CONCAT('%', #{pd.keyApproveUserName}),'%') and STATE = '12')
</if> </if>
<if test="pd.STATE != null and pd.STATE != ''">
<choose>
<when test='pd.STATE == "0"'>
and f.CREATOR = #{pd.CREATOR} and f.state !='-4'
</when>
<when test='pd.STATE == "24"'>
and f.STATE in ('1','2','3','4','5','6'
,'7','8','9')
</when>
<when test='pd.STATE == "11"'>
and (f.STATE in ('11','-3'))
</when>
<!-- State为99时查询的是特级动火归档动火表查询已经完成特级动火流程的数据即回归普通动火流程的数据 -->
<when test='pd.STATE == "99"'>
and (
(
f.STATE &gt;= 1
and f.STATE &lt;= 11
)
or f.STATE = '-3'
)
</when>
<when test='pd.STATE == "98"'>
<!-- and (f.STATE &gt;= 1) -->
</when>
<when test='pd.STATE == "10"'>
and (f.STATE != '11')
) or (uu.USER_ID is not null and f.ISDELETE = '0')
</when>
<otherwise>
and (f.STATE = #{pd.STATE})
</otherwise>
</choose>
</if>
group by f.HOTWORKAPPLICATION_ID group by f.HOTWORKAPPLICATION_ID
ORDER BY f.CREATTIME desc ORDER BY f.CREATTIME desc
<!-- ORDER BY f.OPERATTIME desc --> <!-- ORDER BY f.OPERATTIME desc -->
@ -541,4 +549,12 @@
GROUP BY HOTWORKAPPLICATION_ID GROUP BY HOTWORKAPPLICATION_ID
ORDER BY f.OPERATTIME desc ORDER BY f.OPERATTIME desc
</select> </select>
<select id="getCountByMyApprovalForDelayedHotWork" parameterType="pd" resultType="pd">
select f.STATE,u.USER_ID,count(distinct HOTWORKAPPLICATION_ID) as count
from bus_hotworkapplication f
left join bus_hotworkapplicationuser fu on fu.FOREIGN_KEY = f.HOTWORKAPPLICATION_ID and f.STATE = fu.state
left join sys_user u on u.DEPARTMENT_ID = fu.USER_ID
where u.USER_ID = #{USER_ID} AND fu.ISDELETE = '0' and f.STATE = 10
</select>
</mapper> </mapper>

View File

@ -319,4 +319,41 @@
</if> </if>
order by CREATTIME order by CREATTIME
</select> </select>
<select id="listByDepartment" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
,dept.NAME as deptName
,u.NAME as userName
,su.USERNAME as userName2
, u.USERNAME as userPhone
,dept.DEPARTMENT_ID DEPARTMENT_ID
,su.USER_TYPE USER_TYPE
,reuser.NAME as REGULATORY_USER_NAME
,redept.NAME as REGULATORY_DEPT_NAME
from
<include refid="tableName"></include> f
left join SYS_USER u on u.DEPARTMENT_ID = f.USER_ID
left join bus_specialuser su on su.SPECIALUSER_ID = f.USER_ID
left join oa_department dept on dept.DEPARTMENT_ID = u.DEPARTMENT_ID
left join `qa-gwj-regulatory`.SYS_USER reuser on reuser.USER_ID = f.USER_ID and reuser.USERNAME != 'admin'
left join `qa-gwj-regulatory`.SYS_DEPARTMENT redept on redept.DEPARTMENT_ID = reuser.DEPARTMENT_ID
where f.ISDELETE = '0'
<if test="hotIds != null and hotIds.size>0"> <!-- 关键词检索 -->
and(f.FOREIGN_KEY in
<foreach item="item" index="index" collection="hotIds" open="(" separator="," close=")">
#{item}
</foreach>
)
</if>
<if test="FOREIGN_KEY != null and FOREIGN_KEY != ''"><!-- 关键词检索 -->
and( f.FOREIGN_KEY = #{FOREIGN_KEY})
</if>
<if test="USER_ID != null and USER_ID != ''"><!-- 关键词检索 -->
and( f.USER_ID = (select DEPARTMENT_ID from SYS_USER where USER_ID = #{USER_ID}))
</if>
<if test="STATE != null and STATE != ''"><!-- 关键词检索 -->
and( f.STATE = #{STATE})
</if>
</select>
</mapper> </mapper>