lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEfficiencyReportController.java
@@ -10,6 +10,7 @@ import org.jeecg.modules.mdc.service.MdcEfficiencyReportService; import org.jeecg.modules.mdc.vo.MdcEfficiencyReportQueryVo; import org.jeecg.modules.mdc.vo.MdcEfficiencyReportShiftQueryVo; import org.jeecg.modules.mdc.vo.MdcEfficiencyShiftVo; import org.jeecg.modules.mdc.vo.MdcEfficiencyVo; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -56,7 +57,7 @@ public Result efficiencyShiftList(MdcEfficiencyReportShiftQueryVo vo) { LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); String userId = user.getId(); MdcEfficiencyVo result = mdcEfficiencyReportService.efficiencyShiftList(userId, vo); MdcEfficiencyShiftVo result = mdcEfficiencyReportService.efficiencyShiftList(userId, vo); return Result.OK(result); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcVacationManagementController.java
@@ -27,7 +27,7 @@ @Slf4j @RestController @Api(tags = "åæç®¡ç") @RequestMapping("/mdc/MdcVacationManagement") @RequestMapping("/mdc/mdcVacationManagement") public class MdcVacationManagementController extends JeecgController<MdcVacationManagement, IMdcVacationManagementService> { @Resource lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEfficiencyShiftListDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,40 @@ package org.jeecg.modules.mdc.dto; import lombok.Data; import java.util.List; /** * @author: LiuS * @create: 2023-07-10 15:10 */ @Data public class MdcEfficiencyShiftListDto { private String level1; private String level2; private String level3; /** * 设å¤ç¼ç */ private String equipmentId; /** * 设å¤åç§° */ private String equipmentName; /** * 设å¤ç±»å */ private String equipmentType; /** * çæ¬¡åç§° */ private String shiftSubName; /** * å©ç¨çæ°æ® */ private List<MdcEfficiencyResultDto> dataList; } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcVacationManagement.java
@@ -104,6 +104,18 @@ private String updateBy; /** * å¼å§æ¶é´ */ @TableField(exist = false) private String startTime; /** * ç»ææ¶é´ */ @TableField(exist = false) private String endTime; /** * åå°ä¼ å ¥ï¼å¤ææ¯ä¸ªid */ @TableField(exist = false) lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/GenerateWeekDaysJob.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,35 @@ package org.jeecg.modules.mdc.job; import lombok.extern.slf4j.Slf4j; import org.jeecg.common.util.DateUtils; import org.jeecg.modules.mdc.service.IMdcVacationManagementService; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import javax.annotation.Resource; /** * çæå伿¥å®æ¶ä»»å¡ * * @author: LiuS * @create: 2023-07-11 15:17 */ @Slf4j public class GenerateWeekDaysJob implements Job { @Resource private IMdcVacationManagementService mdcVacationManagementService; @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { log.info("宿¶çæå伿¥ä»»å¡ GenerateWeekDaysJob start! æ¶é´:" + DateUtils.now()); try { mdcVacationManagementService.generateWeekDays(); log.info("宿¶çæå伿¥ä»»å¡ GenerateWeekDaysJob æ§è¡æå!"); } catch (Exception e) { log.error("宿¶çæå伿¥ä»»å¡ GenerateWeekDaysJob æ§è¡å¤±è´¥!"); log.error(e.getMessage(), e); } } } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcVacationManagementMapper.xml
@@ -3,18 +3,24 @@ <mapper namespace="org.jeecg.modules.mdc.mapper.MdcVacationManagementMappper"> <!--æ ¹æ®è½¦é´å±çº§æ¥è¯¢åæå表--> <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcVacationManagement"> select mvm.* from mdc_vacation_management mvm,mdc_equipment me where mvm.equipment_id=me.equipment_id <if test="vacation.equipmentName != null and vacation.equipmentName != '' "> and mvm.equipment_name like concat(concat('%',#{vacation.equipmentName}),'%') </if> <if test="vacation.equipmentId != null and vacation.equipmentId !='' "> and mvm.equipment_id like concat(concat('%',#{vacation.equipmentId}),'%') </if> <if test="vacation.mdcSectionIds != null || vacation.mdcSectionIds.size() > 0 "> and mvm.equipment_id in <foreach collection="vacation.mdcSectionIds" item="id" index="index" open="(" close=")" separator=","> #{id} </foreach> </if> select * from mdc_vacation_management <where> <if test="vacation.equipmentName != null and vacation.equipmentName != '' "> and equipment_name like concat(concat('%',#{vacation.equipmentName}),'%') </if> <if test="vacation.equipmentId != null and vacation.equipmentId !='' "> and equipment_id like concat(concat('%',#{vacation.equipmentId}),'%') </if> <if test="vacation.startTime != null and vacation.endTime != null"> and vacation_date between #{ vacation.startTime } and #{ vacation.endTime } </if> <if test="vacation.mdcSectionIds != null || vacation.mdcSectionIds.size() > 0 "> and equipment_id in <foreach collection="vacation.mdcSectionIds" item="id" index="index" open="(" close=")" separator=","> #{id} </foreach> </if> order by vacation_date asc </where> </select> </mapper> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcVacationManagementService.java
@@ -59,4 +59,10 @@ * @return */ IPage<MdcVacationManagement> pageList(String userId, Page page, HttpServletRequest req,MdcVacationManagement mdcVacationManagement); /** * çæå伿¥ä»»å¡ */ void generateWeekDays(); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEfficiencyReportService.java
@@ -2,6 +2,7 @@ import org.jeecg.modules.mdc.vo.MdcEfficiencyReportQueryVo; import org.jeecg.modules.mdc.vo.MdcEfficiencyReportShiftQueryVo; import org.jeecg.modules.mdc.vo.MdcEfficiencyShiftVo; import org.jeecg.modules.mdc.vo.MdcEfficiencyVo; /** @@ -35,5 +36,5 @@ * @param vo * @return */ MdcEfficiencyVo efficiencyShiftList(String userId, MdcEfficiencyReportShiftQueryVo vo); MdcEfficiencyShiftVo efficiencyShiftList(String userId, MdcEfficiencyReportShiftQueryVo vo); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java
@@ -13,6 +13,7 @@ import org.jeecg.modules.mdc.util.DateUtils; import org.jeecg.modules.mdc.vo.MdcEfficiencyReportQueryVo; import org.jeecg.modules.mdc.vo.MdcEfficiencyReportShiftQueryVo; import org.jeecg.modules.mdc.vo.MdcEfficiencyShiftVo; import org.jeecg.modules.mdc.vo.MdcEfficiencyVo; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.entity.SysDepart; @@ -414,8 +415,47 @@ * @return */ @Override public MdcEfficiencyVo efficiencyShiftList(String userId, MdcEfficiencyReportShiftQueryVo vo) { return null; public MdcEfficiencyShiftVo efficiencyShiftList(String userId, MdcEfficiencyReportShiftQueryVo vo) { MdcEfficiencyShiftVo result = new MdcEfficiencyShiftVo(); List<MdcEfficiencyShiftListDto> listDtos = new ArrayList<>(); List<String> equipmentIds = new ArrayList<>(); if (StringUtils.isNotEmpty(vo.getParentId()) && StringUtils.isEmpty(vo.getEquipmentId())) { if ("2".equals(vo.getTypeTree())) { // é¨é¨å±çº§ equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, vo.getParentId()); } else { // 产线å±çº§ equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, vo.getParentId()); } } else if (StringUtils.isNotEmpty(vo.getEquipmentId())) { // åå°è®¾å¤ä¿¡æ¯ vo.setEquipmentIdList(Collections.singletonList(vo.getEquipmentId())); } else { // æ¥è¯¢ç¨æ·æ¥æçææè®¾å¤ä¿¡æ¯ if ("2".equals(vo.getTypeTree())) { // é¨é¨å±çº§ equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); } else { // 产线å±çº§ equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); } } if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) { vo.setEquipmentIdList(equipmentIds); } List<String> dates = DateUtils.getDatesStringList2(DateUtils.getShortDate2(vo.getStartTime()), DateUtils.getShortDate2(vo.getEndTime())); result.setDates(dates); if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) { result.setMdcEfficiencyList(listDtos); } else { // çæ¬¡å©ç¨çç级 List<MdcUtilizationRate> mdcUtilizationRateList = mdcUtilizationRateService.listByType("kdl"); } return result; } private MdcEfficiencyResultDto efficiencyRate(List<MdcEfficiencyDto> efficiencyList, String date, String equipmentId, List<MdcUtilizationRate> mdcUtilizationRateList) { lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcVacationManagementServiceImpl.java
@@ -1,5 +1,6 @@ package org.jeecg.modules.mdc.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -8,12 +9,17 @@ import org.jeecg.modules.mdc.mapper.MdcVacationManagementMappper; import org.jeecg.modules.mdc.service.IMdcEquipmentService; import org.jeecg.modules.mdc.service.IMdcVacationManagementService; import org.jeecg.modules.mdc.util.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletRequest; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.time.temporal.TemporalAdjusters; import java.util.*; /** @@ -54,45 +60,55 @@ @Override public IPage<MdcVacationManagement> pageList(String userId, Page page, HttpServletRequest req, MdcVacationManagement mdcVacationManagement) { //æ¾ç¤ºå伿¥ Date vacationDate=mdcVacationManagement.getVacationDate(); String type= mdcVacationManagement.getType(); Calendar c=Calendar.getInstance(); c.setTime(vacationDate); int day=c.get(Calendar.DAY_OF_WEEK)-1; System.out.println(day); if (day==6||day==7){ System.out.println("å伿¥"); mdcVacationManagement.setType("å伿¥"); } //æ¥è¯¢ç¨æ·ææ¥æç设å¤ä¿¡æ¯ List<String> equipmentIds=new ArrayList<>(); if (StringUtils.isNotEmpty(mdcVacationManagement.getParentId()) && StringUtils.isEmpty(mdcVacationManagement.getEquipmentId())){ if ("2".equals(mdcVacationManagement.getTypeTree())){ List<String> equipmentIds = new ArrayList<>(); if (StringUtils.isNotEmpty(mdcVacationManagement.getParentId()) && StringUtils.isEmpty(mdcVacationManagement.getEquipmentId())) { if ("2".equals(mdcVacationManagement.getTypeTree())) { //é¨é¨å±çº§ equipmentIds=equipmentService.getEquipmentIdsByDepart(userId,mdcVacationManagement.getParentId()); }else { equipmentIds = equipmentService.getEquipmentIdsByDepart(userId, mdcVacationManagement.getParentId()); } else { //产线å±çº§ equipmentIds=equipmentService.getEquipmentIdsProduction(userId,mdcVacationManagement.getParentId()); equipmentIds = equipmentService.getEquipmentIdsProduction(userId, mdcVacationManagement.getParentId()); } }else if (StringUtils.isNotEmpty(mdcVacationManagement.getEquipmentId())){ } else if (StringUtils.isNotEmpty(mdcVacationManagement.getEquipmentId())) { //åå°è®¾å¤ä¿¡æ¯ mdcVacationManagement.setMdcSectionIds(Collections.singletonList(mdcVacationManagement.getEquipmentId())); }else { } else { //æ¥è¯¢ç¨æ·ææ¥æç设å¤ä¿¡æ¯ if ("2".equals(mdcVacationManagement.getTypeTree())){ if ("2".equals(mdcVacationManagement.getTypeTree())) { //é¨é¨å±çº§ equipmentIds=equipmentService.getEquipmentIdsByDepart(userId,null); }else { equipmentIds=equipmentService.getEquipmentIdsProduction(userId,null); equipmentIds = equipmentService.getEquipmentIdsByDepart(userId, null); } else { equipmentIds = equipmentService.getEquipmentIdsProduction(userId, null); } } if (mdcVacationManagement.getMdcSectionIds() == null || mdcVacationManagement.getMdcSectionIds().isEmpty()){ if (mdcVacationManagement.getMdcSectionIds() == null || mdcVacationManagement.getMdcSectionIds().isEmpty()) { mdcVacationManagement.setMdcSectionIds(equipmentIds); } if (mdcVacationManagement.getMdcSectionIds() == null || mdcVacationManagement.getMdcSectionIds().isEmpty()){ if (mdcVacationManagement.getMdcSectionIds() == null || mdcVacationManagement.getMdcSectionIds().isEmpty()) { return null; } return this.baseMapper.pageList(page,mdcVacationManagement); return this.baseMapper.pageList(page, mdcVacationManagement); } /** * çæå伿¥ */ @Override public void generateWeekDays() { MdcVacationManagement mdcVacationManagement = this.baseMapper.selectOne(new LambdaQueryWrapper<MdcVacationManagement>().eq(MdcVacationManagement::getType, "å伿¥").orderByDesc(MdcVacationManagement::getVacationDate).last("limit 1")); // è·åçæå¼å§æ¶é´åç»ææ¶é´ LocalDate startDate; LocalDate endDate; if (mdcVacationManagement == null) { startDate = LocalDate.now(); endDate = LocalDate.of(DateUtils.getYear(), DateUtils.getMonth(), DateUtils.getDayOfMonth()); } else { LocalDate vacationDate = mdcVacationManagement.getVacationDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate().plusMonths(1); startDate = vacationDate.with(TemporalAdjusters.firstDayOfMonth()); endDate = vacationDate.with(TemporalAdjusters.lastDayOfMonth()); } // è·åå¼å§æ¶é´åç»ææ¶é´çä¸é´å伿¥éå List<Date> dateList = DateUtils.getWeekDays(startDate, endDate); } } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DateUtils.java
@@ -5,6 +5,7 @@ import java.text.DecimalFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.util.*; import java.util.regex.Pattern; @@ -972,4 +973,14 @@ SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return sd.format(date); } /** * * @param startDate * @param endDate * @return */ public static List<Date> getWeekDays(LocalDate startDate, LocalDate endDate) { return null; } } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcEfficiencyShiftVo.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,22 @@ package org.jeecg.modules.mdc.vo; import lombok.Data; import org.jeecg.modules.mdc.dto.MdcEfficiencyShiftListDto; import java.util.List; /** * @author: LiuS * @create: 2023-07-10 14:59 */ @Data public class MdcEfficiencyShiftVo { /** * çæ¬¡å©ç¨çæ°æ® */ private List<MdcEfficiencyShiftListDto> mdcEfficiencyList; private List<String> dates; }