Commit 409d9958 authored by 李腾威's avatar 李腾威

公众号接口故障报修投诉建议保存接口

parent 53f3476d
......@@ -64,7 +64,7 @@ public class ControllerAop {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
// 不需要添加请求头的接口
String[] url = new String[]{"/api/user/selectInfo", "/api/user/save/curCompany", "/jcs/command/lookHtmlText", "/jcs/common/duty-person/findByDutyAreaId", "/tzs/wechatBack", "/tzs/wechat-relation/save"};
String[] url = new String[]{"/api/user/selectInfo", "/api/user/save/curCompany", "/jcs/command/lookHtmlText", "/jcs/common/duty-person/findByDutyAreaId", "/tzs/wechatBack", "/tzs/wechat-relation/save","/tzs/alert-called/saveMobile"};
// 获取请求路径
for(String uri : url) {
if(request.getRequestURI().indexOf(uri) != -1) {
......
......@@ -124,6 +124,7 @@ public class AlertCalledDto extends BaseDto {
@ApiModelProperty(value = "电梯使用状态")
private Integer useStatus;
// 废弃
@ApiModelProperty(value = "警情地址")
private String alertAddress;
......
......@@ -20,6 +20,8 @@ public enum AlertStageEnums {
// 来源类型JQLYLX
DHBJ("963","233","电话报警"),
// 来源类型JQLYLX
GZHSB("972","APPJJ","移动端上报"),
// 警情阶段 JQJD
JJ("964","JJ","接警"),
......
......@@ -34,6 +34,7 @@ public class TzsCommonParam {
public static final String CZJG = "CZJG";
public static final String FKJG = "FKJG";
public static final String WXFK_TS = "WXFK_TS";
public static final String APPJJ = "APPJJ";
public static final String DD = "DD";
public static final String JC = "JC";
}
package com.yeejoin.amos.boot.module.tzs.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -19,11 +20,14 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledRequestDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.entity.WechatRelation;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertFormValueServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.DispatchPaperServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ESAlertCalledService;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ElevatorServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.WechatRelationServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.utils.AlertBeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
......@@ -84,6 +88,9 @@ public class AlertCalledController extends BaseController {
@Autowired
MaintenanceCompanyServiceImpl maintenanceCompanyService;
@Autowired
WechatRelationServiceImpl wechatRelationService;
/**
* 新增警情接警填报记录
*
......@@ -107,22 +114,38 @@ public class AlertCalledController extends BaseController {
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/saveMobile")
@ApiOperation(httpMethod = "POST", value = "新增警情接警填报记录", notes = "新增警情接警填报记录")
public ResponseModel<AlertCalledDto> saveMobile(@RequestBody AlertCalledDto alertCalledDto, @RequestParam String openid) {
public ResponseModel<AlertCalledDto> saveMobile(@RequestBody AlertCalledDto alertCalledDto, @RequestParam String phone) {
if (ValidationUtil.isEmpty(alertCalledDto)){
throw new BadRequest("参数校验失败.");
}
// 校验openid 是否存在
// 校验电梯识别码是否正确
// 校验手机号 是否存在
LambdaQueryWrapper<WechatRelation> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(WechatRelation::getPhone,phone);
WechatRelation wechatRelation = wechatRelationService.getOne(queryWrapper);
if(null == wechatRelation) {
throw new BadRequest("手机号未注册");
}
// alertCalledObjsDto =iAlertCalledService.createAlertCalled(alertCalledObjsDto,reginParams.getUserModel());
return ResponseHelper.buildResponse(alertCalledDto);
// 校验电梯id是否正确
LambdaQueryWrapper<Elevator> queryWrapper1 = new LambdaQueryWrapper();
queryWrapper1.eq(Elevator::getSequenceNbr,Long.valueOf(alertCalledDto.getEquipmentId()));
Elevator elevator = elevatorServiceImpl.getOne(queryWrapper1);
if(null == elevator) {
throw new BadRequest("电梯不存在");
}
// 将电梯地址设置到警情地址
alertCalledDto.setAddress(elevator.getAddress());
alertCalledDto.setRegistrationCode(elevator.getRegisterCode());
alertCalledDto.setDeviceId(String.valueOf(elevator.getRescueCode()));
alertCalledDto.setUseStatus(elevator.getUseStatus());
alertCalledDto.setUseSiteCategory(elevator.getUseSiteCategory());
AlertCalledDto alertCalledDtoReturn = iAlertCalledService.createAlertCalled(alertCalledDto);
return ResponseHelper.buildResponse(alertCalledDtoReturn);
}
/**
......
......@@ -20,6 +20,7 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.tzs.api.enums.DispatchPaperEnums;
import com.yeejoin.amos.boot.module.tzs.api.enums.TzsCommonParam;
import com.yeejoin.amos.boot.module.tzs.api.mapper.AlertCalledMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IAlertCalledService;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
......@@ -35,6 +36,7 @@ import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -298,6 +300,69 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
}
}
/**
*
* <pre>
* 保存警情信息 公众号
* </pre>
*
* @param alertCalledDto
* @return
*/
@Transactional(rollbackFor = RuntimeException.class)
public AlertCalledDto createAlertCalled(AlertCalledDto alertCalledDto) {
try {
// 警情基本信息
AlertCalled alertCalled = BeanDtoVoUtils.convert(alertCalledDto,AlertCalled.class);
alertCalled.setCallTime(new Date());
// 警情报送
alertCalled.setAlertStatus(false);
alertCalled.setAlertSource(AlertStageEnums.GZHSB.getValue());
alertCalled.setAlertSourceCode(AlertStageEnums.GZHSB.getCode());
alertCalled.setIsDelete(false);
alertCalled.setAlertStage(AlertStageEnums.JJ.getValue());
alertCalled.setAlertStageCode(AlertStageEnums.JJ.getId());
alertCalled.setType(AlertStageEnums.JQCB.getValue());
alertCalled.setTypeCode(AlertStageEnums.JQCB.getId());
this.save(alertCalled);
// 动态表单
AlertFormValue alertFormValue = new AlertFormValue();
// 填充警情主键
alertFormValue.setAlertCalledId(alertCalled.getSequenceNbr());
alertFormValue.setAlertTypeCode(alertCalled.getAlarmTypeCode());
if(AlertStageEnums.GZWX.getCode().equals(alertCalled.getAlarmTypeCode())) {
alertFormValue.setFieldName("故障报修描述");
alertFormValue.setFieldValue(alertCalledDto.getDescribe());
alertFormValue.setAlertFormId(8L);
alertFormValue.setFieldCode("fault_report");
} else {
alertFormValue.setFieldName("投诉咨询描述");
alertFormValue.setFieldValue(alertCalledDto.getDescribe());
alertFormValue.setFieldCode("complaint_consulttation");
alertFormValue.setAlertFormId(9L);
}
// 保存动态表单数据
iAlertFormValueService.save(alertFormValue);
//保存处置记录-接警 保存接警日志
repairConsultServiceImpl.saveRepairConsultByAlertIdType(alertCalled.getSequenceNbr(), TzsCommonParam.APPJJ,null, null);
/**
* 同步保存ES
*/
eSAlertCalledService.saveAlertCalledToES(alertCalled);
return alertCalledDto;
} catch (Exception e) {
logger.error("报送失败",e);
throw new RuntimeException("报送失败,系统异常!");
}
}
public Map<String, Object> getAlertInfoList(String beginDate, String endDate,String orgCode, String recUserId) {
Map<String, Object> result = Maps.newHashMap();
......
package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto;
......@@ -87,6 +86,7 @@ public class RepairConsultServiceImpl extends BaseService<RepairConsultDto,Repai
String content = template.getContent();
String createTime = DateUtils.getDateNowString();
DispatchPaperEnums CZHJ = null;
// 公众号生成接警记录
if(AlertStageEnums.JJ.getCode().equals(type)) {
// 接警的处置环节为已接警
CZHJ = DispatchPaperEnums.receivedAlert;
......@@ -104,6 +104,21 @@ public class RepairConsultServiceImpl extends BaseService<RepairConsultDto,Repai
throw new BadRequest("警情类型缺失");
content = content.replace("$createTime",createTime).replace("$createUser",createUser).replace("$call",emergency_call);
content = content.replace("$area",area).replace("$alertType",alertType);
} else if(TzsCommonParam.APPJJ.equals(type)) {
// 接警的处置环节为已接警 公众号上报
CZHJ = DispatchPaperEnums.receivedAlert;
String emergency_call = alertCalledVo.getEmergencyCall();
String area = alertCalledVo.getAddress();
String alertType = alertCalledVo.getAlarmType();
if(emergency_call == null)
throw new BadRequest("求援人电话缺失");
if(area == null)
throw new BadRequest("区域缺失");
if(alertType == null)
throw new BadRequest("警情类型缺失");
content = content.replace("$createTime",createTime).replace("$call",emergency_call);
content = content.replace("$area",area).replace("$alertType",alertType);
} else if(TzsCommonParam.PQ.equals(type)) {
// 派遣的处置环节为已派遣
CZHJ = DispatchPaperEnums.dispatched;
......
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