Browse Source

推送修改,信息发布记录管理,发布渠道管理

develop
wangsixiang 7 months ago
parent
commit
d111b92195
  1. 104
      zc-business/src/main/java/com/zc/business/controller/DcPublishManageController.java
  2. 117
      zc-business/src/main/java/com/zc/business/controller/DcPublishingChannelsController.java
  3. 20
      zc-business/src/main/java/com/zc/business/controller/MsmController.java
  4. 405
      zc-business/src/main/java/com/zc/business/domain/DcPublishManage.java
  5. 125
      zc-business/src/main/java/com/zc/business/domain/DcPublishingChannels.java
  6. 69
      zc-business/src/main/java/com/zc/business/mapper/DcPublishManageMapper.java
  7. 63
      zc-business/src/main/java/com/zc/business/mapper/DcPublishingChannelsMapper.java
  8. 1
      zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java
  9. 61
      zc-business/src/main/java/com/zc/business/service/IDcPublishManageService.java
  10. 63
      zc-business/src/main/java/com/zc/business/service/IDcPublishingChannelsService.java
  11. 7
      zc-business/src/main/java/com/zc/business/service/IMsmService.java
  12. 107
      zc-business/src/main/java/com/zc/business/service/impl/DcPublishManageServiceImpl.java
  13. 101
      zc-business/src/main/java/com/zc/business/service/impl/DcPublishingChannelsServiceImpl.java
  14. 5
      zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java
  15. 107
      zc-business/src/main/java/com/zc/business/service/impl/MsmServiceImpl.java
  16. 174
      zc-business/src/main/resources/mapper/business/DcPublishManageMapper.xml
  17. 92
      zc-business/src/main/resources/mapper/business/DcPublishingChannelsMapper.xml
  18. 18
      zc-business/src/main/resources/mapper/business/DcWarningMapper.xml

104
zc-business/src/main/java/com/zc/business/controller/DcPublishManageController.java

