From 9a53d54817c1e77ffd94cee5b33a57985d78be70 Mon Sep 17 00:00:00 2001 From: xiepeng Date: Tue, 9 Apr 2024 19:08:24 +0800 Subject: [PATCH] =?UTF-8?q?BUG=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppTrafficSecurityNoticeController.java | 2 +- .../TrafficSecurityNoticeController.java | 137 ++++++++++++++++-- ...curityViolationRegistrationController.java | 9 +- .../TrafficSecurityNoticeMapper.java | 4 + .../TrafficSecurityReadDetailMapper.java | 2 + .../mapper/datasource/system/UsersMapper.java | 2 + .../TrafficSecurityNoticeService.java | 4 + .../TrafficSecurityReadDetailService.java | 2 + .../TrafficSecurityNoticeServiceImpl.java | 9 ++ .../impl/TrafficSecurityReadDetailImpl.java | 5 + .../zcloud/service/system/UsersService.java | 1 + .../service/system/impl/UsersServiceImpl.java | 5 +- .../TrafficSecurityNoticeMapper.xml | 45 ++++++ .../TrafficSecurityReadDetailMapper.xml | 30 ++++ ...ficSecurityViolationRegistrationMapper.xml | 6 +- .../mybatis/datasource/system/UsersMapper.xml | 18 ++- 16 files changed, 261 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/zcloud/controller/comprehensive/AppTrafficSecurityNoticeController.java b/src/main/java/com/zcloud/controller/comprehensive/AppTrafficSecurityNoticeController.java index 0af4631..5d23be6 100644 --- a/src/main/java/com/zcloud/controller/comprehensive/AppTrafficSecurityNoticeController.java +++ b/src/main/java/com/zcloud/controller/comprehensive/AppTrafficSecurityNoticeController.java @@ -108,7 +108,7 @@ public class AppTrafficSecurityNoticeController extends BaseController { * 1.获取关系信息 * 2.根据关系信息找到公告信息 */ - pd.put("USER_ID", pd.getString("loginUserId")); +// pd.put("USER_ID", pd.getString("loginUserId")); page.setPd(pd); List varList = trafficSecurityReadDetailService.listByUserId(page); map.put("varList", varList); diff --git a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityNoticeController.java b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityNoticeController.java index 80e874b..99818e8 100644 --- a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityNoticeController.java +++ b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityNoticeController.java @@ -30,6 +30,12 @@ public class TrafficSecurityNoticeController extends BaseController { @Autowired private Smb smb; + @Autowired + private UsersService usersService; + + @Autowired + private TrafficSecurityReadDetailService trafficSecurityReadDetailService; + //新增 @RequestMapping(value = "/add") @ResponseBody @@ -46,7 +52,7 @@ public class TrafficSecurityNoticeController extends BaseController { pd.put("TRANSPORTATIONCOMPANY", Jurisdiction.getCORPINFO_ID()); // 运输企业 pd.put("NOTIFICATION_ID", notificationId); // 主键 pd.put("CREATETIME", DateUtil.date2Str(new Date())); // 添加时间 - pd.put("POSTSTATUS", "1"); // 发布状态 + pd.put("POSTSTATUS", "0"); // 发布状态 pd.put("SIGNEDSTATUS", "0"); // 签收状态 pd.put("ISDELETE", "0"); @@ -85,15 +91,6 @@ public class TrafficSecurityNoticeController extends BaseController { pd.put("REPLY", "0"); // 回复情况 securityNoticeService.save(pd); - String[] personIds = pd.getString("PERSON_ID").split(","); - for (String personId : personIds) { - pd.put("NOTIFICATION_ID", notificationId); - pd.put("PERSON_ID", personId.trim()); - pd.put("READDETAIL_ID", this.get32UUID()); // 主键 - pd.put("REPLYSTATUS", "0"); // 主键 - pd.put("SIGNEDSTATUS", "0"); // 主键 - securityReadDetail.save(pd); - } map.put("result", errInfo); map.put("pd", pd); return map; @@ -187,11 +184,95 @@ public class TrafficSecurityNoticeController extends BaseController { PageData pd = new PageData(); pd = this.getPageData(); pd = securityNoticeService.findById(pd);//根据ID读取 + String[] personIds = pd.getString("PERSON_ID").split(","); + List names = new ArrayList<>(); + List readDetail = new ArrayList<>(); + for (String personId : personIds) { + PageData pageData = new PageData(); + pageData.put("USER_ID",personId); + pageData.put("NOTIFICATION_ID",pd.getString("NOTIFICATION_ID")); + PageData pageData1 = usersService.findById(pageData); + names.add(pageData1); + Page page = new Page(); + page.setPd(pageData); + readDetail = trafficSecurityReadDetailService.listByUserIdOrNoticeId(page); + } + pd.put("readDetail",readDetail); map.put("pd", pd); + //map.put("readDetail", readDetail); + map.put("names", names); map.put("result", errInfo); return map; } + @RequestMapping(value = "/edit") + @ResponseBody + public Object edit( + @RequestParam(value="fileList",required=false) MultipartFile file, + @RequestParam(value="videoList",required=false) MultipartFile videoFile) + throws Exception { + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = this.getPageData(); + + pd.put("OPERATOR", Jurisdiction.getUSER_ID()); // 创建人id + pd.put("CORPINFO_ID", Jurisdiction.getPOST_ID()); // 创建人id + pd.put("OPERATORNAME", Jurisdiction.getName()); // 创建人姓名 + pd.put("TRANSPORTATIONCOMPANY", Jurisdiction.getCORPINFO_ID()); // 运输企业 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); // 添加时间 + pd.put("POSTSTATUS", "0"); // 发布状态 + pd.put("SIGNEDSTATUS", "0"); // 签收状态 + pd.put("ISDELETE", "0"); + + String ffile = DateUtil.getDays(); + if (file != null && StringUtils.isNotBlank(pd.getString("CREATORNAME"))){ + String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); + if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName)) { + errInfo = "fail"; + map.put("result", errInfo); + map.put("msg", "文件格式不正确!"); + return map; + } + String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); + pd.put("ATTACHMENT_ROUTE", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); + pd.put("ATTACHMENT_NAME",pd.getString("CREATORNAME")); + pd.put("CONFIRM_MESSAGE_TIME",DateUtil.date2Str(new Date())); + } + + // 处理 videoFile + if (videoFile != null && StringUtils.isNotBlank(pd.getString("CREATORNAME"))) { + String videoSuffixName = videoFile.getOriginalFilename().substring(videoFile.getOriginalFilename().lastIndexOf(".") + 1).toLowerCase(); + if (!"mp4".equals(videoSuffixName)) { + errInfo = "fail"; + map.put("result", errInfo); + map.put("msg", "视频文件格式不正确!"); + return map; + } + String videoFileName = this.get32UUID() + videoFile.getOriginalFilename().substring(videoFile.getOriginalFilename().lastIndexOf(".")); + smb.sshSftp(videoFile, videoFileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); + pd.put("VIDEO_ROUTE", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + videoFileName); + pd.put("VIDEO_NAME",pd.getString("CREATORNAME")); + } + + pd.put("SIGNING", "0"); // 签收情况 + pd.put("REPLY", "0"); // 回复情况 + securityNoticeService.edit(pd); + + String[] personIds = pd.getString("PERSON_ID").split(","); + for (String personId : personIds) { + //pd.put("NOTIFICATION_ID", notificationId); + pd.put("PERSON_ID", personId.trim()); + pd.put("READDETAIL_ID", this.get32UUID()); // 主键 + pd.put("REPLYSTATUS", "0"); // 主键 + pd.put("SIGNEDSTATUS", "0"); // 主键 + securityReadDetail.save(pd); + } + map.put("result", errInfo); + map.put("pd", pd); + return map; + } + /**删除 * @param * @throws Exception @@ -241,4 +322,40 @@ public class TrafficSecurityNoticeController extends BaseController { map.put("result", errInfo);//返回结果 return map; } + + @RequestMapping(value="/issueSecurityNotice") + @ResponseBody + public Object issueSecurityNotice() throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + // 修改安全通知发布状态 + securityNoticeService.issueSecurityNotice(pd); + // 查询此条通知的信息,获取 推送的ID + PageData securityNotice = securityNoticeService.findById(pd); + // 把此条通知的ID 和 推送人的ID 存入到 发部表 + String[] personIds = securityNotice.getString("PERSON_ID").split(","); + for (int i = 0; i < personIds.length; i++) { + PageData issue = new PageData(); + issue.put("READDETAIL_ID", this.get32UUID()); + issue.put("NOTIFICATION_ID",securityNotice.getString("NOTIFICATION_ID")); + issue.put("TITLE",securityNotice.getString("TITLE")); + issue.put("LEVEL",securityNotice.getString("LEVEL")); + issue.put("REPLY", "0"); + issue.put("SIGNING", "0"); + issue.put("TRANSPORTATIONCOMPANY", securityNotice.getString("TRANSPORTATIONCOMPANY")); + issue.put("PERSON_ID",personIds[i]); + issue.put("PERSON", securityNotice.getString("PERSON_ID")); + issue.put("ISDELETE", "0"); + issue.put("CREATOR", Jurisdiction.getUSER_ID()); + issue.put("CREATORNAME", Jurisdiction.getUsername()); + issue.put("CREATETIME",DateUtil.date2Str(new Date())); + // 编写发布的 insert + trafficSecurityReadDetailService.save(issue); + } + map.put("pd", pd); + map.put("result", errInfo); + return map; + } } diff --git a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityViolationRegistrationController.java b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityViolationRegistrationController.java index 6ed198a..208e7d5 100644 --- a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityViolationRegistrationController.java +++ b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityViolationRegistrationController.java @@ -4,6 +4,7 @@ import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.service.comprehensive.TrafficSecurityViolationRegistrationService; +import com.zcloud.service.system.UsersService; import com.zcloud.util.*; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -23,6 +24,9 @@ import java.util.Map; public class TrafficSecurityViolationRegistrationController extends BaseController { @Autowired private TrafficSecurityViolationRegistrationService violationRegistrationService; + + @Autowired + private UsersService usersService; @Autowired private Smb smb; @@ -74,8 +78,11 @@ public class TrafficSecurityViolationRegistrationController extends BaseControll pd = this.getPageData(); String USER_ID = pd.getString("USER_ID"); // 运输企业 - if (Tools.notEmpty(USER_ID)) + if (Tools.notEmpty(USER_ID)){ + pd.put("USER_ID", USER_ID.trim()); + } + String PENALTYTIME = pd.getString("PENALTYTIME"); // 运输车辆 if (Tools.notEmpty(PENALTYTIME)) diff --git a/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityNoticeMapper.java b/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityNoticeMapper.java index 398c88a..70f39a6 100644 --- a/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityNoticeMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityNoticeMapper.java @@ -37,4 +37,8 @@ public interface TrafficSecurityNoticeMapper { List getAllNotifications(PageData pd); int getRedPoint(PageData pd); + + void edit(PageData pd); + + void issueSecurityNotice(PageData pd); } diff --git a/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityReadDetailMapper.java b/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityReadDetailMapper.java index 3fce7a4..f06df75 100644 --- a/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityReadDetailMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficSecurityReadDetailMapper.java @@ -16,4 +16,6 @@ public interface TrafficSecurityReadDetailMapper { void edit(PageData pd); void delete(PageData pd); + + List listByUserIdOrNoticeId(Page page); } diff --git a/src/main/java/com/zcloud/mapper/datasource/system/UsersMapper.java b/src/main/java/com/zcloud/mapper/datasource/system/UsersMapper.java index 09a5f6a..093e642 100644 --- a/src/main/java/com/zcloud/mapper/datasource/system/UsersMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/system/UsersMapper.java @@ -299,4 +299,6 @@ public interface UsersMapper { PageData getUserByUserId(PageData pd); List getPractitionerSelectList(PageData pd); + + List listUserByIds(String[] personIds); } diff --git a/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityNoticeService.java b/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityNoticeService.java index 0f33117..3426775 100644 --- a/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityNoticeService.java +++ b/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityNoticeService.java @@ -22,4 +22,8 @@ public interface TrafficSecurityNoticeService { List getAllNotifications(PageData pd); public int getRedPoint(PageData pd) throws Exception; + + public void edit(PageData pd); + + public void issueSecurityNotice(PageData pd); } diff --git a/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityReadDetailService.java b/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityReadDetailService.java index 9abe8fa..2692d1b 100644 --- a/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityReadDetailService.java +++ b/src/main/java/com/zcloud/service/comprehensive/TrafficSecurityReadDetailService.java @@ -15,4 +15,6 @@ public interface TrafficSecurityReadDetailService { void edit(PageData pd); void delete(PageData pd); + + List listByUserIdOrNoticeId(Page page); } diff --git a/src/main/java/com/zcloud/service/comprehensive/impl/TrafficSecurityNoticeServiceImpl.java b/src/main/java/com/zcloud/service/comprehensive/impl/TrafficSecurityNoticeServiceImpl.java index e617243..cf2a161 100644 --- a/src/main/java/com/zcloud/service/comprehensive/impl/TrafficSecurityNoticeServiceImpl.java +++ b/src/main/java/com/zcloud/service/comprehensive/impl/TrafficSecurityNoticeServiceImpl.java @@ -49,4 +49,13 @@ public class TrafficSecurityNoticeServiceImpl implements TrafficSecurityNoticeSe return securityNoticeMapper.getRedPoint(pd); } + @Override + public void edit(PageData pd) { + securityNoticeMapper.edit(pd); + } + + @Override + public void issueSecurityNotice(PageData pd) { + securityNoticeMapper.issueSecurityNotice(pd); + } } diff --git a/src/main/java/com/zcloud/service/comprehensive/impl/TrafficSecurityReadDetailImpl.java b/src/main/java/com/zcloud/service/comprehensive/impl/TrafficSecurityReadDetailImpl.java index a30a39b..d975b40 100644 --- a/src/main/java/com/zcloud/service/comprehensive/impl/TrafficSecurityReadDetailImpl.java +++ b/src/main/java/com/zcloud/service/comprehensive/impl/TrafficSecurityReadDetailImpl.java @@ -38,4 +38,9 @@ public class TrafficSecurityReadDetailImpl implements TrafficSecurityReadDetailS public void delete(PageData pd) { securityReadDetailMapper.delete(pd); } + + @Override + public List listByUserIdOrNoticeId(Page page) { + return securityReadDetailMapper.listByUserIdOrNoticeId(page); + } } diff --git a/src/main/java/com/zcloud/service/system/UsersService.java b/src/main/java/com/zcloud/service/system/UsersService.java index 2ed77ea..9da46bd 100644 --- a/src/main/java/com/zcloud/service/system/UsersService.java +++ b/src/main/java/com/zcloud/service/system/UsersService.java @@ -373,4 +373,5 @@ public interface UsersService { List getPractitionerSelectList(PageData pd) throws Exception; + List listUserByIds(String[] personIds); } diff --git a/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java b/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java index 0eb0fba..ab1e5a6 100644 --- a/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java +++ b/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java @@ -1345,5 +1345,8 @@ public class UsersServiceImpl implements UsersService { return usersMapper.getPractitionerSelectList(pd); } - + @Override + public List listUserByIds(String[] personIds) { + return usersMapper.listUserByIds(personIds); + } } diff --git a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityNoticeMapper.xml b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityNoticeMapper.xml index 548acbc..2fc5bae 100644 --- a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityNoticeMapper.xml +++ b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityNoticeMapper.xml @@ -125,6 +125,41 @@ NOTIFICATION_ID = #{NOTIFICATION_ID} + + + update + f + set + NOTIFICATION_ID = #{NOTIFICATION_ID}, + TITLE = #{TITLE}, + LEVEL = #{LEVEL}, + REPLY = #{REPLY}, + SIGNING = #{SIGNING}, + TRANSPORTATIONCOMPANY = #{TRANSPORTATIONCOMPANY}, + PERSON_ID = #{PERSON_ID}, + PERSON = #{PERSON}, + NOTIFICATIONCONTENT = #{NOTIFICATIONCONTENT}, + ISDELETE = #{ISDELETE}, + DELETOR = #{DELETOR}, + DELETETIME = #{DELETETIME}, + CREATOR = #{CREATOR}, + CREATORNAME = #{CREATORNAME}, + CREATETIME = #{CREATETIME}, + OPERATOR = #{OPERATOR}, + OPERATORNAME = #{OPERATORNAME}, + OPERATTIME = #{OPERATTIME}, + REPLYSTATUS = #{REPLYSTATUS}, + PRACTITIONER = #{PRACTITIONER}, + PRACTITIONERTYPE = #{PRACTITIONERTYPE}, + ATTACHMENT_ROUTE = #{ATTACHMENT_ROUTE}, + ATTACHMENT_NAME = #{ATTACHMENT_NAME}, + VIDEO_ROUTE = #{VIDEO_ROUTE}, + VIDEO_NAME = #{VIDEO_NAME}, + POSTSTATUS = #{POSTSTATUS} + where + f.NOTIFICATION_ID = #{NOTIFICATION_ID} + + + + + update + f + set + POSTSTATUS = '1' + where + f.NOTIFICATION_ID = #{NOTIFICATION_ID} + + diff --git a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityReadDetailMapper.xml b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityReadDetailMapper.xml index 4e9039c..49d5b74 100644 --- a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityReadDetailMapper.xml +++ b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityReadDetailMapper.xml @@ -192,5 +192,35 @@ + + + + diff --git a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityViolationRegistrationMapper.xml b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityViolationRegistrationMapper.xml index c3aa517..ee5dee4 100644 --- a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityViolationRegistrationMapper.xml +++ b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityViolationRegistrationMapper.xml @@ -139,7 +139,7 @@ left join sys_user u on f.USER_ID = u.USER_ID where f.ISDELETE = '0' - and f.USER_ID = #{pd.USER_ID} + and u.NAME LIKE CONCAT(CONCAT('%', #{pd.USER_ID}),'%') and f.PENALTYTIME = #{pd.PENALTYTIME} @@ -148,9 +148,11 @@ diff --git a/src/main/resources/mybatis/datasource/system/UsersMapper.xml b/src/main/resources/mybatis/datasource/system/UsersMapper.xml index 6c67a2e..61c9856 100644 --- a/src/main/resources/mybatis/datasource/system/UsersMapper.xml +++ b/src/main/resources/mybatis/datasource/system/UsersMapper.xml @@ -1078,11 +1078,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join SYS_ROLE r on u.ROLE_ID = r.ROLE_ID left join OA_DEPARTMENT d on d.DEPARTMENT_ID=u.DEPARTMENT_ID left join SYS_POST p on p.POST_ID=u.POST_ID - where - USER_ID in - - #{item} - + c order by d.LEVEL asc ,d.DEP_ORDER asc ,d.DEPARTMENT_ID asc, u.SORT asc,u.LAST_LOGIN desc @@ -1867,4 +1863,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and d.BIANMA LIKE CONCAT(CONCAT('%', #{BIANMA}),'%') + +