diff --git a/src/main/java/com/zcloud/controller/app/highriskwork/AppHomeController.java b/src/main/java/com/zcloud/controller/app/highriskwork/AppHomeController.java index 9e8de2cf..28342ca4 100644 --- a/src/main/java/com/zcloud/controller/app/highriskwork/AppHomeController.java +++ b/src/main/java/com/zcloud/controller/app/highriskwork/AppHomeController.java @@ -9,6 +9,7 @@ import com.zcloud.service.inspection.SafetyEnvironmentalInspectorService; import com.zcloud.service.inspection.SafetyEnvironmentalService; import com.zcloud.service.keyProjects.KeyprojectHiddenService; import com.zcloud.util.*; +import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -86,6 +87,24 @@ public class AppHomeController extends BaseController { PageData myGasAnaly = new PageData(); if(!Tools.isEmpty(pd.get("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")); } map.put("result", errInfo); @@ -126,6 +145,24 @@ public class AppHomeController extends BaseController { PageData myGasAnaly = new PageData(); if(!Tools.isEmpty(pd.get("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")); } @@ -142,7 +179,7 @@ public class AppHomeController extends BaseController { //统计消防总数 List dataList = fireCheckListService.getFireCheckListCountByApp(pd); - + map.put("result", errInfo); map.put("blindboardCount", blindboardCount); map.put("breakGroundCount", breakGroundCount); diff --git a/src/main/java/com/zcloud/controller/app/highriskwork/AppHotWorkApplicationController.java b/src/main/java/com/zcloud/controller/app/highriskwork/AppHotWorkApplicationController.java index 3f88b6e5..ced46e97 100644 --- a/src/main/java/com/zcloud/controller/app/highriskwork/AppHotWorkApplicationController.java +++ b/src/main/java/com/zcloud/controller/app/highriskwork/AppHotWorkApplicationController.java @@ -17,6 +17,7 @@ import com.zcloud.service.system.FHlogService; import com.zcloud.util.*; import com.zcloud.util.message.MessageService; import org.apache.commons.io.FileUtils; +import org.apache.commons.lang.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.crypto.hash.SimpleHash; import org.apache.xpath.SourceTree; @@ -806,11 +807,30 @@ public class AppHotWorkApplicationController extends BaseController { hotUserPd.put("STATE",pd.get("STATE").toString()); // 哪一步 hotUserPd.put("USER_ID",pd.getString("loginUserId"));// 登录人 - List hotUserList = hotWorkApplicationUserService.listAll(hotUserPd); // 找到这一笔的审批人 - if(hotUserList.size() != 1){ - map.put("result", "error"); - map.put("msg", "获取审批人意见失败!请联系管理员"); - return map; + if ("10".equals(pd.get("STATE").toString())) { + PageData hotWorkApplication = hotworkapplicationService.findById(pd); + if(!Tools.isEmpty(hotWorkApplication) && hotWorkApplication.getString("STATE").equals("11")){ // 判断此作业是否已归档 + map.put("result", "error"); + map.put("msg", "此作业已归档,请勿重复操作!"); + return map; + } + } + + List hotUserList = new ArrayList<>(); + if (!pd.getString("STATE").equals("10")) { + hotUserList = hotWorkApplicationUserService.listAll(hotUserPd); // 找到这一笔的审批人 + if (hotUserList.size() != 1) { + map.put("result", "error"); + map.put("msg", "获取审批人意见失败!请联系管理员"); + return map; + } + } else { + hotUserList = hotWorkApplicationUserService.listByDepartment(hotUserPd); // 找到这一笔的审批人们 + if (hotUserList.size() < 1) { + map.put("result", "error"); + map.put("msg", "获取审批人意见失败!请联系管理员"); + return map; + } } @@ -953,7 +973,8 @@ public class AppHotWorkApplicationController extends BaseController { }else if("9".equals(pd.getString("STATE"))){ // 添加 临时监火 PageData leaderUser = new PageData(); 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("TYPE","-1"); leaderUser.put("ISDELETE","0"); @@ -1339,6 +1360,24 @@ public class AppHotWorkApplicationController extends BaseController { PageData myGasAnaly = new PageData(); if(!Tools.isEmpty(pd.get("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")); } map.put("varList", varList); diff --git a/src/main/java/com/zcloud/controller/app/highriskwork/AppHotWorkApplicationDelayedController.java b/src/main/java/com/zcloud/controller/app/highriskwork/AppHotWorkApplicationDelayedController.java index 7ddb9cc4..548935fb 100644 --- a/src/main/java/com/zcloud/controller/app/highriskwork/AppHotWorkApplicationDelayedController.java +++ b/src/main/java/com/zcloud/controller/app/highriskwork/AppHotWorkApplicationDelayedController.java @@ -1,5 +1,10 @@ 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.Date; import java.util.HashMap; @@ -22,6 +27,8 @@ import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.service.highriskwork.HotWorkApplicationDelayedService; +import javax.imageio.ImageIO; + /** * 说明:延时监火 * 作者:luoxiaobao @@ -62,9 +69,38 @@ public class AppHotWorkApplicationDelayedController extends BaseController { map.put("msg", "文件格式不正确!"); 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 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); } hotworkapplicationdelayedService.save(pd); diff --git a/src/main/java/com/zcloud/mapper/datasource/highriskwork/HotWorkApplicationMapper.java b/src/main/java/com/zcloud/mapper/datasource/highriskwork/HotWorkApplicationMapper.java index f00f1ba5..eaa1c75b 100644 --- a/src/main/java/com/zcloud/mapper/datasource/highriskwork/HotWorkApplicationMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/highriskwork/HotWorkApplicationMapper.java @@ -91,5 +91,7 @@ public interface HotWorkApplicationMapper{ * @throws Exception */ void updateState4ids(PageData pageData); + + PageData getCountByMyApprovalForDelayedHotWork(PageData pageData); } diff --git a/src/main/java/com/zcloud/mapper/datasource/highriskwork/HotWorkApplicationUserMapper.java b/src/main/java/com/zcloud/mapper/datasource/highriskwork/HotWorkApplicationUserMapper.java index 88dd120e..3d9b3fe2 100644 --- a/src/main/java/com/zcloud/mapper/datasource/highriskwork/HotWorkApplicationUserMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/highriskwork/HotWorkApplicationUserMapper.java @@ -89,5 +89,7 @@ public interface HotWorkApplicationUserMapper{ List getHotdelayed (PageData pd) throws Exception; List getHotGasanalysis (PageData pd) throws Exception; + + List listByDepartment(PageData hotUserPd) throws Exception; } diff --git a/src/main/java/com/zcloud/service/highriskwork/HotWorkApplicationService.java b/src/main/java/com/zcloud/service/highriskwork/HotWorkApplicationService.java index ec26febd..872f7d61 100644 --- a/src/main/java/com/zcloud/service/highriskwork/HotWorkApplicationService.java +++ b/src/main/java/com/zcloud/service/highriskwork/HotWorkApplicationService.java @@ -110,6 +110,8 @@ public interface HotWorkApplicationService{ public List archivelist(Page page) throws Exception; public void updateState4ids(PageData pageData); + + PageData getCountByMyApprovalForDelayedHotWork(String user_id) throws Exception; } diff --git a/src/main/java/com/zcloud/service/highriskwork/HotWorkApplicationUserService.java b/src/main/java/com/zcloud/service/highriskwork/HotWorkApplicationUserService.java index e6c8bb32..d5ac1286 100644 --- a/src/main/java/com/zcloud/service/highriskwork/HotWorkApplicationUserService.java +++ b/src/main/java/com/zcloud/service/highriskwork/HotWorkApplicationUserService.java @@ -112,5 +112,7 @@ public interface HotWorkApplicationUserService{ public List getHotdelayed (PageData pd) throws Exception; public List getHotGasanalysis (PageData pd) throws Exception; + + List listByDepartment(PageData hotUserPd) throws Exception; } diff --git a/src/main/java/com/zcloud/service/highriskwork/impl/HotWorkApplicationServiceImpl.java b/src/main/java/com/zcloud/service/highriskwork/impl/HotWorkApplicationServiceImpl.java index 268f42d9..128ee401 100644 --- a/src/main/java/com/zcloud/service/highriskwork/impl/HotWorkApplicationServiceImpl.java +++ b/src/main/java/com/zcloud/service/highriskwork/impl/HotWorkApplicationServiceImpl.java @@ -105,6 +105,14 @@ public class HotWorkApplicationServiceImpl implements HotWorkApplicationService{ public void updateState4ids(PageData 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 * @throws Exception diff --git a/src/main/java/com/zcloud/service/highriskwork/impl/HotWorkApplicationUserServiceImpl.java b/src/main/java/com/zcloud/service/highriskwork/impl/HotWorkApplicationUserServiceImpl.java index 388b8f6f..0a931c53 100644 --- a/src/main/java/com/zcloud/service/highriskwork/impl/HotWorkApplicationUserServiceImpl.java +++ b/src/main/java/com/zcloud/service/highriskwork/impl/HotWorkApplicationUserServiceImpl.java @@ -370,5 +370,10 @@ public class HotWorkApplicationUserServiceImpl implements HotWorkApplicationUser public List getHotGasanalysis (PageData pd) throws Exception{ return hotworkapplicationuserMapper.getHotGasanalysis(pd); } + + @Override + public List listByDepartment(PageData hotUserPd) throws Exception { + return hotworkapplicationuserMapper.listByDepartment(hotUserPd); + } } diff --git a/src/main/java/com/zcloud/util/WaterMarkUtil.java b/src/main/java/com/zcloud/util/WaterMarkUtil.java new file mode 100644 index 00000000..d9c601e2 --- /dev/null +++ b/src/main/java/com/zcloud/util/WaterMarkUtil.java @@ -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()); + } +} diff --git a/src/main/resources/application-local.properties b/src/main/resources/application-local.properties index 13026235..8d8cc1c0 100644 --- a/src/main/resources/application-local.properties +++ b/src/main/resources/application-local.properties @@ -70,3 +70,26 @@ smb.port=22 smb.user=root smb.password=Zcloud@zcloud88888 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/ diff --git a/src/main/resources/mybatis/datasource/highriskwork/HotWorkApplicationMapper.xml b/src/main/resources/mybatis/datasource/highriskwork/HotWorkApplicationMapper.xml index bbdcd6ca..c23306b4 100644 --- a/src/main/resources/mybatis/datasource/highriskwork/HotWorkApplicationMapper.xml +++ b/src/main/resources/mybatis/datasource/highriskwork/HotWorkApplicationMapper.xml @@ -179,55 +179,29 @@ 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 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 + + + ( + + f.ISDELETE = '0' and ( f.JOB_NUMBER LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%') or f.HOT_WORK_POSITION LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%') ) - - - - and f.CREATOR = #{pd.CREATOR} and f.state !='-4' - - - and f.STATE in ('1','2','3','4','5','6' - ,'7','8','9') - - - and (f.STATE in ('11','-3')) - - - - and ( - ( - f.STATE >= 1 - and f.STATE <= 11 - ) - or f.STATE = '-3' - ) - - - - - - - and (f.STATE = #{pd.STATE}) - - - - - - and f.CORPINFO_ID = #{pd.CORPINFO_ID} - - - and (f.CREATOR = #{pd.CREATOR}) - - - and (HOT_WORK_LEVEL_INDEX = #{pd.HOT_WORK_LEVEL_INDEX}) - - + + and f.CORPINFO_ID = #{pd.CORPINFO_ID} + + + and (f.CREATOR = #{pd.CREATOR}) + + + and (HOT_WORK_LEVEL_INDEX = #{pd.HOT_WORK_LEVEL_INDEX}) + + @@ -300,6 +274,40 @@ 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.CREATOR = #{pd.CREATOR} and f.state !='-4' + + + and f.STATE in ('1','2','3','4','5','6' + ,'7','8','9') + + + and (f.STATE in ('11','-3')) + + + + and ( + ( + f.STATE >= 1 + and f.STATE <= 11 + ) + or f.STATE = '-3' + ) + + + + + + and (f.STATE != '11') + ) or (uu.USER_ID is not null and f.ISDELETE = '0') + + + and (f.STATE = #{pd.STATE}) + + + group by f.HOTWORKAPPLICATION_ID ORDER BY f.CREATTIME desc @@ -541,4 +549,12 @@ GROUP BY HOTWORKAPPLICATION_ID ORDER BY f.OPERATTIME desc + + diff --git a/src/main/resources/mybatis/datasource/highriskwork/HotWorkApplicationUserMapper.xml b/src/main/resources/mybatis/datasource/highriskwork/HotWorkApplicationUserMapper.xml index 58b67881..c717f435 100644 --- a/src/main/resources/mybatis/datasource/highriskwork/HotWorkApplicationUserMapper.xml +++ b/src/main/resources/mybatis/datasource/highriskwork/HotWorkApplicationUserMapper.xml @@ -319,4 +319,41 @@ order by CREATTIME + +