Commit 0c831aa9 authored by kongfm's avatar kongfm

Merge remote-tracking branch 'origin/developer' into developer

parents 5333e2a0 70e87bb8
......@@ -18,7 +18,8 @@ public enum WorkFlowEnum {
GROUPNAME("groupName","角色组的key"),
NAME("name","任务节点的key"),
PROCESSINSTANCEID("processInstanceId",""),
ASSIGN("assignee","角色执行人key");
ASSIGN("assignee","角色执行人key"),
INFORMERLIST("informerList", "用户信息集合");
private String code;//对应菜单组件名称
private String desc;//描述
......
package com.yeejoin.amos.boot.biz.common.service;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
......@@ -59,6 +60,12 @@ public interface IWorkflowExcuteService{
* @throws Exception
*/
public Object getCurrentUserAllTaskList(String key, ReginParams userInfo) throws Exception;
/**
* 根据流程id获取下一节点操作人员userId集合
* @param procressId
* @return
* @throws Exception
*/
public List<String> getUserIdsByWorkflow(String procressId, String checkLeaderId) throws Exception;
}
......@@ -16,11 +16,8 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
......@@ -267,4 +264,27 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
return allTaskResultList;
}
/**
* 根据工作流获取下一审核人角色下的所有用户ID
* @return
*/
@Override
public List<String> getUserIdsByWorkflow(String procressId, String checkLeaderId) throws Exception {
List<String> userIds = new ArrayList<>();
JSONObject teskObject = workflowFeignService.getTaskList(procressId);
JSONArray taskDetailArray = teskObject.getJSONArray(WorkFlowEnum.DATA.getCode());
for (Object obj : taskDetailArray) {
JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(obj));
JSONArray informerList = detail.getJSONArray(WorkFlowEnum.INFORMERLIST.getCode());
if (informerList.size() > 0) {
userIds = informerList.stream().map(item -> {
JSONObject jsonItem = (JSONObject) item;
return jsonItem.getString("userId");
}).collect(Collectors.toList());
} else {
userIds.add(checkLeaderId);
}
}
return userIds;
}
}
package com.yeejoin.amos.boot.module.common.api.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.module.common.api.entity.SourceFile;
import com.yeejoin.amos.boot.module.common.api.excel.CommonExplicitConstraint;
import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "LinkageUnitVo", description = "联动单位")
public class LinkageUnitVo extends BaseDto {
@ExcelIgnore
private static final long serialVersionUID = 1L;
@ExcelProperty(value = "单位名称", index = 0)
@ApiModelProperty(value = "单位名称")
private String unitName;
@ExcelIgnore
@ApiModelProperty(value = "单位code")
private String unitCode;
@ExcelIgnore
@ApiModelProperty(value = "父级单位id")
private String parentId;
@ExcelProperty(value = "服务类别", index = 1)
@ExplicitConstraint(type = "LDDWLB", indexNum = 1, sourceClass = CommonExplicitConstraint.class) //动态下拉内容
@ApiModelProperty(value = "服务类别")
private String linkageUnitType;
@ExcelIgnore
@ApiModelProperty(value = "联动单位类别code")
private String linkageUnitTypeCode;
@ExcelIgnore
@ApiModelProperty(value = "行政区划")
private String administrativeDivisions;
@ExcelIgnore
@ApiModelProperty(value = "行政区划代码")
private String administrativeDivisionsCode;
@ExcelProperty(value = "地址", index = 2)
@ApiModelProperty(value = "地址")
private String address;
@ExcelProperty(value = "经度", index = 3)
@ApiModelProperty(value = "经度")
private String longitude;
@ExcelProperty(value = "纬度", index = 4)
@ApiModelProperty(value = "纬度")
private String latitude;
@ExcelProperty(value = "协议开始日期", index = 5)
@ApiModelProperty(value = "协议开始日期")
private Date agreementStartDate;
@ExcelProperty(value = "协议结束日期", index = 6)
@ApiModelProperty(value = "协议结束日期")
private Date agreementEndDate;
@ExcelProperty(value = "应急联动单位类别", index = 7)
@ExplicitConstraint(type = "YJLDDW", indexNum = 7, sourceClass = CommonExplicitConstraint.class) //动态下拉内容
@ApiModelProperty(value = "应急联动单位类别")
private String emergencyLinkageUnit;
@ExcelIgnore
@ApiModelProperty(value = "应急联动单位类别code")
private String emergencyLinkageUnitCode;
@ExcelProperty(value = "联系人", index = 8)
@ApiModelProperty(value = "联系人 ")
private String contactUser;
@ExcelProperty(value = "联系人电话", index = 9)
@ApiModelProperty(value = "联系人电话")
private String contactPhone;
@ExcelIgnore
@ApiModelProperty(value = "实例id")
private Long instanceId;
@ExcelIgnore
@ApiModelProperty(value = "组织机构代码")
private String orgCode;
@ExcelIgnore
@ApiModelProperty(value = "操作人名称")
private String recUserName;
@ExcelIgnore
@ApiModelProperty(value = "是否在协议期 ")
private String inAgreement;
@ExcelProperty(value = "消防救援能力", index = 10)
@ApiModelProperty(value = "消防救援能力")
private String fireRescueCapability;
@ExcelProperty(value = "职责_简要情况", index = 11)
@ApiModelProperty(value = "职责_简要情况")
private String responsibilitiesSituation;
@ExcelProperty(value = "应急服务内容", index = 12)
@ApiModelProperty(value = "应急服务内容")
private String emergencyServiceContent;
@ExcelProperty(value = "单位_简要情况", index = 13)
@ApiModelProperty(value = "单位_简要情况")
private String unitSituation;
@ExcelIgnore
@ApiModelProperty(value = "联动单位图片")
private List<SourceFile> image;
@ExcelIgnore
@ApiModelProperty(value = "车辆数量")
private String vehicleNumber;
@ExcelIgnore
@ApiModelProperty(value = "特岗人数")
private String personNumber;
}
......@@ -85,7 +85,8 @@ public interface EquipFeignClient {
@RequestParam String code ,
@RequestParam String pageNum,
@RequestParam String pageSize,
@RequestParam Long id);
@RequestParam Long id,
@RequestParam Boolean isNo );
......
......@@ -19,7 +19,7 @@ import java.util.Map;
public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
String selectUpUnitByParam(@Param("id")String biz_org_code);
int selectPersonListCount(Map<String, Object> map);
int selectPersonListCount(@Param("map")Map<String, Object> map);
List<Map<String, Object>> selectPersonList(@Param("map")Map<String, Object> map);
......
......@@ -29,5 +29,5 @@ public interface IDutyCarService extends IDutyCommonService {
* @return
*/
JSONObject isFireCarDriver();
int getDutyCarCount(Long carId);
}
......@@ -71,6 +71,6 @@ public List<OrgMenuDto> getBuildAndKeyTree(Long sequenceNbr);
public List<KeySiteDateDto> getKeySiteDate(Long id);
public List<KeySite> getKeySiteDateByNameLike();
public List<KeySite> getKeySiteDateByNameLike(Long companyId);
}
......@@ -117,7 +117,7 @@ public interface IOrgUsrService {
OrgUsrDto saveOrgPerson(OrgPersonDto OrgPersonDto) throws Exception;
void updateByIdOrgUsr(OrgUsrDto OrgUsrDto, Long id) throws Exception;
OrgUsrDto updateByIdOrgUsr(OrgUsrDto OrgUsrDto, Long id) throws Exception;
void updateByIdOrgPerson(OrgPersonDto OrgPersonDto, Long id) throws Exception;
......
......@@ -112,6 +112,7 @@
linkageUnitTypeCode,
a.emergency_linkage_unit_code
emergencyLinkageUnitCode,
emergency_linkage_unit,
a.address ,
a.latitude,
a.longitude,
......
......@@ -57,18 +57,28 @@
on u.sequence_nbr = g.instance_id
where
u.biz_org_type = 'person'
u.biz_org_type = 'person'
AND
u.is_delete = 0
GROUP BY
u.sequence_nbr ,
u.biz_org_name ,
u.biz_org_code
order by u.rec_date desc
)a where a.sequenceNbr is not null
</select>
u.is_delete = 0
<if test="map.bizOrgName != null">
AND u.biz_org_name like concat('%',#{map.bizOrgName},'%')
</if>
<if test="map.personNumber!= null">
AND v.field_value like concat('%',#{map.personNumber},'%')
</if>
<if test="map.bizOrgCode != null and map.bizOrgCode != '-1'">
AND u.biz_org_code like concat(#{map.bizOrgCode}, '%')
</if>
GROUP BY
u.sequence_nbr ,
u.biz_org_name ,
u.biz_org_code
order by u.rec_date desc
)a where a.sequenceNbr is not null
<if test="map.fieldsValue != null">
<foreach collection="map.fieldsValue.keys" item="item">AND a.${item} = #{map.fieldsValue[${item}]}</foreach>
</if>
</select>
<!--机场单位人员按时间倒叙排列add order by u.rec_date desc 2021-09-08 by kongfm -->
<select id="selectPersonList" resultType="Map">
......@@ -487,7 +497,7 @@ GROUP BY
AND u.biz_org_code LIKE CONCAT(#{code}, '%')
</if>
<if test="fieldCode != null and fieldCode.length > 0">
AND fi.field_code IN
AND f.field_code IN
<foreach collection="fieldCode" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
......
......@@ -27,4 +27,19 @@ public class AlertCalledObjsDto extends BaseDto{
@ApiModelProperty(value = "动态表单值")
private List<AlertFormValue> alertFormValue;
public String getRemark() {
String value="";
for (AlertFormValue al : alertFormValue) {
if (al.getFieldCode().equals("remark")) {
value=al.getFieldValue();
}
}
return value;
}
}
......@@ -101,6 +101,12 @@ public class AlertCalled extends BaseEntity {
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@ApiModelProperty(value = "备注信息")
private String remark;
/*bug 2408 接警记录,按警情状态和接警时间筛选功能失效 陈召 2021-09-22 开始*/
@ApiModelProperty(value = "接警时间开始---用于列表过滤")
......
......@@ -26,7 +26,7 @@
a.call_time callTime,
a.update_time updateTime,
a.rescue_grid rescueGrid,
CONCAT(a.alert_type,' ',IFNULL((select field_value from jc_alert_form_value where jc_alert_form_value.alert_called_id =a.sequence_nbr and jc_alert_form_value.field_code='remark'),"")) alertType,
CONCAT(a.alert_type,' ',IFNULL(a.remark,"")) alertType,
a.alert_type_code alarmTypeCode,
a.unit_involved unitInvolved,
a.trapped_num trappedNum,
......
......@@ -14,7 +14,7 @@
FROM
(
SELECT
a.sequence_nbr,
MD5(RAND() * 10000) sequence_nbr,
a.dispatch_type,
a.rec_date,
a.address,
......
......@@ -108,7 +108,8 @@ public class CommandController extends BaseController {
IDataDictionaryService dataDictionaryService;
@Autowired
IFireChemicalService fireChemicalService;
@Autowired
IDutyCarService dutyCarService;
@Autowired
IFireExpertsService fireExpertsService;
......@@ -1065,6 +1066,9 @@ public class CommandController extends BaseController {
if (e.get("carState").equals("在位")){
e.put("carState",FireCarStatusEnum.执勤.getName());
}
e.put("longitude",116.423762);
e.put("latitude",39.511552);
String sequenceNbr = e.get("sequenceNbr").toString();
//同步力量调派车辆任务状态
alertFormValue.stream().forEach(v->{
......@@ -1083,7 +1087,14 @@ public class CommandController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "车辆资源详情", notes = "车辆资源详情")
public ResponseModel<Map<String,Object>> getCarDetailById(Long id ) {
ResponseModel<Map<String, Object>> date= equipFeignClient.getCarDetailById(id);
return ResponseHelper.buildResponse(date!=null?date.getResult():null);
Map<String, Object> map= date!=null?date.getResult():null;
if(map!=null){
int num =0;
num = iDutyCarService.getDutyCarCount(id);
map.put("personNum",num);
}
return ResponseHelper.buildResponse(map);
}
......@@ -1323,10 +1334,10 @@ public class CommandController extends BaseController {
Long id =null;
//获取用户已绑定车辆id、
UserCar userCar=userCarService.selectByAmosUserId(Long.valueOf(agencyUserModel.getUserId()));
if(isNo!=null&&isNo){
id =userCar!=null?userCar.getCarId():null;
}
ResponseModel<Object> data= equipFeignClient.equipmentCarList(teamId,name,code , pageNum,pageSize,id);
id =userCar!=null?userCar.getCarId():null;
ResponseModel<Object> data= equipFeignClient.equipmentCarList(teamId,name,code , pageNum,pageSize,id,isNo);
Map map =new HashMap();
map.put("select",userCar!=null?userCar.getCarId():null);
map.put("data",data!=null?data.getResult():null);
......
......@@ -47,7 +47,6 @@ public class DutyCarController extends BaseController {
@Autowired
IDutyCarService iDutyCarService;
/**
* 值班列表视图--分页
*
......@@ -165,5 +164,4 @@ public class DutyCarController extends BaseController {
@ApiParam(value = "岗位") @RequestParam(required = false) String postType){
return ResponseHelper.buildResponse(iDutyCarService.getSchedulingDutyForSpecifyDate(dutyDay,shiftId,postType));
}
}
\ No newline at end of file
......@@ -230,8 +230,8 @@ public class KeySiteController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "通过名称模糊查询重点部位的信息", notes = "通过名称模糊查询重点部位的信息")
@GetMapping(value = "/getKeySiteDateByNameLike")
public ResponseModel<List<KeySite>> getKeySiteDateByNameLike() {
return ResponseHelper.buildResponse(keySiteService.getKeySiteDateByNameLike());
public ResponseModel<List<KeySite>> getKeySiteDateByNameLike(@RequestParam(required = false) Long companyId) {
return ResponseHelper.buildResponse(keySiteService.getKeySiteDateByNameLike(companyId));
}
}
......@@ -144,7 +144,7 @@ public class OrgUsrController extends BaseController {
OrgUsrVo.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_COMPANY);
iOrgUsrService.updateByIdOrgUsr(OrgUsrVo, id);
return ResponseHelper.buildResponse(null);
return ResponseHelper.buildResponse( iOrgUsrService.updateByIdOrgUsr(OrgUsrVo, id));
}
......
......@@ -13,6 +13,7 @@ import com.yeejoin.amos.boot.biz.common.utils.QRCodeUtil;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.*;
import com.yeejoin.amos.boot.module.common.api.enums.WaterResourceTypeEnum;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.biz.service.impl.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -92,7 +93,7 @@ public class WaterResourceController extends BaseController {
model.setResourceTypeName(resourceTypeEnum.get().getName());
model.setRealityImg(null);
model.setOrientationImg(JSONArray.toJSONString(model. getOrientationImgList()));
model.setOrientationImg(null);
/*2021-09-08 前端表示前端传递的address参数已经切割过,后端无需再切割获取 陈召 屏蔽代码 97-102行*/
/* if(model.getAddress()!=null){
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(model.getAddress());
......@@ -187,7 +188,7 @@ public class WaterResourceController extends BaseController {
// 更新基本信息
model.setSequenceNbr(sequenceNbr);
//model.setRealityImg(JSONArray.toJSONString(model.getRealityImgList()));
model.setOrientationImg(JSONArray.toJSONString(model.getOrientationImgList()));
//model.setOrientationImg(JSONArray.toJSONString(model.getOrientationImgList()));
WaterResourceDto waterResourceDto = waterResourceServiceImpl.updateWithModel(model);
// 更新属性信息
String resourceType = model.getResourceType();
......
......@@ -218,5 +218,17 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
}
return detailList;
}
@Override
public int getDutyCarCount(Long carId) {
List<Map<String, Object>> equipmentList = dutyPersonShiftMapper.getEquipmentForSpecifyDate(DateUtils.getDateNowShortStr(),
this.getGroupCode(), "carId", "carName", "teamName","result.carId");
int count =0;
for (Map<String, Object> map : equipmentList) {
if(map.containsKey("carId") && map.get("carId").equals(carId)) {
count++;
}
}
return count;
}
}
......@@ -319,9 +319,12 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
}
@Override
public List<KeySite> getKeySiteDateByNameLike() {
public List<KeySite> getKeySiteDateByNameLike(Long companyId) {
LambdaQueryWrapper<KeySite> mapper =new LambdaQueryWrapper<KeySite>();
mapper.eq(KeySite::getIsDelete, false);
if(companyId!=null && companyId.longValue()!=0) {
mapper.eq(KeySite::getBelongId, companyId);
}
return this.baseMapper.selectList(mapper);
}
}
......@@ -523,17 +523,19 @@ public class MaintenanceCompanyServiceImpl
parentCode = parent.getCode();
}
// 旧父节点的code
String oldParentCode = company.getCode().substring(0, company.getCode().length() - TreeParser.CODE_LENGTH);
List<MaintenanceCompany> children =
list(new LambdaQueryWrapper<MaintenanceCompany>().eq(MaintenanceCompany::getIsDelete, false).likeRight(MaintenanceCompany::getCode, company.getCode()).ne(MaintenanceCompany::getSequenceNbr, company.getSequenceNbr()));
if (!ValidationUtil.isEmpty(children)) {
String finalParentCode = parentCode;
children.forEach(i -> {
i.setCode(i.getCode().replaceFirst(oldParentCode, finalParentCode));
});
updateBatchById(children);
if(company.getCode() != null){
String oldParentCode = company.getCode().substring(0, company.getCode().length() - TreeParser.CODE_LENGTH);
List<MaintenanceCompany> children =
list(new LambdaQueryWrapper<MaintenanceCompany>().eq(MaintenanceCompany::getIsDelete, false).likeRight(MaintenanceCompany::getCode, company.getCode()).ne(MaintenanceCompany::getSequenceNbr, company.getSequenceNbr()));
if (!ValidationUtil.isEmpty(children)) {
String finalParentCode = parentCode;
children.forEach(i -> {
i.setCode(i.getCode().replaceFirst(oldParentCode, finalParentCode));
});
updateBatchById(children);
}
company.setCode(company.getCode().replaceFirst(oldParentCode, parentCode));
}
company.setCode(company.getCode().replaceFirst(oldParentCode, parentCode));
}
@Override
......
......@@ -737,7 +737,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
}
@Override
public void updateByIdOrgUsr(OrgUsrDto OrgUsrVo, Long id) throws Exception {
public OrgUsrDto updateByIdOrgUsr(OrgUsrDto OrgUsrVo, Long id) throws Exception {
// 修改单位信息
OrgUsr orgUsr = new OrgUsr();
OrgUsr oriOrgUsr = getById(id);
......@@ -773,6 +773,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
* 同步保存ES
*/
eSOrgUsrService.saveAlertCalledToES(orgUsr);
OrgUsrVo.setBizOrgCode(orgUsr.getBizOrgCode());
return OrgUsrVo;
}
@Override
......
......@@ -403,14 +403,14 @@ public class AlertCalledController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "警情填报联系人模糊查询", notes = "警情填报联系人模糊查询")
public ResponseModel<Object> getContact() {
if (redisUtils.hasKey(RedisKey.CONTACT_USER)) {
Object obj = redisUtils.get(RedisKey.CONTACT_USER);
return ResponseHelper.buildResponse(obj);
} else {
// if (redisUtils.hasKey(RedisKey.CONTACT_USER)) {
// Object obj = redisUtils.get(RedisKey.CONTACT_USER);
// return ResponseHelper.buildResponse(obj);
// } else {
List<Map<String, String>> contactName = iAlertCalledService.getContactName();
redisUtils.set(RedisKey.CONTACT_USER, contactName, time);
// redisUtils.set(RedisKey.CONTACT_USER, contactName, time);
return ResponseHelper.buildResponse(contactName);
}
}
/**
......@@ -441,7 +441,7 @@ public class AlertCalledController extends BaseController {
AlarmGiveStatisticsDto dto = new AlarmGiveStatisticsDto();
LambdaQueryWrapper<AlertCalled> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.isNull(AlertCalled::getFatherAlert);
queryWrapper.eq(AlertCalled::getAlertStatus, true);
queryWrapper.eq(AlertCalled::getAlertStatus, false);
queryWrapper.eq(AlertCalled::getIsDelete, false);
Integer alertNum = iAlertCalledService.getBaseMapper().selectCount(queryWrapper);
dto.setAlarmNum(alertNum);
......
......@@ -67,6 +67,8 @@ import com.yeejoin.amos.boot.module.jcs.api.mapper.TemplateMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertCalledService;
import com.yeejoin.amos.component.rule.config.RuleConfig;
import ch.qos.logback.core.joran.conditional.IfAction;
/**
* 警情接警记录 服务实现类
*
......@@ -257,6 +259,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
try {
// 警情基本信息
AlertCalled alertCalled = alertCalledObjsDto.getAlertCalled();
//主表增加备注字段
if (alertCalled.getAddress() != null) {
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(alertCalled.getAddress());
alertCalled.setAddress(address.getString(BizConstant.ADDRESS));
......@@ -290,6 +294,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
alertCalled.setAlarmType(AlertStageEnums.JQGB.getValue());
alertCalled.setAlarmTypeCode(AlertStageEnums.JQGB.getCode());
alertCalled.setUpdateTime(new Date());
alertCalled.setRemark(alertCalledObjsDto.getRemark());
this.save(alertCalled);
// 填充警情主键
......@@ -307,6 +312,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
alertCalled.setAlertStage(AlertStageEnums.LLDP.getValue());
alertCalled.setAlarmType(AlertStageEnums.JQCB.getValue());
alertCalled.setAlarmTypeCode(AlertStageEnums.JQCB.getCode());
alertCalled.setRemark(alertCalledObjsDto.getRemark());
this.save(alertCalled);
// 填充警情主键
alertFormValuelist.stream().forEach(alertFormValue -> {
......@@ -845,8 +851,14 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
// firefightersName.addAll(contactNames);
List<Map<String, String>> list = orgUsrServiceImpl.getPersonSimpleDetail();
list.stream().forEach(i->{
String phone = QRCodeUtil.generateQRCode()+"@"+ i.get("phone").toString();
i.replace("phone", phone);
String phone="";
if(i.containsKey("phone")) {
phone = QRCodeUtil.generateQRCode()+"@"+ i.get("phone").toString();
i.replace("phone", phone);
}else {
phone = QRCodeUtil.generateQRCode()+"@"+ phone;
i.put("phone", phone);
}
});
return list;
}
......@@ -861,16 +873,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
/* 2304 地址 联系人模糊查询缺失 陈召 2021-09-23 结束 */
public Set<Map<String, Object>> getLocationLike(String locationt) {
// Set<Map<String, Object>> set=new HashSet<Map<String, Object>>();
// List<Map<String, Object>> orgUserLocation = alertCalledMapper.getOrgUserLocation(locationt);
// List<Map<String, Object>> alertCalledLocation = alertCalledMapper.getAlertCalledLocation(locationt);
// List<Map<String, Object>> keySiteLocation = alertCalledMapper.getKeySiteLocation(locationt);
// List<Map<String, Object>> airportLocation = alertCalledMapper.getAirportLocation(locationt);
// set.addAll(alertCalledLocation);
// set.addAll(keySiteLocation);
// set.addAll(airportLocation);
// set.addAll(orgUserLocation);
// set.remove(null);
return alertCalledMapper.getLocation();
Set<Map<String, Object>> set= alertCalledMapper.getLocation();
set.remove(null);
return set;
}
}
......@@ -15,32 +15,7 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.QRCodeUtil;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.CompanyPerson;
import com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyFireFightingDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyFirstAidDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonShiftDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyShiftDto;
import com.yeejoin.amos.boot.module.common.api.dto.DynamicFormInitDto;
import com.yeejoin.amos.boot.module.common.api.dto.DynamicFormInstanceDto;
import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireChemicalDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireExpertsDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireStationDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersInfoDto;
import com.yeejoin.amos.boot.module.common.api.dto.KeySiteExcleDto;
import com.yeejoin.amos.boot.module.common.api.dto.LinkageUnitDto;
import com.yeejoin.amos.boot.module.common.api.dto.MaintenancePersonExcleDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrFormDto;
import com.yeejoin.amos.boot.module.common.api.dto.RescueEquipmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.SpecialPositionStaffDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
import com.yeejoin.amos.boot.module.common.api.entity.FireChemical;
......@@ -328,26 +303,40 @@ public class ExcelServiceImpl {
List<Map<String, Object>> pageList = dynamicFormInstanceService.listAll("linkageUnit");
linkageUnitListMap.forEach(i -> {
String mainString = i.get("instanceId").toString();
pageList.stream().forEach(detail -> {
if (detail.get("instanceId").toString().equals(mainString)) {
i.putAll(detail);
}
});
if ( i.get("instanceId") != null){
String mainString = i.get("instanceId").toString();
pageList.stream().forEach(detail -> {
if (detail.get("instanceId").toString().equals(mainString)) {
i.putAll(detail);
}
});
}
});
List<LinkageUnitDto> resultDtoList = JSONArray.parseArray(JSONArray.toJSONString(linkageUnitListMap),
LinkageUnitDto.class);
List<LinkageUnitDto> detaiList = resultDtoList.stream().map(item -> {
Date now = new Date();
if (item.getLongitude() != null){
}
boolean isInAgreement = DateUtils.belongCalendar(now, item.getAgreementStartDate(),
item.getAgreementEndDate());
item.setInAgreement(isInAgreement ? "是" : "否");
return item;
}).filter(item -> org.apache.commons.lang3.StringUtils.isEmpty(inAgreement) || inAgreement.equals(item.getInAgreement()))
.collect(Collectors.toList());
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), detaiList,
LinkageUnitDto.class, null, false);
/*经纬度导出精度会丢失 转换成string导出 2021-11-02 陈召 开始*/
List<LinkageUnitVo> result = new ArrayList<>();
detaiList.forEach(d->{
LinkageUnitVo linkageUnitVo = new LinkageUnitVo();
BeanUtils.copyProperties(d,linkageUnitVo);
linkageUnitVo.setLatitude(d.getLatitude() != null? String.valueOf(d.getLatitude()):" ");
linkageUnitVo.setLongitude(d.getLongitude() != null?String.valueOf(d.getLongitude()):" ");
result.add(linkageUnitVo);
});
/*经纬度导出精度会丢失 转换成string导出 2021-11-02 陈召 结束*/
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), result,
LinkageUnitVo.class, null, false);
break;
default:
break;
......
......@@ -18,4 +18,9 @@ public class DangerExecuteSubmitDto extends ExecuteSubmitDto {
private Long dangerId;
private LatentDangerExecuteTypeEnum executeTypeEnum;
/**
* 检查组长userId
*/
private String checkLeaderId;
}
......@@ -287,6 +287,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
latentDanger.setCurrentFlowRecordId(inputRecord.getId());
latentDanger.setInstanceId(instance.getString("id"));
latentDangerMapper.updateById(latentDanger);
asyncTask.sendDangerMsg(RequestContext.cloneRequestContext(), latentDanger, onSiteConfirmRole);
}
// TODO 使用远程调用替换
......@@ -1213,6 +1214,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
// 4、在执行完节点后需要将检查组长id设置为下个节点执行人
Object resultObj = workflowExecuteService.setTaskAssign(latentDanger.getInstanceId(), checkLeaderId);
executeSubmitDto.setCheckLeaderId(userModel.getUserId());
if (!(Boolean) resultObj) {
executeSubmitDto.setIsOk(false);
......@@ -2078,6 +2080,8 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
if (!executeSubmitDto.getIsOk()) {
throw new Exception(executeSubmitDto.getMsg());
}
List<String> userIds = workflowExecuteService.getUserIdsByWorkflow(latentDanger.getInstanceId(), executeSubmitDto.getCheckLeaderId());
asyncTask.sendDangerSubmitMsg(RequestContext.cloneRequestContext(), latentDanger, userIds);
return executeSubmitDto;
}
......
......@@ -4,12 +4,17 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.latentdanger.business.param.JPushTypeEnum;
import com.yeejoin.amos.latentdanger.business.param.PushMsgParam;
import com.yeejoin.amos.latentdanger.business.util.DateUtil;
import com.yeejoin.amos.latentdanger.business.util.Toke;
import com.yeejoin.amos.latentdanger.common.enums.MsgSubscribeEnum;
import com.yeejoin.amos.latentdanger.dao.entity.LatentDanger;
import com.yeejoin.amos.latentdanger.dao.entity.Msg;
import com.yeejoin.amos.latentdanger.feign.RemoteSecurityService;
import org.slf4j.Logger;
......@@ -17,12 +22,16 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.context.RequestContextModel;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 异步执行任务
......@@ -33,6 +42,7 @@ import java.util.Set;
public class AsyncTask {
private static final String TAB = "\r\n";
private final Logger log = LoggerFactory.getLogger(AsyncTask.class);
private final String msgType = "danger";
// @Autowired
// private IMsgDao iMsgDao;
// @Autowired
......@@ -146,4 +156,58 @@ public class AsyncTask {
// messageService.pushMsg(toke.getToke(), toke.getProduct(), toke.getAppKey(), pushMsgParam);
}
}
/**
* 提交隐患发送消息至检查组员被检查单位确认隐患
*/
@Async
public void sendDangerMsg(RequestContextModel requestContextModel, LatentDanger latentDanger, String roleName){
RequestContext.setToken(requestContextModel.getToken());
RequestContext.setProduct(requestContextModel.getProduct());
RequestContext.setAppKey(requestContextModel.getAppKey());
MessageModel model = new MessageModel();
model.setTitle(latentDanger.getDangerName());
String body = String.format("隐患名称:%s;隐患级别:%s;治理方式:%s",
latentDanger.getDangerName(), latentDanger.getDangerLevelName(), latentDanger.getReformTypeName());
model.setBody(body);
model.setIsSendApp(true);
model.setMsgType(msgType);
try {
List<RoleModel> result = Privilege.roleClient.queryRoleList(roleName, null).getResult();
if (result.size() > 0) {
List<AgencyUserModel> userModels = Privilege.agencyUserClient.queryByRoleId(String.valueOf(result.get(0).getSequenceNbr()), null).getResult();
List<String> userIds = userModels.stream().map(AgencyUserModel::getUserId).collect(Collectors.toList());
model.setRecivers(userIds);
}
model.setRelationId(String.valueOf(latentDanger.getId()));
Systemctl.messageClient.create(model);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 确认隐患发送消息
*/
@Async
public void sendDangerSubmitMsg(RequestContextModel requestContextModel, LatentDanger latentDanger, List<String> userIds){
RequestContext.setToken(requestContextModel.getToken());
RequestContext.setProduct(requestContextModel.getProduct());
RequestContext.setAppKey(requestContextModel.getAppKey());
MessageModel model = new MessageModel();
model.setTitle(latentDanger.getDangerName());
String body = String.format("隐患名称:%s;隐患级别:%s;治理方式:%s, 推送时间:%s",
latentDanger.getDangerName(), latentDanger.getDangerLevelName(), latentDanger.getReformTypeName(), DateUtil.date2LongStr(new Date()));
model.setBody(body);
model.setIsSendWeb(true);
model.setIsSendApp(true);
model.setMsgType(msgType);
model.setRecivers(userIds);
try {
model.setRelationId(String.valueOf(latentDanger.getId()));
Systemctl.messageClient.create(model);
} catch (Exception e) {
e.printStackTrace();
}
}
}
package com.yeejoin.amos.supervision.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Joiner;
......@@ -29,6 +30,7 @@ import com.yeejoin.amos.supervision.business.vo.CheckAnalysisVo;
import com.yeejoin.amos.supervision.business.vo.CheckInfoVo;
import com.yeejoin.amos.supervision.business.vo.CheckVo;
import com.yeejoin.amos.supervision.common.enums.*;
import com.yeejoin.amos.supervision.core.async.AsyncTask;
import com.yeejoin.amos.supervision.core.common.dto.DangerDto;
import com.yeejoin.amos.supervision.core.common.request.CommonPageable;
import com.yeejoin.amos.supervision.core.common.response.*;
......@@ -47,7 +49,9 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.annotation.Resource;
import javax.transaction.Transactional;
......@@ -97,6 +101,12 @@ public class CheckServiceImpl implements ICheckService {
IPlanTaskService planTaskService;
@Autowired
private IPlanService planService;
@Autowired
private AsyncTask asyncTask;
@Autowired
DangerFeignClient DangerFeignClient;
@Autowired
......@@ -1414,7 +1424,6 @@ public class CheckServiceImpl implements ICheckService {
if (!depName.contains(personIdentity.getCompanyName())) {
check.setDepName(depName + "," + personIdentity.getCompanyName());
}
}
List<CheckInputParam> list = recordParam.getCheckItems();
......@@ -1560,6 +1569,12 @@ public class CheckServiceImpl implements ICheckService {
planTaskDetailMapper.finishTaskDetail(Long.parseLong(detail.get("planTaskDetailId").toString()), recordParam.getPointId(),
recordParam.getPlanTaskId(), mtUserSeq, userName, size, planTaskStatus);
Plan plan = planService.queryPlanById(planTask.getPlanId());
// 计划完成,发送消息
if (PlanStatusEnum.COMPLETED.getValue() == plan.getStatus()){
asyncTask.sendPlanMsgToLeadPeople(RequestContext.cloneRequestContext(), plan);
}
// p_plan_task_detail更新隐患个数
planTaskDetailMapper.updateDanger(Long.parseLong(detail.get("planTaskDetailId").toString()));
......
package com.yeejoin.amos.supervision.business.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.service.IWorkflowExcuteService;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
......@@ -22,7 +21,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -44,6 +42,9 @@ public class PlanAuditServiceImpl implements IPlanAuditService {
@Autowired
WorkflowFeignService workflowFeignService;
@Autowired
private PlanServiceImpl planService;
@Override
@Transactional
public Boolean auditWorkFlow(PlanAuditLog planAuditLog, Integer status, String condition, ReginParams reginParams) throws Exception {
......@@ -72,6 +73,7 @@ public class PlanAuditServiceImpl implements IPlanAuditService {
planAuditLog.setFlowJson(condition);
planAuditLog.setRoleName(roleName);
planAuditLogDao.save(planAuditLog);
planService.getUserIdsByWorkflow(plan, instanceId);
return Boolean.TRUE;
}
}
......
package com.yeejoin.amos.supervision.business.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.google.common.base.Joiner;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.enums.WorkFlowEnum;
import com.yeejoin.amos.boot.biz.common.service.IWorkflowExcuteService;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.supervision.business.constants.XJConstant;
import com.yeejoin.amos.supervision.business.dao.mapper.PlanMapper;
......@@ -15,6 +19,7 @@ import com.yeejoin.amos.supervision.common.enums.CheckTypeSuEnum;
import com.yeejoin.amos.supervision.common.enums.DangerCheckTypeLevelEnum;
import com.yeejoin.amos.supervision.common.enums.PlanStatusEnum;
import com.yeejoin.amos.supervision.common.enums.WorkFlowBranchEnum;
import com.yeejoin.amos.supervision.core.async.AsyncTask;
import com.yeejoin.amos.supervision.core.common.request.AddPlanRequest;
import com.yeejoin.amos.supervision.core.common.response.PlanPointRespone;
import com.yeejoin.amos.supervision.core.util.DateUtil;
......@@ -30,6 +35,7 @@ import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;
......@@ -74,6 +80,12 @@ public class PlanServiceImpl implements IPlanService {
private IWorkflowExcuteService workflowExcuteService;
@Autowired
private AsyncTask asyncTask;
@Autowired
WorkflowFeignService workflowFeignService;
@Autowired
private IPlanAuditDao planAuditDao;
@Autowired
......@@ -132,38 +144,38 @@ public class PlanServiceImpl implements IPlanService {
public void addPlan(HashMap<String, Object> map, ReginParams reginParams) throws Exception {
// 新增路线
AddPlanRequest addPlanRequest = (AddPlanRequest) map.get("param");
Plan param = addPlanRequest.getPlan();
Plan plan = addPlanRequest.getPlan();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
String orgCode = map.get("org_code") == null ? "" : map.get("org_code").toString();
String userId = personIdentity.getPersonSeq();
param.setOrgCode(orgCode);
param.setNextGenDate(DateUtil.getIntervalDate(new Date(), 0));
param.setCreateBy(userId);
addPlanRequest.setPlan(param);
plan.setOrgCode(orgCode);
plan.setNextGenDate(DateUtil.getIntervalDate(new Date(), 0));
plan.setCreateBy(userId);
addPlanRequest.setPlan(plan);
Route route = save(addPlanRequest);
if (!ObjectUtils.isEmpty(route)) {
param.setRouteId(route.getId());
plan.setRouteId(route.getId());
//编辑计划
if (param.getId() > 0) {
Plan oriPlan = planDao.findById(param.getId()).get();
param.setCreateDate(oriPlan.getCreateDate());
param.setCreateBy(oriPlan.getCreateBy());
param.setLastUpdBy(userId);
param.setFirstFlag(XJConstant.PLAN_FIRST_STATUS_YES);
if (plan.getId() > 0) {
Plan oriPlan = planDao.findById(plan.getId()).get();
plan.setCreateDate(oriPlan.getCreateDate());
plan.setCreateBy(oriPlan.getCreateBy());
plan.setLastUpdBy(userId);
plan.setFirstFlag(XJConstant.PLAN_FIRST_STATUS_YES);
}
if (XJConstant.FIX_DATE_NO.equals(param.getIsFixedDate()) && (XJConstant.PLAN_TYPE_MONTH.equals(param.getPlanType()) || XJConstant.PLAN_TYPE_YEAR.equals(param.getPlanType()))) {
param.setDayBegin(DateUtil.formatStrToTime("00:00:00"));
param.setDayEnd(DateUtil.formatStrToTime("23:59:59"));
if (XJConstant.FIX_DATE_NO.equals(plan.getIsFixedDate()) && (XJConstant.PLAN_TYPE_MONTH.equals(plan.getPlanType()) || XJConstant.PLAN_TYPE_YEAR.equals(plan.getPlanType()))) {
plan.setDayBegin(DateUtil.formatStrToTime("00:00:00"));
plan.setDayEnd(DateUtil.formatStrToTime("23:59:59"));
}
planDao.save(param);
Integer status = param.getStatus();
planDao.save(plan);
Integer status = plan.getStatus();
if (status != null && status == 1) {
CheckTypeSuEnum checkTypeSuEnum = CheckTypeSuEnum.getEumByCode(param.getCheckTypeId());
DangerCheckTypeLevelEnum levelEnum = DangerCheckTypeLevelEnum.getEumByCode(param.getCheckLevel());
CheckTypeSuEnum checkTypeSuEnum = CheckTypeSuEnum.getEumByCode(plan.getCheckTypeId());
DangerCheckTypeLevelEnum levelEnum = DangerCheckTypeLevelEnum.getEumByCode(plan.getCheckLevel());
String branch = workFlowExcuteBranch(levelEnum.getCondition(), checkTypeSuEnum.getCondition());
try {
String processInstanceId;
PlanAudit audit = planAuditDao.findByPlanId(param.getId());
PlanAudit audit = planAuditDao.findByPlanId(plan.getId());
if (audit != null) {
//执行一步
processInstanceId = audit.getProcessInstanceId();
......@@ -171,20 +183,22 @@ public class PlanServiceImpl implements IPlanService {
//更新时间
audit.setUpdateDate(new Date());
planAuditDao.save(audit);
this.getUserIdsByWorkflow(plan, processInstanceId);
//记录执行流水-启动节点
insertAuditLog(reginParams, param, personIdentity, audit);
insertAuditLog(reginParams, plan, personIdentity, audit);
} else {
//启动
processInstanceId = workflowExcuteService.startAndComplete(processDefinitionKey, branch);
audit = new PlanAudit();
audit.setPlanId(param.getId());
audit.setPlanId(plan.getId());
audit.setBusinessKey(String.valueOf(sequence.nextId()));
audit.setProcessDefinitionKey(processDefinitionKey);
audit.setProcessInstanceId(processInstanceId);
audit.setStartUserId(userId);
planAuditDao.save(audit);
//记录执行流水-启动节点
insertAuditLog(reginParams, param, personIdentity, audit);
insertAuditLog(reginParams, plan, personIdentity, audit);
this.getUserIdsByWorkflow(plan, processInstanceId);
}
} catch (Exception e) {
log.error("=============防火监督,计划提交,工作流启动失败!!!=============");
......@@ -193,6 +207,30 @@ public class PlanServiceImpl implements IPlanService {
}
}
/**
* 根据工作流获取下一审核人角色下的所有用户ID
* @return
*/
protected List<String> getUserIdsByWorkflow (Plan plan, String processInstanceId){
List<String> userIds = new ArrayList<>();
JSONObject teskObject = workflowFeignService.getTaskList(processInstanceId);
JSONArray taskDetailArray = teskObject.getJSONArray(WorkFlowEnum.DATA.getCode());
for (Object obj : taskDetailArray) {
JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(obj));
JSONArray informerList = detail.getJSONArray(WorkFlowEnum.INFORMERLIST.getCode());
if (informerList.size() > 0) {
userIds = informerList.stream().map(item -> {
JSONObject jsonItem = (JSONObject) item;
return jsonItem.getString("userId");
}).collect(Collectors.toList());
asyncTask.sendAddPlanMsg(RequestContext.cloneRequestContext(), plan, userIds, true, false);
} else {
asyncTask.sendPlanMsgToLeadPeople(RequestContext.cloneRequestContext(), plan);
}
}
return userIds;
}
private void insertAuditLog(ReginParams reginParams, Plan param, ReginParams.PersonIdentity personIdentity, PlanAudit audit) {
PlanAuditLog planAuditLog = new PlanAuditLog();
planAuditLog.setPlanAuditId(audit.getId());
......
......@@ -532,7 +532,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// 2.保存执行数据明细表
planTaskDetail.saveAndFlush(planTaskDetailInstance);
// 推送消息
asyncTask.sendPlanMsg(RequestContext.cloneRequestContext(), plan, planId);
asyncTask.sendPlanMsg(RequestContext.cloneRequestContext(), plan);
}
// 定时任务监控
jobService.planTaskAddJob(planTask);
......
......@@ -14,6 +14,7 @@ import com.yeejoin.amos.supervision.business.entity.mybatis.MsgSubscribeBo;
import com.yeejoin.amos.supervision.business.param.PushMsgParam;
import com.yeejoin.amos.supervision.business.service.intfc.IMessageService;
import com.yeejoin.amos.supervision.business.service.intfc.ISafety3DDataSendService;
import com.yeejoin.amos.supervision.business.util.DateUtil;
import com.yeejoin.amos.supervision.business.util.Toke;
import com.yeejoin.amos.supervision.common.enums.JPushTypeEnum;
import com.yeejoin.amos.supervision.common.enums.MsgSubscribeEnum;
......@@ -45,6 +46,8 @@ import java.util.concurrent.Future;
public class AsyncTask {
private final Logger log = LoggerFactory.getLogger(AsyncTask.class);
private final String msgType = "supervision";
@Autowired
private ISafety3DDataSendService safety3DDataSend;
......@@ -304,15 +307,42 @@ public class AsyncTask {
}
/**
* 计划任务消息
* 提交计划任务消息
* @param requestContextModel
* @param plan
* @param userIds 发送用户id集合
* @param isSendWeb 发送web标识
* @param isSendApp 发送app标识
*/
@Async
public void sendAddPlanMsg(RequestContextModel requestContextModel, Plan plan, List<String> userIds, boolean isSendWeb, boolean isSendApp){
MessageModel model = new MessageModel();
model.setTitle(plan.getName());
String body = String.format("计划名称:%s;检查类型:%s;推送时间:%s",
plan.getName(), plan.getCheckTypeName(), DateUtil.date2LongStr(new Date()));
model.setBody(body);
try {
model.setIsSendWeb(isSendWeb);
model.setIsSendApp(isSendApp);
model.setMsgType(msgType);
model.setRelationId(String.valueOf(plan.getId()));
model.setRecivers(userIds);
// remoteSecurityService.addMessage(requestContextModel, model);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 发送消息至检查组长
* @param plan
*/
@Async
public void sendPlanMsg(RequestContextModel requestContextModel, Plan plan, long planId){
public void sendPlanMsgToLeadPeople(RequestContextModel requestContextModel, Plan plan){
MessageModel model = new MessageModel();
model.setTitle(plan.getName());
String body = String.format("任务批号:%s;类型:%s;执行人:%s",
planId, plan.getCheckTypeName(), plan.getMakerUserName());
String body = String.format("计划名称:%s;检查类型:%s;推送时间:%s",
plan.getName(), plan.getCheckTypeName(), DateUtil.date2LongStr(new Date()));
model.setBody(body);
String leadPeopleIds = plan.getLeadPeopleIds();
if (!ValidationUtil.isEmpty(plan.getUserId()) && !leadPeopleIds.contains(plan.getUserId())){
......@@ -320,9 +350,37 @@ public class AsyncTask {
}
try {
List<String> recivers = remoteSecurityService.getAmosIdListByUserIds(requestContextModel, leadPeopleIds);
model.setIsSendWeb(true);
model.setIsSendApp(true);
model.setMsgType(msgType);
model.setRelationId(String.valueOf(plan.getId()));
model.setRecivers(recivers);
// remoteSecurityService.addMessage(requestContextModel, model);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 发送消息至检查组员
* @param plan
*/
@Async
public void sendPlanMsg(RequestContextModel requestContextModel, Plan plan){
MessageModel model = new MessageModel();
model.setTitle(plan.getName());
String body = String.format("计划名称:%s;检查类型:%s;推送时间:%s",
plan.getName(), plan.getCheckTypeName(), DateUtil.date2LongStr(new Date()));
model.setBody(body);
String leadPeopleIds = plan.getLeadPeopleIds();
if (!ValidationUtil.isEmpty(plan.getUserId()) && !leadPeopleIds.contains(plan.getUserId())){
leadPeopleIds += "," + plan.getUserId();
}
try {
List<String> recivers = remoteSecurityService.getAmosIdListByUserIds(requestContextModel, leadPeopleIds);
model.setIsSendApp(true);
model.setIsSendWeb(true);
model.setMsgType("supervision");
model.setMsgType(msgType);
model.setRelationId(String.valueOf(plan.getId()));
model.setRecivers(recivers);
remoteSecurityService.addMessage(requestContextModel, model);
......@@ -349,5 +407,4 @@ public class AsyncTask {
}
return afterFilterUserIds;
}
}
......@@ -1990,5 +1990,39 @@
</sql>
</changeSet>
<changeSet author="chenzhao" id="2021-11-02-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="jc_template"/>
</preConditions>
<comment>update data jc_template</comment>
<sql>
UPDATE `jc_template` SET content ='【120急救】时间:callTime;地址:address;被困人数:trappedNum;伤亡人数:casualtiesNum;性别:gender;年龄段(岁):ageGroup;患者现状:patientStatus;情况说明:situation;警情阶段:alertStage' WHERE sequence_nbr=23;
</sql>
</changeSet>
<!-- <changeSet author="tw" id="2021-11-01-1">-->
<!-- <preConditions onFail="MARK_RAN">-->
<!-- <tableExists tableName="jc_alert_called"/>-->
<!-- </preConditions>-->
<!-- <comment>增加备注字段</comment>-->
<!-- <sql>-->
<!-- ALTER TABLE jc_alert_called ADD remark varchar(10000) NULL COMMENT '备注'-->
<!-- </sql>-->
<!-- </changeSet>-->
<changeSet author="chenhao" id="2021-11-02-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_data_dictionary"/>
<primaryKeyExists primaryKeyName="sequence_nbr" tableName="cb_data_dictionary"/>
</preConditions>
<comment>update data cb_data_dictionary</comment>
<sql>
INSERT INTO `cb_data_dictionary` (`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES ('1347', '1', '物联报警', 'WLBJ', NULL, NULL, NULL, NULL, NULL, '\0', '12');
INSERT INTO `cb_data_dictionary` (`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES ('1348', '1', '语音融合报警', 'YYRHBJ', NULL, NULL, NULL, NULL, NULL, '\0', '12');
</sql>
</changeSet>
</databaseChangeLog>
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