|
|
|
|
@ -87,7 +87,7 @@ public class ApmConfigServiceImpl extends ServiceImpl<ApmConfigMapper, ApmConfig |
|
|
|
|
List<ApmConfig> configList = baseMapper.selectConfigList(vo.getCreateDept(), DateUtil.format(vo.getApmDay(), DateUtil.PATTERN_DATETIME), vo.getProject()); |
|
|
|
|
|
|
|
|
|
// 获取该天的所有已预约统计
|
|
|
|
|
List<ApmRecordCountDTO> recordCountList = recordService.countAmpNum(createDept, DateUtil.format(vo.getApmDay(), DateUtil.PATTERN_DATETIME)); |
|
|
|
|
List<ApmRecordCountDTO> recordCountList = recordService.countAmpNum(createDept, null, DateUtil.format(vo.getApmDay(), DateUtil.PATTERN_DATETIME)); |
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> detailList = new ArrayList<>(); |
|
|
|
|
for (ApmConfig config : configList) { |
|
|
|
|
@ -101,7 +101,7 @@ public class ApmConfigServiceImpl extends ServiceImpl<ApmConfigMapper, ApmConfig |
|
|
|
|
if (dto.getApmDay().equals(DateUtil.format(config.getApmDay(), DateUtil.PATTERN_DATE)) |
|
|
|
|
&& dto.getProject().equals(config.getProject()) |
|
|
|
|
&& dto.getPeriod().equals(config.getPeriod()) |
|
|
|
|
&& dto.getTimeFrame().equals(config.getTimeFrame()) ) { |
|
|
|
|
&& dto.getTimeFrame().equals(config.getTimeFrame())) { |
|
|
|
|
apmNum = dto.getApmNum(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -117,7 +117,7 @@ public class ApmConfigServiceImpl extends ServiceImpl<ApmConfigMapper, ApmConfig |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<ApmConfigListVO> detailForApm(Long createDept, String apmDay, String cupCardNo) { |
|
|
|
|
List<ApmConfig> allConfigList = baseMapper.selectList(Wrappers.<ApmConfig>lambdaQuery() |
|
|
|
|
List<ApmConfig> allConfigList = baseMapper.selectList(Wrappers.<ApmConfig>lambdaQuery() |
|
|
|
|
.eq(ApmConfig::getCreateDept, createDept) |
|
|
|
|
.eq(ApmConfig::getApmDay, apmDay)); |
|
|
|
|
Map<String, List<ApmConfig>> configProjectMap = new HashMap<>(); |
|
|
|
|
@ -141,7 +141,7 @@ public class ApmConfigServiceImpl extends ServiceImpl<ApmConfigMapper, ApmConfig |
|
|
|
|
Map<String, ApmRecord> cupApmMap = currentApmList.stream().collect(Collectors.toMap(ApmRecord::getProject, Function.identity())); |
|
|
|
|
|
|
|
|
|
// 获取该天的所有预约统计
|
|
|
|
|
List<ApmRecordCountDTO> apmCountList = recordService.countAmpNum(createDept, apmDay); |
|
|
|
|
List<ApmRecordCountDTO> apmCountList = recordService.countAmpNum(createDept, null, apmDay); |
|
|
|
|
List<ApmConfigListVO> resultList = new ArrayList<>(); |
|
|
|
|
for (Map.Entry<String, List<ApmConfig>> configMap : configProjectMap.entrySet()) { |
|
|
|
|
String project = configMap.getKey(); |
|
|
|
|
@ -162,7 +162,7 @@ public class ApmConfigServiceImpl extends ServiceImpl<ApmConfigMapper, ApmConfig |
|
|
|
|
if (dto.getApmDay().equals(DateUtil.format(config.getApmDay(), DateUtil.PATTERN_DATE)) |
|
|
|
|
&& dto.getProject().equals(config.getProject()) |
|
|
|
|
&& dto.getPeriod().equals(config.getPeriod()) |
|
|
|
|
&& dto.getTimeFrame().equals(config.getTimeFrame()) ) { |
|
|
|
|
&& dto.getTimeFrame().equals(config.getTimeFrame())) { |
|
|
|
|
cupApm = dto.getApmNum(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -185,6 +185,7 @@ public class ApmConfigServiceImpl extends ServiceImpl<ApmConfigMapper, ApmConfig |
|
|
|
|
public String saveCheck(Long createDept, List<String> dayList, List<ApmConfigListVO> configListVOS) { |
|
|
|
|
String msg = ""; |
|
|
|
|
List<String> daySearchList = new ArrayList<>(); |
|
|
|
|
List<String> projectList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
// 1. 先根据用户角色判断放号的天是否短于提前几天放号的配置
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
@ -201,6 +202,9 @@ public class ApmConfigServiceImpl extends ServiceImpl<ApmConfigMapper, ApmConfig |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (ApmConfigListVO vo : configListVOS) { |
|
|
|
|
if (!projectList.contains(vo.getProject())) { |
|
|
|
|
projectList.add(vo.getProject()); |
|
|
|
|
} |
|
|
|
|
for (Map<String, Object> detail : vo.getDetailList()) { |
|
|
|
|
String period = detail.containsKey(BusinessConstant.MAP_KEY_APM_CONFIG_LIST_PERIOD) ? (String) detail.get(BusinessConstant.MAP_KEY_APM_CONFIG_LIST_PERIOD) : ""; |
|
|
|
|
String timeFrame = detail.containsKey(BusinessConstant.MAP_KEY_APM_CONFIG_LIST_TIME_FRAME) ? (String) detail.get(BusinessConstant.MAP_KEY_APM_CONFIG_LIST_TIME_FRAME) : ""; |
|
|
|
|
@ -226,37 +230,44 @@ public class ApmConfigServiceImpl extends ServiceImpl<ApmConfigMapper, ApmConfig |
|
|
|
|
Map<String, ApmConfig> alreadyConfMap = new HashMap<>(); |
|
|
|
|
if (Func.isNotEmpty(alreadyConfList)) { |
|
|
|
|
for (ApmConfig config : alreadyConfList) { |
|
|
|
|
String key = config.getProject() + config.getApmDay() + config.getProject() + config.getTimeFrame(); |
|
|
|
|
String key = config.getProject() + config.getApmDay() + config.getPeriod() + config.getTimeFrame(); |
|
|
|
|
if (alreadyConfMap.containsKey(key)) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
alreadyConfMap.put(key, config); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<ApmRecordCountDTO> records = recordService.countAmpNum(createDept, daySearchList); |
|
|
|
|
List<ApmRecordCountDTO> records = recordService.countAmpNum(createDept, projectList, daySearchList); |
|
|
|
|
if (Func.isEmpty(records)) { |
|
|
|
|
records = new ArrayList<>(); |
|
|
|
|
} |
|
|
|
|
Map<String, Integer> alreadyConfCountMap = records.stream().collect(Collectors.toMap( |
|
|
|
|
dto -> dto.getProject() + dto.getApmDay() + dto.getProject() + dto.getTimeFrame(), dto -> dto.getApmNum() |
|
|
|
|
dto -> dto.getProject() + dto.getApmDay() + dto.getPeriod() + dto.getTimeFrame(), dto -> dto.getApmNum() |
|
|
|
|
)); |
|
|
|
|
|
|
|
|
|
for (ApmConfig config : configList) { |
|
|
|
|
String key = config.getProject() + DateUtil.format(config.getApmDay(), DateUtil.PATTERN_DATE) + config.getProject() + config.getTimeFrame(); |
|
|
|
|
String key = config.getProject() + DateUtil.format(config.getApmDay(), DateUtil.PATTERN_DATE) + config.getPeriod() + config.getTimeFrame(); |
|
|
|
|
|
|
|
|
|
if (Func.isEmpty(config.getNumberNum()) || config.getNumberNum() <= 0) { |
|
|
|
|
return "保存失败, 放号数量必须大于0"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 若此次修改的放号没有对应的放号配置或已预约统计为0, 验证通过
|
|
|
|
|
if (alreadyConfMap.containsKey(key) || alreadyConfCountMap.containsKey(key)) { |
|
|
|
|
if (!alreadyConfMap.containsKey(key) || !alreadyConfCountMap.containsKey(key)) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 若此次修改的放号有对应的放号记录, 且已被人预约, 验证放号数量与预约数量
|
|
|
|
|
if (alreadyConfCountMap.containsKey(key) && config.getNumberNum() < alreadyConfCountMap.get(key)) { |
|
|
|
|
|
|
|
|
|
return "保存失败, 放号数量不能低于已预约的数量"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 若已预约map不为空, 证明此次修改没有覆盖到全部的时间段, 且该时间段已被人预约, 放号失败
|
|
|
|
|
if (Func.isNotEmpty(alreadyConfCountMap)) { |
|
|
|
|
return "保存失败, 原放号时段已有预约, 本次修改未覆盖该时段"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return msg; |
|
|
|
|
|