Commit 5b6131e3 authored by 李成龙's avatar 李成龙

Merge branch 'developer' of http://172.16.10.76/moa/amos-boot-biz into developer

# Conflicts: # amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/controller/AlertCalledController.java
parents feaa75f8 709713e5
......@@ -5,6 +5,8 @@ import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
/**
* 基础DTO
* @author kinky
......@@ -24,4 +26,10 @@ public class BaseDto implements Serializable{
protected Date recDate;
@ApiModelProperty(value = "更新人")
protected String recUserId;
/**
* 是否删除
*/
@TableField(value = "is_delete")
private Boolean isDelete;
}
......@@ -19,11 +19,11 @@ public class RedisKey {
//根据消防人员id查询岗位学历信息工作经历
public static final String EDUCATION_POST_EXPERIENCE_FIREFIGHTERS_ID="education_post_experience_firefighters_id_";
//根据合同信id 查询合同信息
public static final String CONTRACT_ID="contract_id";
public static final String CONTRACT_ID="contract_id_";
//根据思想状况信息id 查询思想信息
public static final String THOUGHT_ID="thought_id";
public static final String THOUGHT_ID="thought_id_";
//根据警情id查询警情详情记录
public static final String ALERTCALLED_ID="alertcalled_id";
public static final String ALERTCALLED_ID="alertcalled_id_";
/** 驼峰转下划线(简单写法,效率低于{@link #humpToLine2(String)}) */
public static String humpToLine(String str) {
......
......@@ -25,6 +25,12 @@ spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=172.16.3.3:9300
spring.elasticsearch.rest.uris=http://172.16.3.3:9200
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.85:1883
emqx.user-name=super
emqx.password=a123456
security.systemctl.name=AMOS-API-SYSTEMCTL
......
package com.yeejoin.amos.boot.module.jcs.api.dto;
import java.io.Serializable;
import com.yeejoin.amos.component.rule.Label;
import com.yeejoin.amos.component.rule.RuleFact;
import lombok.Data;
/**
*
* <pre>
* 警情报送规则触发对象
* </pre>
*
* @author gwb
* @version $Id: AlertCalledRo.java, v 0.1 2021年6月24日 下午3:31:14 gwb Exp $
*/
@Data
@RuleFact(value = "警情信息",project = "西咸机场119接处警规则")
public class AlertCalledRo implements Serializable{
/**
* <pre>
*
* </pre>
*/
private static final long serialVersionUID = -8105736102662461646L;
@Label("警情id")
private Long sequenceNbr;
@Label(value = "警情类型")
private String alertType;
@Label(value = "警情类型code")
private String alertTypeCode;
}
......@@ -33,4 +33,13 @@ public class AlertFromDto extends BaseDto{
@ApiModelProperty(value = "操作人名称")
private String recUserName;
@ApiModelProperty(value = "是否一行显示")
private Boolean isBlock;
//新加排序字段
@ApiModelProperty(value = "排序字段")
private int sortNum;
public Boolean getIsBlock() {
return this.isBlock;
}
}
......@@ -53,6 +53,7 @@ public class AlertSubmittedDto extends BaseDto{
/**
* 报送内容
*/
@ApiModelProperty(value = "报送内容")
private JSONObject submitContent;
/**
......
......@@ -4,8 +4,18 @@ import com.yeejoin.amos.boot.module.jcs.api.vo.AlertCalledVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
* <pre>
* 警情信息ES请求参数对象
* </pre>
*
* @author gwb
* @version $Id: ESAlertCalledRequestDto.java, v 0.1 2021年6月24日 下午3:30:40 gwb Exp $
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ESAlertCalledRequestDto extends AlertCalledVo
{
@ApiModelProperty(value = "警情状态")
......
package com.yeejoin.amos.boot.module.jcs.api.dto;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* 消防dto
* 消防队伍下资源dto
*
* @author tb
* @author DELL
*/
@Data
@ApiModel(value="FireCarDto", description="消防车dto")
public class FireCarDto extends BaseDto {
public class FireBrigadeResourceDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "车辆id")
@ApiModelProperty(value = "资源id")
private String id;
@ApiModelProperty(value = "车辆名称")
@ApiModelProperty(value = "资源名称")
private String name;
@ApiModelProperty(value = "资源图片")
private String img;
@ApiModelProperty(value = "资源类型")
private String type;
@ApiModelProperty(value = "所属队伍id")
private String teamId;
......@@ -36,4 +43,19 @@ public class FireCarDto extends BaseDto {
@ApiModelProperty(value = "车辆状态描述")
private String carStateDesc;
@ApiModelProperty(value = "队伍下人员数量")
private int personCount;
@ApiModelProperty(value = "车辆类型")
private String chassisBrand;
@ApiModelProperty(value = "执勤车辆个数")
private Integer onDutyCount;
@ApiModelProperty(value = "出动车辆个数")
private Integer outCount;
@ApiModelProperty(value = "子资源节点")
private List<FireBrigadeResourceDto> children = Lists.newArrayList();
}
......@@ -71,5 +71,5 @@ public class FireTeamDto extends BaseDto {
private String outCount;
@ApiModelProperty(value = "队伍下车辆")
private List<FireCarDto> children;
private List<FireBrigadeResourceDto> children;
}
......@@ -44,7 +44,7 @@ public class AlertForm extends BaseEntity {
private String fieldValueCode;
@ApiModelProperty(value = "是否一行显示")
private boolean isBlock;
private Boolean isBlock;
//新加排序字段
@ApiModelProperty(value = "排序字段")
private int sortNum;
......
......@@ -15,6 +15,7 @@ public enum AlertBusinessTypeEnum {
/**
* 警情续报,非警情确认,警情结案
*/
警情初报("reportAlert", "297", "警情初报"),
警情续报("reportAlert", "313", "警情续报"),
非警情确认("notAlert", "314", "非警情确认"),
警情结案("endAlert", "315", "警情结案");
......
package com.yeejoin.amos.boot.module.jcs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jcs.api.dto.FireBrigadeResourceDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.jcs.api.vo.FireTeamListVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.FireTeamVo;
......@@ -34,4 +35,10 @@ public interface FireTeamMapper extends BaseMapper<FireTeam> {
+ "</script>")
Map<String, Long> getFireTeamCount(int pageNum, int pageSize, FireTeamListVo par);
/**
* 返回监控大队信息列表
*
* @return
*/
List<FireBrigadeResourceDto> listMonitorFireBrigade();
}
......@@ -2,6 +2,10 @@ package com.yeejoin.amos.boot.module.jcs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jcs.api.entity.OrgUsr;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
......@@ -18,4 +22,6 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
* @return
*/
String selectUpUnitByParam(@Param("biz_org_code")String biz_org_code);
List<Map<String, Object>> selectPersonList(Map<String, Object> map);
}
......@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted;
import com.yeejoin.amos.boot.module.jcs.api.vo.AlertSubmittedSMSVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.SchedulingReportingVo;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
/**
* 警情报送记录 服务类
......@@ -34,9 +35,10 @@ public interface IAlertSubmittedService extends IService<AlertSubmitted> {
* 警情报送保存
*
* @param alertSubmittedDto
* @param userName
* @return
*/
Boolean save(AlertSubmittedDto alertSubmittedDto);
Boolean save(AlertSubmittedDto alertSubmittedDto, String userName) throws Exception;
AlertSubmittedSMSVo getSchedulingContent(Long id);
}
package com.yeejoin.amos.boot.module.jcs.api.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.jcs.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.jcs.api.vo.FormValue;
import com.yeejoin.amos.boot.module.jcs.api.vo.OrgMenuVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.OrgUsrVo;
import java.util.Collection;
import java.util.List;
......@@ -15,12 +19,65 @@ import java.util.Map;
* @date 2021-06-18
*/
public interface IOrgUsrService {
/**
* 查询上级单位
* @param parent_id
* @return
*/
String selectUpUnitByParam(String parent_id);
/**
* 获取父级
* @param topId
* @param entityList
* @param packageURL
* @param IDMethodName
* @param IDHierarchy
* @param NAMEMethodName
* @param PARENTIDMethodName
* @param OrgTypeMethodName
* @return
* @throws Exception
*/
List<OrgMenuVo> getTree(Long topId, Collection entityList, String packageURL, String IDMethodName, int IDHierarchy,
String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName) throws Exception;
/**
* 获取子数据集合
* @param topId
* @param entityList
* @param packageURL
* @param IDMethodName
* @param IDHierarchy
* @param NAMEMethodName
* @param PARENTIDMethodName
* @param OrgTypeMethodName
* @return
* @throws Exception
*/
List<OrgMenuVo> getSub(Long topId, Collection entityList, String packageURL, String IDMethodName, int IDHierarchy,
String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName) throws Exception;
/**
* 组装融合调度单位人员信息
* @param ids
* @return
* @throws Exception
*/
List<Map<String, Object>> returnCompanyPersonMsg(List<Long> ids) throws Exception;
/**
* 获取动态表单数据
* @param queryWrapper
* @return
* @throws Exception
*/
List<FormValue> getFormValue(QueryWrapper queryWrapper) throws Exception;
/**
* 保存 机构/部门/人员基本信息
* @param
* @throws Exception
*/
void saveOrgUsr (OrgUsr oriOrgUsr,Long id) throws Exception;;
}
package com.yeejoin.amos.boot.module.jcs.api.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.jcs.api.dto.FireBrigadeResourceDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransfer;
import com.yeejoin.amos.boot.module.jcs.api.vo.PowerTransferCompanyVo;
......@@ -25,5 +26,5 @@ public interface IPowerTransferService extends IService<PowerTransfer> {
/**
* 获取力量调派资源树
*/
void getPowerTree();
List<FireBrigadeResourceDto> getPowerTree();
}
package com.yeejoin.amos.boot.module.jcs.api.vo;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
......@@ -8,34 +10,28 @@ import lombok.Data;
@Data
public class AlertSubmittedExtVo extends AlertSubmittedVo {
/**
* 主键
*/
@ApiModelProperty(value = "主键")
private Long sequenceNbr;
/**
* 记录主表id
*/
@ApiModelProperty(value = "记录主表id")
private Long alertSubmittedId;
/**
* 单位名称
*/
@ApiModelProperty(value = "单位名称")
private String companyName;
/**
* 人员名称
*/
@ApiModelProperty(value = "人员名称")
private String userName;
/**
* 电话号码
*/
@ApiModelProperty(value = "电话号码")
private String userPhone;
/**
* 通话时长
*/
@ApiModelProperty(value = "通话时长")
private String communicationTime;
@ApiModelProperty(value = "报送对象")
private String extraInfo;
@ApiModelProperty(value = "报送内容value")
private JSONObject submissionContentValue;
}
......@@ -52,8 +52,4 @@ public class OrgUsrDownloadTemplateVO {
@ApiModelProperty(value = "归属机构/部门/人员")
private String parentId;
@Excel(name = "amos中公司/部门ID",width = 30)
@ApiModelProperty(value = "扩展属性1")
private String orgExpandAttr1;
}
......@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
/**
......@@ -18,12 +19,14 @@ import java.util.List;
@Accessors(chain = true)
@TableName("cb_org_usr")
@ApiModel(value="OrgUsrVo", description="机构/部门/人员表")
public class OrgUsrFormVo {
public class OrgUsrFormVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "单位id")
private Long id;
@ApiModelProperty(value = "单位id")
protected Long sequenceNbr;
@ApiModelProperty(value = "单位名称")
private String currentUnit;
......@@ -31,6 +34,27 @@ public class OrgUsrFormVo {
@ApiModelProperty(value = "归属机构/部门")
private String parentId;
@ApiModelProperty(value = "机构/部门名称")
private String bizOrgName;
@ApiModelProperty(value = "机构编码")
private String bizOrgCode;
@ApiModelProperty(value = "amos中公司/部门ID")
private String amosOrgId;
@ApiModelProperty(value = "amos中公司/部门编码")
private String amosOrgCode;
@ApiModelProperty(value = "机构类型`")
private String bizOrgType;
@ApiModelProperty(value = "所属建筑名称")
private String buildName;
@ApiModelProperty(value = "所属建筑ID")
private String buildId;
private Integer personNum;
@ApiModelProperty(value = "动态表单值")
......
......@@ -31,6 +31,7 @@
<if test="alertSubmittedDto.businessTypeCode != null and alertSubmittedDto.businessTypeCode != ''">
and jas.business_type_code = #{alertSubmittedDto.businessTypeCode}
</if>
order by jas.submission_time desc
</select>
<select id="listReportingByParam" resultType="com.yeejoin.amos.boot.module.jcs.api.vo.AlertSubmittedExtVo">
select
......@@ -46,8 +47,8 @@
jas.submission_method_code,
jas.update_time,
jaso.sequence_nbr,
group_concat(distinct jaso.company_name) companyName,
group_concat(distinct jaso.user_name) userName
group_concat(distinct jaso.company_name Separator '、') companyName,
group_concat(distinct jaso.user_name Separator '、') userName
from jc_alert_submitted jas
left join jc_alert_submitted_object jaso on jas.sequence_nbr = jaso.alert_submitted_id
where 1=1
......@@ -60,7 +61,8 @@
<if test="alertSubmittedDto.businessTypeCode != null and alertSubmittedDto.businessTypeCode != ''">
and jas.business_type_code = #{alertSubmittedDto.businessTypeCode}
</if>
group by jaso.alert_submitted_id
group by jas.sequence_nbr, jas.submission_time
order by jas.submission_time desc
</select>
<select id="getSchedulingContent" resultType="com.yeejoin.amos.boot.module.jcs.api.vo.AlertSubmittedSMSVo">
......
......@@ -2,4 +2,16 @@
<!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.jcs.api.mapper.FireTeamMapper">
<select id="listMonitorFireBrigade" resultType="com.yeejoin.amos.boot.module.jcs.api.dto.FireBrigadeResourceDto">
SELECT
ft.sequence_nbr id,
ft.NAME,
ft.img,
COUNT( DISTINCT ff.sequence_nbr ) personCount
FROM
cb_fire_team ft
LEFT JOIN cb_firefighters ff ON ff.fire_team_id = ft.sequence_nbr
GROUP BY
ff.fire_team_id
</select>
</mapper>
......@@ -14,4 +14,23 @@
</if>
</select>
<select id="selectPersonList" resultType="Map">
SELECT
DISTINCT
u. sequence_nbr sequenceNbr,
u.biz_org_name bizOrgName,
u.biz_org_code bizOrgCode,
<if test="fields != null">
<foreach collection="fields" item="item" separator=",">MAX(case v.field_code when #{item} then v.field_value end) ${item}</foreach>
</if>
FROM
cb_org_usr u,
jc_alert_form_value v
LEFT JOIN jc_alert_form f ON f.sequence_nbr = v.alert_form_id
where u.sequence_nbr = v.alert_called_id
and v.alert_type_code = #{alertTypeCode}
LIMIT #{pageNum}, #{pageSize}
</select>
</mapper>
......@@ -30,7 +30,7 @@
left join jc_power_transfer pt on ptc.power_transfer_id = pt.sequence_nbr
right join jc_power_transfer_company_resources ptcr
on ptcr.power_transfer_company_id = ptc.sequence_nbr
where pt.alert_called_id = '63453543'
where pt.alert_called_id = #{alertCalledId}
and ptc.is_distribution_agencies = 0) r
group by company_name, type, rec_date
having rec_date = (select rec_date from jc_power_transfer_company_resources order by rec_date desc limit 1)
......
......@@ -6,7 +6,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.ESAlertCalledService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -44,7 +44,6 @@ import com.yeejoin.amos.boot.module.jcs.api.vo.AlertCalledVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.FormValue;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertFormValueServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.ESAlertCalledService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -258,7 +257,7 @@ public class AlertCalledController extends BaseController {
try {
field.setAccessible(true);
Object o = field.get(alertCalled);
if (o != null) {
if (o != null && !"serialVersionUID".equals(field.getName())) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
......@@ -270,7 +269,7 @@ public class AlertCalledController extends BaseController {
} else if (type.equals(Boolean.class)) {
Boolean fileValue = (Boolean) field.get(alertCalled);
queryWrapper.eq(name, fileValue);
}else if (type.equals(Long.class)) {
}else if (type.equals(Long.class) || "long".equals(type.toString())) {
Long fileValue = (Long) field.get(alertCalled);
queryWrapper.eq(name, fileValue);
}
......
......@@ -6,25 +6,33 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.*;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted;
import com.yeejoin.amos.boot.module.jcs.api.enums.SubmissionMethodEnum;
import com.yeejoin.amos.boot.module.jcs.api.vo.*;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.*;
import com.yeejoin.amos.boot.module.jcs.api.vo.AlertSubmittedSMSVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.SchedulingReportingVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.TemplateVo;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertSubmittedServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.PowerTransferServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.TemplateServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
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 javax.ws.rs.HEAD;
import java.lang.reflect.Field;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
/**
......@@ -58,14 +66,11 @@ public class AlertSubmittedController extends BaseController {
*
* @return
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增警情报送记录", notes = "新增警情报送记录")
public ResponseModel<Object> saveAlertSubmitted(HttpServletRequest request,
@RequestBody AlertSubmittedDto alertSubmittedDto) {
return ResponseHelper.buildResponse(alertSubmittedService.save(alertSubmittedDto));
public ResponseModel<Object> saveAlertSubmitted(@RequestBody AlertSubmittedDto alertSubmittedDto) throws Exception {
return ResponseHelper.buildResponse(alertSubmittedService.save(alertSubmittedDto, getUserInfo().getUserName()));
}
/**
......@@ -74,14 +79,12 @@ public class AlertSubmittedController extends BaseController {
* @param id
* @return
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public ResponseModel<Boolean> deleteById(HttpServletRequest request, @PathVariable Long id) {
public ResponseModel<Boolean> deleteById(@PathVariable Long id) {
return ResponseHelper.buildResponse(alertSubmittedService.removeById(id));
}
/**
......@@ -89,15 +92,12 @@ public class AlertSubmittedController extends BaseController {
*
* @return
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/updateById", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "修改警情报送记录", notes = "修改警情报送记录")
public ResponseModel<Boolean> updateByIdAlertSubmitted(HttpServletRequest request,
@RequestBody AlertSubmitted alertSubmitted) {
public ResponseModel<Boolean> updateByIdAlertSubmitted(@RequestBody AlertSubmitted alertSubmitted) {
return ResponseHelper.buildResponse(alertSubmittedService.updateById(alertSubmitted));
}
/**
......@@ -106,10 +106,10 @@ public class AlertSubmittedController extends BaseController {
* @param id
* @return
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@TycloudOperation( ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public ResponseModel<AlertSubmitted> selectById(HttpServletRequest request, @PathVariable Long id) {
public ResponseModel<AlertSubmitted> selectById(@PathVariable Long id) {
return ResponseHelper.buildResponse(alertSubmittedService.getById(id));
}
......@@ -126,7 +126,7 @@ public class AlertSubmittedController extends BaseController {
@ApiOperation(httpMethod = "POST", value = "根据警情id查询警情报送列表", notes = "根据警情id查询警情报送列表")
public ResponseModel<SchedulingReportingVo> listReportingByParam(@RequestBody AlertSubmittedDto queryParam) {
queryParam.setSubmissionMethodCode(SubmissionMethodEnum.PHONE.getCode());
queryParam.setSubmissionMethodCode(SubmissionMethodEnum.SMS.getCode());
return ResponseHelper.buildResponse(alertSubmittedService.listReportingByParam(queryParam));
}
......@@ -135,7 +135,7 @@ public class AlertSubmittedController extends BaseController {
*
* @return
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public IPage<AlertSubmitted> listPage(String pageNum, String pageSize, AlertSubmitted alertSubmitted) {
......
......@@ -44,7 +44,7 @@ public class AlertSubmittedObjectController extends BaseController {
* 新增报送对象
* @return
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增报送对象", notes = "新增报送对象")
public boolean saveAlertSubmittedObject(HttpServletRequest request, @RequestBody AlertSubmittedObject alertSubmittedObject){
......@@ -56,7 +56,7 @@ public class AlertSubmittedObjectController extends BaseController {
* @param id
* @return
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public boolean deleteById(HttpServletRequest request, @PathVariable Long id){
......@@ -67,7 +67,7 @@ public class AlertSubmittedObjectController extends BaseController {
* 修改报送对象
* @return
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/updateById", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "修改报送对象", notes = "修改报送对象")
public boolean updateByIdAlertSubmittedObject(HttpServletRequest request, @RequestBody AlertSubmittedObject alertSubmittedObject){
......@@ -79,7 +79,7 @@ public class AlertSubmittedObjectController extends BaseController {
* @param id
* @return
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public AlertSubmittedObject selectById(HttpServletRequest request, @PathVariable Long id){
......@@ -90,7 +90,7 @@ public class AlertSubmittedObjectController extends BaseController {
* 列表分页查询
* @return
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public IPage<AlertSubmittedObject> listPage(String pageNum,String pageSize, AlertSubmittedObject alertSubmittedObject){
......
......@@ -13,6 +13,8 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertFromValueDto;
import com.yeejoin.amos.boot.module.jcs.api.vo.AlertFormValueVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.OrgDepartmentFormVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.OrgMenuVo;
import org.apache.commons.lang3.StringUtils;
......@@ -108,17 +110,31 @@ public class OrgDepartmentController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "更新单位数据", notes = "更新单位数据")
public ResponseModel<Object> updateByIdOrgUsr(HttpServletRequest request, @RequestBody OrgDepartmentVo OrgDepartmentVo, @PathVariable Long id) {
// 修改人员信息
public ResponseModel<Object> updateByIdOrgUsr(HttpServletRequest request, @RequestBody OrgDepartmentVo OrgDepartmentVo, @PathVariable Long id) throws Exception {
// 修改部门信息
OrgUsr orgUsr = new OrgUsr();
BeanUtils.copyProperties(OrgDepartmentVo,orgUsr);
iOrgUsrService.updateById(orgUsr);
OrgUsr oriOrgUsr = iOrgUsrService.getById(id);
BeanUtils.copyProperties(OrgDepartmentVo, orgUsr);
iOrgUsrService.saveOrgUsr(oriOrgUsr,id);
// 动态表单
List<AlertFormValue> alertFromValuelist = OrgDepartmentVo.getAlertFormValue();
// 填充主键
alertFromValuelist.stream().forEach(alertFromValue -> {
alertFromValue.setAlertCalledId(orgUsr.getSequenceNbr());
});
List<AlertFromValueDto> formList = iAlertFromValueService.queryByCalledId(orgUsr.getSequenceNbr());
for (AlertFormValue dis : alertFromValuelist) {
for (AlertFromValueDto src : formList) {
if (dis.getAlertFormId() == src.getAlertFormId()) {
dis.setSequenceNbr(src.getSequenceNbr());
dis.setRecDate(new Date());
dis.setRecUserId(oriOrgUsr.getRecUserId());
dis.setRecUserName(oriOrgUsr.getRecUserName());
break;
}
}
}
// 保存动态表单数据
iAlertFromValueService.updateBatchById(alertFromValuelist);
return ResponseHelper.buildResponse(null);
......@@ -134,24 +150,26 @@ public class OrgDepartmentController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取部门详情", notes = "获取部门详情")
public ResponseModel<OrgDepartmentFormVo> selectById(HttpServletRequest request, @PathVariable Long id) {
public ResponseModel<OrgDepartmentFormVo> selectById(HttpServletRequest request, @PathVariable Long id) throws Exception {
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
OrgUsr orgUsr = iOrgUsrService.getById(id);
queryWrapper.eq("alert_called_id", id);
// 动态表单数据
List<AlertFormValue> list = iAlertFromValueService.list(queryWrapper);
List<FormValue> formValue = new ArrayList<FormValue>();
for (AlertFormValue alertFormValue : list) {
if (alertFormValue.getFieldValueCode() == null){
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), "text", alertFormValue.getFieldValue(), alertFormValue.getIsBlock());
List<AlertFormValueVo> list = iAlertFromValueService.listByCalledId(id);
List<FormValue> formValue = new ArrayList();
for (AlertFormValueVo alertFormValue : list) {
if (alertFormValue.getFieldValueCode() == null) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), alertFormValue.getFieldType(),
alertFormValue.getFieldValue(), alertFormValue.getIsBlock());
formValue.add(value);
}else {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), "text", alertFormValue.getFieldValueCode(), alertFormValue.getIsBlock());
} else {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), alertFormValue.getFieldType(),
alertFormValue.getFieldValueCode(), alertFormValue.getIsBlock());
formValue.add(value);
}
}
OrgDepartmentFormVo orgDepartmentFormVo = new OrgDepartmentFormVo();
BeanUtils.copyProperties(orgUsr,orgDepartmentFormVo);
BeanUtils.copyProperties(orgUsr, orgDepartmentFormVo);
orgDepartmentFormVo.setDynamicFormAlert(formValue);
return ResponseHelper.buildResponse(orgDepartmentFormVo);
}
......@@ -165,7 +183,7 @@ public class OrgDepartmentController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/companyTree", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取部门树", notes = "获取部门树")
public ResponseModel< List<OrgMenuVo>> selectCompanyTree() throws Exception {
public ResponseModel<List<OrgMenuVo>> selectCompanyTree() throws Exception {
Map<String, Object> columnMap = new HashMap<>();
columnMap.put("is_delete", CommonConstant.IS_DELETE_00);
columnMap.put("biz_org_type", CommonConstant.BIZ_ORG_TYPE_DEPARTMENT);
......@@ -229,9 +247,9 @@ public class OrgDepartmentController {
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "download-template/", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "根据类型导出模板", notes = "根据类型导出模板")
public ResponseModel<Object> downloadTemplate(HttpServletResponse response, @RequestBody List<OrgUsrDownloadTemplateVO> OrgUsrDownloadTemplateVO) throws UnsupportedEncodingException {
@RequestMapping(value = "download-template", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "导出模板", notes = "导出模板")
public ResponseModel downloadTemplate(HttpServletResponse response, @RequestBody List<OrgUsrDownloadTemplateVO> OrgUsrDownloadTemplateVO) throws UnsupportedEncodingException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmss");
ExcelUtils.exportExcel(OrgUsrDownloadTemplateVO, "部门信息", "部门信息", OrgUsrDownloadTemplateVO.class, simpleDateFormat.format(new Date()) + ".xls", response);
return ResponseHelper.buildResponse(null);
......
......@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -110,17 +111,12 @@ public class OrgPersonController {
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "更新单位数据", notes = "更新单位数据")
public ResponseModel updateByIdOrgUsr(HttpServletRequest request, @RequestBody OrgPersonVo OrgPersonVo,
@PathVariable Long id) {
@PathVariable Long id) throws Exception {
// 修改人员信息
OrgUsr orgUsr = new OrgUsr();
OrgUsr oriOrgUsr = iOrgUsrService.getById(id);
BeanUtils.copyProperties(OrgPersonVo, orgUsr);
orgUsr.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON);
orgUsr.setSequenceNbr(id);
orgUsr.setRecDate(new Date());
orgUsr.setRecUserId(oriOrgUsr.getRecUserId());
orgUsr.setRecUserName(oriOrgUsr.getRecUserName());
iOrgUsrService.updateById(orgUsr);
iOrgUsrService.saveOrgUsr(oriOrgUsr,id);
// 动态表单
List<AlertFormValue> alertFromValuelist = OrgPersonVo.getAlertFormValue();
// 填充主键
......@@ -136,6 +132,7 @@ public class OrgPersonController {
dis.setRecDate(new Date());
dis.setRecUserId(oriOrgUsr.getRecUserId());
dis.setRecUserName(oriOrgUsr.getRecUserName());
dis.setAlertTypeCode(src.getAlertTypeCode());
break;
}
}
......@@ -179,6 +176,32 @@ public class OrgPersonController {
return ResponseHelper.buildResponse(orgUsrFormVo);
}
/**
* 根据id查询人员
*
* @param id
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/show/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取人员详情", notes = "获取人员详情")
public ResponseModel selectForShowById(HttpServletRequest request, @PathVariable Long id) {
OrgUsr orgUsr = iOrgUsrService.getById(id);
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", id);
// 动态表单数据
List<AlertFormValueVo> list = iAlertFromValueService.listByCalledId(id);
List<FormValue> formValue = new ArrayList();
Map<String, Object> result = Bean.BeantoMap(orgUsr);
for (AlertFormValueVo alertFormValue : list) {
result.put(alertFormValue.getFieldCode(), alertFormValue.getFieldValue());
}
return ResponseHelper.buildResponse(result);
}
/**
* 获取人员树
*
......@@ -206,43 +229,7 @@ public class OrgPersonController {
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public ResponseModel<Object> listPage(String pageNum, String pageSize, OrgUsr orgUsr) {
Page<OrgUsr> pageBean;
QueryWrapper<OrgUsr> orgUsrQueryWrapper = new QueryWrapper<>();
Class<? extends OrgUsr> aClass = orgUsr.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(orgUsr);
if (o != null) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(orgUsr);
orgUsrQueryWrapper.eq(name, fileValue);
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(orgUsr);
orgUsrQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(orgUsr);
orgUsrQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(orgUsr);
orgUsrQueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
}
});
IPage<OrgUsr> 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));
}
orgUsrQueryWrapper.eq("biz_org_type", CommonConstant.BIZ_ORG_TYPE_PERSON);
page = iOrgUsrService.page(pageBean, orgUsrQueryWrapper);
return ResponseHelper.buildResponse(page);
return ResponseHelper.buildResponse(iOrgUsrService.pagePerson(pageNum, pageSize, orgUsr));
}
/**
......@@ -274,11 +261,27 @@ public class OrgPersonController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/download-template", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "导出人员模板", notes = "导出人员模板")
public ResponseModel downloadTemplate(HttpServletResponse response) throws UnsupportedEncodingException {
public ResponseModel downloadTemplate(HttpServletResponse response, @RequestBody List<OrgUsrDownloadTemplateVO> OrgUsrDownloadTemplateVO) throws UnsupportedEncodingException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmss");
List<OrgUsrDownloadTemplateVO> OrgUsrDownloadTemplateVO = new ArrayList<>();
ExcelUtils.exportExcel(OrgUsrDownloadTemplateVO, "人员信息", "人员信息", OrgUsrDownloadTemplateVO.class,
simpleDateFormat.format(new Date()) + ".xls", response);
ExcelUtils.exportExcel(OrgUsrDownloadTemplateVO, "人员信息", "人员信息", OrgUsrDownloadTemplateVO.class, simpleDateFormat.format(new Date()) + ".xls", response);
return ResponseHelper.buildResponse(null);
}
// /**
// *
// *
// * @param orgCode
// * @return
// */
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @RequestMapping(value = "/{orgCode}/users", method = RequestMethod.GET)
// @ApiOperation(httpMethod = "GET", value = "根据orgCode查询人员", notes = "根据orgCode查询人员")
// public ResponseModel selectUsersByOrgCode(HttpServletRequest request, String pageNum, String pageSize, @PathVariable Long orgCode) {
// Map<String, Object> columnMap = new HashMap<>();
// columnMap.put("is_delete",CommonConstant.IS_DELETE_00);
// columnMap.put("biz_org_code", orgCode);
// columnMap.put("biz_org_type", CommonConstant.BIZ_ORG_TYPE_PERSON);
// return ResponseHelper.buildResponse( iOrgUsrService.listByMap(columnMap));
// }
}
......@@ -13,6 +13,8 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertFromValueDto;
import com.yeejoin.amos.boot.module.jcs.api.vo.AlertFormValueVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.OrgMenuVo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
......@@ -111,17 +113,30 @@ public class OrgUsrController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "更新单位数据", notes = "更新单位数据")
public ResponseModel updateByIdOrgUsr(HttpServletRequest request, @RequestBody OrgUsrVo OrgUsrVo, @PathVariable Long id) {
public ResponseModel updateByIdOrgUsr(HttpServletRequest request, @RequestBody OrgUsrVo OrgUsrVo, @PathVariable Long id) throws Exception {
// 修改单位信息
OrgUsr orgUsr = new OrgUsr();
BeanUtils.copyProperties(OrgUsrVo,orgUsr);
iOrgUsrService.updateById(orgUsr);
OrgUsr oriOrgUsr = iOrgUsrService.getById(id);
BeanUtils.copyProperties(OrgUsrVo, orgUsr);
iOrgUsrService.saveOrgUsr(oriOrgUsr,id);
// 动态表单
List<AlertFormValue> alertFromValuelist = OrgUsrVo.getAlertFormValue();
// 填充主键
alertFromValuelist.stream().forEach(alertFromValue -> {
alertFromValue.setAlertCalledId(orgUsr.getSequenceNbr());
});
List<AlertFromValueDto> formList = iAlertFromValueService.queryByCalledId(orgUsr.getSequenceNbr());
for (AlertFormValue dis : alertFromValuelist) {
for (AlertFromValueDto src : formList) {
if (dis.getAlertFormId() == src.getAlertFormId()) {
dis.setSequenceNbr(src.getSequenceNbr());
dis.setRecDate(new Date());
dis.setRecUserId(oriOrgUsr.getRecUserId());
dis.setRecUserName(oriOrgUsr.getRecUserName());
break;
}
}
}
// 保存动态表单数据
iAlertFromValueService.updateBatchById(alertFromValuelist);
return ResponseHelper.buildResponse(null);
......@@ -137,19 +152,21 @@ public class OrgUsrController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取单位详情", notes = "获取单位详情")
public ResponseModel selectById(HttpServletRequest request, @PathVariable Long id) {
public ResponseModel selectById(HttpServletRequest request, @PathVariable Long id) throws Exception {
OrgUsr orgUsr = iOrgUsrService.getById(id);
QueryWrapper queryWrapper = new QueryWrapper<OrgUsr>();
queryWrapper.eq("alert_called_id", id);
// 动态表单数据
List<AlertFormValue> list = iAlertFromValueService.list(queryWrapper);
List<AlertFormValueVo> list = iAlertFromValueService.listByCalledId(id);
List<FormValue> formValue = new ArrayList();
for (AlertFormValue alertFormValue : list) {
if (alertFormValue.getFieldValueCode() == null){
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), "text", alertFormValue.getFieldValue(), alertFormValue.getIsBlock());
for (AlertFormValueVo alertFormValue : list) {
if (alertFormValue.getFieldValueCode() == null) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), alertFormValue.getFieldType(),
alertFormValue.getFieldValue(), alertFormValue.getIsBlock());
formValue.add(value);
}else {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), "text", alertFormValue.getFieldValueCode(), alertFormValue.getIsBlock());
} else {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), alertFormValue.getFieldType(),
alertFormValue.getFieldValueCode(), alertFormValue.getIsBlock());
formValue.add(value);
}
}
......@@ -298,8 +315,8 @@ public class OrgUsrController extends BaseController {
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "download-template/{type}", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "根据类型导出模板", notes = "根据类型导出模板")
@RequestMapping(value = "download-template", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "导出模板", notes = "导出模板")
public ResponseModel downloadTemplate(HttpServletResponse response, @RequestBody List<OrgUsrDownloadTemplateVO> OrgUsrDownloadTemplateVO) throws UnsupportedEncodingException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmss");
ExcelUtils.exportExcel(OrgUsrDownloadTemplateVO, "单位信息", "单位信息", OrgUsrDownloadTemplateVO.class, simpleDateFormat.format(new Date()) + ".xls", response);
......
......@@ -181,8 +181,7 @@ public class PowerTransferController extends BaseController {
@GetMapping(value = "/power/tree")
@ApiOperation(value = "力量调派资源树", notes = "力量调派资源树")
public ResponseModel<Object> getPowerTree() {
powerTransferService.getPowerTree();
return ResponseHelper.buildResponse("");
return ResponseHelper.buildResponse(powerTransferService.getPowerTree());
}
}
package com.yeejoin.amos.boot.module.jcs.biz.rule.action;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo;
import com.yeejoin.amos.component.rule.RuleActionBean;
import com.yeejoin.amos.component.rule.RuleMethod;
import com.yeejoin.amos.feign.systemctl.Systemctl;
/**
*
* <pre>
* 警情报送规则动作
* </pre>
*
* @author gwb
* @version $Id: AlertCalledAction.java, v 0.1 2021年6月24日 下午4:41:22 gwb Exp $
*/
@Component
@RuleActionBean(beanLabel = "警情报送" )
public class AlertCalledAction {
public static final Logger log = LoggerFactory.getLogger(AlertCalledAction.class);
@PostConstruct
public void init() throws Exception
{
System.out.println();
}
public void sendSysMessage(String msgType, AlertCalledRo contingency) {
// ContingencyRo ro = (ContingencyRo)contingency;
// ro.setTelemetryMap(null);
// ro.setTelesignallingMap(null);
// Constructor<?> constructor;
// try {
// constructor = Class.forName(
// PACKAGEURL + result.getClass().getSimpleName() + "Message")
// .getConstructor(ActionResult.class);
// AbstractActionResultMessage<?> action = (AbstractActionResultMessage<?>) constructor.newInstance(result);
// ToipResponse toipResponse = action.buildResponse(msgType, contingency, result.toJson());
// String topic = String.format("/%s/%s/%s", serviceName, stationName,"numberPlan");
// log.info(String.format("mqtt[%s]:【 %s 】", topic, toipResponse.toJsonStr()));
// webMqttComponent.publish(topic, toipResponse.toJsonStr());
// ContingencyEvent event = new ContingencyEvent(this);
// event.setMsgBody(toipResponse.toJsonStr());
// event.setTopic(topic);
// event.setMsgType(msgType);
// event.setContingency(contingency);
// contingencyLogPublisher.publish(event);
//
// } catch (Exception e) {
// e.printStackTrace();
// }
}
/**
*
* <pre>
* 短信报送
* </pre>
*
* @param smsTemp
* @param sendType
* @param sendIds
* @param alertCalledRo
*/
@RuleMethod(methodLabel = "短信报送", project = "西咸机场119接处警规则")
public void sendcmd(String smsTemp, String sendType, String sendIds, Object object) {
AlertCalledRo alertCalledRo = (AlertCalledRo)object;
HashMap<String, String> smsParams = new HashMap<String, String>();
smsParams.put("smsType", "MOBILE_REGISTER");
smsParams.put("mobile", "15191462503");
Systemctl.smsClient.sendVerifyCode(smsParams);
// ContingencyRo ro = (ContingencyRo)contingency;
// ro.setTelemetryMap(null);
// ro.setTelesignallingMap(null);
// Constructor<?> constructor;
// try {
// constructor = Class.forName(
// PACKAGEURL + result.getClass().getSimpleName() + "Message")
// .getConstructor(ActionResult.class);
// AbstractActionResultMessage<?> action = (AbstractActionResultMessage<?>) constructor.newInstance(result);
// if ("mqtt".equals(pushType.toLowerCase())) {
// ToipResponse toipResponse = action.buildResponse(msgType, contingency, result.toJson());
// String topic = String.format("/%s/%s/%s", serviceName, stationName,"plan");
// log.info(String.format("mqtt[%s]:【 %s 】", topic, toipResponse.toJsonStr()));
// webMqttComponent.publish(topic, toipResponse.toJsonStr());
//
// ContingencyEvent event = new ContingencyEvent(this);
// event.setMsgBody(toipResponse.toJsonStr());
// event.setTopic(topic);
// event.setMsgType(msgType);
// event.setContingency(contingency);
// contingencyLogPublisher.publish(event);
// } else if ("websocket".equals(pushType.toLowerCase())){
// action.execute(msgType, contingency);
// }
//
// } catch (Exception e) {
// e.printStackTrace();
// }
}
}
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
......@@ -17,6 +19,8 @@ import com.yeejoin.amos.boot.module.jcs.api.mapper.AlertCalledMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertCalledService;
import com.yeejoin.amos.boot.module.jcs.api.vo.AlertCalledVo;
import javax.annotation.Resource;
/**
* 警情接警记录 服务实现类
*
......@@ -28,7 +32,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
@Autowired
RedisUtils redisUtils;
@Autowired
@Resource
AlertCalledMapper alertCalledMapper;
@Autowired
......@@ -37,6 +41,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
@Autowired
private ESAlertCalledService eSAlertCalledService;
@Autowired
RuleAlertCalledService ruleAlertCalledService;
/**
*
* <pre>
......@@ -46,11 +52,12 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
* @param alertCalledVo
* @return
*/
public AlertCalledVo createAlertCalled(AlertCalledVo alertCalledVo) throws Exception {
@Transactional
public AlertCalledVo createAlertCalled(AlertCalledVo alertCalledVo) {
try {
// 警情基本信息
AlertCalled alertCalled = alertCalledVo.getAlertCalled();
alertCalled.setCallTime(new Date());
// 判断是否归并警情
if (alertCalled.getFatherAlert() != null) {
// 警情归并,设置当前警情状态为结束。
......@@ -58,15 +65,18 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
alertCalled.setAlertStage(AlertStageEnums.JQJB.getValue());
alertCalled.setAlarmType(AlertStageEnums.JQGB.getValue());
alertCalled.setAlarmTypeCode(AlertStageEnums.JQGB.getCode());
this.save(alertCalled);
} else {
// 警情报送
// ****************************************************待确认开发
alertCalled.setAlertStage(AlertStageEnums.LLDP.getValue());
alertCalled.setAlarmType(AlertStageEnums.JQCB.getValue());
alertCalled.setAlarmTypeCode(AlertStageEnums.JQCB.getCode());
}
this.save(alertCalled);
//调用规则
ruleAlertCalledService.fireAlertCalledRule(new AlertCalledVo(alertCalled,null));
}
// 动态表单
List<AlertFormValue> alertFormValuelist = alertCalledVo.getAlertFormValue();
// 填充警情主键
......@@ -83,6 +93,9 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
eSAlertCalledService.saveAlertCalledToES(alertCalled);
return alertCalledVo;
} catch (Exception e) {
throw new RuntimeException("报送失败,系统异常!");
}
}
......@@ -91,6 +104,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
* type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案
* */
@Override
@Transactional
public boolean updateAlertCalled(Long id, String code) {
// TODO Auto-generated method stub
try {
......
......@@ -5,6 +5,8 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -43,7 +45,7 @@ public class AlertFormServiceImpl extends BaseService<AlertFromDto,AlertForm,Ale
for (AlertForm alertFrom : alertFormValue) {
if(alertFrom.getFieldType().equals("string")||alertFrom.getFieldType().equals("date")||alertFrom.getFieldType().equals("textarea")) {
AlertFormVo vo = new AlertFormVo(alertFrom.getFieldCode(), alertFrom.getFieldName(), alertFrom.getFieldType(), null,
new AlertFormValue(alertFrom.getSequenceNbr(),alertFrom.getFieldName(), alertFrom.getFieldCode(),alertFrom.isBlock()));
new AlertFormValue(alertFrom.getSequenceNbr(),alertFrom.getFieldName(), alertFrom.getFieldCode(),alertFrom.getIsBlock()));
listfrom.add(vo);
}else {
// 查询数据项
......@@ -52,7 +54,7 @@ public class AlertFormServiceImpl extends BaseService<AlertFromDto,AlertForm,Ale
queryWrappercolumnMap.orderByAsc("sort_num");
Collection<DataDictionary> listDataDictionary = iDataDictionaryService.list(queryWrappercolumnMap);
AlertFormVo vo = new AlertFormVo(alertFrom.getFieldCode(), alertFrom.getFieldName(), alertFrom.getFieldType(),
new Items(getdata(listDataDictionary)), new AlertFormValue(alertFrom.getSequenceNbr(),alertFrom.getFieldName(), alertFrom.getFieldCode(),alertFrom.isBlock()));
new Items(getdata(listDataDictionary)), new AlertFormValue(alertFrom.getSequenceNbr(),alertFrom.getFieldName(), alertFrom.getFieldCode(),alertFrom.getIsBlock()));
listfrom.add(vo);
}
}
......@@ -69,4 +71,12 @@ public class AlertFormServiceImpl extends BaseService<AlertFromDto,AlertForm,Ale
}
return listAlertListvalue;
}
public List<String> queryListByFormId(String typeCode) {
return this.queryListByTypeCode(typeCode).stream().map(c -> c.getFieldCode()).collect(Collectors.toList());
}
private List<AlertFromDto> queryListByTypeCode(String alertTypeCode) {
return this.queryForList(null, false, alertTypeCode);
}
}
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.*;
import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateExtendDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmittedObject;
import com.yeejoin.amos.boot.module.jcs.api.entity.DataDictionary;
import com.yeejoin.amos.boot.module.jcs.api.entity.Template;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertBusinessTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSchedulingTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSubmitTypeEnum;
......@@ -12,19 +18,27 @@ import com.yeejoin.amos.boot.module.jcs.api.enums.SubmissionMethodEnum;
import com.yeejoin.amos.boot.module.jcs.api.mapper.AlertSubmittedMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertSubmittedObjectService;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertSubmittedService;
import com.yeejoin.amos.boot.module.jcs.api.vo.*;
import org.springframework.beans.BeanUtils;
import com.yeejoin.amos.boot.module.jcs.api.vo.AlertCalledVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.AlertSubmittedExtVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.AlertSubmittedSMSVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.FormValue;
import com.yeejoin.amos.boot.module.jcs.api.vo.PowerTransferCompanyVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.SchedulingReportingVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.TemplateVo;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.Optional;
import java.util.stream.Collectors;
/**
......@@ -48,6 +62,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto,Ale
TemplateServiceImpl templateService;
@Autowired
PowerTransferServiceImpl powerTransferService;
@Autowired
RuleAlertCalledService ruleAlertCalledService;
@Override
public SchedulingReportingVo listSchedulingByParam(AlertSubmittedDto queryParam) {
......@@ -73,33 +89,73 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto,Ale
public SchedulingReportingVo listReportingByParam(AlertSubmittedDto queryParam) {
SchedulingReportingVo schedulingReportingVo = new SchedulingReportingVo();
List<AlertSubmittedExtVo> alertSubmittedExtVoList = this.baseMapper.listReportingByParam(queryParam);
if (ObjectUtils.isNotEmpty(alertSubmittedExtVoList)) {
// 组装额外信息
String _extraInfo = "报送给%s、%s";
alertSubmittedExtVoList.forEach(alertSubmittedExtVo -> {
alertSubmittedExtVo.setExtraInfo(String.format(_extraInfo, alertSubmittedExtVo.getCompanyName(),
alertSubmittedExtVo.getUserName()));
TemplateExtendDto template = templateService.getByType(alertSubmittedExtVo.getBusinessTypeCode());
String richContent = template.getRichContent();
alertSubmittedExtVo.setSubmissionContentValue(JSONObject.parseObject(alertSubmittedExtVo.getSubmissionContent()));
alertSubmittedExtVo.setSubmissionContent(richContent);
});
schedulingReportingVo.setSchedulingReportingList(alertSubmittedExtVoList);
// TODO 填充短信报送内容
String extraInfo = String.format("已报送%d条", alertSubmittedExtVoList.size());
schedulingReportingVo.setExtraInfo(extraInfo);
}
return schedulingReportingVo;
}
@Override
public Boolean save(AlertSubmittedDto alertSubmittedDto) {
public Boolean save(AlertSubmittedDto alertSubmittedDto, String userName) throws Exception {
saveAlertSubmitted(alertSubmittedDto, userName);
// TODO 调用规则
ruleAlertCalledService.fireAlertCalledRule(new AlertCalledVo(null,null));
return true;
}
/**
* 规则回调
*/
public void ruleCallbackAction(Object obj) {
AlertSubmittedDto alertSubmittedDto = new AlertSubmittedDto();
alertSubmittedDto.setSubmissionMethodCode(SubmissionMethodEnum.SMS.getCode());
alertSubmittedDto.setSchedulingTypeCode(AlertSchedulingTypeEnum.融合调度.getCode());
// alertSubmittedDto.setBusinessTypeCode(AlertBusinessTypeEnum.警情初报.);
saveAlertSubmitted(alertSubmittedDto, "");
}
/**
* 短信报送
*
* @param alertSubmittedDto 警情信息
* @param userName 用户名
*/
public void saveAlertSubmitted(AlertSubmittedDto alertSubmittedDto, String userName) {
// 1.保存警情记录主表
AlertSubmitted alertSubmitted = new AlertSubmitted();
alertSubmitted.setAlertCalledId(alertSubmittedDto.getAlertCalledId());
alertSubmitted.setBusinessTypeCode(alertSubmittedDto.getBusinessTypeCode());
Optional<AlertBusinessTypeEnum> businessTypeEnum = EnumsUtils.getEnumObject(AlertBusinessTypeEnum.class,
e -> e.getCode().equals(alertSubmittedDto.getBusinessTypeCode()));
alertSubmitted.setBusinessType(businessTypeEnum.orElse(AlertBusinessTypeEnum.警情续报).getName());
alertSubmitted.setBusinessType(businessTypeEnum.get().getName());
alertSubmitted.setCallLogId(alertSubmittedDto.getCallLogId());
alertSubmitted.setSubmissionMethodCode(alertSubmittedDto.getSubmissionMethodCode());
Optional<SubmissionMethodEnum> submissionMethodEnum = EnumsUtils.getEnumObject(SubmissionMethodEnum.class,
e -> e.getCode().equals(alertSubmittedDto.getBusinessTypeCode()));
alertSubmitted.setSubmissionMethod(submissionMethodEnum.orElse(SubmissionMethodEnum.SMS).getName());
alertSubmitted.setSubmissionMethod(submissionMethodEnum.get().getName());
Optional<AlertSchedulingTypeEnum> alertSchedulingTypeEnum = EnumsUtils.getEnumObject(AlertSchedulingTypeEnum.class,
e -> e.getCode().equals(alertSubmittedDto.getBusinessTypeCode()));
alertSubmitted.setSchedulingTypeCode(alertSubmittedDto.getSchedulingTypeCode());
alertSubmitted.setSchedulingType(alertSchedulingTypeEnum.orElse(AlertSchedulingTypeEnum.融合调度).getName());
alertSubmitted.setSchedulingType(alertSchedulingTypeEnum.get().getName());
alertSubmitted.setSubmissionContent(alertSubmittedDto.getSubmitContent().toJSONString());
alertSubmitted.setSender(userName);
alertSubmitted.setRecUserName(userName);
alertSubmitted.setUpdateTime(new Date());
alertSubmitted.setSubmissionTime(new Date());
this.baseMapper.insert(alertSubmitted);
......@@ -113,6 +169,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto,Ale
alertSubmittedObject.setType(true);
alertSubmittedObject.setCompanyId(company.getCompanyId());
alertSubmittedObject.setCompanyName(company.getCompanyName());
alertSubmittedObject.setRecUserName(userName);
alertSubmittedObjectList.add(alertSubmittedObject);
});
......@@ -128,16 +185,21 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto,Ale
alertSubmittedObject.setUserId(person.getPersonId());
alertSubmittedObject.setUserName(person.getPersonName());
alertSubmittedObject.setUserPhone(person.getPersonPhone());
alertSubmittedObject.setRecUserName(userName);
alertSubmittedObjectList.add(alertSubmittedObject);
});
});
}
alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
// 3.发送任务消息
// 调用平台短信发送接口发送消息
return true;
// 3.更新警情状态
alertCalledService.updateAlertCalled(alertSubmittedDto.getAlertCalledId(),
alertSubmittedDto.getBusinessTypeCode());
// 4.发送任务消息
// 4.1组织短信内容
// 4.2调用短信发送接口
}
public void getAlertSubmittedContent(Long alertCalledId, ArrayList<TemplateVo> templateVos, String companyName) throws IllegalAccessException {
......@@ -153,9 +215,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto,Ale
Template template = templateService.getOne(new QueryWrapper<Template>().eq("type_code",
dataDictionary.getCode()));
List<PowerTransferCompanyVo> lastPowerTransferCompany;
powerTransferService.getLastPowerTransferCompany(alertCalledId);
if ("警情续报".equals(template.getType()) && (lastPowerTransferCompany =
powerTransferService.getLastPowerTransferCompany(alertCalledId)).size() > 0) {
map.put("businessType",template.getType());
// 获取力量调派内容
StringBuilder companyNames = new StringBuilder();
StringBuilder resourcesInfo = new StringBuilder();
......@@ -173,6 +235,11 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto,Ale
}
}
@Override
public AlertSubmittedSMSVo getSchedulingContent(Long id) {
return this.baseMapper.getSchedulingContent(id);
}
/**
* 将Object对象里面的属性和值转化成Map对象
*
......@@ -201,9 +268,4 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto,Ale
}
return map;
}
@Override
public AlertSubmittedSMSVo getSchedulingContent(Long id) {
return this.baseMapper.getSchedulingContent(id);
}
}
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.yeejoin.amos.boot.module.jcs.api.dto.FireBrigadeResourceDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.FireTeamDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.jcs.api.mapper.FireTeamMapper;
......@@ -36,4 +37,13 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam,FireT
return fireTeamMapper.getFireTeamCount( pageNum, pageSize, par) ;
}
/**
* 获取监控大队列表
*
* @return
*/
public List<FireBrigadeResourceDto> listMonitorFireBrigade() {
return fireTeamMapper.listMonitorFireBrigade();
}
}
......@@ -4,20 +4,29 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.yeejoin.amos.boot.module.jcs.api.dto.OrgUsrDto;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.jcs.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.IOrgUsrService;
import com.yeejoin.amos.boot.module.jcs.api.vo.FormValue;
import com.yeejoin.amos.boot.module.jcs.api.vo.OrgMenuVo;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -33,6 +42,8 @@ import java.util.Map;
public class OrgUsrServiceImpl extends BaseService<OrgUsrDto,OrgUsr,OrgUsrMapper> implements IOrgUsrService {
@Autowired
AlertFormValueServiceImpl alertFormValueServiceImpl;
@Autowired
AlertFormServiceImpl alertFormServiceImpl;
@Override
public String selectUpUnitByParam(String biz_org_code) {
......@@ -241,6 +252,74 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto,OrgUsr,OrgUsrMappe
}
return companyPersonMsg;
}
public IPage<Map<String, Object>> pagePerson(String pageNum, String pageSize, OrgUsr orgUsr) {
IPage<Map<String, Object>> pageBean = null;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
QueryWrapper<OrgUsr> orgUsrQueryWrapper = new QueryWrapper<>();
Class<? extends OrgUsr> aClass = orgUsr.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(orgUsr);
if (o != null) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(orgUsr);
orgUsrQueryWrapper.eq(name, fileValue);
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(orgUsr);
orgUsrQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(orgUsr);
orgUsrQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(orgUsr);
orgUsrQueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
}
});
pageBean.setTotal(this.baseMapper.selectCount(orgUsrQueryWrapper));
Map<String, Object> map = Bean.BeantoMap(orgUsr);
map.put("pageNum", (pageBean.getCurrent() -1) * pageBean.getSize());
map.put("pageSize", pageBean.getSize());
map.put("fields", alertFormServiceImpl.queryListByFormId("246"));
map.put("alertTypeCode", "246");
pageBean.setRecords(this.baseMapper.selectPersonList(map));
return pageBean;
}
@Override
public List<FormValue> getFormValue(QueryWrapper queryWrapper) throws Exception {
List<AlertFormValue> list = alertFormValueServiceImpl.list(queryWrapper);
List<FormValue> formValue = new ArrayList();
for (AlertFormValue alertFormValue : list) {
if (alertFormValue.getFieldValueCode() == null){
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), "text", alertFormValue.getFieldValue(), alertFormValue.getIsBlock());
formValue.add(value);
}else {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), "text", alertFormValue.getFieldValueCode(), alertFormValue.getIsBlock());
formValue.add(value);
}
}
return formValue;
}
@Override
public void saveOrgUsr(OrgUsr oriOrgUsr,Long id) throws Exception {
OrgUsr orgUsr = new OrgUsr();
orgUsr.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON);
orgUsr.setSequenceNbr(id);
orgUsr.setRecDate(new Date());
orgUsr.setRecUserId(oriOrgUsr.getRecUserId());
orgUsr.setRecUserName(oriOrgUsr.getRecUserName());
updateById(orgUsr);
}
}
......@@ -2,9 +2,7 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.jcs.api.dto.FireCarDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.FireTeamDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.FireBrigadeResourceDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyResourcesDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferDto;
......@@ -29,7 +27,6 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -115,46 +112,60 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
}
@Override
public void getPowerTree() {
public List<FireBrigadeResourceDto> getPowerTree() {
List<FireBrigadeResourceDto> fireBrigadeResourceList = Lists.newArrayList();
// 1.调用装备服务接口查询车辆列表
List<FireCarDto> fireCarDtoList = Lists.newArrayList();
List<FireBrigadeResourceDto> fireCarDtoList = Lists.newArrayList();
ResponseModel<Object> result = equipFeignService.getFireCarListAll();
if (!ObjectUtils.isEmpty(result)) {
List<Map<String, Object>> fireCarListMapList = (List<Map<String, Object>>) result.getResult();
fireCarListMapList.stream().filter(car -> ObjectUtils.isNotEmpty(car.get("teamId"))).forEach(car -> {
FireCarDto fireCarDto = (FireCarDto) Bean.mapToBean(car, FireCarDto.class);
FireBrigadeResourceDto fireCarDto = (FireBrigadeResourceDto) Bean.mapToBean(car, FireBrigadeResourceDto.class);
if (FireCarStatusEnum.onDuty.getCode().equals(fireCarDto.getCarState())) {
fireCarDto.setCarStateDesc(FireCarStatusEnum.onDuty.getName());
} else {
fireCarDto.setCarState(FireCarStatusEnum.out.getCode());
fireCarDto.setCarStateDesc(FireCarStatusEnum.out.getName());
}
fireCarDtoList.add(fireCarDto);
});
}
Long onDutyCarCount =
fireCarDtoList.stream().filter(car -> FireCarStatusEnum.onDuty.getCode().equals(car.getCarState())).count();
Long outCarCount = fireCarDtoList.size() - onDutyCarCount;
// 2.查询消防队伍列表
List<FireTeam> fullTimeFireBrigadeList = fireTeamService.list(new QueryWrapper<FireTeam>().eq("type_code",
FireBrigadeTypeEnum.专职消防队.getCode()));
List<FireTeam> monitorFireBrigadeList = fireTeamService.list(new QueryWrapper<FireTeam>().eq("type_code",
FireBrigadeTypeEnum.监控大队.getCode()));
// 3.组装专职消防队伍车辆
// List<FireTeamDto> fireTeamDtoList = Lists.newArrayList();
// if (!CollectionUtils.isEmpty(fullTimeFireBrigadeList)) {
// fullTimeFireBrigadeList.forEach(brigade -> {
// FireTeamDto teamDto = new FireTeamDto();
// BeanUtils.copyProperties(brigade, teamDto);
// teamDto.setType(FireBrigadeTypeEnum.专职消防队.getKey());
//
//// teamDto.setChildren();
// });
// }
fireCarDtoList.stream().collect(Collectors.groupingBy(FireCarDto::getTeamId));
try {
TreeParser.getTree(null, monitorFireBrigadeList, FireTeam.class.getName(), "getSequenceNbr", 2, "getName",
"getParent");
} catch (Exception e) {
e.printStackTrace();
Map<String, List<FireBrigadeResourceDto>> resultMap =
fireCarDtoList.stream().collect(Collectors.groupingBy(FireBrigadeResourceDto::getTeamId));
resultMap.keySet().forEach(brigadeId -> {
FireBrigadeResourceDto fireCarResourceDto = new FireBrigadeResourceDto();
FireTeam fireTeam =
fullTimeFireBrigadeList.stream().filter(team -> brigadeId.equals(team.getSequenceNbr().toString())).findAny().orElse(new FireTeam());
if (ObjectUtils.isNotEmpty(fireTeam.getSequenceNbr())) {
fireCarResourceDto.setId(fireTeam.getSequenceNbr().toString());
fireCarResourceDto.setType(FireBrigadeTypeEnum.专职消防队.getKey());
fireCarResourceDto.setName(fireTeam.getName());
fireCarResourceDto.getChildren().addAll(resultMap.get(brigadeId));
fireCarResourceDto.setOutCount(outCarCount.intValue());
fireCarResourceDto.setOnDutyCount(onDutyCarCount.intValue());
fireBrigadeResourceList.add(fireCarResourceDto);
}
});
// 3.消防队伍-监控大队
List<FireBrigadeResourceDto> monitorFireBrigadeList = fireTeamService.listMonitorFireBrigade();
FireBrigadeResourceDto monitorResourceDto = new FireBrigadeResourceDto();
monitorResourceDto.setId("0");
monitorResourceDto.setName(FireBrigadeTypeEnum.监控大队.getName());
monitorResourceDto.setType(FireBrigadeTypeEnum.监控大队.getKey());
monitorResourceDto.setChildren(monitorFireBrigadeList);
fireBrigadeResourceList.add(monitorResourceDto);
return fireBrigadeResourceList;
}
private List<PowerTransferCompanyResources> DtoEntityBatchConvert(List<PowerTransferCompanyResourcesDto> powerTransferCompanyResourcesDtoList, Long powerTransferCompanySequenceNbr) {
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.vo.AlertCalledVo;
import com.yeejoin.amos.component.rule.RuleTrigger;
/**
*
* <pre>
* 规则触发服务
* </pre>
*
* @author gwb
* @version $Id: RuleAlertCalledService.java, v 0.1 2021年6月24日 下午6:30:44 gwb Exp $
*/
@Service
public class RuleAlertCalledService {
@Autowired
private RuleTrigger ruleTrigger;
/**
*
* <pre>
* 触发警情报送规则
* </pre>
*
* @param alertCalled
* @return
* @throws Exception
*/
public Boolean fireAlertCalledRule(AlertCalledVo alertCalledVo) throws Exception
{
AlertCalled alertCalled = alertCalledVo.getAlertCalled();
if (ValidationUtil.isEmpty(alertCalled))
{
throw new BadRequest("参数校验失败.");
}
//构建警情报送规则对象
AlertCalledRo alertCalledRo = new AlertCalledRo();
alertCalledRo.setSequenceNbr(alertCalled.getSequenceNbr());
alertCalledRo.setAlertType(alertCalled.getAlertType());
alertCalledRo.setAlertTypeCode(alertCalled.getAlertTypeCode());
alertCalledRo.setAlertTypeCode("229");
//触发规则
ruleTrigger.publish(alertCalledRo, "西咸机场119接处警规则/alertCalledRule", new String[0]);
return true;
}
}
......@@ -12,11 +12,17 @@
<dependencies>
<!-- ES-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<!-- amos rule-->
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-rule</artifactId>
<version>1.4.7</version>
</dependency>
</dependencies>
......
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