|
@@ -16,6 +16,7 @@
|
|
|
*/
|
|
|
package com.qunzhixinxi.hnqz.admin.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.date.DateUnit;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
@@ -23,6 +24,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.vo.UserVO;
|
|
|
+import com.qunzhixinxi.hnqz.admin.config.UpmsConfig;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.WmDaHospital;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.WmScorePackage;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.WmScorePackageStatus;
|
|
@@ -43,6 +45,7 @@ import com.qunzhixinxi.hnqz.admin.service.WmTaskService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.WmTaskTypeService;
|
|
|
import com.qunzhixinxi.hnqz.admin.util.HnqzUtils;
|
|
|
import com.qunzhixinxi.hnqz.common.core.util.R;
|
|
|
+import com.qunzhixinxi.hnqz.common.security.service.HnqzUser;
|
|
|
import com.qunzhixinxi.hnqz.common.security.util.SecurityUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -80,6 +83,7 @@ public class WmTaskContentServiceImpl extends ServiceImpl<WmTaskContentMapper, W
|
|
|
private final WmUserSignMapper wmUserSignMapper;
|
|
|
private final WmDaHospitalMapper wmDaHospitalMapper;
|
|
|
private final SysPublicParamService sysPublicParamService;
|
|
|
+ private final UpmsConfig upmsConfig;
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -96,7 +100,9 @@ public class WmTaskContentServiceImpl extends ServiceImpl<WmTaskContentMapper, W
|
|
|
log.warn("获取不到积分包:{}", wmTaskContent.getId());
|
|
|
return R.failed("获取不到积分包");
|
|
|
}
|
|
|
- UserVO sysU = sysUserService.selectUserVoById(SecurityUtils.getUser().getId());
|
|
|
+
|
|
|
+ HnqzUser user = SecurityUtils.getUser();
|
|
|
+ UserVO sysU = sysUserService.selectUserVoById(user.getId());
|
|
|
WmScorePackageStatus query = new WmScorePackageStatus();
|
|
|
query.setUserId(sysU.getUserId() + "");
|
|
|
query.setStatus("2");
|
|
@@ -127,6 +133,19 @@ public class WmTaskContentServiceImpl extends ServiceImpl<WmTaskContentMapper, W
|
|
|
}
|
|
|
|
|
|
WmScorePackageStatus scorePackageStatus = statusList.get(0);
|
|
|
+ long defMeetingTaskCount = 2L;
|
|
|
+
|
|
|
+ Map<String, Long> custMeetingTimes = upmsConfig.getCustMeetingTimes();
|
|
|
+ log.warn("会议类型限制:{}", custMeetingTimes);
|
|
|
+ if (CollUtil.isNotEmpty(custMeetingTimes)){
|
|
|
+ Long times = custMeetingTimes.get(user.getDeptId());
|
|
|
+ log.warn("deptId:{},限制:{}", user.getDeptId(), times);
|
|
|
+ if (times != null){
|
|
|
+ defMeetingTaskCount = times;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ log.warn("最终会议类型限制场数:{}", defMeetingTaskCount);
|
|
|
if ("1".equals(wmTaskContent.getTemp30())) {
|
|
|
// 会议举办
|
|
|
// 限制每天两次
|
|
@@ -137,7 +156,7 @@ public class WmTaskContentServiceImpl extends ServiceImpl<WmTaskContentMapper, W
|
|
|
long meetingTaskCount = wmTaskService.countMeetingTask(CollectionUtil.toList("1", "2", "3", "4"),
|
|
|
String.valueOf(sysU.getUserId()), start, end);
|
|
|
log.info("会议举办次数:{}", meetingTaskCount);
|
|
|
- if (meetingTaskCount >= 2L) {
|
|
|
+ if (meetingTaskCount >= defMeetingTaskCount) {
|
|
|
return R.failed(1, "每天最多举办两场会议");
|
|
|
}
|
|
|
|
|
@@ -163,7 +182,7 @@ public class WmTaskContentServiceImpl extends ServiceImpl<WmTaskContentMapper, W
|
|
|
long meetingTaskCount = wmTaskService.countMeetingTask(CollectionUtil.toList("19"),
|
|
|
String.valueOf(sysU.getUserId()), start, end);
|
|
|
log.info("一对一专访次数:{}", meetingTaskCount);
|
|
|
- if (meetingTaskCount >= 2L) {
|
|
|
+ if (meetingTaskCount >= defMeetingTaskCount) {
|
|
|
return R.failed(1, "每天最多举办两场一对一专访");
|
|
|
}
|
|
|
|
|
@@ -189,7 +208,7 @@ public class WmTaskContentServiceImpl extends ServiceImpl<WmTaskContentMapper, W
|
|
|
long meetingTaskCount = wmTaskService.countMeetingTask(CollectionUtil.toList("34", "35", "36", "37"),
|
|
|
String.valueOf(sysU.getUserId()), start, end);
|
|
|
log.info("培训次数:{}", meetingTaskCount);
|
|
|
- if (meetingTaskCount >= 2L) {
|
|
|
+ if (meetingTaskCount >= defMeetingTaskCount) {
|
|
|
return R.failed(1, "每天最多举办两场培训");
|
|
|
}
|
|
|
|