Commit 279c26af authored by H2T's avatar H2T

更新警情填报业务数据项

parent e30f7903
......@@ -44,4 +44,7 @@ public class RepairConsultDto extends BaseDto {
@ApiModelProperty(value = "阶段附件")
private String attachment;
@ApiModelProperty(value = "备注")
private String remarks;
}
......@@ -69,4 +69,10 @@ public class RepairConsult extends BaseEntity {
@TableField("attachment")
private String attachment;
/**
* 备注
*/
@TableField("remarks")
private String remarks;
}
package com.yeejoin.amos.boot.module.elevator.biz.controller;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.elevator.api.dto.RepairConsultDto;
import com.yeejoin.amos.boot.module.elevator.api.entity.RepairConsult;
import com.yeejoin.amos.boot.module.elevator.biz.service.impl.RepairConsultServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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.RestController;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.context.RequestContext;
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 java.util.List;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 警情填报业务数据项
......@@ -33,6 +38,9 @@ import java.util.List;
public class RepairConsultController extends BaseController {
@Autowired
RedisUtils redisUtils;
@Autowired
RepairConsultServiceImpl repairConsultServiceImpl;
/**
......@@ -41,25 +49,58 @@ public class RepairConsultController extends BaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增警情填报业务数据项", notes = "新增警情填报业务数据项")
public ResponseModel<RepairConsultDto> save(@RequestBody RepairConsultDto model) {
model = repairConsultServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增警情填报业务数据项", notes = "新增警情填报业务数据项")
public ResponseModel<RepairConsultDto> save(@RequestBody RepairConsultDto model) {
model = repairConsultServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据警情id 查找处置过程日志
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "根据警情id 查找处置过程日志", notes = "根据警情id 查找处置过程日志")
@GetMapping(value = "/list/alert/{alertId}")
public ResponseModel<List<RepairConsult>> selectForListByAlertId(@PathVariable Long alertId) {
LambdaQueryWrapper<RepairConsult> queryWrapper = new LambdaQueryWrapper<RepairConsult>();
queryWrapper.eq(RepairConsult::getParentId, alertId).orderByDesc(RepairConsult::getRecDate);
List<RepairConsult> list = repairConsultServiceImpl.list(queryWrapper);
return ResponseHelper.buildResponse(list);
}
/**
* 根据警情id 查找处置过程日志
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "根据警情id 查找处置过程日志", notes = "根据警情id 查找处置过程日志")
@GetMapping(value = "/list/alert/{alertId}")
public ResponseModel<List<RepairConsult>> selectForListByAlertId(@PathVariable Long alertId) {
LambdaQueryWrapper<RepairConsult> queryWrapper = new LambdaQueryWrapper<RepairConsult>();
queryWrapper.eq(RepairConsult::getParentId, alertId).orderByDesc(RepairConsult::getRecDate);
List<RepairConsult> list = repairConsultServiceImpl.list(queryWrapper);
return ResponseHelper.buildResponse(list);
}
/**
* 更新警情填报业务数据项
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/update")
@ApiOperation(httpMethod = "POST", value = "更新警情填报业务数据项", notes = "更新警情填报业务数据项")
public ResponseModel<Object> update(@RequestBody RepairConsultDto model) {
//当前登录的用户信息
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
//更新备注
RepairConsult consult = repairConsultServiceImpl.getOne(new LambdaQueryWrapper<RepairConsult>().eq(RepairConsult::getSequenceNbr, model.getSequenceNbr()));
List<TreeMap> list = new ArrayList<>();
if (ObjectUtil.isNotEmpty(consult.getRemarks()) && !Objects.equals(consult.getRemarks(), "")) {
list = JSONUtil.toList(consult.getRemarks(), TreeMap.class);
}
Date currentDate = DateUtil.date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String formattedDate = sdf.format(currentDate);
TreeMap<Object, Object> map = new TreeMap<>();
map.put("rec_user_id", reginParams.getUserModel().getUserId());
map.put("rec_user_name", reginParams.getUserModel().getUserName());
map.put("rec_date", formattedDate);
map.put("remark", model.getRemarks());
list.add(map);
LambdaUpdateWrapper<RepairConsult> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(RepairConsult::getSequenceNbr, model.getSequenceNbr());
wrapper.set(RepairConsult::getRemarks, JSONUtil.toJsonStr(list));
repairConsultServiceImpl.update(wrapper);
return ResponseHelper.buildResponse("ok");
}
}
......@@ -2,14 +2,17 @@ package com.yeejoin.amos.boot.module.elevator.flc.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertFormRecordDto;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormRecord;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.elevator.api.mapper.AlertFormRecordMapper;
import com.yeejoin.amos.boot.module.elevator.api.service.IAlertFormRecordService;
import com.yeejoin.amos.boot.module.elevator.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.elevator.biz.service.impl.AlertFormValueServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -40,6 +43,8 @@ public class AlertFormRecordServiceImpl extends BaseService<AlertFormRecordDto,
private AlertFormRecordMapper alertFormRecordMapper;
@Autowired
private AlertFormValueServiceImpl iAlertFormValueService;
@Autowired
private AlertCalledServiceImpl alertCalledServiceImpl;
/**
* 驼峰转下划线
......@@ -86,6 +91,12 @@ public class AlertFormRecordServiceImpl extends BaseService<AlertFormRecordDto,
alertFormRecordMapper.insert(record);
// 更新警情基本信息
Long alertCalled = record.getAlertCalledId();
if (!record.getName().equals(oldRecord.getName())){
LambdaUpdateWrapper<AlertCalled> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(AlertCalled::getSequenceNbr, alertCalled);
wrapper.set(AlertCalled::getEmergencyPerson, record.getName());
alertCalledServiceImpl.update(wrapper);
}
LambdaQueryWrapper<AlertFormValue> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AlertFormValue::getAlertCalledId, alertCalled);
// 警情动态表单数据
......
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