Commit cf104b3a authored by tangwei's avatar tangwei

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

parents b8f573b1 575f4188
...@@ -10,20 +10,14 @@ import lombok.Data; ...@@ -10,20 +10,14 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
/** /**
* * @author system_generator
* * @date 2021-06-25
* @author system_generator */
* @date 2021-06-25
*/
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value="FireExpertsDto", description="") @ApiModel(value = "FireExpertsDto", description = "")
public class FireExpertsDto extends BaseDto { public class FireExpertsDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "姓名") @ApiModelProperty(value = "姓名")
private String name; private String name;
...@@ -32,7 +26,7 @@ public class FireExpertsDto extends BaseDto { ...@@ -32,7 +26,7 @@ public class FireExpertsDto extends BaseDto {
@ApiModelProperty(value = "证件类型code") @ApiModelProperty(value = "证件类型code")
private String certificatesTypeCode; private String certificatesTypeCode;
@ApiModelProperty(value = "证件号") @ApiModelProperty(value = "证件号")
private Long certificatesNum; private Long certificatesNum;
...@@ -51,6 +45,9 @@ public class FireExpertsDto extends BaseDto { ...@@ -51,6 +45,9 @@ public class FireExpertsDto extends BaseDto {
@ApiModelProperty(value = "现居住地") @ApiModelProperty(value = "现居住地")
private String residence; private String residence;
@ApiModelProperty(value = "现居住地")
private String residenceDetails;
@ApiModelProperty(value = "政治面貌") @ApiModelProperty(value = "政治面貌")
private String politicalOutlook; private String politicalOutlook;
...@@ -89,10 +86,10 @@ public class FireExpertsDto extends BaseDto { ...@@ -89,10 +86,10 @@ public class FireExpertsDto extends BaseDto {
@ApiModelProperty(value = "消防机构id") @ApiModelProperty(value = "消防机构id")
private Long fireTeamId; private Long fireTeamId;
@ApiModelProperty(value = "消防机构name") @ApiModelProperty(value = "消防机构name")
private Long fireTeamName; private Long fireTeamName;
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String note; private String note;
...@@ -105,4 +102,7 @@ public class FireExpertsDto extends BaseDto { ...@@ -105,4 +102,7 @@ public class FireExpertsDto extends BaseDto {
@ApiModelProperty(value = "出生日期") @ApiModelProperty(value = "出生日期")
private Date birthdayTime; private Date birthdayTime;
@ApiModelProperty(value = "年龄")
private Integer age;
} }
package com.yeejoin.amos.boot.module.common.api.entity; package com.yeejoin.amos.boot.module.common.api.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date; import java.util.Date;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
/** /**
* * @author system_generator
* * @date 2021-06-25
* @author system_generator */
* @date 2021-06-25
*/
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Accessors(chain = true) @Accessors(chain = true)
@TableName("cb_fire_experts") @TableName("cb_fire_experts")
@ApiModel(value="FireExperts对象", description="") @ApiModel(value = "FireExperts对象", description = "")
public class FireExperts extends BaseEntity { public class FireExperts extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "姓名") @ApiModelProperty(value = "姓名")
private String name; private String name;
...@@ -51,6 +49,9 @@ public class FireExperts extends BaseEntity { ...@@ -51,6 +49,9 @@ public class FireExperts extends BaseEntity {
@ApiModelProperty(value = "现居住地") @ApiModelProperty(value = "现居住地")
private String residence; private String residence;
@ApiModelProperty(value = "现居住地")
private String residenceDetails;
@ApiModelProperty(value = "政治面貌") @ApiModelProperty(value = "政治面貌")
private String politicalOutlook; private String politicalOutlook;
......
...@@ -19,19 +19,24 @@ import lombok.Data; ...@@ -19,19 +19,24 @@ import lombok.Data;
@RuleFact(value = "警情信息",project = "西咸机场119接处警规则") @RuleFact(value = "警情信息",project = "西咸机场119接处警规则")
public class AlertCalledRo implements Serializable{ public class AlertCalledRo implements Serializable{
/**
/**
* <pre> * <pre>
* *
* </pre> * </pre>
*/ */
private static final long serialVersionUID = -9034974124471572825L; private static final long serialVersionUID = 7091835997817930383L;
/** /**
* 通用属性 * 通用属性
*/ */
@Label("警情id") @Label("警情id")
private String sequenceNbr; private String sequenceNbr;
@Label(value = "警情时间")
private String callTimeStr;
@Label(value = "警情类型") @Label(value = "警情类型")
private String alertType; private String alertType;
...@@ -39,8 +44,8 @@ public class AlertCalledRo implements Serializable{ ...@@ -39,8 +44,8 @@ public class AlertCalledRo implements Serializable{
@Label(value = "警情类型code") @Label(value = "警情类型code")
private String alertTypeCode; private String alertTypeCode;
@Label(value = "事发单位") @Label(value = "发送单位")
private String unitInvolved; private String companyName;
@Label(value = "被困人数") @Label(value = "被困人数")
private String trappedNum; private String trappedNum;
......
...@@ -15,5 +15,17 @@ ...@@ -15,5 +15,17 @@
<artifactId>amos-boot-module-common-api</artifactId> <artifactId>amos-boot-module-common-api</artifactId>
<version>${amos-biz-boot.version}</version> <version>${amos-biz-boot.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-jcs-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-jcs-biz</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>
package com.yeejoin.amos.boot.module.common.biz.controller; package com.yeejoin.amos.boot.module.common.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.utils.*;
import com.yeejoin.amos.boot.module.common.api.entity.FireExperts;
import com.yeejoin.amos.boot.module.common.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.boot.module.jcs.api.entity.DataDictionary;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.DataDictionaryServiceImpl;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List; import java.util.*;
import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FireExpertsServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.FireExpertsServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
...@@ -35,6 +43,12 @@ public class FireExpertsController extends BaseController { ...@@ -35,6 +43,12 @@ public class FireExpertsController extends BaseController {
@Autowired @Autowired
FireExpertsServiceImpl fireExpertsServiceImpl; FireExpertsServiceImpl fireExpertsServiceImpl;
@Autowired
RedisUtils redisUtils;
@Autowired
DataDictionaryServiceImpl dataDictionaryService;
/** /**
* 新增 * 新增
* *
...@@ -73,7 +87,9 @@ public class FireExpertsController extends BaseController { ...@@ -73,7 +87,9 @@ public class FireExpertsController extends BaseController {
@DeleteMapping(value = "/{sequenceNbr}") @DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除")
public ResponseModel<Boolean> deleteBySequenceNbr(@PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<Boolean> deleteBySequenceNbr(@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(fireExpertsServiceImpl.removeById(sequenceNbr)); FireExperts fireExperts = fireExpertsServiceImpl.getById(sequenceNbr);
fireExperts.setIsDelete(true);
return ResponseHelper.buildResponse(fireExpertsServiceImpl.updateById(fireExperts));
} }
/** /**
...@@ -85,26 +101,66 @@ public class FireExpertsController extends BaseController { ...@@ -85,26 +101,66 @@ public class FireExpertsController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}") @GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个") @ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个")
public ResponseModel<FireExpertsDto> selectOne(@PathVariable Long sequenceNbr) { public ResponseModel<FireExpertsDto> selectOne(@PathVariable Long sequenceNbr) throws Exception {
return ResponseHelper.buildResponse(fireExpertsServiceImpl.queryBySeq(sequenceNbr)); FireExpertsDto fireExpertsDto = fireExpertsServiceImpl.queryBySeq(sequenceNbr);
Date birthdayTime = fireExpertsDto.getBirthdayTime();
int age = BeanDtoVoUtils.getAge(birthdayTime);
fireExpertsDto.setAge(age);
return ResponseHelper.buildResponse(fireExpertsDto);
} }
/** /**
* 列表分页查询 * 列表分页查询
* *
* @param current 当前页 * @param current 当前页
* @param size 每页大小 * @param size 每页大小
* @param fireExpertsDto 查询参数
* @return 返回结果 * @return 返回结果
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page") @GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "分页查询", notes = "分页查询") @ApiOperation(httpMethod = "GET", value = "分页查询", notes = "分页查询")
public ResponseModel<Page<FireExpertsDto>> queryForPage(@RequestParam(value = "current") int current, public ResponseModel<IPage<FireExpertsDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) { @RequestParam(value = "size") int size,
Page<FireExpertsDto> page = new Page<>(); FireExpertsDto fireExpertsDto) {
page.setCurrent(current); FireExperts fireExperts = BeanDtoVoUtils.convert(fireExpertsDto, FireExperts.class);
page.setSize(size); Page<FireExperts> pageBean;
return ResponseHelper.buildResponse(fireExpertsServiceImpl.queryForFireExpertsPage(page)); QueryWrapper<FireExperts> fireExpertsQueryWrapper = new QueryWrapper<>();
Class<? extends FireExperts> aClass = fireExperts.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Class<?> type = field.getType();
Object o = field.get(fireExperts);
if (o != null) {
String name = NameUtils.camel2Underline(field.getName());
if ("name".equalsIgnoreCase(name)) {
String fileValue = (String) o;
fireExpertsQueryWrapper.like(name, fileValue);
} else if ("expert_code".equalsIgnoreCase(name)) {
String fileValue = (String) o;
fireExpertsQueryWrapper.eq(name, fileValue);
} else if (type.equals(Integer.class)) {
Integer fileValue = (Integer) o;
fireExpertsQueryWrapper.eq(name, fileValue);
} else if (type.equals(Long.class)) {
Long fileValue = (Long) o;
fireExpertsQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) o;
fireExpertsQueryWrapper.like(name, fileValue);
}
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常");
}
});
IPage<FireExperts> page;
pageBean = new Page<>(current, size);
page = fireExpertsServiceImpl.page(pageBean, fireExpertsQueryWrapper);
IPage<FireExpertsDto> fireExpertsDtoIPage = BeanDtoVoUtils.iPageDtoStreamFireExperts(page);
return ResponseHelper.buildResponse(fireExpertsDtoIPage);
} }
/** /**
...@@ -116,6 +172,33 @@ public class FireExpertsController extends BaseController { ...@@ -116,6 +172,33 @@ public class FireExpertsController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "列表全部数据查询", notes = "列表全部数据查询") @ApiOperation(httpMethod = "GET", value = "列表全部数据查询", notes = "列表全部数据查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public ResponseModel<List<FireExpertsDto>> selectForList() { public ResponseModel<List<FireExpertsDto>> selectForList() {
return ResponseHelper.buildResponse(fireExpertsServiceImpl.queryForFireExpertsList()); List<FireExpertsDto> fireExpertsDtoList = fireExpertsServiceImpl.queryForFireExpertsList();
fireExpertsDtoList.stream().map(item -> {
item.setAge(BeanDtoVoUtils.getAge(item.getBirthdayTime()));
return item;
}).collect(Collectors.toList());
return ResponseHelper.buildResponse(fireExpertsDtoList);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getExpertsTree", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取专家领域树", notes = "获取专家领域树")
public ResponseModel<Object> getExpertsTree() throws Exception {
String type = "ZJLY";
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
Collection<DataDictionary> list = dataDictionaryService.list(queryWrapper);
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
, "getParent");
Menu menu = new Menu(-1L, "专家领域", -1L, menus);
List<Menu> menuList = new ArrayList<>();
menuList.add(menu);
// 创建挂在主节点
return ResponseHelper.buildResponse(menuList);
}
} }
package com.yeejoin.amos.boot.module.common.biz.utils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.common.api.dto.FireExpertsDto;
import com.yeejoin.amos.boot.module.common.api.entity.FireExperts;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import java.util.Calendar;
import java.util.Date;
/**
* @title: 实体类 Dto,Vo,entity 转换工具类
* @Author fpy
* @Date: 2021/6/3 13:53
*/
@Component
public class BeanDtoVoUtils {
/**
* Dot ,Vo ,Entity 相互转换
*
* @param source 原数据
* @param targetClass 目标类
* @param <T> 泛型类
* @return 转换返回值
*/
public static <T> T convert(Object source, Class<T> targetClass) {
// 判断source是否为空
if (source == null) {
return null;
}
// 判断targetClass是否为空
if (targetClass == null) {
return null;
}
try {
// 创建新的对象实例
T target = targetClass.newInstance();
// 把原对象数据拷贝到新对象
BeanUtils.copyProperties(source, target);
// 返回新对象
return target;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* Dot ,Vo ,Entity 相互转换
*
* @param source 原数据
* @return 转换返回值
*/
public static FireExpertsDto convertFireExperts(FireExperts source) {
// 判断source是否为空
if (source == null) {
return null;
}
try {
// 创建新的对象实例
FireExpertsDto target = FireExpertsDto.class.newInstance();
// 把原对象数据拷贝到新对象
BeanUtils.copyProperties(source, target);
// 计算年龄
int age = getAge(source.getBirthdayTime());
target.setAge(age);
// 返回新对象
return target;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* IPage<Entity> 分页对象转 Page<Dto>
*
* @param page 原分页对象
* @param v 目标vo类
* @param <E> 泛型类
* @param <V> 泛型类
* @return 转换后的分页对象
*/
public static <E, V> IPage<V> iPageDtoStream(IPage<E> page, Class<V> v) {
return page.convert(item -> {
try {
return convert(item, v);
} catch (Exception e) {
return null;
}
});
}
/**
* IPage<Entity> 分页对象转 Page<Dto>
*
* @param page 原分页对象
* @return 转换后的分页对象
*/
public static IPage<FireExpertsDto> iPageDtoStreamFireExperts(IPage<FireExperts> page) {
return page.convert(item -> {
try {
return convertFireExperts(item);
} catch (Exception e) {
return null;
}
});
}
//由出生日期获得年龄
public static int getAge(Date birthDay) {
Calendar cal = Calendar.getInstance();
if (cal.before(birthDay)) {
throw new IllegalArgumentException("出生日期小于当前时间,无效的日期!");
}
int yearNow = cal.get(Calendar.YEAR);
int monthNow = cal.get(Calendar.MONTH);
int dayOfMonthNow = cal.get(Calendar.DAY_OF_MONTH);
cal.setTime(birthDay);
int yearBirth = cal.get(Calendar.YEAR);
int monthBirth = cal.get(Calendar.MONTH);
int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH);
int age = yearNow - yearBirth;
if (monthNow <= monthBirth) {
if (monthNow == monthBirth) {
if (dayOfMonthNow < dayOfMonthBirth) age--;
} else {
age--;
}
}
return age;
}
}
\ No newline at end of file
...@@ -2,23 +2,16 @@ package com.yeejoin.amos.boot.module.jcs.biz.rule.action; ...@@ -2,23 +2,16 @@ package com.yeejoin.amos.boot.module.jcs.biz.rule.action;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertSubmittedServiceImpl;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.utils.StringUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo;
import com.yeejoin.amos.boot.module.jcs.api.entity.OrgUsr; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertSubmittedServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.component.rule.RuleActionBean; import com.yeejoin.amos.component.rule.RuleActionBean;
import com.yeejoin.amos.component.rule.RuleMethod; import com.yeejoin.amos.component.rule.RuleMethod;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
...@@ -38,9 +31,6 @@ public class AlertCalledAction { ...@@ -38,9 +31,6 @@ public class AlertCalledAction {
public static final Logger log = LoggerFactory.getLogger(AlertCalledAction.class); public static final Logger log = LoggerFactory.getLogger(AlertCalledAction.class);
@Autowired @Autowired
private OrgUsrServiceImpl orgUsrService;
@Autowired
private AlertSubmittedServiceImpl alertSubmittedService; private AlertSubmittedServiceImpl alertSubmittedService;
public void sendSysMessage(String msgType, AlertCalledRo contingency) { public void sendSysMessage(String msgType, AlertCalledRo contingency) {
......
...@@ -111,7 +111,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -111,7 +111,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
public Boolean save(AlertSubmittedDto alertSubmittedDto, String userName) throws Exception { public Boolean save(AlertSubmittedDto alertSubmittedDto, String userName) throws Exception {
Long alertSubmittedId = saveAlertSubmitted(alertSubmittedDto, userName); Long alertSubmittedId = saveAlertSubmitted(alertSubmittedDto, userName);
// 组装规则入参 // 组装规则入参
AlertCalled alertCalled = alertCalledService.getById(alertSubmittedDto.getAlertCalledId());
AlertCalledVo alertCalledVo = new AlertCalledVo(); AlertCalledVo alertCalledVo = new AlertCalledVo();
alertCalledVo.setAlertCalled(alertCalled);
List<AlertFormValue> alertFormValue = new ArrayList<>(); List<AlertFormValue> alertFormValue = new ArrayList<>();
AlertFormValue formValue = new AlertFormValue(); AlertFormValue formValue = new AlertFormValue();
formValue.setFieldCode("alertSubmittedId"); formValue.setFieldCode("alertSubmittedId");
...@@ -128,30 +130,38 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -128,30 +130,38 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
*/ */
public void ruleCallbackAction(String smsCode, String sendIds, Object object) throws Exception { public void ruleCallbackAction(String smsCode, String sendIds, Object object) throws Exception {
// 获取报送对象列表 // 获取报送对象列表
List<AlertSubmittedObject> alertSubmittedObjectList = new ArrayList<>(); List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList();;
Set<String> mobiles = new HashSet<>(); Set<String> mobiles = new HashSet<>();
HashMap<String, String> smsParams = new HashMap<>();
// 根据id列表查询所有人员信息 // 根据id列表查询所有人员信息
List<Long> ids = StringUtil.String2LongList(sendIds); List<Long> ids = StringUtil.String2LongList(sendIds);
if (object instanceof AlertCalledRo) { if (object instanceof AlertCalledRo) {
AlertCalledRo calledRo = (AlertCalledRo) object; AlertCalledRo calledRo = (AlertCalledRo) object;
String sequenceNbr = calledRo.getSequenceNbr(); String alertSubmittedId = calledRo.getAlertSubmittedId();
// 组装人员信息
List<Map<String, Object>> orgUsers = orgUsrService.selectForShowByListId(ids); List<Map<String, Object>> orgUsers = orgUsrService.selectForShowByListId(ids);
for (Map<String, Object> orgUser : orgUsers) { for (Map<String, Object> orgUser : orgUsers) {
AlertSubmittedObject alertSubmittedObject = new AlertSubmittedObject(); AlertSubmittedObject alertSubmittedObject = new AlertSubmittedObject();
alertSubmittedObject.setAlertSubmittedId(Long.parseLong(sequenceNbr)); alertSubmittedObject.setAlertSubmittedId(Long.parseLong(alertSubmittedId));
alertSubmittedObject.setType(false); alertSubmittedObject.setType(false);
alertSubmittedObject.setCompanyId((Long) orgUser.get("parentId")); alertSubmittedObject.setCompanyId(Long.valueOf((String) orgUser.get("parentId")));
alertSubmittedObject.setCompanyName((String) orgUser.get("parentName")); alertSubmittedObject.setCompanyName((String) orgUser.get("parenName"));
alertSubmittedObject.setUserId((Long) orgUser.get("bizOrgCode")); alertSubmittedObject.setUserId(10010L);
alertSubmittedObject.setUserName((String) orgUser.get("bizOrgName")); alertSubmittedObject.setUserName((String) orgUser.get("bizOrgName"));
alertSubmittedObject.setUserPhone((String) orgUser.get("telephone")); alertSubmittedObject.setUserPhone((String) orgUser.get("telephone"));
alertSubmittedObject.setRecUserName("ZW");
mobiles.add((String) orgUser.get("telephone")); mobiles.add((String) orgUser.get("telephone"));
alertSubmittedObjectList.add(alertSubmittedObject); alertSubmittedObjectList.add(alertSubmittedObject);
} }
// 组装报送内容
smsParams.put("alertType", calledRo.getAlertType());
smsParams.put("trappedNum", calledRo.getTrappedNum());
smsParams.put("companyName", calledRo.getCompanyName());
} }
// 执行短信报送对象 // 执行短信报送对象
saveAlertSubmittedObject(alertSubmittedObjectList, smsCode, mobiles, object); saveAlertSubmittedObject(alertSubmittedObjectList, smsCode, mobiles, smsParams);
} }
/** /**
...@@ -164,7 +174,6 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -164,7 +174,6 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Long alertSubmittedId = alertSubmittedDto.getSequenceNbr(); Long alertSubmittedId = alertSubmittedDto.getSequenceNbr();
String smsCode = ""; String smsCode = "";
Set<String> mobiles = new HashSet<>(); Set<String> mobiles = new HashSet<>();
HashMap<String, String> smsParams;
if (alertSubmittedId == null) { if (alertSubmittedId == null) {
// 1.保存警情记录主表 // 1.保存警情记录主表
...@@ -237,7 +246,11 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -237,7 +246,11 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 4.发送任务消息 // 4.发送任务消息
// 4.1组织短信内容 // 4.1组织短信内容
smsParams = JSON.parseObject(JSON.toJSONString(alertSubmittedDto.getSubmitContent()), HashMap.class); HashMap<String, String> smsParams = new HashMap<>();
JSONObject submitContent = alertSubmittedDto.getSubmitContent();
smsParams.put("alertType", submitContent.get("alertType").toString());
smsParams.put("trappedNum", submitContent.get("trappedNum").toString());
smsParams.put("companyName", submitContent.get("companyName").toString());
// 4.2调用短信发送接口 // 4.2调用短信发送接口
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams); alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
return finalAlertSubmittedId; return finalAlertSubmittedId;
...@@ -249,16 +262,13 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -249,16 +262,13 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
* @param alertSubmittedObjectList 报送对象列表 * @param alertSubmittedObjectList 报送对象列表
* @param smsCode 短信模板code * @param smsCode 短信模板code
* @param mobiles 电话号码列表 * @param mobiles 电话号码列表
* @param object 报送内容 * @param smsParams 报送内容
*/ */
public void saveAlertSubmittedObject(List<AlertSubmittedObject> alertSubmittedObjectList, String smsCode, public void saveAlertSubmittedObject(List<AlertSubmittedObject> alertSubmittedObjectList, String smsCode,
Set<String> mobiles, Object object) { Set<String> mobiles, HashMap<String, String> smsParams) {
alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList); alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
// 发送任务消息 // 发送任务消息
// 组织短信内容 // 组织短信内容
HashMap<String, String> smsParams = new HashMap<>();
Map<String, String> objectMap = JSON.parseObject(JSON.toJSONString(object), HashMap.class);
smsParams.putAll(objectMap);
// 调用短信发送接口 // 调用短信发送接口
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams); alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
} }
......
...@@ -56,10 +56,9 @@ public class RuleAlertCalledService { ...@@ -56,10 +56,9 @@ public class RuleAlertCalledService {
alertCalledRo.setAlertTypeCode(alertCalled.getAlertTypeCode()); alertCalledRo.setAlertTypeCode(alertCalled.getAlertTypeCode());
alertCalledRo.setCasualtiesNum(alertCalled.getCasualtiesNum() != null ? String.valueOf(alertCalled.getCasualtiesNum()) : "无"); alertCalledRo.setCasualtiesNum(alertCalled.getCasualtiesNum() != null ? String.valueOf(alertCalled.getCasualtiesNum()) : "无");
alertCalledRo.setTrappedNum(alertCalled.getTrappedNum() != null ? String.valueOf(alertCalled.getTrappedNum()) : "无"); alertCalledRo.setTrappedNum(alertCalled.getTrappedNum() != null ? String.valueOf(alertCalled.getTrappedNum()) : "无");
alertCalledRo.setUnitInvolved(alertCalled.getUnitInvolved());
List<AlertFormValue> alertFormValues = alertCalledVo.getAlertFormValue(); List<AlertFormValue> alertFormValues = alertCalledVo.getAlertFormValue();
if (ValidationUtil.isEmpty(alertFormValues)) if (!ValidationUtil.isEmpty(alertFormValues))
{ {
for (AlertFormValue alertFormValue : alertFormValues) for (AlertFormValue alertFormValue : alertFormValues)
{ {
......
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