Commit e7103db7 authored by tianyiming's avatar tianyiming

Merge branch 'develop_tzs_register' into develop_tzs_new_patrol

# Conflicts: # amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/pom.xml
parents 84327cb7 b02f60cf
......@@ -111,7 +111,7 @@ public class ControllerAop {
urls.add("/tcm/base-institution/register");
urls.add("/tcm/base-individuality/person/register");
urls.add("/tcm/userInfo/arrangement-statistic");
urls.add("/tcm/userInfo/arrangement-statistic");
urls.add("/tcm/userInfo/getPersonType");
// 获取请求路径
for (String uri : urls) {
Pattern p = Pattern.compile(uri);
......
......@@ -171,6 +171,7 @@ public class DataDictionaryController extends BaseController {
// 数据字典还原 by kongfm 2021-09-09
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.eq("is_delete", false);
queryWrapper.orderByAsc("sort_num");
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE + type)) {
......
package com.yeejoin.amos.api.openapi.controller;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.Map;
import java.util.logging.SimpleFormatter;
import com.yeejoin.amos.api.openapi.enums.FileFolderPathEnum;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -39,7 +43,7 @@ public class FilesController {
@RequestBody MultipartFile file) throws Exception
{
logger.info(file);
JSONObject jsonObj = uploadFile(file,"cylinder");
JSONObject jsonObj = uploadFile(file,FileFolderPathEnum.CYLINDER.getPath());
return ResponseHelper.buildResponse(jsonObj.toString());
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
......@@ -49,7 +53,7 @@ public class FilesController {
@RequestBody MultipartFile file) throws Exception
{
logger.info(file);
JSONObject jsonObj = uploadFile(file,"csei");
JSONObject jsonObj = uploadFile(file, FileFolderPathEnum.JY.getPath());
return ResponseHelper.buildResponse(jsonObj.toString());
}
......@@ -57,8 +61,10 @@ public class FilesController {
if (ValidationUtil.isEmpty(file)){
throw new BadRequest("参数校验失败.");
}
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFileFree(file, "tzs/"+tag);
Date today = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyyMM");
String path = format.format(today);
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFileFree(file, "tzs/" + tag + "/" + path);
JSONObject jsonObj = new JSONObject();
if (date != null) {
Map<String, String> map = date.getResult();
......@@ -76,16 +82,17 @@ public class FilesController {
@ApiOperation(value = "上传附件")
@PostMapping("/supma")
public ResponseModel<JSONObject> upload(@RequestBody MultipartFile file){
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFile(file);
JSONObject jsonObj = new JSONObject();
if (date != null) {
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
String urlString=it.next();
jsonObj.put("fileUrl", urlString);
jsonObj.put("fileName", map.get(urlString));
}
return ResponseHelper.buildResponse(jsonObj);
JSONObject jsonObject = uploadFile(file, FileFolderPathEnum.JG.getPath());
// FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFile(file);
// JSONObject jsonObj = new JSONObject();
// if (date != null) {
// Map<String, String> map = date.getResult();
// Iterator<String> it = map.keySet().iterator();
// String urlString=it.next();
// jsonObj.put("fileUrl", urlString);
// jsonObj.put("fileName", map.get(urlString));
// }
return ResponseHelper.buildResponse(jsonObject);
}
}
package com.yeejoin.amos.api.openapi.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum FileFolderPathEnum {
/**
* 小程序
*/
WE_APP("app","/app"),
/**
* 96333
*/
ELEVATOR("elevator","/elevator"),
/**
* 气瓶
*/
CYLINDER("cylinder","/cylinder"),
/**
* 一码通
*/
YMT("ymt","/ymt"),
/**
* 两个规定
*/
PATROL("patrol","/patrol"),
/**
* TCM
*/
TCM("tcm","/tcm"),
/**
* 监管
*/
JG("jg","/supma"),
/**
* 检验报告
*/
JY("jg","/csei")
;
private String module;
private String path;
}
......@@ -67,4 +67,10 @@ public class AlertFormRecordDto extends BaseDto {
@ApiModelProperty(value = "备注")
private String remarks;
@ApiModelProperty(value = "信息来源(1:警情报送,2:救援过程,3:警情编辑)")
private String sourcesInfo;
@ApiModelProperty(value = "操作人员真实姓名")
private String recUserRealName;
}
......@@ -111,4 +111,16 @@ public class AlertFormRecord extends BaseEntity {
@TableField("remarks")
private String remarks;
/**
* 信息来源(1:警情报送,2:救援过程,3:警情编辑)
*/
@TableField("sources_info")
private String sourcesInfo;
/**
* 操作人员真实姓名
*/
@TableField("rec_user_real_name")
private String recUserRealName;
}
package com.yeejoin.amos.boot.module.elevator.api.enums;
/**
* 信息来源枚举(1:警情报送,2:救援过程,3:警情编辑)
*/
public enum SourcesInfoEnum {
Submit(1, "警情报送"), Process(2, "救援过程"), Edit(3, "警情编辑");
/**
* 编码
*/
private final Integer code;
/**
* 名称
*/
private final String name;
// 构造方法
SourcesInfoEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public static SourcesInfoEnum getEnum(Integer code) {
for (SourcesInfoEnum liftDirectionEnum : SourcesInfoEnum.values()) {
if (liftDirectionEnum.getCode().equals(code)) {
return liftDirectionEnum;
}
}
return null;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
}
......@@ -13,7 +13,7 @@ import java.util.List;
*/
public interface IAlertDispatchStatisticsService {
void statisticalGeneration();
void statisticalGeneration(String type);
List<AlertDispatchStatistics> getList(String date);
}
......@@ -19,10 +19,9 @@ public interface IAlertFormRecordService {
/**
* 保存警情修改记录
*
* @param map 包含新旧数据的map
* @return
*/
ResponseModel<Object> saveAlertFormRecord(Map<String, AlertFormRecordDto> map);
ResponseModel<Object> saveAlertFormRecord(AlertFormRecordDto record);
/**
* 根据警情id查询所有修改记录
......
......@@ -13,7 +13,7 @@ import java.util.List;
*/
public interface IAlertMaintenanceUnitStatisticsService {
void statisticalGeneration();
void statisticalGeneration(String type);
List<AlertMaintenanceUnitStatistics> getList(String date);
......
......@@ -13,7 +13,7 @@ import java.util.List;
*/
public interface IAlertPlaceStatisticsService {
void statisticalGeneration();
void statisticalGeneration(String type);
List<AlertPlaceStatistics> placeList(String date);
}
......@@ -13,7 +13,7 @@ import java.util.List;
*/
public interface IAlertRescueStatisticsService {
void statisticalGeneration();
void statisticalGeneration(String type);
List<AlertRescueStatistics> getList(String date);
}
......@@ -8,7 +8,7 @@ import java.util.List;
public interface IAlertStatisticsService {
void statisticalGeneration();
void statisticalGeneration(String type);
List<AlertStatistics> getList(String date) throws ParseException;
}
......@@ -13,7 +13,7 @@ import java.util.List;
*/
public interface IAlertUseUnitStatisticsService {
void statisticalGeneration();
void statisticalGeneration(String type);
List<AlertUseUnitStatistics> getList(String date);
}
......@@ -4,6 +4,8 @@ package com.yeejoin.amos.boot.module.elevator.api.service;
import com.yeejoin.amos.boot.module.elevator.api.dto.RescueProcessDto;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import java.text.ParseException;
/**
* 救援过程表接口类
*
......@@ -24,7 +26,7 @@ public interface IRescueProcessService {
* @param rescueProcessDto
* @return
*/
Boolean updateByAlertId(RescueProcessDto rescueProcessDto, AgencyUserModel sendUser);
Boolean updateByAlertId(RescueProcessDto rescueProcessDto, AgencyUserModel sendUser) throws ParseException;
/**
* 根据警情id 更新救援过程表
......
......@@ -13,6 +13,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.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.common.biz.service.impl.MaintenanceCompanyServiceImpl;
import com.yeejoin.amos.boot.module.elevator.api.enums.SourcesInfoEnum;
import com.yeejoin.amos.boot.module.elevator.biz.service.impl.*;
import com.yeejoin.amos.boot.module.elevator.api.dto.*;
import com.yeejoin.amos.boot.module.elevator.api.entity.*;
......@@ -20,6 +21,7 @@ import com.yeejoin.amos.boot.module.elevator.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.elevator.api.service.TzsAuthService;
import com.yeejoin.amos.boot.module.elevator.biz.utils.AlertBeanDtoVoUtils;
import com.yeejoin.amos.boot.module.elevator.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.boot.module.elevator.flc.biz.service.impl.AlertFormRecordServiceImpl;
import com.yeejoin.amos.component.feign.utils.FeignUtil;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
......@@ -51,6 +53,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
......@@ -112,6 +115,9 @@ public class AlertCalledController extends BaseController {
private ElevatorServiceImpl iElevatorService;
@Autowired
private AlertFormRecordServiceImpl alertFormRecordService;
@Autowired
CtiServiceImpl ctiService;
/**
......@@ -141,6 +147,31 @@ public class AlertCalledController extends BaseController {
}
AgencyUserModel userModel = reginParams.getUserModel();
alertCalledObjsDto = iAlertCalledService.createAlertCalled(alertCalledObjsDto, userModel);
try {
//更新警情历史记录表
AlertCalledDto alertCalledDto = alertCalledObjsDto.getAlertCalledDto();
List<AlertFormValue> alertFormValue = alertCalledObjsDto.getAlertFormValue();
HashMap<String, String> formMap = new HashMap<>();
alertFormValue.forEach(x-> formMap.put(x.getFieldCode(),x.getFieldValue()));
AlertFormRecordDto alertFormRecordDto = new AlertFormRecordDto();
alertFormRecordDto.setAlertCalledId(alertCalledDto.getSequenceNbr());
alertFormRecordDto.setAlertTypeCode(alertCalledDto.getAlertSourceCode());
alertFormRecordDto.setName(alertCalledDto.getEmergencyPerson());
alertFormRecordDto.setPhone(alertCalledDto.getContactPhone());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
alertFormRecordDto.setTrappedTime(sdf.parse(formMap.getOrDefault("trapped_time", new Date().toString())));
alertFormRecordDto.setTrappedNum(Integer.parseInt(formMap.getOrDefault("trapped_num", "0")));
alertFormRecordDto.setInjuredNum(Integer.parseInt(formMap.getOrDefault("injured_num", "0")));
alertFormRecordDto.setDieNum(Integer.parseInt(formMap.getOrDefault("die_num", "0")));
alertFormRecordDto.setTrappedFloorNum(Integer.parseInt(formMap.getOrDefault("trapped_floor_num", "0")));
alertFormRecordDto.setIsLight("是".equals(formMap.get("is_light")) ? 1 : 0);
alertFormRecordDto.setDescription((String) formMap.getOrDefault("desc", ""));
alertFormRecordDto.setSourcesInfo(SourcesInfoEnum.Submit.getCode().toString());
alertFormRecordService.saveAlertFormRecord(alertFormRecordDto);
}catch (Exception e){
e.printStackTrace();
}
// 坐席接警后,辅屏由常态化切换为处置态
JSONObject jsonObject = new JSONObject();
......@@ -221,8 +252,7 @@ public class AlertCalledController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getAlertInfo")
@ApiOperation(httpMethod = "GET", value = "警情信息", notes = "警情信息")
public ResponseModel<AlertPaperInfoDto> getAlertInfo(@RequestParam Long alertId
) {
public ResponseModel<AlertPaperInfoDto> getAlertInfo(@RequestParam Long alertId) {
AlertCalled alertCalled = iAlertCalledService.getById(alertId);
AlertPaperInfoDto alertPaperInfoDto = new AlertPaperInfoDto();
alertPaperInfoDto.setAlertId(alertCalled.getSequenceNbr());
......
......@@ -33,13 +33,8 @@ public class AlertFormRecordController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/saveRecord")
@ApiOperation(httpMethod = "POST", value = "新增警情接警填报记录", notes = "新增警情接警填报记录")
public ResponseModel<Object> saveRecord(@RequestBody Map<String, AlertFormRecordDto> map) {
if (ObjectUtil.isNotEmpty(map.get("oldData")) && ObjectUtil.isNotEmpty(map.get("newData"))) {
return ResponseHelper.buildResponse(iAlertFormRecordService.saveAlertFormRecord(map));
} else {
return ResponseHelper.buildResponse("缺少数据");
}
public ResponseModel<Object> saveRecord(@RequestBody AlertFormRecordDto record) {
return ResponseHelper.buildResponse(iAlertFormRecordService.saveAlertFormRecord(record));
}
......
......@@ -55,8 +55,8 @@ public class StatisticsController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/statisticalGeneration")
@ApiOperation(httpMethod = "GET", value = "生成统计数据", notes = "生成统计数据")
public ResponseModel<Object> statisticalGeneration() {
alertStatisticsService.statisticalGeneration();
public ResponseModel<Object> statisticalGeneration(@RequestParam(value = "type", required = false) String type) {
alertStatisticsService.statisticalGeneration(type);
return ResponseHelper.buildResponse("success");
}
......@@ -106,8 +106,8 @@ public class StatisticsController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/rescueStatisticalGeneration")
@ApiOperation(httpMethod = "GET", value = "生成统计数据", notes = "生成统计数据")
public ResponseModel<Object> rescueStatisticalGeneration() {
alertRescueStatisticsService.statisticalGeneration();
public ResponseModel<Object> rescueStatisticalGeneration(@RequestParam(value = "type", required = false) String type) {
alertRescueStatisticsService.statisticalGeneration(type);
return ResponseHelper.buildResponse("success");
}
......@@ -156,8 +156,8 @@ public class StatisticsController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/statisticalPlaceGeneration")
@ApiOperation(httpMethod = "GET", value = "生成统计数据", notes = "生成统计数据")
public ResponseModel<Object> statisticalPlaceGeneration() {
alertPlaceStatisticsService.statisticalGeneration();
public ResponseModel<Object> statisticalPlaceGeneration(@RequestParam(value = "type", required = false) String type) {
alertPlaceStatisticsService.statisticalGeneration(type);
return ResponseHelper.buildResponse("success");
}
......@@ -205,8 +205,8 @@ public class StatisticsController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/statisticalUseUnitGeneration")
@ApiOperation(httpMethod = "GET", value = "生成统计数据", notes = "生成统计数据")
public ResponseModel<Object> statisticalUseUnitGeneration() {
alertUseUnitStatisticsService.statisticalGeneration();
public ResponseModel<Object> statisticalUseUnitGeneration(@RequestParam(value = "type", required = false) String type) {
alertUseUnitStatisticsService.statisticalGeneration(type);
return ResponseHelper.buildResponse("success");
}
......@@ -254,8 +254,8 @@ public class StatisticsController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/statisticalMaintenanceUnitGeneration")
@ApiOperation(httpMethod = "GET", value = "生成统计数据", notes = "生成统计数据")
public ResponseModel<Object> statisticalMaintenanceUnitGeneration() {
alertMaintenanceUnitStatisticsService.statisticalGeneration();
public ResponseModel<Object> statisticalMaintenanceUnitGeneration(@RequestParam(value = "type", required = false) String type) {
alertMaintenanceUnitStatisticsService.statisticalGeneration(type);
return ResponseHelper.buildResponse("success");
}
......@@ -302,8 +302,8 @@ public class StatisticsController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/statisticalDispatchGeneration")
@ApiOperation(httpMethod = "GET", value = "生成统计数据", notes = "生成统计数据")
public ResponseModel<Object> statisticalDispatchGeneration() {
alertDispatchStatisticsService.statisticalGeneration();
public ResponseModel<Object> statisticalDispatchGeneration(@RequestParam(value = "type", required = false) String type) {
alertDispatchStatisticsService.statisticalGeneration(type);
return ResponseHelper.buildResponse("success");
}
......
......@@ -158,39 +158,45 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
@Override
public Object selectAlertCalledById(Long id) {
if(redisUtils.hasKey(RedisKey.TZS_ALERTCALLED_ID+id)){
// if(false){
Object obj= redisUtils.get(RedisKey.TZS_ALERTCALLED_ID+id);
return obj;
}else{
// 警情基本信息
AlertCalled alertCalled = this.getById(id);
LambdaQueryWrapper<AlertFormValue> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AlertFormValue::getAlertCalledId, id);
// 警情动态表单数据
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
List<FormValue> formValue = new ArrayList<FormValue>();
if(list!=null&&list.size()>0) {
for (AlertFormValue alertFormValue : list) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), "text", alertFormValue.getFieldValue(),alertFormValue.getBlock());
formValue.add(value);
}
}
AlertCalledDto alertCalledDto = new AlertCalledDto();
BeanUtils.copyProperties(alertCalled,alertCalledDto);
Elevator elevator = new Elevator();
elevator.setRescueCode(Integer.valueOf(alertCalled.getDeviceId()));
elevator.setRegisterCode(alertCalled.getRegistrationCode());
Map<String,Object> map = iElevatorService.selectElevatorList(elevator);
if(!ObjectUtils.isEmpty(map)){
alertCalledDto.setAddress(String.valueOf(map.get("address")));
alertCalledDto.setProvince(String.valueOf(map.get("province")));
alertCalledDto.setCity(String.valueOf(map.get("city")));
alertCalledDto.setDistrict(String.valueOf(map.get("district")));
alertCalledDto.setUseStatus(String.valueOf(map.get("useStatus")));
alertCalledDto.setUseSiteCategory(ObjectUtils.isEmpty(map.get("useSiteCategory")) || "null".equals(String.valueOf(map.get("useSiteCategory"))) ? null : String.valueOf(map.get("useSiteCategory")));
alertCalledDto.setUseUnit(String.valueOf(map.get("useUnit")));
alertCalledDto.setRegionCode(String.valueOf(map.get("regionCode")));
AlertCalledFormDto alertCalledFormVo = getAlertCalledFormDto(id);
redisUtils.set(RedisKey.TZS_ALERTCALLED_ID+id, JSON.toJSON(alertCalledFormVo),time);
return alertCalledFormVo;
}
}
public AlertCalledFormDto getAlertCalledFormDto(Long id) {
// 警情基本信息
AlertCalled alertCalled = this.getById(id);
LambdaQueryWrapper<AlertFormValue> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AlertFormValue::getAlertCalledId, id);
// 警情动态表单数据
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
List<FormValue> formValue = new ArrayList<FormValue>();
if(list!=null&&list.size()>0) {
for (AlertFormValue alertFormValue : list) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), "text", alertFormValue.getFieldValue(),alertFormValue.getBlock());
formValue.add(value);
}
}
AlertCalledDto alertCalledDto = new AlertCalledDto();
BeanUtils.copyProperties(alertCalled,alertCalledDto);
Elevator elevator = new Elevator();
elevator.setRescueCode(Integer.valueOf(alertCalled.getDeviceId()));
elevator.setRegisterCode(alertCalled.getRegistrationCode());
Map<String,Object> map = iElevatorService.selectElevatorList(elevator);
if(!ObjectUtils.isEmpty(map)){
alertCalledDto.setAddress(String.valueOf(map.get("address")));
alertCalledDto.setProvince(String.valueOf(map.get("province")));
alertCalledDto.setCity(String.valueOf(map.get("city")));
alertCalledDto.setDistrict(String.valueOf(map.get("district")));
alertCalledDto.setUseStatus(String.valueOf(map.get("useStatus")));
alertCalledDto.setUseSiteCategory(ObjectUtils.isEmpty(map.get("useSiteCategory")) || "null".equals(String.valueOf(map.get("useSiteCategory"))) ? null : String.valueOf(map.get("useSiteCategory")));
alertCalledDto.setUseUnit(String.valueOf(map.get("useUnit")));
alertCalledDto.setRegionCode(String.valueOf(map.get("regionCode")));
}
// 数据源切换
// LambdaQueryWrapper<Elevator> elevatorQueryWrapper = new LambdaQueryWrapper<>();
// elevatorQueryWrapper.eq(Elevator::getRescueCode, alertCalled.getDeviceId());
......@@ -206,16 +212,13 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
// alertCalledDto.setUseUnit(elevator.getUseUnit());
// alertCalledDto.setRegionCode(elevator.getRegionCode());
// }
String voiceRecord = "";
VoiceRecordFile temp = voiceRecordFileServiceImpl.getOne(new LambdaQueryWrapper<VoiceRecordFile>().eq(VoiceRecordFile::getAlertId,id).eq(VoiceRecordFile::getAlertStageCode,"860").orderByAsc(VoiceRecordFile::getTelStartTime).last("limit 1"));
if(temp != null) {
voiceRecord = temp.getFilePath();
}
AlertCalledFormDto alertCalledFormVo = new AlertCalledFormDto(alertCalledDto, formValue,voiceRecord);
redisUtils.set(RedisKey.TZS_ALERTCALLED_ID+id, JSON.toJSON(alertCalledFormVo),time);
return alertCalledFormVo;
String voiceRecord = "";
VoiceRecordFile temp = voiceRecordFileServiceImpl.getOne(new LambdaQueryWrapper<VoiceRecordFile>().eq(VoiceRecordFile::getAlertId, id).eq(VoiceRecordFile::getAlertStageCode,"860").orderByAsc(VoiceRecordFile::getTelStartTime).last("limit 1"));
if(temp != null) {
voiceRecord = temp.getFilePath();
}
AlertCalledFormDto alertCalledFormVo = new AlertCalledFormDto(alertCalledDto, formValue,voiceRecord);
return alertCalledFormVo;
}
public void selectAlertCalledByIdNew(AlertPaperInfoDto alertCalled) {
......
......@@ -31,14 +31,21 @@ public class AlertDispatchStatisticsServiceImpl extends BaseService<AlertDispatc
@Autowired
private AlertStatisticsServiceImpl alertStatisticsService;
@Override
@Scheduled(cron = "0 0 0 1 * ?")
@SchedulerLock(name = "AlertDispatchStatisticsServiceImpl", lockAtMostFor = "PT10M", lockAtLeastFor = "PT10M")
public void statisticalGeneration() {
public void statisticalGenerationTask() {
statisticalGeneration(null);
}
@Override
public void statisticalGeneration(String type) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.MONTH, -1);
if (ObjectUtils.isEmpty(type)) {
cal.add(Calendar.MONTH, -1);
}
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
Date firstDayOfMonth = cal.getTime();
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
......
......@@ -33,16 +33,23 @@ public class AlertMaintenanceUnitStatisticsServiceImpl extends BaseService<Alert
@Autowired
private AlertStatisticsServiceImpl alertStatisticsService;
@Override
@Scheduled(cron = "0 0 0 1 * ?")
@SchedulerLock(name = "AlertMaintenanceUnitStatisticsServiceImpl", lockAtMostFor = "PT10M", lockAtLeastFor = "PT10M")
public void statisticalGeneration() {
public void statisticalGenerationTask(){
statisticalGeneration(null);
}
@Override
public void statisticalGeneration(String type) {
DecimalFormat decimalFormat = new DecimalFormat("0.00");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
ArrayList<AlertMaintenanceUnitStatistics> list = new ArrayList<>();
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.MONTH, -1);
if (ObjectUtils.isEmpty(type)){
cal.add(Calendar.MONTH, -1);
}
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
Date firstDayOfMonth = cal.getTime();
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
......
......@@ -27,15 +27,21 @@ import java.util.*;
public class AlertPlaceStatisticsServiceImpl extends BaseService<AlertPlaceStatisticsDto, AlertPlaceStatistics, AlertPlaceStatisticsMapper> implements IAlertPlaceStatisticsService {
@Override
@Scheduled(cron = "0 0 0 1 * ?")
@SchedulerLock(name = "AlertPlaceStatisticsServiceImpl", lockAtMostFor = "PT10M", lockAtLeastFor = "PT10M")
public void statisticalGeneration() {
public void statisticalGenerationTask(){
statisticalGeneration(null);
}
@Override
public void statisticalGeneration(String type) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
DecimalFormat decimalFormat = new DecimalFormat("0.00");
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.MONTH, -1);
if (ObjectUtils.isEmpty(type)){
cal.add(Calendar.MONTH, -1);
}
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
Date firstDayOfMonth = cal.getTime();
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
......
......@@ -32,14 +32,19 @@ public class AlertRescueStatisticsServiceImpl extends BaseService<AlertRescueSta
@Autowired
private AlertStatisticsServiceImpl alertStatisticsService;
@Override
@Scheduled(cron = "0 0 0 1 * ?")
@SchedulerLock(name = "AlertRescueStatisticsServiceImpl", lockAtMostFor = "PT10M", lockAtLeastFor = "PT10M")
public void statisticalGeneration() {
public void statisticalGenerationTask(){
statisticalGeneration(null);
}
@Override
public void statisticalGeneration(String type) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.MONTH, -1);
if (ObjectUtils.isEmpty(type)){
cal.add(Calendar.MONTH, -1);
}
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
Date firstDayOfMonth = cal.getTime();
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
......
......@@ -31,15 +31,20 @@ public class AlertStatisticsServiceImpl extends BaseService<AlertStatisticsDto,
@Autowired
RedisUtils redisUtils;
@Override
@Scheduled(cron = "0 0 0 1 * ?")
@SchedulerLock(name = "AlertStatisticsServiceImpl", lockAtMostFor = "PT10M", lockAtLeastFor = "PT10M")
public void statisticalGeneration() {
public void statisticalGenerationTask(){
statisticalGeneration(null);
}
@Override
public void statisticalGeneration(String type) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.MONTH, -1);
if (ObjectUtils.isEmpty(type)){
cal.add(Calendar.MONTH, -1);
}
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
Date firstDayOfMonth = cal.getTime();
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
......
......@@ -27,15 +27,20 @@ import java.util.*;
@Service
public class AlertUseUnitStatisticsServiceImpl extends BaseService<AlertUseUnitStatisticsDto, AlertUseUnitStatistics, AlertUseUnitStatisticsMapper> implements IAlertUseUnitStatisticsService {
@Override
@Scheduled(cron = "0 0 0 1 * ?")
@SchedulerLock(name = "AlertUseUnitStatisticsServiceImpl", lockAtMostFor = "PT10M", lockAtLeastFor = "PT10M")
public void statisticalGeneration() {
public void statisticalGenerationTask(){
statisticalGeneration(null);
}
@Override
public void statisticalGeneration(String type) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.MONTH, -1);
if (ObjectUtils.isEmpty(type)){
cal.add(Calendar.MONTH, -1);
}
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
Date firstDayOfMonth = cal.getTime();
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
......
......@@ -9,18 +9,18 @@ import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.elevator.api.dto.DispatchPaperFormDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.DispatchTaskDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.RescueProcessDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.*;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.elevator.api.entity.DispatchPaper;
import com.yeejoin.amos.boot.module.elevator.api.entity.DispatchTask;
import com.yeejoin.amos.boot.module.elevator.api.entity.RescueProcess;
import com.yeejoin.amos.boot.module.elevator.api.enums.DispatchPaperEnums;
import com.yeejoin.amos.boot.module.elevator.api.enums.SourcesInfoEnum;
import com.yeejoin.amos.boot.module.elevator.api.mapper.RescueProcessMapper;
import com.yeejoin.amos.boot.module.elevator.api.service.IRescueProcessService;
import com.yeejoin.amos.boot.module.elevator.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.boot.module.elevator.flc.biz.service.impl.AlertFormRecordServiceImpl;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -31,6 +31,7 @@ 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;
/**
......@@ -58,6 +59,9 @@ public class RescueProcessServiceImpl extends BaseService<RescueProcessDto,Rescu
RepairConsultServiceImpl repairConsultServiceImpl;
@Autowired
private AlertFormRecordServiceImpl alertFormRecordService;
@Autowired
AlertCalledServiceImpl iAlertCalledService;
@Autowired
......@@ -178,6 +182,29 @@ public class RescueProcessServiceImpl extends BaseService<RescueProcessDto,Rescu
if (Boolean.TRUE.equals(rescueProcessDto.getCasualtiesStatus())){
updateMessage(rescueProcessDto, "injured_num");
updateMessage(rescueProcessDto, "die_num");
try {
//更新警情历史记录表
AlertCalledFormDto calledFormDto = iAlertCalledService.getAlertCalledFormDto(rescueProcessDto.getAlertId());
List<FormValue> dynamicFormAlert = calledFormDto.getDynamicFormAlert();
HashMap<String, String> formMap = new HashMap<>();
dynamicFormAlert.forEach(x->formMap.put(x.getKey(),x.getValue()));
AlertCalledDto alertCalledDto = calledFormDto.getAlertCalledDto();
AlertFormRecordDto alertFormRecordDto = new AlertFormRecordDto();
alertFormRecordDto.setAlertCalledId(rescueProcessDto.getAlertId());
alertFormRecordDto.setAlertTypeCode(alertCalledDto.getAlarmTypeCode());
alertFormRecordDto.setName(alertCalledDto.getEmergencyPerson());
alertFormRecordDto.setPhone(alertCalledDto.getEmergencyCall());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
alertFormRecordDto.setTrappedTime(sdf.parse(formMap.getOrDefault("trapped_time",new Date().toString())));
alertFormRecordDto.setTrappedNum(Integer.valueOf(formMap.getOrDefault("trapped_num","0")));
alertFormRecordDto.setTrappedFloorNum(Integer.parseInt(formMap.getOrDefault("trapped_floor_num","0")));
alertFormRecordDto.setInjuredNum(Integer.valueOf(rescueProcessDto.getCasualtiesInfo()));
alertFormRecordDto.setDieNum(Integer.valueOf(rescueProcessDto.getDieNum()));
alertFormRecordDto.setSourcesInfo(SourcesInfoEnum.Process.getCode().toString());
alertFormRecordService.saveAlertFormRecord(alertFormRecordDto);
}catch (Exception e){
e.printStackTrace();
}
redisUtils.del(RedisKey.TZS_ALERTCALLED_ID+rescueProcessDto.getAlertId());
}
rescueProcessDto.setDispatchTime(null);
......
package com.yeejoin.amos.boot.module.elevator.flc.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
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.biz.utils.CommonResponseUtil;
......@@ -11,23 +12,23 @@ import com.yeejoin.amos.boot.module.elevator.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormRecord;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.elevator.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.elevator.api.enums.SourcesInfoEnum;
import com.yeejoin.amos.boot.module.elevator.api.mapper.AlertFormRecordMapper;
import com.yeejoin.amos.boot.module.elevator.api.service.IAlertFormRecordService;
import com.yeejoin.amos.boot.module.elevator.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.elevator.biz.service.impl.AlertFormValueServiceImpl;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.lang.reflect.Field;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -68,63 +69,65 @@ public class AlertFormRecordServiceImpl extends BaseService<AlertFormRecordDto,
}
/**
* 用户单位信息redis获取
**/
public ReginParams getReginParams() {
return JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
}
/**
* 保存警情修改记录
*
* @param map 包含新旧数据的map
* @return
*/
@Override
@Transactional
public ResponseModel saveAlertFormRecord(Map<String, AlertFormRecordDto> map) {
public ResponseModel saveAlertFormRecord(AlertFormRecordDto data) {
try {
AlertFormRecordDto oldData = map.get("oldData");
AlertFormRecordDto newData = map.get("newData");
List<AlertFormRecord> recordByCalledId = alertFormRecordMapper.getRecordByCalledId(newData.getAlertCalledId());
AlertFormRecord oldRecord = new AlertFormRecord();
//第一次修改,保存旧记录
if (recordByCalledId.isEmpty()) {
BeanUtils.copyProperties(oldData, oldRecord);
oldRecord.setEditTime(oldData.getTrappedTime());
alertFormRecordMapper.insert(oldRecord);
}
AlertFormRecord record = new AlertFormRecord();
BeanUtils.copyProperties(newData, record);
BeanUtils.copyProperties(data, record);
AgencyUserModel userModel = this.getReginParams().getUserModel();
record.setEditTime(new Date());
record.setRecUserRealName(userModel.getRealName());
record.setSourcesInfo(Objects.requireNonNull(SourcesInfoEnum.getEnum(Integer.valueOf(record.getSourcesInfo()))).getName());
alertFormRecordMapper.insert(record);
// 更新警情基本信息
Long alertCalled = record.getAlertCalledId();
if (!record.getName().equals(oldRecord.getName())){
LambdaUpdateWrapper<AlertCalled> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(AlertCalled::getSequenceNbr, alertCalled);
wrapper.set(AlertCalled::getEmergencyPerson, record.getName());
alertCalledServiceImpl.update(wrapper);
}
LambdaQueryWrapper<AlertFormValue> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AlertFormValue::getAlertCalledId, alertCalled);
// 更新警情动态表单数据
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
HashMap<String, Object> listMap = new HashMap<>();
list.forEach(x -> listMap.put(x.getFieldCode(), x.getFieldValue()));
for (Field field : record.getClass().getDeclaredFields()) {
// 设置为可访问,以访问私有属性
field.setAccessible(true);
String fieldName = convertToUnderline(field.getName());
Object value = field.get(record);
//“是否有光照” 转 文字存储
if ("is_light".equals(fieldName)){
value = (value.equals(1) ? "是" : "否");
// 警情编辑时候更新警情动态表单数据
if (SourcesInfoEnum.Edit.getName().equals(record.getSourcesInfo())){
// 更新警情基本信息
if (!record.getName().equals(oldRecord.getName())){
LambdaUpdateWrapper<AlertCalled> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(AlertCalled::getSequenceNbr, alertCalled);
wrapper.set(AlertCalled::getEmergencyPerson, record.getName());
alertCalledServiceImpl.update(wrapper);
}
try {
//表tz_alert_form_value中的字典名称desc和表tz_alert_form_record中列名称description冲突,做特殊处理
if (listMap.containsKey(fieldName) || (listMap.containsKey("desc") && fieldName.equals("description"))) {
LambdaUpdateWrapper<AlertFormValue> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(AlertFormValue::getAlertCalledId, alertCalled);
wrapper.eq(AlertFormValue::getFieldCode, fieldName.equals("description") ? "desc" : fieldName);
wrapper.set(AlertFormValue::getFieldValue, value);
iAlertFormValueService.update(wrapper);
LambdaQueryWrapper<AlertFormValue> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AlertFormValue::getAlertCalledId, alertCalled);
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
HashMap<String, Object> listMap = new HashMap<>();
list.forEach(x -> listMap.put(x.getFieldCode(), x.getFieldValue()));
for (Field field : record.getClass().getDeclaredFields()) {
// 设置为可访问,以访问私有属性
field.setAccessible(true);
String fieldName = convertToUnderline(field.getName());
Object value = field.get(record);
//“是否有光照” 转 文字存储
if ("is_light".equals(fieldName)){
value = (value.equals(1) ? "是" : "否");
}
try {
//表tz_alert_form_value中的字典名称desc和表tz_alert_form_record中列名称description冲突,做特殊处理
if (listMap.containsKey(fieldName) || (listMap.containsKey("desc") && fieldName.equals("description"))) {
LambdaUpdateWrapper<AlertFormValue> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(AlertFormValue::getAlertCalledId, alertCalled);
wrapper.eq(AlertFormValue::getFieldCode, fieldName.equals("description") ? "desc" : fieldName);
wrapper.set(AlertFormValue::getFieldValue, value);
iAlertFormValueService.update(wrapper);
}
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
}
redisUtils.del(RedisKey.TZS_ALERTCALLED_ID + alertCalled);
......
......@@ -174,12 +174,14 @@
af.check_results AS checkResult
FROM
( SELECT * FROM tz_cylinder_filling_record WHERE is_not_es IS NULL AND filling_before_id IS NOT NULL
AND filling_check_id IS NOT NULL LIMIT 5000 ) r
AND filling_check_id IS NOT NULL and LENGTH(filling_startTime) >= 10 LIMIT 5000 ) r
LEFT JOIN tz_cylinder_filling b ON b.filling_before_id = r.filling_before_id
AND r.filling_before_id IS NOT NULL and b.inspection_date NOT LIKE'16%'
AND date_format ( b.inspection_date, '%Y-%m-%d' ) = date_format ( r.filling_startTime, '%Y-%m-%d' ) and b.sequence_code is not null AND b.app_id is not null
LEFT JOIN tz_cylinder_filling_check af ON af.filling_check_id = r.filling_check_id
AND date_format ( af.inspection_date, '%Y-%m-%d' ) = date_format ( r.filling_startTime, '%Y-%m-%d' )
and LENGTH(b.inspection_date) >= 10
and LENGTH(af.inspection_date) >= 10
LEFT JOIN tz_cylinder_unit tcn ON tcn.app_id = r.app_id
</select>
......
......@@ -38,6 +38,7 @@
WHEN (SELECT COUNT(1)
FROM tz_cylinder_inspection ins
WHERE ins.app_id = tcu.app_id
and LENGTH(ins.next_inspection_date) >= 10
and TO_DAYS(ins.next_inspection_date) - TO_DAYS(NOW()) &lt;= 30) > 0 THEN
1
WHEN (SELECT COUNT(1) FROM view_unit_outofdate v WHERE v.credit_code = tcu.credit_code) > 0 THEN
......
......@@ -173,7 +173,7 @@ public class CylinderDateInfoServiceImpl extends BaseService<CylinderDateInfoDto
public void fixedDelayPageData() {
// 每天更新或者添加昨天的数据
//取时间
//取时间
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
......@@ -195,14 +195,14 @@ public class CylinderDateInfoServiceImpl extends BaseService<CylinderDateInfoDto
temp.setAppId(appid);
temp.setDeveloperAgency(token.getDeveloperAgency());
// 获取气瓶基本信息
Integer cylinder = cylinderInfoService.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, appid).between(CylinderInfo::getSyncDate, todayStr + " 00:00:00", todayStr + " 23:59:59"));
Integer cylinderUnit = cylinderUnitService.count(new LambdaQueryWrapper<CylinderUnit>().eq(CylinderUnit::getAppId, appid).between(CylinderUnit::getSyncDate, todayStr + " 00:00:00", todayStr + " 23:59:59"));
Integer tags = cylinderTagsService.count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId, appid).between(CylinderTags::getSyncDate, todayStr + " 00:00:00", todayStr + " 23:59:59"));
Integer inspection = cylinderInspectionService.count(new LambdaQueryWrapper<CylinderInspection>().eq(CylinderInspection::getAppId, appid).between(CylinderInspection::getSyncDate, todayStr + " 00:00:00", todayStr + " 23:59:59"));
Integer filling = cylinderFillingService.count(new LambdaQueryWrapper<CylinderFilling>().eq(CylinderFilling::getAppId, appid).between(CylinderFilling::getSyncDate, todayStr + " 00:00:00", todayStr + " 23:59:59"));
Integer fillingRecord = cylinderFillingRecordService.count(new LambdaQueryWrapper<CylinderFillingRecord>().eq(CylinderFillingRecord::getAppId, appid).between(CylinderFillingRecord::getSyncDate, todayStr + " 00:00:00", todayStr + " 23:59:59"));
Integer fillingCheck = cylinderFillingCheckService.count(new LambdaQueryWrapper<CylinderFillingCheck>().eq(CylinderFillingCheck::getAppId, appid).between(CylinderFillingCheck::getSyncDate, todayStr + " 00:00:00", todayStr + " 23:59:59"));
Integer examine = cylinderFillingExamineService.count(new LambdaQueryWrapper<CylinderFillingExamine>().eq(CylinderFillingExamine::getAppId, appid).between(CylinderFillingExamine::getSyncDate, todayStr + " 00:00:00", todayStr + " 23:59:59"));
Integer cylinder = cylinderInfoService.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, appid).between(CylinderInfo::getRecDate, todayStr + " 00:00:00", todayStr + " 23:59:59"));
Integer cylinderUnit = cylinderUnitService.count(new LambdaQueryWrapper<CylinderUnit>().eq(CylinderUnit::getAppId, appid).between(CylinderUnit::getRecDate, todayStr + " 00:00:00", todayStr + " 23:59:59"));
Integer tags = cylinderTagsService.count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId, appid).between(CylinderTags::getRecDate, todayStr + " 00:00:00", todayStr + " 23:59:59"));
Integer inspection = cylinderInspectionService.count(new LambdaQueryWrapper<CylinderInspection>().eq(CylinderInspection::getAppId, appid).between(CylinderInspection::getRecDate, todayStr + " 00:00:00", todayStr + " 23:59:59"));
Integer filling = cylinderFillingService.count(new LambdaQueryWrapper<CylinderFilling>().eq(CylinderFilling::getAppId, appid).between(CylinderFilling::getRecDate, todayStr + " 00:00:00", todayStr + " 23:59:59"));
Integer fillingRecord = cylinderFillingRecordService.count(new LambdaQueryWrapper<CylinderFillingRecord>().eq(CylinderFillingRecord::getAppId, appid).between(CylinderFillingRecord::getRecDate, todayStr + " 00:00:00", todayStr + " 23:59:59"));
Integer fillingCheck = cylinderFillingCheckService.count(new LambdaQueryWrapper<CylinderFillingCheck>().eq(CylinderFillingCheck::getAppId, appid).between(CylinderFillingCheck::getRecDate, todayStr + " 00:00:00", todayStr + " 23:59:59"));
Integer examine = cylinderFillingExamineService.count(new LambdaQueryWrapper<CylinderFillingExamine>().eq(CylinderFillingExamine::getAppId, appid).between(CylinderFillingExamine::getRecDate, todayStr + " 00:00:00", todayStr + " 23:59:59"));
Integer total = cylinder + cylinderUnit + tags + inspection + filling + fillingRecord + fillingCheck + examine;
temp.setCylinderExamineInfo(examine);
temp.setCylinderUnit(cylinderUnit);
......@@ -273,14 +273,14 @@ public class CylinderDateInfoServiceImpl extends BaseService<CylinderDateInfoDto
logger.info("初始化数据时间{}", todayStr);
// 获取气瓶基本信息
Integer cylinder = cylinderInfoService.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, appid).notLike(CylinderInfo::getSyncDate, todayStr));
Integer cylinderUnit = cylinderUnitService.count(new LambdaQueryWrapper<CylinderUnit>().eq(CylinderUnit::getAppId, appid).notLike(CylinderUnit::getSyncDate, todayStr));
Integer tags = cylinderTagsService.count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId, appid).notLike(CylinderTags::getSyncDate, todayStr));
Integer inspection = cylinderInspectionService.count(new LambdaQueryWrapper<CylinderInspection>().eq(CylinderInspection::getAppId, appid).notLike(CylinderInspection::getSyncDate, todayStr));
Integer filling = cylinderFillingService.count(new LambdaQueryWrapper<CylinderFilling>().eq(CylinderFilling::getAppId, appid).notLike(CylinderFilling::getSyncDate, todayStr));
Integer fillingRecord = cylinderFillingRecordService.count(new LambdaQueryWrapper<CylinderFillingRecord>().eq(CylinderFillingRecord::getAppId, appid).notLike(CylinderFillingRecord::getSyncDate, todayStr));
Integer fillingCheck = cylinderFillingCheckService.count(new LambdaQueryWrapper<CylinderFillingCheck>().eq(CylinderFillingCheck::getAppId, appid).notLike(CylinderFillingCheck::getSyncDate, todayStr));
Integer examine = cylinderFillingExamineService.count(new LambdaQueryWrapper<CylinderFillingExamine>().eq(CylinderFillingExamine::getAppId, appid).notLike(CylinderFillingExamine::getSyncDate, todayStr));
Integer cylinder = cylinderInfoService.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, appid).notLike(CylinderInfo::getRecDate, todayStr));
Integer cylinderUnit = cylinderUnitService.count(new LambdaQueryWrapper<CylinderUnit>().eq(CylinderUnit::getAppId, appid).notLike(CylinderUnit::getRecDate, todayStr));
Integer tags = cylinderTagsService.count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId, appid).notLike(CylinderTags::getRecDate, todayStr));
Integer inspection = cylinderInspectionService.count(new LambdaQueryWrapper<CylinderInspection>().eq(CylinderInspection::getAppId, appid).notLike(CylinderInspection::getRecDate, todayStr));
Integer filling = cylinderFillingService.count(new LambdaQueryWrapper<CylinderFilling>().eq(CylinderFilling::getAppId, appid).notLike(CylinderFilling::getRecDate, todayStr));
Integer fillingRecord = cylinderFillingRecordService.count(new LambdaQueryWrapper<CylinderFillingRecord>().eq(CylinderFillingRecord::getAppId, appid).notLike(CylinderFillingRecord::getRecDate, todayStr));
Integer fillingCheck = cylinderFillingCheckService.count(new LambdaQueryWrapper<CylinderFillingCheck>().eq(CylinderFillingCheck::getAppId, appid).notLike(CylinderFillingCheck::getRecDate, todayStr));
Integer examine = cylinderFillingExamineService.count(new LambdaQueryWrapper<CylinderFillingExamine>().eq(CylinderFillingExamine::getAppId, appid).notLike(CylinderFillingExamine::getRecDate, todayStr));
Integer total = cylinder + cylinderUnit + tags + inspection + filling + fillingRecord + fillingCheck + examine;
temp.setCylinderExamineInfo(examine);
temp.setCylinderUnit(cylinderUnit);
......
......@@ -377,6 +377,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
}
builder.query(boolMust);
builder.sort("inspectionDateMs",SortOrder.DESC);
builder.sort("sequenceNbr",SortOrder.DESC);
builder.from((pageNum - 1) * pageSize);
builder.size(pageSize);
......
......@@ -30,4 +30,6 @@ public interface TzsUserInfoMapper extends BaseMapper<TzsUserInfo> {
List<String> selectUserIds();
List<GroupAndPersonInfoDto> getUnitInfoByUserId(Long groupId);
String selectPostNameByUserId(String userId);
}
......@@ -196,7 +196,7 @@
LEFT JOIN privilege_company pc ON tui.unit_code = pc.company_code
WHERE
tzei.equip_category IS NOT NULL
AND tui.userId IS NOT NULL
AND tui.amos_user_id IS NOT NULL
AND tui.unit_code IS NOT NULL
AND pc.org_code IS NOT NULL
AND tzei.is_delete = '0'
......@@ -204,4 +204,8 @@
AND tzei.unit_type <![CDATA[<>]]> '检验检测机构'
AND tui.amos_user_id IN (SELECT USER_ID FROM privilege_group_user WHERE GROUP_SEQ = #{groupId})
</select>
<select id="selectPostNameByUserId" resultType="java.lang.String">
SELECT post_name FROM "tzs_user_info" WHERE amos_user_id = #{userId}
</select>
</mapper>
\ No newline at end of file
......@@ -29,6 +29,7 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.GroupModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -44,6 +45,7 @@ import java.util.*;
import java.util.stream.Collectors;
@Service
@Slf4j
public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserInfo, TzsUserInfoMapper> implements ITzsUserInfoService {
@Autowired
......@@ -443,14 +445,13 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
@Override
public Map<String, Object> getPersonType() {
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
if (ObjectUtils.isEmpty(reginParams)) {
String userId = RequestContext.getExeUserId();
if (ObjectUtils.isEmpty(userId)) {
return null;
}
String userId = reginParams.getUserModel().getUserId();
TzsUserInfo tzsUserInfo = tzsUserInfoMapper.selectOne(new QueryWrapper<TzsUserInfo>().eq("amos_user_id", userId));
String postName = tzsUserInfoMapper.selectPostNameByUserId(userId);
Map<String, Object> result = new HashMap<>();
result.put("postName", tzsUserInfo.getPostName());
result.put("postName", ObjectUtils.isEmpty(postName) ? null : postName);
return result;
}
......
......@@ -168,6 +168,11 @@
<version>4.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.0.0</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.apache.shardingsphere</groupId>-->
<!-- <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>-->
......
......@@ -7,10 +7,19 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.entity.mybatis.TaskBo;
import com.yeejoin.amos.patrol.business.entity.mybatis.TaskFeedbackBo;
import com.yeejoin.amos.patrol.business.param.*;
import com.yeejoin.amos.patrol.business.param.FeedbackParam;
import com.yeejoin.amos.patrol.business.param.RoutePointParam;
import com.yeejoin.amos.patrol.business.param.TaskPageParam;
import com.yeejoin.amos.patrol.business.param.TaskParam;
import com.yeejoin.amos.patrol.business.param.TaskStatisticsParam;
import com.yeejoin.amos.patrol.business.service.intfc.IPointService;
import com.yeejoin.amos.patrol.business.service.intfc.ITaskService;
import com.yeejoin.amos.patrol.business.util.*;
import com.yeejoin.amos.patrol.business.util.ClazzFieldUtil;
import com.yeejoin.amos.patrol.business.util.CommonResponse;
import com.yeejoin.amos.patrol.business.util.CommonResponseUtil;
import com.yeejoin.amos.patrol.business.util.DaoCriteria;
import com.yeejoin.amos.patrol.business.util.FileHelper;
import com.yeejoin.amos.patrol.business.util.TaskPageParamUtil;
import com.yeejoin.amos.patrol.business.vo.TaskStatisticsVo;
import com.yeejoin.amos.patrol.common.enums.TaskFeedbackType;
import com.yeejoin.amos.patrol.common.enums.TaskStatusEnum;
......@@ -34,17 +43,45 @@ import org.springframework.core.io.ClassPathResource;
import org.springframework.data.domain.Page;
import org.springframework.scheduling.annotation.Async;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
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.springframework.web.multipart.MultipartFile;
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.HttpServletResponse;
import javax.xml.transform.*;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import java.io.*;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
......@@ -890,5 +927,16 @@ public class TaskController extends AbstractBaseController{
return map;
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "图片上传按月分文件夹")
@PostMapping(value = "/imageUpload")
public ResponseModel<Object> uploadTaskFiles (@RequestBody MultipartFile file) {
if (ValidationUtil.isEmpty(file)){
throw new BadRequest("参数校验失败.");
}
Map fileMap = taskService.uploadFile(file);
return ResponseHelper.buildResponse(fileMap);
}
}
......@@ -2,6 +2,8 @@ package com.yeejoin.amos.patrol.business.param;
import com.yeejoin.amos.patrol.core.common.request.CommonPageable;
import java.util.List;
/**
* 计划执行查询参数
* @author suhuiguang
......@@ -68,6 +70,18 @@ public class PlanTaskPageParam extends CommonPageable {
*/
private String userId;
/**
* 人员编号
*/
private List<String> ids;
public List<String> getIds() {
return ids;
}
public void setIds(List<String> ids) {
this.ids = ids;
}
/**
* 单位
......
package com.yeejoin.amos.patrol.business.service.impl;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.patrol.business.dao.mapper.CheckMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.TaskMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.TaskPictureMapper;
import com.yeejoin.amos.patrol.business.dao.repository.*;
import com.yeejoin.amos.patrol.business.dao.repository.ICheckShotDao;
import com.yeejoin.amos.patrol.business.dao.repository.ITaskDao;
import com.yeejoin.amos.patrol.business.dao.repository.ITaskDetailDao;
import com.yeejoin.amos.patrol.business.dao.repository.ITaskFeedbackDao;
import com.yeejoin.amos.patrol.business.dao.repository.ITaskForwardLogDao;
import com.yeejoin.amos.patrol.business.dao.repository.ITaskPictureDao;
import com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo;
import com.yeejoin.amos.patrol.business.entity.mybatis.TaskBo;
import com.yeejoin.amos.patrol.business.entity.mybatis.TaskFeedbackBo;
import com.yeejoin.amos.patrol.business.param.*;
import com.yeejoin.amos.patrol.business.param.TaskDetailParam;
import com.yeejoin.amos.patrol.business.param.TaskInfoParam;
import com.yeejoin.amos.patrol.business.param.TaskPageParam;
import com.yeejoin.amos.patrol.business.param.TaskParam;
import com.yeejoin.amos.patrol.business.param.TaskStatisticsParam;
import com.yeejoin.amos.patrol.business.service.intfc.ITaskService;
import com.yeejoin.amos.patrol.business.util.DaoCriteria;
import com.yeejoin.amos.patrol.business.util.ToolUtils;
......@@ -20,7 +31,12 @@ import com.yeejoin.amos.patrol.common.enums.TaskFeedbackType;
import com.yeejoin.amos.patrol.common.enums.TaskStatusEnum;
import com.yeejoin.amos.patrol.core.common.response.AppPointCheckRespone;
import com.yeejoin.amos.patrol.core.util.query.BaseQuerySpecification;
import com.yeejoin.amos.patrol.dao.entity.*;
import com.yeejoin.amos.patrol.dao.entity.CheckShot;
import com.yeejoin.amos.patrol.dao.entity.Task;
import com.yeejoin.amos.patrol.dao.entity.TaskDetail;
import com.yeejoin.amos.patrol.dao.entity.TaskFeedback;
import com.yeejoin.amos.patrol.dao.entity.TaskForwardLog;
import com.yeejoin.amos.patrol.dao.entity.TaskPicture;
import com.yeejoin.amos.patrol.exception.YeeException;
import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
import com.yeejoin.amos.patrol.quartz.IJobService;
......@@ -35,6 +51,8 @@ import org.springframework.data.domain.PageImpl;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.annotation.Resource;
import javax.persistence.criteria.CriteriaBuilder;
......@@ -43,7 +61,15 @@ import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import javax.transaction.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
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.Set;
import java.util.regex.Pattern;
......@@ -573,4 +599,33 @@ public class TaskServiceImpl implements ITaskService {
List<Map<String, Object>> taskList = taskMapper.synchronizedOfflineTasks(request);
return taskList;
}
@Override
public Map<String, String> uploadFile(MultipartFile file) {
JSONObject fileObj = uploadFile(file, "twoRegulations");
Map<String, String> map = new HashMap<>();
if (!ValidationUtil.isEmpty(fileObj)) {
map.put(fileObj.getString("fileUrl"), fileObj.getString("fileName"));
}
return map;
}
private JSONObject uploadFile(MultipartFile file, String tag) {
Date today = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyyMM");
String path = format.format(today);
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFileFree(file, "tzs/" + tag + "/" + path);
JSONObject jsonObj = new JSONObject();
if (date != null) {
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
while (it.hasNext()) {
String urlString=it.next();
jsonObj.put("fileUrl", urlString);
jsonObj.put("fileName", map.get(urlString));
}
}
return jsonObj;
}
}
......@@ -13,6 +13,7 @@ import com.yeejoin.amos.patrol.dao.entity.TaskFeedback;
import com.yeejoin.amos.patrol.dao.entity.TaskPicture;
import org.quartz.JobDataMap;
import org.springframework.data.domain.Page;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
import java.util.List;
......@@ -166,4 +167,11 @@ public interface ITaskService {
* @return
*/
public List<Map<String, Object>> synchronizedOfflineTasks(AgencyUserModel user, ReginParams reginParams);
/**
* 图片上传
*
* @return*/
Map<String, String> uploadFile(MultipartFile file);
}
......@@ -129,14 +129,14 @@ public class FileHelper {
* @param file
* @return
*/
public static boolean isPPT2003(File file) {
try ( InputStream is = new FileInputStream(file);
HSLFSlideShow ppt = new HSLFSlideShow(is);) {
} catch (Exception e) {
return false;
}
return true;
}
// public static boolean isPPT2003(File file) {
// try ( InputStream is = new FileInputStream(file);
// // HSLFSlideShow ppt = new HSLFSlideShow(is);) {
// } catch (Exception e) {
// return false;
// }
// return true;
// }
/**
*
......
......@@ -520,7 +520,7 @@ public static List<HashMap<String, Object>> genWholeExeData(List<HashMap<String,
if (!CollectionUtils.isEmpty(userDetailsDtoList)) {
Map<String, List<UserDetailsDto>> userDetailsDtoMap = userDetailsDtoList.stream().
filter(obj -> obj.getEquipCategoryCode().contains(deviceType) && obj.getUnitTypeCode().contains(unitType))
.collect(Collectors.groupingBy(UserDetailsDto::getUnitOrgCode));
.collect(Collectors.groupingBy(UserDetailsDto::getUnitCode));
for (HashMap<String, Object> stringObjectHashMap : timeList) {
HashMap<String, Object> tempMap = new HashMap<>();
Object strBeginTime = stringObjectHashMap.get("BEGIN_TIME");
......
......@@ -154,6 +154,12 @@
and a.org_code like #{orgCode}
</if>
<if test="bizOrgCode!=null"> and d.biz_org_code like concat(#{bizOrgCode},'%') </if>
<if test="ids != null ">
and b.id in
<foreach item="id" collection="ids" index="index" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
order by b.id
......
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