From c5ea8e40eff563f5b36f92f1657b0d670d2a02c5 Mon Sep 17 00:00:00 2001 From: guoshengxiong <1923636941@qq.com> Date: Tue, 7 May 2024 00:00:47 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zhgd/mybatis/DataScopeHandler.java | 24 +++-------------- .../basicdata/service/INoticeService.java | 2 ++ .../service/impl/NoticeServiceImpl.java | 9 +++++-- .../car/mapper/CarPassRecordMapper.java | 2 ++ .../car/mapper/xml/CarPassRecordMapper.xml | 1 + .../QualityInspectionRecordServiceImpl.java | 4 ++- .../impl/QualityRectifyRecordServiceImpl.java | 16 ++++++++---- ...iAnalyseHardWareAlarmRecordController.java | 3 +++ .../AiAnalyseHardWareAlarmRecordMapper.xml | 26 +++++++++++++++++++ ...rityQualityInspectionRecordController.java | 9 +++++++ .../entity/vo/StatsByChangeIdVo.java | 17 ++++++++++++ ...SecurityQualityInspectionRecordMapper.java | 2 ++ ...zSecurityQualityInspectionRecordMapper.xml | 16 ++++++++++++ ...ecurityQualityInspectionRecordService.java | 3 +++ ...ityQualityInspectionRecordServiceImpl.java | 21 ++++++++++----- ...curityQualityRectifyRecordServiceImpl.java | 16 ++++++++---- .../zhgd/xmgl/push/config/PushPayloads.java | 19 ++++++++++++++ .../push/controller/UniPushController.java | 3 ++- .../xmgl/push/service/UniPushService.java | 2 +- .../push/service/impl/UniPushServiceImpl.java | 12 ++++----- 20 files changed, 158 insertions(+), 49 deletions(-) create mode 100644 src/main/java/com/zhgd/xmgl/modules/xz.security/entity/vo/StatsByChangeIdVo.java create mode 100644 src/main/java/com/zhgd/xmgl/push/config/PushPayloads.java diff --git a/src/main/java/com/zhgd/mybatis/DataScopeHandler.java b/src/main/java/com/zhgd/mybatis/DataScopeHandler.java index 8195b530c..e2b477504 100644 --- a/src/main/java/com/zhgd/mybatis/DataScopeHandler.java +++ b/src/main/java/com/zhgd/mybatis/DataScopeHandler.java @@ -44,6 +44,9 @@ import java.util.stream.Collectors; @Slf4j public class DataScopeHandler implements DataPermissionHandler { + @Lazy + @Autowired + IAiAnalyseHardWareRecordService aiAnalyseHardWareRecordService; @Lazy @Autowired private XzSupplierQualificationApplyServiceImpl xzSupplierQualificationApplyService; @@ -53,28 +56,10 @@ public class DataScopeHandler implements DataPermissionHandler { @Lazy @Autowired private UserDevAuthorityServiceImpl userDevAuthorityService; - // - //@Lazy - //@Autowired - //private IProjectService projectService; - // - //@Lazy - //@Autowired - //private IEnterpriseService enterpriseService; - // - //@Lazy - //@Autowired - //private IEngineeringService engineeringService; - // - //@Lazy - //@Autowired - //private ISystemUserDataScopeService systemUserDataScopeService; - @Lazy @Autowired private UserEnterpriseServiceImpl userEnterpriseService; - @Override public Expression getSqlSegment(Expression where, String mappedStatementId) { return null; @@ -131,9 +116,6 @@ public class DataScopeHandler implements DataPermissionHandler { //} } - @Autowired - IAiAnalyseHardWareRecordService aiAnalyseHardWareRecordService; - private PlainSelect dataScopeFilterByProject(PlainSelect plainSelect, UserInfo user, Object obj) { JSONObject jo = (JSONObject) obj; Object parameter = jo.get("parameter"); diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/service/INoticeService.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/INoticeService.java index 124b77316..c0b4a63ea 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/service/INoticeService.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/INoticeService.java @@ -30,6 +30,8 @@ public interface INoticeService extends IService { */ void addUserNotice(Long accountId, String msg, String title, String type); + void addUserNoticeAndApp(Long accountId, String msg, String title, String type, Object payload); + /** * 发通知,给某人和app通知 * diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/NoticeServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/NoticeServiceImpl.java index fb7a9d816..d1f4b3b1f 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/NoticeServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/NoticeServiceImpl.java @@ -82,13 +82,18 @@ public class NoticeServiceImpl extends ServiceImpl impleme } @Override - public void addUserNoticeAndApp(Long accountId, String msg, String title, String type) { + public void addUserNoticeAndApp(Long accountId, String msg, String title, String type, Object payload) { addUserNotice(accountId, msg, title, type); SystemUser systemUser = systemUserMapper.selectById(accountId); if (systemUser == null) { return; } - uniPushService.pushToSingleByAlias(systemUser.getClientId(), title, msg, null); + uniPushService.pushToSingleByAlias(systemUser.getClientId(), title, msg, payload); + } + + @Override + public void addUserNoticeAndApp(Long accountId, String msg, String title, String type) { + addUserNoticeAndApp(accountId, msg, title, type, null); } @Override diff --git a/src/main/java/com/zhgd/xmgl/modules/car/mapper/CarPassRecordMapper.java b/src/main/java/com/zhgd/xmgl/modules/car/mapper/CarPassRecordMapper.java index f6aa1a476..e69066571 100644 --- a/src/main/java/com/zhgd/xmgl/modules/car/mapper/CarPassRecordMapper.java +++ b/src/main/java/com/zhgd/xmgl/modules/car/mapper/CarPassRecordMapper.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.Map; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zhgd.annotation.DataScope; import com.zhgd.jeecg.common.mybatis.EntityMap; import com.zhgd.xmgl.modules.car.entity.vo.TodayOutInNumber; import org.apache.ibatis.annotations.Mapper; @@ -18,6 +19,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; * @version: V1.0 */ @Mapper +@DataScope(includeTable = "enterprise_info") public interface CarPassRecordMapper extends BaseMapper { Map getCurrentDayCarPassRecordOutAndInNum(Map map); diff --git a/src/main/java/com/zhgd/xmgl/modules/car/mapper/xml/CarPassRecordMapper.xml b/src/main/java/com/zhgd/xmgl/modules/car/mapper/xml/CarPassRecordMapper.xml index 196b0a643..9f2dd5700 100644 --- a/src/main/java/com/zhgd/xmgl/modules/car/mapper/xml/CarPassRecordMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/car/mapper/xml/CarPassRecordMapper.xml @@ -162,6 +162,7 @@ else 3 end) car_type FROM car_pass_record a LEFT JOIN car_info b ON (a.project_sn = b.project_sn AND a.car_number = b.car_number) + left join enterprise_info ei on ei.id=b.enterprise_id where a.project_sn = #{param.projectSn} and b.id is not null diff --git a/src/main/java/com/zhgd/xmgl/modules/quality/service/impl/QualityInspectionRecordServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/quality/service/impl/QualityInspectionRecordServiceImpl.java index 6c253e1f8..cdbdf7764 100644 --- a/src/main/java/com/zhgd/xmgl/modules/quality/service/impl/QualityInspectionRecordServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/quality/service/impl/QualityInspectionRecordServiceImpl.java @@ -38,6 +38,7 @@ import com.zhgd.xmgl.modules.worker.mapper.EnterpriseInfoMapper; import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper; import com.zhgd.xmgl.modules.xz.entity.XzDeductScoreRecord; import com.zhgd.xmgl.modules.xz.mapper.XzDeductScoreRecordMapper; +import com.zhgd.xmgl.push.config.PushPayloads; import com.zhgd.xmgl.util.JxlExcelUtils; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; @@ -261,7 +262,8 @@ public class QualityInspectionRecordServiceImpl extends ServiceImpl> queryPageList(@RequestBody Map map) { diff --git a/src/main/java/com/zhgd/xmgl/modules/video/mapper/xml/AiAnalyseHardWareAlarmRecordMapper.xml b/src/main/java/com/zhgd/xmgl/modules/video/mapper/xml/AiAnalyseHardWareAlarmRecordMapper.xml index 53db0dfb2..0271ae16f 100644 --- a/src/main/java/com/zhgd/xmgl/modules/video/mapper/xml/AiAnalyseHardWareAlarmRecordMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/video/mapper/xml/AiAnalyseHardWareAlarmRecordMapper.xml @@ -37,6 +37,32 @@ AND a.create_time <= #{param.endTime} + + and a.hardware_id in ( + select ai_analyse_hard_ware_record.hardware_id from ai_analyse_hard_ware_record where id in ( + select distinct qrtaah.ai_analyse_hard_ware_record_id from quality_region_to_ai_analyse_hard qrtaah join + quality_region_to_enterprise qrte on qrte.quality_region_id=qrtaah.quality_region_id + where qrte.enterprise_id = #{param.enterpriseId} OR qrte.enterprise_id IN ( SELECT DISTINCT t.enterprise_id + FROM + (SELECT t.id FROM project_enterprise t WHERE t.enterprise_id = #{param.enterpriseId}) t2 join + project_enterprise + t on find_in_set( t2.id, ancestors ) ) + )) + + + and a.hardware_id in( + select ai_analyse_hard_ware_record.hardware_id from ai_analyse_hard_ware_record where id in ( + select distinct h.ai_analyse_hard_ware_record_id from quality_region_to_ai_analyse_hard h where + h.quality_region_id = #{param.qualityRegionId} OR h.quality_region_id IN ( SELECT t.id FROM quality_region t + WHERE find_in_set(#{param.qualityRegionId}, ancestors) )) + ) + + + AND a.handle_done = #{param.handleDone} + + + AND (a.handle_done = #{param.handleDone} or a.handle_done is null) + group by a.id order by a.create_time desc diff --git a/src/main/java/com/zhgd/xmgl/modules/xz.security/controller/XzSecurityQualityInspectionRecordController.java b/src/main/java/com/zhgd/xmgl/modules/xz.security/controller/XzSecurityQualityInspectionRecordController.java index 45ca355e6..6dcd3bc2b 100644 --- a/src/main/java/com/zhgd/xmgl/modules/xz.security/controller/XzSecurityQualityInspectionRecordController.java +++ b/src/main/java/com/zhgd/xmgl/modules/xz.security/controller/XzSecurityQualityInspectionRecordController.java @@ -306,5 +306,14 @@ public class XzSecurityQualityInspectionRecordController { return Result.success(qualityInspectionRecordService.countQualityInspectionRecordRegion(paramMap)); } + @ApiOperation(value = "整改人统计", notes = "整改人统计", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"), + }) + @PostMapping(value = "/statsByChangeId") + public Result> statsByChangeId(@ApiIgnore @RequestBody Map paramMap) { + return Result.success(qualityInspectionRecordService.statsByChangeId(paramMap)); + } + } diff --git a/src/main/java/com/zhgd/xmgl/modules/xz.security/entity/vo/StatsByChangeIdVo.java b/src/main/java/com/zhgd/xmgl/modules/xz.security/entity/vo/StatsByChangeIdVo.java new file mode 100644 index 000000000..46642a3fe --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/xz.security/entity/vo/StatsByChangeIdVo.java @@ -0,0 +1,17 @@ +package com.zhgd.xmgl.modules.xz.security.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class StatsByChangeIdVo { + @ApiModelProperty("姓名") + private String workerName; + @ApiModelProperty("整改数量") + private Integer changeNum; + @ApiModelProperty("整改率") + private Double changeRate; + @ApiModelProperty("及时整改率") + private Double changeRateTimely; + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/xz.security/mapper/XzSecurityQualityInspectionRecordMapper.java b/src/main/java/com/zhgd/xmgl/modules/xz.security/mapper/XzSecurityQualityInspectionRecordMapper.java index 738a68d87..bf15ce32a 100644 --- a/src/main/java/com/zhgd/xmgl/modules/xz.security/mapper/XzSecurityQualityInspectionRecordMapper.java +++ b/src/main/java/com/zhgd/xmgl/modules/xz.security/mapper/XzSecurityQualityInspectionRecordMapper.java @@ -61,4 +61,6 @@ public interface XzSecurityQualityInspectionRecordMapper extends BaseMapper countQualityInspectionRecordUrgentLevel(HashMap paramMap); List countQualityInspectionRecordRegion(HashMap paramMap); + + List statsByChangeId(Map paramMap); } diff --git a/src/main/java/com/zhgd/xmgl/modules/xz.security/mapper/xml/XzSecurityQualityInspectionRecordMapper.xml b/src/main/java/com/zhgd/xmgl/modules/xz.security/mapper/xml/XzSecurityQualityInspectionRecordMapper.xml index e99a8452e..1d30e0f5b 100644 --- a/src/main/java/com/zhgd/xmgl/modules/xz.security/mapper/xml/XzSecurityQualityInspectionRecordMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/xz.security/mapper/xml/XzSecurityQualityInspectionRecordMapper.xml @@ -498,4 +498,20 @@ group by qr.id order by y desc + + diff --git a/src/main/java/com/zhgd/xmgl/modules/xz.security/service/IXzSecurityQualityInspectionRecordService.java b/src/main/java/com/zhgd/xmgl/modules/xz.security/service/IXzSecurityQualityInspectionRecordService.java index a6a8ed438..dfc967c6f 100644 --- a/src/main/java/com/zhgd/xmgl/modules/xz.security/service/IXzSecurityQualityInspectionRecordService.java +++ b/src/main/java/com/zhgd/xmgl/modules/xz.security/service/IXzSecurityQualityInspectionRecordService.java @@ -61,4 +61,7 @@ public interface IXzSecurityQualityInspectionRecordService extends IService paramMap); List countQualityInspectionRecordRegion(HashMap paramMap); + + List statsByChangeId(Map paramMap); + } diff --git a/src/main/java/com/zhgd/xmgl/modules/xz.security/service/impl/XzSecurityXzSecurityQualityInspectionRecordServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/xz.security/service/impl/XzSecurityXzSecurityQualityInspectionRecordServiceImpl.java index 9077f4ed6..942190825 100644 --- a/src/main/java/com/zhgd/xmgl/modules/xz.security/service/impl/XzSecurityXzSecurityQualityInspectionRecordServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/xz.security/service/impl/XzSecurityXzSecurityQualityInspectionRecordServiceImpl.java @@ -23,6 +23,12 @@ import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserMapper; import com.zhgd.xmgl.modules.basicdata.service.INoticeService; import com.zhgd.xmgl.modules.quality.entity.QualityRegion; import com.zhgd.xmgl.modules.quality.mapper.QualityRegionMapper; +import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo; +import com.zhgd.xmgl.modules.worker.entity.WorkerInfo; +import com.zhgd.xmgl.modules.worker.mapper.EnterpriseInfoMapper; +import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper; +import com.zhgd.xmgl.modules.xz.entity.XzDeductScoreRecord; +import com.zhgd.xmgl.modules.xz.mapper.XzDeductScoreRecordMapper; import com.zhgd.xmgl.modules.xz.security.entity.XzSecurityDangerItemRecord; import com.zhgd.xmgl.modules.xz.security.entity.XzSecurityQualityInspectionRecord; import com.zhgd.xmgl.modules.xz.security.entity.XzSecurityQualityRectifyRecord; @@ -32,12 +38,7 @@ import com.zhgd.xmgl.modules.xz.security.mapper.XzSecurityDangerItemRecordMapper import com.zhgd.xmgl.modules.xz.security.mapper.XzSecurityQualityInspectionRecordMapper; import com.zhgd.xmgl.modules.xz.security.mapper.XzSecurityQualityRectifyRecordMapper; import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityQualityInspectionRecordService; -import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo; -import com.zhgd.xmgl.modules.worker.entity.WorkerInfo; -import com.zhgd.xmgl.modules.worker.mapper.EnterpriseInfoMapper; -import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper; -import com.zhgd.xmgl.modules.xz.entity.XzDeductScoreRecord; -import com.zhgd.xmgl.modules.xz.mapper.XzDeductScoreRecordMapper; +import com.zhgd.xmgl.push.config.PushPayloads; import com.zhgd.xmgl.util.JxlExcelUtils; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; @@ -261,7 +262,8 @@ public class XzSecurityXzSecurityQualityInspectionRecordServiceImpl extends Serv } xzSecurityQualityInspectionRecordMapper.insert(xzSecurityQualityInspectionRecord); if (xzSecurityQualityInspectionRecord.getRecordType() == 1 && xzSecurityQualityInspectionRecord.getStatus() == 2) { - noticeService.addUserNoticeAndApp(xzSecurityQualityInspectionRecord.getChangeId(), "您有一条安全检查待整改,问题:" + xzSecurityQualityInspectionRecord.getDangerItemContent(), "安全管理待整改", "10"); + noticeService.addUserNoticeAndApp(xzSecurityQualityInspectionRecord.getChangeId(), "您有一条安全检查待整改,问题:" + xzSecurityQualityInspectionRecord.getDangerItemContent(), "安全管理待整改", "10", + PushPayloads.buildPushPayload(10, xzSecurityQualityInspectionRecord)); } deductScoreIf(xzSecurityQualityInspectionRecord); @@ -439,6 +441,11 @@ public class XzSecurityXzSecurityQualityInspectionRecordServiceImpl extends Serv return baseMapper.countQualityInspectionRecordRegion(paramMap); } + @Override + public List statsByChangeId(Map paramMap) { + return baseMapper.statsByChangeId(paramMap); + } + private void setWeekRatioData(XzSecurityAllAndWeekDataVO allAndWeekDataVO) { long weekClose = allAndWeekDataVO.getWeekClose(); long weekNoClose = allAndWeekDataVO.getWeekNoClose(); diff --git a/src/main/java/com/zhgd/xmgl/modules/xz.security/service/impl/XzSecurityXzSecurityQualityRectifyRecordServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/xz.security/service/impl/XzSecurityXzSecurityQualityRectifyRecordServiceImpl.java index 5a928e498..9994bb956 100644 --- a/src/main/java/com/zhgd/xmgl/modules/xz.security/service/impl/XzSecurityXzSecurityQualityRectifyRecordServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/xz.security/service/impl/XzSecurityXzSecurityQualityRectifyRecordServiceImpl.java @@ -20,6 +20,7 @@ import com.zhgd.xmgl.modules.xz.security.mapper.XzSecurityQualityInspectionRecor import com.zhgd.xmgl.modules.xz.security.mapper.XzSecurityQualityRectifyRecordMapper; import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityQualityInspectionRecordService; import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityQualityRectifyRecordService; +import com.zhgd.xmgl.push.config.PushPayloads; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.io.FileUtils; @@ -79,7 +80,8 @@ public class XzSecurityXzSecurityQualityRectifyRecordServiceImpl extends Service //已整改时候需要复查 if (xzSecurityQualityRectifyRecord.getStatus() == 2) { xzSecurityQualityInspectionRecord.setStatus(3); - noticeService.addUserNoticeAndApp(tempXzSecurityQualityInspectionRecord.getReviewId(), "您有一条安全检查的整改结果需要复查,请及时查看。", "安全管理整改结果待复查", "10"); + noticeService.addUserNoticeAndApp(tempXzSecurityQualityInspectionRecord.getReviewId(), "您有一条安全检查的整改结果需要复查,请及时查看。", "安全管理整改结果待复查", "10", + PushPayloads.buildPushPayload(10, xzSecurityQualityInspectionRecord)); } else { xzSecurityQualityInspectionRecord.setStatus(2); } @@ -87,19 +89,23 @@ public class XzSecurityXzSecurityQualityRectifyRecordServiceImpl extends Service //复查合格时候需要核验 if (xzSecurityQualityRectifyRecord.getStatus() == 2) { xzSecurityQualityInspectionRecord.setStatus(4); - noticeService.addUserNoticeAndApp(tempXzSecurityQualityInspectionRecord.getVerifyManId(), "您有一条安全检查的整改结果需要核验,请及时查看。", "安全管理整改结果核验通知", "10"); + noticeService.addUserNoticeAndApp(tempXzSecurityQualityInspectionRecord.getVerifyManId(), "您有一条安全检查的整改结果需要核验,请及时查看。", "安全管理整改结果核验通知", "10", + PushPayloads.buildPushPayload(10, xzSecurityQualityInspectionRecord)); } else { xzSecurityQualityInspectionRecord.setStatus(2); - noticeService.addUserNoticeAndApp(tempXzSecurityQualityInspectionRecord.getChangeId(), "您提交的安全检查的整改结果复查不通过,请及时重新整改。", "安全管理整改结果复查通知", "10"); + noticeService.addUserNoticeAndApp(tempXzSecurityQualityInspectionRecord.getChangeId(), "您提交的安全检查的整改结果复查不通过,请及时重新整改。", "安全管理整改结果复查通知", "10", + PushPayloads.buildPushPayload(10, xzSecurityQualityInspectionRecord)); } } else { //核验合格时候则该记录合格 if (xzSecurityQualityRectifyRecord.getStatus() == 2) { xzSecurityQualityInspectionRecord.setStatus(5); - noticeService.addUserNoticeAndApp(tempXzSecurityQualityInspectionRecord.getChangeId(), "您提交的安全检查的整改结果已通过核验。", "安全管理整改结果核验通知", "10"); + noticeService.addUserNoticeAndApp(tempXzSecurityQualityInspectionRecord.getChangeId(), "您提交的安全检查的整改结果已通过核验。", "安全管理整改结果核验通知", "10", + PushPayloads.buildPushPayload(10, xzSecurityQualityInspectionRecord)); } else { xzSecurityQualityInspectionRecord.setStatus(2); - noticeService.addUserNoticeAndApp(tempXzSecurityQualityInspectionRecord.getChangeId(), "您提交的安全检查的整改结果核验不通过,请及时重新整改。", "安全管理整改结果核验通知", "10"); + noticeService.addUserNoticeAndApp(tempXzSecurityQualityInspectionRecord.getChangeId(), "您提交的安全检查的整改结果核验不通过,请及时重新整改。", "安全管理整改结果核验通知", "10", + PushPayloads.buildPushPayload(10, xzSecurityQualityInspectionRecord)); } } xzSecurityQualityInspectionRecordMapper.updateById(xzSecurityQualityInspectionRecord); diff --git a/src/main/java/com/zhgd/xmgl/push/config/PushPayloads.java b/src/main/java/com/zhgd/xmgl/push/config/PushPayloads.java new file mode 100644 index 000000000..299f60b65 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/push/config/PushPayloads.java @@ -0,0 +1,19 @@ +package com.zhgd.xmgl.push.config; + +import lombok.Data; + +@Data +public class PushPayloads { + /** + * 10安全11质量 + */ + private Integer type; + private Object data; + + public static PushPayloads buildPushPayload(Integer type, Object data) { + PushPayloads pushPayload = new PushPayloads(); + pushPayload.setType(type); + pushPayload.setData(data); + return pushPayload; + } +} diff --git a/src/main/java/com/zhgd/xmgl/push/controller/UniPushController.java b/src/main/java/com/zhgd/xmgl/push/controller/UniPushController.java index 314085208..499653481 100644 --- a/src/main/java/com/zhgd/xmgl/push/controller/UniPushController.java +++ b/src/main/java/com/zhgd/xmgl/push/controller/UniPushController.java @@ -33,12 +33,13 @@ public class UniPushController { @ApiImplicitParam(name = "alias", value = "别名", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "title", value = "标题", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "content", value = "标题", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "payload", value = "payload", paramType = "body", required = false, dataType = "String"), }) @PostMapping("/pushMess") public Result pushMessage(@RequestBody Map map) { Result result=new Result(); try { - ApiResult apiResult=uniPushService.pushToSingleByAlias(MapUtils.getString(map,"alias"),MapUtils.getString(map,"title"),MapUtils.getString(map,"content"),null); + ApiResult apiResult = uniPushService.pushToSingleByAlias(MapUtils.getString(map, "alias"), MapUtils.getString(map, "title"), MapUtils.getString(map, "content"), MapUtils.getString(map, "payload")); if (apiResult.isSuccess()){ result.successMsg("操作成功"); }else{ diff --git a/src/main/java/com/zhgd/xmgl/push/service/UniPushService.java b/src/main/java/com/zhgd/xmgl/push/service/UniPushService.java index d47cb1663..27db64cf2 100644 --- a/src/main/java/com/zhgd/xmgl/push/service/UniPushService.java +++ b/src/main/java/com/zhgd/xmgl/push/service/UniPushService.java @@ -13,7 +13,7 @@ import java.util.Map; **/ public interface UniPushService { - ApiResult pushToSingleByAlias(String alias, String title, String content,String payload); + ApiResult pushToSingleByAlias(String alias, String title, String content, Object payload); ApiResult bindAlias(String alias, String clientId);//别名绑定 diff --git a/src/main/java/com/zhgd/xmgl/push/service/impl/UniPushServiceImpl.java b/src/main/java/com/zhgd/xmgl/push/service/impl/UniPushServiceImpl.java index 3de5293f5..523f90999 100644 --- a/src/main/java/com/zhgd/xmgl/push/service/impl/UniPushServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/push/service/impl/UniPushServiceImpl.java @@ -37,16 +37,16 @@ public class UniPushServiceImpl implements UniPushService { private PushApiHelper pushApiHelper; @Override - public ApiResult pushToSingleByAlias(String alias, String title, String content, String payload) { + public ApiResult pushToSingleByAlias(String alias, String title, String content, Object payload) { PushDTO pushDTO = this.buildPushDTO(title, content, payload); // log.info("payload-----" + pushDTO.getPushMessage().getNotification().getPayload()); log.info("alias----{},title-----{},content-----{}", alias, title, content); log.info("pushDTO-----" + JSON.toJSONString(pushDTO)); // 设置接收人信息 Audience audience = new Audience(); - pushDTO.setAudience(audience); audience.addAlias(alias);// cid audience.addCid(alias);// cid + pushDTO.setAudience(audience); if (pushApiHelper != null) { pushApiHelper.getPushApi().pushToSingleByCid(pushDTO); // 进行cid单推 @@ -65,7 +65,7 @@ public class UniPushServiceImpl implements UniPushService { } - private PushDTO buildPushDTO(String title, String content, String payload) { + private PushDTO buildPushDTO(String title, String content, Object payload) { PushDTO pushDTO = new PushDTO<>(); // 设置推送参数 //requestid需要每次变化唯一 @@ -100,7 +100,7 @@ public class UniPushServiceImpl implements UniPushService { aps.setSound("default"); aps.setAlert(alert); IosDTO iosDTO = new IosDTO(); - iosDTO.setPayload(payload); + iosDTO.setPayload(payload.toString()); iosDTO.setAps(aps); iosDTO.setType("notify"); @@ -117,8 +117,8 @@ public class UniPushServiceImpl implements UniPushService { notification1.setBody(content); notification1.setClickType("intent"); notification1.setIntent("intent:#Intent;action=android.intent.action.oppopush;launchFlags=0x14000000;component=com.weixiaobao/io.dcloud.PandoraEntry;S.UP-OL-SU=true;S.title=" + title + ";S.content=" + content + ";S.payload=" + payload + ";end"); - notification1.setPayload(payload); - notification1.setUrl(payload); + notification1.setPayload(payload.toString()); + notification1.setUrl(payload.toString()); //各厂商自有功能单项设置 //ups.addOption("HW", "/message/android/notification/badge/class", "io.dcloud.PandoraEntry "); //ups.addOption("HW", "/message/android/notification/badge/add_num", 1);