同步防汛抗旱通讯录旧平台数据库,防汛通讯录历史预警查询修改

master
徐杰盟 2024-06-25 17:58:24 +08:00
parent 81e3f4bf3e
commit 74f9b8bfe0
4 changed files with 56 additions and 4 deletions

View File

@ -17,6 +17,8 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@ -59,6 +61,7 @@ public class AddressBookOldController {
@ApiOperation(value = "查询所有联系人")
@PostMapping(value = "find")
@Cacheable(value = ADDRESS_BOOK_REDIS_KEY, key = "#root.method.name+':'+#dto.toString()")
public ResultJson<List<AddressBookOld>> find(@RequestBody AddressBookOldDto dto) {
LambdaQueryChainWrapper<AddressBookOld> query = service.lambdaQuery();
@ -116,6 +119,7 @@ public class AddressBookOldController {
}
@ApiOperation(value = "联系人导入")
@PostMapping(value = "uploadExcel")
@CacheEvict(value = ADDRESS_BOOK_REDIS_KEY, allEntries = true)
public ResultJson uploadExcel(@RequestBody ExcelDataVo data) {
String s = redisTemplate.opsForValue().get(ADDRESS_BOOK_TEMP_REDIS_KEY + data.getKey());

View File

@ -2,7 +2,9 @@ package com.whdc.controller;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.whdc.model.entity.WarnMsgFB;
import com.whdc.model.vo.ExcelOldDataVo;
import com.whdc.service.IWarnMsgFBService;
import com.whdc.utils.ExcelCommon;
import com.whdc.utils.ResultJson;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -13,6 +15,11 @@ 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.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@Api(tags = "预警叫应 - Controller")
@ -49,4 +56,30 @@ public class WarnMsgFBController {
return ResultJson.ok(service.find(dto));
}
@ApiOperation(value = "解析文件数据")
@PostMapping(value = "getExcelData")
public ResultJson<ExcelOldDataVo> getExcelData(MultipartFile file) {
List<WarnMsgFB> appends = ExcelCommon.importExcel(file, 0, 1, WarnMsgFB.class);
service.saveBatch(appends);
List<Integer> warns = appends.stream().map(WarnMsgFB::getWarnid).collect(Collectors.toList());
List<WarnMsgFB> list = service.lambdaQuery().in(WarnMsgFB::getWarnid, warns).list();
Map<Integer, List<WarnMsgFB>> map = list.stream().collect(Collectors.groupingBy(WarnMsgFB::getWarnid, Collectors.toList()));
map.forEach((k,v) ->{
if (CollectionUtils.isNotEmpty(v) && v.size() > 1){
for (int i = 1; i < v.size(); i++) {
service.removeById(v.get(i));
}
}
});
return ResultJson.ok();
}
}

View File

@ -1,6 +1,9 @@
package com.whdc.model.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
@ -18,38 +21,50 @@ import java.util.Date;
@TableName("FXKH_TXL.WARNMSG_FEEDBACK")
public class WarnMsgFB {
@TableId(value = "ID",type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Integer id;
@TableField("WARNID")
@ApiModelProperty(value = "预警信息ID")
@Excel(name = "warnid")
private Integer warnid;
@TableField("PUBLISH_TIME")
@ApiModelProperty(value = "预警信息发布时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Excel(name = "publishTime")
private Date publishTime;
@TableField("HANDLE_TIME")
@ApiModelProperty(value = "预警信息处理时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Excel(name = "handleTime")
private Date handleTime;
@TableField("CALL_TIME")
@ApiModelProperty(value = "预警信息呼叫时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Excel(name = "callTime")
private Date callTime;
@TableField("CALLED_PERSON")
@ApiModelProperty(value="被呼叫人姓名")
@Excel(name = "calledPerson")
private String calledPerson;
@TableField("CALLED_POSITION")
@ApiModelProperty(value="被呼叫人职务")
@Excel(name = "calledPosition")
private String calledPosition;
@TableField("CALLED_PHONE")
@ApiModelProperty(value="被呼叫人手机号")
@Excel(name = "calledPhone")
private String calledPhone;
@TableField("CALL_PERSON")
@ApiModelProperty(value="呼叫人姓名")
@Excel(name = "callPerson")
private String callPerson;
}

View File

@ -40,10 +40,10 @@ spring:
# Redis
redis:
database: 5
host: 10.42.6.75
# host: 127.0.0.1
# password:
password: Whdc_890
# host: 10.42.6.75
host: 127.0.0.1
password:
# password: Whdc_890
port: 6379
servlet: