Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
yang_shj 1 year ago
parent
commit
338e83e59f
  1. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.java
  2. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainMapper.java
  3. 24
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainMapper.xml
  4. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyMainService.java
  5. 27
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java

14
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyMainController.java

@ -6,6 +6,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType; import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType; import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainReportExcel; import com.hnac.hzims.operational.duty.entity.ImsDutyMainReportExcel;
import com.hnac.hzims.operational.duty.service.IImsDutyMainService; import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
@ -32,6 +33,7 @@ import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -254,4 +256,16 @@ public class ImsDutyMainController extends BladeController {
.registerWriteHandler(new ExcelMergeHandler(mergeRowIndex, mergeColumeIndex)).sheet().doWrite(list); .registerWriteHandler(new ExcelMergeHandler(mergeRowIndex, mergeColumeIndex)).sheet().doWrite(list);
} }
/**
* 个人排班表
*/
@GetMapping("/personScheduling")
@ApiOperationSupport(order = 8)
@ApiOperation(value = "个人排班表", notes = "个人排班表")
public R personScheduling(@RequestParam String date) {
if(StringUtils.isBlank(date)){
date = new SimpleDateFormat("yyyy-MM").format(new Date());
}
return imsDutyMainService.personScheduling(date);
}
} }

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainMapper.java

@ -1,5 +1,6 @@
package com.hnac.hzims.operational.duty.mapper; package com.hnac.hzims.operational.duty.mapper;
import com.baomidou.mybatisplus.annotation.SqlParser;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity;
import com.hnac.hzims.operational.duty.vo.*; import com.hnac.hzims.operational.duty.vo.*;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -72,4 +73,7 @@ public interface ImsDutyMainMapper extends UserDataScopeBaseMapper<ImsDutyMainEn
List<DutyInfoVo> getDutyDataV2(@Param("list") List<Long> deptIdList); List<DutyInfoVo> getDutyDataV2(@Param("list") List<Long> deptIdList);
List<ImsSchedulingVo> selectByDateListV2(@Param(value = "date")String date,@Param(value = "deptId") Long deptId); List<ImsSchedulingVo> selectByDateListV2(@Param(value = "date")String date,@Param(value = "deptId") Long deptId);
@SqlParser(filter = true)
List<ImsSchedulingVo> selectDutyMainByPerson(@Param(value = "date")String date,@Param(value = "userId") Long userId);
} }

24
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyMainMapper.xml

@ -56,6 +56,30 @@
</foreach> </foreach>
</if> </if>
</delete> </delete>
<select id="selectDutyMainByPerson" resultType="com.hnac.hzims.operational.duty.vo.ImsSchedulingVo">
SELECT
DM.ID AS id,
DM.DUTY_GROUP_ID AS groupId,
DM.CLASS_ID AS classId,
DM.PRE_DUTY_ID AS preDutyId,
DM.status ,
DM.DUTY_DATE AS dutyDate,
CONCAT(CASE WHEN DM.`CLASS_ID` = 0 THEN '休息' ELSE DC.CLASS_NAME END, '-', DG.GROUP_NAME) AS name,
DC.START_TIME AS startTime,
DC.END_TIME AS endTime,
DM.CREATE_USER,
DM.CREATE_DEPT
FROM
hz_ims_duty_main DM
LEFT JOIN hz_ims_duty_class DC
ON DM.CLASS_ID = DC.ID
LEFT JOIN hz_ims_duty_group DG
ON DM.DUTY_GROUP_ID = DG.ID
where DM.is_deleted = 0
and DM.duty_date like CONCAT('%',#{date}, '%')
and DM.DUTY_PERSON_IDS like CONCAT('%',#{userId}, '%')
ORDER BY DM.`DUTY_DATE`,DC.`START_TIME`,DC.`END_TIME` ASC
</select>
<select id="selectByDateList" resultType="com.hnac.hzims.operational.duty.vo.ImsSchedulingVo"> <select id="selectByDateList" resultType="com.hnac.hzims.operational.duty.vo.ImsSchedulingVo">
SELECT SELECT
DM.ID AS id, DM.ID AS id,

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyMainService.java

@ -151,4 +151,6 @@ public interface IImsDutyMainService extends BaseService<ImsDutyMainEntity> {
R updateDutyMainInfoVoById(ChangeDutyMainVo changeDutyMainVo); R updateDutyMainInfoVoById(ChangeDutyMainVo changeDutyMainVo);
List<ImsDutyMainReportExcel> getExcelDutyData(Integer year, Integer month, Long deptId); List<ImsDutyMainReportExcel> getExcelDutyData(Integer year, Integer month, Long deptId);
R personScheduling(String date);
} }

27
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java

@ -21,6 +21,7 @@ import com.hnac.hzims.operational.main.vo.DutyPersonalReportVO;
import com.hnac.hzims.operational.report.vo.DutyReportVO; import com.hnac.hzims.operational.report.vo.DutyReportVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -1525,6 +1526,32 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
return dutyMainReportExcelList; return dutyMainReportExcelList;
} }
@Override
public R personScheduling(String date) {
if (ObjectUtil.isEmpty(AuthUtil.getUserId())){
throw new ServiceException("暂无用户登录信息,请加载后重试");
}
List<ImsSchedulingVo> imsSchedulingVos = this.baseMapper.selectDutyMainByPerson(date, AuthUtil.getUserId());
imsSchedulingVos= imsSchedulingVos.stream().map(s->{
if(StringUtils.isBlank(s.getGroupNames())){
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, s.getId());
last("limit 1");
}});
if (StringUtils.isNotBlank(imsDutyMainPersonEntity.getDutyGroupName())){
s.setGroupName(imsDutyMainPersonEntity.getDutyGroupName());
}else {
s.setGroupName("临时班组");
}
}
return s;
}).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(imsSchedulingVos)){
return R.data(imsSchedulingVos);
}
return R.fail("暂无排班计划");
}
/** /**
* 获取上一班组 * 获取上一班组

Loading…
Cancel
Save