Commit b3888453 authored by KeYong's avatar KeYong

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

parents f7186567 82ef9bcc
......@@ -20,29 +20,30 @@ import javax.servlet.http.HttpServletRequest;
@RestControllerAdvice
public class GlobalExceptionHandler {
private Logger log = LoggerFactory.getLogger(this.getClass());
public GlobalExceptionHandler() {
}
@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){
response.setStatus(HttpStatus.FORBIDDEN.value());
}else{
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
}
response.setDevMessage("FAILED");
response.setMessage( exception.getMessage());
response.setTraceId(RequestContext.getTraceId());
response.setPath(request.getServletPath());exception.printStackTrace();
return response;
}
private Logger log = LoggerFactory.getLogger(this.getClass());
public GlobalExceptionHandler() {
}
@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().contains("账号已经在其他设备登录") || exception.getMessage().contains("请重新登录"))) {
response.setStatus(HttpStatus.FORBIDDEN.value());
} else {
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
}
response.setDevMessage("FAILED");
response.setMessage(exception.getMessage());
response.setTraceId(RequestContext.getTraceId());
response.setPath(request.getServletPath());
exception.printStackTrace();
return response;
}
}
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;
}
}
......@@ -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;
}
......@@ -148,4 +148,11 @@ public class EquipmentInformDto extends BaseDto {
@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;
}
......@@ -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.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> {
}
package com.yeejoin.amos.boot.module.tzs.flc.api.service;
/**
* 设备指标接口类
*
* @author system_generator
* @date 2021-12-29
*/
public interface IEquipmentIndexInformService {
}
......@@ -15,7 +15,7 @@ import java.util.List;
*/
public interface IEquipmentInformService {
EquipmentInformDto createEquipmentInform(EquipmentInformDto model);
EquipmentInformDto createEquipmentInform(EquipmentInformDto model, ReginParams userInfo);
Page<EquipmentInformDto> queryDtoList(Page<EquipmentInformDto> page, EquipmentInformDto equipmentInformDto, String sortParam, String sortRule);
......@@ -23,9 +23,74 @@ public interface IEquipmentInformService {
Boolean acceptInform(Long sequenceNbr);
EquipmentInformDto updateEquipmentInform(EquipmentInformDto model);
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;
}
<?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>
......@@ -18,8 +18,10 @@
'暂存'
WHEN 1 THEN
'未接收'
WHEN 9 THEN
WHEN 2 THEN
'已接收'
WHEN 9 THEN
'已驳回'
ELSE
''
END AS informStatus,
......
<?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>
......@@ -108,11 +108,11 @@ public class OrgUsrController extends BaseController {
// BUG 2741 首先判断是否为公司 如果公司底下有人员不可直接删除 bykongfm
//bug 2882 判断是否为部门 如果部门底下有人员不可直接删除 chenzhao 2021-09-27 start
OrgUsr tempOrg = iOrgUsrService.getById(id.toString());
if(tempOrg.getBizOrgType().equals("COMPANY") || tempOrg.getBizOrgType().equals("DEPARTMENT")) {
List<OrgUsr> tempList = iOrgUsrService.list(new LambdaQueryWrapper<OrgUsr>().eq(OrgUsr::getParentId,id).eq(OrgUsr::getIsDelete,false));
if (tempOrg.getBizOrgType().equals("COMPANY") || tempOrg.getBizOrgType().equals("DEPARTMENT")) {
List<OrgUsr> tempList = iOrgUsrService.list(new LambdaQueryWrapper<OrgUsr>().eq(OrgUsr::getParentId, id).eq(OrgUsr::getIsDelete, false));
/*bug3031 删除机场单位后,队伍所属单位字段数据未清空 2021-10-13 start*/
List<FireTeam> fireTeams = fireTeamMapper.byTeamId(id);
if(tempList.size() > 0 || fireTeams.size() > 0 ) {
if (tempList.size() > 0 || fireTeams.size() > 0) {
return ResponseHelper.buildResponse("-1");
}
/*bug3031 删除机场单位后,队伍所属单位字段数据未清空 2021-10-13 end*/
......@@ -120,7 +120,7 @@ public class OrgUsrController extends BaseController {
//bug 2882 判断是否为部门 如果部门底下有人员不可直接删除 chenzhao 2021-09-27 end
// iOrgUsrService.update(new UpdateWrapper<OrgUsr>().eq("sequence_nbr", id).set("is_delete", CommonConstant.IS_DELETE_01));
/*bug 2812 一次删除多条数据 传入类型修改为string 问题解决 2021-09-09 陈召 开始*/
iOrgUsrService.update(new UpdateWrapper<OrgUsr>().eq("sequence_nbr", String.valueOf(id)).set("is_delete", CommonConstant.IS_DELETE_01));
iOrgUsrService.update(new UpdateWrapper<OrgUsr>().eq("sequence_nbr", String.valueOf(id)).set("is_delete", CommonConstant.IS_DELETE_01));
/*bug 2812 一次删除多条数据 传入类型修改为string 问题解决 2021-09-09 陈召 结束*/
try {
eSOrgUsrService.deleteById(id);
......@@ -144,7 +144,7 @@ public class OrgUsrController extends BaseController {
public ResponseModel<?> updateByIdOrgUsr(HttpServletRequest request, @RequestBody OrgUsrDto OrgUsrVo, @PathVariable Long id) throws Exception {
OrgUsrVo.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_COMPANY);
// iOrgUsrService.updateByIdOrgUsr(OrgUsrVo, id);
return ResponseHelper.buildResponse( iOrgUsrService.updateByIdOrgUsr(OrgUsrVo, id));
return ResponseHelper.buildResponse(iOrgUsrService.updateByIdOrgUsr(OrgUsrVo, id));
}
......@@ -227,7 +227,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();
......@@ -255,6 +254,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);
......@@ -450,11 +450,11 @@ public class OrgUsrController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = {"/getLoginUserDetails/{userId}", "/getLoginUserDetails"}, method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取登陆人绑定的人员关系", notes = "获取登陆人绑定的人员关系")
public ResponseModel<List<Map<String, Object>>> getLoginUserDetails(@PathVariable(required=false) String userId) {
public ResponseModel<List<Map<String, Object>>> getLoginUserDetails(@PathVariable(required = false) String userId) {
AgencyUserModel user = getUserInfo();
String userIds = userId;
if (StringUtils.isEmpty(userIds)) {
userIds = user.getUserId();
userIds = user.getUserId();
}
List<Map<String, Object>> loginUserDetails = iOrgUsrService.getLoginUserDetails(userIds, user);
return ResponseHelper.buildResponse(loginUserDetails);
......@@ -465,7 +465,7 @@ public class OrgUsrController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "获取最上级station", notes = "获取最上级建筑信息")
public ResponseModel<JSONObject> getBuliding(@PathVariable Long id) {
JSONObject equipjSONObject = this.getBulid(id);
return ResponseHelper.buildResponse(equipjSONObject);
return ResponseHelper.buildResponse(equipjSONObject);
}
public JSONObject getBulid(Long id) {
......@@ -477,11 +477,12 @@ public class OrgUsrController extends BaseController {
if (!"0".equals(equipjSONObject.getString("parentId"))) {
String parentId = equipjSONObject.getString("parentId");
if (StringUtils.isNotBlank(parentId)) {
return getBulid(Long.parseLong(parentId));
return getBulid(Long.parseLong(parentId));
}
}
return equipjSONObject;
}
/**
* 判断关联账户是否已关联
*
......@@ -491,7 +492,7 @@ public class OrgUsrController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getAmosId/{amosId}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "判断关联账户是否已关联", notes = "判断关联账户是否已关联")
public ResponseModel<Object> getAmosId(@PathVariable String amosId) {
public ResponseModel<Object> getAmosId(@PathVariable String amosId) {
return ResponseHelper.buildResponse(iOrgUsrService.amosIdExist(amosId));
}
......@@ -572,7 +573,7 @@ public class OrgUsrController extends BaseController {
public ResponseModel<List<OrgUsr>> getPersonListByCompanyId(@PathVariable String companyId) {
return ResponseHelper.buildResponse(iOrgUsrService.getPersonListByCompanyId(companyId));
}
/**
* 根据id获取单位人员列表
*
......
......@@ -1403,7 +1403,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());
......@@ -1412,7 +1412,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);
}
}
......
......@@ -75,13 +75,13 @@ public class DownloadFileService implements IDownloadFileService {
//装备信息
// appDownload.setDownloadEquipmentDatas(equipmentMapper.getDownloadEquipmentData());
appDownload.setDownloadEquipmentDatas(equipmentMapper.getDownloadEquipmentData());
//
// //性能指标模板
// appDownload.setEquipmentIndex(equipmentIndexService.list(queryWrapper1));
appDownload.setEquipmentIndex(equipmentIndexService.list());
//
// //性能指标
// appDownload.setEquipmentSpecificIndexs(equipmentSpecificIndexSerivce.list(queryWrapper));
appDownload.setEquipmentSpecificIndexs(equipmentSpecificIndexSerivce.list());
//仓库
appDownload.setWarehouseStructure(warehouseStructureService.list());
......
......@@ -1067,6 +1067,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{
......
......@@ -267,7 +267,7 @@ 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));
......@@ -277,7 +277,7 @@ public class AlertSubmittedController extends BaseController {
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") ;
definitions.put("$companyName", null == companyName ? "" : companyName);
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
......@@ -9,6 +10,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;
......@@ -422,7 +424,22 @@ 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("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 +465,11 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
throw new RuntimeException("报送失败,系统异常!");
}
}
/**
* 根据id 修改警情 type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案
*/
......
......@@ -8,6 +8,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.ArrayList;
......@@ -303,9 +304,16 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Override
public Boolean save(AlertSubmittedDto alertSubmittedDto, String userName) throws Exception {
try {
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);
......@@ -355,7 +363,10 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
String ids = calledRo.getIds();
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->{
......@@ -508,7 +519,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
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,14 +529,15 @@ 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.getRecDate(),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());
......@@ -743,7 +755,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
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()):"");
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);
}
......@@ -1152,10 +1177,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
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("$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("$contactUser",alertCalled.getContactUser());
definitions.put("$contactPhone",alertCalled.getContactPhone());
definitions.put("$recDate", DateUtils.convertDateToString(new Date(), DateUtils.DATE_TIME_PATTERN));
String content = getTaskInformation( template.getContent(),definitions);
template.setContent(content);
TemplateDto templateDto = new TemplateDto();
......
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.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonShiftDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyShiftDto;
import com.yeejoin.amos.boot.module.common.api.entity.DutyShift;
import com.yeejoin.amos.boot.module.common.api.mapper.DutyShiftMapper;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
......@@ -129,6 +131,8 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
@Autowired
private AircraftServiceImpl aircraftServiceImpl;
@Autowired
private DutyShiftMapper dutyShiftMapper;
@Override
public PowerTransferSimpleDto getPowerTransferList(Long alertCalledId) {
......@@ -295,11 +299,58 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
}
if (fireCarDto.getId() != null) {
int num = 0;
num = iDutyCarService.getDutyCarCount(Long.valueOf(fireCarDto.getId()));
fireCarDto.setPersonCount(num);
try {
int num;
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());
}
});
List<Map<String, Object>> list = iDutyCarService.list(null, beginDate, endDate);
num = (int) list.stream().filter(e -> e.get("carId").equals(fireCarDto.getId()) && ((List<DutyPersonShiftDto>) e.get("dutyShift")).get(0).getShiftName().equals(dutyShiftName[0])).count();
fireCarDto.setPersonCount(num);
} catch (ParseException e) {
e.printStackTrace();
}
}
fireCarDtoList.add(fireCarDto);
});
}
......
......@@ -1938,7 +1938,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());
......
......@@ -1270,7 +1270,8 @@ 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 = JSONObject.parseObject(latentDangerBo.getReformJson());
JSONObject reformJsonObject = executeParam.getFlowJson();
if (ValidationUtil.isEmpty(reformJsonObject)) {
reformJsonObject = new JSONObject();
}
......
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());
}
}
......@@ -62,31 +62,33 @@ public class EquipmentInformController extends BaseController {
return ResponseHelper.buildResponse(code);
}
/**
* 新增设备告知单
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
/**
* 暂存新增设备告知单 有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);
return ResponseHelper.buildResponse(model);
model = equipmentInformServiceImpl.createEquipmentInform(model,getSelectedOrgInfo());
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
* 提交设备告知单
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/updateEquipmentInform")
@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));
@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()));
}
......@@ -100,7 +102,7 @@ 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));
}
......@@ -153,8 +155,80 @@ public class EquipmentInformController extends BaseController {
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));
}
......
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());
}
}
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;
/**
* 设备告知单服务实现类
......@@ -47,6 +64,9 @@ public class EquipmentInformServiceImpl extends BaseService<EquipmentInformDto,E
@Autowired
SourceFileServiceImpl sourceFileService;
@Autowired
WorkflowFeignService workflowFeignService;
@Autowired
EquipmentServiceImpl equipmentServiceImpl;
......@@ -60,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;
/**
* 分页查询
*/
......@@ -75,32 +106,26 @@ public class EquipmentInformServiceImpl extends BaseService<EquipmentInformDto,E
}
@Override
public EquipmentInformDto createEquipmentInform(EquipmentInformDto model) {
// 获取用户所在单位 保存施工单位所属信息
OrgUsr myUnit = null;
AgencyUserModel user = Privilege.agencyUserClient.getme().getResult();
List<CompanyModel> companys = user.getCompanys();
for(CompanyModel c : companys) {
myUnit = iOrgUsrService.getOne(new LambdaQueryWrapper<OrgUsr>().eq(OrgUsr::getIsDelete,false).eq(OrgUsr::getAmosOrgId,c.getSequenceNbr()));
}
if(myUnit == null) {
throw new BadRequest("该用户非施工单位人员无法创建告知单");
}
// 判断是暂存还是提交
if(EquipmentInformStatusEnum.未接收.getCode().equals(model.getInformStatus())) { // 提交判断日期
if(model.getPlanProductDate() == null) {
throw new BadRequest("未填写计划施工日期");
public EquipmentInformDto createEquipmentInform(EquipmentInformDto model, ReginParams userInfo) {
model.setInformStatus(EquipmentInformStatusEnum.暂存.getCode());
if(model.getSequenceNbr() == null) { // 新增
// 获取用户所在单位 保存施工单位所属信息
OrgUsr myUnit = null;
AgencyUserModel user = Privilege.agencyUserClient.getme().getResult();
List<CompanyModel> companys = user.getCompanys();
for(CompanyModel c : companys) {
myUnit = iOrgUsrService.getOne(new LambdaQueryWrapper<OrgUsr>().eq(OrgUsr::getIsDelete,false).eq(OrgUsr::getAmosOrgId,c.getSequenceNbr()));
}
if(( model.getPlanProductDate().getTime() - System.currentTimeMillis() ) < 3*24*60*60*1000 ) {
throw new BadRequest("计划施工日期比现在时间至少提前3天");
if(myUnit == null) {
throw new BadRequest("该用户非施工单位人员无法创建告知单");
}
model.setProductInformDate(new Date());
model.setProductUnitId(myUnit.getSequenceNbr());
model.setProductUnit(myUnit.getBizOrgName());
model = this.createWithModel(model);
} else {
model = this.updateWithModel(model);
}
model.setProductInformDate(new Date());
model.setProductUnitId(myUnit.getSequenceNbr());
model.setProductUnit(myUnit.getBizOrgName());
model = this.createWithModel(model);
saveSourceFile(model);
return model;
}
......@@ -130,6 +155,303 @@ public class EquipmentInformServiceImpl extends BaseService<EquipmentInformDto,E
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;
}
@Override
public EquipmentInformDto queryDtoBySeq(Long sequenceNbr) {
EquipmentInformDto result = this.queryBySeq(sequenceNbr);
// 封装附件
Map attachment = sourceFileService.getAttachments(sequenceNbr);
result.setAttachments(attachment);
return result;
}
@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;
}
// 保存附件信息
public void saveSourceFile(EquipmentInformDto model) {
if (model.getAttachments() != null) {
......
......@@ -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
......@@ -2398,5 +2398,51 @@
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>
</databaseChangeLog>
......@@ -75,7 +75,7 @@
LEFT JOIN p_route_point prp ON prp.point_id = pi.point_id
WHERE
pi.point_id = #{pointId}
AND IF(prp.id, NOT FIND_IN_SET(pi.id,prp.exclude_items),' 1=1 ')
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
......@@ -59,4 +59,8 @@ redis.cache.failure.time=10800
failure.work.flow.processDefinitionKey=malfunction_repair
video.fegin.name=video
latentDanger.feign.name=AMOS-LATENT-DANGER
Knowledgebase.fegin.name=AMOS-API-KNOWLEDGEBASE
\ No newline at end of file
Knowledgebase.fegin.name=AMOS-API-KNOWLEDGEBASE
## 设备告知流程v1
inform.work.flow.processDefinitionKey=equipment_inform_process_v1
\ No newline at end of file
......@@ -780,5 +780,30 @@
</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