Browse Source

Merge remote-tracking branch 'origin/develop' into develop

develop
wangsixiang 3 weeks ago
parent
commit
fd06d39425
  1. 9
      zc-business/src/main/java/com/zc/business/controller/DcEmployeesController.java
  2. 33
      zc-business/src/main/java/com/zc/business/controller/DcExternalPlatformHeartbeatController.java
  3. 4
      zc-business/src/main/java/com/zc/business/mapper/DcEmployeesMapper.java
  4. 3
      zc-business/src/main/java/com/zc/business/service/IDcEmployeesService.java
  5. 23
      zc-business/src/main/java/com/zc/business/service/impl/DcEmployeesServiceImpl.java
  6. 31
      zc-business/src/main/java/com/zc/business/service/impl/MsmServiceImpl.java
  7. 6
      zc-business/src/main/resources/mapper/business/DcEmployeesMapper.xml

9
zc-business/src/main/java/com/zc/business/controller/DcEmployeesController.java

@ -11,11 +11,13 @@ import com.zc.business.enums.UniversalEnum;
import com.zc.business.service.IDcEmployeesService; import com.zc.business.service.IDcEmployeesService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 值班人员信息Controller * 值班人员信息Controller
@ -155,4 +157,11 @@ public class DcEmployeesController extends BaseController
public AjaxResult personnelPositions(){ public AjaxResult personnelPositions(){
return toAjax(dcEmployeesService.personnelPositions()); return toAjax(dcEmployeesService.personnelPositions());
} }
@ApiOperation("获取应急机构下的所有人员")
@GetMapping("/getAllEmployees")
public List<Map<String,Object>> getAllEmployees(@ApiParam(value = "桩号", name = "stakeMark", required = true) String stakeMark)
{
return dcEmployeesService.getAllEmployees(stakeMark);
}
} }

33
zc-business/src/main/java/com/zc/business/controller/DcExternalPlatformHeartbeatController.java

@ -1,12 +1,22 @@
package com.zc.business.controller; package com.zc.business.controller;
import java.io.IOException;
import java.util.Date;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.ip.IpUtils; import com.ruoyi.common.utils.ip.IpUtils;
import com.zc.business.domain.DcExternalPlatformHeartbeat; import com.zc.business.domain.DcExternalPlatformHeartbeat;
import com.zc.business.enums.UniversalEnum;
import com.zc.business.service.IDcExternalPlatformHeartbeatService; import com.zc.business.service.IDcExternalPlatformHeartbeatService;
import com.zc.common.core.httpclient.OkHttp;
import com.zc.common.core.httpclient.exception.HttpException;
import okhttp3.Response;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -95,4 +105,27 @@ public class DcExternalPlatformHeartbeatController extends BaseController
{ {
return toAjax(dcExternalPlatformHeartbeatService.deleteDcExternalPlatformHeartbeatByIds(ids)); return toAjax(dcExternalPlatformHeartbeatService.deleteDcExternalPlatformHeartbeatByIds(ids));
} }
/**
* 桥梁监测心跳
*/
@Scheduled(cron = "0 */5 * * * ?")
public void bridgeMonitoringHeartbeat() throws HttpException, IOException {
OkHttp okHttp = new OkHttp();
Response response // 请求响应
= okHttp
.url("http://iot.sdhscloud.com/web/healthz") // 请求地址
.get(); // 请求方法
if (response.body() != null) {
String result = response.body().string();
if (StringUtils.isNotEmpty(result) && result.equals("ok")){
DcExternalPlatformHeartbeat dcExternalPlatformHeartbeat = new DcExternalPlatformHeartbeat();
dcExternalPlatformHeartbeat.setType("4");
dcExternalPlatformHeartbeat.setCreateTime(new Date());
dcExternalPlatformHeartbeat.setIp(IpUtils.getHostIp());
dcExternalPlatformHeartbeatService.insertDcExternalPlatformHeartbeat(dcExternalPlatformHeartbeat);
}
}
}
} }

4
zc-business/src/main/java/com/zc/business/mapper/DcEmployeesMapper.java

@ -79,4 +79,8 @@ public interface DcEmployeesMapper
public Integer updateJobInformation(@Param("employeesId")Long employeesId,@Param("station")Long station); public Integer updateJobInformation(@Param("employeesId")Long employeesId,@Param("station")Long station);
List<DcEmployees> selectEmployeesByIds(Long[] ids); List<DcEmployees> selectEmployeesByIds(Long[] ids);
List<Map<String, Object>> selectAllOrganization();
List<Map<String, Object>> selectOrganizationEmployees(@Param("organizationId") String organizationId);
} }

3
zc-business/src/main/java/com/zc/business/service/IDcEmployeesService.java

@ -71,4 +71,7 @@ public interface IDcEmployeesService
public List<HashMap<String,Object>> selectEmployeesPostAll(); public List<HashMap<String,Object>> selectEmployeesPostAll();
//定时任务,获取值班信息定义人员归属岗位 //定时任务,获取值班信息定义人员归属岗位
public int personnelPositions(); public int personnelPositions();
//获取应急机构下所有人员
List<Map<String,Object>> getAllEmployees(String stakeMark);
} }