@ -0,0 +1,104 @@
package com.zc.business.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.zc.business.domain.DcPublishManage;
import com.zc.business.service.IDcPublishManageService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 信息发布管理记录Controller
*
* @author ruoyi
* @date 2024-04-19
*/
@RestController
@RequestMapping("/business/manage")
public class DcPublishManageController extends BaseController
{
@Autowired
private IDcPublishManageService dcPublishManageService;
/**
* 查询信息发布管理记录列表
*/
@PreAuthorize("@ss.hasPermi('business:manage:list')")
@GetMapping("/list")
public TableDataInfo list(DcPublishManage dcPublishManage)
{
startPage();
List<DcPublishManage> list = dcPublishManageService.selectDcPublishManageList(dcPublishManage);
return getDataTable(list);
}
/**
* 导出信息发布管理记录列表
*/
@PreAuthorize("@ss.hasPermi('business:manage:export')")
@Log(title = "信息发布管理记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DcPublishManage dcPublishManage)
{
List<DcPublishManage> list = dcPublishManageService.selectDcPublishManageList(dcPublishManage);
ExcelUtil<DcPublishManage> util = new ExcelUtil<>(DcPublishManage.class);
util.exportExcel(response, list, "信息发布管理记录数据");
}
/**
* 获取信息发布管理记录详细信息
*/
@PreAuthorize("@ss.hasPermi('business:manage:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(dcPublishManageService.selectDcPublishManageById(id));
}
/**
* 新增信息发布管理记录
*/
@PreAuthorize("@ss.hasPermi('business:manage:add')")
@Log(title = "信息发布管理记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DcPublishManage dcPublishManage)
{
return toAjax(dcPublishManageService.insertDcPublishManage(dcPublishManage));
}
/**
* 修改信息发布管理记录
*/
@PreAuthorize("@ss.hasPermi('business:manage:edit')")
@Log(title = "信息发布管理记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DcPublishManage dcPublishManage)
{
return toAjax(dcPublishManageService.updateDcPublishManage(dcPublishManage));
}
/**
* 删除信息发布管理记录
*/
@PreAuthorize("@ss.hasPermi('business:manage:remove')")
@Log(title = "信息发布管理记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(dcPublishManageService.deleteDcPublishManageByIds(ids));
}
}

117
zc-business/src/main/java/com/zc/business/controller/DcPublishingChannelsController.java

@ -0,0 +1,117 @@
package com.zc.business.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.zc.business.domain.DcPublishingChannels;
import com.zc.business.service.IDcPublishingChannelsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 发布渠道Controller
*
* @author ruoyi
* @date 2024-04-19
*/
@RestController
@RequestMapping("/business/channels")
public class DcPublishingChannelsController extends BaseController
{
@Autowired
private IDcPublishingChannelsService dcPublishingChannelsService;
/**
* 查询发布渠道列表
*/
@PreAuthorize("@ss.hasPermi('business:channels:list')")
@GetMapping("/list")
public TableDataInfo list(DcPublishingChannels dcPublishingChannels)
{
startPage();
List<DcPublishingChannels> list = dcPublishingChannelsService.selectDcPublishingChannelsList(dcPublishingChannels);
return getDataTable(list);
}
/**
* 导出发布渠道列表
*/
@PreAuthorize("@ss.hasPermi('business:channels:export')")
@Log(title = "发布渠道", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DcPublishingChannels dcPublishingChannels)
{
List<DcPublishingChannels> list = dcPublishingChannelsService.selectDcPublishingChannelsList(dcPublishingChannels);
ExcelUtil<DcPublishingChannels> util = new ExcelUtil<>(DcPublishingChannels.class);
util.exportExcel(response, list, "发布渠道数据");
}
/**
* 获取发布渠道详细信息
*/
@PreAuthorize("@ss.hasPermi('business:channels:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(dcPublishingChannelsService.selectDcPublishingChannelsById(id));
}
/**
* 新增发布渠道
*/
@PreAuthorize("@ss.hasPermi('business:channels:add')")
@Log(title = "发布渠道", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DcPublishingChannels dcPublishingChannels)
{
if (dcPublishingChannels.getDataCategory()==null){
return AjaxResult.error("参数错误");
}
List<DcPublishingChannels> channelsList = dcPublishingChannelsService.
selectChannelsDataCategory(dcPublishingChannels.getDataCategory());
if (channelsList!=null&&channelsList.size()>0){
return AjaxResult.error("事件类型已存在");
}
return toAjax(dcPublishingChannelsService.insertDcPublishingChannels(dcPublishingChannels));
}
/**
* 修改发布渠道
*/
@PreAuthorize("@ss.hasPermi('business:channels:edit')")
@Log(title = "发布渠道", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DcPublishingChannels dcPublishingChannels)
{
List<DcPublishingChannels> channelsList = dcPublishingChannelsService.
selectChannelsDataCategory(dcPublishingChannels.getDataCategory());
if (channelsList!=null&&channelsList.size()>0){
return AjaxResult.error("事件类型已存在");
}
return toAjax(dcPublishingChannelsService.updateDcPublishingChannels(dcPublishingChannels));
}
/**
* 删除发布渠道
*/
@PreAuthorize("@ss.hasPermi('business:channels:remove')")
@Log(title = "发布渠道", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(dcPublishingChannelsService.deleteDcPublishingChannelsByIds(ids));
}
}

20
zc-business/src/main/java/com/zc/business/controller/MsmController.java

@ -45,11 +45,25 @@ public class MsmController extends BaseController {
//调用微信推送
@PostMapping("/wenXinPush")
public AjaxResult commandAndDispatch(@RequestBody HashMap map){
return AjaxResult.success(msmService.wenXinSend("wx9ee0e3babfd8d2af","de2ecb80b30d63135918ba3ae6ffb711","内容"));
return AjaxResult.success(msmService.wenXinSend("内容"));
}
//整合推送
@PostMapping("/pushAll")
public AjaxResult pushAll(@RequestBody HashMap map)
public AjaxResult pushAll(@RequestBody HashMap map){
if (map == null || !map.containsKey("type")||StringUtils.isBlank(map.get("type").toString())) {
return AjaxResult.error("参数错误");
}
if (map == null ||!map.containsKey("content")|| StringUtils.isBlank(map.get("content").toString())) {
return AjaxResult.error("内容为空");
}
if (!map.containsKey("eventId")|| StringUtils.isBlank(map.get("eventId").toString())) {
return AjaxResult.error("事件id为空");
}
return msmService.putAll(map);
}
//整合推送(弃用)
@PostMapping("/pushAllText")
public AjaxResult pushAllText(@RequestBody HashMap map)
{
if (map == null || !map.containsKey("type")||StringUtils.isBlank(map.get("type").toString())) {
return AjaxResult.error("参数错误");
@ -77,7 +91,7 @@ public class MsmController extends BaseController {
continue;
}
if ("2".equals(type)) { //微信
JSONArray objects = msmService.wenXinSend("wx9ee0e3babfd8d2af", "de2ecb80b30d63135918ba3ae6ffb711",content);
JSONArray objects = msmService.wenXinSend(content);
data = (Integer) objects.get(0);
continue;
}

405
zc-business/src/main/java/com/zc/business/domain/DcPublishManage.java

@ -0,0 +1,405 @@
package com.zc.business.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.omg.CORBA.INTERNAL;
/**
* 信息发布管理记录对象 dc_publish_manage
*
* @author ruoyi
* @date 2024-04-19
*/
public class DcPublishManage extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 事件编号 */
@Excel(name = "事件编号")
private String eventId;
/** 所属机构 */
@Excel(name = "所属机构")
private Long deptId;
/** 发布渠道ID */
@Excel(name = "发布渠道ID")
private Long publishChannelsId;
/** 标题 */
@Excel(name = "标题")
private String title;
/** 发布渠道:多选用逗号隔开1-手机短信2-微信公众号3-微博4-情报板5-服务网站6-微信小程序 */
@Excel(name = "发布渠道",readConverterExp="1=手机短信,2=微信公众号,3=微博,4=情报板,5=服务网站,6=微信小程序")
private Integer publishChannels;
/** 审核状态:0-待审核1-已审核2-未通过 */
@Excel(name = "审核状态: 0-待审核 1-已审核 2-未通过")
private Integer isverify;
/** 发布者 */
@Excel(name = "发布者")
private String publisher;
/** 审核者1 */
@Excel(name = "审核者1")
private String auditor1;
/** 审核者1 */
@Excel(name = "审核者1")
private String auditor2;
/** 审核时间1 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
@Excel(name = "审核时间1", width = 30, dateFormat = "yyyy-MM-dd")
private Date auditTime1;
/** 审核时间1 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
@Excel(name = "审核时间1", width = 30, dateFormat = "yyyy-MM-dd")
private Date auditTime2;
/** 审核者1意见 */
@Excel(name = "审核者1意见")
private String auditComment1;
/** 审核者2意见 */
@Excel(name = "审核者2意见")
private String auditComment2;
/** 发布时间 */
@Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date publishTime;
/** 发布状态:1-成功2-失败3-草稿 */
@Excel(name = "发布状态: 1-成功 2-失败 3-草稿")
private Integer publishStatus;
/** 事件详情 */
@Excel(name = "事件详情")
private String contentDetails;
@Excel(name = "方向", readConverterExp = "1=菏泽方向,3=济南方向")
private String direction;
@Excel(name = "桩号")
private String stakeMark;
@Excel(name = "事件主类",readConverterExp = "1=交通事故,2=车辆故障,3=交通管制,4=交通拥堵,5=非法上路,6=路障清除,7=施工建设,8=服务区异常,9=设施设备隐患,10=异常天气,11=其他事件")
private String eventType;
@Excel(name = "事件子类", readConverterExp = "1-1=追尾,1-2=侧翻,1-3=撞护栏,1-4=自然,1-5=其他事故,2-1=车辆故障,3-1=主线封闭和限行,3-2=收费站封闭和限行,3-3=立交封闭和限行,3-4=服务区封闭和限行,4-1=道路拥堵,4-2=立交拥堵,4-3=收费站拥堵,4-4=服务区拥堵,5-1=行人,5-2=非机动车,5-3=摩托车,5-4=其他,6-1=烟雾,6-2=倒伏树木,6-3=撒落物,6-4=动物,6-5=其他,7-1=道路养护施工,7-2=收费站养护施工,7-3=服务区养护施工,7-4=枢纽立交匝道养护施工,7-5=地方道路养护施工,7-6=道路工程建设施工,7-7=收费站工程建设施工,7-8=服务区工程建设施工,7-9=枢纽立交匝道工程建设施工,7-10=地方道路工程建设施工,8-1=封闭、暂停营业,8-2=重要设施停用,8-3=服务区其他异常,9-1=摄像机,9-2=护栏,9-3=隔离栅")
private String eventSubclass;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date eventTime;
/** 参数开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date startTime;
/** 参数结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date endTime;
//参数
private String startStakeMarkValue;
//参数
private String endStakeMarkValue;
//参数
private Integer startStakeMark;
//参数
private Integer endStakeMark;
//管制收费站
private String facilityName;
//事件状态:0-待确认1-处理中2-已完成
private Integer eventState;
public Integer getEventState() {
return eventState;
}
public void setEventState(Integer eventState) {
this.eventState = eventState;
}
public String getFacilityName() {
return facilityName;
}
public void setFacilityName(String facilityName) {
this.facilityName = facilityName;
}
public String getStartStakeMarkValue() {
return startStakeMarkValue;
}
public void setStartStakeMarkValue(String startStakeMarkValue) {
this.startStakeMarkValue = startStakeMarkValue;
}
public String getEndStakeMarkValue() {
return endStakeMarkValue;
}
public void setEndStakeMarkValue(String endStakeMarkValue) {
this.endStakeMarkValue = endStakeMarkValue;
}
public Integer getStartStakeMark() {
return startStakeMark;
}
public void setStartStakeMark(Integer startStakeMark) {
this.startStakeMark = startStakeMark;
}
public Integer getEndStakeMark() {
return endStakeMark;
}
public void setEndStakeMark(Integer endStakeMark) {
this.endStakeMark = endStakeMark;
}
public String getDirection() {
return direction;
}
public Date getEventTime() {
return eventTime;
}
public void setEventTime(Date eventTime) {
this.eventTime = eventTime;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public void setDirection(String direction) {
this.direction = direction;
}
public String getStakeMark() {
return stakeMark;
}
public void setStakeMark(String stakeMark) {
this.stakeMark = stakeMark;
}
public String getEventType() {
return eventType;
}
public void setEventType(String eventType) {
this.eventType = eventType;
}
public String getEventSubclass() {
return eventSubclass;
}
public void setEventSubclass(String eventSubclass) {
this.eventSubclass = eventSubclass;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setEventId(String eventId)
{
this.eventId = eventId;
}
public String getEventId()
{
return eventId;
}
public void setDeptId(Long deptId)
{
this.deptId = deptId;
}
public Long getDeptId()
{
return deptId;
}
public void setPublishChannelsId(Long publishChannelsId)
{
this.publishChannelsId = publishChannelsId;
}
public Long getPublishChannelsId()
{
return publishChannelsId;
}
public void setTitle(String title)
{
this.title = title;
}
public String getTitle()
{
return title;
}
public void setPublishChannels(Integer publishChannels)
{
this.publishChannels = publishChannels;
}
public Integer getPublishChannels()
{
return publishChannels;
}
public void setIsverify(Integer isverify)
{
this.isverify = isverify;
}
public Integer getIsverify()
{
return isverify;
}
public void setPublisher(String publisher)
{
this.publisher = publisher;
}
public String getPublisher()
{
return publisher;
}
public void setAuditor1(String auditor1)
{
this.auditor1 = auditor1;
}
public String getAuditor1()
{
return auditor1;
}
public void setAuditor2(String auditor2)
{
this.auditor2 = auditor2;
}
public String getAuditor2()
{
return auditor2;
}
public void setAuditTime1(Date auditTime1)
{
this.auditTime1 = auditTime1;
}
public Date getAuditTime1()
{
return auditTime1;
}
public void setAuditTime2(Date auditTime2)
{
this.auditTime2 = auditTime2;
}
public Date getAuditTime2()
{
return auditTime2;
}
public void setAuditComment1(String auditComment1)
{
this.auditComment1 = auditComment1;
}
public String getAuditComment1()
{
return auditComment1;
}
public void setAuditComment2(String auditComment2)
{
this.auditComment2 = auditComment2;
}
public String getAuditComment2()
{
return auditComment2;
}
public void setPublishTime(Date publishTime)
{
this.publishTime = publishTime;
}
public Date getPublishTime()
{
return publishTime;
}
public void setPublishStatus(Integer publishStatus)
{
this.publishStatus = publishStatus;
}
public Integer getPublishStatus()
{
return publishStatus;
}
public void setContentDetails(String contentDetails)
{
this.contentDetails = contentDetails;
}
public String getContentDetails()
{
return contentDetails;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("eventId", getEventId())
.append("deptId", getDeptId())
.append("publishChannelsId", getPublishChannelsId())
.append("title", getTitle())
.append("publishChannels", getPublishChannels())
.append("isverify", getIsverify())
.append("publisher", getPublisher())
.append("auditor1", getAuditor1())
.append("auditor2", getAuditor2())
.append("auditTime1", getAuditTime1())
.append("auditTime2", getAuditTime2())
.append("auditComment1", getAuditComment1())
.append("auditComment2", getAuditComment2())
.append("publishTime", getPublishTime())
.append("publishStatus", getPublishStatus())
.append("contentDetails", getContentDetails())
.append("remark", getRemark())
.append("updateTime", getUpdateTime())
.append("createTime", getCreateTime())
.toString();
}
}

125
zc-business/src/main/java/com/zc/business/domain/DcPublishingChannels.java

@ -0,0 +1,125 @@
package com.zc.business.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 发布渠道对象 dc_publishing_channels
*
* @author ruoyi
* @date 2024-04-19
*/
public class DcPublishingChannels extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 数据种类:和交通事件类型保持一致就可以 */
@Excel(name = "数据种类",readConverterExp = "1=交通事故,2=车辆故障,3=交通管制,4=交通拥堵,5=非法上路,6=路障清除,7=施工建设,8=服务区异常,9=设施设备隐患,10=异常天气,11=其他事件")
private Integer dataCategory;
/** 1-影响通行2-不影响通行 */
@Excel(name = "影响级别",readConverterExp="1=影响通行,2=不影响通行")
private Integer infoLevel;
/** 0-停用2-启用 */
@Excel(name = "启用状态",readConverterExp="0=停用,2=启用")
private Integer enabled;
/** 1-单人审核2-双人审核 */
@Excel(name = "审核方式",readConverterExp="1=单人审核,2=双人审核")
private Integer auditMethod;
/** 发布渠道:多选用逗号隔开1-手机短信2-微信公众号3-微博4-情报板5-服务网站6-微信小程序 */
@Excel(name = "发布渠道",readConverterExp="1=手机短信,2=微信公众号,3=微博,4=情报板,5=服务网站,6=微信小程序")
private String publishChannels;
/** 启用日期 */
@Excel(name = "启用日期", readConverterExp = "$column.readConverterExp()")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date enableDate;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setDataCategory(Integer dataCategory)
{
this.dataCategory = dataCategory;
}
public Integer getDataCategory()
{
return dataCategory;
}
public void setInfoLevel(Integer infoLevel)
{
this.infoLevel = infoLevel;
}
public Integer getInfoLevel()
{
return infoLevel;
}
public void setEnabled(Integer enabled)
{
this.enabled = enabled;
}
public Integer getEnabled()
{
return enabled;
}
public void setAuditMethod(Integer auditMethod)
{
this.auditMethod = auditMethod;
}
public Integer getAuditMethod()
{
return auditMethod;
}
public void setPublishChannels(String publishChannels)
{
this.publishChannels = publishChannels;
}
public String getPublishChannels()
{
return publishChannels;
}
public void setEnableDate(Date enableDate)
{
this.enableDate = enableDate;
}
public Date getEnableDate()
{
return enableDate;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("dataCategory", getDataCategory())
.append("infoLevel", getInfoLevel())
.append("enabled", getEnabled())
.append("auditMethod", getAuditMethod())
.append("publishChannels", getPublishChannels())
.append("enableDate", getEnableDate())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.toString();
}
}

69
zc-business/src/main/java/com/zc/business/mapper/DcPublishManageMapper.java

@ -0,0 +1,69 @@
package com.zc.business.mapper;
import java.util.HashMap;
import java.util.List;
import com.zc.business.domain.DcPublishManage;
import org.apache.ibatis.annotations.Param;
/**
* 信息发布管理记录Mapper接口
*
* @author ruoyi
* @date 2024-04-19
*/
public interface DcPublishManageMapper
{
/**
* 查询信息发布管理记录
*
* @param id 信息发布管理记录主键
* @return 信息发布管理记录
*/
public DcPublishManage selectDcPublishManageById(Long id);
/**
* 查询信息发布管理记录列表
*
* @param dcPublishManage 信息发布管理记录
* @return 信息发布管理记录集合
*/
List<DcPublishManage> selectDcPublishManageList(DcPublishManage dcPublishManage);
/**
* 新增信息发布管理记录
*
* @param dcPublishManage 信息发布管理记录
* @return 结果
*/
int insertDcPublishManage(DcPublishManage dcPublishManage);
/**
* 修改信息发布管理记录
*
* @param dcPublishManage 信息发布管理记录
* @return 结果
*/
int updateDcPublishManage(DcPublishManage dcPublishManage);
/**
* 删除信息发布管理记录
*
* @param id 信息发布管理记录主键
* @return 结果
*/
int deleteDcPublishManageById(Long id);
/**
* 批量删除信息发布管理记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteDcPublishManageByIds(Long[] ids);
//查询交通事件类型
public Integer selectEventType(@Param("eventId")String eventId);
//获取发布渠道信息
public DcPublishManage selectPublishManage(@Param("dataCategory")Integer dataCategory);
//查询信息发布列表
public List<HashMap<String,Object>> selectDcPublishManageListMap(DcPublishManage dcPublishManage);
}

63
zc-business/src/main/java/com/zc/business/mapper/DcPublishingChannelsMapper.java

@ -0,0 +1,63 @@
package com.zc.business.mapper;
import java.util.List;
import com.zc.business.domain.DcPublishingChannels;
/**
* 发布渠道Mapper接口
*
* @author ruoyi
* @date 2024-04-19
*/
public interface DcPublishingChannelsMapper
{
/**
* 查询发布渠道
*
* @param id 发布渠道主键
* @return 发布渠道
*/
public DcPublishingChannels selectDcPublishingChannelsById(Long id);
/**
* 查询发布渠道列表
*
* @param dcPublishingChannels 发布渠道
* @return 发布渠道集合
*/
List<DcPublishingChannels> selectDcPublishingChannelsList(DcPublishingChannels dcPublishingChannels);
/**
* 新增发布渠道
*
* @param dcPublishingChannels 发布渠道
* @return 结果
*/
int insertDcPublishingChannels(DcPublishingChannels dcPublishingChannels);
/**
* 修改发布渠道
*
* @param dcPublishingChannels 发布渠道
* @return 结果
*/
int updateDcPublishingChannels(DcPublishingChannels dcPublishingChannels);
/**
* 删除发布渠道
*
* @param id 发布渠道主键
* @return 结果
*/
int deleteDcPublishingChannelsById(Long id);
/**
* 批量删除发布渠道
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteDcPublishingChannelsByIds(Long[] ids);
//查询数据类型是否已经存在
public List<DcPublishingChannels> selectChannelsDataCategory(Integer dataCategory);
}

1
zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java

@ -115,6 +115,7 @@ public interface DcWarningMapper
//查询记录信息
public List<HashMap<String,Object>> selectDispatchResource(@Param("dispatchId")Long dispatchId);
//查询查询值班的全部人员
public List<HashMap<String,Object>> selectShiftsEmployeesToday();
public List<HashMap<String,Object>> selectShiftsEmployees();
//查询机构人员和调度关系
public List<HashMap<String,Object>> selectEmployeesDispatch(@Param("organizationId")Long organizationId,@Param("eventId") String eventId);

61
zc-business/src/main/java/com/zc/business/service/IDcPublishManageService.java

@ -0,0 +1,61 @@
package com.zc.business.service;
import java.util.List;
import com.zc.business.domain.DcPublishManage;
/**
* 信息发布管理记录Service接口
*
* @author ruoyi
* @date 2024-04-19
*/
public interface IDcPublishManageService
{
/**
* 查询信息发布管理记录
*
* @param id 信息发布管理记录主键
* @return 信息发布管理记录
*/
public DcPublishManage selectDcPublishManageById(Long id);
/**
* 查询信息发布管理记录列表
*
* @param dcPublishManage 信息发布管理记录
* @return 信息发布管理记录集合
*/
List<DcPublishManage> selectDcPublishManageList(DcPublishManage dcPublishManage);
/**
* 新增信息发布管理记录
*
* @param dcPublishManage 信息发布管理记录
* @return 结果
*/
int insertDcPublishManage(DcPublishManage dcPublishManage);
/**
* 修改信息发布管理记录
*
* @param dcPublishManage 信息发布管理记录
* @return 结果
*/
int updateDcPublishManage(DcPublishManage dcPublishManage);
/**
* 批量删除信息发布管理记录
*
* @param ids 需要删除的信息发布管理记录主键集合
* @return 结果
*/
int deleteDcPublishManageByIds(Long[] ids);
/**
* 删除信息发布管理记录信息
*
* @param id 信息发布管理记录主键
* @return 结果
*/
int deleteDcPublishManageById(Long id);
}

63
zc-business/src/main/java/com/zc/business/service/IDcPublishingChannelsService.java

@ -0,0 +1,63 @@
package com.zc.business.service;
import java.util.List;
import com.zc.business.domain.DcPublishingChannels;
/**
* 发布渠道Service接口
*
* @author ruoyi
* @date 2024-04-19
*/
public interface IDcPublishingChannelsService
{
/**
* 查询发布渠道
*
* @param id 发布渠道主键
* @return 发布渠道
*/
public DcPublishingChannels selectDcPublishingChannelsById(Long id);
/**
* 查询发布渠道列表
*
* @param dcPublishingChannels 发布渠道
* @return 发布渠道集合
*/
List<DcPublishingChannels> selectDcPublishingChannelsList(DcPublishingChannels dcPublishingChannels);
/**
* 新增发布渠道
*
* @param dcPublishingChannels 发布渠道
* @return 结果
*/
int insertDcPublishingChannels(DcPublishingChannels dcPublishingChannels);
/**
* 修改发布渠道
*
* @param dcPublishingChannels 发布渠道
* @return 结果
*/
int updateDcPublishingChannels(DcPublishingChannels dcPublishingChannels);
/**
* 批量删除发布渠道
*
* @param ids 需要删除的发布渠道主键集合
* @return 结果
*/
int deleteDcPublishingChannelsByIds(Long[] ids);
/**
* 删除发布渠道信息
*
* @param id 发布渠道主键
* @return 结果
*/
int deleteDcPublishingChannelsById(Long id);
//查询数据类型是否已经存在
public List<DcPublishingChannels> selectChannelsDataCategory(Integer dataCategory);
}

7
zc-business/src/main/java/com/zc/business/service/IMsmService.java

@ -2,6 +2,9 @@ package com.zc.business.service;
import com.alibaba.fastjson.JSONArray;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.http.converter.xml.AbstractJaxb2HttpMessageConverter;
import java.util.HashMap;
public interface IMsmService {
/**
@ -16,6 +19,8 @@ public interface IMsmService {
*
* @return
*/
JSONArray wenXinSend(String appId, String appSecret,String content);
JSONArray wenXinSend(String content);
//整合推送
public AjaxResult putAll(HashMap map);
}

107
zc-business/src/main/java/com/zc/business/service/impl/DcPublishManageServiceImpl.java

@ -0,0 +1,107 @@
package com.zc.business.service.impl;
import com.ruoyi.common.utils.DateUtils;
import com.zc.business.domain.DcPublishManage;
import com.zc.business.mapper.DcPublishManageMapper;
import com.zc.business.service.IDcPublishManageService;
import com.zc.business.utils.StakeMarkUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 信息发布管理记录Service业务层处理
*
* @author ruoyi
* @date 2024-04-19
*/
@Service
public class DcPublishManageServiceImpl implements IDcPublishManageService
{
@Autowired
private DcPublishManageMapper dcPublishManageMapper;
/**
* 查询信息发布管理记录
*
* @param id 信息发布管理记录主键
* @return 信息发布管理记录
*/
@Override
public DcPublishManage selectDcPublishManageById(Long id)
{
return dcPublishManageMapper.selectDcPublishManageById(id);
}
/**
* 查询信息发布管理记录列表
*
* @param dcPublishManage 信息发布管理记录
* @return 信息发布管理记录
*/
@Override
public List<DcPublishManage> selectDcPublishManageList(DcPublishManage dcPublishManage)
{
StakeMarkUtils stakeMarkUtils = new StakeMarkUtils();
if (StringUtils.isNotBlank(dcPublishManage.getStartStakeMarkValue())) {
Integer stakeMark = stakeMarkUtils.stakeMarkToInt(dcPublishManage.getStartStakeMarkValue());
dcPublishManage.setStartStakeMark(stakeMark);
}
if (StringUtils.isNotBlank(dcPublishManage.getEndStakeMarkValue())) {
Integer endMark = stakeMarkUtils.stakeMarkToInt(dcPublishManage.getEndStakeMarkValue());
dcPublishManage.setEndStakeMark(endMark);
}
return dcPublishManageMapper.selectDcPublishManageList(dcPublishManage);
}
/**
* 新增信息发布管理记录
*
* @param dcPublishManage 信息发布管理记录
* @return 结果
*/
@Override
public int insertDcPublishManage(DcPublishManage dcPublishManage)
{
dcPublishManage.setCreateTime(DateUtils.getNowDate());
return dcPublishManageMapper.insertDcPublishManage(dcPublishManage);
}
/**
* 修改信息发布管理记录
* @param dcPublishManage 信息发布管理记录
* @return 结果
*/
@Override
public int updateDcPublishManage(DcPublishManage dcPublishManage)
{
dcPublishManage.setUpdateTime(DateUtils.getNowDate());
return dcPublishManageMapper.updateDcPublishManage(dcPublishManage);
}
/**
* 批量删除信息发布管理记录
*
* @param ids 需要删除的信息发布管理记录主键
* @return 结果
*/
@Override
public int deleteDcPublishManageByIds(Long[] ids)
{
return dcPublishManageMapper.deleteDcPublishManageByIds(ids);
}
/**
* 删除信息发布管理记录信息
*
* @param id 信息发布管理记录主键
* @return 结果
*/
@Override
public int deleteDcPublishManageById(Long id)
{
return dcPublishManageMapper.deleteDcPublishManageById(id);
}
}

101
zc-business/src/main/java/com/zc/business/service/impl/DcPublishingChannelsServiceImpl.java

@ -0,0 +1,101 @@
package com.zc.business.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zc.business.mapper.DcPublishingChannelsMapper;
import com.zc.business.domain.DcPublishingChannels;
import com.zc.business.service.IDcPublishingChannelsService;
/**
* 发布渠道Service业务层处理
*
* @author ruoyi
* @date 2024-04-19
*/
@Service
public class DcPublishingChannelsServiceImpl implements IDcPublishingChannelsService
{
@Autowired
private DcPublishingChannelsMapper dcPublishingChannelsMapper;
/**
* 查询发布渠道
*
* @param id 发布渠道主键
* @return 发布渠道
*/
@Override
public DcPublishingChannels selectDcPublishingChannelsById(Long id)
{
return dcPublishingChannelsMapper.selectDcPublishingChannelsById(id);
}
/**
* 查询发布渠道列表
*
* @param dcPublishingChannels 发布渠道
* @return 发布渠道
*/
@Override
public List<DcPublishingChannels> selectDcPublishingChannelsList(DcPublishingChannels dcPublishingChannels)
{
return dcPublishingChannelsMapper.selectDcPublishingChannelsList(dcPublishingChannels);
}
/**
* 新增发布渠道
*
* @param dcPublishingChannels 发布渠道
* @return 结果
*/
@Override
public int insertDcPublishingChannels(DcPublishingChannels dcPublishingChannels)
{
dcPublishingChannels.setCreateTime(DateUtils.getNowDate());
return dcPublishingChannelsMapper.insertDcPublishingChannels(dcPublishingChannels);
}
/**
* 修改发布渠道
*
* @param dcPublishingChannels 发布渠道
* @return 结果
*/
@Override
public int updateDcPublishingChannels(DcPublishingChannels dcPublishingChannels)
{
dcPublishingChannels.setUpdateTime(DateUtils.getNowDate());
return dcPublishingChannelsMapper.updateDcPublishingChannels(dcPublishingChannels);
}
/**
* 批量删除发布渠道
*
* @param ids 需要删除的发布渠道主键
* @return 结果
*/
@Override
public int deleteDcPublishingChannelsByIds(Long[] ids)
{
return dcPublishingChannelsMapper.deleteDcPublishingChannelsByIds(ids);
}
/**
* 删除发布渠道信息
*
* @param id 发布渠道主键
* @return 结果
*/
@Override
public int deleteDcPublishingChannelsById(Long id)
{
return dcPublishingChannelsMapper.deleteDcPublishingChannelsById(id);
}
//查询数据类型是否已经存在
@Override
public List<DcPublishingChannels> selectChannelsDataCategory(Integer dataCategory) {
return dcPublishingChannelsMapper.selectChannelsDataCategory(dataCategory);
}
}

5
zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java

@ -509,7 +509,8 @@ public class DcWarningServiceImpl implements IDcWarningService
}
List<HashMap<String, Object>> sortedHashMaps = hashMaps.stream().sorted(Comparator.comparing(map -> {
return (Double) map.get("difference"); })).collect(Collectors.toList());
if (!sortedHashMaps.isEmpty()) {
HashMap<String, Object> hashMap = dcWarningMapper.selectDcDispatch(dcWarning.getId());//查询事件是否已经有转的调度记录
if (!sortedHashMaps.isEmpty()&&hashMap==null) {
HashMap<String, Object> map = sortedHashMaps.get(0);
Long id = (Long) map.get("id");//取出最近的机构id
if (id != null) {
@ -675,7 +676,7 @@ public class DcWarningServiceImpl implements IDcWarningService
HashMap<Object, Object> hashMap = new HashMap<>();
Long id = (Long) map.get("id");//调度记录id
Object deptName =map.get("deptName");//部门名称
List<HashMap<String, Object>> shifts = dcWarningMapper.selectShiftsEmployees();//值班为空把全部的人员信息作为值班人员信息
List<HashMap<String, Object>> shifts = dcWarningMapper.selectShiftsEmployees();//值班为空把全部的人员信息作为值班人员信息
List<HashMap<String, Object>> resource = dcWarningMapper.selectDispatchResource(id);//全部资源信息
List<HashMap<String, Object>> employeesChoice = dcWarningMapper.selectEmployeesChoice(id);//选中人员信息
List<HashMap<String, Object>> vehiclesChoice = dcWarningMapper.selectVehiclesChoice(id);//选中车辆信息

107
zc-business/src/main/java/com/zc/business/service/impl/MsmServiceImpl.java

@ -7,17 +7,26 @@ import com.aliyuncs.IAcsClient;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.profile.DefaultProfile;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.zc.business.domain.DcEventProcess;
import com.zc.business.domain.DcPublishManage;
import com.zc.business.mapper.DcPublishManageMapper;
import com.zc.business.service.IMsmService;
import com.zc.business.utils.HttpUtil;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
@ -32,7 +41,16 @@ import java.util.concurrent.TimeUnit;
@Service
public class MsmServiceImpl implements IMsmService {
private static final String WEIXINTUISONTOKEN = "weixintuisontoken";//redis策略缓存的key
private static final String ALIYUNACCESSKEYID="LTAI5tENd3j1tP5t2fF4fxaX";//阿里短信accessKeyId
private static final String ALIYUNAECRET="i86Yenj13XRd2aeZMtybpKxsqI1VRU";//阿里云密钥
private static final String ALIYUNTEMPLATE="SMS_154950909";//阿里云短信模板
private static final String WEIXINAPPID="wx9ee0e3babfd8d2af";//微信公众号appid
private static final String WEIXINAPPSECRET="de2ecb80b30d63135918ba3ae6ffb711";//微信公众号APPSECRET
private static final String WEIXINTEMPLATE="D_yBiN7aDl2pw3bhSqU_Fbi0D8BHXL0qeBjhusWVO68";//微信公众号推送模板id
@Autowired
private DcEventProcessServiceImpl dcEventProcessService;
@Autowired
private DcPublishManageMapper dcPublishManageMapper;
/**
* 发送短信
*
@ -42,13 +60,13 @@ public class MsmServiceImpl implements IMsmService {
public boolean send(String phone) {
//地域节点、阿里云的id、秘钥
DefaultProfile profile = DefaultProfile.getProfile("cn-qingdao",
"LTAI5tENd3j1tP5t2fF4fxaX", "i86Yenj13XRd2aeZMtybpKxsqI1VRU");
ALIYUNACCESSKEYID, ALIYUNAECRET);
IAcsClient client = new DefaultAcsClient(profile);
SendSmsRequest request = new SendSmsRequest();
request.setSysRegionId("cn-qingdao");//地域节点
request.putQueryParameter("PhoneNumbers", phone); //手机号,要填绑定测试的手机号码
request.putQueryParameter("SignName", "阿里云短信测试"); //阿里云签名名称
request.putQueryParameter("TemplateCode", "SMS_154950909"); //阿里云模板code
request.putQueryParameter("TemplateCode", ALIYUNTEMPLATE); //阿里云模板code
String code = String.format("%04d", new Random().nextInt(10000));//验证码
HashMap<Object, Object> map = new HashMap<>();
map.put("code", code); //参数加入到map
@ -56,7 +74,7 @@ public class MsmServiceImpl implements IMsmService {
request.putQueryParameter("TemplateParam", json);
try {
SendSmsResponse response = client.getAcsResponse(request);
if (response != null && response.getCode() != null && response.getCode().equals("OK")) {
if (response != null && response.getCode() != null && response.getCode().equalsIgnoreCase("OK")) {
return true;
}
return false;
@ -74,11 +92,13 @@ public class MsmServiceImpl implements IMsmService {
// }
//微信推送
@Override
public JSONArray wenXinSend(String appId, String appSecret,String content) {
public JSONArray wenXinSend(String content) {
MsmServiceImpl msmService = new MsmServiceImpl();
return msmService.sendTemp(appId, appSecret,content);
return msmService.sendTemp(WEIXINAPPID, WEIXINAPPSECRET,content);
}
//获取微信token
public static com.alibaba.fastjson.JSONObject getAccessToken(String appId, String appSecret) {
String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appId + "&secret=" + appSecret;
@ -112,8 +132,9 @@ public class MsmServiceImpl implements IMsmService {
RedisCache redisCache = SpringUtils.getBean(RedisCache.class);
String accessToken = redisCache.getCacheObject(WEIXINTUISONTOKEN);
if (StringUtils.isBlank(accessToken)) {
accessToken = msmService.getAccessToken(appId, appSecret).getString("access_token");//获取到了access_token
String expiresIn = msmService.getAccessToken(appId, appSecret).getString("expires_in");//token有效秒数
com.alibaba.fastjson.JSONObject jsonObject = msmService.getAccessToken(appId, appSecret);
accessToken = jsonObject.getString("access_token");//获取到了access_token
String expiresIn = jsonObject.getString("expires_in");//token有效秒数
redisCache.setCacheObject(WEIXINTUISONTOKEN, accessToken, Integer.parseInt(expiresIn), TimeUnit.SECONDS);//把token存入到redis中,并设置过期时间(时间来自于微信接口返回)
}
JSONArray userListOpenid = msmService.getUserListOpenid(accessToken);
@ -123,7 +144,7 @@ public class MsmServiceImpl implements IMsmService {
executor.execute(() -> {
// 封装要发送的json
Map<String, Object> map = new HashMap();
map.put("template_id", "D_yBiN7aDl2pw3bhSqU_Fbi0D8BHXL0qeBjhusWVO68");//模板消息id
map.put("template_id", WEIXINTEMPLATE);//模板消息id
map.put("touser", openid.toString());//这里的openid是全部关注公众号的openid
// 封装data
com.alibaba.fastjson.JSONObject data = new com.alibaba.fastjson.JSONObject();
@ -170,7 +191,6 @@ public class MsmServiceImpl implements IMsmService {
//获取微信公众号全部关注人的openid
public static JSONArray getUserListOpenid(String accessToken) {
String url = "https://api.weixin.qq.com/cgi-bin/user/get?access_token=" + accessToken;
;
com.alibaba.fastjson.JSONObject jsonObj = null;
try {
URL urlGet = new URL(url);
@ -191,4 +211,71 @@ public class MsmServiceImpl implements IMsmService {
com.alibaba.fastjson.JSONObject data = jsonObj.getJSONObject("data");
return data.getJSONArray("openid");
}
//整合推送
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult putAll(HashMap map) {
MsmServiceImpl msmService = new MsmServiceImpl();
DcPublishManage dcPublishManage = new DcPublishManage();
String eventId = map.get("eventId").toString();//事件id
String content = map.get("content").toString();//信息内容
Integer eventType = dcPublishManageMapper.selectEventType(eventId);//事件类型
DcPublishManage publishManage = dcPublishManageMapper.selectPublishManage(eventType);//渠道信息
if (publishManage!=null){
dcPublishManage.setPublishChannelsId(publishManage.getId());//渠道id
}
dcPublishManage.setEventId(eventId);//事件id
dcPublishManage.setPublisher(SecurityUtils.getUsername());//发布人
dcPublishManage.setPublishTime(DateUtils.getNowDate());//发布时间
dcPublishManage.setCreateTime(DateUtils.getNowDate());//创建时间
dcPublishManage.setContentDetails(map.get("content").toString());
ArrayList<String> array = (ArrayList<String>) map.get("type");
Boolean send = null;
Integer data = null;
String weiXin = "微信推送失败"; // 初始化为成功状态
String message = "短信推送失败"; // 初始化为失败状态
for (String type : array) {
if ("1".equals(type)) { //短信
if (map == null || StringUtils.isBlank(map.get("phone").toString())) {
return AjaxResult.error("手机号为空");
}
String string = map.get("phone").toString();
send = msmService.send(string);
if (send == true) {
message = "短信推送成功"; // 如果 send 为 true,则短信推送成功
dcPublishManage.setPublishStatus(1);//发布成功
}else {
dcPublishManage.setPublishStatus(2);//发布失败
}
dcPublishManage.setPublishChannels(1);//发布渠道类型:短信
dcPublishManageMapper.insertDcPublishManage(dcPublishManage);//加入推送记录
continue;
}
if ("2".equals(type)) { //微信
JSONArray objects = msmService.wenXinSend(content);
data = (Integer) objects.get(0);
if (data == 0) {
weiXin = "微信推送成功"; // 如果所有 dateValue 都为0,则微信推送成功
dcPublishManage.setPublishStatus(1);//发布成功
}else {
dcPublishManage.setPublishStatus(2);//发布失败
}
dcPublishManage.setPublishChannels(2);//发布渠道类型:微信公众号
dcPublishManageMapper.insertDcPublishManage(dcPublishManage);//加入推送记录
continue;
}
}
DcEventProcess dcEventProcess = new DcEventProcess();
dcEventProcess.setEventId(eventId);
dcEventProcess.setSource(1);
dcEventProcess.setProcessType(2);
String context = "出行信息发布:" + content;
dcEventProcess.setContext(context);
dcEventProcessService.insertDcEventProcess(dcEventProcess);
if ("短信推送成功".equals(message) && "微信推送成功".equals(weiXin)) {
return AjaxResult.success(message + "," + weiXin);
} else {
return AjaxResult.error(message + "," + weiXin);
}
}
}

174
zc-business/src/main/resources/mapper/business/DcPublishManageMapper.xml

@ -0,0 +1,174 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zc.business.mapper.DcPublishManageMapper">
<resultMap type="DcPublishManage" id="DcPublishManageResult">
<result property="id" column="id" />
<result property="eventId" column="event_id" />
<result property="deptId" column="dept_id" />
<result property="publishChannelsId" column="publish_channels_id" />
<result property="title" column="title" />
<result property="publishChannels" column="publish_channels" />
<result property="isverify" column="isverify" />
<result property="publisher" column="publisher" />
<result property="auditor1" column="auditor_1" />
<result property="auditor2" column="auditor_2" />
<result property="auditTime1" column="audit_time_1" />
<result property="auditTime2" column="audit_time_2" />
<result property="auditComment1" column="audit_comment_1" />
<result property="auditComment2" column="audit_comment_2" />
<result property="publishTime" column="publish_time" />
<result property="publishStatus" column="publish_status" />
<result property="contentDetails" column="content_details" />
<result property="remark" column="remark" />
<result property="updateTime" column="update_time" />
<result property="createTime" column="create_time" />
<result property="direction" column="direction" />
<result property="stakeMark" column="stake_mark" />
<result property="eventType" column="event_type" />
<result property="eventSubclass" column="event_subclass" />
<result property="eventTime" column="eventTime" />
<result property="facilityName" column="facility_name" />
<result property="eventState" column="event_state" />
</resultMap>
<sql id="selectDcPublishManageVo">
select facility.facility_name,
manage.id, manage.event_id, manage.publish_channels_id,
manage.title, manage.publish_channels , manage.publisher,
manage.publish_time, manage.create_time,
manage.publish_status, manage.content_details, manage.remark,
event.create_time eventTime,event.direction,event.stake_mark,
event.event_type,event.event_subclass,event.event_state
from dc_publish_manage as manage
LEFT JOIN dc_event as event on event.id=manage.event_id
LEFT JOIN dc_event_traffic_control as traffic on event.id=traffic.id
LEFT JOIN dc_facility as facility ON traffic.facility_id=facility.id
</sql>
<select id="selectDcPublishManageList" parameterType="DcPublishManage" resultMap="DcPublishManageResult">
<include refid="selectDcPublishManageVo"/>
<where>
<if test="eventState != null"> and event.event_state = #{eventState}</if>
<if test="eventType != null and eventType != ''"> and event.event_type = #{eventType}</if>
<if test="publishStatus != null and publishStatus != '' "> and manage.publish_status = #{publishStatus}</if>
<if test="startTime != null and endTime != null ">
and manage.create_time between #{startTime} and #{endTime}
</if>
<if test="startStakeMark != null and startStakeMark != ''">
and CAST(SUBSTRING(SUBSTRING_INDEX(event.stake_mark,'+',1),2)AS UNSIGNED)*1000
+CAST(SUBSTRING_INDEX(event.stake_mark, '+', -1) AS UNSIGNED)&gt;=#{startStakeMark}
</if>
<if test=" endStakeMark != null and endStakeMark != '' ">
and CAST(SUBSTRING(SUBSTRING_INDEX(event.stake_mark,'+',1),2)AS UNSIGNED)*1000
+CAST(SUBSTRING_INDEX(event.stake_mark, '+', -1) AS UNSIGNED)&lt;=#{endStakeMark}
</if>
</where>
</select>
<select id="selectDcPublishManageById" parameterType="Long" resultMap="DcPublishManageResult">
<include refid="selectDcPublishManageVo"/>
where id = #{id}
</select>
<select id="selectEventType" resultType="java.lang.Integer">
select event_type from dc_event where id=#{eventId}
</select>
<select id="selectPublishManage" resultType="com.zc.business.domain.DcPublishManage">
select id,publish_channels from dc_publishing_channels where enabled=2 and data_category=#{dataCategory}
</select>
<select id="selectDcPublishManageListMap" resultType="java.util.HashMap">
select
event.occurrence_time,event.direction,event.event_type,event.stake_mark,
manage.id, manage.event_id, manage.publish_channels_id,
manage.title, manage.publish_channels, manage.publisher,
manage.publish_time, manage.publish_status, manage.content_details, manage.remark,
manage.update_time, manage.create_time from dc_publish_manage as manage
LEFT JOIN dc_event as event on manage.event_id=event.id
</select>
<insert id="insertDcPublishManage" parameterType="DcPublishManage" useGeneratedKeys="true" keyProperty="id">
insert into dc_publish_manage
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="eventId != null and eventId != ''">event_id,</if>
<if test="deptId != null">dept_id,</if>
<if test="publishChannelsId != null">publish_channels_id,</if>
<if test="title != null">title,</if>
<if test="publishChannels != null">publish_channels,</if>
<if test="isverify != null">isverify,</if>
<if test="publisher != null and publisher != ''">publisher,</if>
<if test="auditor1 != null">auditor_1,</if>
<if test="auditor2 != null">auditor_2,</if>
<if test="auditTime1 != null">audit_time_1,</if>
<if test="auditTime2 != null">audit_time_2,</if>
<if test="auditComment1 != null">audit_comment_1,</if>
<if test="auditComment2 != null">audit_comment_2,</if>
<if test="publishTime != null">publish_time,</if>
<if test="publishStatus != null">publish_status,</if>
<if test="contentDetails != null">content_details,</if>
<if test="remark != null">remark,</if>
<if test="updateTime != null">update_time,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="eventId != null and eventId != ''">#{eventId},</if>
<if test="deptId != null">#{deptId},</if>
<if test="publishChannelsId != null">#{publishChannelsId},</if>
<if test="title != null">#{title},</if>
<if test="publishChannels != null">#{publishChannels},</if>
<if test="isverify != null">#{isverify},</if>
<if test="publisher != null and publisher != ''">#{publisher},</if>
<if test="auditor1 != null">#{auditor1},</if>
<if test="auditor2 != null">#{auditor2},</if>
<if test="auditTime1 != null">#{auditTime1},</if>
<if test="auditTime2 != null">#{auditTime2},</if>
<if test="auditComment1 != null">#{auditComment1},</if>
<if test="auditComment2 != null">#{auditComment2},</if>
<if test="publishTime != null">#{publishTime},</if>
<if test="publishStatus != null">#{publishStatus},</if>
<if test="contentDetails != null">#{contentDetails},</if>
<if test="remark != null">#{remark},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateDcPublishManage" parameterType="DcPublishManage">
update dc_publish_manage
<trim prefix="SET" suffixOverrides=",">
<if test="eventId != null and eventId != ''">event_id = #{eventId},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="publishChannelsId != null">publish_channels_id = #{publishChannelsId},</if>
<if test="title != null">title = #{title},</if>
<if test="publishChannels != null">publish_channels = #{publishChannels},</if>
<if test="isverify != null">isverify = #{isverify},</if>
<if test="publisher != null and publisher != ''">publisher = #{publisher},</if>
<if test="auditor1 != null">auditor_1 = #{auditor1},</if>
<if test="auditor2 != null">auditor_2 = #{auditor2},</if>
<if test="auditTime1 != null">audit_time_1 = #{auditTime1},</if>
<if test="auditTime2 != null">audit_time_2 = #{auditTime2},</if>
<if test="auditComment1 != null">audit_comment_1 = #{auditComment1},</if>
<if test="auditComment2 != null">audit_comment_2 = #{auditComment2},</if>
<if test="publishTime != null">publish_time = #{publishTime},</if>
<if test="publishStatus != null">publish_status = #{publishStatus},</if>
<if test="contentDetails != null">content_details = #{contentDetails},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDcPublishManageById" parameterType="Long">
delete from dc_publish_manage where id = #{id}
</delete>
<delete id="deleteDcPublishManageByIds" parameterType="String">
delete from dc_publish_manage where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

92
zc-business/src/main/resources/mapper/business/DcPublishingChannelsMapper.xml

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zc.business.mapper.DcPublishingChannelsMapper">
<resultMap type="DcPublishingChannels" id="DcPublishingChannelsResult">
<result property="id" column="id" />
<result property="dataCategory" column="data_category" />
<result property="infoLevel" column="info_level" />
<result property="enabled" column="enabled" />
<result property="auditMethod" column="audit_method" />
<result property="publishChannels" column="publish_channels" />
<result property="enableDate" column="enable_date" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDcPublishingChannelsVo">
select id, data_category, info_level, enabled, audit_method, publish_channels, enable_date, create_time, update_time from dc_publishing_channels
</sql>
<select id="selectDcPublishingChannelsList" parameterType="DcPublishingChannels" resultMap="DcPublishingChannelsResult">
<include refid="selectDcPublishingChannelsVo"/>
<where>
<if test="dataCategory != null "> and data_category = #{dataCategory}</if>
<if test="infoLevel != null "> and info_level = #{infoLevel}</if>
<if test="enabled != null "> and enabled = #{enabled}</if>
<if test="auditMethod != null "> and audit_method = #{auditMethod}</if>
<if test="publishChannels != null and publishChannels != ''"> and publish_channels = #{publishChannels}</if>
</where>
</select>
<select id="selectDcPublishingChannelsById" parameterType="Long" resultMap="DcPublishingChannelsResult">
<include refid="selectDcPublishingChannelsVo"/>
where id = #{id}
</select>
<insert id="insertDcPublishingChannels" parameterType="DcPublishingChannels" useGeneratedKeys="true" keyProperty="id">
insert into dc_publishing_channels
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dataCategory != null">data_category,</if>
<if test="infoLevel != null">info_level,</if>
<if test="enabled != null">enabled,</if>
<if test="auditMethod != null">audit_method,</if>
<if test="publishChannels != null and publishChannels != ''">publish_channels,</if>
<if test="enableDate != null">enable_date,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dataCategory != null">#{dataCategory},</if>
<if test="infoLevel != null">#{infoLevel},</if>
<if test="enabled != null">#{enabled},</if>
<if test="auditMethod != null">#{auditMethod},</if>
<if test="publishChannels != null and publishChannels != ''">#{publishChannels},</if>
<if test="enableDate != null">#{enableDate},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateDcPublishingChannels" parameterType="DcPublishingChannels">
update dc_publishing_channels
<trim prefix="SET" suffixOverrides=",">
<if test="dataCategory != null">data_category = #{dataCategory},</if>
<if test="infoLevel != null">info_level = #{infoLevel},</if>
<if test="enabled != null">enabled = #{enabled},</if>
<if test="auditMethod != null">audit_method = #{auditMethod},</if>
<if test="publishChannels != null and publishChannels != ''">publish_channels = #{publishChannels},</if>
<if test="enableDate != null">enable_date = #{enableDate},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDcPublishingChannelsById" parameterType="Long">
delete from dc_publishing_channels where id = #{id}
</delete>
<delete id="deleteDcPublishingChannelsByIds" parameterType="String">
delete from dc_publishing_channels where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectChannelsDataCategory" resultType="com.zc.business.domain.DcPublishingChannels">
select id from dc_publishing_channels where data_category=#{dataCategory}
</select>
</mapper>

18
zc-business/src/main/resources/mapper/business/DcWarningMapper.xml

@ -316,7 +316,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where event_id=#{eventId}
</select>
<select id="selectDispatchResource" resultType="java.util.HashMap">
SELECT
SELECT DISTINCT
dc_dispatch_resource.resource_id resourceId,
dc_dispatch_resource.dispatch_type dispatchType,
CASE
@ -336,12 +336,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where dc_dispatch_resource.dispatch_id=#{dispatchId}
</select>
<select id="selectShiftsEmployeesToday" resultType="java.util.HashMap">
select DISTINCT employees.name shiftsName,employees.contact_number shiftsNumber from dc_shifts as shifts
left join dc_employees as employees on shifts.employees_id=employees.id
where DATE(date) = CURDATE();
</select>
<select id="selectShiftsEmployees" resultType="java.util.HashMap">
select shifts.name shiftsName,shifts.contact_number shiftsNumber
from dc_employees as shifts
</select>
<select id="selectEmployeesDispatch" resultType="java.util.HashMap">
SELECT dc_employees.id,
SELECT DISTINCT dc_employees.id,
dc_employees.name,
dc_employees.contact_number AS contactNumber,
CASE
@ -362,7 +367,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and employees_type = 2
</select>
<select id="selectVehiclesDispatch" resultType="java.util.HashMap">
select dc_vehicles.id,
select DISTINCT dc_vehicles.id,
dc_vehicles.vehicle_type vehicleType,
dc_vehicles.vehicle_plate vehiclePlate,
CASE
@ -386,14 +391,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id from dc_organization where parent_id=0;
</select>
<select id="selectEmployeesChoice" resultType="java.util.HashMap">
select employees.id,employees.`name` from dc_dispatch_resource as resource
select DISTINCT employees.id,employees.`name` from dc_dispatch_resource as resource
LEFT JOIN dc_employees as employees on resource.resource_id=employees.id
WHERE resource.dispatch_id=#{dispatchId} and resource.dispatch_type=1
</select>
<select id="selectVehiclesChoice" resultType="java.util.HashMap">
select vehicle.id,vehicle.vehicle_type vehicleType,vehicle.vehicle_plate vehiclePlate from dc_dispatch_resource as resource
select DISTINCT vehicle.id,vehicle.vehicle_type vehicleType,vehicle.vehicle_plate vehiclePlate from dc_dispatch_resource as resource
LEFT JOIN dc_vehicles as vehicle on resource.resource_id=vehicle.id
WHERE resource.dispatch_id=1 and resource.dispatch_type=2
WHERE resource.dispatch_id=#{dispatchId} and resource.dispatch_type=2
</select>
</mapper>

Loading…
Cancel
Save