Commit abdf4264 authored by kongfm's avatar kongfm

地图派遣人员推送

parent f04e98b3
package com.yeejoin.amos.boot.module.tzs.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 维保人员DTO
*/
@Data
@ApiModel(value="MainPersonDto", description="维保人员DTO")
public class MainPersonDto {
@ApiModelProperty(value = "维保人员名称")
private String name;
@ApiModelProperty(value = "维保人员电话")
private String telephone;
@ApiModelProperty(value = "维保单位id")
private String orgId;
@ApiModelProperty(value = "警情id")
private String alertId;
@ApiModelProperty(value = "维保单位名称")
private String orgName;
@ApiModelProperty(value = "维保单位地址")
private String orgAddress;
@ApiModelProperty(value = "使用单位地址")
private String unitAddress;
}
package com.yeejoin.amos.boot.module.tzs.api.mapper; package com.yeejoin.amos.boot.module.tzs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.tzs.api.dto.MainPersonDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskDto; import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskListDto; import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskListDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchTask; import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchTask;
...@@ -22,4 +23,6 @@ public interface DispatchTaskMapper extends BaseMapper<DispatchTask> { ...@@ -22,4 +23,6 @@ public interface DispatchTaskMapper extends BaseMapper<DispatchTask> {
WechatMyTaskDto getTaskInfoByTaskId(@Param("taskId") Long taskId); WechatMyTaskDto getTaskInfoByTaskId(@Param("taskId") Long taskId);
List<WechatMyTaskListDto> getTaskListByPhonePager(@Param("phone") String phone,@Param("typeCode") String typeCode, @Param("current") Long current); List<WechatMyTaskListDto> getTaskListByPhonePager(@Param("phone") String phone,@Param("typeCode") String typeCode, @Param("current") Long current);
List<MainPersonDto> todayTaskPerson();
} }
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tzs.api.service; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tzs.api.service;
import com.yeejoin.amos.boot.module.tzs.api.dto.DispatchTaskDto; import com.yeejoin.amos.boot.module.tzs.api.dto.DispatchTaskDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.MainPersonDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatDispatchFeedbackDto; import com.yeejoin.amos.boot.module.tzs.api.dto.WechatDispatchFeedbackDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMessageDto; import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMessageDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskDto; import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskDto;
...@@ -42,4 +43,8 @@ public interface IDispatchTaskService { ...@@ -42,4 +43,8 @@ public interface IDispatchTaskService {
* @return * @return
*/ */
WechatMessageDto getWechatMessageDtoByDispatchTaskDto(DispatchTaskDto dispatchTaskDto); WechatMessageDto getWechatMessageDtoByDispatchTaskDto(DispatchTaskDto dispatchTaskDto);
List<MainPersonDto> todayTaskPerson();
} }
...@@ -86,5 +86,20 @@ ...@@ -86,5 +86,20 @@
limit #{current},5 limit #{current},5
</select> </select>
<select id="todayTaskPerson" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.MainPersonDto">
select
t.response_user_name as name,
t.response_user_tel as telephone,
t.response_org_id as orgId,
t.response_org_name as orgName,
t.alert_id as alertId,
m.address as orgAddress,
u.address as unitAddress
from tz_dispatch_task t
left JOIN cb_maintenance_unit m on m.sequence_nbr = t.response_org_id
left JOIN tcb_use_unit u on u.sequence_nbr = t.response_org_id
where to_days(t.dispatch_time) = TO_DAYS(now())
</select>
</mapper> </mapper>
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tzs.biz.controller; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tzs.biz.controller;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.tzs.api.dto.MainPersonDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatDispatchFeedbackDto; import com.yeejoin.amos.boot.module.tzs.api.dto.WechatDispatchFeedbackDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskDto; import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskDto;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -98,4 +99,16 @@ public class DispatchTaskController extends BaseController { ...@@ -98,4 +99,16 @@ public class DispatchTaskController extends BaseController {
public ResponseModel<WechatMyTaskDto> saveWechatFeedBack(@RequestBody WechatDispatchFeedbackDto model) { public ResponseModel<WechatMyTaskDto> saveWechatFeedBack(@RequestBody WechatDispatchFeedbackDto model) {
return ResponseHelper.buildResponse(dispatchTaskServiceImpl.saveWechatFeedBack(model)); return ResponseHelper.buildResponse(dispatchTaskServiceImpl.saveWechatFeedBack(model));
} }
/**
* 查找当日派遣人员信息
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "查找当日派遣人员信息", notes = "查找当日派遣人员信息")
@GetMapping(value = "/list/todayTaskPerson")
public ResponseModel<List<MainPersonDto>> todayTaskPerson() {
List<MainPersonDto> list = dispatchTaskServiceImpl.todayTaskPerson();
return ResponseHelper.buildResponse(list);
}
} }
...@@ -38,6 +38,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -38,6 +38,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -51,6 +52,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -51,6 +52,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
...@@ -65,6 +67,7 @@ import javax.xml.parsers.DocumentBuilder; ...@@ -65,6 +67,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
...@@ -91,6 +94,10 @@ public class WechatController extends BaseController { ...@@ -91,6 +94,10 @@ public class WechatController extends BaseController {
@Value("${tzs.wechat.ticketurl}") @Value("${tzs.wechat.ticketurl}")
private String WECHAT_TICKETURL; private String WECHAT_TICKETURL;
@Autowired
private EmqKeeper emqKeeper;
@Value("${mqtt.topic.task.personinfo}")
private String personInfoTopic;
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
...@@ -395,6 +402,23 @@ public class WechatController extends BaseController { ...@@ -395,6 +402,23 @@ public class WechatController extends BaseController {
|| ValidationUtil.isEmpty(dto.getLongitude())){ || ValidationUtil.isEmpty(dto.getLongitude())){
throw new BadRequest("参数校验失败."); throw new BadRequest("参数校验失败.");
} }
// 推送经纬度 人员姓名 电话 警情id
JSONObject jsonObject = new JSONObject();
DispatchTask task = dispatchTaskServiceImpl.getById(dto.getTaskId());
jsonObject.put("personName",task.getResponseUserName());
jsonObject.put("personTel",task.getResponseUserTel());
jsonObject.put("latitude",dto.getLatitude());
jsonObject.put("longitude",dto.getLongitude());
jsonObject.put("alertId",task.getAlertId());
try {
emqKeeper.getMqttClient().publish(personInfoTopic, jsonObject.toString().getBytes("UTF-8"), 1, false);
} catch (MqttException e) {
logger.error("mqtt发送失败" +jsonObject );
} catch (UnsupportedEncodingException e) {
logger.error("mqtt发送失败" +jsonObject );
}
String distance = dispatchTaskService.returnDistanceByTaskId(dto.getTaskId(),dto.getLongitude(),dto.getLatitude()); String distance = dispatchTaskService.returnDistanceByTaskId(dto.getTaskId(),dto.getLongitude(),dto.getLatitude());
return ResponseHelper.buildResponse(distance); return ResponseHelper.buildResponse(distance);
} }
......
...@@ -12,6 +12,7 @@ import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService; ...@@ -12,6 +12,7 @@ import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto; import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.DispatchPaperFormDto; import com.yeejoin.amos.boot.module.tzs.api.dto.DispatchPaperFormDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.DispatchTaskDto; import com.yeejoin.amos.boot.module.tzs.api.dto.DispatchTaskDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.MainPersonDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.RescueProcessDto; import com.yeejoin.amos.boot.module.tzs.api.dto.RescueProcessDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatDispatchFeedbackDto; import com.yeejoin.amos.boot.module.tzs.api.dto.WechatDispatchFeedbackDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMessageDto; import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMessageDto;
...@@ -478,6 +479,11 @@ public class DispatchTaskServiceImpl extends BaseService<DispatchTaskDto,Dispatc ...@@ -478,6 +479,11 @@ public class DispatchTaskServiceImpl extends BaseService<DispatchTaskDto,Dispatc
return temp; return temp;
} }
@Override
public List<MainPersonDto> todayTaskPerson() {
return baseMapper.todayTaskPerson();
}
@Transactional @Transactional
@Override @Override
public Boolean createDispatchTask(DispatchTaskDto dispatchTaskDto, AgencyUserModel sendUser) { public Boolean createDispatchTask(DispatchTaskDto dispatchTaskDto, AgencyUserModel sendUser) {
......
...@@ -43,8 +43,8 @@ tzs.cti.url=http://36.46.151.113:8000 ...@@ -43,8 +43,8 @@ tzs.cti.url=http://36.46.151.113:8000
tzs.wechat.url=https://api.weixin.qq.com tzs.wechat.url=https://api.weixin.qq.com
##wechatAPPID wx79aca5bb1cb4af92 wx8918c1aaad956617 ##wechatAPPID wx79aca5bb1cb4af92 wx8918c1aaad956617
tzs.wechat.appid=wx8918c1aaad956617 tzs.wechat.appid=wx79aca5bb1cb4af92
##wechatSECRET f3a12323ba731d282c3d4698c27c3e97 f3a12323ba731d282c3d4698c27c3e97 ##wechatSECRET 337c3d8f3e749140d4f9aedc8311033b f3a12323ba731d282c3d4698c27c3e97
tzs.wechat.secret=337c3d8f3e749140d4f9aedc8311033b tzs.wechat.secret=337c3d8f3e749140d4f9aedc8311033b
##wechatToken ##wechatToken
...@@ -58,3 +58,6 @@ tzs.wechat.tempId.wx=rags-expfNSBB-h2WenuBI2c6pCEndH4uwTtOqlHqDM ...@@ -58,3 +58,6 @@ tzs.wechat.tempId.wx=rags-expfNSBB-h2WenuBI2c6pCEndH4uwTtOqlHqDM
tzs.wechat.url.wx=tzs.yeeamos.com/persondetail.html tzs.wechat.url.wx=tzs.yeeamos.com/persondetail.html
tzs.wechat.tempId.ts=SLjmNJoCNLC3FBcYzWzR-u3el0kqXf8WMTmzw8dAQm4 tzs.wechat.tempId.ts=SLjmNJoCNLC3FBcYzWzR-u3el0kqXf8WMTmzw8dAQm4
tzs.wechat.url.ts=tzs.yeeamos.com/persondetail.html tzs.wechat.url.ts=tzs.yeeamos.com/persondetail.html
mqtt.topic.task.personinfo=tzs-task-personinfo
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment