Commit 0b70bd3f authored by fangxinjiang's avatar fangxinjiang

户截止日调整-fxj

parent a164cdbd
...@@ -186,14 +186,14 @@ public class THouseHoldLimitController { ...@@ -186,14 +186,14 @@ public class THouseHoldLimitController {
} }
/** /**
* 户截止日配置表 批量导入 * 户截止日配置表 批量导入 新增或更新
* *
* @author fxj * @author fxj
* @date 2025-12-11 14:19:54 * @date 2025-12-11 14:19:54
**/ **/
@SneakyThrows @SneakyThrows
@Operation(description = "批量新增户截止日配置表") @Operation(description = "批量新增或更新户截止日配置表")
@SysLog("批量新增户截止日配置表") @SysLog("批量新增或更新户截止日配置表")
@PostMapping("/importListAdd") @PostMapping("/importListAdd")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file) { public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file) {
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
......
...@@ -309,11 +309,6 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe ...@@ -309,11 +309,6 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe
.eq(THouseHoldLimit::getType,excel.getType()) .eq(THouseHoldLimit::getType,excel.getType())
.eq(THouseHoldLimit::getName,excel.getName()) .eq(THouseHoldLimit::getName,excel.getName())
.last(CommonConstants.LAST_ONE_SQL)); .last(CommonConstants.LAST_ONE_SQL));
if (null != holdLimit){
errorMsg = new ErrorMessage(excel.getRowIndex(), "该户名及户类型已存在", excel);
errorMessageList.add(errorMsg);
continue;
}
if (Common.isNotNull(excel.getDeadLineDay())){ if (Common.isNotNull(excel.getDeadLineDay())){
if (!Common.isNumber(excel.getDeadLineDay())){ if (!Common.isNumber(excel.getDeadLineDay())){
errorMsg = new ErrorMessage(excel.getRowIndex(), "派增截止(日)只能是数字", excel); errorMsg = new ErrorMessage(excel.getRowIndex(), "派增截止(日)只能是数字", excel);
...@@ -347,17 +342,32 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe ...@@ -347,17 +342,32 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe
limitInsert.setDeadLineDay(excel.getDeadLineDay()); limitInsert.setDeadLineDay(excel.getDeadLineDay());
limitInsert.setAddHandleRule(excel.getAddHandleRule()); limitInsert.setAddHandleRule(excel.getAddHandleRule());
limitInsert.setName(excel.getName()); limitInsert.setName(excel.getName());
limitInsert.setCreateBy(user.getId());
limitInsert.setUpdateBy(user.getId()); limitInsert.setUpdateBy(user.getId());
limitInsert.setCreateTime(LocalDateTime.now());
limitInsert.setUpdateTime(LocalDateTime.now()); limitInsert.setUpdateTime(LocalDateTime.now());
limitInsert.setCreateName(user.getNickname()); // 从户配置中覆盖省市县信息(处理空值情况)
limitInsert.setProvince(houseHold.getProvince()); limitInsert.setProvince(Common.isEmpty(houseHold.getProvince()) ? "" : houseHold.getProvince());
limitInsert.setCity(houseHold.getCity()); limitInsert.setCity(Common.isEmpty(houseHold.getCity()) ? null : houseHold.getCity());
limitInsert.setTown(houseHold.getTown()); limitInsert.setTown(Common.isEmpty(houseHold.getTown()) ? null : houseHold.getTown());
map.put(excel.getName()+excel.getType(),excel.getRowIndex().toString()); map.put(excel.getName()+excel.getType(),excel.getRowIndex().toString());
// 插入 // 判断是新增还是更新
if (!insertExcel(limitInsert)){ boolean success;
if (null != holdLimit){
// 更新已有记录
limitInsert.setId(holdLimit.getId());
limitInsert.setCreateBy(holdLimit.getCreateBy());
limitInsert.setCreateTime(holdLimit.getCreateTime());
limitInsert.setCreateName(holdLimit.getCreateName());
limitInsert.setUpdateBy(user.getId());
limitInsert.setUpdateTime(LocalDateTime.now());
success = updateExcel(limitInsert);
} else {
// 新增记录
limitInsert.setCreateBy(user.getId());
limitInsert.setCreateTime(LocalDateTime.now());
limitInsert.setCreateName(user.getNickname());
success = insertExcel(limitInsert);
}
if (!success){
errorMsg = new ErrorMessage(excel.getRowIndex(), "导入异常", excel); errorMsg = new ErrorMessage(excel.getRowIndex(), "导入异常", excel);
errorMessageList.add(errorMsg); errorMessageList.add(errorMsg);
continue; continue;
...@@ -373,6 +383,13 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe ...@@ -373,6 +383,13 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe
return baseMapper.insert(insert) >= 1; return baseMapper.insert(insert) >= 1;
} }
/**
* 更新excel record
*/
private boolean updateExcel(THouseHoldLimit update) {
return baseMapper.updateById(update) >= 1;
}
/** /**
* 通过户名称及类型查询到具体截止日期后去看是否为工作日,如果不是工作日则往前推,知道找到工作日,然后返回工作日 * 通过户名称及类型查询到具体截止日期后去看是否为工作日,如果不是工作日则往前推,知道找到工作日,然后返回工作日
* 如果找不到对应截止日期,则返回null * 如果找不到对应截止日期,则返回null
......
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