23
zc-business/src/main/java/com/zc/business/service/impl/DcEmployeesServiceImpl.java

@ -1,6 +1,7 @@
package com.zc.business.service.impl; package com.zc.business.service.impl;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StakeMarkUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.zc.business.domain.DcEmployees; import com.zc.business.domain.DcEmployees;
import com.zc.business.enums.UniversalEnum; import com.zc.business.enums.UniversalEnum;
@ -160,4 +161,26 @@ public class DcEmployeesServiceImpl implements IDcEmployeesService {
} }
return UniversalEnum.ONE.getNumber(); return UniversalEnum.ONE.getNumber();
} }
//获取应急机构下所有人员
@Override
public List<Map<String,Object>> getAllEmployees(String stakeMark){
Long stakeMarkNum = StakeMarkUtils.formatMetreLong(stakeMark);
List<Map<String,Object>> organizationList = dcEmployeesMapper.selectAllOrganization();
if (organizationList != null){
for (Map<String, Object> organization : organizationList) {
if (StringUtils.isEmpty(organization.get("stakeMark").toString())){
continue;
}
Long num = StakeMarkUtils.formatMetreLong(organization.get("stakeMark").toString());
Long difference = Math.abs(stakeMarkNum - num);
organization.put("difference", difference / 1000);
List<Map<String,Object>> employeesList = dcEmployeesMapper.selectOrganizationEmployees(organization.get("id").toString());
organization.put("employeesList",employeesList);
}
}
return organizationList;
}
} }

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

@ -12,12 +12,15 @@ import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.common.utils.spring.SpringUtils;
import com.zc.business.domain.DcEmployees;
import com.zc.business.domain.DcEventProcess; import com.zc.business.domain.DcEventProcess;
import com.zc.business.domain.DcPublishManage; import com.zc.business.domain.DcPublishManage;
import com.zc.business.enums.UniversalEnum; import com.zc.business.enums.UniversalEnum;
import com.zc.business.mapper.DcEmployeesMapper;
import com.zc.business.mapper.DcPublishManageMapper; import com.zc.business.mapper.DcPublishManageMapper;
import com.zc.business.service.IMsmService; import com.zc.business.service.IMsmService;
import com.zc.business.utils.HttpUtil; import com.zc.business.utils.HttpUtil;
import com.zc.business.utils.QYWXUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject; import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -27,9 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.io.InputStream; import java.io.InputStream;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.util.HashMap; import java.util.*;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
@ -51,6 +52,10 @@ public class MsmServiceImpl implements IMsmService {
private DcEventProcessServiceImpl dcEventProcessService; private DcEventProcessServiceImpl dcEventProcessService;
@Autowired @Autowired
private DcPublishManageMapper dcPublishManageMapper; private DcPublishManageMapper dcPublishManageMapper;
@Autowired
private DcEmployeesMapper employeesMapper;
@Autowired
private QYWXUtil qywxUtil;
/** /**
* 发送短信 * 发送短信
* *
@ -280,6 +285,26 @@ public class MsmServiceImpl implements IMsmService {
// continue; // continue;
// } // }
// } // }
//企业微信推送
List<Integer> employees = (List<Integer>) map.get("employees");
Long[] ids = employees.stream().mapToLong(Integer::longValue).boxed().toArray(Long[]::new);
List<DcEmployees> employeesList = employeesMapper.selectEmployeesByIds(ids);
List<String> wxUserIds = new ArrayList<>();
for (DcEmployees dcEmployees : employeesList) {
if (StringUtils.isNotBlank(dcEmployees.getWxUserId())){
wxUserIds.add(dcEmployees.getWxUserId());
} else {
String wxUserId = qywxUtil.getUserIdByMobile(dcEmployees.getContactNumber());
if (StringUtils.isNotBlank(wxUserId)){
dcEmployees.setWxUserId(wxUserId);
employeesMapper.updateDcEmployees(dcEmployees);
wxUserIds.add(wxUserId);
}
}
}
qywxUtil.sendMessageByWxUserId(wxUserIds,content);
DcEventProcess dcEventProcess = new DcEventProcess(); DcEventProcess dcEventProcess = new DcEventProcess();
dcEventProcess.setEventId(eventId); dcEventProcess.setEventId(eventId);
dcEventProcess.setSource(UniversalEnum.ONE.getNumber()); dcEventProcess.setSource(UniversalEnum.ONE.getNumber());

6
zc-business/src/main/resources/mapper/business/DcEmployeesMapper.xml

@ -130,6 +130,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</select> </select>
<select id="selectAllOrganization" resultType="java.util.Map">
select id,organization_name organizationName,stake_mark stakeMark from dc_organization
</select>
<select id="selectOrganizationEmployees" resultType="java.util.Map">
select id,name from dc_employees where organization_id = #{organizationId}
</select>
<update id="updateJobInformation"> <update id="updateJobInformation">
update dc_employees set organization_id=#{station} where employees_id=#{employeesId} update dc_employees set organization_id=#{station} where employees_id=#{employeesId}
</update> </update>

Loading…
Cancel
Save