Commit b0ac33cf authored by kongfm's avatar kongfm

tzs 我的业务和关注电梯相关代码

parent 14625de4
......@@ -26,7 +26,7 @@ public class MyBatisPlusCodeGenerator {
/**
* 项目名称缩写
*/
static String projectShortName = "common";
static String projectShortName = "tzs";
/**
* 项目api目录
......@@ -102,7 +102,7 @@ public class MyBatisPlusCodeGenerator {
gc.setActiveRecord(false);
// 数据源配置
DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://172.16.6.60:3306/amos-jcs-biz?serverTimezone=GMT%2B8");
dsc.setUrl("jdbc:mysql://172.16.6.60:3306/amos-tzs-biz?serverTimezone=GMT%2B8");
// dsc.setSchemaName("public");
// dsc.setDriverName("com.mysql.jdbc.Driver");
dsc.setDriverName("com.mysql.cj.jdbc.Driver");
......
......@@ -16,4 +16,6 @@ public class ElevatorInfoDto {
ElevatorMaintenanceInfoDto elevatorMaintenanceInfoDto;
ElevatorTestInfoDto elevatorTestInfoDto;
boolean hasFocus;
}
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 = "ElevatorInfoDto", description = "ElevatorInfoDto")
public class ElevatorListDto {
@ApiModelProperty(value = "电梯id")
private String elevatorId;
@ApiModelProperty(value = "电梯地址")
private String elevatorAddress;
@ApiModelProperty(value = "电梯救援码")
private String rescueCode;
}
package com.yeejoin.amos.boot.module.tzs.api.dto;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 关注电梯关系表
*
* @author litw
* @date 2021-09-22
* @author system_generator
* @date 2021-10-08
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="EnevatorRelationDto", description="关注电梯关系表")
public class EnevatorRelationDto extends BaseDto {
@ApiModel(value="ElevatorRelationDto", description="关注电梯关系表")
public class ElevatorRelationDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "openid个人识别id")
private Long openId;
private String openId;
@ApiModelProperty(value = "电梯id")
private String enevatorId;
private Long elevatorId;
}
package com.yeejoin.amos.boot.module.tzs.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* 微信公众号我的业务列表
*/
@Data
@ApiModel(value="WechatMyBusinessListDto", description="微信公众号业务列表dto类")
public class WechatMyBusinessListDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")
protected Long sequenceNbr;
@ApiModelProperty(value = "任务类型")
private String taskType;
@ApiModelProperty(value = "是否结案")
private Boolean taskStatus;
@ApiModelProperty(value = "地址")
private String address;
@ApiModelProperty(value = "创建时间")
private Date dispatchTime;
@ApiModelProperty(value = "业务状态")
private String bussinessStatus;
}
package com.yeejoin.amos.boot.module.tzs.api.dto;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 微信公众号返回我的业务dto类
* kongfm
*/
@Data
@ApiModel(value="WechatMyBussinessDto", description="微信公众号返回我的业务dto类")
public class WechatMyBussinessDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")
protected Long sequenceNbr;
@ApiModelProperty(value = "派遣单id")
private Long paperId;
@ApiModelProperty(value = "任务状态")
private String taskStatus;
@ApiModelProperty(value = "任务类别")
private String taskType;
@ApiModelProperty(value = "任务类别code")
private String taskTypeCode;
@ApiModelProperty(value = "地址")
private String address;
@ApiModelProperty(value = "电梯识别码")
private String rescueCode;
@ApiModelProperty(value = "被困楼层")
private String trappedFloorNum;
@ApiModelProperty(value = "被困人数")
private String trappedNum;
@ApiModelProperty(value = "派遣时间")
private Date dispatchTime;
@ApiModelProperty(value = "有无人员伤亡")
private String hasDeadHurt;
@ApiModelProperty(value = "使用单位")
private String useUnit;
@ApiModelProperty(value = "使用单位id")
private Long useUnitId;
@ApiModelProperty(value = "使用单位主管机构")
private String useUnitAuthority;
@ApiModelProperty(value = "求援人电话")
private String emergencyCall;
@ApiModelProperty(value = "求援时间/ 报修时间/ 投诉时间")
private Date recDate;
@ApiModelProperty(value = "到达时间")
private Date arriveTime;
@ApiModelProperty(value = "救援完成时间")
private Date saveTime;
@ApiModelProperty(value = "救援单位")
private String saveOrg;
@ApiModelProperty(value = "维修完成时间")
private Date fixFinishTime;
@ApiModelProperty(value = "维修单位")
private String responseOrg;
@ApiModelProperty(value = "维修人")
private String responseUser;
@ApiModelProperty(value = "故障原因")
private String errorResult;
@ApiModelProperty(value = "维修结果")
private String fixResult;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "现场照片")
private List<AttachmentDto> fixImgs;
@ApiModelProperty(value = "故障描述")
private String errorContent;
@ApiModelProperty(value = "故障照片")
private List<AttachmentDto> errorImgs;
@ApiModelProperty(value = "反馈时间")
private Date responseTime;
@ApiModelProperty(value = "反馈人")
private String feedbackUname;
@ApiModelProperty(value = "结果评价")
private String feedbackResult;
@ApiModelProperty(value = "反馈备注")
private String feedbackRemark;
@ApiModelProperty(value = "反馈现场照片")
private List<AttachmentDto> feedBackImgs;
@ApiModelProperty(value = "处置时间")
private Date dealTime;
@ApiModelProperty(value = "处置单位")
private String dealOrg;
@ApiModelProperty(value = "处置人")
private String dealUser;
@ApiModelProperty(value = "处置结果")
private String actionResult;
}
......@@ -2,19 +2,22 @@ package com.yeejoin.amos.boot.module.tzs.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 关注电梯关系表
*
* @author litw
* @date 2021-09-22
* @author system_generator
* @date 2021-10-08
*/
@Data
@Accessors(chain = true)
@TableName("tz_enevator_relation")
public class EnevatorRelation {
@TableName("tz_elevator_relation")
public class ElevatorRelation {
private static final long serialVersionUID = 1L;
......@@ -22,12 +25,12 @@ public class EnevatorRelation {
* openid个人识别id
*/
@TableField("open_id")
private Long openId;
private String openId;
/**
* 电梯id
*/
@TableField("enevator_id")
private String enevatorId;
@TableField("elevator_id")
private Long elevatorId;
}
......@@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBusinessListDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBussinessDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskListDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import org.apache.ibatis.annotations.Param;
......@@ -71,4 +74,8 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> {
List<Map<String, Object>> getTodayEmergencyDetail(String rescueTotal,String rescueComplete, String regionCode);
WechatMyBussinessDto getBussinessInfoById(@Param("alertId") Long alertId);
List<WechatMyBusinessListDto> getBussinessListByPhonePager(@Param("phone") String phone, @Param("bussinessCode") String bussinessCode, @Param("current") Long current);
}
package com.yeejoin.amos.boot.module.tzs.api.mapper;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorListDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.ElevatorRelation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 关注电梯关系表 Mapper 接口
*
* @author system_generator
* @date 2021-10-08
*/
public interface ElevatorRelationMapper extends BaseMapper<ElevatorRelation> {
/**
* 获取是否关注电梯
* @param openId
* @param elevatorId
* @return
*/
Integer hasFocusElevator(@Param("openId") String openId, @Param("elevatorId") Long elevatorId);
/**
* 关注电梯
* @param openId
* @param elevatorId
* @return
*/
Integer focusElevator(@Param("openId") String openId, @Param("elevatorId") String elevatorId);
/**
* 取消关注电梯
* @param openId
* @param elevatorId
* @return
*/
Integer cancelFocusElevator(@Param("openId") String openId, @Param("elevatorId") String elevatorId);
/**
* 获取用户关注电梯列表
* @param openId
* @return
*/
List<ElevatorListDto> getMyFocusElevator(@Param("openId") String openId);
}
package com.yeejoin.amos.boot.module.tzs.api.mapper;
import com.yeejoin.amos.boot.module.tzs.api.entity.EnevatorRelation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 关注电梯关系表 Mapper 接口
*
* @author litw
* @date 2021-09-22
*/
public interface EnevatorRelationMapper extends BaseMapper<EnevatorRelation> {
}
......@@ -7,10 +7,17 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertHandlerDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBusinessListDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBussinessDto;
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.enums.DispatchPaperEnums;
import org.apache.ibatis.annotations.Param;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import java.util.List;
/**
* 警情接警填报记录接口类
*
......@@ -65,4 +72,8 @@ public interface IAlertCalledService {
AlertHandlerDto getHandlerInfo(String alertId);
Object getCalledInfo();
WechatMyBussinessDto getBussinessInfoById(Long alertId);
List<WechatMyBusinessListDto> getBussinessListByPhonePager(String phone, String bussinessCode, Long current);
}
package com.yeejoin.amos.boot.module.tzs.api.service;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorListDto;
import java.util.List;
/**
* 关注电梯关系表接口类
*
* @author system_generator
* @date 2021-10-08
*/
public interface IElevatorRelationService {
/**
* 获取是否关注电梯
* @param phone
* @param elevatorId
* @return
*/
Boolean hasFocusElevator(String phone, Long elevatorId);
/**
* 关注电梯
* @param openId
* @param elevatorId
* @return
*/
Boolean focusElevator(String openId, String elevatorId);
/**
* 取消关注电梯
* @param openId
* @param elevatorId
* @return
*/
Boolean cancelFocusElevator(String openId, String elevatorId);
/**
* 获取用户关注电梯列表
* @param openId
* @return
*/
List<ElevatorListDto> getMyFocusElevator(String openId);
}
package com.yeejoin.amos.boot.module.tzs.api.service;
/**
* 关注电梯关系表接口类
*
* @author litw
* @date 2021-09-22
*/
public interface IEnevatorRelationService {
}
......@@ -427,6 +427,58 @@
</if>
</select>
<select id="getBussinessInfoById" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBussinessDto">
select
a.sequence_nbr,
p.sequence_nbr as paperId,
a.alert_stage as taskStatus,
a.alarm_type as taskType,
a.alarm_type_code as taskTypeCode,
e.address,
e.rescue_code as rescueCode,
p.dispatch_time as dispatchTime,
e.use_unit as useUnit,
e.use_unit_id as useUnitId,
e.use_unit_authority as useUnitAuthority,
a.emergency_call as emergencyCall,
a.rec_date as recDate,
p.arrive_time as arriveTime,
p.save_org_name as saveOrg,
p.feedback_finish_time as fixFinishTime,
p.repair_org_name as responseOrg,
p.repair_user as responseUser,
p.remark as feedbackRemark,
p.feedback_time as responseTime,
p.feedback_uname as feedbackUname,
p.feedback_finish_time as dealTime,
p.deal_org_name as dealOrg,
p.deal_user as dealUser
from tz_alert_called a
LEFT JOIN tcb_elevator e on e.sequence_nbr = a.equipment_id
LEFT JOIN tz_dispatch_paper p on p.alert_id = a.sequence_nbr
where a.sequence_nbr = #{alertId}
</select>
<select id="getBussinessListByPhonePager" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBusinessListDto">
select
a.sequence_nbr,
a.alarm_type as taskType,
a.alert_status as taskStatus,
e.address,
a.call_time as dispatchTime,
a.alert_stage as bussinessStatus
from tz_alert_called a
LEFT JOIN tcb_elevator e on e.sequence_nbr = a.equipment_id
LEFT JOIN tz_dispatch_paper p on p.alert_id = a.sequence_nbr
where a.emergency_call =#{phone}
and a.is_delete = 0
and a.father_alert is null
and a.alarm_type_code = #{bussinessCode}
ORDER BY a.rec_date desc
limit #{current},5
</select>
</mapper>
<?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.yeejoin.amos.boot.module.tzs.api.mapper.ElevatorRelationMapper">
<select id="hasFocusElevator" resultType="java.lang.Integer">
select count(1) from tz_elevator_relation el
where el.elevator_id = #{elevatorId} and el.open_id = #{openId}
</select>
<insert id="focusElevator" >
insert into tz_elevator_relation values (#{openId}, #{elevatorId})
</insert>
<delete id="cancelFocusElevator" >
delete el from tz_elevator_relation el where el.open_id = #{openId} and el.elevator_id = #{elevatorId}
</delete>
<select id="getMyFocusElevator" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorListDto">
SELECT
e.sequence_nbr AS elevatorId,
e.address AS elevatorAddress,
e.rescue_code AS rescueCode
FROM
tz_elevator_relation el
LEFT JOIN tcb_elevator e ON e.sequence_nbr = el.elevator_id
WHERE
el.open_id = #{openId}
</select>
</mapper>
<?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.yeejoin.amos.boot.module.tzs.api.mapper.EnevatorRelationMapper">
</mapper>
......@@ -10,6 +10,7 @@ import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorBaseInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorListDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorMaintenanceInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorNewDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorTestInfoDto;
......@@ -18,6 +19,7 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.EsElevatorDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.entity.MaintainInfo;
import com.yeejoin.amos.boot.module.tzs.api.entity.TestInfo;
import com.yeejoin.amos.boot.module.tzs.api.service.IElevatorRelationService;
import com.yeejoin.amos.boot.module.tzs.api.service.IElevatorService;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ESElevatorServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ElevatorServiceImpl;
......@@ -90,6 +92,9 @@ public class ElevatorController extends BaseController {
@Value("${mqtt.topic.elevator.push}")
private String elevatorpushTopic;
@Autowired
private IElevatorRelationService elevatorRelationService;
/**
* 新增电梯
*
......@@ -313,9 +318,9 @@ public class ElevatorController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getElevatorInfo", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据电梯id或电梯救援识别码获取电梯信息", notes = "根据电梯id或电梯救援识别码获取电梯信息")
public ResponseModel<ElevatorInfoDto> getElevatorInfo(Long sequenceNbr,String rescueCode) {
public ResponseModel<ElevatorInfoDto> getElevatorInfo(Long sequenceNbr,String rescueCode, String openId) {
if(StringUtils.isBlank(rescueCode) && sequenceNbr == null) {
if(StringUtils.isBlank(rescueCode) && sequenceNbr == null && StringUtils.isBlank(openId)) {
throw new BadRequest("参数错误");
}
Elevator elevator;
......@@ -354,6 +359,9 @@ public class ElevatorController extends BaseController {
Bean.toPo(testInfo,elevatorTestInfoDto);
elevatorInfoDto.setElevatorTestInfoDto(elevatorTestInfoDto);
}
if(elevator != null) {
elevatorInfoDto.setHasFocus(elevatorRelationService.hasFocusElevator(openId, elevator.getSequenceNbr()));
}
return ResponseHelper.buildResponse(elevatorInfoDto);
}
......@@ -473,5 +481,43 @@ public class ElevatorController extends BaseController {
return ResponseHelper.buildResponse(null);
}
/**
* 关注电梯
* @param elevatorId
* @param openId
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/focusElevator/{elevatorId}/{openId}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "关注电梯", notes = "关注电梯")
public ResponseModel<Boolean> focusElevator(@PathVariable String elevatorId, @PathVariable String openId){
return ResponseHelper.buildResponse(elevatorRelationService.focusElevator(openId,elevatorId));
}
/**
* 取消关注电梯
* @param elevatorId
* @param openId
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/cancelFocusElevator/{elevatorId}/{openId}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "取消关注电梯", notes = "取消关注电梯")
public ResponseModel<Boolean> cancelFocusElevator(@PathVariable String elevatorId, @PathVariable String openId){
return ResponseHelper.buildResponse(elevatorRelationService.cancelFocusElevator(openId,elevatorId));
}
/**
* 获取关注电梯列表
* @param openId
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getMyFocusElevator/{openId}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取关注电梯列表", notes = "获取关注电梯列表")
public ResponseModel<List<ElevatorListDto>> cancelFocusElevator(@PathVariable String openId){
return ResponseHelper.buildResponse(elevatorRelationService.getMyFocusElevator(openId));
}
}
package com.yeejoin.amos.boot.module.tzs.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.tzs.api.dto.EnevatorRelationDto;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.EnevatorRelationServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* 关注电梯关系表
*
* @author litw
* @date 2021-09-22
*/
@RestController
@Api(tags = "关注电梯关系表Api")
@RequestMapping(value = "/enevator-relation")
public class EnevatorRelationController extends BaseController {
@Autowired
EnevatorRelationServiceImpl enevatorRelationServiceImpl;
/**
* 新增关注电梯关系表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增关注电梯关系表", notes = "新增关注电梯关系表")
public ResponseModel<EnevatorRelationDto> save(@RequestBody EnevatorRelationDto model) {
model = enevatorRelationServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr删除 -- 取消关注
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{openId}/{enevatorId}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除关注电梯关系表", notes = "根据sequenceNbr删除关注电梯关系表")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "openId") Long openId,
@PathVariable(value = "enevatorId") String sequenceNbr){
return ResponseHelper.buildResponse(enevatorRelationServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个关注电梯关系表", notes = "根据sequenceNbr查询单个关注电梯关系表")
public ResponseModel<EnevatorRelationDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(enevatorRelationServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "关注电梯关系表分页查询", notes = "关注电梯关系表分页查询")
public ResponseModel<Page<EnevatorRelationDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<EnevatorRelationDto> page = new Page<EnevatorRelationDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(enevatorRelationServiceImpl.queryForEnevatorRelationPage(page));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "关注电梯关系表列表全部数据查询", notes = "关注电梯关系表列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<EnevatorRelationDto>> selectForList() {
return ResponseHelper.buildResponse(enevatorRelationServiceImpl.queryForEnevatorRelationList());
}
}
......@@ -12,6 +12,8 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.SignatureDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatAccessDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMessageDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBusinessListDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBussinessDto;
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.WechatRelationDto;
......@@ -440,6 +442,21 @@ public class WechatController extends BaseController {
}
/**
* 获取业务详情
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/getBussinessInfo/{bussinessId}")
@ApiOperation(httpMethod = "GET", value = "获取业务详情", notes = "获取业务详情")
public ResponseModel<WechatMyBussinessDto> getBussinessInfo(@PathVariable Long bussinessId) {
if (ValidationUtil.isEmpty(bussinessId)){
throw new BadRequest("参数校验失败.");
}
return ResponseHelper.buildResponse(getBussinessDtoById(bussinessId));
}
/**
* 点击到达触发事件
*
* @return
......@@ -498,6 +515,26 @@ public class WechatController extends BaseController {
return ResponseHelper.buildResponse(dispatchTaskService.getTaskListByPhonePager(phone, taskType, currentPage));
}
/**
* 获取我的业务列表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/getBussinessList")
@ApiOperation(httpMethod = "GET", value = "根据用户手机号获取业务列表", notes = "根据用户手机号获取业务列表")
public ResponseModel<List<WechatMyBusinessListDto>> getBussinessList(@ApiParam(value = "电话号码", required = true) @RequestParam String phone,
@ApiParam(value = "业务类别", required = true) @RequestParam String businessType,
@ApiParam(value = "当前页码", required = true) @RequestParam Long currentPage) {
if (ValidationUtil.isEmpty(phone) ||
ValidationUtil.isEmpty(businessType) ||
ValidationUtil.isEmpty(currentPage)){
throw new BadRequest("参数校验失败.");
}
return ResponseHelper.buildResponse(iAlertCalledService.getBussinessListByPhonePager(phone, businessType, currentPage));
}
/**
* 微信端图片上传
*
......@@ -524,39 +561,128 @@ public class WechatController extends BaseController {
return ResponseHelper.buildResponse(urlString);
}
private WechatMyTaskDto getTaskDtoByTaskId(Long taskId) {
WechatMyTaskDto temp = dispatchTaskService.getTaskInfoByTaskId(taskId);
List<AlertFormValue> paperList = null;
Map<String, List<AttachmentDto>> imgMap = null;
List<AttachmentDto> imgDtos = null;
Map<String, List<AttachmentDto>> errorImgMap = null;
List<AttachmentDto> errorImgDtos = null;
LambdaQueryWrapper<AlertFormValue> queryWrapper = new LambdaQueryWrapper<>();
switch (temp.getTaskTypeCode()) {
case "960" : // 困人救援
temp.setHasDeadHurt("无");
queryWrapper.eq(AlertFormValue::getAlertCalledId, temp.getAlertId());
// 警情动态表单数据
List<AlertFormValue> alertList = iAlertFormValueService.list(queryWrapper);
alertList.stream().forEach(t -> {
String value = t.getFieldValue();
if("trapped_floor_num".equals(t.getFieldCode())) {
// 被困楼层
temp.setTrappedFloorNum(value);
} else if("trapped_num".equals(t.getFieldCode())) {
// 被困人数
temp.setTrappedNum(value);
} else if("injured_num".equals(t.getFieldCode())) {
// 受伤人数
if(StringUtils.isNotEmpty(value)) {
temp.setHasDeadHurt("有");
}
} else if("die_num".equals(t.getFieldCode())) {
// 死亡人数
if(StringUtils.isNotEmpty(value)) {
temp.setHasDeadHurt("有");
}
}
});
queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AlertFormValue::getAlertCalledId, temp.getPaperId());
// 派遣动态表单
paperList = iAlertFormValueService.list(queryWrapper);
paperList.stream().forEach(t -> {
String value = t.getFieldValue();
if("save_time".equals(t.getFieldCode())) {
// 救援完成时间
if(StringUtils.isNotBlank(value)) {
temp.setSaveTime(DateUtils.longStr2Date(value));
}
} else if("error_result".equals(t.getFieldCode())) {
// 故障原因
temp.setErrorResult(value);
} else if("fix_result".equals(t.getFieldCode())) {
// 维修结果
temp.setFixResult(value);
} else if("fix_remark".equals(t.getFieldCode())) {
// 维修备注
temp.setRemark(value);
}
});
imgMap = sourceFileService.getAttachments(temp.getPaperId());
imgDtos = imgMap.get("imgs");
temp.setFixImgs(imgDtos);
/**
* 测试模板消息
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/testDispatch/{taskId}")
@ApiOperation(httpMethod = "GET", value = "测试模板消息", notes = "测试模板消息")
public ResponseModel<JSONObject> testDispatch(@PathVariable Long taskId) {
DispatchTask task = dispatchTaskServiceImpl.getById(taskId);
String tel = task.getResponseUserTel();
tel = "15353367807";
// 获取openId
WechatRelation relation = wechatRelationServiceImpl.getOne(new LambdaQueryWrapper<WechatRelation>().eq(WechatRelation::getPhone,tel));
if(relation == null ) {
throw new BadRequest("该用户未在系统中注册,无法发送模板消息"); // 接口迁移到服务中时改成日志形式;
break;
case "961" : // 故障维修
queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AlertFormValue::getAlertCalledId, temp.getPaperId());
// 派遣动态表单
paperList = iAlertFormValueService.list(queryWrapper);
paperList.stream().forEach(t -> {
String value = t.getFieldValue();
if("save_time".equals(t.getFieldCode())) {
// 救援完成时间
if(StringUtils.isNotBlank(value)) {
temp.setSaveTime(DateUtils.longStr2Date(value));
}
} else if("error_result".equals(t.getFieldCode())) {
// 故障原因
temp.setErrorResult(value);
} else if("fix_result".equals(t.getFieldCode())) {
// 维修结果
temp.setFixResult(value);
} else if("fix_remark".equals(t.getFieldCode())) {
// 维修备注
temp.setRemark(value);
} else if("feedback_result".equals(t.getFieldCode())) {
// 反馈结果
temp.setFeedbackResult(value);
}
});
imgMap = sourceFileService.getAttachments(temp.getPaperId());
imgDtos = imgMap.get("imgs");
temp.setFixImgs(imgDtos);
errorImgMap = sourceFileService.getAttachments(temp.getAlertId());
errorImgDtos = errorImgMap.get("imgs");
temp.setErrorImgs(errorImgDtos);
break;
case "962" : // 投诉建议
queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AlertFormValue::getAlertCalledId, temp.getPaperId());
// 派遣动态表单
paperList = iAlertFormValueService.list(queryWrapper);
paperList.stream().forEach(t -> {
String value = t.getFieldValue();
if("action_result".equals(t.getFieldCode())) {
// 处置结果
temp.setActionResult(value);
}
});
break;
}
WechatMessageDto test = new WechatMessageDto();
Map<String, String> data = new HashMap<>();
data.put("dispatchTime", DateUtils.date2LongStr(task.getDispatchTime()));
AlertCalledFormDto dto = iAlertCalledService.selectAlertCalledByIdNoCache(task.getAlertId());
data.put("address",dto.getAlertCalledDto().getAddress());
test.setUrl("www.baidu.com");
test.setTemplateId("SLjmNJoCNLC3FBcYzWzR-u3el0kqXf8WMTmzw8dAQm4");
test.setData(data);
JSONObject result = wechatService.sendWechatModelMessage(relation.getOpenId(),test);
return ResponseHelper.buildResponse(result);
return temp;
}
private WechatMyTaskDto getTaskDtoByTaskId(Long taskId) {
WechatMyTaskDto temp = dispatchTaskService.getTaskInfoByTaskId(taskId);
private WechatMyBussinessDto getBussinessDtoById(Long alertId) {
WechatMyBussinessDto temp = iAlertCalledService.getBussinessInfoById(alertId);
List<AlertFormValue> paperList = null;
Map<String, List<AttachmentDto>> imgMap = null;
List<AttachmentDto> imgDtos = null;
......@@ -566,7 +692,7 @@ public class WechatController extends BaseController {
switch (temp.getTaskTypeCode()) {
case "960" : // 困人救援
temp.setHasDeadHurt("无");
queryWrapper.eq(AlertFormValue::getAlertCalledId, temp.getAlertId());
queryWrapper.eq(AlertFormValue::getAlertCalledId, temp.getSequenceNbr());
// 警情动态表单数据
List<AlertFormValue> alertList = iAlertFormValueService.list(queryWrapper);
alertList.stream().forEach(t -> {
......@@ -651,7 +777,7 @@ public class WechatController extends BaseController {
temp.setFixImgs(imgDtos);
errorImgMap = sourceFileService.getAttachments(temp.getAlertId());
errorImgMap = sourceFileService.getAttachments(temp.getSequenceNbr());
errorImgDtos = errorImgMap.get("imgs");
temp.setErrorImgs(errorImgDtos);
break;
......
......@@ -20,6 +20,8 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.AlertHandlerDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertHandlerInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertPaperInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.FormValue;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBusinessListDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBussinessDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchPaper;
......@@ -336,6 +338,16 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
return list;
}
@Override
public WechatMyBussinessDto getBussinessInfoById(Long alertId) {
return baseMapper.getBussinessInfoById(alertId);
}
@Override
public List<WechatMyBusinessListDto> getBussinessListByPhonePager(String phone, String bussinessCode, Long current) {
return baseMapper.getBussinessListByPhonePager(phone, bussinessCode, current*5);
}
private void dataInit(AlertHandlerInfoDto alertHandlerInfoDto, String process,String answerThePolice, String report, String notice, String arrive, String complete,String returnVisit) {
alertHandlerInfoDto.setAbProcess(process);
alertHandlerInfoDto.setAcAnswerThePolice(answerThePolice);
......
package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorListDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorRelationDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.ElevatorRelation;
import com.yeejoin.amos.boot.module.tzs.api.mapper.ElevatorRelationMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IElevatorRelationService;
import com.yeejoin.amos.boot.module.tzs.biz.controller.AlertCalledController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.List;
/**
* 关注电梯关系表服务实现类
*
* @author system_generator
* @date 2021-10-08
*/
@Service
public class ElevatorRelationServiceImpl extends BaseService<ElevatorRelationDto, ElevatorRelation, ElevatorRelationMapper> implements IElevatorRelationService {
private final Logger logger = LoggerFactory.getLogger(ElevatorRelationServiceImpl.class);
@Override
public Boolean hasFocusElevator(String phone, Long elevatorId) {
return baseMapper.hasFocusElevator(phone, elevatorId) == 1;
}
@Override
public Boolean focusElevator(String openId, String elevatorId) {
Boolean flag = false;
try {
int result = baseMapper.focusElevator(openId, elevatorId);
flag = true;
} catch (Exception e) {
logger.error("关注电梯失败" + e.getMessage());
}
return flag;
}
@Override
public Boolean cancelFocusElevator(String openId, String elevatorId) {
return baseMapper.cancelFocusElevator(openId, elevatorId) == 1;
}
@Override
public List<ElevatorListDto> getMyFocusElevator(String openId) {
return baseMapper.getMyFocusElevator(openId);
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.yeejoin.amos.boot.module.tzs.api.entity.EnevatorRelation;
import com.yeejoin.amos.boot.module.tzs.api.mapper.EnevatorRelationMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IEnevatorRelationService;
import com.yeejoin.amos.boot.module.tzs.api.dto.EnevatorRelationDto;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/**
* 关注电梯关系表服务实现类
*
* @author litw
* @date 2021-09-22
*/
@Service
public class EnevatorRelationServiceImpl extends BaseService<EnevatorRelationDto,EnevatorRelation,EnevatorRelationMapper> implements IEnevatorRelationService {
/**
* 分页查询
*/
public Page<EnevatorRelationDto> queryForEnevatorRelationPage(Page<EnevatorRelationDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<EnevatorRelationDto> queryForEnevatorRelationList() {
return this.queryForList("" , false);
}
}
\ 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