|
|
@ -15,6 +15,7 @@ import com.hnac.hzims.operational.duty.enume.JoinStatus; |
|
|
|
import com.hnac.hzims.operational.duty.mapper.*; |
|
|
|
import com.hnac.hzims.operational.duty.mapper.*; |
|
|
|
import com.hnac.hzims.operational.duty.scheduled.ThreadTask; |
|
|
|
import com.hnac.hzims.operational.duty.scheduled.ThreadTask; |
|
|
|
import com.hnac.hzims.operational.duty.service.IImsDutyGroupPService; |
|
|
|
import com.hnac.hzims.operational.duty.service.IImsDutyGroupPService; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.duty.service.IImsDutyMainPersonService; |
|
|
|
import com.hnac.hzims.operational.duty.service.IImsDutyMainService; |
|
|
|
import com.hnac.hzims.operational.duty.service.IImsDutyMainService; |
|
|
|
import com.hnac.hzims.operational.duty.service.IImsDutyMainTemplateService; |
|
|
|
import com.hnac.hzims.operational.duty.service.IImsDutyMainTemplateService; |
|
|
|
import com.hnac.hzims.operational.duty.vo.*; |
|
|
|
import com.hnac.hzims.operational.duty.vo.*; |
|
|
@ -28,8 +29,11 @@ import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.utils.*; |
|
|
|
import org.springblade.core.tool.utils.*; |
|
|
|
import org.springblade.system.user.cache.UserCache; |
|
|
|
import org.springblade.system.user.cache.UserCache; |
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
|
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
|
|
|
|
|
|
|
import java.sql.Time; |
|
|
|
import java.sql.Time; |
|
|
|
import java.text.DateFormat; |
|
|
|
import java.text.DateFormat; |
|
|
@ -58,11 +62,18 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private OperPhenomenonMapper operPhenomenonMapper; |
|
|
|
private OperPhenomenonMapper operPhenomenonMapper; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
|
|
|
|
private ImsDutyMainPersonMapper imsDutyMainPersonMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IImsDutyMainPersonService iImsDutyMainPersonService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ImsDutyRecMapper imsDutyRecMapper; |
|
|
|
private ImsDutyRecMapper imsDutyRecMapper; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private IImsDutyGroupPService imsDutyGroupPService; |
|
|
|
private IImsDutyGroupPService imsDutyGroupPService; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private DutyGroupGeneratingCapacityMapper groupGeneratingCapacityMapper; |
|
|
|
private DutyGroupGeneratingCapacityMapper groupGeneratingCapacityMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IUserClient userClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public R saveOrUpdateImsDutyMain(ImsDutyMainEntity imsDutyMain) { |
|
|
|
public R saveOrUpdateImsDutyMain(ImsDutyMainEntity imsDutyMain) { |
|
|
@ -110,6 +121,26 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
|
|
public R deleteV2(List<Long> ids) { |
|
|
|
|
|
|
|
if (ids.size() == 0) { |
|
|
|
|
|
|
|
return R.fail("ids不能为空"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//状态为待值班的才可以删除
|
|
|
|
|
|
|
|
for (int i = 0; i < ids.size(); i++) { |
|
|
|
|
|
|
|
ImsDutyMainEntity imsDutyMainEntity = this.getById(ids.get(i)); |
|
|
|
|
|
|
|
if (imsDutyMainEntity.getStatus() != JoinStatus.DUTY_WAIT.getStatus()) { |
|
|
|
|
|
|
|
return R.fail("状态为待值班的才可以删除"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<ImsDutyMainPersonEntity> personEntityList = imsDutyMainPersonMapper.selectList(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ |
|
|
|
|
|
|
|
in(ImsDutyMainPersonEntity::getDutyMainId, ids); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
List<Long> collect = personEntityList.stream().map(s -> s.getId()).collect(Collectors.toList()); |
|
|
|
|
|
|
|
return R.status(this.deleteLogic(ids) && iImsDutyMainPersonService.deleteLogic(collect)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public R getByDateListAll(String dutyDate, Long personId) { |
|
|
|
public R getByDateListAll(String dutyDate, Long personId) { |
|
|
|
return R.data(this.baseMapper.selectByDateListAll(dutyDate, personId)); |
|
|
|
return R.data(this.baseMapper.selectByDateListAll(dutyDate, personId)); |
|
|
|
} |
|
|
|
} |
|
|
@ -121,6 +152,42 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
|
|
|
|
public ImsSchedulingVo getByIdOneV2(Long id) { |
|
|
|
|
|
|
|
ImsSchedulingVo imsSchedulingVo = this.baseMapper.selectByIdOneV2(id, null); |
|
|
|
|
|
|
|
if (null == imsSchedulingVo.getGroupId()) { |
|
|
|
|
|
|
|
imsSchedulingVo.setGroupName("临时班组"); |
|
|
|
|
|
|
|
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ |
|
|
|
|
|
|
|
eq(ImsDutyMainPersonEntity::getDutyMainId, id); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
imsSchedulingVo.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(imsSchedulingVo.getGroupId()); |
|
|
|
|
|
|
|
imsSchedulingVo.setGroupName(imsDutyGroupEntity.getGroupName()); |
|
|
|
|
|
|
|
imsSchedulingVo.setGroupId(imsDutyGroupEntity.getId()); |
|
|
|
|
|
|
|
imsSchedulingVo.setManagerId(imsDutyGroupEntity.getManagerId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return imsSchedulingVo; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public ImsSchedulingVo getByIdOneV2(Long id, Long preDutyId) { |
|
|
|
|
|
|
|
ImsSchedulingVo imsSchedulingVo = this.baseMapper.selectByIdOneV2(id, preDutyId); |
|
|
|
|
|
|
|
if (null == imsSchedulingVo.getGroupId()) { |
|
|
|
|
|
|
|
imsSchedulingVo.setGroupName("临时班组"); |
|
|
|
|
|
|
|
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ |
|
|
|
|
|
|
|
eq(ImsDutyMainPersonEntity::getDutyMainId, id); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
imsSchedulingVo.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(imsSchedulingVo.getGroupId()); |
|
|
|
|
|
|
|
imsSchedulingVo.setGroupName(imsDutyGroupEntity.getGroupName()); |
|
|
|
|
|
|
|
imsSchedulingVo.setGroupId(imsDutyGroupEntity.getId()); |
|
|
|
|
|
|
|
imsSchedulingVo.setManagerId(imsDutyGroupEntity.getManagerId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return imsSchedulingVo; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public ImsDutyMainEntity getMainEntity(Long id) { |
|
|
|
public ImsDutyMainEntity getMainEntity(Long id) { |
|
|
|
return this.baseMapper.selectMainByIdOne(id); |
|
|
|
return this.baseMapper.selectMainByIdOne(id); |
|
|
|
} |
|
|
|
} |
|
|
@ -133,6 +200,8 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public R getScheduling(ImsSchedulingVo imsSchedulingVo) { |
|
|
|
public R getScheduling(ImsSchedulingVo imsSchedulingVo) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (null == imsSchedulingVo.getSchedulingType()) { |
|
|
|
if (null == imsSchedulingVo.getSchedulingType()) { |
|
|
|
imsSchedulingVo.setSchedulingType(1); |
|
|
|
imsSchedulingVo.setSchedulingType(1); |
|
|
|
} |
|
|
|
} |
|
|
@ -144,6 +213,324 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
|
|
public R getSchedulingV2(ImsSchedulingVo imsSchedulingVo) { |
|
|
|
|
|
|
|
//判断是否符合排班规则。
|
|
|
|
|
|
|
|
String[] start = imsSchedulingVo.getStartDate().split("-"); |
|
|
|
|
|
|
|
String[] end = imsSchedulingVo.getEndDate().split("-"); |
|
|
|
|
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
|
|
|
|
int year = cal.get(Calendar.YEAR); |
|
|
|
|
|
|
|
int month = cal.get(Calendar.MONTH) + 1;//获取月份
|
|
|
|
|
|
|
|
int day = cal.get(Calendar.DAY_OF_MONTH); |
|
|
|
|
|
|
|
String date1 = getDate(year, month, day); |
|
|
|
|
|
|
|
String date2 = DateUtils.dayStringDate(date1, 1, true); |
|
|
|
|
|
|
|
if (!imsSchedulingVo.getStartDate().equals(date2)) { |
|
|
|
|
|
|
|
String minusOnedDay = DateUtils.dayStringDate(imsSchedulingVo.getStartDate(), 1, false); |
|
|
|
|
|
|
|
log.info("--------------Auth:" + AuthUtil.getDeptId() + "--------createDept:" + imsSchedulingVo.getCreateDept()); |
|
|
|
|
|
|
|
List<ImsDutyMainEntity> imsDutyMainEntities = this.baseMapper.selectByDateAndDept(minusOnedDay, imsSchedulingVo.getCreateDept()); |
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(imsDutyMainEntities)) { |
|
|
|
|
|
|
|
return R.fail("所选日期之前存在未排班情况,请重新选择日期区间!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<String> dates = getTwoPeriodsAll(Integer.valueOf(start[0]), Integer.valueOf(start[1]), Integer.valueOf(start[2]), Integer.valueOf(end[0]), Integer.valueOf(end[1]), Integer.valueOf(end[2])); |
|
|
|
|
|
|
|
if (Integer.valueOf(start[0]) < year) { |
|
|
|
|
|
|
|
return R.fail("年份必须大于或等于当前年份!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (Integer.valueOf(start[0]) == year && Integer.valueOf(start[1]) < month) { |
|
|
|
|
|
|
|
return R.fail("时间必须大于或等于当前时间"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<ImsDutyMainEntity> imsDutyMainEntities2 = this.baseMapper.selectList(new LambdaQueryWrapper<ImsDutyMainEntity>() {{ |
|
|
|
|
|
|
|
ge(ImsDutyMainEntity::getDutyDate, imsSchedulingVo.getStartDate()); |
|
|
|
|
|
|
|
le(ImsDutyMainEntity::getDutyDate, imsSchedulingVo.getEndDate()); |
|
|
|
|
|
|
|
eq(ImsDutyMainEntity::getCreateDept, imsSchedulingVo.getCreateDept()); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
List<ImsDutyMainPersonEntity> imsDutyMainPersonEntities = imsDutyMainPersonMapper.selectList(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ |
|
|
|
|
|
|
|
ge(ImsDutyMainPersonEntity::getDutyDate, imsSchedulingVo.getStartDate()); |
|
|
|
|
|
|
|
le(ImsDutyMainPersonEntity::getDutyDate, imsSchedulingVo.getEndDate()); |
|
|
|
|
|
|
|
eq(ImsDutyMainPersonEntity::getCreateDept, imsSchedulingVo.getCreateDept()); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(imsDutyMainPersonEntities) || CollectionUtil.isNotEmpty(imsDutyMainEntities2)) { |
|
|
|
|
|
|
|
if (imsSchedulingVo.isCompose() == false) { |
|
|
|
|
|
|
|
//如果有排班记录且无需排序,则返回
|
|
|
|
|
|
|
|
return R.data(1); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(dates)) { |
|
|
|
|
|
|
|
//重新修改已有的排版,先删除,在添加
|
|
|
|
|
|
|
|
this.baseMapper.delete(new LambdaQueryWrapper<ImsDutyMainEntity>() {{ |
|
|
|
|
|
|
|
eq(ImsDutyMainEntity::getCreateDept, imsSchedulingVo.getCreateDept()); |
|
|
|
|
|
|
|
in(ImsDutyMainEntity::getDutyDate, dates); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
imsDutyMainPersonMapper.delete(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ |
|
|
|
|
|
|
|
in(ImsDutyMainPersonEntity::getDutyDate, dates); |
|
|
|
|
|
|
|
eq(ImsDutyMainPersonEntity::getCreateDept, imsSchedulingVo.getCreateDept()); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String subDayDate = DateUtils.dayDate(DateUtil.parse(imsSchedulingVo.getStartDate(), DateUtil.PATTERN_DATE), -1, DateUtil.PATTERN_DATE); |
|
|
|
|
|
|
|
ImsDutyMainEntity imsDutyMainEntity1 = this.baseMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{ |
|
|
|
|
|
|
|
eq(ImsDutyMainEntity::getDutyDate, subDayDate); |
|
|
|
|
|
|
|
eq(ImsDutyMainEntity::getCreateDept, imsSchedulingVo.getCreateDept()); |
|
|
|
|
|
|
|
ne(ImsDutyMainEntity::getStatus, "-1"); |
|
|
|
|
|
|
|
orderByDesc(ImsDutyMainEntity::getId).last("LIMIT 1"); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
if (null == imsSchedulingVo.getSchedulingType()) { |
|
|
|
|
|
|
|
imsSchedulingVo.setSchedulingType(1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//符合条件后根据周期、轮询排班方式保存
|
|
|
|
|
|
|
|
if (1 == imsSchedulingVo.getSchedulingType()) { |
|
|
|
|
|
|
|
return pollSchedulingV2(imsSchedulingVo, dates, imsDutyMainEntity1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return cycleSchedulingTowV2(imsSchedulingVo, dates, imsDutyMainEntity1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 轮询排班 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param imsSchedulingVo |
|
|
|
|
|
|
|
* @param dates |
|
|
|
|
|
|
|
* @param imsDutyMainEntity1 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private R pollSchedulingV2(ImsSchedulingVo imsSchedulingVo, List<String> dates, ImsDutyMainEntity imsDutyMainEntity1) { |
|
|
|
|
|
|
|
String[] groupIdsSplit; |
|
|
|
|
|
|
|
int dutyNum; |
|
|
|
|
|
|
|
//轮询排班分为:班组还是灵活;如果是2.灵活人员排班,则不需要查数据库,直接存对应信息
|
|
|
|
|
|
|
|
if (2 == imsSchedulingVo.getPersonType()) { |
|
|
|
|
|
|
|
Map<String, List<String>> rosters = imsSchedulingVo.getRosters(); |
|
|
|
|
|
|
|
groupIdsSplit = rosters.keySet().toArray(new String[0]); |
|
|
|
|
|
|
|
dutyNum = groupIdsSplit.length; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
groupIdsSplit = imsSchedulingVo.getGroupIds().split("\\^"); |
|
|
|
|
|
|
|
String[] groupNamesSplit = imsSchedulingVo.getGroupNames().split("\\^"); |
|
|
|
|
|
|
|
dutyNum = groupNamesSplit.length; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String[] classIdsSplit = imsSchedulingVo.getClassIds().split("\\^"); |
|
|
|
|
|
|
|
String[] classNamesSplit = imsSchedulingVo.getClassNames().split("\\^"); |
|
|
|
|
|
|
|
int classNum = classNamesSplit.length; |
|
|
|
|
|
|
|
int allClass = 0; |
|
|
|
|
|
|
|
List<ImsDutyMainEntity> imsDutyMainEntityList = new ArrayList<>(); |
|
|
|
|
|
|
|
List<ImsDutyMainPersonEntity> imsDutyMainPersonEntityList = new ArrayList<>(); |
|
|
|
|
|
|
|
String proDutyMainId = ""; |
|
|
|
|
|
|
|
for (int i = 1; i <= dates.size(); i++) { |
|
|
|
|
|
|
|
String date = dates.get(i - 1); |
|
|
|
|
|
|
|
for (int j = 1; j <= classNum; j++) { |
|
|
|
|
|
|
|
//总排班数加1
|
|
|
|
|
|
|
|
allClass++; |
|
|
|
|
|
|
|
int temp, tempSub = 0; |
|
|
|
|
|
|
|
temp = allClass % dutyNum; |
|
|
|
|
|
|
|
//班组下标,确定取哪个班组
|
|
|
|
|
|
|
|
tempSub = temp - 1; |
|
|
|
|
|
|
|
//如果整除,取最后一个班组
|
|
|
|
|
|
|
|
if (temp == 0) { |
|
|
|
|
|
|
|
tempSub = dutyNum - 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ImsDutyMainEntity imsDutyMainEntity = new ImsDutyMainEntity(); |
|
|
|
|
|
|
|
imsDutyMainEntity.setClassId(Long.valueOf(classIdsSplit[j - 1])); |
|
|
|
|
|
|
|
imsDutyMainEntity.setClassName(classNamesSplit[j - 1]); |
|
|
|
|
|
|
|
imsDutyMainEntity.setDutyDate(DateUtil.parse(date, DateUtil.PATTERN_DATE)); |
|
|
|
|
|
|
|
imsDutyMainEntity.setStatus(0); |
|
|
|
|
|
|
|
imsDutyMainEntity.setCreateTime(new Date()); |
|
|
|
|
|
|
|
if (Func.isBlank(proDutyMainId)) { |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(imsDutyMainEntity1)) { |
|
|
|
|
|
|
|
proDutyMainId = imsDutyMainEntity1.getId().toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
imsDutyMainEntity.setPreDutyId(Long.valueOf(proDutyMainId)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
imsDutyMainEntity.setCreateDept(imsSchedulingVo.getCreateDept()); |
|
|
|
|
|
|
|
List<Long> collect; |
|
|
|
|
|
|
|
Long managerId; |
|
|
|
|
|
|
|
if (2 == imsSchedulingVo.getPersonType()) { |
|
|
|
|
|
|
|
List<String> idList = imsSchedulingVo.getRosters().get(groupIdsSplit[tempSub]); |
|
|
|
|
|
|
|
collect = idList.stream().map(s -> Long.valueOf(s)).collect(Collectors.toList()); |
|
|
|
|
|
|
|
managerId = Long.valueOf(groupIdsSplit[tempSub]); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
String groupId = groupIdsSplit[tempSub]; |
|
|
|
|
|
|
|
imsDutyMainEntity.setDutyGroupId(Long.valueOf(groupIdsSplit[tempSub])); |
|
|
|
|
|
|
|
//查询预备排班的班组人员,为空,则失败
|
|
|
|
|
|
|
|
List<Long> longList = Arrays.asList(imsSchedulingVo.getGroupIds().split("\\^")) |
|
|
|
|
|
|
|
.parallelStream() |
|
|
|
|
|
|
|
.map(a -> Long.parseLong(a.trim())) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<ImsDutyGroupPEntity> list = imsDutyGroupPService.selectByGroupIds(longList); |
|
|
|
|
|
|
|
collect = list.stream().filter(iter -> iter.getGroupId().toString().equals(groupId)).map(iter -> |
|
|
|
|
|
|
|
iter.getPersonId()).collect(Collectors.toList()); |
|
|
|
|
|
|
|
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(groupId); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(imsDutyGroupEntity) && ObjectUtil.isNotEmpty(imsDutyGroupEntity.getManagerId())) { |
|
|
|
|
|
|
|
managerId = imsDutyGroupEntity.getManagerId(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return R.fail("该班组没有值班组组长"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String ids = StringUtils.join(collect, "^"); |
|
|
|
|
|
|
|
imsDutyMainEntity.setDutyPersonIds(ids); |
|
|
|
|
|
|
|
Long id = IdWorker.getId(); |
|
|
|
|
|
|
|
imsDutyMainEntity.setId(id); |
|
|
|
|
|
|
|
imsDutyMainEntity.setCreateUser(AuthUtil.getUserId()); |
|
|
|
|
|
|
|
imsDutyMainEntity.setUpdateUser(AuthUtil.getUserId()); |
|
|
|
|
|
|
|
imsDutyMainEntity.setTenantId(AuthUtil.getTenantId()); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(imsDutyMainEntity1)) { |
|
|
|
|
|
|
|
proDutyMainId = imsDutyMainEntity1.getId().toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
imsDutyMainEntity.setPreDutyId(Long.valueOf(proDutyMainId)); |
|
|
|
|
|
|
|
imsDutyMainEntityList.add(imsDutyMainEntity); |
|
|
|
|
|
|
|
proDutyMainId = id == null ? "" : imsDutyMainEntity.getId() + ""; |
|
|
|
|
|
|
|
//值班人员表同步保存一份
|
|
|
|
|
|
|
|
copyPersonByDutyMain(imsSchedulingVo, managerId, imsDutyMainPersonEntityList, imsDutyMainEntity, collect); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ThreadTask.dutyTask(imsDutyMainEntityList, imsDutyMainPersonEntityList, imsSchedulingVo.getEndDate(), proDutyMainId, imsSchedulingVo.getCreateDept(), imsSchedulingVo.getDutyClassTypeId()); |
|
|
|
|
|
|
|
return R.success("操作成功,系统正在排班中,请稍后查看"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void copyPersonByDutyMain(ImsSchedulingVo imsSchedulingVo, Long managerId, List<ImsDutyMainPersonEntity> imsDutyMainPersonEntityList, ImsDutyMainEntity imsDutyMainEntity, List<Long> collect) { |
|
|
|
|
|
|
|
//每个人员对应一条排班-人员计划
|
|
|
|
|
|
|
|
for (Long personId : collect) { |
|
|
|
|
|
|
|
ImsDutyMainPersonEntity imsDutyMainPersonEntity = new ImsDutyMainPersonEntity(); |
|
|
|
|
|
|
|
imsDutyMainPersonEntity.setClassId(imsDutyMainEntity.getClassId()); |
|
|
|
|
|
|
|
imsDutyMainPersonEntity.setCreateDept(imsDutyMainEntity.getCreateDept()); |
|
|
|
|
|
|
|
imsDutyMainPersonEntity.setClassName(imsDutyMainEntity.getClassName()); |
|
|
|
|
|
|
|
imsDutyMainPersonEntity.setDutyDate(imsDutyMainEntity.getDutyDate()); |
|
|
|
|
|
|
|
imsDutyMainPersonEntity.setStatus(imsDutyMainEntity.getStatus()); |
|
|
|
|
|
|
|
imsDutyMainPersonEntity.setCreateTime(imsDutyMainEntity.getCreateTime()); |
|
|
|
|
|
|
|
imsDutyMainPersonEntity.setDutyMainId(imsDutyMainEntity.getId()); |
|
|
|
|
|
|
|
imsDutyMainPersonEntity.setCreateUser(imsDutyMainEntity.getCreateUser()); |
|
|
|
|
|
|
|
imsDutyMainPersonEntity.setUpdateUser(imsDutyMainEntity.getUpdateUser()); |
|
|
|
|
|
|
|
imsDutyMainPersonEntity.setTenantId(imsDutyMainEntity.getTenantId()); |
|
|
|
|
|
|
|
imsDutyMainPersonEntity.setDutyPerson(personId); |
|
|
|
|
|
|
|
long id1 = IdWorker.getId(imsDutyMainPersonEntity); |
|
|
|
|
|
|
|
imsDutyMainPersonEntity.setId(id1); |
|
|
|
|
|
|
|
if (2 == imsSchedulingVo.getPersonType()) { |
|
|
|
|
|
|
|
imsDutyMainPersonEntity.setDutyChargePerson(imsSchedulingVo.getManagerId()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
imsDutyMainPersonEntity.setDutyChargePerson(managerId); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
imsDutyMainPersonEntityList.add(imsDutyMainPersonEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 周期排班 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param imsSchedulingVo |
|
|
|
|
|
|
|
* @param dates |
|
|
|
|
|
|
|
* @param imsDutyMainEntity1 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private R cycleSchedulingTowV2(ImsSchedulingVo imsSchedulingVo, List<String> dates, ImsDutyMainEntity imsDutyMainEntity1) { |
|
|
|
|
|
|
|
if (imsSchedulingVo.getTemplate()) { |
|
|
|
|
|
|
|
if (!doSaveTemplate(imsSchedulingVo)) { |
|
|
|
|
|
|
|
return R.fail("模版名称已存在"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<ImsDutyMainEntity> imsDutyMainEntityList = new ArrayList<>(); |
|
|
|
|
|
|
|
List<ImsDutyMainPersonEntity> personEntityList = new ArrayList<>(); |
|
|
|
|
|
|
|
String proDutyMainId = ""; |
|
|
|
|
|
|
|
String[] dutyArrIds = imsSchedulingVo.getDutyArrIds(); |
|
|
|
|
|
|
|
for (int i = 1; i <= dates.size(); i++) { |
|
|
|
|
|
|
|
String date = dates.get(i - 1); |
|
|
|
|
|
|
|
for (int j = 1; j <= dutyArrIds.length; j++) { |
|
|
|
|
|
|
|
String classId = dutyArrIds[j - 1]; |
|
|
|
|
|
|
|
//按值班周期的天数取模
|
|
|
|
|
|
|
|
int temp = i % imsSchedulingVo.getDutyNum(); |
|
|
|
|
|
|
|
//值班下标
|
|
|
|
|
|
|
|
int tempSub = temp - 1; |
|
|
|
|
|
|
|
//如果整除,取最后一个值班
|
|
|
|
|
|
|
|
if (temp == 0) { |
|
|
|
|
|
|
|
tempSub = imsSchedulingVo.getDutyNum() - 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String groupId; |
|
|
|
|
|
|
|
String[] split; |
|
|
|
|
|
|
|
if (imsSchedulingVo.getPersonType() == 1) { |
|
|
|
|
|
|
|
//获取对应班组的值班班次
|
|
|
|
|
|
|
|
groupId = imsSchedulingVo.getDutyOrderIds().get(classId)[tempSub]; |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
//灵活排班,无实际作用,只是为了groupId能够初始化
|
|
|
|
|
|
|
|
groupId =""; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//人员IDS
|
|
|
|
|
|
|
|
String personIds = ""; |
|
|
|
|
|
|
|
if ("0".equals(classId)) { |
|
|
|
|
|
|
|
//班组排班比灵活排班,多保存一部分没有排到班的信息
|
|
|
|
|
|
|
|
if (imsSchedulingVo.getPersonType() == 1) { |
|
|
|
|
|
|
|
split = groupId.split(","); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(split)) { |
|
|
|
|
|
|
|
for (String dutyGroupId : split) { |
|
|
|
|
|
|
|
//查询班组信息
|
|
|
|
|
|
|
|
List<ImsDutyGroupPEntity> list = imsDutyGroupPService.selectByGroupIds(Arrays.asList(Long.valueOf(dutyGroupId))); |
|
|
|
|
|
|
|
List<Long> collectPerson = list.stream().filter(iter -> iter.getGroupId().toString().equals(dutyGroupId)).map(iter -> iter.getPersonId()).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(collectPerson)) { |
|
|
|
|
|
|
|
personIds = StringUtils.join(collectPerson, "^"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtil.isNotBlank(dutyGroupId)) { |
|
|
|
|
|
|
|
ImsDutyMainEntity imsDutyMainEntity = new ImsDutyMainEntity(); |
|
|
|
|
|
|
|
setMainEntity(imsDutyMainEntity, classId, Long.valueOf(dutyGroupId), date); |
|
|
|
|
|
|
|
imsDutyMainEntity.setStatus(-1); |
|
|
|
|
|
|
|
imsDutyMainEntity.setDutyPersonIds(personIds); |
|
|
|
|
|
|
|
imsDutyMainEntity.setCreateDept(imsSchedulingVo.getCreateDept()); |
|
|
|
|
|
|
|
Long id = IdWorker.getId(); |
|
|
|
|
|
|
|
imsDutyMainEntity.setId(id); |
|
|
|
|
|
|
|
imsDutyMainEntity.setCreateUser(AuthUtil.getUserId()); |
|
|
|
|
|
|
|
imsDutyMainEntity.setUpdateUser(AuthUtil.getUserId()); |
|
|
|
|
|
|
|
imsDutyMainEntity.setTenantId(AuthUtil.getTenantId()); |
|
|
|
|
|
|
|
imsDutyMainEntityList.add(imsDutyMainEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ImsDutyMainEntity imsDutyMainEntity = new ImsDutyMainEntity(); |
|
|
|
|
|
|
|
//人员ID
|
|
|
|
|
|
|
|
List<Long> collectPerson; |
|
|
|
|
|
|
|
//负责人ID
|
|
|
|
|
|
|
|
Long managerId = 0l; |
|
|
|
|
|
|
|
if (imsSchedulingVo.getPersonType() == 1) { |
|
|
|
|
|
|
|
//查询班组信息
|
|
|
|
|
|
|
|
List<ImsDutyGroupPEntity> list = imsDutyGroupPService.selectByGroupIds(Arrays.asList(Long.valueOf(groupId))); |
|
|
|
|
|
|
|
collectPerson = list.stream().filter(iter -> iter.getGroupId().toString().equals(groupId)).map(iter -> iter.getPersonId()).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(collectPerson)) { |
|
|
|
|
|
|
|
personIds = StringUtils.join(collectPerson, "^"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
imsDutyMainEntity.setDutyGroupId(Long.valueOf(groupId)); |
|
|
|
|
|
|
|
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(groupId); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(imsDutyGroupEntity) && ObjectUtil.isNotEmpty(imsDutyGroupEntity.getManagerId())) { |
|
|
|
|
|
|
|
managerId = imsDutyGroupEntity.getManagerId(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
//灵活排版没有班组信息
|
|
|
|
|
|
|
|
FlexibleSchedulingVo flexibleSchedulingVo = imsSchedulingVo.getFlexible().get(classId).get(tempSub); |
|
|
|
|
|
|
|
collectPerson = flexibleSchedulingVo.getPersonIds().stream().map(s -> Long.valueOf(s)).collect(Collectors.toList()); |
|
|
|
|
|
|
|
personIds = StringUtils.join(collectPerson, "^"); |
|
|
|
|
|
|
|
managerId = Long.valueOf(flexibleSchedulingVo.getChargeId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
setMainEntity(imsDutyMainEntity, classId, date); |
|
|
|
|
|
|
|
if (Func.isBlank(proDutyMainId)) { |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(imsDutyMainEntity1)) { |
|
|
|
|
|
|
|
proDutyMainId = imsDutyMainEntity1.getId().toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
imsDutyMainEntity.setPreDutyId(Long.valueOf(proDutyMainId)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtil.isNotBlank(personIds)) { |
|
|
|
|
|
|
|
imsDutyMainEntity.setDutyPersonIds(personIds); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
imsDutyMainEntity.setCreateDept(imsSchedulingVo.getCreateDept()); |
|
|
|
|
|
|
|
Long id = IdWorker.getId(imsDutyMainEntity); |
|
|
|
|
|
|
|
imsDutyMainEntity.setId(id); |
|
|
|
|
|
|
|
imsDutyMainEntity.setCreateUser(AuthUtil.getUserId()); |
|
|
|
|
|
|
|
imsDutyMainEntity.setUpdateUser(AuthUtil.getUserId()); |
|
|
|
|
|
|
|
imsDutyMainEntity.setTenantId(AuthUtil.getTenantId()); |
|
|
|
|
|
|
|
imsDutyMainEntityList.add(imsDutyMainEntity); |
|
|
|
|
|
|
|
proDutyMainId = id == null ? "" : imsDutyMainEntity.getId().toString(); |
|
|
|
|
|
|
|
//同步保存到排班计划-人员表
|
|
|
|
|
|
|
|
copyPersonByDutyMain(imsSchedulingVo, managerId, personEntityList, imsDutyMainEntity, collectPerson); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ThreadTask.dutyTask(imsDutyMainEntityList, personEntityList, imsSchedulingVo.getEndDate(), proDutyMainId, imsSchedulingVo.getCreateDept(), imsSchedulingVo.getDutyClassTypeId()); |
|
|
|
|
|
|
|
return R.success("操作成功,系统正在排班中,请稍后查看"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private R pollScheduling(ImsSchedulingVo imsSchedulingVo) { |
|
|
|
private R pollScheduling(ImsSchedulingVo imsSchedulingVo) { |
|
|
|
String[] start = imsSchedulingVo.getStartDate().split("-"); |
|
|
|
String[] start = imsSchedulingVo.getStartDate().split("-"); |
|
|
@ -347,6 +734,60 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
return R.data(new TreeMap<>(map)); |
|
|
|
return R.data(new TreeMap<>(map)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 查询已排班记录 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param year |
|
|
|
|
|
|
|
* @param month |
|
|
|
|
|
|
|
* @param deptId |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public R getSchedulingListV2(int year, int month, Long deptId) { |
|
|
|
|
|
|
|
String yearAndMonth = ""; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (month < 10) { |
|
|
|
|
|
|
|
yearAndMonth = year + "-0" + month; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
yearAndMonth = year + "-" + month; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<ImsSchedulingVo> imsSchedulingVos = this.baseMapper.selectByDateListV2(yearAndMonth, deptId); |
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(imsSchedulingVos)) { |
|
|
|
|
|
|
|
return R.success("该月未排班"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int days = getDaysByYearMonth(year, month); |
|
|
|
|
|
|
|
Map<String, List<ImsSchedulingVo>> map = new HashMap(); |
|
|
|
|
|
|
|
for (int i = 1; i <= days; i++) { |
|
|
|
|
|
|
|
String date = getDate(year, month, i); |
|
|
|
|
|
|
|
List<ImsSchedulingVo> collect = imsSchedulingVos.stream().filter(o -> DateUtil.format(o.getDutyDate(), DateUtil.PATTERN_DATE).equals(date)).sorted(Comparator.comparing(ImsSchedulingVo::getId)).collect(Collectors.toList()); |
|
|
|
|
|
|
|
collect = collect.stream().map(s -> { |
|
|
|
|
|
|
|
//灵活排班把班组名称拼接成人员名称
|
|
|
|
|
|
|
|
if (s.getGroupId() == null) { |
|
|
|
|
|
|
|
String[] split = s.getDutyPersonIds().split("\\^"); |
|
|
|
|
|
|
|
if (null != split && split.length > 0) { |
|
|
|
|
|
|
|
for (int j = 0; j < split.length; j++) { |
|
|
|
|
|
|
|
User user = UserCache.getUser(Long.valueOf(split[j])); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(user)) { |
|
|
|
|
|
|
|
if (j == split.length - 1) { |
|
|
|
|
|
|
|
s.setName(s.getName() + user.getName()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
s.setName(s.getName() + user.getName() + "、"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(s.getGroupId()); |
|
|
|
|
|
|
|
s.setName(s.getName() + imsDutyGroupEntity.getGroupName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return s; |
|
|
|
|
|
|
|
}).sorted(Comparator.comparing(ImsSchedulingVo::getId)).collect(Collectors.toList()); |
|
|
|
|
|
|
|
map.put(date, collect); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return R.data(new TreeMap<>(map)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* @Override |
|
|
|
/* @Override |
|
|
|
public R getSchedulingList(int year, int month,Long deptId) { |
|
|
|
public R getSchedulingList(int year, int month,Long deptId) { |
|
|
|
if (month < 10) { |
|
|
|
if (month < 10) { |
|
|
@ -397,6 +838,50 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
return R.data(list); |
|
|
|
return R.data(list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public R getMainIdByPersonV2(Long id) { |
|
|
|
|
|
|
|
List<ImsDutyMainVO> list = new ArrayList<>(); |
|
|
|
|
|
|
|
ImsDutyMainEntity imsDutyMainEntity = this.baseMapper.selectById(id); |
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(imsDutyMainEntity) || StringUtil.isBlank(imsDutyMainEntity.getDutyPersonIds())) { |
|
|
|
|
|
|
|
return R.data(""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String ids = imsDutyMainEntity.getDutyPersonIds(); |
|
|
|
|
|
|
|
String[] split = ids.split("\\^"); |
|
|
|
|
|
|
|
if (null != split && split.length > 0) { |
|
|
|
|
|
|
|
for (String s : split) { |
|
|
|
|
|
|
|
ImsDutyMainVO vo = new ImsDutyMainVO(); |
|
|
|
|
|
|
|
User user = UserCache.getUser(Long.valueOf(s)); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(user)) { |
|
|
|
|
|
|
|
vo.setUserId(s); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(user)) { |
|
|
|
|
|
|
|
vo.setUserName(user.getName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
vo.setId(id); |
|
|
|
|
|
|
|
list.add(vo); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Long managerId; |
|
|
|
|
|
|
|
if (null != (imsDutyMainEntity.getDutyGroupId())) { |
|
|
|
|
|
|
|
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(imsDutyMainEntity.getDutyGroupId()); |
|
|
|
|
|
|
|
managerId = imsDutyGroupEntity.getManagerId(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ |
|
|
|
|
|
|
|
eq(ImsDutyMainPersonEntity::getDutyMainId, imsDutyMainEntity.getId()); |
|
|
|
|
|
|
|
last("limit 1;"); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
managerId = imsDutyMainPersonEntity.getDutyChargePerson(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
list = list.stream().map(s -> { |
|
|
|
|
|
|
|
if (s.getUserId().equals(managerId.toString())) { |
|
|
|
|
|
|
|
s.setUserName(s.getUserName() + "(值班组组长)"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return s; |
|
|
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
return R.data(list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取当前值班班组 主页任务统计 |
|
|
|
* 获取当前值班班组 主页任务统计 |
|
|
|
* |
|
|
|
* |
|
|
@ -408,7 +893,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
eq("STATUS", 1).last("limit 1"); |
|
|
|
eq("STATUS", 1).last("limit 1"); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
|
|
|
|
|
|
|
|
return this.baseMapper.selectByIdOne(entity.getId(), null); |
|
|
|
return this.baseMapper.selectByIdOneV2(entity.getId(), null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -420,16 +905,24 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
private boolean doSaveTemplate(ImsSchedulingVo vo) { |
|
|
|
private boolean doSaveTemplate(ImsSchedulingVo vo) { |
|
|
|
List<ImsDutyMainTemplateEntity> list = iImsDutyMainTemplateService.list(new LambdaQueryWrapper<ImsDutyMainTemplateEntity>() {{ |
|
|
|
List<ImsDutyMainTemplateEntity> list = iImsDutyMainTemplateService.list(new LambdaQueryWrapper<ImsDutyMainTemplateEntity>() {{ |
|
|
|
eq(ImsDutyMainTemplateEntity::getTemplateName, vo.getTemplateName()); |
|
|
|
eq(ImsDutyMainTemplateEntity::getTemplateName, vo.getTemplateName()); |
|
|
|
|
|
|
|
eq(ImsDutyMainTemplateEntity::getType, vo.getPersonType()); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
if (CollectionUtil.isNotEmpty(list)) { |
|
|
|
if (CollectionUtil.isNotEmpty(list)) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
ImsDutyMainTemplateEntity entity = new ImsDutyMainTemplateEntity(); |
|
|
|
ImsDutyMainTemplateEntity entity = new ImsDutyMainTemplateEntity(); |
|
|
|
|
|
|
|
if (1 == vo.getPersonType()) { |
|
|
|
String dutyOrderIds = JSONObject.toJSONString(vo.getDutyOrderIds(), SerializerFeature.WriteMapNullValue); |
|
|
|
String dutyOrderIds = JSONObject.toJSONString(vo.getDutyOrderIds(), SerializerFeature.WriteMapNullValue); |
|
|
|
|
|
|
|
entity.setDutyOrderIds(dutyOrderIds); |
|
|
|
|
|
|
|
entity.setType(1); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
String flexible = JSONObject.toJSONString(vo.getFlexible(), SerializerFeature.WriteMapNullValue); |
|
|
|
|
|
|
|
entity.setFlexible(flexible); |
|
|
|
|
|
|
|
entity.setType(2); |
|
|
|
|
|
|
|
} |
|
|
|
String dutyArrIds = JSONObject.toJSONString(vo.getDutyArrIds(), SerializerFeature.WriteMapNullValue); |
|
|
|
String dutyArrIds = JSONObject.toJSONString(vo.getDutyArrIds(), SerializerFeature.WriteMapNullValue); |
|
|
|
entity.setDutyNum(vo.getDutyNum()); |
|
|
|
entity.setDutyNum(vo.getDutyNum()); |
|
|
|
entity.setTemplateName(vo.getTemplateName()); |
|
|
|
entity.setTemplateName(vo.getTemplateName()); |
|
|
|
entity.setDutyOrderIds(dutyOrderIds); |
|
|
|
|
|
|
|
entity.setDutyArrIds(dutyArrIds); |
|
|
|
entity.setDutyArrIds(dutyArrIds); |
|
|
|
entity.setDutyClassTypeId(vo.getDutyClassTypeId()); |
|
|
|
entity.setDutyClassTypeId(vo.getDutyClassTypeId()); |
|
|
|
entity.setCreateDept(vo.getCreateDept()); |
|
|
|
entity.setCreateDept(vo.getCreateDept()); |
|
|
@ -513,7 +1006,27 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<ImsDutyMainMergeVo> getDutyMainByDept(List<Long> list) { |
|
|
|
public List<ImsDutyMainMergeVo> getDutyMainByDept(List<Long> list) { |
|
|
|
return this.baseMapper.selectDutyMainByDept(list); |
|
|
|
return getDutyMainByDeptV2(list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public List<ImsDutyMainMergeVo> getDutyMainByDeptV2(List<Long> list) { |
|
|
|
|
|
|
|
List<ImsDutyMainMergeVo> imsDutyMainMergeVos = this.baseMapper.selectDutyMainByDeptV2(list); |
|
|
|
|
|
|
|
imsDutyMainMergeVos = imsDutyMainMergeVos.stream().map(s -> { |
|
|
|
|
|
|
|
if (null == s.getGroupId()) { |
|
|
|
|
|
|
|
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ |
|
|
|
|
|
|
|
eq(ImsDutyMainPersonEntity::getDutyMainId, s.getDutyId()); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
s.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(s.getGroupId()); |
|
|
|
|
|
|
|
s.setGroupName(imsDutyGroupEntity.getGroupName()); |
|
|
|
|
|
|
|
s.setGroupId(imsDutyGroupEntity.getId()); |
|
|
|
|
|
|
|
s.setManagerId(imsDutyGroupEntity.getManagerId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return s; |
|
|
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
return imsDutyMainMergeVos; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -553,11 +1066,11 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
return this.baseMapper.selectSchedulingVoByDateList(startDate, endDate); |
|
|
|
return this.baseMapper.selectSchedulingVoByDateList(startDate, endDate); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<HomePageDutyMainInfoVo> getHomePageDutyInfo(Long deptId) { |
|
|
|
public List<HomePageDutyMainInfoVo> getHomePageDutyInfo(Long deptId) { |
|
|
|
List<HomePageDutyMainInfoVo> list = new ArrayList<>(); |
|
|
|
List<HomePageDutyMainInfoVo> list = new ArrayList<>(); |
|
|
|
List<DutyMainInfoVo> dutyMainInfoVos = this.baseMapper.selectDutyMainInfoVo(deptId); |
|
|
|
List<DutyMainInfoVo> dutyMainInfoVos = getDutyDataV2(deptId); |
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(dutyMainInfoVos)) { |
|
|
|
if (CollectionUtil.isNotEmpty(dutyMainInfoVos)) { |
|
|
|
for (DutyMainInfoVo dutyMainInfoVo : dutyMainInfoVos) { |
|
|
|
for (DutyMainInfoVo dutyMainInfoVo : dutyMainInfoVos) { |
|
|
|
HomePageDutyMainInfoVo vo = new HomePageDutyMainInfoVo(); |
|
|
|
HomePageDutyMainInfoVo vo = new HomePageDutyMainInfoVo(); |
|
|
@ -591,7 +1104,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
dutyMainInfoVo.setGeneratingCapacity(generatingCapacity); |
|
|
|
dutyMainInfoVo.setGeneratingCapacity(generatingCapacity); |
|
|
|
} |
|
|
|
} |
|
|
|
vo.setHeadInfo(dutyMainInfoVo); |
|
|
|
vo.setHeadInfo(dutyMainInfoVo); |
|
|
|
DutyMainInfoVo corryVo = this.baseMapper.selectDutyMainInfoSign(dutyMainInfoVo.getId()); |
|
|
|
DutyMainInfoVo corryVo = getNextDutyDataV2(dutyMainInfoVo.getId()); |
|
|
|
if (ObjectUtil.isNotEmpty(corryVo) && Func.isNotBlank(corryVo.getDutyPersonIds())) { |
|
|
|
if (ObjectUtil.isNotEmpty(corryVo) && Func.isNotBlank(corryVo.getDutyPersonIds())) { |
|
|
|
List<AuditVo> auditVoList = new ArrayList<>(); |
|
|
|
List<AuditVo> auditVoList = new ArrayList<>(); |
|
|
|
for (String personId : corryVo.getDutyPersonIds().split("\\^")) { |
|
|
|
for (String personId : corryVo.getDutyPersonIds().split("\\^")) { |
|
|
@ -619,7 +1132,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<DutyMainInfoVo> getDutyDurationDate() { |
|
|
|
public List<DutyMainInfoVo> getDutyDurationDate() { |
|
|
|
//获取当班信息
|
|
|
|
//获取当班信息
|
|
|
|
List<DutyMainInfoVo> dutyList = this.baseMapper.selectDutyMainInfoVo(null); |
|
|
|
List<DutyMainInfoVo> dutyList = getDutyDataV2(null); |
|
|
|
dutyList.forEach(dutyVO -> { |
|
|
|
dutyList.forEach(dutyVO -> { |
|
|
|
Time startTime = dutyVO.getStartTime(); |
|
|
|
Time startTime = dutyVO.getStartTime(); |
|
|
|
Time endTime = dutyVO.getEndTime(); |
|
|
|
Time endTime = dutyVO.getEndTime(); |
|
|
@ -639,6 +1152,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 查询排班数据 |
|
|
|
* 查询排班数据 |
|
|
|
|
|
|
|
* |
|
|
|
* @param deptIdList |
|
|
|
* @param deptIdList |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -648,10 +1162,24 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
// 查询区域当前值班
|
|
|
|
// 查询区域当前值班
|
|
|
|
List<DutyInfoVo> dutyInfoVoList = this.baseMapper.getDutyData(deptIdList); |
|
|
|
List<DutyInfoVo> dutyInfoVoList = this.baseMapper.getDutyDataV2(deptIdList); |
|
|
|
if (CollectionUtil.isEmpty(dutyInfoVoList)) { |
|
|
|
if (CollectionUtil.isEmpty(dutyInfoVoList)) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//修改数据结构后:分灵活排班和班组排班拿负责人
|
|
|
|
|
|
|
|
dutyInfoVoList = dutyInfoVoList.stream().map(s -> { |
|
|
|
|
|
|
|
if (null == s.getGroupId()) { |
|
|
|
|
|
|
|
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ |
|
|
|
|
|
|
|
eq(ImsDutyMainPersonEntity::getDutyMainId, s.getId()); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
s.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson().toString()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(s.getGroupId()); |
|
|
|
|
|
|
|
s.setGroupName(imsDutyGroupEntity.getGroupName()); |
|
|
|
|
|
|
|
s.setManagerId(imsDutyGroupEntity.getManagerId().toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return s; |
|
|
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
dutyInfoVoList.forEach(item -> { |
|
|
|
dutyInfoVoList.forEach(item -> { |
|
|
|
// 负责人
|
|
|
|
// 负责人
|
|
|
|
User user = UserCache.getUser(Long.valueOf(item.getManagerId())); |
|
|
|
User user = UserCache.getUser(Long.valueOf(item.getManagerId())); |
|
|
@ -673,14 +1201,32 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
return dutyInfoVoList; |
|
|
|
return dutyInfoVoList; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public R getAllPersonInfo(Long deptId) { |
|
|
|
|
|
|
|
R<List<User>> allUserList = userClient.userListByDeptId(deptId); |
|
|
|
|
|
|
|
return allUserList; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取上一班组 |
|
|
|
* 获取上一班组 |
|
|
|
|
|
|
|
* |
|
|
|
* @param item |
|
|
|
* @param item |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private NextDutyInfoVo getUpDutyInfo(DutyInfoVo item) { |
|
|
|
private NextDutyInfoVo getUpDutyInfo(DutyInfoVo item) { |
|
|
|
DutyMainInfoVo dutyMainInfoVo = this.baseMapper.queryDutyInfo(item.getPreDutyId()); |
|
|
|
DutyMainInfoVo dutyMainInfoVo = this.baseMapper.queryDutyInfoV2(item.getPreDutyId()); |
|
|
|
|
|
|
|
if (null == dutyMainInfoVo.getGroupName()) { |
|
|
|
|
|
|
|
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ |
|
|
|
|
|
|
|
eq(ImsDutyMainPersonEntity::getDutyMainId, dutyMainInfoVo.getId()); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
dutyMainInfoVo.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson().toString()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(dutyMainInfoVo.getDutyGroupId()); |
|
|
|
|
|
|
|
dutyMainInfoVo.setGroupName(imsDutyGroupEntity.getGroupName()); |
|
|
|
|
|
|
|
dutyMainInfoVo.setDutyGroupId(imsDutyGroupEntity.getId()); |
|
|
|
|
|
|
|
dutyMainInfoVo.setManagerId(imsDutyGroupEntity.getManagerId().toString()); |
|
|
|
|
|
|
|
} |
|
|
|
if (ObjectUtil.isEmpty(dutyMainInfoVo)) { |
|
|
|
if (ObjectUtil.isEmpty(dutyMainInfoVo)) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -704,11 +1250,12 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取下一班组 |
|
|
|
* 获取下一班组 |
|
|
|
|
|
|
|
* |
|
|
|
* @param item |
|
|
|
* @param item |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private NextDutyInfoVo getNextDutyInfo(DutyInfoVo item) { |
|
|
|
private NextDutyInfoVo getNextDutyInfo(DutyInfoVo item) { |
|
|
|
DutyMainInfoVo dutyMainInfoVo = this.baseMapper.selectDutyMainInfoSign(item.getId()); |
|
|
|
DutyMainInfoVo dutyMainInfoVo = getNextDutyDataV2(item.getId()); |
|
|
|
if (ObjectUtil.isEmpty(dutyMainInfoVo)) { |
|
|
|
if (ObjectUtil.isEmpty(dutyMainInfoVo)) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -802,7 +1349,6 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ImsDutyMainEntity> imsDutyMainEntityList = new ArrayList<>(); |
|
|
|
List<ImsDutyMainEntity> imsDutyMainEntityList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
String proDutyMainId = ""; |
|
|
|
String proDutyMainId = ""; |
|
|
|
//排班
|
|
|
|
//排班
|
|
|
|
for (int i = 1; i <= dates.size(); i++) { |
|
|
|
for (int i = 1; i <= dates.size(); i++) { |
|
|
@ -893,6 +1439,12 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
imsDutyMainEntity.setCreateTime(new Date()); |
|
|
|
imsDutyMainEntity.setCreateTime(new Date()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setMainEntity(ImsDutyMainEntity imsDutyMainEntity, String classId, String date) { |
|
|
|
|
|
|
|
imsDutyMainEntity.setDutyDate(DateUtil.parse(date, DateUtil.PATTERN_DATE)); |
|
|
|
|
|
|
|
imsDutyMainEntity.setClassId(Long.valueOf(classId)); |
|
|
|
|
|
|
|
imsDutyMainEntity.setStatus(0); |
|
|
|
|
|
|
|
imsDutyMainEntity.setCreateTime(new Date()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 根据 年、月 获取对应的月份 的 天数 |
|
|
|
* 根据 年、月 获取对应的月份 的 天数 |
|
|
@ -909,11 +1461,32 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取当班 |
|
|
|
* 获取当班 |
|
|
|
|
|
|
|
* |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<DutyMainInfoVo> getDutyData(Long deptId) { |
|
|
|
public List<DutyMainInfoVo> getDutyData(Long deptId) { |
|
|
|
return this.baseMapper.selectDutyMainInfoVo(deptId); |
|
|
|
return getDutyDataV2(deptId); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public List<DutyMainInfoVo> getDutyDataV2(Long deptId) { |
|
|
|
|
|
|
|
List<DutyMainInfoVo> dutyMainInfoVos = this.baseMapper.selectDutyMainInfoVoV2(deptId); |
|
|
|
|
|
|
|
dutyMainInfoVos = dutyMainInfoVos.stream().map(s -> { |
|
|
|
|
|
|
|
if (null == s.getGroupName()) { |
|
|
|
|
|
|
|
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ |
|
|
|
|
|
|
|
eq(ImsDutyMainPersonEntity::getDutyMainId, s.getId()); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
s.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson().toString()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(s.getDutyGroupId()); |
|
|
|
|
|
|
|
s.setGroupName(imsDutyGroupEntity.getGroupName()); |
|
|
|
|
|
|
|
s.setDutyGroupId(imsDutyGroupEntity.getId()); |
|
|
|
|
|
|
|
s.setManagerId(imsDutyGroupEntity.getManagerId().toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return s; |
|
|
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
return dutyMainInfoVos; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -921,4 +1494,20 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
return this.baseMapper.selectDutyMainInfoSign(parentId); |
|
|
|
return this.baseMapper.selectDutyMainInfoSign(parentId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public DutyMainInfoVo getNextDutyDataV2(Long parentId) { |
|
|
|
|
|
|
|
DutyMainInfoVo dutyMainInfoVo = this.baseMapper.selectDutyMainInfoSignV2(parentId); |
|
|
|
|
|
|
|
if (null == dutyMainInfoVo.getGroupName()) { |
|
|
|
|
|
|
|
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ |
|
|
|
|
|
|
|
eq(ImsDutyMainPersonEntity::getDutyMainId, dutyMainInfoVo.getId()); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
dutyMainInfoVo.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson().toString()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(dutyMainInfoVo.getDutyGroupId()); |
|
|
|
|
|
|
|
dutyMainInfoVo.setGroupName(imsDutyGroupEntity.getGroupName()); |
|
|
|
|
|
|
|
dutyMainInfoVo.setDutyGroupId(imsDutyGroupEntity.getId()); |
|
|
|
|
|
|
|
dutyMainInfoVo.setManagerId(imsDutyGroupEntity.getManagerId().toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return dutyMainInfoVo; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|