Commit 54083d2f authored by tangwei's avatar tangwei

增加接口

parent 49d421de
......@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="AlertCalled对象", description="警情接警记录")
public class AlertCalled extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "警情状态")
private Boolean alertStatus;
......@@ -44,12 +44,6 @@ public class AlertCalled extends BaseEntity {
@ApiModelProperty(value = "报警类型code")
private String alarmTypeCode;
@ApiModelProperty(value = "报警方式")
private String alarmMode;
@ApiModelProperty(value = "报警方式code")
private String alarmModeCode;
@ApiModelProperty(value = "通话记录信息id")
private Integer callRecordId;
......@@ -113,4 +107,8 @@ public class AlertCalled extends BaseEntity {
@ApiModelProperty(value = "接警时间结束---用于列表过滤")
@TableField(exist=false)
private Date callTimeEnd ;
@TableField(exist=false)
@ApiModelProperty(value = "是否处警")
private Boolean isFatherAlert;
}
......@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="AlertFrom对象", description="警情表单")
public class AlertFrom extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "警情类型")
......
......@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="AlertFromType对象", description="动态表单类型")
public class AlertFromType extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "表单类型code")
......
......@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="AlertFromValue对象", description="")
public class AlertFromValue extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "表单id")
......
......@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="AlertSubmitted对象", description="警情报送记录")
public class AlertSubmitted extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "警情id")
......
......@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="AlertSubmittedObject对象", description="报送对象")
public class AlertSubmittedObject extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "报送单据id")
......
......@@ -18,7 +18,7 @@ import java.util.Date;
@ApiModel(value = "tb_demo对象", description = "Demo示例")
public class CbDemo extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "NAME")
private String name;
......
......@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="DataDictionary对象", description="数据字典")
public class DataDictionary extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "code")
......
......@@ -29,7 +29,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="FireExperts对象", description="")
public class FireExperts extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "姓名")
......
......@@ -29,7 +29,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="FireTeam对象", description="消防队伍")
public class FireTeam extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "消防队伍图片")
......
......@@ -29,8 +29,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="Firefighters对象", description="消防队员")
public class Firefighters extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "系统账号")
private String systemAccount;
......
......@@ -29,7 +29,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="FirefightersContacts对象", description="联系人")
public class FirefightersContacts extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "人员id")
......
......@@ -32,7 +32,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="FirefightersContract对象", description="消防员合同")
public class FirefightersContract extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "合同名称")
......
......@@ -29,7 +29,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="FirefightersEducation对象", description="人员学历")
public class FirefightersEducation extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "人员id")
......
......@@ -32,7 +32,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="FirefightersJacket对象", description="消防人员配装记录")
public class FirefightersJacket extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "消防队员")
......
......@@ -29,7 +29,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="FirefightersPost对象", description="岗位信息")
public class FirefightersPost extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "人员id")
......
......@@ -32,7 +32,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="FirefightersThought对象", description="消防员思想谈话记录")
public class FirefightersThought extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "消防救援人员")
......
......@@ -29,7 +29,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="FirefightersWorkexperience对象", description="工作经历")
public class FirefightersWorkexperience extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "参加工作时间")
......
......@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="OrgUsr对象", description="机构/部门/人员表")
public class OrgUsr extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "机构/部门名称")
......
......@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="OrgUsrAuth对象", description="")
public class OrgUsrAuth extends BaseEntity {
private static final long serialVersionUID = 1L;
private String recUserName;
......
......@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="PowerTransfer对象", description="力量调派")
public class PowerTransfer extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "警情id")
......
......@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="PowerTransferCompany对象", description="调派单位")
public class PowerTransferCompany extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "调派单据id")
......
......@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="PowerTransferCompanyResources对象", description="调派单位资源")
public class PowerTransferCompanyResources extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "资源类型")
......
......@@ -25,7 +25,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ApiModel(value="Template对象", description="模板表")
public class Template extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "模板类型")
......
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.yeejoin.amos.boot.biz.common.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFromValue;
import com.yeejoin.amos.boot.module.jcs.api.entity.FirefightersJacket;
......@@ -30,152 +31,194 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Arrays;
import java.util.List;
/**
* 警情接警记录
*
* @author tb
* @date 2021-06-17
*/
* 警情接警记录
*
* @author tb
* @date 2021-06-17
*/
@RestController
@Api(tags = "警情接警记录Api")
@RequestMapping(value = "/jcs/alert-called")
public class AlertCalledController extends BaseController {
@Autowired
IAlertCalledService iAlertCalledService;
@Autowired
IAlertFromValueService iAlertFromValueService;
/**
* 新增警情接警记录
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增警情接警记录", notes = "新增警情接警记录")
@Transactional
public ResponseModel saveAlertCalled(HttpServletRequest request, @RequestBody AlertCalledVo alertCalledVo){
//警情基本信息
AlertCalled alertCalled= alertCalledVo.getAlertCalled();
//判断是否归并警情
if(alertCalled.getFatherAlert()!=null){
//警情归并,设置当前警情状态为结束。
alertCalled.setAlertStatus(true);
}else{
//警情报送
//****************************************************待确认开发
}
iAlertCalledService.save(alertCalled);
//动态表单
List<AlertFromValue> alertFromValuelist= alertCalledVo.getAlertFromValue();
//填充警情主键
alertFromValuelist.stream().forEach(alertFromValue->{
alertFromValue.setAlertCalledId(alertCalled.getSequenceNbr());
});
//保存动态表单数据
iAlertFromValueService.saveBatch(alertFromValuelist);
iAlertCalledService.save(alertCalled);
return CommonResponseUtil.success(alertCalledVo);
}
/**
* 根据id删除
* @param id
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public boolean deleteById(HttpServletRequest request, @PathVariable Long id){
return iAlertCalledService.removeById(id);
}
/**
* 修改警情接警记录
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/updateById", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "修改警情接警记录", notes = "修改警情接警记录")
public boolean updateByIdAlertCalled(HttpServletRequest request, @RequestBody AlertCalled alertCalled){
return iAlertCalledService.updateById(alertCalled);
}
/**
* 根据id查询
* @param id
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public ResponseModel selectById(HttpServletRequest request, @PathVariable Long id){
//警情基本信息
AlertCalled alertCalled=iAlertCalledService.getById(id);
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", id);
//警情动态表单数据
List<AlertFromValue> alertFromValue = iAlertFromValueService.list(queryWrapper);
AlertCalledVo alertCalledVo=new AlertCalledVo(alertCalled,alertFromValue);
return CommonResponseUtil.success(alertCalledVo);
}
/**
* 列表分页查询
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public ResponseModel listPage(String pageNum,String pageSize, AlertCalled alertCalled){
Page<AlertCalled> pageBean;
QueryWrapper<AlertCalled> alertCalledQueryWrapper = new QueryWrapper<>();
Class<? extends AlertCalled> aClass = alertCalled.getClass();
alertCalledQueryWrapper.eq("is_delete",1);
if(alertCalled.getCallTimeStart()!=null&&alertCalled.getCallTimeEnd()!=null){
alertCalledQueryWrapper.between("call_time",alertCalled.getCallTimeStart(),alertCalled.getCallTimeEnd());
}
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(alertCalled);
if (o != null) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(alertCalled);
alertCalledQueryWrapper.eq(name, fileValue);
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(alertCalled);
alertCalledQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(alertCalled);
alertCalledQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(alertCalled);
alertCalledQueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
throw new RuntimeException("系统异常");
}
});
IPage<AlertCalled> page;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = iAlertCalledService.page(pageBean, alertCalledQueryWrapper);
return CommonResponseUtil.success(page);
}
}
@Autowired
IAlertCalledService iAlertCalledService;
@Autowired
IAlertFromValueService iAlertFromValueService;
/**
* 新增警情接警记录
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增警情接警记录", notes = "新增警情接警记录")
@Transactional
public ResponseModel saveAlertCalled(HttpServletRequest request, @RequestBody AlertCalledVo alertCalledVo) {
// 警情基本信息
AlertCalled alertCalled = alertCalledVo.getAlertCalled();
// 判断是否归并警情
if (alertCalled.getFatherAlert() != null) {
// 警情归并,设置当前警情状态为结束。
alertCalled.setAlertStatus(true);
} else {
// 警情报送
// ****************************************************待确认开发
}
iAlertCalledService.save(alertCalled);
// 动态表单
List<AlertFromValue> alertFromValuelist = alertCalledVo.getAlertFromValue();
// 填充警情主键
alertFromValuelist.stream().forEach(alertFromValue -> {
alertFromValue.setAlertCalledId(alertCalled.getSequenceNbr());
});
// 保存动态表单数据
iAlertFromValueService.saveBatch(alertFromValuelist);
iAlertCalledService.save(alertCalled);
return CommonResponseUtil.success(alertCalledVo);
}
/**
* 根据id删除
*
* @param id
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public boolean deleteById(HttpServletRequest request, @PathVariable Long id) {
return iAlertCalledService.removeById(id);
}
/**
* 修改警情接警记录
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/updateById", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "修改警情接警记录", notes = "修改警情接警记录")
public boolean updateByIdAlertCalled(HttpServletRequest request, @RequestBody AlertCalled alertCalled) {
return iAlertCalledService.updateById(alertCalled);
}
/**
* 根据id查询
*
* @param id
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public ResponseModel selectById(HttpServletRequest request, @PathVariable Long id) {
// 警情基本信息
AlertCalled alertCalled = iAlertCalledService.getById(id);
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据
List<AlertFromValue> alertFromValue = iAlertFromValueService.list(queryWrapper);
AlertCalledVo alertCalledVo = new AlertCalledVo(alertCalled, alertFromValue);
return CommonResponseUtil.success(alertCalledVo);
}
/**
* 列表分页查询
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public ResponseModel listPage(String pageNum, String pageSize, AlertCalled alertCalled) {
Page<AlertCalled> pageBean;
QueryWrapper<AlertCalled> alertCalledQueryWrapper = new QueryWrapper<>();
Class<? extends AlertCalled> aClass = alertCalled.getClass();
alertCalledQueryWrapper.eq("is_delete", 0);
alertCalledQueryWrapper.orderByDesc("call_time");
if (alertCalled.getCallTimeStart() != null && alertCalled.getCallTimeEnd() != null) {
alertCalledQueryWrapper.between("call_time", alertCalled.getCallTimeStart(), alertCalled.getCallTimeEnd());
}
if(alertCalled.getIsFatherAlert()) {
alertCalledQueryWrapper.isNull("father_alert");
}
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(alertCalled);
if (o != null) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(alertCalled);
alertCalledQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(alertCalled);
alertCalledQueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常");
}
});
IPage<AlertCalled> page;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = iAlertCalledService.page(pageBean, alertCalledQueryWrapper);
return CommonResponseUtil.success(page);
}
/**
* 列表无分页查询
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getList", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表无分页查询", notes = "列表无分页查询")
public ResponseModel list(AlertCalled alertCalled) {
QueryWrapper<AlertCalled> alertCalledQueryWrapper = new QueryWrapper<>();
Class<? extends AlertCalled> aClass = alertCalled.getClass();
alertCalledQueryWrapper.eq("is_delete", 0);
alertCalledQueryWrapper.orderByDesc("call_time");
if (alertCalled.getCallTimeStart() != null && alertCalled.getCallTimeEnd() != null) {
alertCalledQueryWrapper.between("call_time", alertCalled.getCallTimeStart(), alertCalled.getCallTimeEnd());
}
if(alertCalled.getIsFatherAlert()) {
alertCalledQueryWrapper.isNull("father_alert");
}
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(alertCalled);
if (o != null) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(alertCalled);
alertCalledQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(alertCalled);
alertCalledQueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常");
}
});
List<AlertCalled> list = iAlertCalledService.list(alertCalledQueryWrapper);
return CommonResponseUtil.success(list);
}
}
\ 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