Commit 9776c531 authored by chenhao's avatar chenhao

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

parents 94c50284 bbef2b1e
......@@ -9,7 +9,8 @@ import java.lang.annotation.Target;
/**
* @author DELL
*
* 注解在mapper方法上
* 注解需要数据权限过滤的mapper。
* interfacePath对应为平台菜单管理中菜单组件(全局唯一)。
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
......@@ -20,6 +21,6 @@ public @interface DataAuth {
* 菜单组件
* @return
*/
String interfacePath() default "";
String interfacePath();
}
......@@ -55,36 +55,47 @@ public class PermissionInterceptor implements Interceptor {
@Autowired
RedisUtils redisUtils;
private String falseCondition = " 1=2";
@Override
public Object intercept(Invocation invocation) throws Throwable {
StatementHandler statementHandler = PluginUtils.realTarget(invocation.getTarget());
MetaObject metaObject = SystemMetaObject.forObject(statementHandler);
MappedStatement mappedStatement = (MappedStatement) metaObject.getValue("delegate.mappedStatement");
// TODO 处理mybatis plus
String dataAuthRule = PermissionInterceptorContext.getDataAuthRule();
// 被拦截方法
Method method = getTargetDataAuthMethod(mappedStatement);
DataAuth dataAuth = getTargetDataAuthAnnotation(mappedStatement);
// 没有DataAuth定义注解的跳过
if (null == dataAuth) {
// 没有DataAuth定义注解的跳过及没有手动指定使用数据规则的跳过
if (null == dataAuth && ValidationUtil.isEmpty(dataAuthRule)) {
PermissionInterceptorContext.clean();
return invocation.proceed();
}
// 接口地址为空返回空数据
if (ValidationUtil.isEmpty(dataAuth.interfacePath())) {
// 数据权限地址为空返回空数据
if (ValidationUtil.isEmpty(dataAuth.interfacePath()) && ValidationUtil.isEmpty(dataAuthRule)) {
// method.getReturnType().isPrimitive() = true 是count语句
PermissionInterceptorContext.clean();
return method.getReturnType().isPrimitive() ? invocation.proceed() : null;
}
dataAuthRule = ValidationUtil.isEmpty(dataAuth.interfacePath()) ? dataAuthRule : dataAuth.interfacePath();
ReginParams reginParam = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId()
, RequestContext.getToken())).toString(), ReginParams.class);
if (ValidationUtil.isEmpty(reginParam) || ValidationUtil.isEmpty(reginParam.getUserModel())) {
// method.getReturnType().isPrimitive() = true 是count语句
PermissionInterceptorContext.clean();
return method.getReturnType().isPrimitive() ? invocation.proceed() : null;
}
// 用户数据权限配置信息
Map<String, List<PermissionDataruleModel>> dataAuthorization = Privilege.permissionDataruleClient.queryByUser(reginParam.getUserModel().getUserId(),
dataAuth.interfacePath()).getResult();
dataAuthRule).getResult();
// 没有数据权限直接返回空数据
if (ValidationUtil.isEmpty(dataAuthorization)) {
PermissionInterceptorContext.clean();
return method.getReturnType().isPrimitive() ? invocation.proceed() : null;
}
......@@ -93,6 +104,7 @@ public class PermissionInterceptor implements Interceptor {
// 将权限规则拼接到原始sql
sql = processSelectSql(sql, dataAuthorization, reginParam, boundSql);
metaObject.setValue("delegate.boundSql.sql", sql);
PermissionInterceptorContext.clean();
return invocation.proceed();
}
......@@ -180,10 +192,10 @@ public class PermissionInterceptor implements Interceptor {
dataAuthorization.entrySet().stream().filter(map -> !ValidationUtil.isEmpty(map.getValue())).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
// 没有配置数据权限直接返回 false 条件
if (ValidationUtil.isEmpty(nonEmptyDataAuthorization)) {
authSql = " 1=2";
authSql = falseCondition;
} else {
// 解析数据权限sql
authSql = parseDataAuthorization(dataAuthorization, reginParams, mainTableAlias, boundSql);
authSql = parseDataAuthorization(nonEmptyDataAuthorization, reginParams, mainTableAlias, boundSql);
}
// 替换数据权限
if (!ValidationUtil.isEmpty(authSql)) {
......@@ -292,7 +304,8 @@ public class PermissionInterceptor implements Interceptor {
getRuleValue(rule, reginParam, boundSql)) + "'";
} else {
// 包含
authSql = mainTableAlias + "." + rule.getRuleColumn() + " like '" + getRuleValue(rule, reginParam, boundSql) + "'";
authSql = mainTableAlias + "." + rule.getRuleColumn() + " like '%" + getRuleValue(rule,
reginParam, boundSql) + "%'";
}
} else {
// =; >; >=; <; <=; !=
......@@ -326,6 +339,26 @@ public class PermissionInterceptor implements Interceptor {
String attrName = ruleValue.substring(2, ruleValue.length() - 1);
ruleValue = ValidationUtil.isEmpty(map.get(attrName)) ? "" : map.get(attrName).toString();
}
// 从查询参数中获取json字段参数值
if (rule.getRuleColumn().contains("->")) {
Map<String, Object> map;
Map<String, Object> map2 = Maps.newHashMap();
if (boundSql.getParameterObject() instanceof Map) {
map = (Map<String, Object>) boundSql.getParameterObject();
for(Map.Entry<String, Object> entry : map.entrySet()) {
if (entry.getValue() instanceof Map) {
map2.putAll((Map<? extends String, ?>) entry.getValue());
}
}
map.putAll(map2);
} else {
map = Bean.BeantoMap(boundSql.getParameterObject());
}
if(map.containsKey(ruleValue)) {
ruleValue = ValidationUtil.isEmpty(map.get(ruleValue)) ? falseCondition : map.get(ruleValue).toString();
}
}
return ruleValue;
}
}
package com.yeejoin.amos.boot.biz.common.interceptors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PermissionInterceptorContext {
private static final Logger logger = LoggerFactory.getLogger(PermissionInterceptorContext.class);
private static ThreadLocal<PermissionInterceptorContextModel> requestContext = ThreadLocal.withInitial(PermissionInterceptorContextModel::new);
private static PermissionInterceptorContextModel getPermissionInterceptorContext() {
return requestContext.get();
}
public static String getDataAuthRule() {
return getPermissionInterceptorContext().getDataAuthRule();
}
public static void setDataAuthRule(String dataAuthRule) {
getPermissionInterceptorContext().setDataAuthRule(dataAuthRule);
}
public static void clean() {
if (requestContext != null) {
logger.info("clean RestThreadLocal......Begin");
requestContext.remove();
logger.info("clean RestThreadLocal......Done");
}
}
}
package com.yeejoin.amos.boot.biz.common.interceptors;
import org.typroject.tyboot.core.foundation.context.RequestContextEntityType;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
*
*/
public class PermissionInterceptorContextModel implements Serializable {
private static final long serialVersionUID = 1L;
private String dataAuthRule;
public String getDataAuthRule() {
return dataAuthRule;
}
public void setDataAuthRule(String dataAuthRule) {
this.dataAuthRule = dataAuthRule;
}
public void clean() {
this.dataAuthRule = null;
}
}
......@@ -23,6 +23,7 @@ public class MessageAction {
MessageModel messageModel = JSON.parseObject(JSON.toJSONString(msgObj), MessageModel.class);
messageModel.setTitle(title);
messageModel.setBody(RuleUtils.instedParams(content, msgObj));
log.info(String.format("接收规则返回数据: %s", JSON.toJSONString(msgObj)));
if (!ValidationUtil.isEmpty(messageModel)) {
try {
Systemctl.messageClient.create(messageModel);
......
......@@ -46,7 +46,7 @@ public class ContractDto extends BaseDto {
private String contractNo;
@ApiModelProperty(value = "机构代码用于权限过滤")
private Boolean orgCode;
private String orgCode;
@ApiModelProperty(value = "单位名称")
private String company;
......
......@@ -61,7 +61,7 @@ public class Contract extends BaseEntity {
* 机构代码用于权限过滤
*/
@TableField("org_code")
private Boolean orgCode;
private String orgCode;
/**
* 单位名称
*/
......
......@@ -167,14 +167,18 @@ public class ExcelUtil {
String[] postTypeNamestrings = new String[postTypeNameDetailList.size()];
List<String> userNameDetailList = (List<String>) detail.get(detail.size()-3);
String[] userNamestrings = new String[userNameDetailList.size()];
List<String> companyNameList = (List<String>) detail.get(detail.size()-4);
String[] companyNameLists = new String[companyNameList.size()];
map.put(4, fireStationDetailList.toArray(strings));
map.put(3, postTypeNameDetailList.toArray(postTypeNamestrings));
map.put(2, userNameDetailList.toArray(userNamestrings));
map.put(1, companyNameList.toArray(companyNameLists));
map.putAll(explicitListConstraintMap);
fireStationExplicitListConstraintMap.add(map);
detail.remove(detail.size()-1);
detail.remove(detail.size()-1);
detail.remove(detail.size()-1);
detail.remove(detail.size()-1);
resultList.add(detail);
});
excelWriterSheetBuilder
......
package com.yeejoin.amos.boot.module.common.api.feign;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig;
import io.swagger.annotations.ApiOperation;
@FeignClient(name = "${amosTraining.fegin.name:AMOS-TRAININGEXAM}", path = "trainingexam", configuration = {MultipartSupportConfig.class})
public interface AmosTrainingFeignClient {
@RequestMapping(value = "/trainingProject/update/operation/number", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "修改人员编号", notes = "修改人员编号")
public ResponseModel<Boolean> updOperationNumber(@RequestParam String newNumber,@RequestParam String oldNumber) ;
}
......@@ -188,7 +188,9 @@ public interface EquipFeignClient {
* @return
*/
@RequestMapping(value = "/building/video/page", method = RequestMethod.GET)
ResponseModel<Page<Map<String, Object>>> getVideo( @RequestParam("current") long current, @RequestParam("size") long size, @RequestParam("buildingId") Long buildingId);
ResponseModel<Page<Map<String, Object>>> getVideo( @RequestParam("current") long current,
@RequestParam("size") long size,
@RequestParam("buildingId") Long buildingId);
@RequestMapping(value = "/building/video/page", method = RequestMethod.GET)
ResponseModel<Page<Map<String, Object>>> getVideopag( @RequestParam("current") String current,
......@@ -209,13 +211,11 @@ public interface EquipFeignClient {
);
@RequestMapping(value = "/confirmAlarm/getDetailsById", method = RequestMethod.GET)
public ResponseModel<Map<String, Object>> getDetailsById(@RequestParam Long alamId, @RequestParam(required = false) Long equipId, @RequestParam(required = false) String type, @RequestParam String area) ;
ResponseModel<Map<String, Object>> getDetailsById(@RequestParam Long alamId,
@RequestParam(required = false) Long equipId,
@RequestParam(required = false) String type,
@RequestParam String area) ;
/**
*
*获取视频列表
......@@ -223,7 +223,11 @@ public interface EquipFeignClient {
* @return
*/
@RequestMapping(value = "/video/pageVideo", method = RequestMethod.GET)
ResponseModel<Page<Map<String, Object>>> pageVideo( @RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize, @RequestParam("longitude") Double longitude,@RequestParam("latitude") Double latitude,@RequestParam("distance") Double distance);
ResponseModel<Page<Map<String, Object>>> pageVideo(@RequestParam("pageNum") Integer pageNum,
@RequestParam("pageSize") Integer pageSize,
@RequestParam("longitude") Double longitude,
@RequestParam("latitude") Double latitude,
@RequestParam("distance") Double distance);
@RequestMapping(value = "/video/pageList", method = RequestMethod.GET)
......
......@@ -166,4 +166,8 @@ public interface IMaintenanceCompanyService {
List<MaintenanceCompany> findByInstanceIdAndType(Long instanceId, String type);
List<MaintenanceCompany> findByCodeAndType(String code, String type);
List<MaintenanceCompany> findPersonByAmosOrgId(String code, String userId);
MaintenanceCompany getOne(Long parentId);
}
......@@ -109,8 +109,8 @@ public interface IOrgUsrService {
* @throws Exception
*/
Map<String, Object> selectForShowById(OrgUsr orgUsr, Long id) throws Exception;
Map<String, Object> selectForShowByIduser(OrgUsr orgUsr, Long id) throws Exception;
Map<String, Object> selectForShowByIduser(OrgUsr orgUsr, Long id) throws Exception;
List<OrgUsr> selectCompanyDepartmentMsg();
......@@ -146,7 +146,9 @@ public interface IOrgUsrService {
OrgDepartmentFormDto selectDepartmentById(Long id) throws Exception;
List<Map<String, Object>> selectForShowByListId(List<Long> ids) throws Exception;
List<Map<String, Object>> selectForShowByListIdUser(List<Long> ids) throws Exception;
/**
* * @param null
*
......@@ -186,7 +188,7 @@ public interface IOrgUsrService {
List<Map<String, Object>> getparent();
List<OrgUsrExcelDto> exportToExcel( Map par);
List<OrgUsrExcelDto> exportToExcel(Map par);
UserUnitDto getUserUnit(String userId);
......@@ -236,7 +238,7 @@ public interface IOrgUsrService {
*
* @param orgUserId
* @return
* @exception
* @throws
*/
AgencyUserModel getAmosIdByOrgUserId(String orgUserId) throws Exception;
......@@ -245,12 +247,13 @@ public interface IOrgUsrService {
*
* @param orgUserIds
* @return
* @exception
* @throws
*/
List<String> getAmosIdListByOrgUserId(String orgUserIds) throws Exception;
/**
* 查询目标公司下所有人员的简要信息,数据包含:所在公司id和name ,人员id和name,岗位id和name
*
* @param ids
* @return
*/
......@@ -263,11 +266,11 @@ public interface IOrgUsrService {
OrgUsr selectByAmosOrgId(Long id);
public List<OrgUsr> getPersonListByParentIds(List<String> ids) ;
List<OrgUsrFormDto> getUnSyncOrgCompanyList(List<Long> companyIdList);
List<OrgUsr> getPersonListByParentIds(List<String> ids);
public OrgUsr getDetailById( Long id);
List<OrgUsrFormDto> getUnSyncOrgCompanyList(List<Long> companyIdList);
OrgUsr getDetailById(Long id);
/**
......
......@@ -60,13 +60,13 @@
and submission_time between #{startTime} and #{endTime}
</if>
<if test="submissionName != null ">
and submission_name = #{submissionName}
and submission_name = like concat (%, #{submissionName},%)
</if>
<if test="submissionBranchId!= null ">
and submission_branch_id = #{submissionBranchId}
and submission_branch_id= #{submissionBranchId}
</if>
<if test="sequenceNbr!= null ">
and sequence_nbr = #{ sequenceNbr}
and sequence_nbr = like concat (%,#{ sequenceNbr},%)
</if>
</where>
order by submission_time DESC limit #{current},#{size}
......
......@@ -135,7 +135,7 @@ public class FireEquipment implements Serializable {
@ApiModelProperty(value = "是否组合设备")
@TableField("combinedequipment")
private String combinedequipment;
private Boolean combinedequipment = false;
@ApiModelProperty(value = "出厂编号")
@TableField("factorynumber")
......@@ -167,7 +167,7 @@ public class FireEquipment implements Serializable {
@ApiModelProperty(value = "重要性")
@TableField("critical")
private String critical;
private Boolean critical = false;
@ApiModelProperty(value = "电子地址")
@TableField("electronicaddress")
......
......@@ -147,4 +147,12 @@ public class EquipmentSpecific extends BaseEntity {
* 存放位置冗余字段
*/
private Long warehouseStructureId;
@ApiModelProperty(value = "告警状态")
@TableField(exist = false)
private Integer status;
@ApiModelProperty(value = "系统名称")
@TableField(exist = false)
private String systemName;
}
......@@ -125,6 +125,10 @@ public class EquipmentSpecificAlarmLog extends BaseEntity {
@TableField("equipment_index_id")
private Long equipmentIndexId;
@ApiModelProperty(value = "报警状态1报警0恢复")
@TableField("status")
private Integer status;
@ApiModelProperty(value = "画布id")
@TableField(exist = false)
private Long sceneId;
......
......@@ -4,6 +4,7 @@ import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.vo.BuildingTreeVo;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -18,47 +19,47 @@ public class AppDownloadVO {
/**
* 装备
*/
private List<DownloadEquipmentDataVO> downloadEquipmentDatas;
private List<DownloadEquipmentDataVO> downloadEquipmentDatas = new ArrayList<>();
/**
* 车辆
*/
private List<Car> downloadCarDatas;
private List<Car> downloadCarDatas = new ArrayList<>();
/**
* 建筑
*/
private List<BuildingTreeVo> buildTree;
private List<BuildingTreeVo> buildTree = new ArrayList<>();
/**
*设备对应性能指标
*/
private List<EquipmentSpecificIndex> equipmentSpecificIndexs;
private List<EquipmentSpecificIndex> equipmentSpecificIndexs = new ArrayList<>();
/**
*性能指标模板
*/
private List<EquipmentIndex> equipmentIndex;
private List<EquipmentIndex> equipmentIndex = new ArrayList<>();
/**
*货位
*/
private List<WarehouseStructure> warehouseStructure;
private List<WarehouseStructure> warehouseStructure = new ArrayList<>();
/**
* 车载装备
*/
private List<EquipmentOnCar> equipmentOnCar;
private List<EquipmentOnCar> equipmentOnCar = new ArrayList<>();
/**
* 车载灭火药剂
*/
private List<ExtinguishantOnCar> extinguishantOnCar;
private List<ExtinguishantOnCar> extinguishantOnCar = new ArrayList<>();
/**
*报废原因
*/
private List<SystemDic> reason;
private List<SystemDic> reason = new ArrayList<>();
}
......@@ -68,4 +68,10 @@ public class CarPropertyVo {
@ApiModelProperty(value = "创建日期")
private Date createDate;
/**
* 单位名称
*/
@ApiModelProperty(value = "mRid")
private String mRid;
}
......@@ -25,23 +25,24 @@ public class GlobalExceptionHandler {
public GlobalExceptionHandler() {
}
@ExceptionHandler({ Exception.class })
@ExceptionHandler({Exception.class})
public ResponseModel<Object> MethodArgumentNotValidHandler(Exception exception) throws Exception {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
.getRequest();
ResponseModel<Object> response = new ResponseModel<>();
//解析平台返回错误信息,统一返回403,app 端统一跳转到登录页面
if(exception.getMessage()!=null&&exception.getMessage().indexOf("账号已经在其他设备登录")!=-1 ||exception.getMessage().indexOf("请重新登录")!=-1){
if (exception.getMessage() != null && (exception.getMessage().contains("账号已经在其他设备登录") || exception.getMessage().contains("请重新登录"))) {
response.setStatus(HttpStatus.FORBIDDEN.value());
}else{
} else {
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
}
response.setDevMessage("FAILED");
response.setMessage( exception.getMessage());
response.setMessage(exception.getMessage());
response.setTraceId(RequestContext.getTraceId());
response.setPath(request.getServletPath());exception.printStackTrace();
response.setPath(request.getServletPath());
exception.printStackTrace();
return response;
}
......
......@@ -109,6 +109,16 @@ public class CommonPageInfoParam extends CommonPageable {
*/
private List<String> buildIds;
private String status;
public void setStatus(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
public void setWarehouseStructureName(String warehouseStructureName) {
this.warehouseStructureName = warehouseStructureName;
}
......
......@@ -55,6 +55,8 @@ public class CommonPageParamUtil {
param.setBuildId(toString(queryRequests.get(i).getValue()));
} else if("buildIds".equals(name)){
param.setBuildIds((List<String>)queryRequests.get(i).getValue());
} else if("status".equals(name)){
param.setStatus(toString(queryRequests.get(i).getValue()));
}
}
if(commonPageable !=null){
......
package com.yeejoin.equipmanage.common.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @author keyong
* @title: TopographyAlarmVo
* <pre>
* @description: TODO
* </pre>
* @date 2021/12/29 18:57
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TopographyAlarmVo {
private Date createDate;
private String fireEquipmentSpecificIndexName;
private String fireEquipmentName;
private String warehouseStructureName;
private String equipmentName;
private String handleStatus;
private String handleType;
private String alarmType;
private String alarmContent;
private String status;
}
package com.yeejoin.equipmanage.common.vo;
import lombok.Data;
/**
* @author keyong
* @title: IotDataVO
* <pre>
* @description: 物联系统发送的增量数据封装VO
* </pre>
* @date 2021/1/7 17:44
*/
@Data
public class TopographyIotDataVO {
private String name;
private Object value;
private String unit;
}
package com.yeejoin.equipmanage.common.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @author keyong
* @title: TopographyAlarmVo
* <pre>
* @description: TODO
* </pre>
* @date 2021/12/29 18:57
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TopographyIotVo {
private Date time;
private List<TopographyIotDataVO> list;
}
......@@ -41,8 +41,9 @@ public class AlertSubmittedObject extends BaseEntity {
@ApiModelProperty(value = "人员id")
private Long userId;
@TableField("user_name")
@ApiModelProperty(value = "人员名称")
private String userName;
private String theUser;
@ApiModelProperty(value = "人员电话")
private String userPhone;
......
......@@ -43,8 +43,8 @@
ELSE '' END responseLevelCode
FROM jc_alert_called a
where a.is_delete=0
AND a.coordinate_x IS NOT NULL
AND a.coordinate_y IS NOT NULL
<!--AND a.coordinate_x IS NOT NULL
AND a.coordinate_y IS NOT NULL-->
<if test='par.status==0'>
and a.alert_status =0
</if>
......@@ -79,10 +79,10 @@
<if test='pageNum!=null and pageSize !=null'>
limit #{pageNum},#{pageSize}
</if>
</select>
</select>
<select id="alertCalledListByAlertStatusCount" resultType="Integer">
<select id="alertCalledListByAlertStatusCount" resultType="Integer">
SELECT
COUNT(*)
FROM jc_alert_called a
......@@ -105,10 +105,10 @@
and a.call_time &gt;= (NOW() - interval 24 hour)
</if>
</select>
</select>
<select id="selectAllPage" resultType="com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled">
<select id="selectAllPage" resultType="com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled">
SELECT
a.sequence_nbr,
a.alert_status,
......@@ -151,7 +151,7 @@
and a.call_time between #{startTime} and #{endTime}
</if>
<if test="alertTypeCode!= null and alertTypeCode!= '' ">
and a.alarm_type_code = #{alertTypeCode}
and a.alert_type_code = #{alertTypeCode}
</if>
<if test="alertSourceCode!= null ">
and a.alert_source_code = #{alertSourceCode}
......@@ -173,9 +173,9 @@
order by a.call_time DESC limit #{current},#{size}
</if>
</where>
</select>
</select>
<select id="selectAllCount" resultType="int">
<select id="selectAllCount" resultType="int">
SELECT
count(b.num)
FROM
......@@ -207,10 +207,10 @@
GROUP BY a.sequence_nbr
</if>
</where>) b
</select>
</select>
<select id="AlertCalledcountTime" resultType="Integer">
<select id="AlertCalledcountTime" resultType="Integer">
select COUNT(*) from jc_alert_called where is_delete=0
......@@ -227,10 +227,10 @@
and TO_DAYS( NOW( ) ) - TO_DAYS( call_time) = 1
</if>
</select>
</select>
<select id="getTodayAlertCalled" resultType="com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledTodyDto">
<select id="getTodayAlertCalled" resultType="com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledTodyDto">
select jc_alert_called.alert_type alarmType,
jc_alert_called.address,
......@@ -240,10 +240,10 @@
and to_days(call_time) = to_days(now())
ORDER BY call_time DESC
</select>
</select>
<!--统计未结束的警情数量-->
<!--统计未结束的警情数量-->
<select id="AlertCalledcount" resultType="Integer">
......
......@@ -85,6 +85,11 @@ public class DangerDto implements Serializable {
private List<String> photoUrl;
/**
* 隐患图片列表
*/
private String photoUrls;
/**
* 检查项名称
*/
private String inputItemName;
......
package com.yeejoin.amos.boot.module.tzs.api.enums;
import lombok.AllArgsConstructor;
@AllArgsConstructor
public enum InformWorkFlowEnum {
企业提交审批("submitInform","企业提交审批","0"),
接收方接收告知书("acceptInform","接收方接收告知书","9"),
接收方移交告知书("transferInform","接收方移交告知书","1"),
企业撤回告知书("withdrawInform","企业撤回告知书","2"),
接收方驳回告知书("dismissInform","接收方驳回告知书","3"),
企业撤销告知书("cancelInform","企业撤销告知书","-1");
private String code;//流程编码
private String stage;//流程阶段
private String processStatus;// 流程状态
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getStage() {
return stage;
}
public void setStage(String stage) {
this.stage = stage;
}
public String getProcessStatus() {
return processStatus;
}
public void setProcessStatus(String processStatus) {
this.processStatus = processStatus;
}
}
......@@ -82,6 +82,6 @@ public class CylinderInfoDto extends BaseDto {
private Boolean syncState;
@ApiModelProperty(value = "对接公司编码")
private String apiCompanyCode;
private String appId;
}
......@@ -91,7 +91,7 @@ public class CylinderUnitDto extends BaseDto {
private Boolean syncState;
@ApiModelProperty(value = "对接公司编码")
private String apiCompanyCode;
private String appId;
@ApiModelProperty(value = "气瓶数量")
private Long cylinderNumber;
......
......@@ -79,7 +79,7 @@ public class EquipmentDto extends BaseDto {
private String productCode;
@ApiModelProperty(value = "监督检验机构")
private Long supervisionAgency;
private String supervisionAgency;
@ApiModelProperty(value = "检验报告编号")
private String inspectionReportCode;
......@@ -101,4 +101,16 @@ public class EquipmentDto extends BaseDto {
@ApiModelProperty(value = "设备所属单位")
private String equipUnit;
@ApiModelProperty(value = "详细地址")
private String address;
@ApiModelProperty(value = "经度")
private String longitude;
@ApiModelProperty(value = "纬度")
private String latitude;
@ApiModelProperty(value = "所属区域代码")
private String regionCode;
}
package com.yeejoin.amos.boot.module.tzs.flc.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 设备指标
*
* @author system_generator
* @date 2021-12-29
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="EquipmentIndexInformDto", description="设备指标")
public class EquipmentIndexInformDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "设备id")
private Long equipmentId;
@ApiModelProperty(value = "设备名称")
private String equipmentName;
@ApiModelProperty(value = "指标值")
private String value;
@ApiModelProperty(value = "装备定义指标id")
private Long defIndexId;
@ApiModelProperty(value = "装备定义指标名称")
private String defIndexName;
@ApiModelProperty(value = "装备定义指标key")
private String defIndexKey;
}
......@@ -130,4 +130,29 @@ public class EquipmentInformDto extends BaseDto {
@TableField(exist = false)
private Map<String, List<AttachmentDto>> attachments;
@ApiModelProperty(value = "设备数量")
private Integer equipmentNum;
@ApiModelProperty(value = "开始-施工告知日期")
private String productInformDateStart;
@ApiModelProperty(value = "结束-施工告知日期")
private String productInformDateEnd;
@ApiModelProperty(value = "开始-计划施工日期")
private String planProductDateStart;
@ApiModelProperty(value = "结束-计划施工日期")
private String planProductDateEnd;
@ApiModelProperty(value = "施工区域")
private String productArea;
@ApiModelProperty(value = "流程ID")
private String processId;
@ApiModelProperty(value = "流程状态")
private String processStatus;
}
......@@ -108,4 +108,16 @@ public class InformEquipmentDto extends BaseDto {
private List<EquipmentIndexDto> equipmentIndex;
@ApiModelProperty(value = "详细地址")
private String address;
@ApiModelProperty(value = "经度")
private String longitude;
@ApiModelProperty(value = "纬度")
private String latitude;
@ApiModelProperty(value = "所属区域代码")
private String regionCode;
}
package com.yeejoin.amos.boot.module.tzs.flc.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 通话记录附件
*
* @author system_generator
* @date 2021-12-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="InformProcessInfoDto", description="通话记录附件")
public class InformProcessInfoDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "流转内容")
private String processInfo;
@ApiModelProperty(value = "流程操作人")
private String handler;
@ApiModelProperty(value = "操作人所属单位id")
private Long handlerUnitId;
@ApiModelProperty(value = "流程状态")
private String processStatus;
@ApiModelProperty(value = "流程操作人id")
private Long handlerId;
@ApiModelProperty(value = "操作人所属单位")
private String handlerUnit;
@ApiModelProperty(value = "流程id")
private String processId;
@ApiModelProperty(value = "告知书id")
private Long informId;
}
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
......@@ -150,7 +151,6 @@ public class CylinderInfo {
/**
* 对接公司编码
*/
@TableField("api_company_code")
private String apiCompanyCode;
@TableField("app_id")
private String appId;
}
......@@ -168,8 +168,8 @@ public class CylinderUnit {
/**
* 对接公司编码
*/
@TableField("api_company_code")
private String apiCompanyCode;
@TableField("app_id")
private String appId;
/**
* 经度
......
......@@ -129,7 +129,7 @@ public class Equipment extends BaseEntity {
* 监督检验机构
*/
@TableField("supervision_agency")
private Long supervisionAgency;
private String supervisionAgency;
/**
* 检验报告编号
......@@ -155,4 +155,29 @@ public class Equipment extends BaseEntity {
@TableField("equip_unit")
private String equipUnit;
/**
* 详细地址
*/
@TableField("address")
private String address;
/**
* 经度
*/
@TableField("longitude")
private String longitude;
/**
* 纬度
*/
@TableField("latitude")
private String latitude;
/**
* 所属区域代码
*/
@TableField("region_code")
private String regionCode;
}
package com.yeejoin.amos.boot.module.tzs.flc.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 设备指标
*
* @author system_generator
* @date 2021-12-29
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("tcb_equipment_index_inform")
public class EquipmentIndexInform extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 设备id
*/
@TableField("equipment_id")
private Long equipmentId;
/**
* 设备名称
*/
@TableField("equipment_name")
private String equipmentName;
/**
* 指标值
*/
@TableField("value")
private String value;
/**
* 装备定义指标id
*/
@TableField("def_index_id")
private Long defIndexId;
/**
* 装备定义指标名称
*/
@TableField("def_index_name")
private String defIndexName;
/**
* 装备定义指标key
*/
@TableField("def_index_key")
private String defIndexKey;
}
......@@ -215,9 +215,20 @@ public class EquipmentInform extends BaseEntity {
private String informCode;
/**
* 告知单状态 0 暂存 1未接收 9已接收
* 告知单状态 0 暂存 1未接收 2已接收
*/
@TableField("inform_status")
private String informStatus;
/**
* 流程ID
*/
@TableField("process_id")
private String processId;
/**
* 流程状态
*/
@TableField("process_status")
private String processStatus;
}
......@@ -165,4 +165,29 @@ public class InformEquipment extends BaseEntity {
*/
@TableField("source_equipment_id")
private Long sourceEquipmentId;
/**
* 详细地址
*/
@TableField("address")
private String address;
/**
* 经度
*/
@TableField("longitude")
private String longitude;
/**
* 纬度
*/
@TableField("latitude")
private String latitude;
/**
* 所属区域代码
*/
@TableField("region_code")
private String regionCode;
}
package com.yeejoin.amos.boot.module.tzs.flc.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 通话记录附件
*
* @author system_generator
* @date 2021-12-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("tz_inform_process_info")
public class InformProcessInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 流转内容
*/
@TableField("process_info")
private String processInfo;
/**
* 流程操作人
*/
@TableField("handler")
private String handler;
/**
* 操作人所属单位id
*/
@TableField("handler_unit_id")
private Long handlerUnitId;
/**
* 流程状态
*/
@TableField("process_status")
private String processStatus;
/**
* 流程操作人id
*/
@TableField("handler_id")
private Long handlerId;
/**
* 操作人所属单位
*/
@TableField("handler_unit")
private String handlerUnit;
/**
* 流程id
*/
@TableField("process_id")
private String processId;
/**
* 告知书id
*/
@TableField("inform_id")
private Long informId;
}
......@@ -10,7 +10,8 @@ public enum EquipmentInformStatusEnum {
暂存("0", "暂存"),
未接收("1", "未接收"),
已接收("2", "已接收");
已接收("2", "已接收"),
已驳回("9", "已驳回");
private String code;
......
package com.yeejoin.amos.boot.module.tzs.flc.api.mapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentIndexInform;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 设备指标 Mapper 接口
*
* @author system_generator
* @date 2021-12-29
*/
public interface EquipmentIndexInformMapper extends BaseMapper<EquipmentIndexInform> {
}
package com.yeejoin.amos.boot.module.tzs.flc.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentInformDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentInform;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* 设备告知单 Mapper 接口
......@@ -11,4 +17,35 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface EquipmentInformMapper extends BaseMapper<EquipmentInform> {
Page<List<EquipmentInformDto>> queryDtoList(Page<EquipmentInformDto> page,
@Param("productCode") String productCode,
@Param("productInformDateStart") String productInformDateStart,
@Param("productInformDateEnd") String productInformDateEnd,
@Param("productUnitId") Long productUnitId,
@Param("regionCode") String regionCode,
@Param("address") String address,
@Param("planProductDateStart") String planProductDateStart,
@Param("planProductDateEnd") String planProductDateEnd,
@Param("acceptUnitId") Long acceptUnitId,
@Param("informStatus") String informStatus,
@Param("sortParam") String sortParam,
@Param("sortRule") String sortRule,
@Param("companyId") Long companyId);
Page<List<EquipmentInformDto>> queryDtoListSub(Page<EquipmentInformDto> page,
@Param("productCode") String productCode,
@Param("productInformDateStart") String productInformDateStart,
@Param("productInformDateEnd") String productInformDateEnd,
@Param("productUnitId") Long productUnitId,
@Param("regionCode") String regionCode,
@Param("address") String address,
@Param("planProductDateStart") String planProductDateStart,
@Param("planProductDateEnd") String planProductDateEnd,
@Param("acceptUnitId") Long acceptUnitId,
@Param("informStatus") String informStatus,
@Param("sortParam") String sortParam,
@Param("sortRule") String sortRule,
@Param("companyId") Long companyId);
}
package com.yeejoin.amos.boot.module.tzs.flc.api.mapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.InformProcessInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 通话记录附件 Mapper 接口
*
* @author system_generator
* @date 2021-12-27
*/
public interface InformProcessInfoMapper extends BaseMapper<InformProcessInfo> {
}
......@@ -16,4 +16,12 @@ import java.util.List;
public interface UnitInfoMapper extends BaseMapper<UnitInfo> {
List<UnitInfoDto> getUnitByType(@Param("typeCode") String typeCode);
List<UnitInfoDto> getAllUnit();
List<UnitInfoDto> getUnitByTypeParams(@Param("typeCode") String typeCode,
@Param("unitType") String unitType,
@Param("address") String address,
@Param("orgName") String orgName,
@Param("organizationCode") String organizationCode);
}
package com.yeejoin.amos.boot.module.tzs.flc.api.service;
/**
* 设备指标接口类
*
* @author system_generator
* @date 2021-12-29
*/
public interface IEquipmentIndexInformService {
}
package com.yeejoin.amos.boot.module.tzs.flc.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentInformDto;
import java.util.List;
/**
* 设备告知单接口类
*
......@@ -11,6 +15,100 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentInformDto;
*/
public interface IEquipmentInformService {
EquipmentInformDto createEquipmentInform(EquipmentInformDto model);
EquipmentInformDto createEquipmentInform(EquipmentInformDto model, ReginParams userInfo);
/**
* 获取本单位提交的告知书列表
* @param page
* @param equipmentInformDto
* @param sortParam
* @param sortRule
* @return
*/
Page<EquipmentInformDto> queryDtoList(Page<EquipmentInformDto> page, EquipmentInformDto equipmentInformDto, String sortParam, String sortRule);
/**
* 获取监管端查看的告知书列表
* @param page
* @param equipmentInformDto
* @param sortParam
* @param sortRule
* @return
*/
Page<EquipmentInformDto> queryDtoListSub(Page<EquipmentInformDto> page, EquipmentInformDto equipmentInformDto, String sortParam, String sortRule);
Boolean batchDelete(List<Long> sequenceNbrList);
Boolean acceptInform(Long sequenceNbr);
EquipmentInformDto updateEquipmentInform(EquipmentInformDto model, ReginParams userInfo);
EquipmentInformDto queryDtoBySeq(Long sequenceNbr);
/**
* 启动 告知书流程
* @param sequenceNbr
* @param userInfo
* @return
* @throws Exception
*/
Boolean startWorkflow(Long sequenceNbr, ReginParams userInfo) throws Exception;
/**
* 接收方接收告知书
* @param sequenceNbr
* @param userInfo
* @return
* @throws Exception
*/
Boolean acceptInform(Long sequenceNbr, ReginParams userInfo) throws Exception;
/**
* 企业移交告知书
* @param sequenceNbr
* @param userInfo
* @return
* @throws Exception
*/
Boolean transferInform(Long sequenceNbr, ReginParams userInfo, Long transferUnitId) throws Exception;
/**
* 企业撤回告知书
* @param sequenceNbr
* @param userInfo
* @return
* @throws Exception
*/
Boolean withdrawInform(Long sequenceNbr, ReginParams userInfo) throws Exception;
/**
* 接收方驳回告知书
* @param sequenceNbr
* @param userInfo
* @return
* @throws Exception
*/
Boolean dismissInform(Long sequenceNbr, ReginParams userInfo) throws Exception;
/**
* 企业撤销告知书
* @param sequenceNbr
* @param userInfo
* @return
* @throws Exception
*/
Boolean cancelInform(Long sequenceNbr, ReginParams userInfo) throws Exception;
/**
* 企业再次提交
* @param sequenceNbr
* @param userInfo
* @return
* @throws Exception
*/
Boolean reSubmit(Long sequenceNbr, ReginParams userInfo) throws Exception;
/**
* 监管端撤回已经通过的告知书
* @param sequenceNbr
* @return
*/
Boolean callbackInform(Long sequenceNbr);
}
package com.yeejoin.amos.boot.module.tzs.flc.api.service;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentInformDto;
/**
* 通话记录附件接口类
*
* @author system_generator
* @date 2021-12-27
*/
public interface IInformProcessInfoService {
// 保存流程过程记录
Boolean saveProcessInfo(EquipmentInformDto model, ReginParams userInfo, String processStage) throws Exception;
}
......@@ -37,5 +37,7 @@ public interface IUnitInfoService {
List<UnitInfoDto> getInspectionUnit();
List<UnitInfoDto> getUseUnit();
List<UnitInfoDto> getAllUnit();
List<UnitInfoDto> getUseUnit(String unitType, String address, String orgName, String organizationCode);
}
......@@ -11,9 +11,9 @@
tz_cylinder_info t
WHERE
t.sequence_nbr IN ( SELECT max( tt.sequence_nbr ) FROM tz_cylinder_info tt GROUP BY tt.sequence_code )
AND t.api_company_code = (
AND t.app_id = (
SELECT
u.api_company_code
u.app_id
FROM
tz_cylinder_unit u
WHERE
......
<?xml version="1.0" encoding="UTF-8"?>
<!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.tzs.flc.api.mapper.EquipmentIndexInformMapper">
</mapper>
......@@ -2,4 +2,140 @@
<!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.tzs.flc.api.mapper.EquipmentInformMapper">
<select id="queryDtoList" resultType="java.util.Map">
SELECT
a.sequence_nbr AS sequenceNbr,
a.product_code AS productCode,
a.product_unit AS productUnit,
CONCAT(a.province,a.city,a.district) AS productArea,
CONCAT(a.stree,a.community,a.address) AS address,
a.plan_product_date AS planProductDate,
a.product_inform_date AS productInformDate,
a.accept_unit AS acceptUnit,
CASE
a.inform_status
WHEN 0 THEN
'暂存'
WHEN 1 THEN
'未接收'
WHEN 2 THEN
'已接收'
WHEN 9 THEN
'已驳回'
ELSE
''
END AS informStatus,
IFNULL(t.equipmentNum, 0) as equipmentNum
FROM
tz_equipment_inform a
LEFT JOIN (select count(e.sequence_nbr) as equipmentNum, e.inform_id from tcb_inform_equipment e GROUP BY e.inform_id ) t on t.inform_id = a.sequence_nbr
WHERE a.is_delete = 0
AND a.product_unit_id = #{companyId}
<if test="productCode != null and productCode != ''">
AND a.product_code like CONCAT('%',#{productCode},'%')
</if>
<if test="productUnitId != null ">
AND a.product_unit_id = #{productUnitId}
</if>
<if test="regionCode != null and regionCode != ''">
AND a.region_code like CONCAT('%',#{regionCode},'%')
</if>
<if test="address != null and address != ''">
AND ( a.stree like CONCAT('%',#{address},'%')
or a.community like CONCAT('%',#{address},'%')
or a.address like CONCAT('%',#{address},'%') )
</if>
<if test="productInformDateStart != null and productInformDateStart != ''">
and #{productInformDateStart} <![CDATA[ <= ]]> a.product_inform_date
</if>
<if test="productInformDateEnd != null and productInformDateEnd != ''">
and a.product_inform_date <![CDATA[ <= ]]> #{productInformDateEnd}
</if>
<if test="planProductDateStart != null and planProductDateStart != ''">
and #{planProductDateStart} <![CDATA[ <= ]]> a.plan_product_date
</if>
<if test="planProductDateEnd != null and planProductDateEnd != ''">
and a.plan_product_date <![CDATA[ <= ]]> #{planProductDateEnd}
</if>
<if test="acceptUnitId != null ">
AND a.accept_unit_id = #{acceptUnitId}
</if>
<if test="informStatus != null and informStatus != ''">
AND a.inform_status = #{informStatus}
</if>
<if test="sortParam != null and sortParam != '' and sortRule != null and sortRule != '' ">
ORDER BY ${sortParam} ${sortRule}
</if>
</select>
<select id="queryDtoListSub" resultType="java.util.Map">
SELECT
a.sequence_nbr AS sequenceNbr,
a.product_code AS productCode,
a.product_unit AS productUnit,
CONCAT(a.province,a.city,a.district) AS productArea,
CONCAT(a.stree,a.community,a.address) AS address,
a.plan_product_date AS planProductDate,
a.product_inform_date AS productInformDate,
a.accept_unit AS acceptUnit,
CASE
a.inform_status
WHEN 0 THEN
'暂存'
WHEN 1 THEN
'未接收'
WHEN 2 THEN
'已接收'
WHEN 9 THEN
'已驳回'
ELSE
''
END AS informStatus,
IFNULL(t.equipmentNum, 0) as equipmentNum
FROM
tz_equipment_inform a
LEFT JOIN (select count(e.sequence_nbr) as equipmentNum, e.inform_id from tcb_inform_equipment e GROUP BY e.inform_id ) t on t.inform_id = a.sequence_nbr
WHERE a.is_delete = 0
AND a.accept_unit_id = #{companyId}
AND a.inform_status != 0
<if test="productCode != null and productCode != ''">
AND a.product_code like CONCAT('%',#{productCode},'%')
</if>
<if test="productUnitId != null ">
AND a.product_unit_id = #{productUnitId}
</if>
<if test="regionCode != null and regionCode != ''">
AND a.region_code like CONCAT('%',#{regionCode},'%')
</if>
<if test="address != null and address != ''">
AND ( a.stree like CONCAT('%',#{address},'%')
or a.community like CONCAT('%',#{address},'%')
or a.address like CONCAT('%',#{address},'%') )
</if>
<if test="productInformDateStart != null and productInformDateStart != ''">
and #{productInformDateStart} <![CDATA[ <= ]]> a.product_inform_date
</if>
<if test="productInformDateEnd != null and productInformDateEnd != ''">
and a.product_inform_date <![CDATA[ <= ]]> #{productInformDateEnd}
</if>
<if test="planProductDateStart != null and planProductDateStart != ''">
and #{planProductDateStart} <![CDATA[ <= ]]> a.plan_product_date
</if>
<if test="planProductDateEnd != null and planProductDateEnd != ''">
and a.plan_product_date <![CDATA[ <= ]]> #{planProductDateEnd}
</if>
<if test="acceptUnitId != null ">
AND a.accept_unit_id = #{acceptUnitId}
</if>
<if test="informStatus != null and informStatus != ''">
AND a.inform_status = #{informStatus}
</if>
<if test="sortParam != null and sortParam != '' and sortRule != null and sortRule != '' ">
ORDER BY ${sortParam} ${sortRule}
</if>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!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.tzs.flc.api.mapper.InformProcessInfoMapper">
</mapper>
......@@ -12,5 +12,43 @@
AND a.unit_type_code LIKE CONCAT('%', #{typeCode}, '%')
</select>
<select id="getAllUnit" resultType="com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto">
select
a.*
from tz_flc_unit_info a
where a.is_delete = 0
AND
(a.unit_status = '1' or a.is_change = 1)
</select>
<select id="getUnitByTypeParams" resultType="com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto">
select
a.*,
CONCAT(a.province, a.city, a.district ,a.stree,a.community,a.address ) as fullAddress
from tz_flc_unit_info a
where a.is_delete = 0 AND
(a.unit_status = '1' or a.is_change = 1)
AND a.unit_type_code LIKE CONCAT('%', #{typeCode}, '%')
<if test="unitType != null and unitType != ''">
AND a.unit_type LIKE CONCAT('%', #{unitType}, '%')
</if>
<if test="address != null and address != ''">
AND ( a.province LIKE CONCAT('%', #{address}, '%')
OR a.city LIKE CONCAT('%', #{address}, '%')
OR a.district LIKE CONCAT('%', #{address}, '%')
OR a.stree LIKE CONCAT('%', #{address}, '%')
OR a.community LIKE CONCAT('%', #{address}, '%')
OR a.address LIKE CONCAT('%', #{address}, '%')
)
</if>
<if test="orgName != null and orgName != ''">
AND a.org_name LIKE CONCAT('%', #{orgName}, '%')
</if>
<if test="organizationCode != null and organizationCode != ''">
AND a.organization_code LIKE CONCAT('%', #{organizationCode}, '%')
</if>
</select>
</mapper>
......@@ -172,7 +172,7 @@ public class CommandController extends BaseController {
public ResponseModel<Page<AlertCalledZhDto>> listhistoryPage(Integer pageNum, Integer pageSize, RequestData par) {
if(par.getStatus() != null&&par.getStatus() == -1 ){
if (par.getStatus() != null && par.getStatus() == -1) {
AgencyUserModel agencyUserModel = getUserInfo();
Long id = null;
......@@ -181,17 +181,17 @@ public class CommandController extends BaseController {
//获取正在进行的灾情null
if (userCar != null) {
AlertCalled alertCalled = powerTransferCompanyResourcesService.getByPowerTransferCompanyResourId(userCar.getCarId());
if(alertCalled!=null){
if (alertCalled != null) {
par.setAlertId(alertCalled.getSequenceNbr());
par.setStatus(null);
}else{
} else {
return ResponseHelper.buildResponse(null);
}
}else{
} else {
return ResponseHelper.buildResponse(null);
}
}else{
} else {
if (par.getStatus() == null) {
par.setStatus(1);
}
......@@ -295,15 +295,12 @@ public class CommandController extends BaseController {
@GetMapping(value = "video/list")
@ApiOperation(httpMethod = "GET", value = " 视频分页查询88", notes = "视频分页查询88")
public ResponseModel<Object> getVideo(Integer pageNum, Integer pageSize, RequestData par) {
if (par.getAlertId() != null) {
AlertCalled alertCalled = iAlertCalledService.getAlertCalledById(par.getAlertId());
par.setLatitude(alertCalled.getCoordinateX());
par.setLongitude(alertCalled.getCoordinateY());
}
ResponseModel<Page<Map<String, Object>>> data = equipFeignClient.pageVideo(pageNum == 0 ? 1 : pageNum, pageSize, par.getLongitude(), par.getLatitude(), par.getDistance());
Page<Map<String, Object>> pag = data != null ? data.getResult() : null;
List<Map<String, Object>> records = pag != null ? pag.getRecords() : null;
if (records != null && records.size() > 0) {
......@@ -344,21 +341,16 @@ public class CommandController extends BaseController {
}
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "分页查询视图下的视频列表")
@RequestMapping(value = "monitorView/video/page", method = RequestMethod.GET)
public ResponseModel<Page<Map<String, Object>>> queryUncheckedVideoList(
@RequestParam(value = "nodeId") Long nodeId,
@RequestParam(value = "nodeType" ,required =false) String nodeType,
@RequestParam(value = "nodeType", required = false) String nodeType,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size
) throws Exception
{
ResponseModel<Page<Map<String, Object>>> data = equipFeignClient.queryVideoPage(nodeId,nodeType,current,size);
) throws Exception {
ResponseModel<Page<Map<String, Object>>> data = equipFeignClient.queryVideoPage(nodeId, nodeType, current, size);
Page<Map<String, Object>> pag = data != null ? data.getResult() : null;
List<Map<String, Object>> records = pag != null ? pag.getRecords() : null;
if (records != null && records.size() > 0) {
......@@ -376,24 +368,21 @@ public class CommandController extends BaseController {
@GetMapping(value = "confirmAlarm/getDetailsById")
@ApiOperation(value = "根据id,type查询确警页面相关数据")
public ResponseModel<Map<String, Object>> getDetailsById(@RequestParam Long alamId, @RequestParam Long equipId, @RequestParam String type, @RequestParam String area) {
ResponseModel<Map<String, Object>> response = equipFeignClient.getDetailsById( alamId, equipId, type, area);
ResponseModel<Map<String, Object>> response = equipFeignClient.getDetailsById(alamId, equipId, type, area);
Map<String, Object> data = response.getResult();
List<Map<String, Object>> records = data != null ? (List<Map<String, Object>>)data.get("video") : null;
List<Map<String, Object>> records = data != null ? (List<Map<String, Object>>) data.get("video") : null;
if (records != null && records.size() > 0) {
for (Map<String, Object> record : records) {
ResponseModel<String> da = videoFeignClient.videoUrlByIndexCode(record.get("code") + "");
String url = da != null ? da.getResult().substring(da.getResult().indexOf("openUrl")) : null;
record.put("url", url);
}
data.put("video",records);
data.put("video", records);
}
return ResponseHelper.buildResponse(data);
}
/**
* 水源列表分页查询
*
......@@ -590,15 +579,15 @@ public class CommandController extends BaseController {
public ResponseModel<JSONObject> selectOne(Long id) {
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(iWaterResourceService.selectBySequenceNbr(id)));
if(!ValidationUtil.isEmpty(jsonObject.get("buildDate"))) {
if (!ValidationUtil.isEmpty(jsonObject.get("buildDate"))) {
String str = jsonObject.get("buildDate").toString();
Date date = new Date(Long.parseLong(str));
jsonObject.put("buildDate", DateUtils.convertDateToString(date,DateUtils.DATE_TIME_PATTERN));
jsonObject.put("buildDate", DateUtils.convertDateToString(date, DateUtils.DATE_TIME_PATTERN));
} else {
jsonObject.put("buildDate", "");
}
if(ValidationUtil.isEmpty(jsonObject.get("intakeHeight"))) {
if (ValidationUtil.isEmpty(jsonObject.get("intakeHeight"))) {
jsonObject.put("intakeHeight", "");
}
......@@ -641,7 +630,7 @@ public class CommandController extends BaseController {
String time = DateUtil.formatDate(alertCalledZhDto.getCallTime(), "yyyy-MM-dd HH:mm:ss");
st.append("【").append(alertCalledZhDto.getAlertType()).append("】").append(" ").append(time).append(" ").append(alertCalledZhDto.getAddress());
st.append("【").append(alertCalledZhDto.getAlertType()).append("】").append(" ").append(time).append(" ").append(alertCalledZhDto.getAddress()!=null?alertCalledZhDto.getAddress():"");
SeismometeorologyDto sto = new SeismometeorologyDto(alertCalledZhDto.getSequenceNbr(), "1", "警情通知", null, alertCalledZhDto.getCallTime(), null, st.toString());
li.add(sto);
......@@ -1075,8 +1064,7 @@ public class CommandController extends BaseController {
Page page = new Page(current, size);
List<OrderItem> list = OrderItem.ascs("id");
page.setOrders(list);
ResponseModel<Page<Map<String, Object>>> data = equipFeignClient.getVideo(current, size, 0l);
ResponseModel<Page<Map<String, Object>>> data = equipFeignClient.getVideo(current, size, 0L);
Page<Map<String, Object>> pag = data != null ? data.getResult() : null;
List<Map<String, Object>> records = pag != null ? pag.getRecords() : null;
if (records != null && records.size() > 0) {
......@@ -1454,7 +1442,6 @@ public class CommandController extends BaseController {
}
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "getPowerTransferCompanyResourcesServiceNew", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取当前任务,车辆状态,随车人员,任务详情", notes = "获取当前任务,车辆状态,随车人员,任务详情")
......@@ -1465,27 +1452,22 @@ public class CommandController extends BaseController {
// 根据车牌查询车辆调派信息级警情id
List<PowerData> pw = powerTransferMapper.getPowerDataCar(id);
if(null != pw && pw.size() > 0) {
if (null != pw && pw.size() > 0) {
Long alertCalledId = Long.valueOf(pw.get(0).getAlertCallId());
Long carid = Long.valueOf(pw.get(0).getResourcesId());
//获取正在进行的灾情
powerTransferCompanyResources = powerTransferCompanyResourcesService.getByAlertCalledIdCarId(alertCalledId, carid);
// 随车人员
// List<PowerData> powerDataOne = powerTransferMapper.getPowerDataOne(carid);
List<Map<String, Object>> equipmentList = iDutyCarService.getDutyCaruser(carid);
if(!ValidationUtil.isEmpty(equipmentList)) {
if (!ValidationUtil.isEmpty(equipmentList)) {
String str = "";
String newStr = "";
for(int i = 0; i < equipmentList.size(); i++ ) {
if(i==equipmentList.size()-1){
newStr = str.concat(equipmentList.get(i).get("userName")+"");
}else{
newStr = str.concat(equipmentList.get(i).get("userName")+",");
for (int i = 0; i < equipmentList.size(); i++) {
if (i == equipmentList.size() - 1) {
newStr =newStr+ str.concat(equipmentList.get(i).get("userName") + "");
} else {
newStr = newStr+str.concat(equipmentList.get(i).get("userName") + ",");
}
}
powerTransferCompanyResources.setPw(newStr);
......@@ -1494,38 +1476,39 @@ public class CommandController extends BaseController {
}
//任务详情
PowerData powerData = powerTransferMapper.getPowerDataOther(alertCalledId,carid);
if(null != powerData) {
PowerData powerData = powerTransferMapper.getPowerDataOther(alertCalledId, carid);
if (null != powerData) {
powerTransferCompanyResources.setTaskInformation(powerData.getTaskInformation());
}
} else {
ResponseModel<Map<String, Object>> equipmentIndexDto = equipFeignClient.getCarDetailByCarNum(id);
if(equipmentIndexDto.getResult().size() == 0) {
if (equipmentIndexDto.getResult().size() == 0) {
return ResponseHelper.buildResponse(null);
}
// LambdaQueryWrapper<PowerTransferCompanyResources> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(PowerTransferCompanyResources::getResourcesNum,id);
// powerTransferCompanyResources = powerTransferCompanyResourcesMapper.selectOne(queryWrapper);
if(!ValidationUtil.isEmpty(equipmentIndexDto.getResult())) {
Map<String,Object> map = equipmentIndexDto.getResult();
if (!ValidationUtil.isEmpty(equipmentIndexDto.getResult())) {
Map<String, Object> map = equipmentIndexDto.getResult();
// 随车人员
List<PowerData> powerDataOne = powerTransferMapper.getPowerDataOne(Long.valueOf(map.get("id").toString()));
List<Map<String, Object>> equipmentList = iDutyCarService.getDutyCaruser(Long.valueOf(map.get("id").toString()));
powerTransferCompanyResources.setResourcesName(map.get("name").toString());
powerTransferCompanyResources.setResourcesNum(map.get("carNum").toString());
if(!ValidationUtil.isEmpty(powerDataOne)) {
if (!ValidationUtil.isEmpty(equipmentList)) {
String str = "";
String newStr = "";
for(int i = 0; i < powerDataOne.size(); i++ ) {
newStr = str.concat(powerDataOne.get(i).getPostTypeName()).concat(":").concat(powerDataOne.get(i).getUser());
for (int i = 0; i < equipmentList.size(); i++) {
if (i == equipmentList.size() - 1) {
newStr = newStr+str.concat(equipmentList.get(i).get("userName") + "");
} else {
newStr =newStr+ str.concat(equipmentList.get(i).get("userName") + ",");
}
}
powerTransferCompanyResources.setPw(newStr);
} else {
powerTransferCompanyResources.setPw("无");
}
powerTransferCompanyResources.setStatusName("无任务");
powerTransferCompanyResources.setCarStatusName(FireCarStatusEnum.getEnum(map.get("carState").toString()).getName());
powerTransferCompanyResources.setCarStatusName("执勤");
powerTransferCompanyResources.setTaskInformation("无");
}
}
......
package com.yeejoin.amos.boot.module.common.biz.controller;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSON;
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.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamCardDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamListDto;
......@@ -44,9 +17,23 @@ import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FireTeamServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 消防队伍
......@@ -101,11 +88,11 @@ public class FireTeamController extends BaseController {
@RequestMapping(value = "/updateById", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "修改消防队伍", notes = "修改消防队伍")
public ResponseModel<Object> updateByIdFireTeam(HttpServletRequest request, @RequestBody FireTeam fireTeam) {
if (ValidationUtil.isEmpty(fireTeam.getSequenceNbr())){
if (ValidationUtil.isEmpty(fireTeam.getSequenceNbr())) {
throw new BadRequest("更新消防队伍必须传入主键");
}
// BUG 2842 由 BUG2217 2684 新增业务 需要统计消防队伍旗下所有消防队伍信息导致数据逻辑错误 返回错误提示 2021-09-10 by kongfm
if(fireTeam.getSequenceNbr().equals(fireTeam.getParent())) {
if (fireTeam.getSequenceNbr().equals(fireTeam.getParent())) {
throw new BadRequest("消防队伍上级不可选为自己");
}
return ResponseHelper.buildResponse(iFireTeamService.saveFireTeam(fireTeam));
......@@ -266,7 +253,7 @@ public class FireTeamController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{teamIds}/company", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "查询消防队伍所属单位", notes = "查询消防队伍所属单位")
public ResponseModel<FireTeam> listFighterCompany(@PathVariable(value = "teamIds")String teamIds) {
public ResponseModel<FireTeam> listFighterCompany(@PathVariable(value = "teamIds") String teamIds) {
FireTeam fireTeamBySequenceNbr = iFireTeamService.getFireTeamBySequenceNbr(Long.valueOf(teamIds));
return ResponseHelper.buildResponse(fireTeamBySequenceNbr);
}
......@@ -275,8 +262,8 @@ public class FireTeamController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/firstAid", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "急救站", notes = "急救站")
public Object getFirstAidForTypeCodeAndCompanyId(String code, String typeCode,Long companyId) {
return ResponseHelper.buildResponse(iFireTeamService.getFirstAidForTypeCodeAndCompanyId(code,typeCode,companyId));
public Object getFirstAidForTypeCodeAndCompanyId(String code, String typeCode, Long companyId) {
return ResponseHelper.buildResponse(iFireTeamService.getFirstAidForTypeCodeAndCompanyId(code, typeCode, companyId));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -285,11 +272,12 @@ public class FireTeamController extends BaseController {
public ResponseModel<List<Menu>> getFirstTeamToDesignatedDepartment() throws Exception {
return ResponseHelper.buildResponse(iFireTeamService.getFirstTeamToDesignatedDepartment());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/find/departmentTree", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = " 消防队伍中 消救部 下的 类型为【企(事)业单位专职消防救援队】的队伍", notes = " 消防队伍中 消救部下的 类型为【企(事)业单位专职消防救援队】的队伍")
public ResponseModel<List<Menu>> getFirstTeamToDesignatedDepartment(@RequestParam String dicCode,@RequestParam String typeCode) throws Exception {
return ResponseHelper.buildResponse(iFireTeamService.getFirstTeamToDesignatedDepartment(dicCode,typeCode));
public ResponseModel<List<Menu>> getFirstTeamToDesignatedDepartment(@RequestParam String dicCode, @RequestParam String typeCode) throws Exception {
return ResponseHelper.buildResponse(iFireTeamService.getFirstTeamToDesignatedDepartment(dicCode, typeCode));
}
@PersonIdentify
......
......@@ -219,7 +219,6 @@ public class OrgUsrController extends BaseController {
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public IPage<OrgUsr> listPage(String pageNum, String pageSize, OrgUsr orgUsr) {
Page<OrgUsr> pageBean;
QueryWrapper<OrgUsr> orgUsrQueryWrapper = new QueryWrapper<>();
Class<? extends OrgUsr> aClass = orgUsr.getClass();
......@@ -247,6 +246,7 @@ public class OrgUsrController extends BaseController {
} catch (Exception e) {
}
});
orgUsrQueryWrapper.eq("is_delete", 0);
IPage<OrgUsr> page;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
......@@ -503,7 +503,6 @@ public class OrgUsrController extends BaseController {
@RequestMapping(value = "/getAmosId/{amosId}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "判断关联账户是否已关联", notes = "判断关联账户是否已关联")
public ResponseModel<Object> getAmosId(@PathVariable String amosId) {
return ResponseHelper.buildResponse(iOrgUsrService.amosIdExist(amosId));
}
......
......@@ -122,11 +122,16 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID
public List< Map<String, Object>> getFirstAidExportData(List<String> ids) {
List< Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
List< Map<String, Object>> result = new ArrayList<Map<String, Object>>();
List<String> userNameList= new ArrayList<String>();
List<String> firstAidSimpleList = new ArrayList<String>();
List<String> companyNameList = new ArrayList<String>();
String typeString = "JJZ";
ids.stream().forEach(i->{
Map<String, Object> detailMap = new HashMap<String, Object>();
List<OrgUsr> personList = orgUsrServiceImpl.getPersonListByParentId(Long.parseLong(i));
List<String> userNameList= new ArrayList<String>();
personList.stream().forEach(m -> {
String userNameString =m.getBizOrgName()+ "@" +m.getSequenceNbr();
userNameList.add(userNameString);
......@@ -134,28 +139,29 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID
detailMap.put("userName", userNameList);
OrgUsr companyDetail = orgUsrServiceImpl.getDetailById(Long.parseLong(i));
String companyNameString = companyDetail.getBizOrgName()+ "@" +companyDetail.getSequenceNbr();
detailMap.put("companyName", companyNameString);
companyNameList.add(companyNameString);
detailMap.put("companyName", companyNameList);
List<DataDictionary> dataDicList= dataDictionaryService.getByType(typeString);
List<String> dataDicSimpleList = new ArrayList<String>();
dataDicList.stream().forEach(l->{
String dataDic = l.getName() + "@" +l.getCode();
dataDicSimpleList.add(dataDic);
});
detailMap.put("postTypeName",dataDicSimpleList);
List<Map<String, Object>> list = dutyPersonShiftMapper.getFirstAidForTypeCodeAndCompanyId(
Long.parseLong(i));
List<String> firstAidSimpleList = new ArrayList<String>();
list.stream().forEach(m -> {
String firstAidNameString = m.get("name").toString() + "@" + m.get("sequence_nbr").toString();
firstAidSimpleList.add(firstAidNameString);
});
if( firstAidSimpleList != null && firstAidSimpleList.size() > 1 ) {
if( firstAidSimpleList != null && firstAidSimpleList.size() >= 1 ) {
detailMap.put("firstAidName", firstAidSimpleList);
resultList.add(detailMap);
}
});
return resultList;
result.add(resultList.get(0));
return result;
}
}
......@@ -282,9 +282,12 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
failureDetailsDto.setFailureCode(buildOrderNo());
String parentId = iOrgUsrService.getParentId(userInfo.getUserModel().getUserId());
if (parentId != null){
failureDetailsDto.setBizCode(Long.valueOf(parentId));
}
OrgUsr orgUsr = iOrgUsrService.getById(parentId);
failureDetailsDto.setBizCode(Long.valueOf(parentId));
model = this.createWithModel(failureDetailsDto);
if (ObjectUtils.isNotEmpty(failureDetailsDto.getAttachment())) {
......
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.common.api.entity.Firefighters;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -36,18 +16,24 @@ import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.common.api.dto.FireBrigadeResourceDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamCardDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamListDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamZhDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto;
import com.yeejoin.amos.boot.module.common.api.dto.RequestData;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.FireTeamMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFireTeamService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
* 消防队伍 服务实现类
......@@ -72,7 +58,6 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
DataDictionaryServiceImpl iDataDictionaryService;
/**
* 获取监控大队列表
*
......@@ -146,15 +131,16 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
public List<FireTeamDto> queryFireTeamForListTree(Boolean isDelete) {
return fireTeamMapper.listFireTeamDtoTree(isDelete);
}
public List<FireTeamDto> queryFireTeamForList(Boolean isDelete,Map map) {
if(map== null || map.size()<1) {
return fireTeamMapper.listFireTeamDto(isDelete,null,null,null,null,null);
public List<FireTeamDto> queryFireTeamForList(Boolean isDelete, Map map) {
if (map == null || map.size() < 1) {
return fireTeamMapper.listFireTeamDto(isDelete, null, null, null, null, null);
}
String nodeId =map.containsKey("nodeId")?map.get("nodeId").toString():null;
String nodeType =map.containsKey("nodeType")?map.get("nodeType").toString():null;
String name =map.containsKey("name")?map.get("name").toString():null;
String typeCode =map.containsKey("typeCode")?map.get("typeCode").toString():null;
List<String> nodeIdsList=null;
String nodeId = map.containsKey("nodeId") ? map.get("nodeId").toString() : null;
String nodeType = map.containsKey("nodeType") ? map.get("nodeType").toString() : null;
String name = map.containsKey("name") ? map.get("name").toString() : null;
String typeCode = map.containsKey("typeCode") ? map.get("typeCode").toString() : null;
List<String> nodeIdsList = null;
// 查询单位
if (Objects.equals("1", nodeType)) {
List<OrgUsr> companyDeptList = orgUsrService.listOrgUserById(Long.parseLong(nodeId));
......@@ -165,8 +151,9 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
List<FireTeam> teamList = listFireTeamById(Long.parseLong(nodeId));
nodeIdsList = teamList.stream().map(e -> e.getSequenceNbr().toString()).collect(Collectors.toList());
}
return fireTeamMapper.listFireTeamDto(isDelete,nodeId,nodeType,name,typeCode,nodeIdsList);
return fireTeamMapper.listFireTeamDto(isDelete, nodeId, nodeType, name, typeCode, nodeIdsList);
}
/**
* 根据列表构造队伍树
*
......@@ -201,7 +188,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
});
// 消防队伍
List<MenuFrom> teamMenuList = Lists.newArrayList();
List<FireTeamDto> teamList = this.queryFireTeamForList(false,null);
List<FireTeamDto> teamList = this.queryFireTeamForList(false, null);
teamList.forEach(team -> {
if (ValidationUtil.isEmpty(team.getParent())) {
// 将单位下没有上级队伍的队伍直接挂在单位下(方便组成树结构)
......@@ -251,11 +238,11 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
} else {
/*如果修改的队伍有下级队伍,所属单位一起修改 2021-10-18 陈召 开始*/
LambdaQueryWrapper<FireTeam> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FireTeam::getParent,fireTeam.getSequenceNbr());
wrapper.eq(BaseEntity::getIsDelete,false);
wrapper.eq(FireTeam::getParent, fireTeam.getSequenceNbr());
wrapper.eq(BaseEntity::getIsDelete, false);
List<FireTeam> fireTeams = baseMapper.selectList(wrapper);
if (!fireTeams.isEmpty()){
fireTeams.forEach(i->{
if (!fireTeams.isEmpty()) {
fireTeams.forEach(i -> {
i.setCompany(fireTeam.getCompany());
i.setCompanyName(fireTeam.getCompanyName());
i.setCompanyCode(fireTeam.getCompanyCode());
......@@ -332,7 +319,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
ResponseModel<List<Map<String, Object>>> result = equipFeignClient.getFireCarListAllcount();
List<Map<String, Object>> result1 = result.getResult();
if(result1!=null&&result1.size()> 0){
if (result1 != null && result1.size() > 0) {
list.forEach(fireTeamZhDto -> {
Long sequenceNbr = fireTeamZhDto.getSequenceNbr();
result1.forEach(map -> {
......@@ -430,10 +417,11 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
/**
* 加载系统中本单位消防队伍中类型为【企(事)业单位医疗救援队(站)】的队伍 --->急救站
*
* @param typeCode
*/
public List<FireTeam> getFirstAidForTypeCodeAndCompanyId(String dicCode,String typeCode,Long companyId) {
DataDictionary dataDictionary = iDataDictionaryService.getByCode(dicCode,typeCode);
public List<FireTeam> getFirstAidForTypeCodeAndCompanyId(String dicCode, String typeCode, Long companyId) {
DataDictionary dataDictionary = iDataDictionaryService.getByCode(dicCode, typeCode);
if (ObjectUtils.isEmpty(dataDictionary)) {
return null;
}
......@@ -461,15 +449,15 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
return TreeParser.getTree(null, this.baseMapper.selectList(queryWrapper), FireTeam.class.getName(), "getSequenceNbr", 2, "getName", "getParent",
null);
}
/**
*
* @param name
* @return
* @throws Exception
*/
public List<Menu> getFirstTeamToDesignatedDepartment(String dicCode, String typeCode) throws Exception {
DataDictionary dataDictionary = iDataDictionaryService.getByCode(dicCode,typeCode);
public List<Menu> getFirstTeamToDesignatedDepartment(String dicCode, String typeCode) throws Exception {
DataDictionary dataDictionary = iDataDictionaryService.getByCode(dicCode, typeCode);
if (ObjectUtils.isEmpty(dataDictionary)) {
return null;
}
......@@ -482,17 +470,17 @@ public List<Menu> getFirstTeamToDesignatedDepartment(String dicCode, String type
queryWrapper1.eq(FireTeam::getIsDelete, false);
queryWrapper1.eq(FireTeam::getCompanyName, "消防救援保障部");
queryWrapper1.isNull(FireTeam::getParent);
FireTeam parentFireTeam= this.baseMapper.selectOne(queryWrapper1);
if(parentFireTeam==null ) {
FireTeam parentFireTeam = this.baseMapper.selectOne(queryWrapper1);
if (parentFireTeam == null) {
return null;
}
return TreeParser.getTree(parentFireTeam.getSequenceNbr() , this.baseMapper.selectList(queryWrapper), FireTeam.class.getName(), "getSequenceNbr", 2, "getName", "getParent",
return TreeParser.getTree(parentFireTeam.getSequenceNbr(), this.baseMapper.selectList(queryWrapper), FireTeam.class.getName(), "getSequenceNbr", 2, "getName", "getParent",
null);
// TODO Auto-generated method stub
}
}
public List<Menu> getFireTeamTypeTree(String bizOrgCode) throws Exception {
public List<Menu> getFireTeamTypeTree(String bizOrgCode) throws Exception {
return iDataDictionaryService.getFireTeamTypeTree(bizOrgCode);
}
}
}
......@@ -33,13 +33,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -116,7 +110,7 @@ public class MaintenanceCompanyServiceImpl
maintenanceCompany.setType(maintenanceCompany.getType().toUpperCase());
maintenanceCompany.setIsDelete(false);
this.save(maintenanceCompany);
if (maintenanceCompany.getAttachments().isEmpty()){
if (maintenanceCompany.getAttachments().isEmpty()) {
sourceFileService.saveAttachments(maintenanceCompany.getSequenceNbr(), maintenanceCompany.getAttachments());
}
return maintenanceCompany;
......@@ -151,7 +145,7 @@ public class MaintenanceCompanyServiceImpl
maintenanceCompany.setParentId(parentId);
maintenanceCompany.setIsDelete(false);
this.save(maintenanceCompany);
if (maintenanceCompany.getAttachments().isEmpty()){
if (maintenanceCompany.getAttachments().isEmpty()) {
sourceFileService.saveAttachments(maintenanceCompany.getSequenceNbr(), maintenanceCompany.getAttachments());
}
return maintenanceCompany;
......@@ -185,7 +179,7 @@ public class MaintenanceCompanyServiceImpl
maintenanceCompany.setParentId(parentId);
maintenanceCompany.setIsDelete(false);
this.save(maintenanceCompany);
if (maintenanceCompany.getAttachments().isEmpty()){
if (maintenanceCompany.getAttachments().isEmpty()) {
sourceFileService.saveAttachments(maintenanceCompany.getSequenceNbr(), maintenanceCompany.getAttachments());
}
return maintenanceCompany;
......@@ -199,10 +193,10 @@ public class MaintenanceCompanyServiceImpl
}
// 新增删除维保单位逻辑,BUG 2500 单位下有子单位或者人员时应无法直接删除. by litw satrt
LambdaQueryWrapper<MaintenanceCompany> wrapperCompany = new LambdaQueryWrapper<MaintenanceCompany>();
wrapperCompany.eq(MaintenanceCompany::getParentId,sequenceNbr);
wrapperCompany.eq(MaintenanceCompany::getIsDelete,false);
wrapperCompany.eq(MaintenanceCompany::getParentId, sequenceNbr);
wrapperCompany.eq(MaintenanceCompany::getIsDelete, false);
int count = maintenanceCompanyMapper.selectCount(wrapperCompany);
if(count > 0) {
if (count > 0) {
throw new BadRequest("单位下有子单位或者人员,无法删除");
}
......@@ -271,7 +265,7 @@ public class MaintenanceCompanyServiceImpl
dynamicFormList.forEach(r -> {
MaintenanceCompany detail = maintenanceCompanyMap.get(Long.parseLong(r.get("instanceId").toString()));
if (!ObjectUtils.isEmpty(detail)) {
if(detail.getParentId()!=null) {
if (detail.getParentId() != null) {
MaintenanceCompany map = maintenanceCompanyMapper.selectById(detail.getParentId());
r.put("parentName", map.getName());
}
......@@ -280,7 +274,8 @@ public class MaintenanceCompanyServiceImpl
});
return dynamicFormList;
}
public List<Map<String, Object>> getAllMaintenanceEexcleList(String maintenanceType,Map parms) {
public List<Map<String, Object>> getAllMaintenanceEexcleList(String maintenanceType, Map parms) {
String type = null;
switch (maintenanceType.toUpperCase()) {
case PERSON:
......@@ -299,13 +294,13 @@ public class MaintenanceCompanyServiceImpl
LambdaQueryWrapper<MaintenanceCompany> wrapper = new LambdaQueryWrapper<MaintenanceCompany>();
wrapper.eq(MaintenanceCompany::getType, maintenanceType.toUpperCase());
wrapper.eq(MaintenanceCompany::getIsDelete, false);
if(parms!=null && parms.size()>0) {
String name =parms.containsKey("name")?parms.get("name").toString():null;
String parentId =parms.containsKey("parentId")?parms.get("parentId").toString():null;
if(name!=null) {
if (parms != null && parms.size() > 0) {
String name = parms.containsKey("name") ? parms.get("name").toString() : null;
String parentId = parms.containsKey("parentId") ? parms.get("parentId").toString() : null;
if (name != null) {
wrapper.like(MaintenanceCompany::getName, name);
}
if(parentId!=null) {
if (parentId != null) {
wrapper.eq(MaintenanceCompany::getParentId, parentId);
}
......@@ -317,18 +312,19 @@ public class MaintenanceCompanyServiceImpl
dynamicFormList.forEach(r -> {
MaintenanceCompany detail = maintenanceCompanyMap.get(Long.parseLong(r.get("instanceId").toString()));
if (!ObjectUtils.isEmpty(detail)) {
if(detail.getParentId()!=null && detail.getName()!=null) {
if (detail.getParentId() != null && detail.getName() != null) {
MaintenanceCompany map = maintenanceCompanyMapper.selectById(detail.getParentId());
r.put("parentName", map.getName());
r.putAll(Bean.BeantoMap(detail));
}
}
});
return dynamicFormList.stream().filter(i-> i.containsKey("name")).collect(Collectors.toList());
return dynamicFormList.stream().filter(i -> i.containsKey("name")).collect(Collectors.toList());
}
@Override
public List<MaintenancePersonExcleDto> exportToMaintenancePersonExcel(Map map) {
List<Map<String, Object>> list = this.getAllMaintenanceEexcleList(PERSON,map);
List<Map<String, Object>> list = this.getAllMaintenanceEexcleList(PERSON, map);
return JSONArray.parseArray(JSONArray.toJSONString(list), MaintenancePersonExcleDto.class);
}
......@@ -350,6 +346,19 @@ public class MaintenanceCompanyServiceImpl
return Lists.newArrayList();
}
@Override
public List<MaintenanceCompany> findPersonByAmosOrgId(String code, String userId) {
LambdaQueryWrapper<MaintenanceCompany> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(MaintenanceCompany::getType, code);
queryWrapper.eq(MaintenanceCompany::getAmosId, userId);
return this.baseMapper.selectList(queryWrapper);
}
@Override
public MaintenanceCompany getOne(Long parentId) {
return this.getById(parentId);
}
/**
* 维保单位人员信息分頁信息显示时的字段过滤
*
......@@ -365,7 +374,7 @@ public class MaintenanceCompanyServiceImpl
Map<String, Object> legalMap = null;
for (Map<String, Object> map : list.getRecords()) {
legalMap = new HashMap<String, Object>();
for (Entry<String, Object> m : map.entrySet()) {
for (Map.Entry<String, Object> m : map.entrySet()) {
if (Arrays.asList(arrayType).contains(m.getKey())) {
legalMap.putAll(map);
}
......@@ -405,7 +414,7 @@ public class MaintenanceCompanyServiceImpl
}
mainTableList = this.checkMaintenanceCompanyList(wrapper, paramsMap);
/*BUG 2503 人员头像存在附件中,获取附件信息返回前端 start*/
for (MaintenanceCompany m:mainTableList
for (MaintenanceCompany m : mainTableList
) {
m.setAttachments(sourceFileService.getAttachments(m.getSequenceNbr()));
}
......@@ -521,7 +530,7 @@ public class MaintenanceCompanyServiceImpl
parentCode = parent.getCode();
}
// 旧父节点的code
if(company.getCode() != null){
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()));
......@@ -633,7 +642,7 @@ public class MaintenanceCompanyServiceImpl
MaintenanceCompany maintenanceCompany = new MaintenanceCompany();
if (ValidationUtil.isEmpty(seq)) {
maintenanceCompany = getMaintenanceCompany(amosUserId);
seq = maintenanceCompany.getSequenceNbr();
seq = maintenanceCompany.getParentId();
}
// 机场单位列表基本信息
if (pageNum == -1 || pageSize == -1) {
......@@ -719,9 +728,9 @@ public class MaintenanceCompanyServiceImpl
/**
* 复制map对象
*
* @explain 将paramsMap中的键值对全部拷贝到resultMap中;
* @param paramsMap 被拷贝对象
* @param resultMap 拷贝后的对象
* @explain 将paramsMap中的键值对全部拷贝到resultMap中;
*/
private static void mapCopy(Map paramsMap, Map resultMap) {
if (resultMap == null) {
......
......@@ -21,6 +21,7 @@ import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.enums.OrgPersonEnum;
import com.yeejoin.amos.boot.module.common.api.enums.UserRolesEnum;
import com.yeejoin.amos.boot.module.common.api.enums.UserUnitTypeEnum;
import com.yeejoin.amos.boot.module.common.api.feign.AmosTrainingFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.DynamicFormInstanceMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.service.IMaintenanceCompanyService;
......@@ -50,6 +51,7 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* 机构/部门/人员表 服务实现类
*
......@@ -92,14 +94,15 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Autowired
DynamicFormInstanceMapper dynamicFormInstanceMapper;
@Autowired
AmosTrainingFeignClient amosTrainingFeignClient;
public static List<OrgMenuDto> buildTreeParallel(List<OrgUsr> list) {
List<OrgMenuDto> menuList = list.stream().map(o ->
new OrgMenuDto(o.getSequenceNbr(), o.getBizOrgName(),
ObjectUtils.isEmpty(o.getParentId()) ? 0L : Long.parseLong(o.getParentId()), o.getBizOrgType(), false,
o.getBizOrgCode()).setTotal(o.getTotal())).collect(Collectors.toList());
List<OrgMenuDto> result = new ArrayList<>();
Map<Long, OrgMenuDto> map = new HashMap<>(menuList.size());
menuList.forEach(e -> map.put(e.getKey(), e));
......@@ -747,6 +750,11 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Override
public OrgPersonDto updateByIdOrgPerson(OrgPersonDto OrgPersonVo, Long id) throws Exception {
try {
updatePersonNumber(id, OrgPersonVo);
} catch (Exception e) {
logger.info("同步修改培训计划中的人员编号:---------------" + id);
}
// 修改人员信息
OrgUsr orgUsr = new OrgUsr();
OrgUsr oriOrgUsr = getById(id);
......@@ -781,6 +789,23 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return OrgPersonVo;
}
void updatePersonNumber(Long id, OrgPersonDto OrgPersonVo) {
String oldNumber = null;
String newNumber = null;
List<DynamicFormInstanceDto> list = alertFormValueServiceImpl.listByCalledId(id);
for (DynamicFormInstanceDto dynamicFormInstanceDto : list) {
if (dynamicFormInstanceDto.getFieldCode().equals("personNumber")) {
oldNumber = dynamicFormInstanceDto.getFieldValue();
}
}
for (DynamicFormInstance dynamicForm : OrgPersonVo.getDynamicFormValue()) {
if (dynamicForm.getFieldCode().equals("personNumber")) {
newNumber = dynamicForm.getFieldValue();
}
}
amosTrainingFeignClient.updOperationNumber(newNumber, oldNumber);
}
@Override
public OrgUsrFormDto selectCompanyById(Long id) throws Exception {
OrgUsr orgUsr = getById(id);
......@@ -1172,10 +1197,14 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
}
public String getParentId(String amosOrgId) {
List<OrgUsrDto> orgUsrDtos = queryForList("", false, amosOrgId);
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BaseEntity::getIsDelete, false);
wrapper.eq(OrgUsr::getAmosOrgId, amosOrgId);
List<OrgUsr> orgUsrs = orgUsrMapper.selectList(wrapper);
String parentId = null;
if (orgUsrDtos.size() >= 1) {
parentId = orgUsrDtos.get(0).getParentId();
if (orgUsrs.size() >= 1) {
parentId = orgUsrs.get(0).getParentId();
} else {
return null;
}
......@@ -1233,15 +1262,15 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Override
public UserUnitDto getUserUnit(String userId) {
if (StringUtils.isNotBlank(userId)) {
String[] typeArr = TYPE.split(",");
// 业主单位
// 业主单位人员
List<UserUnitDto> list = orgUsrMapper.getUserUnit(userId, typeArr[0], null);
// 维保单位
List<DynamicFormInstance> instanceList = alertFormValueServiceImpl.getInstanceByCodeAndValue(CODE, userId);
if (!CollectionUtils.isEmpty(list) && !CollectionUtils.isEmpty(instanceList)) {
// 维保单位人员
// maintenanceCompanyService.findPerssonByAmosOrgId(typeArr[0], userId);
List<MaintenanceCompany> maintenancePersons = null;
if (!CollectionUtils.isEmpty(list) && !CollectionUtils.isEmpty(maintenancePersons)) {
throw new RuntimeException("人员绑定单位重复!");
} else {
}
if (!CollectionUtils.isEmpty(list)) {
if (list.size() == 1) {
UserUnitDto userUnitDto = list.get(0);
......@@ -1258,43 +1287,23 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
throw new RuntimeException("未获取人员业主单位!");
}
throw new RuntimeException("人员绑定业主单位不唯一!");
} else {
if (!CollectionUtils.isEmpty(instanceList)) {
if (instanceList.size() == 1) {
Long instanceId = instanceList.get(0).getInstanceId();
List<MaintenanceCompany> maintenanceCompanyList = maintenanceCompanyService
.findByInstanceIdAndType(instanceId, typeArr[0]);
if (!CollectionUtils.isEmpty(maintenanceCompanyList)) {
if (maintenanceCompanyList.size() == 1) {
MaintenanceCompany person = maintenanceCompanyList.get(0);
}
if (!CollectionUtils.isEmpty(maintenancePersons)) {
if (maintenancePersons.size() == 1) {
MaintenanceCompany person = maintenancePersons.get(0);
MaintenanceCompany maintenanceCompany = maintenanceCompanyService.getOne(person.getParentId());
UserUnitDto unitDto = new UserUnitDto();
unitDto.setIdentityType(UserUnitTypeEnum.MAINTENANCE_COMPANY.getValue());
unitDto.setPersonSeq(String.valueOf(person.getSequenceNbr()));
unitDto.setPersonName(person.getName());
String codeVal = person.getCode().substring(0, 5);
if (StringUtils.isNotBlank(codeVal)) {
List<MaintenanceCompany> companyList = maintenanceCompanyService
.findByCodeAndType(codeVal, typeArr[1]);
if (!CollectionUtils.isEmpty(companyList)) {
MaintenanceCompany company = companyList.get(0);
unitDto.setCompanyId(String.valueOf(company.getSequenceNbr()));
unitDto.setCompanyName(company.getName());
unitDto.setCompanyId(String.valueOf(maintenanceCompany.getSequenceNbr()));
unitDto.setCompanyName(maintenanceCompany.getName());
return unitDto;
}
}
throw new RuntimeException("未获取人员维保单位!");
}
throw new RuntimeException("人员绑定维保单位不唯一!");
}
}
throw new RuntimeException("人员绑定维保单位不唯一!");
}
}
}
throw new RuntimeException("人员未绑定任何单位!");
}
throw new RuntimeException("参数必传且不为空!");
}
@Override
public List<UserDto> getUserInfo(String userId) {
......@@ -1424,7 +1433,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
Map<Long, CheckObjectDto> map = new HashMap<>(companyList.size());
companyList.forEach(e -> map.put(e.getSequenceNbr(), e));
Set<? extends Map.Entry<Long, ? extends CheckObjectDto>> entries = map.entrySet();
entries.parallelStream().forEach(entry -> {
entries.stream().forEach(entry -> {
CheckObjectDto value = entry.getValue();
if (!ObjectUtils.isEmpty(value)) {
Long parent = ObjectUtils.isEmpty(value.getParentId()) ? 0L : Long.parseLong(value.getParentId());
......@@ -1433,7 +1442,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
int num = orgUsrTreeDto.getNum() + value.getNum();
orgUsrTreeDto.setNum(num);
} else {
if (value.getBizOrgType().equals(OrgPersonEnum.公司.getKey())) {
if (value.getBizOrgType().equals(OrgPersonEnum.公司.getKey()) && null == value.getParentId()) {
list.add(value);
}
}
......@@ -1577,7 +1586,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
*/
@Override
public List<OrgUsr> getPersonListByParentId(Long id) {
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<>();
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<OrgUsr>();
wrapper.eq(OrgUsr::getIsDelete, false);
wrapper.eq(OrgUsr::getParentId, id);
wrapper.eq(OrgUsr::getBizOrgType, OrgPersonEnum.人员.getKey());
......@@ -2047,6 +2056,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return userDto;
}
public Object getOrgUserByAmosUserId(String amosUserId) throws Exception {
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<OrgUsr>();
wrapper.eq(OrgUsr::getIsDelete, false);
......
......@@ -43,6 +43,7 @@ import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @author wujiang
* @date 2020-07-07
......@@ -87,6 +88,7 @@ public class EquipmentDetailController extends AbstractBaseController {
@Autowired
FireFightingSystemServiceImpl fireFightingSystemServiceImpl;
/**
* 新增
*
......@@ -100,6 +102,7 @@ public class EquipmentDetailController extends AbstractBaseController {
equipmentSpecificSerivce.refreshStaData();
return detail;
}
@Async
public void refreshCount(String bizOrgCode) {
equipmentSpecificSerivce.refreshStaData();
......@@ -109,6 +112,7 @@ public class EquipmentDetailController extends AbstractBaseController {
}
}
/**
* 设备新增带打码入库
***/
......@@ -213,7 +217,6 @@ public class EquipmentDetailController extends AbstractBaseController {
*
* 修改
* **/
@RequestMapping(value = "equipment/updateById", method = RequestMethod.PUT)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "修改", notes = "修改")
......
......@@ -91,6 +91,7 @@ public class MaintenanceResourceDataController extends AbstractBaseController {
/**
* 获取维保设施资源数据详细信息
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{id}")
public ResponseModel getInfo(@PathVariable("id") Long id) {
return CommonResponseUtil.success(maintenanceResourceDataService.selectMaintenanceResourceDataById(id));
......@@ -99,6 +100,7 @@ public class MaintenanceResourceDataController extends AbstractBaseController {
/**
* 新增维保设施资源数据
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping
public ResponseModel add(@RequestBody MaintenanceResourceData maintenanceResource) {
return CommonResponseUtil.success(maintenanceResourceDataService.insertMaintenanceResourceData(maintenanceResource));
......@@ -107,6 +109,7 @@ public class MaintenanceResourceDataController extends AbstractBaseController {
/**
* 修改维保设施资源数据
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping
public ResponseModel edit(@RequestBody MaintenanceResourceData maintenanceResource) {
return CommonResponseUtil.success(maintenanceResourceDataService.updateMaintenanceResourceData(maintenanceResource));
......@@ -115,6 +118,7 @@ public class MaintenanceResourceDataController extends AbstractBaseController {
/**
* 获取维保消防设施选择列表
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getMaintenanceResourceDataList")
public ResponseModel getMaintenanceResourceDataList() {
String orgCode = getOrgCode();
......@@ -124,6 +128,7 @@ public class MaintenanceResourceDataController extends AbstractBaseController {
/**
* 删除维保设施资源数据
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping("/{ids}")
public ResponseModel remove(@PathVariable Long[] ids) {
return CommonResponseUtil.success(maintenanceResourceDataService.deleteMaintenanceResourceDataByIds(ids));
......@@ -132,6 +137,7 @@ public class MaintenanceResourceDataController extends AbstractBaseController {
/**
* 业主单位批量关联消防设施,反推已有消防系统
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping("/relationMainResData")
public ResponseModel relationMainResData(@RequestBody List<MaintenanceResourceData> list) {
return CommonResponseUtil.success(maintenanceResourceDataService.relationMainResData(getAppKey(), getProduct(), getToken(), list));
......
package com.yeejoin.equipmanage.controller;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
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 com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.dto.TopographyLineDTO;
import com.yeejoin.equipmanage.common.entity.dto.TopographyNodeDTO;
import com.yeejoin.equipmanage.common.entity.dto.TopographyNodeDetailDTO;
import com.yeejoin.equipmanage.common.entity.dto.TopographyTreeDTO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentIndexVO;
import com.yeejoin.equipmanage.common.enums.TopoNodeTypeEnum;
import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.common.vo.*;
import com.yeejoin.equipmanage.mapper.*;
import com.yeejoin.equipmanage.service.*;
import com.yeejoin.equipmanage.service.impl.TopographyNodeDetailService;
import com.yeejoin.equipmanage.service.impl.TopographyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/**
* <p>
......@@ -43,14 +51,48 @@ import io.swagger.annotations.ApiParam;
@RestController
@Api(tags = "网络拓扑Api")
@RequestMapping(value = "/topography")
public class TopographyController
{
public class TopographyController extends AbstractBaseController {
private final Logger logger = LogManager.getLogger(TopographyController.class);
@Autowired
private TopographyService topographyService;
@Autowired
private TopographyNodeDetailService topographyNodeDetailService;
@Autowired
IEquipmentSpecificAlarmService equipmentSpecificAlarmService;
@Autowired
IEquipmentDetailService iEquipmentDetailService;
@Autowired
EquipmentDetailMapper equipmentDetailMapper;
@Autowired
private StockDetailMapper stockDetailMapper;
@Autowired
IStockService iStockService;
@Autowired
IEquipmentSpecificSerivce equipmentSpecificService;
@Autowired
IEquipmentSpecificAlarmLogService equipmentSpecificAlarmLogService;
@Autowired
EquipmentSpecificAlarmMapper equipmentSpecificAlarmMapper;
@Autowired
private RestTemplate restTemplate;
@Autowired
FireFightingSystemMapper fireFightingSystemMapper;
@Autowired
IEquipmentSpecificAlarmService iEquipmentSpecificAlarmService;
@Autowired
IEquipmentIndexService equipmentIndexService;
@Autowired
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired
IEquipmentService iEquipmentService;
@Value("${iot.vehicle.track}")
private String iotServerName;
// /**
// * 拓扑图-树
// *
......@@ -191,7 +233,7 @@ public class TopographyController
/**
* 网络拓扑图-树
*
* @param type 节点类型
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -206,18 +248,18 @@ public class TopographyController
/**
* 网络拓扑图
*
* @param type 节点类型
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "网络拓扑图", notes = "拓扑图")
@RequestMapping(value = "/webNodes/{treeid}", method = RequestMethod.GET)
public ResponseModel<Map<String,Object>> webNodes(@ApiParam(value = "树id", required = false) @PathVariable String treeid) {
public ResponseModel<Map<String, Object>> webNodes(@ApiParam(value = "树id", required = false) @PathVariable String treeid) {
//获取当前登录人的公司code
List<TopographyNodeDTO> nodes = topographyService.getNodes(treeid, TopoNodeTypeEnum.网络拓扑图.getType());
List<TopographyLineDTO> links = topographyService.getLinks(treeid, TopoNodeTypeEnum.网络拓扑图.getType());
Map<String,Object> results = new HashMap<>();
Map<String, Object> results = new HashMap<>();
results.put("nodeData", nodes);
results.put("linkData", links);
return ResponseHelper.buildResponse(results);
......@@ -253,7 +295,7 @@ public class TopographyController
/**
* 保存网络拓扑图
*
* @param type 节点类型
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -269,7 +311,7 @@ public class TopographyController
/**
* 节点详情
*
* @param type 节点类型
* @param
* @return
*/
@SuppressWarnings("rawtypes")
......@@ -448,4 +490,291 @@ public class TopographyController
// return CommonResponseUtil.success();
// }
/***
*
* 根拓补节点id查询详情
*
* **/
@RequestMapping(value = "/equipment/detail", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据节点id查询详情", notes = "根据节点id查询详情")
public EquipmentDate selectEquipmentDateById(@RequestParam(required = false) String id) {
TopographyNodeDetailDTO detailDTO = topographyNodeDetailService.queryByNodeid(id);
if (null == id || null == detailDTO || !StringUtil.isNotEmpty(detailDTO.getEqpId())) {
throw new RuntimeException("节点信息错误或此节点下未绑定装备!");
}
String eqpId = detailDTO.getEqpId();
EquipmentDate equipmentDate = new EquipmentDate();
EquipmentSpecific equipmentSpecific = equipmentSpecificService.getById(eqpId);
QueryWrapper<EquipmentSpecificAlarm> wrapper = new QueryWrapper<>();
wrapper.eq("equipment_specific_id", eqpId);
wrapper.orderByDesc("create_date");
List<EquipmentSpecificAlarm> list = equipmentSpecificAlarmService.getBaseMapper().selectList(wrapper);
EquipmentSpecificAlarm alarm;
if (0 > list.size()) {
alarm = list.get(0);
equipmentSpecific.setStatus(alarm.getStatus());
} else {
equipmentSpecific.setStatus(0);
}
equipmentSpecific.setFullqrCode("01#" + equipmentSpecific.getQrCode());
String sysName = this.getSystemNameBySpeId(equipmentSpecific);
equipmentSpecific.setSystemName(sysName);
EquipmentDetail equipmentDetail = iEquipmentDetailService.getOneById(equipmentSpecific.getEquipmentDetailId());
StockDetail stockDetail = null;
//消防装备默认分支
List<StockDetail> stockDetails = stockDetailMapper.selectList(new LambdaQueryWrapper<StockDetail>().eq(StockDetail::getEquipmentSpecificId, eqpId));
if (!stockDetails.isEmpty()) {
stockDetail = stockDetails.get(0);
equipmentSpecific.setStockDetail(stockDetail);
}
if (stockDetail != null) {
equipmentSpecific.setStock(iStockService.getById(stockDetail.getStockId()));
}
equipmentDate.setEquipmentDetail(equipmentDetail);
equipmentDate.setEquipmentSpecific(equipmentSpecific);
return equipmentDate;
}
public String getSystemNameBySpeId(EquipmentSpecific equipmentSpecific) {
List<FireFightingSystemEntity> sys = new ArrayList<>();
String[] ids;
String sysIds = equipmentSpecific.getSystemId();
if (StringUtil.isNotEmpty(sysIds)) {
if (-1 != sysIds.indexOf(",")) {
ids = sysIds.split(",");
sys = fireFightingSystemMapper.getFightingSysByIds(ids);
} else {
FireFightingSystemEntity entity = fireFightingSystemMapper.selectById(Long.valueOf(sysIds));
sys.add(entity);
}
}
StringBuilder sb = new StringBuilder();
sys.forEach(x -> {
if (0 < sb.length()) {
sb.append(",");
}
sb.append(x.getName());
});
return sb.toString();
}
/***
*
* 根拓补节点id查询告警信息(未恢复或者所有)
*
* **/
@RequestMapping(value = "/equipment/alarm", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据节点id查询告警信息", notes = "根据节点id查询告警信息")
public ResponseModel getAlarmInfo(@RequestParam(required = false) String id, @RequestParam(required = false) int status,
@RequestParam(required = false) String beginDate, @RequestParam(required = false) String endDate,
CommonPageable commonPageable) {
TopographyNodeDetailDTO detailDTO = topographyNodeDetailService.queryByNodeid(id);
if (null == id || null == detailDTO || !StringUtil.isNotEmpty(detailDTO.getEqpId())) {
throw new RuntimeException("节点信息错误或此节点下未绑定装备!");
}
EquipmentSpecific equipmentSpecific = equipmentSpecificService.getById(detailDTO.getEqpId());
List<CommonRequest> queryRequests = new ArrayList<>();
CommonRequest request = new CommonRequest();
request.setName("beginDate");
request.setValue(StringUtil.isNotEmpty(beginDate) ? StringUtils.trimToNull(beginDate).substring(0, 10) + " 00:00:00" : null);
queryRequests.add(request);
CommonRequest request1 = new CommonRequest();
request1.setName("endDate");
request1.setValue(StringUtil.isNotEmpty(endDate) ? StringUtils.trimToNull(endDate).substring(0, 10) + " 23:59:59" : null);
queryRequests.add(request1);
CommonRequest request2 = new CommonRequest();
request2.setName("id");
request2.setValue(StringUtil.isNotEmpty(String.valueOf(equipmentSpecific.getId())) ? StringUtils.trimToNull(String.valueOf(equipmentSpecific.getId())) : null);
queryRequests.add(request2);
CommonRequest request3 = new CommonRequest();
request3.setName("status");
request3.setValue(StringUtil.isNotEmpty(status) ? StringUtils.trimToNull(String.valueOf(status)) : null);
queryRequests.add(request3);
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<TopographyAlarmVo> list = iEquipmentSpecificAlarmService.listAlarmsPageForTopography(param);
return CommonResponseUtil.success(list);
}
/**
* 根拓补节点id查询当前节点最新物联信息
**/
@RequestMapping(value = "/equipment/iot/info", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据节点id查询当前物联信息", notes = "根据节点id查询当前物联信息")
public Map<String, Object> getEquipmentIotInfo(@RequestParam(required = false) String id) {
TopographyNodeDetailDTO detailDTO = topographyNodeDetailService.queryByNodeid(id);
if (null == id || null == detailDTO || !StringUtil.isNotEmpty(detailDTO.getEqpId())) {
throw new RuntimeException("节点信息错误或此节点下未绑定装备!");
}
String eqpId = detailDTO.getEqpId();
EquipmentSpecific equipmentSpecific = equipmentSpecificService.getById(eqpId);
EquipmentDetail equipmentDetail = iEquipmentDetailService.getById(equipmentSpecific.getEquipmentDetailId());
Long equipmentId = equipmentDetail.getEquipmentId();
HashMap<String, List> map = new HashMap<>();
ConcurrentHashMap map1 = new ConcurrentHashMap();
List<String> list = equipmentIndexService.getGruopName(equipmentId);
list.forEach(x -> {
QueryWrapper<EquipmentIndex> wrapper = new QueryWrapper<>();
wrapper.eq("equipment_id", equipmentId);
wrapper.eq("group_name", x);
wrapper.orderByAsc("sort_num");
List<EquProperty> properList = new ArrayList<>();
equipmentIndexService.list(wrapper).forEach(y -> {
EquProperty equProperty = new EquProperty();
equProperty.setEquipmentIndexId(y.getId());
equProperty.setIsIot(y.getIsIot());
equProperty.setPerfQuotaName(y.getPerfQuotaName());
equProperty.setEquipmentIndexName(y.getPerfQuotaName());
equProperty.setGroupName(y.getGroupName());
equProperty.setValue(y.getPerfValue());
equProperty.setUnitName(y.getUnitName());
equProperty.setEquipmentIndexKey(y.getPerfQuotaDefinitionId());
properList.add(equProperty);
});
map.put(x, properList);
});
QueryWrapper<EquipmentIndex> wrappernull = new QueryWrapper<>();
wrappernull.isNull("group_name").or().eq("group_name", " ");
wrappernull.eq("equipment_id", equipmentId);
wrappernull.orderByAsc("sort_num");
List<EquProperty> properList = new ArrayList<>();
equipmentIndexService.list(wrappernull).forEach(y -> {
EquProperty equProperty = new EquProperty();
equProperty.setEquipmentIndexId(y.getId());
equProperty.setPerfQuotaName(y.getPerfQuotaName());
equProperty.setEquipmentIndexName(y.getPerfQuotaName());
equProperty.setIsIot(y.getIsIot());
equProperty.setGroupName(y.getGroupName());
equProperty.setValue(y.getPerfValue());
equProperty.setUnitName(y.getUnitName());
equProperty.setEquipmentIndexKey(y.getPerfQuotaDefinitionId());
properList.add(equProperty);
});
properList.forEach(e -> {
List<EquipmentIndexVO> equipmentIndexList = equipmentSpecificIndexMapper.getEquipIndexByIndexId(e.getEquipmentIndexId(), equipmentSpecific.getId());
if (equipmentIndexList.size() > 0) {
if (StringUtil.isNotEmpty(equipmentIndexList.get(0).getValue())) {
e.setValue(equipmentIndexList.get(0).getValue());
} else {
e.setValue("");
}
} else {
e.setValue("");
}
});
//判断map中是否有key为’其他‘的数据,提取单独处理
List<EquProperty> otherProperList = map.get("其他");
if (otherProperList != null && otherProperList.size() > 0) {
otherProperList.addAll(properList);
map.put("其他", otherProperList);
} else {
map.put("其他", properList);
}
Equipment byId = iEquipmentService.getById(equipmentId);
Map<String, Object> re = new HashMap<>();
re.put("res", map);
// re.put("pre", byId.getPrefQuota()); // 非核心参数此处不需要
return re;
}
/***
*
* 根拓补节点id查询当前节点物联数据记录
*
* **/
@RequestMapping(value = "/equipment/info", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据节点id查询当前节点物联数据记录", notes = "根据节点id查询当前节点物联数据记录")
public ResponseModel getEquipmentIotInfo(@RequestParam(required = false) String id, @RequestParam(required = false) String beginDate,
@RequestParam(required = false) String endDate) {
TopographyNodeDetailDTO detailDTO = topographyNodeDetailService.queryByNodeid(id);
if (null == id || null == detailDTO || !StringUtil.isNotEmpty(detailDTO.getEqpId())) {
throw new RuntimeException("节点信息错误或此节点下未绑定装备!");
}
String eqpId = detailDTO.getEqpId();
EquipmentSpecific equipmentSpecific = equipmentSpecificService.getById(eqpId);
String iotCode = equipmentSpecific.getIotCode();
String prefix = null;
String suffix = null;
if (iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
return CommonResponseUtil.failure("装备物联编码错误,请确认!");
}
LonAndLatEntityVo lonAndLatEntityVo = new LonAndLatEntityVo();
String url = iotServerName;
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("Content-Type", "application/json");
headers.set("product", getProduct());
headers.set("token", getToken());
headers.set("appKey", getAppKey());
HttpEntity httpEntity = new HttpEntity<>(lonAndLatEntityVo, headers);
ResponseEntity<FeignClientResult> feignClientResult = null;
try {
feignClientResult = restTemplate.exchange("http://" + url
+ "/iot/v1/livedata/list?timeStart=" + beginDate + "&timeEnd=" + endDate + "&productKey=" + prefix + "&deviceName=" + suffix,
HttpMethod.GET, httpEntity, FeignClientResult.class);
} catch (Exception e) {
e.printStackTrace();
}
if (null != feignClientResult && feignClientResult.getBody().getStatus() == 200) {
List<TopographyIotVo> list = new ArrayList<>();
if (null != feignClientResult.getBody().getResult()) {
String json = JSON.toJSONString(feignClientResult.getBody().getResult());
JSONObject jsonObject = JSONObject.parseObject(json);
Iterator it = jsonObject.entrySet().iterator();
List<IotDataVO> iotDatalist = new ArrayList<IotDataVO>();
while (it.hasNext()) {
IotDataVO iotDataVO = new IotDataVO();
Map.Entry<String, Object> entry = (Map.Entry<String, Object>) it.next();
if (!"name".equals(entry.getKey()) || !"deviceName".equals(entry.getKey()) || !"time".equals(entry.getKey())) {
iotDataVO.setKey(entry.getKey());
iotDataVO.setValue(entry.getValue());
}
iotDatalist.add(iotDataVO);
}
List<EquipmentSpecificIndex> indexes = equipmentSpecificIndexMapper.getEquipmentSpeIndexByIotCode(iotCode);
if (0 <indexes.size()) {
iotDatalist.forEach(iotDataVO -> {
TopographyIotVo iotVo = new TopographyIotVo();
List<TopographyIotDataVO> lists = new ArrayList<TopographyIotDataVO>();
indexes.forEach(x -> {
iotVo.setTime(x.getUpdateDate());
if (x.getNameKey().equals(iotDataVO.getKey())) {
TopographyIotDataVO dataVO = new TopographyIotDataVO();
dataVO.setName(x.getIndexName());
dataVO.setValue(x.getValue());
dataVO.setUnit(x.getIndexUnitName());
lists.add(dataVO);
}
});
iotVo.setList(lists);
list.add(iotVo);
});
}
}
return CommonResponseUtil.success(list);
} else {
logger.error("注:iotCode为 (" + iotCode + ") 的装备不存在于物联系统中!");
return CommonResponseUtil.success();
}
}
public static Map<String, String> mapStringToMap(String str) {
str = str.substring(1, str.length() - 1);
String[] strs = str.split(",");
Map<String, String> map = new HashMap<String, String>();
for (String string : strs) {
String key = string.split("=")[0];
String value = string.split("=")[1];
map.put(key, value);
}
return map;
}
}
......@@ -526,7 +526,7 @@ public class UserController extends AbstractBaseController {
result.put("userId", jsonObject.getString("userId"));
result.put("appKey", jsonObject.getString("appKey"));
result.put("product", jsonObject.getString("product"));
result.put("jpushUserKey", appMessagePushService.buildJpushUserKey(jsonObject.getString("userId")));
result.put("jpushUserKey", AppMessagePushService.buildJpushUserKey(jsonObject.getString("userId")));
return CommonResponseUtil.success(result);
}
return CommonResponseUtil.failure("登录失败");
......
......@@ -185,4 +185,5 @@ public interface EquipmentSpecificAlarmMapper extends BaseMapper<EquipmentSpecif
* @return
*/
List<EquipmentSpecificAlarm> getEquipListBySpecific(@Param("status") Boolean status, @Param("equipmentSpecificId") Long equipmentSpecificId);
}
......@@ -46,6 +46,8 @@ public interface EquipmentSpecificIndexMapper extends BaseMapper<EquipmentSpecif
*/
List<EquipmentSpecificIndex> getEquipmentSpeIndexByIotCode(String iotCode);
List<EquipmentSpecificIndex> getEquipmentSpeIndexDataByIotCode(String iotCode);
/**
* 通过设备id查询
*
......
......@@ -10,6 +10,7 @@ import com.yeejoin.equipmanage.common.utils.CommonPageInfoParam;
import com.yeejoin.equipmanage.common.vo.AlarmDataVO;
import com.yeejoin.equipmanage.common.vo.AlarmEquipMockDataVO;
import com.yeejoin.equipmanage.common.vo.AlarmListDataVO;
import com.yeejoin.equipmanage.common.vo.TopographyAlarmVo;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
......@@ -42,6 +43,9 @@ public interface IEquipmentSpecificAlarmService extends IService<EquipmentSpecif
org.springframework.data.domain.Page<AlarmListDataVO> listAlarmsPage(CommonPageInfoParam param);
org.springframework.data.domain.Page<TopographyAlarmVo> listAlarmsPageForTopography(CommonPageInfoParam param);
Map<String, Object> getSpecificInfoById(Long id);
Map<String, Object> getSpecificInfoByCode(String code);
......
......@@ -261,14 +261,14 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
} catch (Exception e) {
log.error("查询机场人员为空,检查机场人员是否绑定单位!");
}
confirmAlamVo.setFireLocation(ent.getLocation());
List<UserDto> infoList = equipmentSpecificSerivce.getEquipSpecificLocationInfo(ent.getEquipmentSpecificId(), FIELD_NAME.split(","));
if (CollectionUtils.isNotEmpty(infoList)) {
infoList.stream().forEach(dto -> {
String name = dto.getPersonName();
// String name = dto.getPersonName();
// confirmAlamVo.setFireLocation(name);
String code = dto.getFieldCode();
String value = dto.getFieldValue();
confirmAlamVo.setFireLocation(name);
switch (code) {
case "longitude":
confirmAlamVo.setFloorLongitude(getVal(value));
......
package com.yeejoin.equipmanage.service.impl;
import javax.annotation.Resource;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.equipmanage.common.entity.FormGroup;
import com.yeejoin.equipmanage.common.entity.SystemDic;
import com.yeejoin.equipmanage.common.entity.vo.AppDownloadVO;
import com.yeejoin.equipmanage.common.enums.GroupCodeEnum;
import com.yeejoin.equipmanage.common.utils.FileUploadFactory;
import com.yeejoin.equipmanage.common.utils.FileUploadTypeEnum;
import com.yeejoin.equipmanage.common.utils.ImportFile;
import com.yeejoin.equipmanage.common.vo.BuildingTreeVo;
import com.yeejoin.equipmanage.mapper.EquipmentMapper;
import com.yeejoin.equipmanage.mapper.ExtinguishantOnCarMapper;
import com.yeejoin.equipmanage.service.*;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import com.yeejoin.equipmanage.common.utils.FileUploadFactory;
import com.yeejoin.equipmanage.common.utils.FileUploadTypeEnum;
import com.yeejoin.equipmanage.common.utils.ImportFile;
import org.typroject.tyboot.core.foundation.utils.Bean;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
......@@ -55,10 +52,11 @@ public class DownloadFileService implements IDownloadFileService {
public void setFactory(FileUploadFactory factory) {
this.factory = factory;
}
@Override
public HSSFWorkbook DownloadFile(String type) {
ImportFile up = factory.create(FileUploadTypeEnum.getEnum(type));
HSSFWorkbook workbook =(HSSFWorkbook) up.downloadImportFile();
HSSFWorkbook workbook = (HSSFWorkbook) up.downloadImportFile();
return workbook;
}
......@@ -76,12 +74,13 @@ public class DownloadFileService implements IDownloadFileService {
appDownload.setDownloadCarDatas(carService.list());
//装备信息
appDownload.setDownloadEquipmentDatas(equipmentMapper.getDownloadEquipmentData());
//性能指标模板
appDownload.setDownloadEquipmentDatas(equipmentMapper.getDownloadEquipmentData());
//
// //性能指标模板
appDownload.setEquipmentIndex(equipmentIndexService.list());
//性能指标
//
// //性能指标
appDownload.setEquipmentSpecificIndexs(equipmentSpecificIndexSerivce.list());
//仓库
......@@ -101,6 +100,7 @@ public class DownloadFileService implements IDownloadFileService {
/**
* 建筑树数据处理
*
* @param formGroup
* @param allList
* @return
......
......@@ -12,9 +12,11 @@ import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.servlet.http.HttpServletResponse;
import com.yeejoin.equipmanage.common.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.PageImpl;
......@@ -43,10 +45,6 @@ import com.yeejoin.equipmanage.common.enums.EquipmentDataEnum;
import com.yeejoin.equipmanage.common.utils.CommonPageInfoParam;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.vo.AlarmDataVO;
import com.yeejoin.equipmanage.common.vo.AlarmEquipMockDataVO;
import com.yeejoin.equipmanage.common.vo.AlarmListDataVO;
import com.yeejoin.equipmanage.common.vo.EquipmentAlarmDownloadVO;
import com.yeejoin.equipmanage.mapper.ConfirmAlarmMapper;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificAlarmLogMapper;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificAlarmMapper;
......@@ -223,6 +221,39 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
}
@Override
public org.springframework.data.domain.Page<TopographyAlarmVo> listAlarmsPageForTopography(CommonPageInfoParam param) {
Page page = new Page(param.getPageNumber(), param.getPageSize());
Page<Map<String, Object>> mybatisResult = this.baseMapper.pageAlarmsInfo(page, param);
List<TopographyAlarmVo> res = new ArrayList<>();
if (mybatisResult.getSize() > 0) {
mybatisResult.getRecords().forEach(x -> {
TopographyAlarmVo dataVO = new TopographyAlarmVo();
try {
dataVO.setCreateDate(DateUtils.dateParse(String.valueOf(x.get("createDate")),DateUtils.DATE_TIME_T_PATTERN));
} catch (ParseException e) {
e.printStackTrace();
}
dataVO.setFireEquipmentSpecificIndexName(String.valueOf(x.get("fireEquipmentSpecificIndexName")));
dataVO.setFireEquipmentName(String.valueOf(x.get("fireEquipmentName")));
dataVO.setWarehouseStructureName(String.valueOf(x.get("warehouseStructureName")));
dataVO.setEquipmentName(null == x.get("equipmentName") ? null : String.valueOf(x.get("equipmentName")));
dataVO.setHandleStatus(String.valueOf(x.get("handleStatus")));
dataVO.setStatus(String.valueOf(x.get("status")));
Object type = x.get("type");
if (AlarmTypeEnum.HZGJ.getCode().equals(type) || AlarmTypeEnum.GZGJ.getCode().equals(type)
|| AlarmTypeEnum.PB.getCode().equals(type)) {
dataVO.setAlarmType(AlarmTypeEnum.getTypeByCode(String.valueOf(type)));
}
dataVO.setAlarmContent(x.get("fireEquipmentName") + dataVO.getAlarmType());
dataVO.setHandleType(null == x.get("handleType") ? null : String.valueOf(x.get("handleType")));
res.add(dataVO);
});
}
param.setPageNumber(param.getPageNumber() - 1);
return new PageImpl<>(res, param, mybatisResult.getTotal());
}
@Override
public Map<String, Object> getSpecificInfoById(Long id) {
Map<String, Object> map = new HashMap<>();
EquipmentSpecificAlarmLog alarm = equipmentSpecificAlarmLogMapper.selectById(id);
......
......@@ -995,6 +995,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
AlamVideoVO video = videoMapper.getVideoById(id);
if (!ObjectUtils.isEmpty(video)) {
video.setUrl(videoService.getVideoUrl(video.getName().toString(), video.getPresetPosition(), video.getUrl(), video.getCode()));
video.setId(id);
}
return video;
} else {
......@@ -1590,7 +1591,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Override
public void refreshStaData() {
List<Map<String, Object>> result = this.baseMapper.queryCompanyStaData();
result.forEach(m -> redisUtils.set((buildKey(m)), m.get("total"),86400));
result.forEach(m -> redisUtils.set((buildKey(m)), m.get("total"), 86400));
}
private String buildKey(Map<String, Object> row) {
......
......@@ -440,6 +440,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
equipmentSpecificAlarmService.saveOrUpdate(action);
if (AlarmStatusEnum.BJ.getCode() == action.getStatus()) {
equipmentAlarmLogs.add(addEquipAlarmLogRecord(action));
if (ValidationUtil.isEmpty(action.getAlamContent())){
action.setAlamContent(action.getEquipmentSpecificName() + action.getEquipmentSpecificIndexName());
}
mqttSendGateway.sendToMqtt(TopicEnum.EQDQR.getTopic(), JSONArray.toJSON(action).toString());
}
specificAlarmIds.add(action.getId());
......@@ -872,6 +875,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
equipmentSpecificAlarmLog.setAlarmReason(equipmentSpecificAlarm.getAlamReason());
equipmentSpecificAlarmLog.setEquipmentSpecificCode(equipmentSpecificAlarm.getCode());
equipmentSpecificAlarmLog.setBuildId(equipmentSpecificAlarm.getBuildId());
equipmentSpecificAlarmLog.setStatus(equipmentSpecificAlarm.getStatus());
equipmentSpecificAlarmLogService.save(equipmentSpecificAlarmLog);
// 同步告警消息给平台
if (amosSwitch) {
......
......@@ -362,6 +362,7 @@ public class SyncDataUtil {
fireVehicleInfo.setUpdateDate(new Date());
fireVehicleInfo.setValue(i.getValue());
fireVehicleInfo.setAliasname(i.getName());
fireVehicleInfo.setMrid(i.getMRid());
return fireVehicleInfo;
}
).collect(Collectors.toList());
......
......@@ -216,7 +216,7 @@ public class AlertCalledController extends BaseController {
String callTimeEnd,
String callTimeStart,
String systemSourceCode,
String isFatherAlert) {
@RequestParam(value ="isFatherAlert",required = false) String isFatherAlert) {
/* Page<AlertCalled> pageBean;
IPage<AlertCalled> page;
QueryWrapper<AlertCalled> alertCalledQueryWrapper = new QueryWrapper<>();
......
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.alibaba.fastjson.JSONArray;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -109,7 +113,7 @@ public class AlertFormController extends BaseController {
/**
* 根据表态类型code查询表单数据项
* @param id
* @param
* @return
*/
......@@ -120,7 +124,18 @@ public class AlertFormController extends BaseController {
List<AlertFormInitDto> list=new ArrayList<AlertFormInitDto>();
if(redisUtils.hasKey(RedisKey.FORM_CODE+code)){
Object obj= redisUtils.get(RedisKey.FORM_CODE+code);
return ResponseHelper.buildResponse(obj);
JSONArray arr = (JSONArray) obj;
List<AlertFormInitDto> list1 = arr.toJavaList(AlertFormInitDto.class);
for (AlertFormInitDto alertFormInitDto: list1) {
if(alertFormInitDto.getKey().equals("fireTime")) {
Date date = new Date();
alertFormInitDto.setDefaultValue(date);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(date);
alertFormInitDto.getFormItemDescr().setFieldValue(dateString);
}
}
return ResponseHelper.buildResponse(JSON.toJSON(list1));
}else{
list= iAlertFormService.getFormlist(code);
redisUtils.set(RedisKey.FORM_CODE+code,JSON.toJSON(list),time);
......
......@@ -51,6 +51,7 @@ import java.io.UnsupportedEncodingException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
......@@ -267,17 +268,23 @@ public class AlertSubmittedController extends BaseController {
Map<String, String> definitions = new HashMap<>();
definitions.put("$type",alertCalled.getAlertType());
definitions.put("$callTime", DateUtils.dateTimeToDateString(alertCalled.getCallTime()));
definitions.put("$callTime", DateUtils.convertDateToString(alertCalled.getCallTime(),DateUtils.DATE_TIME_PATTERN));
definitions.put("$replaceContent",replaceContent);
definitions.put("$address",alertCalled.getAddress());
definitions.put("$recDate",DateUtils.convertDateToString(alertCalled.getRecDate(),DateUtils.DATE_TIME_PATTERN));
definitions.put("$address",ValidationUtil.isEmpty(alertCalled.getAddress()) ? "" : alertCalled.getAddress());
// definitions.put("$recDate",DateUtils.convertDateToString(alertCalled.getUpdateTime(),DateUtils.DATE_TIME_PATTERN));
definitions.put("$contactUser",ValidationUtil.isEmpty(alertCalled.getContactUser()) ? "" : alertCalled.getContactUser());
definitions.put("$trappedNum",ValidationUtil.isEmpty(alertCalledRo.getTrappedNum()) ? "" : String.valueOf(alertCalled.getTrappedNum()));
definitions.put("$casualtiesNum",ValidationUtil.isEmpty(alertCalled.getCasualtiesNum()) ? "" : String.valueOf(alertCalled.getCasualtiesNum()));
definitions.put("$contactPhone",ValidationUtil.isEmpty(alertCalled.getContactPhone()) ? "" : alertCalled.getContactPhone());
definitions.put("$contactUser",ValidationUtil.isEmpty(alertCalled.getContactUser()) ? "" : alertCalled.getContactUser());
definitions.put("$trappedNum",ValidationUtil.isEmpty(alertCalledRo.getTrappedNum()) ? "" : String.valueOf(alertCalled.getTrappedNum()));
definitions.put("$casualtiesNum",ValidationUtil.isEmpty(alertCalled.getCasualtiesNum()) ? "" : String.valueOf(alertCalled.getCasualtiesNum()));
definitions.put("$contactPhone",ValidationUtil.isEmpty(alertCalled.getContactPhone()) ? "" : alertCalled.getContactPhone());
String companyName = JSONObject.parseObject(schedulingContent.getSubmissionContent()).getString("$companyName") ;
String companyName = JSONObject.parseObject(schedulingContent.getSubmissionContent()).getString("companyName") ;
JSONObject jsonObject = null;
if(!ValidationUtil.isEmpty(alertCalled.getUpdateTime())) {
jsonObject = JSONObject.parseObject(schedulingContent.getSubmissionContent());
jsonObject.put("recDate",DateUtils.convertDateToString(alertCalled.getUpdateTime(), DateUtils.DATE_TIME_PATTERN));
}
definitions.put("$companyName", null == companyName ? "" : companyName);
......@@ -289,6 +296,10 @@ public class AlertSubmittedController extends BaseController {
content = getTaskInformation( schedulingContent.getSubmissionTemplate(),definitions);
}
if(jsonObject != null) {
schedulingContent.setSubmissionContent(jsonObject.toJSONString());
}
schedulingContent.setSubmissionTemplate(content);
if(!ValidationUtil.isEmpty(schedulingContent.getSubmissionContent())) {
try {
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
......@@ -9,6 +12,7 @@ import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
......@@ -267,13 +271,13 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
for (AlertFormValue alertFormValue : list) {
if("flightNumber".equals(alertFormValue.getFieldCode())) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
"text", alertFormValue.getFieldValueCode(), alertFormValue.getBlock());
"text", ValidationUtil.isEmpty(alertFormValue.getFieldValueCode()) ? alertFormValue.getFieldValue() : alertFormValue.getFieldValueCode() , alertFormValue.getBlock());
formValue.add(value);
continue;
}
if("aircraftModel".equals(alertFormValue.getFieldCode())) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
"text", alertFormValue.getFieldValueCode(), alertFormValue.getBlock());
"text", ValidationUtil.isEmpty(alertFormValue.getFieldValueCode()) ? alertFormValue.getFieldValue() : alertFormValue.getFieldValueCode() , alertFormValue.getBlock());
formValue.add(value);
continue;
}
......@@ -422,7 +426,23 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
par.setAlertId(alertCalled.getSequenceNbr());
List<AlertCalledZhDto> list = this.alertCalledListByAlertStatus(null, null, par);
String json=list!=null&&list.size()>0?JSONObject.toJSONString(list.get(0), SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue):"";
String json="";
if(list!=null&&list.size()>0){
AlertCalledZhDto ll=list.get(0);
Map<String, String> map = BeanUtils.describe((Object) list.get(0));
String strDateFormat = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
map.put("sequenceNbr",ll.getSequenceNbr()+"");
map.put("callTime",ll.getCallTime()!=null?sdf.format(ll.getCallTime()):"");
map.put("updateTime",ll.getUpdateTime()!=null?sdf.format(ll.getUpdateTime()):"");
json=list!=null&&list.size()>0?JSONObject.toJSONString(map, SerializerFeature.PrettyFormat,
SerializerFeature.WriteMapNullValue):"";
}
emqKeeper.getMqttClient().publish(topicData, json.getBytes(), RuleConfig.DEFAULT_QOS, false);
/**
......@@ -448,6 +468,11 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
throw new RuntimeException("报送失败,系统异常!");
}
}
/**
* 根据id 修改警情 type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案
*/
......@@ -615,11 +640,11 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
/*
* if(null == valueCode) { valueCode = alertFormValue.getFieldValue(); }
*/
if("flightNumber".equals(alertFormValue.getFieldCode()) || "aircraftModel".equals(alertFormValue.getFieldCode())) {
listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), alertFormValue.getFieldValueCode()));
} else {
// if("flightNumber".equals(alertFormValue.getFieldCode()) || "aircraftModel".equals(alertFormValue.getFieldCode())) {
// listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), alertFormValue.getFieldValueCode()));
// } else {
listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), valueCode));
}
// }
});
map.put("data", listdate);
......@@ -1134,7 +1159,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
// }
private Object getIdsList1(String type ,String condition1, String condition2, String condition3)throws Exception {
List<Object> resultList = new ArrayList<Object>();
List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
ResponseModel<Object> responseForcondition1Name = knowledgebaseFeignClient
.queryListByTagName(condition1.split(",")[0]);
......@@ -1231,7 +1256,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
if (ObjectUtils.isNotEmpty(SimpleDetailResponse.getResult()) && priority != 0) {
JSONArray detailJsonArray = JSONArray.parseArray(JSONArray.toJSONString(SimpleDetailResponse.getResult()));
JSONObject detailJsonObject= detailJsonArray.getJSONObject(0);
map.put("recDate",detailJsonObject.getString("REC_DATE"));
map.put("recDate",DateUtils.dateToString(detailJsonObject.getString("REC_DATE")));
map.put("sequenceNbr", detailJsonObject.getString("SEQUENCE_NBR"));
map.put("docTitle", detailJsonObject.getString("DOC_TITLE"));
map.put("priority", priority);
......@@ -1239,6 +1264,45 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
}
}
}
sort(resultList);
return resultList;
}
public void sort(List<Map<String, Object>> list) {
Collections.sort(list, new Comparator<Map<String, Object>>() {
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
return (Integer) o1.get("priority") < (Integer) o2
.get("priority") ? ((Integer) o1.get("priority") == (Integer) o2
.get("priority") ? 0 : -1) : 1;
}
});
}
//
// public static void main(String[] args) {
// List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
// Map<String, Object> map = new HashMap<String, Object>();
// map.put("docTitle", "21313213");
// map.put("priority", 21);
// resultList.add(map);
// Map<String, Object> map1 = new HashMap<String, Object>();
// map1.put("docTitle", "21313213");
// map1.put("priority", 12);
// resultList.add(map1);
// Map<String, Object> map2 = new HashMap<String, Object>();
// map2.put("docTitle", "21313213");
// map2.put("priority", 1);
// resultList.add(map2);
// Map<String, Object> map3 = new HashMap<String, Object>();
// map3.put("docTitle", "21313213");
// map3.put("priority", 31);
// resultList.add(map3);
// Map<String, Object> map4 = new HashMap<String, Object>();
// map4.put("docTitle", "21313213");
// map4.put("priority", 18);
// resultList.add(map4);
// sort(resultList);
// for (Map<String, Object> map6 : resultList) {
// System.out.println(map6.get("priority"));
// }
// }
}
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.text.ParseException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.XWPFTable;
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttPersistenceException;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STJc.Enum;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
......@@ -82,39 +38,12 @@ import com.yeejoin.amos.boot.module.common.api.service.IFireTeamService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FireTeamServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCallCommandDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCallePowerTransferRo;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledMobDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledPowerInfoDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledZhDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedExtDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedSMSDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedZHDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.CarStatusInfoDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.InstructionsZHDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerData;
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.PowerTransferCompanyZHDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PushMessageWebAndAppRo;
import com.yeejoin.amos.boot.module.jcs.api.dto.SchedulingReportingDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateExtendDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.VoiceRecordFileDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.*;
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.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.AlertStageEnums;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSubmitTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.FireCarStatusEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.SubmissionMethodEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.*;
import com.yeejoin.amos.boot.module.jcs.api.mapper.AlertSubmittedMapper;
import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferCompanyMapper;
import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferMapper;
......@@ -125,6 +54,33 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.component.rule.config.RuleConfig;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.XWPFTable;
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttPersistenceException;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STJc.Enum;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.io.*;
import java.lang.reflect.Field;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/**
......@@ -241,12 +197,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
TemplateExtendDto template = null;
Template templateN = null;
if(AlertBusinessTypeEnum.警情初报.getName().equals(alertSubmittedExtDto.getBusinessType())) {
if (AlertBusinessTypeEnum.警情初报.getName().equals(alertSubmittedExtDto.getBusinessType())) {
// 获取任务派发模板
templateN = templateService
.getOne(new QueryWrapper<Template>().eq("type_code", "JQCB").eq("format", false));
template = new TemplateExtendDto();
BeanUtils.copyProperties(templateN,template);
BeanUtils.copyProperties(templateN, template);
template.setRichContent(template.getContent());
} else {
......@@ -260,36 +216,45 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
*/
AlertCalledRo alertCalledRo = new AlertCalledRo();
String replaceContent ="";
if(null != alertCalled) {
String replaceContent = "";
if (null != alertCalled) {
replaceContent = RuleAlertCalledService.init(alertCalledRo, alertCalledVo);
}
Map<String, String> definitions = new HashMap<>();
definitions.put("$type",alertCalled.getAlertType());
definitions.put("$callTime", DateUtils.dateTimeToDateString(alertCalled.getCallTime()));
definitions.put("$replaceContent",replaceContent);
definitions.put("$address",ValidationUtil.isEmpty(alertCalled.getAddress()) ? "无" : alertCalled.getAddress());
definitions.put("$recDate",DateUtils.dateTimeToDateString(alertCalled.getRecDate()));
definitions.put("$type", alertCalled.getAlertType());
definitions.put("$callTime", DateUtils.convertDateToString(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
definitions.put("$replaceContent", replaceContent);
definitions.put("$address", ValidationUtil.isEmpty(alertCalled.getAddress()) ? "" : alertCalled.getAddress());
// definitions.put("$recDate",DateUtils.dateTimeToDateString(alertCalled.getUpdateTime()));
definitions.put("$contactUser", ValidationUtil.isEmpty(alertCalled.getContactUser()) ? "" : alertCalled.getContactUser());
definitions.put("$trappedNum", ValidationUtil.isEmpty(alertCalledRo.getTrappedNum()) ? "" : String.valueOf(alertCalled.getTrappedNum()));
definitions.put("$casualtiesNum", ValidationUtil.isEmpty(alertCalled.getCasualtiesNum()) ? "" : String.valueOf(alertCalled.getCasualtiesNum()));
definitions.put("$contactPhone", ValidationUtil.isEmpty(alertCalled.getContactPhone()) ? "" : alertCalled.getContactPhone());
String companyName = JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent()).getString("$companyName");
JSONObject jsonObject = null;
if (!ValidationUtil.isEmpty(alertCalled.getUpdateTime())) {
jsonObject = JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent());
jsonObject.put("recDate", DateUtils.convertDateToString(alertCalled.getUpdateTime(), DateUtils.DATE_TIME_PATTERN));
}
definitions.put("$contactUser",ValidationUtil.isEmpty(alertCalled.getContactUser()) ? "无" : alertCalled.getContactUser());
definitions.put("$trappedNum",ValidationUtil.isEmpty(alertCalledRo.getTrappedNum()) ? "无" : String.valueOf(alertCalled.getTrappedNum()));
definitions.put("$casualtiesNum",ValidationUtil.isEmpty(alertCalled.getCasualtiesNum()) ? "无" : String.valueOf(alertCalled.getCasualtiesNum()));
definitions.put("$contactPhone",ValidationUtil.isEmpty(alertCalled.getContactPhone()) ? "无" : alertCalled.getContactPhone());
if (jsonObject != null) {
alertSubmittedExtDto.setSubmissionContent(jsonObject.toJSONString());
}
String companyName = JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent()).getString("$companyName") ;
definitions.put("$companyName", null == companyName ? "" : companyName);
String content = getTaskInformation( template.getRichContent(),definitions);
String content = getTaskInformation(template.getRichContent(), definitions);
alertSubmittedExtDto.setSubmissionContentValue(JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent()));
alertSubmittedExtDto.setSubmissionContent(content);
} catch (JSONException e) {
alertSubmittedExtDto.setSubmissionContentValue(alertSubmittedExtDto.getSubmitContent());
} catch (ParseException e) {
e.printStackTrace();
}
});
schedulingReportingDto.setSchedulingReportingList(alertSubmittedExtDtoList);
......@@ -303,14 +268,21 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Override
public Boolean save(AlertSubmittedDto alertSubmittedDto, String userName) throws Exception {
try {
Map<String,String> map = saveAlertSubmitted(alertSubmittedDto, userName);
String company = ValidationUtil.isEmpty(alertSubmittedDto.getSubmitContent().get("companyName")) ? "" : alertSubmittedDto.getSubmitContent().get("companyName").toString();
Map<String, String> map = saveAlertSubmitted(alertSubmittedDto, userName);
// 组装规则入参
AlertCalled alertCalled = alertCalledService.getById(alertSubmittedDto.getAlertCalledId());
alertCalled.setCompanyName(company);
// if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
//// alertCalled.setEndTimeStr()
//// }
AlertCalledObjsDto alertCalledVo = (AlertCalledObjsDto) alertCalledService.selectAlertCalledByIdNoRedisNew(alertCalled.getSequenceNbr());
alertCalledVo.setAlertCalled(alertCalled);
// 调用规则
ruleAlertCalledService.fireAlertCalledRule(alertCalledVo, map.get("alertWay"),map.get("mobiles"), map.get("usIds"), map.get("feedBack"));
ruleAlertCalledService.fireAlertCalledRule(alertCalledVo, map.get("alertWay"), map.get("mobiles"), map.get("usIds"), map.get("feedBack"));
//通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(powertopic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true);
} catch (MqttException e) {
......@@ -322,7 +294,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
/**
* 规则回调
*/
public void ruleCallbackAction(String smsCode, List<Map<String,Object>> sendIds, Object object) throws Exception {
public void ruleCallbackAction(String smsCode, List<Map<String, Object>> sendIds, Object object) throws Exception {
// 获取报送对象列表
List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList();
......@@ -340,7 +312,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
String alertSubmittedId = calledRo.getAlertSubmittedId();
alertCalledId = calledRo.getSequenceNbr();
AlertCalledObjsDto alertCalledObjsDto = (AlertCalledObjsDto)alertCalledService.selectAlertCalledByIdNoRedisNew(Long.valueOf(calledRo.getSequenceNbr()));
AlertCalledObjsDto alertCalledObjsDto = (AlertCalledObjsDto) alertCalledService.selectAlertCalledByIdNoRedisNew(Long.valueOf(calledRo.getSequenceNbr()));
alertCalled = alertCalledObjsDto.getAlertCalled();
// AlertCalledRo tempCalledRo = new AlertCalledRo();
......@@ -353,77 +325,80 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 警情续报 警情结案,非警情确认选择人员电话号码
String ids = calledRo.getIds();
if(!ValidationUtil.isEmpty(ids)) {
if (!ValidationUtil.isEmpty(ids)) {
List<String> ls = Arrays.asList(ids.split(","));
ls.stream().forEach(e->mobiles.add(e));
for (String s : ls
) {
mobiles.add(s);
}
}
// 获取报送规则
sendIds.stream().forEach(e->{
sendIds.stream().forEach(e -> {
// 一般火灾 // 航空器救援
if(alertTypeCode.equals(AlertStageEnums.YBHZ.getCode()) || alertTypeCode.equals(AlertStageEnums.HKJY.getCode())) {
if(e.containsKey("onDuty")) {
if (alertTypeCode.equals(AlertStageEnums.YBHZ.getCode()) || alertTypeCode.equals(AlertStageEnums.HKJY.getCode())) {
if (e.containsKey("onDuty")) {
// 当日值班人员:获值班表中包括消救部、综合办公室、消防支队、应急指挥科的值班人员。
String [] arr = e.get("onDuty").toString().split(",");
String[] arr = e.get("onDuty").toString().split(",");
List<String> list = Arrays.asList(arr);
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyId(list);
orgUsers.addAll(mapList);
}
if(e.containsKey("fireBrigade")) {
if (e.containsKey("fireBrigade")) {
// 根据人员岗位:班组长、队长、通讯员; 消防队伍--消防人员 中,对应岗位的人员
List<FirefightersDto> fireBrigade = firefightersService.queryById(e.get("fireBrigade").toString().split(","), e.get("name").toString());
fireBrigade.stream().forEach(f->{
HashMap<String,Object> map = new HashMap<>();
map.put("telephone",f.getMobilePhone());
map.put("sequenceNbr",f.getSequenceNbr());
map.put("bizOrgName",f.getName());
map.put("amosUserId",f.getAmosUserId());
fireBrigade.stream().forEach(f -> {
HashMap<String, Object> map = new HashMap<>();
map.put("telephone", f.getMobilePhone());
map.put("sequenceNbr", f.getSequenceNbr());
map.put("bizOrgName", f.getName());
map.put("amosUserId", f.getAmosUserId());
map.put("companyName", e.get("name").toString());
orgUsers.add(map);
});
}
if(e.containsKey("name")) {
if (e.containsKey("name")) {
// 消防救援保障部
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyIdNew(e.get("name").toString());
orgUsers.addAll(mapList);
}
// 安运部
if(e.get("type").toString().equals("AY")) {
if(e.containsKey("name")) {
String [] arr = e.get("airportPost").toString().split(",");
if (e.get("type").toString().equals("AY")) {
if (e.containsKey("name")) {
String[] arr = e.get("airportPost").toString().split(",");
List<String> list = Arrays.asList(arr);
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId(e.get("name").toString(),list);
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId(e.get("name").toString(), list);
orgUsers.addAll(mapList);
}
}
// 事发单位
if(e.get("type").toString().equals("SF")) {
if(e.containsKey("airportPost")) {
String [] arr = e.get("airportPost").toString().split(",");
if (e.get("type").toString().equals("SF")) {
if (e.containsKey("airportPost")) {
String[] arr = e.get("airportPost").toString().split(",");
List<String> list = Arrays.asList(arr);
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId(unitInvolved,list);
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId(unitInvolved, list);
orgUsers.addAll(mapList);
}
}
}
// 突发事件救援 // 漏油现场安全保障 // 专机保障 // 其他
if(alertTypeCode.equals(AlertStageEnums.HKJY.getCode()) || alertTypeCode.equals(AlertStageEnums.LYXC.getCode())
if (alertTypeCode.equals(AlertStageEnums.HKJY.getCode()) || alertTypeCode.equals(AlertStageEnums.LYXC.getCode())
|| alertTypeCode.equals(AlertStageEnums.ZJBZ.getCode()) || alertTypeCode.equals(AlertStageEnums.QTJQ.getCode())) {
if(e.containsKey("onDuty")) {
if (e.containsKey("onDuty")) {
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyNew(e.get("name").toString());
orgUsers.addAll(mapList);
}
}
// 120急救
if(alertTypeCode.equals(AlertStageEnums.JJJQ.getCode())) {
if (alertTypeCode.equals(AlertStageEnums.JJJQ.getCode())) {
if (e.containsKey("name")) {
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyNew(e.get("name").toString());
orgUsers.addAll(mapList);
......@@ -441,7 +416,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 保存初报细分类型(一般火灾、航空器救援等)
alertSubmitted.setBusinessTypeCode(calledRo.getAlertTypeCode());
// 警情初报 --- 续报 结案
if(alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
if (alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情初报.getName());
Optional<SubmissionMethodEnum> submissionMethodEnum = Optional.of(SubmissionMethodEnum.SMS);
......@@ -458,10 +433,10 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
this.baseMapper.insert(alertSubmitted);
alertSubmittedId = alertSubmitted.getSequenceNbr().toString();
} else if(alertWay.equals(AlertBusinessTypeEnum.警情续报.getCode())) {
} else if (alertWay.equals(AlertBusinessTypeEnum.警情续报.getCode())) {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情续报.getName());
sCode = "SMS_JCS_XB";
} else if(alertWay.equals(AlertBusinessTypeEnum.警情结案.getCode())) {
} else if (alertWay.equals(AlertBusinessTypeEnum.警情结案.getCode())) {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情结案.getName());
sCode = "SMS_JCS_JA";
} else {
......@@ -476,14 +451,14 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
smsCode = alertBusinessTypeEnum.get().getSms_code();
if(!alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
if (!alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
LambdaQueryWrapper<AlertSubmitted> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AlertSubmitted::getAlertCalledId,alertCalledId);
queryWrapper.eq(AlertSubmitted::getAlertCalledId, alertCalledId);
queryWrapper.orderByDesc(AlertSubmitted::getSequenceNbr);
List<AlertSubmitted> alertSubmitteds = alertSubmittedMapper.selectList(queryWrapper);
alertSubmittedNew = alertSubmitteds.get(0);
if(!ValidationUtil.isEmpty(calledRo.getUsIds())) {
if (!ValidationUtil.isEmpty(calledRo.getUsIds())) {
usIds.addAll(Arrays.asList(calledRo.getUsIds().split(",")));
}
}
......@@ -491,7 +466,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 组装人员信息
for (Map<String, Object> orgUser : orgUsers) {
AlertSubmittedObject alertSubmittedObject = new AlertSubmittedObject();
if(!alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
if (!alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
alertSubmittedObject.setAlertSubmittedId(alertSubmittedNew.getSequenceNbr());
} else {
alertSubmittedObject.setAlertSubmittedId(Long.parseLong(alertSubmittedId));
......@@ -504,11 +479,11 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObject.setType(false);
alertSubmittedObject.setUserId(Long.valueOf(String.valueOf(orgUser.get("sequenceNbr"))));
alertSubmittedObject.setUserName((String) orgUser.get("bizOrgName"));
alertSubmittedObject.setTheUser((String) orgUser.get("bizOrgName"));
alertSubmittedObject.setCompanyName((String) orgUser.get("companyName"));
if (!ValidationUtil.isEmpty(orgUser.get("telephone"))) {
mobiles.add((String) orgUser.get("telephone"));
mobiles.add(orgUser.get("telephone").toString());
alertSubmittedObject.setUserPhone((String) orgUser.get("telephone"));
}
alertSubmittedObjectList.add(alertSubmittedObject);
......@@ -518,54 +493,52 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
smsParams.put("callTimeStr", calledRo.getCallTimeStr());
smsParams.put("address", calledRo.getAddress());
smsParams.put("fireLocation", calledRo.getFireLocation());
smsParams.put("endTimeStr", DateUtils.convertDateToString(alertCalled.getUpdateTime(), DateUtils.DATE_TIME_PATTERN));
smsParams.put("burningMaterial", calledRo.getBurningMaterial());
smsParams.put("fireSituation", calledRo.getFireSituation());
smsParams.put("trappedNum", calledRo.getTrappedNum());
smsParams.put("casualtiesNum", calledRo.getCasualtiesNum());
smsParams.put("dangerousExplosives", calledRo.getDangerousExplosives());
smsParams.put("companyName", calledRo.getCompanyName());
smsParams.put("contactUser", calledRo.getContactUser());
smsParams.put("contactPhone", calledRo.getContactPhone());
smsParams.put("contactUser", alertCalled.getContactUser());
smsParams.put("contactPhone", alertCalled.getContactPhone());
smsParams.put("replaceContent", calledRo.getReplaceContent());
smsParams.put("alertType", calledRo.getAlertType());
smsParams.put("feedback", calledRo.getFeedback());
}
// 短信报送对象
// alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
// 发送任务消息
// 组织短信内容
// 调用短信发送接口
Map<String,String> besidesMap = new HashMap<>();
besidesMap.put("alterId",String.valueOf(alertCalled.getSequenceNbr()));
Map<String, String> besidesMap = new HashMap<>();
besidesMap.put("alterId", String.valueOf(alertCalled.getSequenceNbr()));
if(alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
if (alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
besidesMap.put("sendTime", DateUtils.dateFormat(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情初报.getCode(),besidesMap,smsParams,usIds);
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情初报.getCode(), besidesMap, smsParams, usIds);
} else {
if(alertWay.equals(AlertBusinessTypeEnum.警情续报.getCode())) {
if (alertWay.equals(AlertBusinessTypeEnum.警情续报.getCode())) {
besidesMap.put("sendTime", DateUtils.dateFormat(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情续报.getCode(),besidesMap,smsParams,usIds);
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情续报.getCode(), besidesMap, smsParams, usIds);
}
if(alertWay.equals(AlertBusinessTypeEnum.警情结案.getCode())) {
if (alertWay.equals(AlertBusinessTypeEnum.警情结案.getCode())) {
besidesMap.put("startTime", DateUtils.dateFormat(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
besidesMap.put("endTime", DateUtils.dateFormat(alertCalled.getRecDate(), DateUtils.DATE_TIME_PATTERN));
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情结案.getCode(),besidesMap,smsParams,usIds);
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情结案.getCode(), besidesMap, smsParams, usIds);
}
if(alertWay.equals(AlertBusinessTypeEnum.非警情确认.getCode())) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.非警情确认.getCode(),besidesMap,smsParams,usIds);
if (alertWay.equals(AlertBusinessTypeEnum.非警情确认.getCode())) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.非警情确认.getCode(), besidesMap, smsParams, usIds);
}
alertCalledAction.sendAlertCalleCmd(sCode, mobiles, smsParams);
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
......@@ -576,10 +549,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
* @param userName 用户名
*/
@Transactional(rollbackFor = Exception.class)
public Map<String,String> saveAlertSubmitted(AlertSubmittedDto alertSubmittedDto, String userName) {
try { Long alertSubmittedId = alertSubmittedDto.getSequenceNbr();
public Map<String, String> saveAlertSubmitted(AlertSubmittedDto alertSubmittedDto, String userName) {
try {
Long alertSubmittedId = alertSubmittedDto.getSequenceNbr();
String alertWay = "";
Map<String,String> map = new HashMap<>();
Date endDate = null;
Map<String, String> map = new HashMap<>();
Set<String> mobiles = new HashSet<>();
List<Long> userIds = new ArrayList<>();
if (alertSubmittedId == null) {
......@@ -595,6 +570,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
e -> e.getCode().equals(bussTypeCode));
alertSubmitted.setBusinessType(businessTypeEnum.get().getName());
alertSubmitted.setCallLogId(alertSubmittedDto.getCallLogId());
alertSubmitted.setRecDate(alertSubmittedDto.getRecDate());
alertSubmitted.setSubmissionMethodCode(alertSubmittedDto.getSubmissionMethodCode());
Optional<SubmissionMethodEnum> submissionMethodEnum = EnumsUtils.getEnumObject(SubmissionMethodEnum.class,
e -> e.getCode().equals(alertSubmittedDto.getSubmissionMethodCode()));
......@@ -607,6 +583,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 任务 4174 日常值班---融合调度----短信模版中的内容用户可以全部删除掉,按照自定义内容重新录入发送内容 by litw 2021年10月27日
alertSubmitted.setBusinessTypeCode(alertSubmittedDto.getBusinessTypeCode());
alertSubmittedDto.getSubmitContent().get("recDate").toString();
endDate = DateUtils.dateParse(alertSubmittedDto.getSubmitContent().get("recDate").toString(), DateUtils.HOUR_PATTERN);
alertSubmitted.setSubmissionContent(alertSubmittedDto.getSubmitContent().toJSONString());
alertSubmitted.setSender(userName);
......@@ -645,7 +624,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObject.setCompanyName(company.getCompanyName());
alertSubmittedObject.setUserId(person.getPersonId());
userIds.add(person.getPersonId());
alertSubmittedObject.setUserName(person.getPersonName());
alertSubmittedObject.setTheUser(person.getPersonName());
alertSubmittedObject.setUserPhone(person.getPersonPhone());
alertSubmittedObject.setRecUserName(userName);
if (!ValidationUtil.isEmpty(person.getPersonPhone())) {
......@@ -661,35 +640,38 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
queryWrapper.in(true, OrgUsr::getSequenceNbr, userIds);
List<String> usIds = new ArrayList<>();
List<OrgUsr> list = orgUsrService.getBaseMapper().selectList(queryWrapper);
if(null != list && list.size() > 0) {
list.stream().forEach(e->{
if(!ValidationUtil.isEmpty(e.getAmosOrgId())) {
if (null != list && list.size() > 0) {
list.stream().forEach(e -> {
if (!ValidationUtil.isEmpty(e.getAmosOrgId())) {
usIds.add(e.getAmosOrgId());
}
});
map.put("usIds", StringUtils.join(usIds.toArray(new String[userIds.size()]),","));
map.put("usIds", StringUtils.join(usIds.toArray(new String[userIds.size()]), ","));
} else {
map.put("usIds", "");
}
alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
// alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
for (AlertSubmittedObject object : alertSubmittedObjectList) {
alertSubmittedObjectServiceImpl.save(object);
}
// 3.更新警情状态
alertCalledService.updateAlertCalled(alertSubmittedDto.getAlertCalledId(),
alertSubmittedDto.getBusinessTypeCode());
// 警情续报
if(AlertBusinessTypeEnum.警情续报.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
if (AlertBusinessTypeEnum.警情续报.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
alertWay = AlertBusinessTypeEnum.警情续报.getCode();
}
if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
if (AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
alertWay = AlertBusinessTypeEnum.警情结案.getCode();
// 警情结案生成模板
try {
AlertCalledFormDto alertCalledFormDto = (AlertCalledFormDto)alertCalledService.selectAlertCalledById(alertSubmittedDto.getAlertCalledId());
AlertCalledFormDto alertCalledFormDto = (AlertCalledFormDto) alertCalledService.selectAlertCalledById(alertSubmittedDto.getAlertCalledId());
AlertCalled alertCalled = alertCalledFormDto.getAlertCalled();
generateMob(alertCalled);
} catch (FileNotFoundException e) {
......@@ -699,17 +681,11 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
}
if(AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
if (AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
alertWay = AlertBusinessTypeEnum.非警情确认.getCode();
}
if (AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())
|| AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
// 查询本次警情调派的车辆
......@@ -736,34 +712,47 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
//警情結案推送
if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
if (AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
//tuisongxinjingqing
RequestData par=new RequestData();
RequestData par = new RequestData();
par.setAlertId(alertSubmittedDto.getAlertCalledId());
List<AlertCalledZhDto> list4 = alertCalledService.alertCalledListByAlertStatus(null, null, par);
String json=list4!=null&&list4.size()>0?JSONObject.toJSONString(list4.get(0), SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue):"";
String json = "";
if (list != null && list.size() > 0) {
AlertCalledZhDto ll = list4.get(0);
Map<String, String> map1 = org.apache.commons.beanutils.BeanUtils.describe((Object) list4.get(0));
String strDateFormat = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
map1.put("callTime", ll.getCallTime() != null ? sdf.format(ll.getCallTime()) : "");
map.put("sequenceNbr", ll.getSequenceNbr() + "");
map1.put("updateTime", ll.getUpdateTime() != null ? sdf.format(ll.getUpdateTime()) : "");
json = list != null && list.size() > 0 ? JSONObject.toJSONString(map1, SerializerFeature.PrettyFormat,
SerializerFeature.WriteMapNullValue) : "";
}
// String json=list4!=null&&list4.size()>0?JSONObject.toJSONString(list4.get(0), SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue):"";
emqKeeper.getMqttClient().publish(topicJa, json.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
// 4.发送任务消息
// 4.1组织短信内容 废弃
JSONObject submitContent = alertSubmittedDto.getSubmitContent();
String feedBack = submitContent.get("editContent") != null ? submitContent.get("editContent").toString(): "";
String feedBack = submitContent.get("editContent") != null ? submitContent.get("editContent").toString() : "";
// 4.2调用短信发送接口 废弃
// alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);\
map.put("feedBack",feedBack);
map.put("alertWay",alertWay);
map.put("mobiles", StringUtils.join(mobiles,","));
map.put("feedBack", feedBack);
map.put("alertWay", alertWay);
map.put("mobiles", StringUtils.join(mobiles, ","));
return map;
} catch (Exception e) {
e.printStackTrace();
......@@ -784,7 +773,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
report.setCallTime(ValidationUtil.isEmpty(alertCalled.getCallTime()) ? "" : DateUtils.convertDateToString(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
String urlString="";
String urlString = "";
report.setEndTime(DateUtils.convertDateToString(new Date(), DateUtils.DATE_TIME_PATTERN));
// 查询第一次调派
......@@ -794,39 +783,39 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
List<Map<String, Object>> other = alertSubmittedMapper.getFirst(alertCalled.getSequenceNbr());
LinkedList<AlertCalledPowerInfoDto> list = new LinkedList<>();
for(int i = 0; i <first.size(); i++) {
for (int i = 0; i < first.size(); i++) {
AlertCalledPowerInfoDto dto = new AlertCalledPowerInfoDto();
if(i == 0) {
if (i == 0) {
dto.setDisatchNum(String.valueOf(first.size()));
}
handleFunc(dto,first.get(i));
LocalDateTime dateTime = (LocalDateTime)first.get(i).get("recDate");
handleFunc(dto, first.get(i));
LocalDateTime dateTime = (LocalDateTime) first.get(i).get("recDate");
Date date = Date.from(dateTime.toInstant(ZoneOffset.of("+8")));
report.setToTime((DateUtils.dateFormat(date,DateUtils.HOUR_PATTERN)));
report.setToTime((DateUtils.dateFormat(date, DateUtils.HOUR_PATTERN)));
report.setArriveTime((DateUtils.dateFormat(date,DateUtils.HOUR_PATTERN)));
report.setArriveTime((DateUtils.dateFormat(date, DateUtils.HOUR_PATTERN)));
dto.setArriveTime((DateUtils.dateFormat(date,DateUtils.HOUR_PATTERN)));
dto.setArriveTime((DateUtils.dateFormat(date, DateUtils.HOUR_PATTERN)));
list.add(dto);
}
for(int i = 0; i <other.size(); i++) {
for (int i = 0; i < other.size(); i++) {
AlertCalledPowerInfoDto dto = new AlertCalledPowerInfoDto();
handleFunc(dto,first.get(i));
LocalDateTime dateTime = (LocalDateTime)first.get(i).get("recDate");
handleFunc(dto, first.get(i));
LocalDateTime dateTime = (LocalDateTime) first.get(i).get("recDate");
Date date = Date.from(dateTime.toInstant(ZoneOffset.of("+8")));
dto.setArriveTime((DateUtils.dateFormat(date,DateUtils.HOUR_PATTERN)));
dto.setArriveTime((DateUtils.dateFormat(date, DateUtils.HOUR_PATTERN)));
list.add(dto);
}
// 查询应急指挥辅屏值班人员
List<Map<String, Object>> mapList = iDutyPersonService.listOnDutyPerson();
List<AlertCallCommandDto> list1 = new ArrayList<>();
mapList.forEach(e->{
mapList.forEach(e -> {
AlertCallCommandDto dto = new AlertCallCommandDto();
dto.setName(e.get("userName").toString());
dto.setDuty(e.get("postTypeName").toString());
......@@ -855,17 +844,17 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// String filePath = this.getClass().getClassLoader().getResource("templates").getPath();
String filePath = "";
String fileName = "";
if(os.toLowerCase().startsWith("win")) {
if (os.toLowerCase().startsWith("win")) {
filePath = this.getClass().getClassLoader().getResource("templates").getPath();
fileName = filePath + "/" + System.currentTimeMillis() + ".docx";
} else {
// String [] arr = path.split("amos-boot-system-jcs-1.0.0.jar!");
// System.out.println(arr[0].substring(0,arr[0].lastIndexOf("/")));
// fileName = arr[0].substring(0,arr[0].lastIndexOf("/")) + "/" + System.currentTimeMillis() + ".docx";
fileName = "/opt/file/"+System.currentTimeMillis() + ".docx";
fileName = "/opt/file/" + System.currentTimeMillis() + ".docx";
}
String newFileName= "";
String newFileName = "";
AlertCalledPowerInfoTablePolicy calledPowerInfoTablePolicy = new AlertCalledPowerInfoTablePolicy();
AlertCallCommandTablePolicy alertCallCommandTablePolicy = new AlertCallCommandTablePolicy();
......@@ -876,12 +865,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
XWPFTemplate template = XWPFTemplate.compile(resourceAsStream, configureBuilder.build()).render(report);
File file = new File(fileName);
if (!file .getParentFile().exists()) {
file .getParentFile().mkdirs();
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
if(!file .exists()) {
if (!file.exists()) {
try {
file .createNewFile();
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
......@@ -903,17 +892,17 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
//拼接完整连接
String pa1 = "";
if(os.toLowerCase().startsWith("win")){
if (os.toLowerCase().startsWith("win")) {
String pa = fileName.substring(1);
document.loadFromFile(pa);
newFileName = System.currentTimeMillis()+".doc";
newFileName = System.currentTimeMillis() + ".doc";
//保存结果文件
pa1 = newFileName.substring(1);
document.saveToFile(pa1, FileFormat.Doc);
} else {
document.loadFromFile(fileName);
System.out.println(fileName);
newFileName = "/opt/file/" + System.currentTimeMillis()+".doc";
newFileName = "/opt/file/" + System.currentTimeMillis() + ".doc";
System.out.println(newFileName);
document.saveToFile(newFileName, FileFormat.Doc);
pa1 = newFileName;
......@@ -926,7 +915,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
while (it.hasNext()) {
urlString=it.next();
urlString = it.next();
}
}
System.out.println(urlString);
......@@ -944,12 +933,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
template.close();
File file2 = new File(fileName);
if(file2.exists()) {
if (file2.exists()) {
file2.delete();
}
File file1 = new File(newFileName);
if(file1.exists()) {
if (file1.exists()) {
file1.delete();
}
} catch (IOException e) {
......@@ -958,7 +947,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
}
}
void handleFunc(AlertCalledPowerInfoDto dto,Map<String, Object> map) {
void handleFunc(AlertCalledPowerInfoDto dto, Map<String, Object> map) {
if (map.containsKey("carName")) {
dto.setCarName(map.get("carName").toString());
}
......@@ -1003,7 +993,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
List<RowRenderData> checkDangerList = Lists.newArrayList();
reportDto.forEach(foreachWithIndex((report, index) -> {
RowRenderData rowRenderData = RowRenderData.build(String.valueOf(reportDto.size() - index),
report.getStation(), report.getArriveTime(), report.getCarName(),report.getPersonNum(),report.getDisatchNum(),report.getDryPowder(),report.getFoam(),report.getOther());
report.getStation(), report.getArriveTime(), report.getCarName(), report.getPersonNum(), report.getDisatchNum(), report.getDryPowder(), report.getFoam(), report.getOther());
checkDangerList.add(rowRenderData);
}));
generateTableData(table, checkDangerList);
......@@ -1044,7 +1034,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
cellRenderData.getRenderData().setStyle(style);
});
XWPFTableRow insertNewTableRow = table.insertNewTableRow(dangerListDataStartRowNew);
IntStream.range(2,6).forEach(j -> insertNewTableRow.createCell());
IntStream.range(2, 6).forEach(j -> insertNewTableRow.createCell());
MiniTableRenderPolicy.Helper.renderRow(table, dangerListDataStartRowNew, reverseList.get(i));
}
......@@ -1054,7 +1044,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
public static void generateTableData(XWPFTable table, List<RowRenderData> dangerList) {
String firstSize ="";
String firstSize = "";
if (!ValidationUtil.isEmpty(dangerList)) {
firstSize = dangerList.get(0).getCellDatas().get(5).getRenderData().getText();
int fSizs = Integer.parseInt(firstSize);
......@@ -1065,7 +1055,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 循环插入行
int listLength = dangerList.size();
for (int i = 0; i < fSizs; i++) {
if(i == 0) {
if (i == 0) {
TableStyle tableStyle = new TableStyle();
tableStyle.setAlign(Enum.forInt(2));
reverseList.get(i).getCellDatas().get(0).setCellStyle(tableStyle);
......@@ -1085,11 +1075,11 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
XWPFTableRow insertNewTableRow = table.insertNewTableRow(dangerListDataStartRow);
IntStream.range(5,14).forEach(j -> insertNewTableRow.createCell());
IntStream.range(5, 14).forEach(j -> insertNewTableRow.createCell());
MiniTableRenderPolicy.Helper.renderRow(table, dangerListDataStartRow, reverseList.get(i));
}
for (int i = fSizs; i < listLength ; i++) {
for (int i = fSizs; i < listLength; i++) {
reverseList.get(i).getCellDatas().forEach(cellRenderData -> {
Style style = new Style();
style.setFontFamily("仿宋");
......@@ -1097,14 +1087,14 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
cellRenderData.getRenderData().setStyle(style);
});
XWPFTableRow insertNewTableRow = table.insertNewTableRow(dangerListDataStartRow);
IntStream.range(5,14).forEach(j -> insertNewTableRow.createCell());
IntStream.range(5, 14).forEach(j -> insertNewTableRow.createCell());
MiniTableRenderPolicy.Helper.renderRow(table, dangerListDataStartRow, reverseList.get(i));
}
TableTools.mergeCellsVertically(table, 0, 0, fSizs + 1);
if(listLength - fSizs > 1 ) {
TableTools.mergeCellsVertically(table, 0, fSizs + 2 , listLength + 1);
if (listLength - fSizs > 1) {
TableTools.mergeCellsVertically(table, 0, fSizs + 2, listLength + 1);
}
}
}
......@@ -1141,7 +1131,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
*/
AlertCalledRo alertCalledRo = new AlertCalledRo();
String replaceContent = RuleAlertCalledService.init(alertCalledRo,alertCalledVo);
String replaceContent = RuleAlertCalledService.init(alertCalledRo, alertCalledVo);
// 获取模板内容
List<DataDictionary> dataDictionaries =
......@@ -1151,12 +1141,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Template template = templateService.getOne(new QueryWrapper<Template>().eq("type_code",
dataDictionary.getCode()).eq("format", true));
Map<String, String> definitions = new HashMap<>();
definitions.put("$type",alertCalled.getAlertType());
definitions.put("$callTime", DateUtils.dateTimeToDateString(alertCalled.getCallTime()));
definitions.put("$replaceContent",replaceContent);
definitions.put("$address",alertCalled.getAddress());
definitions.put("$recDate", DateUtils.convertDateToString(alertCalled.getRecDate(), DateUtils.DATE_TIME_PATTERN));
String content = getTaskInformation( template.getContent(),definitions);
definitions.put("$type", alertCalled.getAlertType());
definitions.put("$callTime", DateUtils.convertDateToString(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
definitions.put("$replaceContent", replaceContent);
definitions.put("$address", ValidationUtil.isEmpty(alertCalled.getAddress()) ? "" : alertCalled.getAddress());
definitions.put("$contactUser", ValidationUtil.isEmpty(alertCalled.getContactUser()) ? "" : alertCalled.getContactUser());
definitions.put("$contactPhone", ValidationUtil.isEmpty(alertCalled.getContactPhone()) ? "" : alertCalled.getContactPhone());
// definitions.put("$recDate", DateUtils.convertDateToString(new Date(), DateUtils.DATE_TIME_PATTERN));
if (alertCalled.getAlertStatus()) {
map.put("recDate", DateUtils.convertDateToString(alertCalled.getUpdateTime(), DateUtils.DATE_TIME_PATTERN));
} else {
map.put("recDate", DateUtils.convertDateToString(new Date(), DateUtils.DATE_TIME_PATTERN));
}
String content = getTaskInformation(template.getContent(), definitions);
template.setContent(content);
TemplateDto templateDto = new TemplateDto();
BeanUtils.copyProperties(template, templateDto);
......@@ -1185,7 +1183,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
//获取接警录音
List<VoiceRecordFileDto> voiceRecordFileDtos = voiceRecordFileService.listByAlertId(id);
voiceRecordFileDtos.stream().forEach(voiceRecordFileDto -> {
InstructionsZHDto instruct = new InstructionsZHDto(voiceRecordFileDto.getSequenceNbr(), "接警录音", voiceRecordFileDto.getRecDate(), voiceRecordFileDto.getFilePath(),null);
InstructionsZHDto instruct = new InstructionsZHDto(voiceRecordFileDto.getSequenceNbr(), "接警录音", voiceRecordFileDto.getRecDate(), voiceRecordFileDto.getFilePath(), null);
listInstructionsZHDto.add(instruct);
});
......@@ -1236,16 +1234,16 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
break;
}
InstructionsZHDto instruct = new InstructionsZHDto(AlertSubmittedZHDto.getSequenceNbr(), AlertSubmittedZHDto.getBusinessType(), AlertSubmittedZHDto.getSubmissionTime(), content,null);
InstructionsZHDto instruct = new InstructionsZHDto(AlertSubmittedZHDto.getSequenceNbr(), AlertSubmittedZHDto.getBusinessType(), AlertSubmittedZHDto.getSubmissionTime(), content, null);
listInstructionsZHDto.add(instruct);
});
// 获取归并得警情信息
LambdaQueryWrapper<AlertCalled> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(AlertCalled::getFatherAlert,id);
queryWrapper.eq(AlertCalled::getFatherAlert, id);
List<AlertCalled> alertCalleds = alertCalledService.getBaseMapper().selectList(queryWrapper);
alertCalleds.stream().forEach(e->{
alertCalleds.stream().forEach(e -> {
AlertSubmittedZHDto alertSubmittedZHDto = new AlertSubmittedZHDto();
AlertCalledFormDto alertCalledFormDto = (AlertCalledFormDto) alertCalledService.selectAlertCalledByIdNoRedis(e.getSequenceNbr());
alertSubmittedZHDto.setAlertCalledFormDto(alertCalledFormDto);
......@@ -1305,7 +1303,6 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
@SuppressWarnings("unchecked")
public void ruleCallbackActionForPowerTransferForCar(String smsCode, List sendIds, Object object, List<String> pList)
throws IllegalAccessException, MqttPersistenceException, MqttException {
......@@ -1333,8 +1330,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertCalledId = calledRo.getSequenceNbr();
AlertCalled alertCalled = alertCalledService.getAlertCalledById(Long.parseLong(alertSubmittedId));
//响应级别
String responseLevelString ="";
if(alertCalled!=null && alertCalled.getResponseLevel()!=null) {
String responseLevelString = "";
if (alertCalled != null && alertCalled.getResponseLevel() != null) {
responseLevelString = alertCalled.getResponseLevel();
}
//先获取消救部领导、消救部值班人员信息
......@@ -1342,20 +1339,21 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(e));
// 消救部
if (jsonObject.containsKey("airportUnit")) {
String departmentName= jsonObject.getString("name");
if (jsonObject.containsKey("airportUnit")) { {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName,null);
String departmentName = jsonObject.getString("name");
if (jsonObject.containsKey("airportUnit")) {
{
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName, null);
userIdList.addAll(mapList);
}
if(jsonObject.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(),departmentName);
if (jsonObject.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(), departmentName);
userIdList.addAll(mapList);
}
}
}
});
List<Object> companyDetail = JSONArray.parseArray(JSON.toJSON(calledRo.getCompany()).toString(),Object.class);
List<Object> companyDetail = JSONArray.parseArray(JSON.toJSON(calledRo.getCompany()).toString(), Object.class);
for (Object powerTransferCompanyDto : companyDetail) {
PowerTransferCompanyDto powerDto = JSONObject.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class);
Long companyId = powerDto.getCompanyId();
......@@ -1364,32 +1362,34 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Set<Map<String, Object>> sendUserIds = new HashSet<Map<String, Object>>();
//FireTeam fireTeam= fireTeamServiceImpl.getById(companyId);
String alertTypeCode = calledRo.getAlertTypeCode();
FireTeam fireTeam= fireTeamServiceImpl.getById(companyId);
FireTeam fireTeam = fireTeamServiceImpl.getById(companyId);
sendIds.stream().forEach(e -> {
JSONObject jsonObject1 = JSONObject.parseObject(JSONObject.toJSONString(e));
if (jsonObject1.containsKey("type") && (jsonObject1.getString("type").equals(AlertStageEnums.DD.getCode()))) {
String [] groupCode = jsonObject1.getString("fireBrigade").split(",");
List<String> positionType= Arrays.asList(groupCode);
if (jsonObject1.containsKey("fireBrigade")) { {
String[] groupCode = jsonObject1.getString("fireBrigade").split(",");
List<String> positionType = Arrays.asList(groupCode);
if (jsonObject1.containsKey("fireBrigade")) {
{
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(fireTeam.getCompanyName(),positionType);
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(fireTeam.getCompanyName(), positionType);
sendUserIds.addAll(mapList);
}
if(jsonObject1.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(),fireTeam.getCompanyName());
if (jsonObject1.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(), fireTeam.getCompanyName());
sendUserIds.addAll(mapList);
}
}
}else if (jsonObject1.containsKey("type") && (jsonObject1.getString("type").equals(AlertStageEnums.ZD.getCode()))) {
String [] groupCode = jsonObject1.get("fireBrigade").toString().split(",");
List<String> positionType= Arrays.asList(groupCode);
String departmentName= jsonObject1.getString("name");
if (jsonObject1.containsKey("fireBrigade")) { {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName,positionType);
} else if (jsonObject1.containsKey("type") && (jsonObject1.getString("type").equals(AlertStageEnums.ZD.getCode()))) {
String[] groupCode = jsonObject1.get("fireBrigade").toString().split(",");
List<String> positionType = Arrays.asList(groupCode);
String departmentName = jsonObject1.getString("name");
if (jsonObject1.containsKey("fireBrigade")) {
{
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName, positionType);
sendUserIds.addAll(mapList);
}
if(jsonObject1.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(),departmentName);
if (jsonObject1.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(), departmentName);
sendUserIds.addAll(mapList);
}
}
......@@ -1407,7 +1407,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObject.setCompanyName(companyName);
alertSubmittedObject.setType(false);
alertSubmittedObject.setUserId(Long.parseLong(orgUser.get("userId").toString()));
alertSubmittedObject.setUserName(orgUser.get("userName").toString());
alertSubmittedObject.setTheUser(orgUser.get("userName").toString());
// 将发送人放入 list
pList.add(orgUser.get("userName").toString());
......@@ -1450,23 +1450,23 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObjectSub.setCompanyId(companyId);
alertSubmittedObjectSub.setCompanyName(companyName);
alertSubmittedObjectSub.setType(false);
if(map==null || !map.containsKey("userId")) {
if (map == null || !map.containsKey("userId")) {
continue;
}
alertSubmittedObjectSub.setUserId(Long.parseLong(map.get("userId").toString()));
alertSubmittedObjectSub.setUserName(map.get("userName").toString());
alertSubmittedObjectSub.setTheUser(map.get("userName").toString());
//
pList.add(map.get("userName").toString());
Set<String> mobile =null;
List<String> userList=null;
Set<String> mobile = null;
List<String> userList = null;
if (!ValidationUtil.isEmpty(map.get("mobilePhone"))) {
mobile = new HashSet<String>() {
{
add(map.get("mobilePhone").toString());
}
};
userList=new ArrayList<String>();
if(!ValidationUtil.isEmpty(map.get("amosId"))) {
userList = new ArrayList<String>();
if (!ValidationUtil.isEmpty(map.get("amosId"))) {
userList.add(map.get("amosId").toString());
}
alertSubmittedObjectSub.setUserPhone(map.get("mobilePhone").toString());
......@@ -1478,8 +1478,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Map<String, String> besidesMap = new HashMap<String, String>();
besidesMap.put("responseLevelString", responseLevelString);
besidesMap.put("alterId", alertCalledId);
if(userList.size()>0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList);
if (userList.size() > 0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(), besidesMap, smsParams, userList);
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS,
......@@ -1488,12 +1488,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
}
String resourcesNumStr = resourcesNum.toString();
List<String> userList= new ArrayList<String>();
List<String> userList = new ArrayList<String>();
sendUserIds.stream().forEach(i -> {
if (i.containsKey("mobilePhone")) {
mobiles.add(i.get("mobilePhone").toString());
}
if (i.containsKey("amosId")&& !ValidationUtil.isEmpty(i.get("amosId"))) {
if (i.containsKey("amosId") && !ValidationUtil.isEmpty(i.get("amosId"))) {
userList.add(i.get("amosId").toString());
}
});
......@@ -1510,8 +1510,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Map<String, String> besidesMap = new HashMap<String, String>();
besidesMap.put("responseLevelString", responseLevelString);//响应级别
besidesMap.put("alterId", alertCalledId);
if(userList.size()>0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList);
if (userList.size() > 0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(), besidesMap, smsParams, userList);
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
......@@ -1532,17 +1532,18 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
String alertSubmittedId = calledRo.getAlertSubmittedId();
alertCalledId = calledRo.getSequenceNbr();
Set<Map<String, Object>> userIds = new HashSet<Map<String, Object>>();
List<Object> companyDetail =JSONArray.parseArray(JSON.toJSON(calledRo.getCompany()).toString(),Object.class);
for(Object e:sendIds) {
List<Object> companyDetail = JSONArray.parseArray(JSON.toJSON(calledRo.getCompany()).toString(), Object.class);
for (Object e : sendIds) {
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(e));
if(jsonObject.containsKey("type") &&( (jsonObject.getString("type").equals(AlertStageEnums.ZH.getCode())) || jsonObject.getString("type").equals(AlertStageEnums.XJ.getCode()))) {
String departmentName= jsonObject.getString("name");
if (jsonObject.containsKey("airportUnit")) { {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName,null);
if (jsonObject.containsKey("type") && ((jsonObject.getString("type").equals(AlertStageEnums.ZH.getCode())) || jsonObject.getString("type").equals(AlertStageEnums.XJ.getCode()))) {
String departmentName = jsonObject.getString("name");
if (jsonObject.containsKey("airportUnit")) {
{
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName, null);
userIds.addAll(mapList);
}
if(jsonObject.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(),departmentName);
if (jsonObject.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(), departmentName);
userIds.addAll(mapList);
}
}
......@@ -1553,18 +1554,19 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
PowerTransferCompanyDto powerDto = JSONObject.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class);
Long companyId = powerDto.getCompanyId();
String companyName = powerDto.getCompanyName();
FireTeam fireTeam= fireTeamServiceImpl.getById(companyId);
FireTeam fireTeam = fireTeamServiceImpl.getById(companyId);
for(Object sendObject:sendIds) {
for (Object sendObject : sendIds) {
JSONObject jsonObject1 = JSONObject.parseObject(JSONObject.toJSONString(sendObject));
if (jsonObject1.containsKey("type") && (jsonObject1.getString("type").equals(AlertStageEnums.监控大队.getCode()))) {
if(jsonObject1.containsKey("onDuty")) {
if (jsonObject1.containsKey("onDuty")) {
List<Map<String, Object>> dutyList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(
DateUtils.getDateNowShortStr(), fireTeam.getCompanyName());
sendUserIds.addAll(dutyList);
}
if (jsonObject1.containsKey("airportUnit")) { {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff( fireTeam.getCompanyName(),null);
if (jsonObject1.containsKey("airportUnit")) {
{
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(fireTeam.getCompanyName(), null);
sendUserIds.addAll(mapList);
}
}
......@@ -1582,7 +1584,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObject.setCompanyName(companyName);
alertSubmittedObject.setType(false);
alertSubmittedObject.setUserId(Long.parseLong(orgUser.get("userId").toString()));
alertSubmittedObject.setUserName(orgUser.get("userName").toString());
alertSubmittedObject.setTheUser(orgUser.get("userName").toString());
pList.add(orgUser.get("userName").toString());
if (!ValidationUtil.isEmpty(orgUser.get("telephone"))) {
......@@ -1601,12 +1603,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
smsParams.put("contactPhone", calledRo.getContactPhone());
smsParams.put("alertType", calledRo.getAlertType());
List<String> userList= new ArrayList<String>();
List<String> userList = new ArrayList<String>();
sendUserIds.stream().forEach(i -> {
if (i.containsKey("mobilePhone")) {
mobiles.add(i.get("mobilePhone").toString());
}
if (i.containsKey("amosId")&& !ValidationUtil.isEmpty(i.get("amosId"))) {
if (i.containsKey("amosId") && !ValidationUtil.isEmpty(i.get("amosId"))) {
userList.add(i.get("amosId").toString());
}
});
......@@ -1618,13 +1620,13 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 调用短信发送接口
try {
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
}catch(Exception e){
} catch (Exception e) {
}
Map<String, String> besidesMap = new HashMap<String, String>();
besidesMap.put("alterId", alertCalledId);
if(userList.size()>0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList);
if (userList.size() > 0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(), besidesMap, smsParams, userList);
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
......@@ -1632,9 +1634,6 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
public void ruleCallbackActionForPowerTransferForAid(String smsCode, List sendIds, Object object, List<String> pList) throws MqttPersistenceException, MqttException {
List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList();
......@@ -1650,19 +1649,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
String alertSubmittedId = calledRo.getAlertSubmittedId();
alertCalledId = calledRo.getSequenceNbr();
//List<FireTeam> fireTeamList= new ArrayList<FireTeam>();
List<Object> companyDetail =JSONArray.parseArray(JSON.toJSON(calledRo.getCompany()).toString(),Object.class);
List<Object> companyDetail = JSONArray.parseArray(JSON.toJSON(calledRo.getCompany()).toString(), Object.class);
//获取急救科、消救部人员信息
for(Object e:sendIds) {
for (Object e : sendIds) {
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(e));
if(jsonObject.containsKey("type") &&( (jsonObject.getString("type").equals(AlertStageEnums.ZH.getCode())) || jsonObject.getString("type").equals(AlertStageEnums.XJ.getCode()))) {
String departmentName= jsonObject.getString("name");
if (jsonObject.containsKey("airportUnit")) { {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName,null);
if (jsonObject.containsKey("type") && ((jsonObject.getString("type").equals(AlertStageEnums.ZH.getCode())) || jsonObject.getString("type").equals(AlertStageEnums.XJ.getCode()))) {
String departmentName = jsonObject.getString("name");
if (jsonObject.containsKey("airportUnit")) {
{
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName, null);
userIds.addAll(mapList);
}
if(jsonObject.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(),departmentName);
if (jsonObject.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(), departmentName);
userIds.addAll(mapList);
}
}
......@@ -1674,13 +1674,13 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
PowerTransferCompanyDto powerDto = JSONObject.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class);
Long companyId = powerDto.getCompanyId();
String companyName = powerDto.getCompanyName();
FireTeam fireTeam= fireTeamServiceImpl.getById(companyId);//这个公司ID实际上是120急救站的id值
FireTeam fireTeam = fireTeamServiceImpl.getById(companyId);//这个公司ID实际上是120急救站的id值
//fireTeamList.add(fireTeam);
for(Object e:sendIds) {
for (Object e : sendIds) {
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(e));
//获取120急救站的规则
if (jsonObject.containsKey("type") && (jsonObject.getString("type").equals(AlertStageEnums.JJZ.getCode()))) {
if(!jsonObject.containsKey("onDuty")) {
if (!jsonObject.containsKey("onDuty")) {
continue;
}
//fireTeamList.stream().forEach(i->{
......@@ -1703,7 +1703,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObject.setCompanyName(companyName);
alertSubmittedObject.setType(false);
alertSubmittedObject.setUserId(Long.parseLong(orgUser.get("userId").toString()));
alertSubmittedObject.setUserName(orgUser.get("userName").toString());
alertSubmittedObject.setTheUser(orgUser.get("userName").toString());
pList.add(orgUser.get("userName").toString());
if (!ValidationUtil.isEmpty(orgUser.get("mobilePhone"))) {
......@@ -1721,12 +1721,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
smsParams.put("contactUser", calledRo.getContactUser());
smsParams.put("contactPhone", calledRo.getContactPhone());
smsParams.put("alertType", calledRo.getAlertType());
List<String> userList= new ArrayList<String>();
List<String> userList = new ArrayList<String>();
sendUserIds.stream().forEach(i -> {
if (i.containsKey("mobilePhone")) {
mobiles.add(i.get("mobilePhone").toString());
}
if (i.containsKey("amosId")&& !ValidationUtil.isEmpty(i.get("amosId"))) {
if (i.containsKey("amosId") && !ValidationUtil.isEmpty(i.get("amosId"))) {
userList.add(i.get("amosId").toString());
}
});
......@@ -1738,13 +1738,13 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 调用短信发送接口
try {
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
}catch (Exception e) {// TODO: handle exception
} catch (Exception e) {// TODO: handle exception
}
Map<String, String> besidesMap = new HashMap<String, String>();
besidesMap.put("alterId", alertCalledId);
if(userList.size()>0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList);
if (userList.size() > 0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(), besidesMap, smsParams, userList);
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
......@@ -1754,11 +1754,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
/**
* app消息web 消息推送
*
* @param
* @throws MqttPersistenceException
* @throws MqttException
*/
public void pushPowerTransferToAppAndWeb(String type,Map<String, String> besidesMap, HashMap<String, String> smsParams, List<String> userList){
public void pushPowerTransferToAppAndWeb(String type, Map<String, String> besidesMap, HashMap<String, String> smsParams, List<String> userList) {
PushMessageWebAndAppRo pushMessageWebAndAppRo = new PushMessageWebAndAppRo();
pushMessageWebAndAppRo.setRelationId(besidesMap.get("alterId"));
......@@ -1769,24 +1770,24 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
pushMessageWebAndAppRo.setRuleType(type);
pushMessageWebAndAppRo.setMsgType(this.msgType);
pushMessageWebAndAppRo.setTerminal(RuleConstant.APP_WEB);
Map<String,String> map= new HashMap<String,String>();
Map<String, String> map = new HashMap<String, String>();
//map.put("url", "disasterPage");
map.put("sequenceNbr", besidesMap.get("alterId"));
if(AlertBusinessTypeEnum.警情结案.getCode().equals(type)) {
if (AlertBusinessTypeEnum.警情结案.getCode().equals(type)) {
pushMessageWebAndAppRo.setName("消息");
pushMessageWebAndAppRo.setStartTime(besidesMap.get("startTime"));
pushMessageWebAndAppRo.setEndTime(besidesMap.get("endTime"));
pushMessageWebAndAppRo.setAddress(smsParams.get("address"));
pushMessageWebAndAppRo.setRuleType("endAlert");
}
if(AlertBusinessTypeEnum.非警情确认.getCode().equals(type)) {
if (AlertBusinessTypeEnum.非警情确认.getCode().equals(type)) {
pushMessageWebAndAppRo.setName("消息");
pushMessageWebAndAppRo.setSendTime(smsParams.get("callTimeStr"));
pushMessageWebAndAppRo.setAddress(smsParams.get("address"));
pushMessageWebAndAppRo.setRuleType("notAlert");
}
if(AlertBusinessTypeEnum.警情续报.getCode().equals(type)) {
if (AlertBusinessTypeEnum.警情续报.getCode().equals(type)) {
pushMessageWebAndAppRo.setName("消息");
pushMessageWebAndAppRo.setCompanyName(smsParams.get("alertType"));
pushMessageWebAndAppRo.setAddress(smsParams.get("address"));
......@@ -1796,20 +1797,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
pushMessageWebAndAppRo.setCasualtiesNum(smsParams.get("casualtiesNum"));//伤亡人数
pushMessageWebAndAppRo.setRuleType("followReportAlert");
}
if(AlertBusinessTypeEnum.力量调派.getCode().equals(type)) {
if (AlertBusinessTypeEnum.力量调派.getCode().equals(type)) {
//map.put("url", "powerInformationPage");
pushMessageWebAndAppRo.setName(AlertBusinessTypeEnum.力量调派.getName());
pushMessageWebAndAppRo.setCompanyName(smsParams.get("resourcesNum"));
pushMessageWebAndAppRo.setAddress(smsParams.get("address"));
pushMessageWebAndAppRo.setSendTime(smsParams.get("callTimeStr"));
if(StringUtils.isNotBlank(besidesMap.get("transferLocation"))) {
if (StringUtils.isNotBlank(besidesMap.get("transferLocation"))) {
pushMessageWebAndAppRo.setTransferLocation(besidesMap.get("responseLevelString"));//响应级别
pushMessageWebAndAppRo.setRuleType("fullTime");
}else {
} else {
pushMessageWebAndAppRo.setRuleType("monitor");
}
}
if(AlertBusinessTypeEnum.警情初报.getCode().equals(type)) {
if (AlertBusinessTypeEnum.警情初报.getCode().equals(type)) {
pushMessageWebAndAppRo.setRuleType("reportAlert");
pushMessageWebAndAppRo.setName(AlertBusinessTypeEnum.警情初报.getName());
pushMessageWebAndAppRo.setSendTime(besidesMap.get("sendTime"));
......@@ -1819,7 +1820,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
pushMessageWebAndAppRo.setTrappedNum(smsParams.get("trappedNum"));//被困人数
pushMessageWebAndAppRo.setCasualtiesNum(smsParams.get("casualtiesNum"));//伤亡人数
}
pushMessageWebAndAppRo.setExtras(map);;
pushMessageWebAndAppRo.setExtras(map);
;
try {
ruleTrigger.publish(pushMessageWebAndAppRo, "消息/addAlterMessageCheck", new String[0]);
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.dao.mapper.DataDictionaryMapper;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamCardDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamListDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto;
import com.yeejoin.amos.boot.module.common.api.dto.LinkageUnitDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.entity.MaintenanceCompany;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.enums.ExcelSelectData;
......@@ -51,6 +26,17 @@ import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class DataSourcesImpl implements DataSources {
......@@ -141,28 +127,28 @@ public class DataSourcesImpl implements DataSources {
str = getBuildTree();
break;
case "getCompanyDetailTree":
str =getCompanyDetailTree();
str = getCompanyDetailTree();
break;
case "getparent":
str =getparent();
str = getparent();
break;
case "getUnitTeam":
str =getUnitTeam();
str = getUnitTeam();
break;
case "getCompany":
str =getCompany();
str = getCompany();
break;
case "getCitys":
str =getCitys();
str = getCitys();
break;
case "getDutyArea":
str =getDutyArea();
str = getDutyArea();
break;
case "getEquipCategory":
str =getEquipCategory();
str = getEquipCategory();
break;
case "getEquipDefinition":
str =getEquipDefinition();
str = getEquipDefinition();
break;
}
}
......@@ -186,7 +172,7 @@ public class DataSourcesImpl implements DataSources {
// new FireTeamListDto());
// List<FireTeamCardDto> records = fireTeamCardDtoIPage.getRecords();
List<FireTeam> records= fireTeamService.getFireTeamList();
List<FireTeam> records = fireTeamService.getFireTeamList();
List<String> names = records.stream().map(item -> {
......@@ -317,9 +303,9 @@ public class DataSourcesImpl implements DataSources {
private String[] getparent() throws Exception {
String[] str=null;
List<Map<String ,Object>> orgUsrTree = orgUsrService.getparent();
if(orgUsrTree!=null&&orgUsrTree.size()>0){
String[] str = null;
List<Map<String, Object>> orgUsrTree = orgUsrService.getparent();
if (orgUsrTree != null && orgUsrTree.size() > 0) {
List<String> buildingNames = orgUsrTree.stream().map(item -> {
return item.get("name") + "@" + item.get("id");
}).collect(Collectors.toList());
......@@ -332,6 +318,7 @@ public class DataSourcesImpl implements DataSources {
/**
* 特岗人员模板及救援车辆模板获取联动单位 BUG 2455 相关代码 bykongfm
*
* @return
*/
private String[] getUnitTeam() {
......@@ -345,6 +332,7 @@ public class DataSourcesImpl implements DataSources {
/**
* 消防队员模板获取所属部门
*
* @return
*/
private String[] getCompany() {
......@@ -352,7 +340,7 @@ public class DataSourcesImpl implements DataSources {
//List<OrgMenuDto> menus = OrgUsrServiceImpl.buildTreeParallel(iOrgUsrService.selectCompanyDepartmentMsg());
List<OrgUsr> menus = iOrgUsrService.selectCompanyDepartmentMsg();
List<String> names = menus.stream().map(item -> {
return item.getBizOrgName() + "@" + item.getSequenceNbr()+ "@" + item.getBizOrgCode();
return item.getBizOrgName() + "@" + item.getSequenceNbr() + "@" + item.getBizOrgCode();
}).collect(Collectors.toList());
String[] str = names.toArray(new String[names.size()]);
return str;
......@@ -360,25 +348,26 @@ public class DataSourcesImpl implements DataSources {
/**
* 消防队员模板获取地址
*
* @return
*/
private String[] getCitys() {
FeignClientResult<java.util.Collection<RegionModel>> region = Systemctl.regionClient.queryForTreeParent(null);
java.util.Collection<RegionModel> regions = region.getResult();// 以及地址
List<String> address = new ArrayList<>();
setAddress("",address,regions);
setAddress("", address, regions);
String[] str = address.toArray(new String[address.size()]);
return str;
}
private void setAddress(String name,List<String> address, Collection<RegionModel> regions) {
private void setAddress(String name, List<String> address, Collection<RegionModel> regions) {
for (RegionModel item : regions) {
//添加自己的
address.add(name+" "+item.getRegionName() + "@" + item.getSequenceNbr());
if(item.getChildren() != null && item.getChildren().size() > 0) {
setAddress(name+" "+item.getRegionName() ,address,item.getChildren());
address.add(name + " " + item.getRegionName() + "@" + item.getSequenceNbr());
if (item.getChildren() != null && item.getChildren().size() > 0) {
setAddress(name + " " + item.getRegionName(), address, item.getChildren());
}
}
......@@ -405,6 +394,7 @@ public class DataSourcesImpl implements DataSources {
/**
* 获取设施分类// BUG 2935 优化项 分类从93060000 取得字典数据 by kongfm 2021-09-17
*
* @return
*/
private String[] getEquipCategory() {
......@@ -421,20 +411,20 @@ public class DataSourcesImpl implements DataSources {
List<LinkedHashMap<String, Object>> waterList = Lists.newArrayList();
List<LinkedHashMap<String, Object>> category = Lists.newArrayList();
List<String> resultList = Lists.newArrayList();
for(LinkedHashMap<String, Object> t :categoryList) {
if(categoryCode.equals(t.get("code").toString())){
for (LinkedHashMap<String, Object> t : categoryList) {
if (categoryCode.equals(t.get("code").toString())) {
fireList = (List<LinkedHashMap<String, Object>>) t.get("children");
}
}
// 筛选第二层
for(LinkedHashMap<String, Object> t : fireList) {
if(fireCode.equals(t.get("code").toString())){
for (LinkedHashMap<String, Object> t : fireList) {
if (fireCode.equals(t.get("code").toString())) {
waterList = (List<LinkedHashMap<String, Object>>) t.get("children");
}
}
// 筛选第三层
for(LinkedHashMap<String, Object> t : waterList) {
if(waterCode.equals(t.get("code").toString())){
for (LinkedHashMap<String, Object> t : waterList) {
if (waterCode.equals(t.get("code").toString())) {
category = (List<LinkedHashMap<String, Object>>) t.get("children");
}
}
......@@ -454,9 +444,9 @@ public class DataSourcesImpl implements DataSources {
List<String> resultList = Lists.newArrayList();
if(categoryList!=null&&categoryList.size()>0){
if (categoryList != null && categoryList.size() > 0) {
categoryList.forEach(t -> {
resultList.add(t.get("name") + "@" + t.get("id")+ "@" +t.get("categoryId")+ "@" +t.get("unitName"));
resultList.add(t.get("name") + "@" + t.get("id") + "@" + t.get("categoryId") + "@" + t.get("unitName"));
});
str = resultList.toArray(new String[resultList.size()]);
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -31,32 +7,19 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.dto.FireBrigadeResourceDto;
import com.yeejoin.amos.boot.module.common.api.entity.DutyShift;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.DutyPersonShiftMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.DutyShiftMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.DynamicFormInstanceMapper;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DutyCarServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FireTeamServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo;
import com.yeejoin.amos.boot.module.jcs.api.dto.CarStatusInfoDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.ControllerDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerCarCountDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerCompanyCountDto;
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;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferResourceDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferSimpleDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.ResourceStatisticsDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.entity.Controller;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransfer;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompany;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompanyResources;
import com.yeejoin.amos.boot.module.jcs.api.entity.Template;
import com.yeejoin.amos.boot.module.jcs.api.dto.*;
import com.yeejoin.amos.boot.module.jcs.api.entity.*;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertFeedbackStatusEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.DutyInfoEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.FireBrigadeTypeEnum;
......@@ -64,6 +27,24 @@ import com.yeejoin.amos.boot.module.jcs.api.enums.FireCarStatusEnum;
import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.IPowerTransferService;
import com.yeejoin.amos.component.rule.config.RuleConfig;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*;
import java.util.stream.Collectors;
/**
* 力量调派 服务实现类
......@@ -109,6 +90,9 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
@Autowired
private EmqKeeper emqKeeper;
@Autowired
DutyPersonShiftMapper dutyPersonShiftMapper;
@Value("${mqtt.topic.command.power.deployment}")
private String topic;
......@@ -128,7 +112,7 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
ControllerServiceImpl controllerServiceImpl;
@Autowired
private AircraftServiceImpl aircraftServiceImpl;
private DutyShiftMapper dutyShiftMapper;
@Override
public PowerTransferSimpleDto getPowerTransferList(Long alertCalledId) {
......@@ -295,11 +279,103 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
}
if (fireCarDto.getId() != null) {
List<Map<String, String>> resultList = new ArrayList<>();
String dutyDay = DateUtils.getDateNowShortStr();
Map<String, Object> instanceMap = dutyPersonShiftMapper.getInstanceIdForSpecifyDateAndEquipment(dutyDay,
"dutyCar", fireCarDto.getId());
if (instanceMap != null) {
String instanceId = instanceMap.get("instanceIds").toString();
if (StringUtils.isNotBlank(instanceId)) {
String[] instanceIds = instanceId.split(",");
List<Map<String, Object>> dutyList = dutyPersonShiftMapper.getDutyForSpecifyDate(dutyDay);
if (dutyList != null && dutyList.size() > 0) {
for (Map<String, Object> dutyDetail : dutyList) {
if (!dutyDetail.containsKey("name")) {
continue;
}
// 获取当前装备ID下的排版数据
List<Map<String, Object>> specifyDateList = dutyPersonShiftMapper.getPositionStaffDutyForSpecifyDate(dutyDay,
"dutyCar", instanceIds, dutyDetail.get("name").toString());
if (specifyDateList == null || specifyDateList.size() < 1 || specifyDateList.get(0) == null) {
continue;
}
LinkedHashMap<String, String> infoMap_1 = new LinkedHashMap<String, String>();
for (Map<String, Object> specify : specifyDateList) {
//
if (specify.containsKey("userName") && specify.get("userName") != null) {
if (specify.get("userName").toString().contains(",")) {
String[] userNames = specify.get("userName").toString().split(",");
infoMap_1.put(dutyDetail.get("name").toString(), userNames.length + "");
} else {
infoMap_1.put(dutyDetail.get("name").toString(), "1");
}
resultList.add(infoMap_1);
}
}
}
}
}
}
int num = 0;
num = iDutyCarService.getDutyCarCount(Long.valueOf(fireCarDto.getId()));
String todayTime = DateUtils.getDateNowShortStr();
String beginDate = todayTime;
beginDate = beginDate + " 00:00:00";
String endDate = todayTime;
endDate = endDate + " 23:59:59";
LambdaQueryWrapper<DutyShift> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BaseEntity::getIsDelete, false);
List<DutyShift> dutyShifts = dutyShiftMapper.selectList(wrapper);
String[] dutyShiftName = {" "};
dutyShifts.forEach(e -> {
String startTime = e.getStartTime();
Date startDate = null;
Date dateEnd = null;
if (startTime.startsWith("当日:")) {
String resultTime = startTime.replace("当日:", todayTime) + ":00";
startDate = DateUtils.longStr2Date(resultTime);
} else if (startTime.startsWith("次日:")) {
Date dateNow = DateUtils.getDateNow();
Date date = DateUtils.dateAddDays(dateNow, 1);
String s = DateUtils.convertDateToString(date, DateUtils.DATE_PATTERN);
String resultTime = startTime.replace("次日:", s) + ":00";
startDate = DateUtils.longStr2Date(resultTime);
}
String endTime = e.getEndTime();
if (endTime.startsWith("当日:")) {
String resultTime = endTime.replace("当日:", todayTime) + ":00";
dateEnd = DateUtils.longStr2Date(resultTime);
} else if (endTime.startsWith("次日:")) {
Date dateNow = DateUtils.getDateNow();
Date date = DateUtils.dateAddDays(dateNow, 1);
String s = DateUtils.convertDateToString(date, DateUtils.DATE_PATTERN);
String resultTime = endTime.replace("次日:", s) + ":00";
dateEnd = DateUtils.longStr2Date(resultTime);
}
if (DateUtils.belongCalendar(DateUtils.getDateNow(), startDate, dateEnd)) {
dutyShiftName[0] = dutyShiftName[0].replace(" ", e.getName());
}
});
if (resultList != null) {
resultList.forEach(e -> {
if (e.containsKey(dutyShiftName[0])) {
String personNum = e.get(dutyShiftName[0]);
fireCarDto.setPersonCount(Integer.valueOf(personNum));
}
});
} else {
fireCarDto.setPersonCount(num);
}
}
fireCarDtoList.add(fireCarDto);
});
}
......
......@@ -126,10 +126,10 @@ public class RuleAlertCalledService {
}
//航空器救援
if (alertFormValue.getFieldCode().equals("flightNumber")) {
alertCalledRo.setFlightNumber(alertFormValue.getFieldValueCode());
alertCalledRo.setFlightNumber(ValidationUtil.isEmpty(alertFormValue.getFieldValueCode()) ? alertFormValue.getFieldValue() : alertFormValue.getFieldValueCode());
}
if (alertFormValue.getFieldCode().equals("aircraftModel")) {
alertCalledRo.setAircraftModel(alertFormValue.getFieldValueCode());
alertCalledRo.setAircraftModel(ValidationUtil.isEmpty(alertFormValue.getFieldValueCode()) ? alertFormValue.getFieldValue() : alertFormValue.getFieldValueCode());
}
if (alertFormValue.getFieldCode().equals("landingTime")) {
alertCalledRo.setLandingTime(alertFormValue.getFieldValue());
......@@ -160,7 +160,7 @@ public class RuleAlertCalledService {
//漏油现场安全保障
if (alertFormValue.getFieldCode().equals("flightNumber")) {
alertCalledRo.setFlightNumberLy(alertFormValue.getFieldValue());
alertCalledRo.setFlightNumberLy(ValidationUtil.isEmpty(alertFormValue.getFieldValueCode()) ? alertFormValue.getFieldValue() : alertFormValue.getFieldValueCode());
}
if (alertFormValue.getFieldCode().equals("seat")) {
alertCalledRo.setSeat(alertFormValue.getFieldValue());
......
......@@ -1312,7 +1312,8 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
return executeSubmitDto;
}
AgencyUserModel checkLeader = jcsFeignClient.getAmosIdByUserId(param.getReformLeaderId()).getResult();
JSONObject reformJson = new JSONObject();
JSONObject reformJson = ValidationUtil.isEmpty(latentDanger.getReformJson()) ? new JSONObject() :
latentDanger.getReformJson();
reformJson.put("reformLeaderId", param.getReformLeaderId());
latentDanger.setReformJson(reformJson);
Object result = workflowExecuteService.setTaskAssign(processInstanceId, checkLeader.getUserName());
......@@ -1916,10 +1917,11 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
pageParam.put("leadPeopleId", jcsUserId);
// 登录人为整改责任人
pageParam.put("reformLeaderId", jcsUserId);
// 登录人单位
pageParam.put("bizOrgCode", person.get("bizOrgCode").toString().substring(0, 6));
}
}
Page page = new Page(pageParam.getParamPageCurrent(), pageParam.getParamPageSize());
IPage<LatentDanger> iPage = this.baseMapper.selectPageByParam(page, (Map<String, Object>) pageParam);
if (iPage.getCurrent() != pageParam.getParamPageCurrent()) {
......@@ -1937,7 +1939,8 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
}
} catch (Exception e) {
}
Map<String, Object> finalBuildingAbsolutePositionMap = buildingAbsolutePositionMap;
Map<String, Object> finalBuildingAbsolutePositionMap =
ValidationUtil.isEmpty(buildingAbsolutePositionMap) ? new HashMap<>() : buildingAbsolutePositionMap;
iPage.getRecords().forEach(danger -> {
if (!ValidationUtil.isEmpty(danger.getStructureId()) && !ValidationUtil.isEmpty(finalBuildingAbsolutePositionMap.get(danger.getStructureId().toString()))) {
danger.setStructureName(finalBuildingAbsolutePositionMap.get(danger.getStructureId().toString()).toString());
......
......@@ -9,6 +9,8 @@ import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
......@@ -25,6 +27,8 @@ import java.util.List;
@Component
public class EnumFillAop {
private static final Logger logger = LoggerFactory.getLogger(EnumFillAop.class);
@Autowired
RedisUtils redisUtils;
......@@ -39,20 +43,28 @@ public class EnumFillAop {
@Before("fillEnum()")
public void doBefore(JoinPoint joinPoint) {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
// 获取隐患等级枚举
synchronized (this) {
// 获取隐患等级枚举
if (ValidationUtil.isEmpty(LatentDangerLevelEnum.supervisionDangerLevelEnumMap)) {
try {
List<DictionarieValueModel> dicResult =
Systemctl.dictionarieClient.dictValues(bizType + LatentDangerLevelEnum.dictCode).getResult();
dicResult.forEach(dic -> LatentDangerLevelEnum.addEnumDynamic(dic.getDictDataDesc(), dic.getDictDataValue(), dic.getDictDataKey(),
"", dic.getOrderNum()));
} catch (Exception e) {
logger.debug(e.getMessage());
}
}
// 获取治理方式枚举
try {
if (ValidationUtil.isEmpty(LatentDangerReformTypeEnum.supervisionReformTypeEnumMap)) {
List<DictionarieValueModel> dicResult =
Systemctl.dictionarieClient.dictValues(bizType + LatentDangerReformTypeEnum.dictCode).getResult();
dicResult.forEach(dic -> LatentDangerReformTypeEnum.addEnumDynamic(dic.getDictDataDesc(), dic.getDictDataValue(), dic.getDictDataKey()));
}
} catch (Exception e) {
logger.debug(e.getMessage());
}
}
// 获取治理状态枚举
// if (ValidationUtil.isEmpty(LatentDangerStateEnum.enumMap)) {
......
......@@ -81,6 +81,7 @@ public class AsyncTask {
if (pointName != null) {
body += "关联检查点:" + pointName + TAB;
}
body = body.replaceAll(null, "").replaceAll("null", "");
saveAndSendMsg(orgCode, informerList, msgTypeEnum.getTitle(), body, msgTypeEnum.getMsgType(), latentDangerId, state, "");
}
......
......@@ -184,6 +184,7 @@ public class AsyncTask {
if (pointName != null) {
body += "关联检查点:" + pointName + TAB;
}
body = body.replaceAll(null, "").replaceAll("null", "");
saveAndSendMsg(orgCode, informerList, msgTypeEnum.getTitle(), body, msgTypeEnum.getMsgType(), latentDangerId, state,"");
}
......
......@@ -7,7 +7,6 @@ import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.gson.JsonObject;
import com.yeejoin.amos.boot.biz.common.bo.DepartmentBo;
import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.boot.biz.common.service.impl.WorkflowExcuteServiceImpl;
......@@ -328,7 +327,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
riskSourceId = Long.parseLong(inputCheckDto.getRiskSourceId());
}
LatentDangerBo latentDangerBo = saveLatentDanger("", param.getRemark(), remark, userId, departmentId,
LatentDangerBo latentDangerBo = saveLatentDanger("", "", remark, userId, departmentId,
businessKey, orgCode, dangerName, levelEnum.getCode(),
null, dangerTypeEnum, photoUrls, inputCheckDto.getCheckInputId(), riskSourceId,
position.get(inputCheckDto.getRiskSourceId())==null?"":position.get(inputCheckDto.getRiskSourceId()).toString(), InstanceKeyEnum.PATROL.getCode());
......@@ -559,11 +558,17 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
}
@Override
public CommonResponse list(String toke, String product, String appKey, LatentDangerListParam latentDangerListParam, AgencyUserModel user, String loginOrgCode, String deptId) {
public CommonResponse list(String toke,
String product,
String appKey,
LatentDangerListParam latentDangerListParam,
AgencyUserModel user,
String loginOrgCode,
String deptId) {
JSONObject respBody;
Date startDate = new Date();
if (latentDangerListParam.getIsHandle()) {
respBody = remoteWorkFlowService.completedPageTask(user.getRealName(),latentDangerListParam.getBelongType());
respBody = remoteWorkFlowService.completedPageTask(user.getUserName(),latentDangerListParam.getBelongType());
} else {
respBody = remoteWorkFlowService.pageTask(user.getUserId(),latentDangerListParam.getBelongType());
}
......@@ -1234,7 +1239,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
executeParam.getFlowJson(), executeParam.getDangerId(), role, executeTypeEnum.getName(),executeParam.getRemark());
} else {
if (executeTypeEnum.equals(LatentDangerExcuteTypeEnum.隐患评审通过)) {
// 将定的治理人保存在日志记录
// 将定的治理人保存在日志记录
executeParam.getFlowJson().put("governUserId", governUserId);
}
LatentDangerFlowRecordBo flowRecord = saveFlowRecord(executeJson.getString("id"), data.getString("name"), userId, departmentId,
......@@ -1243,9 +1248,16 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
latentDangerBo.setDangerState(executeTypeEnum.getNextState().getCode().toString());
if (executeTypeEnum.equals(LatentDangerExcuteTypeEnum.隐患常规治理)) {
latentDangerBo.setReformType(LatentDangerReformTypeEnum.常规整改.getCode().toString());
latentDangerBo.setReformJson(executeParam.getFlowJson().toJSONString());
JSONObject reformJsonObj = JSONObject.parseObject(latentDangerBo.getReformJson());
if (ValidationUtil.isEmpty(reformJsonObj)) {
reformJsonObj = executeParam.getFlowJson();
} else {
reformJsonObj.putAll(executeParam.getFlowJson());
}
latentDangerBo.setReformJson(reformJsonObj.toJSONString());
latentDangerBo.setInferOtherThings(executeParam.getInferOtherThings());
latentDangerBo.setProblemDescription(executeParam.getRemark());
latentDangerBo.setProblemDescription(ValidationUtil.isEmpty(executeParam.getProblemDescription()) ?
executeParam.getRemark() : executeParam.getProblemDescription());
latentDangerBo.setReasonAnalysis(executeParam.getReasonAnalysis());
} else if (executeTypeEnum.equals(LatentDangerExcuteTypeEnum.隐患延期治理)) {
latentDangerBo.setReformType(LatentDangerReformTypeEnum.延期治理.getCode().toString());
......@@ -1258,10 +1270,22 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
if (executeTypeEnum.equals(LatentDangerExcuteTypeEnum.隐患评审通过)) {
latentDangerBo.setReformLimitDate(DateUtil.str2Date(executeParam.getReformLimitDate(), DateUtil.DATETIME_DEFAULT_FORMAT));
latentDangerBo.setDangerLevel(executeParam.getDangerLevel().toString());
// JSONObject reformJsonObject = JSONObject.parseObject(latentDangerBo.getReformJson());
JSONObject reformJsonObject = executeParam.getFlowJson();
if (ValidationUtil.isEmpty(reformJsonObject)) {
reformJsonObject = new JSONObject();
}
reformJsonObject.put("governUserId", governUserId);
latentDangerBo.setReformJson(reformJsonObject.toJSONString());
// 消防巡查需求:评审通过后定治理人
// 消防巡查需求:评审通过后定治理人
// 2.指定治理执行人
workflowExecuteService.setTaskAssign(latentDangerBo.getInstanceId(), governUserId);
Object result = workflowExecuteService.setTaskAssign(latentDangerBo.getInstanceId(), governUserId);
if (!(Boolean) result) {
executeSubmitDto.setIsOk(false);
executeSubmitDto.setMsg("设置治理行人失败");
return executeSubmitDto;
}
}
}
if (executeTypeEnum.equals(LatentDangerExcuteTypeEnum.隐患延期治理车间部门审核通过)) {
......@@ -1269,6 +1293,10 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
if (executeParam.getNeedCompanyVerify() == 0) {
latentDangerBo.setDangerState(LatentDangerStateEnum.延期治理申请.getCode().toString());
latentDangerBo.setReformLimitDate(latentDangerBo.getDelayLimitDate());
if (!assignGovernUser(latentDangerBo, executeSubmitDto)) {
return executeSubmitDto;
}
} else {// 延期治理评审通过且 需要 公司审核
latentDangerBo.setDangerState(LatentDangerStateEnum.延期治理申请待公司审核.getCode().toString());
LatentDangerFlowRecordBo recordBo =
......@@ -1283,15 +1311,16 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
|| LatentDangerExcuteTypeEnum.隐患延期治理公司审核拒绝.equals(executeTypeEnum)
|| LatentDangerExcuteTypeEnum.隐患验证拒绝.equals(executeTypeEnum)) {
latentDangerBo.setDangerState(LatentDangerStateEnum.待治理.getCode().toString());
// 获取第一次评审时选择的治理人
LatentDangerFlowRecordBo record = latentDangerFlowRecordMapper.getByDangerIdAndActionFlag(latentDangerBo.getId(), "隐患评审");
JSONObject recordObj = JSONObject.parseObject(record.getFlowJson());
if (!ValidationUtil.isEmpty(recordObj.get("governUserId"))) {
workflowExecuteService.setTaskAssign(latentDangerBo.getInstanceId(), (String) recordObj.get("governUserId"));
if (!assignGovernUser(latentDangerBo, executeSubmitDto)) {
return executeSubmitDto;
}
} else if (executeTypeEnum.equals(LatentDangerExcuteTypeEnum.隐患延期治理公司审核通过)) {
latentDangerBo.setDangerState(LatentDangerStateEnum.延期治理申请.getCode().toString());
latentDangerBo.setReformLimitDate(latentDangerBo.getDelayLimitDate());
if (!assignGovernUser(latentDangerBo, executeSubmitDto)) {
return executeSubmitDto;
}
} /**else if (executeTypeEnum.equals(LatentDangerExcuteTypeEnum.隐患延期治理公司审核拒绝)) {
// TODO 待需求确认是回到部门审核还是回到隐患治理节点
latentDangerBo.setDangerState(LatentDangerStateEnum.延期治理申请待车间部门审核.getCode().toString());
......@@ -1310,6 +1339,29 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
return executeSubmitDto;
}
/**
* 设置治理人到流程执行节点(平台人员用户名)
*
* @param latentDangerBo
* @param executeSubmitDto
* @return
*/
public boolean assignGovernUser(LatentDangerBo latentDangerBo, DangerExecuteSubmitDto executeSubmitDto) {
// 获取最后一次评审时选择的治理人
LatentDangerFlowRecordBo record = latentDangerFlowRecordMapper.getByDangerIdAndActionFlag(latentDangerBo.getId(), "隐患评审");
JSONObject recordObj = JSONObject.parseObject(record.getFlowJson());
if (!ValidationUtil.isEmpty(recordObj.get("governUserId"))) {
Object result = workflowExecuteService.setTaskAssign(latentDangerBo.getInstanceId(),
(String) recordObj.get("governUserId"));
if (!(Boolean) result) {
executeSubmitDto.setIsOk(false);
executeSubmitDto.setMsg("指定治理人失败");
return false;
}
}
return true;
}
private void sendMessage(LatentDangerBo latentDangerBo, LatentDangerExcuteTypeEnum excuteTypeEnum,
LatentDangerPatrolBo patrolBo, String flowTaskName, String informerList,
String userRealName, String departmentName) {
......
......@@ -155,6 +155,7 @@ public class AsyncTask {
if (pointName != null) {
body += "关联检查点:" + pointName + TAB;
}
body = body.replaceAll(null, "").replaceAll("null", "");
saveAndSendMsg(orgCode, informerList, msgTypeEnum.getTitle(), body, msgTypeEnum.getMsgType(), latentDangerId, taskId, state,"");
}
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.supervision.business.dto;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author DELL
......@@ -84,4 +85,9 @@ public class HiddenDangerDto {
* 检查项名称
*/
private String inputItemName;
/**
* 隐患图片
*/
private List<String> photoUrl;
}
......@@ -45,4 +45,13 @@ public interface JCSFeignClient {
*/
@RequestMapping(value = "jcs/org-usr/amos/companyIds", method = RequestMethod.GET)
FeignClientResult<Map<String, Integer>> getDeptCountByCompanyIds(@RequestParam("companyIdList") List<String> companyIdList);
/**
* 根据机场单位id获取单位详情
*
* @param companyId 机场单位id
* @return
*/
@RequestMapping(value = "jcs/org-usr/getUnit/{id}", method = RequestMethod.GET)
FeignClientResult<Map<String, Object>> getCompanyById(@PathVariable("id") String companyId);
}
......@@ -22,6 +22,7 @@ import com.yeejoin.amos.supervision.business.dto.HiddenDangerExportDataDto;
import com.yeejoin.amos.supervision.business.dto.HiddenDangerImportDto;
import com.yeejoin.amos.supervision.business.dto.HiddenDangerTemplateDto;
import com.yeejoin.amos.supervision.business.feign.DangerFeignClient;
import com.yeejoin.amos.supervision.business.feign.JCSFeignClient;
import com.yeejoin.amos.supervision.business.service.intfc.IHiddenDangerService;
import com.yeejoin.amos.supervision.common.enums.CheckTypeSuEnum;
import com.yeejoin.amos.supervision.common.enums.DangerCheckTypeLevelEnum;
......@@ -38,6 +39,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.DataNotFound;
import javax.servlet.http.HttpServletResponse;
......@@ -87,6 +89,9 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
@Autowired
IPointDao iPointDao;
@Autowired
JCSFeignClient jcsFeignClient;
@Override
public List<HiddenDangerExportDataDto> listAll(String planId, Long pointId, String level, String status) {
//1.查询指定计划和公司的关联隐患数据
......@@ -283,12 +288,21 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
result.put("bizId", hiddenDangerDto.getCheckInputId());
result.put("bizName", hiddenDangerDto.getInputItemName());
result.put("routeId", plan.getRouteId());
result.put("accompanyingUserId", plan.getLeadPeopleIds());
result.put("accompanyingUserName", plan.getLeadPeopleNames());
result.put("accompanyingUserId", plan.getLeadPeopleIds()); // 检查陪同人id
result.put("accompanyingUserName", plan.getLeadPeopleNames()); // 检查陪同人名称
result.put("checkUnitId",plan.getCheckUnitId());
result.put("checkUnitName",plan.getCheckUnitName());
result.put("leadPeopleId", plan.getLeadPeopleIds());
result.put("leadPeopleName", plan.getLeadPeopleNames());
result.put("leadPeopleId", plan.getLeadPeopleIds()); // 牵头人id
result.put("leadPeopleName", plan.getLeadPeopleNames()); // 牵头人名称
result.put("makerUserId", plan.getMakerUserId()); // 计划制定人id
result.put("makerUserName", plan.getMakerUserName()); // 计划制定人名称
result.put("userId", plan.getUserId()); // 检查参与人id
result.put("userIdName", plan.getUserName()); // 检查参与人名称
// 将机场单位bizOrgCode保存起来用于按机场单位数据过滤
FeignClientResult<Map<String, Object>> companyResult = jcsFeignClient.getCompanyById(point.getOriginalId());
if (!ValidationUtil.isEmpty(companyResult)) {
result.put("bizOrgCode", companyResult.getResult().get("bizOrgCode"));
}
this.buildCheckInfo(result, hiddenDangerDto.getCheckInputId());
return result;
}
......
......@@ -1218,7 +1218,15 @@ public class PointServiceImpl implements IPointService {
}
List<DangerDto> dangerDtoList = listFeignClientResult.getResult();
if (!ObjectUtils.isEmpty(dangerDtoList)) {
collect = dangerDtoList.stream().collect(Collectors.groupingBy(DangerDto::getBizId, Collectors.toList()));
dangerDtoList.forEach(dangerDto -> {
List<String> photoUrl = Lists.newArrayList();
if (!ValidationUtil.isEmpty(dangerDto.getPhotoUrls())) {
photoUrl = Arrays.asList(dangerDto.getPhotoUrls().split(","));
}
dangerDto.setPhotoUrl(photoUrl);
});
collect = dangerDtoList.stream().collect(Collectors.groupingBy(DangerDto::getBizId,
Collectors.toList()));
}
}
......
......@@ -7,8 +7,10 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.MaintenanceUnitDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.entity.MaintenanceUnit;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentInformDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.Equipment;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentInform;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo;
import com.yeejoin.amos.boot.module.tzs.flc.api.enums.EquipmentStatusEnum;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
......@@ -302,4 +304,7 @@ public class BeanDtoVoUtils {
}
});
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EquipmentIndexInformServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentIndexInformDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
/**
* 设备指标
*
* @author system_generator
* @date 2021-12-29
*/
@RestController
@Api(tags = "设备指标Api")
@RequestMapping(value = "/equipment-index-inform")
public class EquipmentIndexInformController extends BaseController {
@Autowired
EquipmentIndexInformServiceImpl equipmentIndexInformServiceImpl;
/**
* 新增设备指标
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增设备指标", notes = "新增设备指标")
public ResponseModel<EquipmentIndexInformDto> save(@RequestBody EquipmentIndexInformDto model) {
model = equipmentIndexInformServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新设备指标", notes = "根据sequenceNbr更新设备指标")
public ResponseModel<EquipmentIndexInformDto> updateBySequenceNbrEquipmentIndexInform(@RequestBody EquipmentIndexInformDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(equipmentIndexInformServiceImpl.updateWithModel(model));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除设备指标", notes = "根据sequenceNbr删除设备指标")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(equipmentIndexInformServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个设备指标", notes = "根据sequenceNbr查询单个设备指标")
public ResponseModel<EquipmentIndexInformDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(equipmentIndexInformServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "设备指标分页查询", notes = "设备指标分页查询")
public ResponseModel<Page<EquipmentIndexInformDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<EquipmentIndexInformDto> page = new Page<EquipmentIndexInformDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(equipmentIndexInformServiceImpl.queryForEquipmentIndexInformPage(page));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "设备指标列表全部数据查询", notes = "设备指标列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<EquipmentIndexInformDto>> selectForList() {
return ResponseHelper.buildResponse(equipmentIndexInformServiceImpl.queryForEquipmentIndexInformList());
}
}
package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentInform;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
......@@ -55,44 +63,34 @@ public class EquipmentInformController extends BaseController {
}
/**
* 新增设备告知单
* 暂存新增设备告知单 有id 为更新无id 为新增
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增设备告知单", notes = "新增设备告知单")
@ApiOperation(httpMethod = "POST", value = "暂存新增设备告知单 有id 为更新无id 为新增", notes = "暂存新增设备告知单 有id 为更新无id 为新增")
public ResponseModel<EquipmentInformDto> save(@RequestBody EquipmentInformDto model) {
model = equipmentInformServiceImpl.createEquipmentInform(model);
model = equipmentInformServiceImpl.createEquipmentInform(model,getSelectedOrgInfo());
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新设备告知单", notes = "根据sequenceNbr更新设备告知单")
public ResponseModel<EquipmentInformDto> updateBySequenceNbrEquipmentInform(@RequestBody EquipmentInformDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(equipmentInformServiceImpl.updateWithModel(model));
}
/**
* 根据sequenceNbr删除
* 提交设备告知单
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除设备告知单", notes = "根据sequenceNbr删除设备告知单")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(equipmentInformServiceImpl.removeById(sequenceNbr));
@PostMapping(value = "/submit")
@ApiOperation(httpMethod = "POST", value = "提交设备告知单", notes = "提交设备告知单")
public ResponseModel<EquipmentInformDto> submit(@RequestBody EquipmentInformDto model) {
if (ValidationUtil.isEmpty(model.getSequenceNbr())) {
throw new BadRequest("参数校验失败.");
}
return ResponseHelper.buildResponse(equipmentInformServiceImpl.updateEquipmentInform(model,getSelectedOrgInfo()));
}
/**
* 根据sequenceNbr查询
......@@ -104,40 +102,171 @@ public class EquipmentInformController extends BaseController {
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个设备告知单", notes = "根据sequenceNbr查询单个设备告知单")
public ResponseModel<EquipmentInformDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(equipmentInformServiceImpl.queryBySeq(sequenceNbr));
return ResponseHelper.buildResponse(equipmentInformServiceImpl.queryDtoBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @param pageNum 当前页
* @param pageSize 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "设备告知单分页查询", notes = "设备告知单分页查询")
public ResponseModel<Page<EquipmentInformDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
@GetMapping(value = "/list")
@ApiOperation(httpMethod = "GET", value = "告知书列表查询", notes = "告知书列表查询")
public ResponseModel<Page<EquipmentInformDto>> queryForPage(@RequestParam(value = "pageNum") int pageNum, @RequestParam(value = "pageSize") int pageSize, String sort , EquipmentInformDto equipmentInformDto) {
Page<EquipmentInformDto> page = new Page<EquipmentInformDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(equipmentInformServiceImpl.queryForEquipmentInformPage(page));
page.setCurrent(pageNum);
page.setSize(pageSize);
String sortParam = "";
String sortRule = "";
if(sort!=null) { // 排序失效
String[] date= sort.split(",");
if(date[1].equals("ascend")) {
sortParam = RedisKey.humpToLine(date[0]);
sortRule = "asc";
}else {
sortParam =RedisKey.humpToLine(date[0]);
sortRule = "desc";
}
}else {
sortParam = "rec_date";
sortRule = "desc";
}
Page<EquipmentInformDto> pageBean = equipmentInformServiceImpl.queryDtoList(page,equipmentInformDto,sortParam,sortRule);
Page<EquipmentInformDto> result = new Page<EquipmentInformDto>(pageNum,pageSize);
long totle = pageBean.getTotal();
result.setRecords(pageBean.getRecords());
result.setTotal(totle);
return ResponseHelper.buildResponse(result);
}
/**
* 列表全部数据查询
* 根据sequenceNbr删除
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "设备告知单列表全部数据查询", notes = "设备告知单列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<EquipmentInformDto>> selectForList() {
return ResponseHelper.buildResponse(equipmentInformServiceImpl.queryForEquipmentInformList());
@DeleteMapping(value = "/delete_batch")
@ApiOperation(httpMethod = "DELETE", value = "批量删除告知书信息", notes = "批量删除告知书信息")
public ResponseModel<Boolean> deleteBySequenceNbr(@RequestParam(value = "sequenceNbrList") List<Long> sequenceNbrList){
return ResponseHelper.buildResponse(equipmentInformServiceImpl.batchDelete(sequenceNbrList));
}
/**
* 企业通过流程
* @param sequenceNbr
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/finishWorkflow/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "通过流程", notes = "测试通过流程")
public ResponseModel<Boolean> finishWorkflow(@PathVariable Long sequenceNbr) throws Exception{
return ResponseHelper.buildResponse(equipmentInformServiceImpl.acceptInform(sequenceNbr,getSelectedOrgInfo()));
}
/**
* 接收方驳回告知书
* @param sequenceNbr
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/dismissInform/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "接收方驳回告知书", notes = "接收方驳回告知书")
public ResponseModel<Boolean> dismissInform(@PathVariable Long sequenceNbr) throws Exception{
return ResponseHelper.buildResponse(equipmentInformServiceImpl.dismissInform(sequenceNbr,getSelectedOrgInfo()));
}
/**
* 企业撤回告知书
* @param sequenceNbr
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/withdrawInform/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "企业撤回告知书", notes = "企业撤回告知书")
public ResponseModel<Boolean> withdrawInform(@PathVariable Long sequenceNbr) throws Exception{
return ResponseHelper.buildResponse(equipmentInformServiceImpl.withdrawInform(sequenceNbr,getSelectedOrgInfo()));
}
/**
* 接收方移交告知书
* @param sequenceNbr
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/transferInform/{sequenceNbr}/{transferUnitId}")
@ApiOperation(httpMethod = "GET", value = "接收方移交告知书", notes = "接收方移交告知书")
public ResponseModel<Boolean> transferInform(@PathVariable Long sequenceNbr, @PathVariable Long transferUnitId) throws Exception{
return ResponseHelper.buildResponse(equipmentInformServiceImpl.transferInform(sequenceNbr,getSelectedOrgInfo(),transferUnitId));
}
/**
* 企业废弃告知书
* @param sequenceNbr
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/cancelInform/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "企业废弃告知书", notes = "企业废弃告知书")
public ResponseModel<Boolean> cancelInform(@PathVariable Long sequenceNbr) throws Exception{
return ResponseHelper.buildResponse(equipmentInformServiceImpl.cancelInform(sequenceNbr,getSelectedOrgInfo()));
}
/**
* 监管端撤回已经通过的申请
* @param sequenceNbr
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/callbackInform/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "监管端撤回已经通过的申请", notes = "监管端撤回已经通过的申请")
public ResponseModel<Boolean> callbackInform(@PathVariable Long sequenceNbr) throws Exception{
return ResponseHelper.buildResponse(equipmentInformServiceImpl.callbackInform(sequenceNbr));
}
/**
* 列表分页查询
*
* @param pageNum 当前页
* @param pageSize 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/subList")
@ApiOperation(httpMethod = "GET", value = "告知书列表查询-接收单位", notes = "告知书列表查询-接收单位")
public ResponseModel<Page<EquipmentInformDto>> subList(@RequestParam(value = "pageNum") int pageNum, @RequestParam(value = "pageSize") int pageSize, String sort , EquipmentInformDto equipmentInformDto) {
Page<EquipmentInformDto> page = new Page<EquipmentInformDto>();
page.setCurrent(pageNum);
page.setSize(pageSize);
String sortParam = "";
String sortRule = "";
if(sort!=null) { // 排序失效
String[] date= sort.split(",");
if(date[1].equals("ascend")) {
sortParam = RedisKey.humpToLine(date[0]);
sortRule = "asc";
}else {
sortParam =RedisKey.humpToLine(date[0]);
sortRule = "desc";
}
}else {
sortParam = "rec_date";
sortRule = "desc";
}
Page<EquipmentInformDto> pageBean = equipmentInformServiceImpl.queryDtoListSub(page,equipmentInformDto,sortParam,sortRule);
Page<EquipmentInformDto> result = new Page<EquipmentInformDto>(pageNum,pageSize);
long totle = pageBean.getTotal();
result.setRecords(pageBean.getRecords());
result.setTotal(totle);
return ResponseHelper.buildResponse(result);
}
}
package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.InformProcessInfoServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformProcessInfoDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
/**
* 通话记录附件
*
* @author system_generator
* @date 2021-12-27
*/
@RestController
@Api(tags = "通话记录附件Api")
@RequestMapping(value = "/inform-process-info")
public class InformProcessInfoController extends BaseController {
@Autowired
InformProcessInfoServiceImpl informProcessInfoServiceImpl;
/**
* 新增通话记录附件
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增通话记录附件", notes = "新增通话记录附件")
public ResponseModel<InformProcessInfoDto> save(@RequestBody InformProcessInfoDto model) {
model = informProcessInfoServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新通话记录附件", notes = "根据sequenceNbr更新通话记录附件")
public ResponseModel<InformProcessInfoDto> updateBySequenceNbrInformProcessInfo(@RequestBody InformProcessInfoDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(informProcessInfoServiceImpl.updateWithModel(model));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除通话记录附件", notes = "根据sequenceNbr删除通话记录附件")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(informProcessInfoServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个通话记录附件", notes = "根据sequenceNbr查询单个通话记录附件")
public ResponseModel<InformProcessInfoDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(informProcessInfoServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "通话记录附件分页查询", notes = "通话记录附件分页查询")
public ResponseModel<Page<InformProcessInfoDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<InformProcessInfoDto> page = new Page<InformProcessInfoDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(informProcessInfoServiceImpl.queryForInformProcessInfoPage(page));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "通话记录附件列表全部数据查询", notes = "通话记录附件列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<InformProcessInfoDto>> selectForList() {
return ResponseHelper.buildResponse(informProcessInfoServiceImpl.queryForInformProcessInfoList());
}
}
......@@ -10,6 +10,7 @@ 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.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.tzs.api.enums.TzsCommonParam;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TzsAuthServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoApproveDto;
......@@ -463,10 +464,22 @@ public class UnitInfoController extends BaseController {
* 获取使用单位列表
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getUseUnit")
@ApiOperation(httpMethod = "GET", value = "获取使用单位列表", notes = "获取使用单位列表")
public ResponseModel<List<UnitInfoDto>> getUseUnit() {
List<UnitInfoDto> result = unitInfoServiceImpl.getUseUnit();
@PostMapping(value = "/getUseUnit")
@ApiOperation(httpMethod = "POST", value = "获取使用单位列表", notes = "获取使用单位列表")
public ResponseModel<List<UnitInfoDto>> getUseUnit(@RequestBody UnitInfoDto model) {
List<UnitInfoDto> result = unitInfoServiceImpl.getUseUnit(model.getUnitType(),model.getAddress(),model.getOrgName(),model.getOrganizationCode());
return ResponseHelper.buildResponse(result);
}
/**
* 获取所有单位列表
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getAllUnit")
@ApiOperation(httpMethod = "GET", value = "获取所有单位列表", notes = "获取所有单位列表")
public ResponseModel<List<UnitInfoDto>> getAllUnit() {
List<UnitInfoDto> result = unitInfoServiceImpl.getAllUnit();
return ResponseHelper.buildResponse(result);
}
......
package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentIndexInform;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.EquipmentIndexInformMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.IEquipmentIndexInformService;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentIndexInformDto;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/**
* 设备指标服务实现类
*
* @author system_generator
* @date 2021-12-29
*/
@Service
public class EquipmentIndexInformServiceImpl extends BaseService<EquipmentIndexInformDto,EquipmentIndexInform,EquipmentIndexInformMapper> implements IEquipmentIndexInformService {
/**
* 分页查询
*/
public Page<EquipmentIndexInformDto> queryForEquipmentIndexInformPage(Page<EquipmentIndexInformDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<EquipmentIndexInformDto> queryForEquipmentIndexInformList() {
return this.queryForList("" , false);
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.enums.FailureStatuEnum;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.enums.InformWorkFlowEnum;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentIndexDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.Equipment;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentIndex;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentIndexInform;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentInform;
import com.yeejoin.amos.boot.module.tzs.flc.api.enums.EquipmentInformStatusEnum;
import com.yeejoin.amos.boot.module.tzs.flc.api.enums.EquipmentStatusEnum;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.EquipmentInformMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.IEquipmentIndexInformService;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.IEquipmentInformService;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentInformDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.IInformEquipmentService;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.IInformProcessInfoService;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
/**
* 设备告知单服务实现类
......@@ -44,6 +64,9 @@ public class EquipmentInformServiceImpl extends BaseService<EquipmentInformDto,E
@Autowired
SourceFileServiceImpl sourceFileService;
@Autowired
WorkflowFeignService workflowFeignService;
@Autowired
EquipmentServiceImpl equipmentServiceImpl;
......@@ -57,6 +80,17 @@ public class EquipmentInformServiceImpl extends BaseService<EquipmentInformDto,E
@Autowired
InformEquipmentServiceImpl informEquipmentServiceImpl;
@Value("${inform.work.flow.processDefinitionKey}")
private String processDefinitionKey;
@Autowired
IInformProcessInfoService iInformProcessInfoService;
@Autowired
EquipmentIndexInformServiceImpl iEquipmentIndexInformService;
/**
* 分页查询
*/
......@@ -72,7 +106,9 @@ public class EquipmentInformServiceImpl extends BaseService<EquipmentInformDto,E
}
@Override
public EquipmentInformDto createEquipmentInform(EquipmentInformDto model) {
public EquipmentInformDto createEquipmentInform(EquipmentInformDto model, ReginParams userInfo) {
model.setInformStatus(EquipmentInformStatusEnum.暂存.getCode());
if(model.getSequenceNbr() == null) { // 新增
// 获取用户所在单位 保存施工单位所属信息
OrgUsr myUnit = null;
AgencyUserModel user = Privilege.agencyUserClient.getme().getResult();
......@@ -83,26 +119,371 @@ public class EquipmentInformServiceImpl extends BaseService<EquipmentInformDto,E
if(myUnit == null) {
throw new BadRequest("该用户非施工单位人员无法创建告知单");
}
// 判断是暂存还是提交
if(EquipmentInformStatusEnum.未接收.getCode().equals(model.getInformStatus())) { // 提交判断日期
model.setProductInformDate(new Date());
model.setProductUnitId(myUnit.getSequenceNbr());
model.setProductUnit(myUnit.getBizOrgName());
model = this.createWithModel(model);
} else {
model = this.updateWithModel(model);
}
saveSourceFile(model);
return model;
}
@Override
public Page<EquipmentInformDto> queryDtoList(Page<EquipmentInformDto> page, EquipmentInformDto equipmentInformDto, String sortParam, String sortRule) {
AgencyUserModel user = Privilege.agencyUserClient.getme().getResult();
List<CompanyModel> companys = user.getCompanys();
Long cpmpanyId = -1l;
for(CompanyModel c : companys) {
cpmpanyId = iOrgUsrService.getOne(new LambdaQueryWrapper<OrgUsr>().eq(OrgUsr::getIsDelete,false).eq(OrgUsr::getAmosOrgId,c.getSequenceNbr())).getSequenceNbr();
}
if(cpmpanyId == -1l) {
throw new BadRequest("未找到登陆人所在企业");
}
Page<List<EquipmentInformDto>>list = baseMapper.queryDtoList(page,equipmentInformDto.getProductCode(),equipmentInformDto.getProductInformDateStart(),equipmentInformDto.getProductInformDateEnd(),
equipmentInformDto.getProductUnitId(),equipmentInformDto.getRegionCode(),equipmentInformDto.getAddress(),equipmentInformDto.getPlanProductDateStart(),equipmentInformDto.getPlanProductDateEnd(),
equipmentInformDto.getAcceptUnitId(),equipmentInformDto.getInformStatus(),sortParam,sortRule,cpmpanyId);
Page<EquipmentInformDto> page1 = new Page<>();
List<EquipmentInformDto> resultDtoList = JSONArray.parseArray(JSONArray.toJSONString(list.getRecords()),EquipmentInformDto.class);
page1.setCurrent(page.getCurrent());
page1.setSize(page.getSize());
page1.setTotal(list.getTotal());
page1.setRecords(resultDtoList);
return page1;
}
@Override
public Page<EquipmentInformDto> queryDtoListSub(Page<EquipmentInformDto> page, EquipmentInformDto equipmentInformDto, String sortParam, String sortRule) {
AgencyUserModel user = Privilege.agencyUserClient.getme().getResult();
List<CompanyModel> companys = user.getCompanys();
Long cpmpanyId = -1l;
for(CompanyModel c : companys) {
cpmpanyId = c.getSequenceNbr();
}
if(cpmpanyId == -1l) {
throw new BadRequest("未找到登陆人所在企业");
}
Page<List<EquipmentInformDto>>list = baseMapper.queryDtoListSub(page,equipmentInformDto.getProductCode(),equipmentInformDto.getProductInformDateStart(),equipmentInformDto.getProductInformDateEnd(),
equipmentInformDto.getProductUnitId(),equipmentInformDto.getRegionCode(),equipmentInformDto.getAddress(),equipmentInformDto.getPlanProductDateStart(),equipmentInformDto.getPlanProductDateEnd(),
equipmentInformDto.getAcceptUnitId(),equipmentInformDto.getInformStatus(),sortParam,sortRule,cpmpanyId);
Page<EquipmentInformDto> page1 = new Page<>();
List<EquipmentInformDto> resultDtoList = JSONArray.parseArray(JSONArray.toJSONString(list.getRecords()),EquipmentInformDto.class);
page1.setCurrent(page.getCurrent());
page1.setSize(page.getSize());
page1.setTotal(list.getTotal());
page1.setRecords(resultDtoList);
return page1;
}
@Transactional
@Override
public Boolean batchDelete(List<Long> sequenceNbrList) {
for(Long sequenceNbr : sequenceNbrList) {
if(! this.update(new LambdaUpdateWrapper<EquipmentInform>().eq(EquipmentInform::getSequenceNbr,sequenceNbr).set(EquipmentInform::getIsDelete,true))) {
throw new BadRequest("删除" + sequenceNbr +"告知书失败");
}
}
return true;
}
/**
* 根据informId 接收告知书
* @param sequenceNbr
* @return
*/
@Transactional
@Override
public Boolean acceptInform(Long sequenceNbr) {
// 接收告知书 更新告知书状态
Boolean flag = false;
flag = this.update(new LambdaUpdateWrapper<EquipmentInform>().eq(EquipmentInform::getSequenceNbr,sequenceNbr).set(EquipmentInform::getInformStatus,"9"));
if(flag) {
// 更新设备相关参数
List<InformEquipmentDto> equipmentList = informEquipmentServiceImpl.getEquipListByInformId(sequenceNbr);
equipmentList.stream().forEach(t -> {
// 更新设备信息
Equipment sourceEquip = equipmentServiceImpl.getById(t.getSourceEquipmentId() );
BeanUtils.copyProperties(t,sourceEquip);
sourceEquip.setSequenceNbr(t.getSourceEquipmentId());
equipmentServiceImpl.updateById(sourceEquip);
// 获取设备附件信息 保存附件信息
// 原附件信息
Map<String, List<AttachmentDto>> sourceAttach = sourceFileService.getAttachments(t.getSequenceNbr());
for( Map.Entry<String, List<AttachmentDto>> m :sourceAttach.entrySet()) {
List<AttachmentDto> tempList = m.getValue();
tempList.stream().forEach(l -> {
l.setSequenceNbr(null);
});
}
if(sourceAttach != null) {
sourceFileService.saveAttachments(t.getSourceEquipmentId() , sourceAttach);
}
// 先删除备份保存的参数信息再保存新参数信息
iEquipmentIndexInformService.remove(new LambdaQueryWrapper<EquipmentIndexInform>().eq(EquipmentIndexInform::getEquipmentId,sourceEquip.getSequenceNbr()));
// 备份参数
List<EquipmentIndex> indexList = equipmentIndexServiceImpl.list(new LambdaQueryWrapper<EquipmentIndex>().eq(EquipmentIndex::getEquipmentId,sourceEquip.getSequenceNbr()));
indexList.stream().forEach(i -> {
EquipmentIndexInform tempIndex = new EquipmentIndexInform();
BeanUtils.copyProperties(i,tempIndex);
tempIndex.setSequenceNbr(null);
iEquipmentIndexInformService.save(tempIndex);
equipmentIndexServiceImpl.removeById(i);
});
// 保存设备参数信息
List<EquipmentIndexDto> equipmentIndex = t.getEquipmentIndex();
if(equipmentIndex != null && equipmentIndex.size()>0) {
for(EquipmentIndexDto index : equipmentIndex) {
index.setEquipmentId(sourceEquip.getSequenceNbr());
index.setEquipmentName(sourceEquip.getName());
index.setSequenceNbr(null);
equipmentIndexServiceImpl.createWithModel(index);
}
}
});
}
return flag;
}
@Transactional
@Override
public EquipmentInformDto updateEquipmentInform(EquipmentInformDto model, ReginParams userInfo) {
if(model.getPlanProductDate() == null) {
throw new BadRequest("未填写计划施工日期");
}
if(( model.getPlanProductDate().getTime() - System.currentTimeMillis() ) < 3*24*60*60*1000 ) {
throw new BadRequest("计划施工日期比现在时间至少提前3天");
}
this.updateWithModel(model);
saveSourceFile(model);
EquipmentInform inform = this.getById(model.getSequenceNbr());
String informStatus = inform.getInformStatus();
if(EquipmentInformStatusEnum.已驳回.getCode().equals(informStatus)) { // 已驳回重新提交
try {
this.startWorkflow(model.getSequenceNbr(),userInfo);
} catch (Exception e) {
e.printStackTrace();
}
} else {
String processStatus = inform.getProcessStatus();
if(StringUtils.isEmpty(processStatus)) {
try {
this.startWorkflow(model.getSequenceNbr(),userInfo);
} catch (Exception e) {
e.printStackTrace();
}
} else if(processStatus.equals(InformWorkFlowEnum.企业撤回告知书.getProcessStatus()) || processStatus.equals(InformWorkFlowEnum.接收方驳回告知书.getProcessStatus())) {
try {
this.reSubmit(model.getSequenceNbr(),userInfo);
} catch (Exception e) {
e.printStackTrace();
}
}
}
return model;
}
model.setProductInformDate(new Date());
@Override
public EquipmentInformDto queryDtoBySeq(Long sequenceNbr) {
EquipmentInformDto result = this.queryBySeq(sequenceNbr);
// 封装附件
Map attachment = sourceFileService.getAttachments(sequenceNbr);
result.setAttachments(attachment);
return result;
}
model.setProductUnitId(myUnit.getSequenceNbr());
model.setProductUnit(myUnit.getBizOrgName());
model = this.createWithModel(model);
saveSourceFile(model);
return model;
@Override
@Transactional
public Boolean startWorkflow(Long sequenceNbr, ReginParams userInfo) throws Exception {
EquipmentInformDto model = this.queryBySeq(sequenceNbr);
String businessKey = buildOrderNo();
JSONObject body = new JSONObject();
body.put("businessKey", businessKey);
body.put("processDefinitionKey", processDefinitionKey);
JSONObject jsonObject = workflowFeignService.startByVariable(body);
if (jsonObject == null) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
JSONObject instance = jsonObject.getJSONObject("data");
if (instance == null) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
// 启动流程 后更新状态和流程ID
// 拿到流程processId
model.setProcessId(instance.getString("id"));
InformWorkFlowEnum submit = InformWorkFlowEnum.企业提交审批;
model.setProcessStatus(submit.getProcessStatus());
// 其他操作
// 流程流转
if (excuteTask(model, userInfo,submit)) {
model.setInformStatus(EquipmentInformStatusEnum.未接收.getCode());
this.updateWithModel(model);
return true;
} else {
throw new Exception("执行流程失败");
}
}
@Override
@Transactional
public Boolean acceptInform(Long sequenceNbr, ReginParams userInfo) throws Exception {
EquipmentInformDto model = this.queryBySeq(sequenceNbr);
model.setInformStatus("9");
InformWorkFlowEnum submit = InformWorkFlowEnum.接收方接收告知书;
model.setProcessStatus(submit.getProcessStatus());
// 流程流转
if (excuteTask(model, userInfo,submit)) {
model.setInformStatus(EquipmentInformStatusEnum.已接收.getCode());
this.updateWithModel(model);
this.acceptInform(sequenceNbr);
return true;
} else {
throw new Exception("执行流程失败");
}
}
@Override
@Transactional
public Boolean transferInform(Long sequenceNbr, ReginParams userInfo, Long transferUnitId) throws Exception {
EquipmentInformDto model = this.queryBySeq(sequenceNbr);
// company
CompanyModel companyInfo = Privilege.companyClient.seleteOne(transferUnitId).getResult();
if(companyInfo!= null) {
model.setAcceptUnit(companyInfo.getCompanyName());
model.setAcceptUnitId(transferUnitId);
}
InformWorkFlowEnum submit = InformWorkFlowEnum.接收方移交告知书;
model.setProcessStatus(submit.getProcessStatus());
// 流程流转
if (excuteTask(model, userInfo,submit)) {
this.updateWithModel(model);
return true;
} else {
throw new Exception("执行流程失败");
}
}
@Override
@Transactional
public Boolean withdrawInform(Long sequenceNbr, ReginParams userInfo) throws Exception {
EquipmentInformDto model = this.queryBySeq(sequenceNbr);
InformWorkFlowEnum submit = InformWorkFlowEnum.企业撤回告知书;
model.setProcessStatus(submit.getProcessStatus());
// 流程流转
if (excuteTask(model, userInfo,submit)) {
this.updateWithModel(model);
return true;
} else {
throw new Exception("执行流程失败");
}
}
@Override
@Transactional
public Boolean dismissInform(Long sequenceNbr, ReginParams userInfo) throws Exception {
EquipmentInformDto model = this.queryBySeq(sequenceNbr);
InformWorkFlowEnum submit = InformWorkFlowEnum.接收方驳回告知书;
model.setProcessStatus(submit.getProcessStatus());
// 流程流转
if (excuteTask(model, userInfo,submit)) {
this.updateWithModel(model);
return true;
} else {
throw new Exception("执行流程失败");
}
}
@Override
@Transactional
public Boolean cancelInform(Long sequenceNbr, ReginParams userInfo) throws Exception {
EquipmentInformDto model = this.queryBySeq(sequenceNbr);
InformWorkFlowEnum submit = InformWorkFlowEnum.企业撤销告知书;
model.setProcessStatus(submit.getProcessStatus());
// 流程流转
if (excuteTask(model, userInfo,submit)) {
model.setIsDelete(true);
this.updateWithModel(model);
return true;
} else {
throw new Exception("执行流程失败");
}
}
@Override
public Boolean reSubmit(Long sequenceNbr, ReginParams userInfo) throws Exception {
EquipmentInformDto model = this.queryBySeq(sequenceNbr);
InformWorkFlowEnum submit = InformWorkFlowEnum.企业提交审批;
model.setProcessStatus(submit.getProcessStatus());
// 流程流转
if (excuteTask(model, userInfo,submit)) {
this.updateWithModel(model);
return true;
} else {
throw new Exception("执行流程失败");
}
}
@Override
public Boolean callbackInform(Long sequenceNbr) {
// 状态修改为驳回 还原index
EquipmentInformDto model = this.queryBySeq(sequenceNbr);
model.setInformStatus(EquipmentInformStatusEnum.已驳回.getCode());
this.updateWithModel(model);
// 还原index
// 更新设备相关参数
List<InformEquipmentDto> equipmentList = informEquipmentServiceImpl.getEquipListByInformId(sequenceNbr);
equipmentList.stream().forEach(t -> {
// 更新设备信息
Equipment sourceEquip = equipmentServiceImpl.getById(t.getSourceEquipmentId() );
// 先删除现在参数
equipmentIndexServiceImpl.remove(new LambdaQueryWrapper<EquipmentIndex>().eq(EquipmentIndex::getEquipmentId,sourceEquip.getSequenceNbr()));
// 还原备份参数
List<EquipmentIndexInform> indexList = iEquipmentIndexInformService.list(new LambdaQueryWrapper<EquipmentIndexInform>().eq(EquipmentIndexInform::getEquipmentId,sourceEquip.getSequenceNbr()));
indexList.stream().forEach(i -> {
EquipmentIndex tempIndex = new EquipmentIndex();
BeanUtils.copyProperties(i,tempIndex);
tempIndex.setSequenceNbr(null);
equipmentIndexServiceImpl.save(tempIndex);
});
});
return true;
}
public boolean excuteTask(EquipmentInformDto model, ReginParams userInfo, InformWorkFlowEnum informWorkFlowEnum) throws Exception {
HashMap<String, Object> conditionMap = new HashMap<String, Object>();
conditionMap.put("condition", informWorkFlowEnum.getProcessStatus());
JSONObject teskObject = workflowFeignService.getTaskList(model.getProcessId());
if (ObjectUtils.isNotEmpty(teskObject)) {
JSONArray taskDetailArray = teskObject.getJSONArray("data");
for (Object obj : taskDetailArray) {
JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(obj));
workflowFeignService.pickupAndCompleteTask(detail.getString("id"), conditionMap);
}
}
// 更新流程日志
iInformProcessInfoService.saveProcessInfo(model, userInfo,informWorkFlowEnum.getStage());
return true;
}
public static String buildOrderNo() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String newDate = sdf.format(new Date());
String result = "";
Random random = new Random();
for (int i = 0; i < 3; i++) {
result += random.nextInt(10);
}
return newDate + result;
}
// 保存附件信息
......
......@@ -46,18 +46,24 @@ public class InformEquipmentServiceImpl extends BaseService<InformEquipmentDto,I
@Transactional
@Override
public InformEquipmentDto saveInformEquipment(InformEquipmentDto model) {
String address = model.getAddress();
String latitude = model.getLatitude();
String longitude = model.getLongitude();
// 首先获取设备基本信息并复制
Equipment sourceEquip = equipmentServiceImpl.getById(model.getSourceEquipmentId());
BeanUtils.copyProperties(sourceEquip,model);
model.setSequenceNbr(null);
model.setRecDate(new Date());
model.setRecUserId(null);
model.setRecUserName(null);
model.setAddress(address);
model.setLatitude(latitude);
model.setLongitude(longitude);
model.setIsDelete(false);
this.createWithModel(model);
// 保存设备参数信息
List<EquipmentIndex> indexList = equipmentIndexServiceImpl.list(new LambdaQueryWrapper<EquipmentIndex>().eq(EquipmentIndex::getEquipmentId,model.getSourceEquipmentId()).eq(EquipmentIndex::getIsDelete,false));
List<EquipmentIndex> indexList = equipmentIndexServiceImpl.list(new LambdaQueryWrapper<EquipmentIndex>().eq(EquipmentIndex::getEquipmentId,model.getSourceEquipmentId()));
if(indexList != null && indexList.size()>0) {
for(EquipmentIndex t : indexList) {
EquipmentIndexDto temp = new EquipmentIndexDto();
......
package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentInformDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformProcessInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentInform;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.InformProcessInfo;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.InformProcessInfoMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.IInformProcessInfoService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
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 java.util.List;
/**
* 通话记录附件服务实现类
*
* @author system_generator
* @date 2021-12-27
*/
@Service
public class InformProcessInfoServiceImpl extends BaseService<InformProcessInfoDto,InformProcessInfo,InformProcessInfoMapper> implements IInformProcessInfoService {
@Autowired
EquipmentInformServiceImpl equipmentInformServiceImpl;
/**
* 分页查询
*/
public Page<InformProcessInfoDto> queryForInformProcessInfoPage(Page<InformProcessInfoDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<InformProcessInfoDto> queryForInformProcessInfoList() {
return this.queryForList("" , false);
}
@Override
@Transactional
public Boolean saveProcessInfo(EquipmentInformDto model, ReginParams userInfo, String processStage) throws Exception {
// 记录 流程操作人 所属单位 流程状态 和动作
InformProcessInfoDto info = new InformProcessInfoDto();
AgencyUserModel user = userInfo.getUserModel();
List<CompanyModel> companys = user.getCompanys();
CompanyModel company = null;
if(companys != null && companys.size() >0) {
company = companys.get(0);
info.setHandlerUnit(company.getCompanyName());
info.setHandlerUnitId(company.getSequenceNbr());
}
info.setHandlerId(Long.parseLong(user.getUserId()));
info.setHandler(user.getRealName());
info.setProcessId(model.getProcessId());
info.setInformId(model.getSequenceNbr());
info.setProcessInfo(processStage);
info.setProcessStatus(model.getProcessStatus());
this.createWithModel(info);
return true;
}
}
\ No newline at end of file
......@@ -553,7 +553,12 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
}
@Override
public List<UnitInfoDto> getUseUnit() {
return baseMapper.getUnitByType(TzsCommonParam.USE_UNIT_CODE);
public List<UnitInfoDto> getUseUnit(String unitType, String address, String orgName, String organizationCode) {
return baseMapper.getUnitByTypeParams(TzsCommonParam.USE_UNIT_CODE,unitType,address,orgName,organizationCode);
}
@Override
public List<UnitInfoDto> getAllUnit() {
return baseMapper.getAllUnit();
}
}
\ No newline at end of file
......@@ -10,13 +10,16 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils;
......@@ -48,4 +51,10 @@ public class AmostEquipApplication {
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port
+ path + "/doc.html\n" + "----------------------------------------------------------");
}
@Bean
@LoadBalanced
RestTemplate restTemplate(){
return new RestTemplate();
}
}
......@@ -17,6 +17,7 @@ pagehelper.helper-dialect=mysql
pagehelper.params=count=countSql
pagehelper.reasonable=false
pagehelper.support-methods-arguments=true
spring.main.allow-bean-definition-overriding=true
#liquibase
spring.liquibase.change-log=classpath:/changelog/changelog-master.xml
spring.liquibase.enabled=true
......
......@@ -2226,4 +2226,16 @@
</sql>
</changeSet>
<changeSet author="keyong" id="1640205688-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific_alarm_log" columnName="status"/>
</not>
</preConditions>
<comment>wl_equipment_specific_alarm_log add column status</comment>
<sql>
alter table `wl_equipment_specific_alarm_log` add column `status` bit(1) COLLATE utf8mb4_general_ci NOT NULL DEFAULT b'1' COMMENT '报警状态:1报警0恢复';
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -22,16 +22,18 @@
SELECT
cp.id,
cp.car_id,
ei.`name`,
IFNULL(ei.`name`,'') AS `name`,
ei.name_key AS nameKey,
cp.`value`,
ei.unit,
ei.is_iot AS isIot,
ei.sort_num AS sort,
cp.create_date
cp.create_date ,
IFNULL(c.qr_code,'') AS mRid
FROM
wl_car_property cp
LEFT JOIN wl_equipment_index ei ON ei.id = cp.equipment_index_id
LEFT JOIN wl_car c ON c.id = cp.car_id
<where>
<if test="id != null">
cp.car_id = #{id}
......
......@@ -111,6 +111,7 @@
<select id="getEquipListBySpecific" resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarm">
<![CDATA[
SELECT
*
FROM
......@@ -120,6 +121,7 @@
AND equipment_specific_id = #{equipmentSpecificId}
ORDER BY
create_date DESC
]]>
</select>
......@@ -207,7 +209,8 @@
LEFT JOIN wl_equipment we ON wled.equipment_id = we.id
) d
<where>
<if test="param.warehouseStructureName != null and param.warehouseStructureName != ''">and d.warehouseStructureName like
<if test="param.warehouseStructureName != null and param.warehouseStructureName != ''">and
d.warehouseStructureName like
concat(concat("%",#{param.warehouseStructureName}),"%")
</if>
<if test="param.equipCode != null and param.equipCode != ''">AND d.fireEquipmentCode like
......@@ -219,15 +222,19 @@
<if test="param.alarmType == 'FIREALARM'">AND d.type = #{param.alarmType}</if>
<if test="param.orgCode != null and param.orgCode != ''">AND d.org_code = #{param.orgCode}</if>
<if test="param.type != null and param.type != ''">AND d.type = #{param.type}</if>
<if test="param.handleStatus != null and param.handleStatus != '' and param.handleStatus == 1">AND d.handleStatus = '已处理' </if>
<if test="param.handleStatus != null and param.handleStatus != '' and param.handleStatus == 2">AND d.handleStatus = '未处理' </if>
<if test="param.handleStatus != null and param.handleStatus != '' and param.handleStatus == 1">AND
d.handleStatus = '已处理'
</if>
<if test="param.handleStatus != null and param.handleStatus != '' and param.handleStatus == 2">AND
d.handleStatus = '未处理'
</if>
<if test="param.system != null and param.system != ''">
AND find_in_set(#{param.system},d.systemId)
</if>
<if test="param.buildIds!=null">
AND d.buildId IN
<foreach item="item" collection="param.buildIds" separator=","
open="(" close=")" index=""> #{item}
open="(" close=")" index="">#{item}
</foreach>
</if>
</where>
......@@ -266,7 +273,7 @@
<if test="alarmType == 'FIREALARM'">AND d.type = #{alarmType}</if>
</where>
</select>
<select id="pageAlarmsInfo" resultType="java.util.HashMap">
<select id="pageAlarmsInfo" resultType="Map">
SELECT
d.*
FROM
......@@ -302,7 +309,7 @@
wlesal.equipment_specific_index_value
END AS fireEquipmentPointValue,
wlesa.frequency AS frequency,
wlesa.status AS status,
wlesal.status AS status,
wlesal.type AS type,
wlesal.create_date AS createDate,
wlesal.build_id AS buildId,
......@@ -323,7 +330,8 @@
LEFT JOIN wl_equipment_specific_alarm wlesa ON wlesa.id = wlesal.equipment_specific_alarm_id) d
WHERE 1=1
AND d.fireEquipmentName IS NOT NULL
<if test="param.warehouseStructureName != null and param.warehouseStructureName != ''">and d.warehouseStructureName like
<if test="param.warehouseStructureName != null and param.warehouseStructureName != ''">and
d.warehouseStructureName like
concat(concat("%",#{param.warehouseStructureName}),"%")
</if>
<if test="param.equipCode != null and param.equipCode != ''">AND d.fireEquipmentCode like
......@@ -345,8 +353,11 @@
</if>
<if test="param.buildId != null and param.buildId != ''">
and (d.buildId=#{param.buildId}
or find_in_set(d.fireEquipmentId,(SELECT s.point_in_scene FROM `wl_source_scene` s where s.source_id = #{param.buildId})))
or find_in_set(d.fireEquipmentId,(SELECT s.point_in_scene FROM `wl_source_scene` s where s.source_id =
#{param.buildId})))
</if>
<if test="param.id!=null and param.id!=''">AND d.fireEquipmentId = #{param.id}</if>
<if test="param.status!=null and param.status!=3">AND d.status = #{param.status}</if>
ORDER BY d.createDate DESC
</select>
<select id="getAlarmList" resultType="java.util.HashMap">
......@@ -638,19 +649,19 @@
si.id AS equipmentMeasurementId,
ei.name_key AS fieldName,
ei.`name` AS fieldLabel,
si.`value`,
IFNULL(si.`value`,'') AS `value`,
sa.frequency,
sa.`status`,
sa.type,
es.CODE AS fireEquipmentMRid,
IFNULL(es.CODE,'') AS fireEquipmentMRid,
NULL AS equipmentMeasurementMRid,
ed.`name` AS fireEquipmentName,
sa.recovery_date,
sal.create_date,
sal.update_date,
sal.alarm_reason AS description,
sal.equipment_specific_name AS `name`,
sal.equipment_specific_code AS mrid
IFNULL(sal.equipment_specific_name,'') AS `name`,
IFNULL(sal.equipment_specific_code,'') AS mrid
FROM
wl_equipment_specific_alarm_log sal
LEFT JOIN wl_equipment_specific_alarm sa ON sal.equipment_specific_alarm_id = sa.id
......@@ -735,11 +746,13 @@
AND wlesal.create_date LIKE CONCAT( DATE_FORMAT( NOW( ), '%Y-%m-%d' ), '%' )
</if>
<if test='dto.createDate != null and dto.createDate == "7"'>
AND wlesal.create_date BETWEEN CONCAT( DATE_ADD( DATE_FORMAT( NOW( ), '%Y-%m-%d ' ), INTERVAL - 7 DAY ), '00:00:00' )
AND wlesal.create_date BETWEEN CONCAT( DATE_ADD( DATE_FORMAT( NOW( ), '%Y-%m-%d ' ), INTERVAL - 7 DAY ),
'00:00:00' )
AND CONCAT( DATE_FORMAT( NOW( ), '%Y-%m-%d ' ), '%', '23:59:59' )
</if>
<if test='dto.createDate != null and dto.createDate == "30"'>
AND wlesal.create_date BETWEEN CONCAT( DATE_ADD( DATE_FORMAT( NOW( ), '%Y-%m-%d ' ), INTERVAL - 30 DAY ), '00:00:00' )
AND wlesal.create_date BETWEEN CONCAT( DATE_ADD( DATE_FORMAT( NOW( ), '%Y-%m-%d ' ), INTERVAL - 30 DAY
), '00:00:00' )
AND CONCAT( DATE_FORMAT( NOW( ), '%Y-%m-%d ' ), '%', '23:59:59' )
</if>
<if test="dto.createDate != null and dto.createDate.length() > 7">
......@@ -885,22 +898,26 @@
</if>
<if test='dto.createDate != null and dto.createDate == "3"'>
AND wlesal.create_date &gt;= subdate(curdate(),date_format(curdate(),'%w')-1) and wlesal.create_date &lt;= subdate(curdate(),date_format(curdate(),'%w')-7) <!--本周-->
AND wlesal.create_date &gt;= subdate(curdate(),date_format(curdate(),'%w')-1) and wlesal.create_date
&lt;= subdate(curdate(),date_format(curdate(),'%w')-7) <!--本周-->
</if>
<if test='dto.createDate != null and dto.createDate == "4"'>
AND wlesal.create_date &gt;= subdate(curdate(),date_format(curdate(),'%w')+6) and wlesal.create_date &lt;= subdate(curdate(),date_format(curdate(),'%w')-0)<!--上周-->
AND wlesal.create_date &gt;= subdate(curdate(),date_format(curdate(),'%w')+6) and wlesal.create_date
&lt;= subdate(curdate(),date_format(curdate(),'%w')-0)<!--上周-->
</if>
<if test='dto.createDate != null and dto.createDate == "5"'>
AND date_format(wlesa.create_date,'%y-%m')=date_format(curdate(),'%y-%m')<!--本月-->
</if>
<if test='dto.createDate != null and dto.createDate == "6"'>
AND date_format(wlesa.create_date,'%y-%m')=date_format(date_sub(curdate(), interval 1 month),'%y-%m') <!--上月-->
AND date_format(wlesa.create_date,'%y-%m')=date_format(date_sub(curdate(), interval 1
month),'%y-%m') <!--上月-->
</if>
<if test='dto.startDate != null and dto.endDate != null '>
AND DATE_FORMAT(wlesa.create_date, '%Y-%m-%d ' ) between DATE_FORMAT(#{dto.startDate}, '%Y-%m-%d ' ) and DATE_FORMAT(#{dto.endDate}, '%Y-%m-%d ' )
AND DATE_FORMAT(wlesa.create_date, '%Y-%m-%d ' ) between DATE_FORMAT(#{dto.startDate}, '%Y-%m-%d ' ) and
DATE_FORMAT(#{dto.endDate}, '%Y-%m-%d ' )
</if>
<if test="dto.isFirm == 'yes'">
......@@ -945,7 +962,8 @@
b.eqname fireEquipmentName,
b.qrcode fireEquipmentCode,
b.eqimg eqimg,
IFNULL(( select DISTINCT wl_equipment_specific_alarm.`status` from wl_equipment_specific_alarm where wl_equipment_specific_alarm.`status`=1 and wl_equipment_specific_alarm.equipment_detail_id=b.eqid ), 0) `status`
IFNULL(( select DISTINCT wl_equipment_specific_alarm.`status` from wl_equipment_specific_alarm where
wl_equipment_specific_alarm.`status`=1 and wl_equipment_specific_alarm.equipment_detail_id=b.eqid ), 0) `status`
from
(select
wl_warehouse_structure.full_name address,
......@@ -956,7 +974,8 @@
wl_equipment_specific.system_id
from wl_equipment_detail
LEFT JOIN wl_equipment_specific ON wl_equipment_specific.equipment_detail_id = wl_equipment_detail.id
LEFT JOIN (select DISTINCT wl_equipment_index.equipment_id from wl_equipment_index where wl_equipment_index.is_iot=1) b on b.equipment_id=wl_equipment_detail.equipment_id
LEFT JOIN (select DISTINCT wl_equipment_index.equipment_id from wl_equipment_index where
wl_equipment_index.is_iot=1) b on b.equipment_id=wl_equipment_detail.equipment_id
LEFT JOIN wl_stock_detail on wl_equipment_detail.id =wl_stock_detail.equipment_detail_id
LEFT JOIN wl_warehouse_structure on wl_stock_detail.warehouse_structure_id = wl_warehouse_structure.id
)b
......@@ -1023,7 +1042,8 @@
count(wl_equipment_specific_alarm.id) num
from wl_equipment_specific_alarm where wl_equipment_specific_alarm.`status`=1
<if test="tyep == 'yes'">
and wl_equipment_specific_alarm.confirm_type <![CDATA[<>]]> '' AND wl_equipment_specific_alarm.confirm_type IS NOT NULL
and wl_equipment_specific_alarm.confirm_type <![CDATA[<>]]> '' AND wl_equipment_specific_alarm.confirm_type
IS NOT NULL
</if>
<if test="tyep == 'no'">
and wl_equipment_specific_alarm.confirm_type is null
......
......@@ -78,7 +78,8 @@
wes.org_code AS orgCode,
wei.type_code AS typeCode,
wei.name AS indexName,
wei.unit AS indexUnitName
wei.unit AS indexUnitName,
wesi.update_date AS updateDate
FROM
wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id
......@@ -86,6 +87,30 @@
WHERE
wes.iot_code = #{iotCode}
</select>
<select id="getEquipmentSpeIndexDataByIotCode"
resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex">
SELECT
wesi.id AS id,
wei.name_key AS nameKey,
IFNULL(si.value_label, si.`value`) AS 'value',
wesi.equipment_specific_id AS equipmentSpecificId,
wesi.equipment_index_id AS equipmentIndexId,
wes.org_code AS code,
wes.iot_code AS iotCode,
wes.org_code AS orgCode,
wei.type_code AS typeCode,
wei.name AS indexName,
wei.unit AS indexUnitName,
wei.value_enum AS valueEnum
FROM
wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
WHERE
wes.iot_code = #{iotCode}
</select>
<select id="getEquipmentSpeIndexByEquipmentSecificId"
resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex">
SELECT
......
......@@ -737,15 +737,15 @@
SELECT
es.id,
es.`code` AS mrid,
ed.`name`,
ed.`name` AS aliasname,
es.`name`,
es.`name` AS aliasname,
es.`code`,
e.`name` AS categoryname,
e.`code` AS categorycode,
ed.equipment_name AS categoryname,
ed.`code` AS categorycode,
( SELECT GROUP_CONCAT( url ) FROM wl_upload_file WHERE file_type = 'image' AND object_type = 'equipment' AND object_id = ed.id ) AS img,
es.iot_code AS iotcode,
f.`name` AS stationname,
f.`code` AS stationcode,
'' AS stationname,
'' AS stationcode,
ws.source_id AS buildid,
es.system_id AS fightingsystemids,
TRIM(CONCAT_WS(' ',ws.full_name,sd.description)) AS position,
......@@ -760,11 +760,9 @@
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON es.equipment_detail_id = ed.id
LEFT JOIN wl_equipment e ON e.id = ed.equipment_id
LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = es.id
LEFT JOIN wl_warehouse_structure ws ON ws.id = sd.warehouse_structure_id
LEFT JOIN wl_area a ON es.area_id = a.id,
f_station_info f
LEFT JOIN wl_area a ON es.area_id = a.id
WHERE
es.id = #{id}
</select>
......
......@@ -752,10 +752,10 @@
fs.`name` AS aliasname,
fs.`code`,
fg.group_name AS systemtype,
fs.install_date AS installdate,
p.`name` AS chargeperson,
fs.charge_person_phone AS chargepersonphone,
mi.`name` AS constructionunit,
IFNULL(fs.install_date,'') AS installdate,
IFNULL(p.`name`,'') AS chargeperson,
IFNULL(fs.charge_person_phone,'') AS chargepersonphone,
IFNULL(mi.`name`,'') AS constructionunit,
mi1.`name` AS maintenanceunit,
fs.first_maintenance_date AS firstmaintenancedate,
fs.maintenance_frequency AS maintenancefrequency,
......
......@@ -330,21 +330,14 @@
</if>
wle.latitude
FROM wl_video wle
where wle.longitude is not null and wle.latitude is not null
<if test='distance!=null'>
and Round(st_distance(point(wle.longitude,wle.latitude),point(#{longitude},#{latitude}))*111195,1) &lt;=
#{distance}
<if test='longitude!=null and latitude!=null and distance!=null'>
and distance &lt;= #{distance}
</if>
<if test='longitude!=null and latitude!=null '>
ORDER BY distance
</if>
limit #{pageNum},#{pageSize}
</select>
......
......@@ -2485,5 +2485,103 @@
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812099', 'companyPlanePhonto', '单位总平面图', 'upload', '7', 'eq', b'0', b'0', '244', NULL, NULL, NULL, '2021-12-14 18:05:38', b'0', NULL, '20', NULL);
</sql>
</changeSet>
<changeSet author="helinlin" id="2021-12-23-11-06">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_contract"/>
</preConditions>
<comment>change org_code filed type</comment>
<sql>
ALTER TABLE `cb_contract` MODIFY COLUMN org_code VARCHAR(10) DEFAULT NULL COMMENT '机构代码用于权限过滤';
</sql>
</changeSet>
<changeSet author="litengwei" id="2021-11-29-litengwei-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="jc_template" />
</preConditions>
<comment>update data jc_template</comment>
<sql>
update
`jc_template` jc
set
content = '<![CDATA[<p>【警情续报】<span contenteditable="true" data-name="editContent" data-type="input"></span><p>相关警情:时间:$callTime 地点: $address 发生$type 警情 $replaceContent 被困人数:<span contenteditable="true" data-name="trappedNum" data-type="input"></span>;伤亡人数:<span contenteditable="true" data-name="casualtiesNum" data-type="input"></span>;<p>发送单位:<span contentEditable data-name="companyName" data-type="input"></span></p><p>联系人:$contactUser 联系电话:$contactPhone < /p> ]]>'
where jc.type_code = '313'
</sql>
</changeSet>
<changeSet author="litengwei" id="2021-11-29-litengwei-2">
<preConditions onFail="MARK_RAN">
<tableExists tableName="jc_template" />
</preConditions>
<comment>update data jc_template</comment>
<sql>
update
jc_template jc
set
content = '<![CDATA[<p>【非警情确认】根据现场反馈信息、视频监控信息和消防物联监控信息,判断 【时间:$callTime 地点: $address 发生$type 警情 $replaceContent ;被困人数:<span contenteditable="true" data-name="trappedNum" data-type="input"></span>;伤亡人数:<span contenteditable="true" data-name="casualtiesNum" data-type="input"></span>; 】 为非警情,请个单位、部门尽快 进行恢复到日常执勤状态。</p><p>发送单位:<span contenteditable="true" data-name="companyName" data-type="input"></span></p><p>联系人:$contactUser 联系电话:$contactPhone < /p>]]>'
where
jc.type_code = '314'
</sql>
</changeSet>
<changeSet author="litengwei" id="2021-11-29-litengwei-3">
<preConditions onFail="MARK_RAN">
<tableExists tableName="jc_template" />
</preConditions>
<comment>update data jc_template</comment>
<sql>
update
jc_template jc
set
content = '<![CDATA[<p>【警情结案】当前警情已于<span contenteditable="true" data-name="recDate" data-type="input"></span> 当前警情已经结案。</p>相关警情:时间:$callTime 地点: $address 发生$type 警情 $replaceContent;被困人数:<span contenteditable="true" data-name="trappedNum" data-type="input"></span>;伤亡人数:<span contenteditable="true" data-name="casualtiesNum" data-type="input"></span>;<p>发送单位:<span contentEditable data-name="companyName" data-type="input"></span></p><p>联系人:$contactUser 联系电话:$contactPhone < /p>]]>'
where
jc.type_code = '315'
</sql>
</changeSet>
<changeSet author="litengwei" id="2021-11-30-litengwei-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="jc_template" />
</preConditions>
<comment>update data jc_template</comment>
<sql>
update
`jc_template` jc
set
content = '<![CDATA[<p>【警情续报】<span contenteditable="true" data-name="editContent" data-type="input"></span><p>相关警情:时间:$callTime 地点: $address 发生$type 警情 $replaceContent 被困人数:<span contenteditable="true" data-name="trappedNum" data-type="input"></span>;伤亡人数:<span contenteditable="true" data-name="casualtiesNum" data-type="input"></span>;<p>发送单位:<span contentEditable data-name="companyName" data-type="input"></span></p><p>联系人:$contactUser 联系电话:$contactPhone </p> ]]>'
where jc.type_code = '313'
</sql>
</changeSet>
<changeSet author="litengwei" id="2021-11-30-litengwei-2">
<preConditions onFail="MARK_RAN">
<tableExists tableName="jc_template" />
</preConditions>
<comment>update data jc_template</comment>
<sql>
update
jc_template jc
set
content = '<![CDATA[<p>【非警情确认】根据现场反馈信息、视频监控信息和消防物联监控信息,判断 【时间:$callTime 地点: $address 发生$type 警情 $replaceContent ;被困人数:<span contenteditable="true" data-name="trappedNum" data-type="input"></span>;伤亡人数:<span contenteditable="true" data-name="casualtiesNum" data-type="input"></span>; 】 为非警情,请个单位、部门尽快 进行恢复到日常执勤状态。</p><p>发送单位:<span contenteditable="true" data-name="companyName" data-type="input"></span></p><p>联系人:$contactUser 联系电话:$contactPhone </p>]]>'
where
jc.type_code = '314'
</sql>
</changeSet>
<changeSet author="litengwei" id="2021-11-30-litengwei-3">
<preConditions onFail="MARK_RAN">
<tableExists tableName="jc_template" />
</preConditions>
<comment>update data jc_template</comment>
<sql>
update
jc_template jc
set
content = '<![CDATA[<p>【警情结案】当前警情已于<span contenteditable="true" data-name="recDate" data-type="input"></span> 结案。</p>相关警情:时间:$callTime 地点: $address 发生$type 警情 $replaceContent;被困人数:<span contenteditable="true" data-name="trappedNum" data-type="input"></span>;伤亡人数:<span contenteditable="true" data-name="casualtiesNum" data-type="input"></span>;<p>发送单位:<span contentEditable data-name="companyName" data-type="input"></span></p><p>联系人:$contactUser 联系电话:$contactPhone </p>]]>'
where
jc.type_code = '315'
</sql>
</changeSet>
</databaseChangeLog>
......@@ -71,10 +71,11 @@
p_point_inputitem pi
LEFT JOIN p_input_item ii ON ii.id = pi.input_item_id
LEFT JOIN p_point_classify pc ON FIND_IN_SET(pc.id, pi.classify_ids) > 0
LEFT JOIN p_route_point prp ON prp.point_id = pi.point_id
WHERE
pi.point_id = #{pointId}
AND NOT FIND_IN_SET(pi.id,prp.exclude_items)
AND IF(prp.id, NOT FIND_IN_SET(pi.id,IFNULL(prp.exclude_items,'')),' 1=1 ')
ORDER BY
pi.order_no
</select>
......
......@@ -51,4 +51,5 @@ emqx.user-name=super
emqx.password=a123456
emqx.max-inflight=1000
rule.definition.localIp=172.16.3.121
file.url=http://39.98.45.134:9000/
\ No newline at end of file
spring.application.name=TZS-kfm
spring.application.name=TZS
server.servlet.context-path=/tzs
server.port=11000
spring.profiles.active=jd
......@@ -60,3 +60,7 @@ failure.work.flow.processDefinitionKey=malfunction_repair
video.fegin.name=video
latentDanger.feign.name=AMOS-LATENT-DANGER
Knowledgebase.fegin.name=AMOS-API-KNOWLEDGEBASE
## 设备告知流程v1
inform.work.flow.processDefinitionKey=equipment_inform_process_v1
\ No newline at end of file
......@@ -494,6 +494,316 @@
</changeSet>
<changeSet author="kongfm" id="2021-12-22-01">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tcb_equipment"/>
</not>
</preConditions>
<comment>add tcb_equipment table </comment>
<sql>
CREATE TABLE `tcb_equipment` (
`sequence_nbr` bigint(50) NOT NULL COMMENT '主键',
`equip_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '设备id',
`code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备编号',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '设备名称',
`category_id` bigint(50) NOT NULL COMMENT '设备类别id',
`category_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备类别名称',
`type_id` bigint(50) NOT NULL COMMENT '设备种类id',
`type_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备种类名称',
`variety_id` bigint(50) NULL DEFAULT NULL COMMENT '设备品种id',
`variety_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备品种名称',
`brand` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备品牌',
`model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规格型号',
`inner_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单位内部编号',
`design_unit_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设计单位名称',
`manufacturer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '制造单位名称',
`design_life` int(10) NULL DEFAULT NULL COMMENT '设计使用年限',
`factory_date` datetime NULL DEFAULT NULL COMMENT '出厂日期',
`product_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品编号(出厂编号)',
`supervision_agency` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '监督检验机构',
`inspection_report_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '检验报告编号',
`status` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '设备状态(未安装,已安装...)',
`rec_user_id` int(11) NULL DEFAULT NULL COMMENT '更新人id',
`rec_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人名称',
`rec_date` datetime NULL DEFAULT NULL COMMENT '更新日期',
`is_delete` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除(0未删除,1删除)',
`equip_unit_id` bigint(32) NULL DEFAULT NULL COMMENT '设备所属单位id',
`equip_unit` varchar(104) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备所属单位',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '装备信息表' ROW_FORMAT = DYNAMIC;
</sql>
</changeSet>
<changeSet author="kongfm" id="2021-12-22-02">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tcb_equipment_associated"/>
</not>
</preConditions>
<comment>add tcb_equipment_associated table </comment>
<sql>
CREATE TABLE `tcb_equipment_associated` (
`sequence_nbr` bigint(50) NOT NULL COMMENT '主键',
`equipment_id` bigint(50) NULL DEFAULT NULL COMMENT '设备id',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称',
`model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '型号',
`specifications` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规格',
`code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '编号',
`amount` int(10) NULL DEFAULT NULL COMMENT '数量',
`manufacturer` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '制造单位',
`production_date` datetime NULL DEFAULT NULL COMMENT '制造日期',
`part_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '部件/装置号',
`certificate_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '型式试验合格证号',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
`appraisal_agency_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鉴定机构名称',
`appraisal_date` datetime NULL DEFAULT NULL COMMENT '设计文件鉴定日期',
`appraisal_report_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '鉴定报告书编号',
`supervisory_inspection_agency` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '监检检验机构',
`social_credit_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '统一社会信用代码',
`approval_certificate_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机构核准证编号',
`rec_user_id` bigint(50) NULL DEFAULT NULL COMMENT '更新人id',
`rec_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人名称',
`rec_date` datetime NULL DEFAULT NULL COMMENT '更新日期',
`is_delete` bit(1) NULL DEFAULT NULL COMMENT '是否删除(1删除,0未删除)',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '配套设备/设施/部件' ROW_FORMAT = DYNAMIC;
</sql>
</changeSet>
<changeSet author="kongfm" id="2021-12-22-03">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tcb_equipment_index"/>
</not>
</preConditions>
<comment>add tcb_equipment_index table </comment>
<sql>
CREATE TABLE `tcb_equipment_index` (
`sequence_nbr` bigint(50) NOT NULL COMMENT '主键',
`equipment_id` bigint(50) NOT NULL COMMENT '设备id',
`equipment_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备名称',
`value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '指标值',
`def_index_id` bigint(50) NULL DEFAULT NULL COMMENT '装备定义指标id',
`def_index_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '装备定义指标名称',
`def_index_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '装备定义指标key',
`rec_user_id` bigint(50) NULL DEFAULT NULL COMMENT '更新人id',
`rec_user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人名称',
`rec_date` datetime NULL DEFAULT NULL COMMENT '更新时间',
`is_delete` bit(1) NULL DEFAULT NULL COMMENT '是否删除(1删除,0未删除)',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '设备指标' ROW_FORMAT = DYNAMIC;
</sql>
</changeSet>
<changeSet author="kongfm" id="2021-12-23-01">
<preConditions onFail="MARK_RAN">
<tableExists tableName="tcb_equipment"/>
</preConditions>
<comment>modify table tcb_equipment add address columns</comment>
<sql>
ALTER TABLE `tcb_equipment` add address varchar(500) COMMENT '详细地址';
ALTER TABLE `tcb_equipment` add longitude varchar(30) COMMENT '经度';
ALTER TABLE `tcb_equipment` add latitude varchar(30) COMMENT '纬度';
ALTER TABLE `tcb_equipment` add region_code varchar(30) COMMENT '所属区域代码';
</sql>
</changeSet>
<changeSet author="kongfm" id="2021-12-23-02">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tcb_inform_equipment"/>
</not>
</preConditions>
<comment>add tcb_inform_equipment table </comment>
<sql>
CREATE TABLE `tcb_inform_equipment` (
`sequence_nbr` bigint(50) NOT NULL COMMENT '主键',
`equip_id` varchar(50) NOT NULL COMMENT '设备id',
`code` varchar(50) DEFAULT NULL COMMENT '设备编号',
`name` varchar(255) NOT NULL COMMENT '设备名称',
`category_id` bigint(50) NOT NULL COMMENT '设备类别id',
`category_name` varchar(255) DEFAULT NULL COMMENT '设备类别名称',
`type_id` bigint(50) NOT NULL COMMENT '设备种类id',
`type_name` varchar(255) DEFAULT NULL COMMENT '设备种类名称',
`variety_id` bigint(50) DEFAULT NULL COMMENT '设备品种id',
`variety_name` varchar(255) DEFAULT NULL COMMENT '设备品种名称',
`brand` varchar(255) DEFAULT NULL COMMENT '设备品牌',
`model` varchar(255) DEFAULT NULL COMMENT '规格型号',
`inner_code` varchar(50) DEFAULT NULL COMMENT '单位内部编号',
`design_unit_name` varchar(255) DEFAULT NULL COMMENT '设计单位名称',
`manufacturer` varchar(255) DEFAULT NULL COMMENT '制造单位名称',
`design_life` int(10) DEFAULT NULL COMMENT '设计使用年限',
`factory_date` datetime DEFAULT NULL COMMENT '出厂日期',
`product_code` varchar(255) DEFAULT NULL COMMENT '产品编号(出厂编号)',
`supervision_agency` bigint(50) DEFAULT NULL COMMENT '监督检验机构',
`inspection_report_code` varchar(255) DEFAULT NULL COMMENT '检验报告编号',
`status` varchar(50) NOT NULL COMMENT '设备状态(未安装,已安装...)',
`rec_user_id` int(11) DEFAULT NULL COMMENT '更新人id',
`rec_user_name` varchar(255) DEFAULT NULL COMMENT '更新人名称',
`rec_date` datetime DEFAULT NULL COMMENT '更新日期',
`is_delete` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除(0未删除,1删除)',
`equip_unit_id` bigint(32) DEFAULT NULL COMMENT '设备所属单位id',
`equip_unit` varchar(104) DEFAULT NULL COMMENT '设备所属单位',
`inform_id` bigint(32) DEFAULT NULL COMMENT '告知单id',
`source_equipment_id` bigint(32) DEFAULT NULL COMMENT '原设备id',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='告知申请-设备信息表';
</sql>
</changeSet>
<changeSet author="kongfm" id="2021-12-23-03">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_equipment_inform"/>
</not>
</preConditions>
<comment>add tz_equipment_inform table </comment>
<sql>
CREATE TABLE `tz_equipment_inform` (
`sequence_nbr` bigint(19) NOT NULL DEFAULT '0' COMMENT 'id',
`product_code` varchar(20) DEFAULT NULL COMMENT '施工告知编号',
`product_inform_date` datetime DEFAULT NULL COMMENT '施工告知日期',
`product_unit` varchar(50) DEFAULT NULL COMMENT '施工单位',
`product_unit_id` bigint(32) DEFAULT NULL COMMENT '施工单位id',
`product_type` varchar(20) DEFAULT NULL COMMENT '施工类型',
`product_type_code` varchar(25) DEFAULT NULL COMMENT '施工类型code',
`licence_code` varchar(50) DEFAULT NULL COMMENT '生产许可证编号',
`licence_date` datetime DEFAULT NULL COMMENT '生产许可证有效期',
`region_code` varchar(100) DEFAULT NULL COMMENT '区域编码',
`province` varchar(50) DEFAULT NULL COMMENT '省',
`city` varchar(50) DEFAULT NULL COMMENT '市',
`district` varchar(50) DEFAULT NULL COMMENT '县区',
`stree` varchar(50) DEFAULT NULL COMMENT '街道',
`community` varchar(50) DEFAULT NULL COMMENT '小区',
`address` varchar(100) DEFAULT NULL COMMENT '详细地址',
`longitude` varchar(50) DEFAULT NULL COMMENT '经度',
`latitude` varchar(50) DEFAULT NULL COMMENT '纬度',
`principal` varchar(20) DEFAULT NULL COMMENT '施工负责人',
`principal_id` bigint(32) DEFAULT NULL COMMENT '施工负责人id',
`principal_phone` varchar(20) DEFAULT NULL COMMENT '施工负责人电话',
`plan_product_date` datetime DEFAULT NULL COMMENT '计划施工日期',
`accept_unit` varchar(50) DEFAULT NULL COMMENT '接收机构',
`accept_unit_id` bigint(32) DEFAULT NULL COMMENT '接收机构id',
`inspecton_unit` varchar(50) DEFAULT NULL COMMENT '检验机构',
`inspecton_unit_id` bigint(32) DEFAULT NULL COMMENT '检验机构id',
`use_unit` varchar(50) DEFAULT NULL COMMENT '使用单位',
`use_unit_id` bigint(32) DEFAULT NULL COMMENT '使用单位id',
`property_unit` varchar(50) DEFAULT NULL COMMENT '产权单位',
`property_unit_id` bigint(32) DEFAULT NULL COMMENT '产权单位id',
`use_site` varchar(50) DEFAULT NULL COMMENT '使用场所',
`use_site_code` varchar(50) DEFAULT NULL COMMENT '使用场所code',
`inform_code` varchar(50) DEFAULT NULL COMMENT '告知书编号',
`inform_status` varchar(50) DEFAULT NULL COMMENT '告知单状态 0 暂存 1未接收 9已接收',
`rec_user_name` varchar(15) CHARACTER SET utf8 DEFAULT NULL COMMENT '接警人名称',
`rec_user_id` varchar(19) CHARACTER SET utf8 DEFAULT NULL COMMENT '接警人',
`rec_date` datetime DEFAULT NULL COMMENT '接警时间',
`is_delete` bit(1) DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='设备告知单';
</sql>
</changeSet>
<changeSet author="kongfm" id="2021-12-23-04">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from cb_data_dictionary where sequence_nbr = 1108</sqlCheck>
</preConditions>
<comment>add data_dictionary inform </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 (1108, '1108', '改造', 'BUILD_TYPE', NULL, NULL, NULL, NULL, NULL, b'0', 1);
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 (1109, '1109', '维修', 'BUILD_TYPE', NULL, NULL, NULL, NULL, NULL, b'0', 1);
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 (1110, '1110', '移装', 'BUILD_TYPE', NULL, NULL, NULL, NULL, NULL, b'0', 1);
</sql>
</changeSet>
<changeSet author="kongfm" id="2021-12-23-05">
<preConditions onFail="MARK_RAN">
<tableExists tableName="tcb_inform_equipment"/>
</preConditions>
<comment>modify table tcb_inform_equipment add address columns</comment>
<sql>
ALTER TABLE `tcb_inform_equipment` add address varchar(500) COMMENT '详细地址';
ALTER TABLE `tcb_inform_equipment` add longitude varchar(30) COMMENT '经度';
ALTER TABLE `tcb_inform_equipment` add latitude varchar(30) COMMENT '纬度';
ALTER TABLE `tcb_inform_equipment` add region_code varchar(30) COMMENT '所属区域代码';
</sql>
</changeSet>
<changeSet author="kongfm" id="2021-12-24-01">
<preConditions onFail="MARK_RAN">
<tableExists tableName="tz_equipment_inform"/>
</preConditions>
<comment>modify table tz_equipment_inform add processInfo columns</comment>
<sql>
ALTER TABLE `tz_equipment_inform` add process_id varchar(50) COMMENT '流程id';
</sql>
</changeSet>
<changeSet author="kongfm" id="2021-12-27-01">
<preConditions onFail="MARK_RAN">
<tableExists tableName="tz_equipment_inform"/>
</preConditions>
<comment>modify table tz_equipment_inform add processInfo columns</comment>
<sql>
ALTER TABLE `tz_equipment_inform` add process_status varchar(50) COMMENT '流程状态';
</sql>
</changeSet>
<changeSet author="kongfm" id="2021-12-27-02">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_inform_process_info"/>
</not>
</preConditions>
<comment>add tz_inform_process_info table </comment>
<sql>
CREATE TABLE `tz_inform_process_info` (
`sequence_nbr` bigint(30) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`process_info` varchar(255) NOT NULL COMMENT '流转内容',
`handler` varchar(255) NOT NULL COMMENT '流程操作人',
`handler_unit_id` bigint(32) NOT NULL COMMENT '操作人所属单位id',
`rec_user_id` bigint(30) DEFAULT NULL COMMENT '更新人id',
`rec_user_name` varchar(100) DEFAULT NULL COMMENT '更新人名称',
`rec_date` datetime DEFAULT NULL COMMENT '更新时间',
`is_delete` bit(1) DEFAULT b'0' COMMENT '是否删除(0:未删除,1:已删除)',
`process_status` varchar(15) NOT NULL COMMENT '流程状态',
`handler_id` bigint(32) DEFAULT NULL COMMENT '流程操作人id',
`handler_unit` varchar(255) DEFAULT NULL COMMENT '操作人所属单位',
`process_id` varchar(50) DEFAULT NULL COMMENT '流程id',
`inform_id` bigint(32) DEFAULT NULL COMMENT '告知书id',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1458324621349306370 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='通话记录附件';
</sql>
</changeSet>
<changeSet author="kongfm" id="2021-12-29-01">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tcb_equipment_index_inform"/>
</not>
</preConditions>
<comment>add tcb_equipment_index_inform table </comment>
<sql>
CREATE TABLE `tcb_equipment_index_inform` (
`sequence_nbr` bigint(50) NOT NULL COMMENT '主键',
`equipment_id` bigint(50) NOT NULL COMMENT '设备id',
`equipment_name` varchar(255) DEFAULT NULL COMMENT '设备名称',
`value` varchar(255) DEFAULT NULL COMMENT '指标值',
`def_index_id` bigint(50) DEFAULT NULL COMMENT '装备定义指标id',
`def_index_name` varchar(255) DEFAULT NULL COMMENT '装备定义指标名称',
`def_index_key` varchar(255) DEFAULT NULL COMMENT '装备定义指标key',
`rec_user_id` bigint(50) DEFAULT NULL COMMENT '更新人id',
`rec_user_name` varchar(255) DEFAULT NULL COMMENT '更新人名称',
`rec_date` datetime DEFAULT NULL COMMENT '更新时间',
`is_delete` bit(1) DEFAULT NULL COMMENT '是否删除(1删除,0未删除)',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='设备指标';
</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