lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcPlanCloseController.java
@@ -5,18 +5,21 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.commons.lang.StringUtils; import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.aspect.annotation.AutoLog; import lombok.extern.slf4j.Slf4j; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.mdc.entity.MdcPlanClose; import org.jeecg.modules.mdc.service.IMdcPlanCloseService; import org.jeecg.modules.mdc.vo.MdcPlanCloseVo; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; @@ -24,13 +27,13 @@ import io.swagger.annotations.ApiOperation; /** * @Description: mdc计ååæºç»´æ¤è¡¨ * @Description: mdc(计å/é计å)åæºç»´æ¤è¡¨ * @Author: Lius * @Date: 2023-07-13 * @Version: V1.0 */ @Slf4j @Api(tags = "mdc计ååæºç»´æ¤è¡¨") @Api(tags = "mdc(计å/é计å)åæºç»´æ¤è¡¨") @RestController @RequestMapping("/mdc/mdcPlanClose") public class MdcPlanCloseController extends JeecgController<MdcPlanClose, IMdcPlanCloseService> { @@ -47,16 +50,17 @@ * @param req * @return */ @AutoLog(value = "mdc计ååæºç»´æ¤è¡¨-å页å表æ¥è¯¢") @ApiOperation(value = "mdc计ååæºç»´æ¤è¡¨-å页å表æ¥è¯¢", notes = "mdc计ååæºç»´æ¤è¡¨-å页å表æ¥è¯¢") @AutoLog(value = "mdc(计å/é计å)åæºç»´æ¤è¡¨-å页å表æ¥è¯¢") @ApiOperation(value = "mdc(计å/é计å)åæºç»´æ¤è¡¨-å页å表æ¥è¯¢", notes = "mdc(计å/é计å)åæºç»´æ¤è¡¨-å页å表æ¥è¯¢") @GetMapping(value = "/list") public Result<?> queryPageList(MdcPlanClose mdcPlanClose, public Result<?> queryPageList(MdcPlanCloseVo mdcPlanClose, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { QueryWrapper<MdcPlanClose> queryWrapper = QueryGenerator.initQueryWrapper(mdcPlanClose, req.getParameterMap()); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); String userId = user.getId(); Page<MdcPlanClose> page = new Page<MdcPlanClose>(pageNo, pageSize); IPage<MdcPlanClose> pageList = mdcPlanCloseService.page(page, queryWrapper); IPage<MdcPlanClose> pageList = mdcPlanCloseService.pageList(userId, page, mdcPlanClose, req); return Result.OK(pageList); } @@ -66,11 +70,17 @@ * @param mdcPlanClose * @return */ @AutoLog(value = "mdc计ååæºç»´æ¤è¡¨-æ·»å ") @ApiOperation(value = "mdc计ååæºç»´æ¤è¡¨-æ·»å ", notes = "mdc计ååæºç»´æ¤è¡¨-æ·»å ") @AutoLog(value = "mdc(计å/é计å)åæºç»´æ¤è¡¨-æ·»å ") @ApiOperation(value = "mdc(计å/é计å)åæºç»´æ¤è¡¨-æ·»å ", notes = "mdc(计å/é计å)åæºç»´æ¤è¡¨-æ·»å ") @PostMapping(value = "/add") public Result<?> add(@RequestBody MdcPlanClose mdcPlanClose) { mdcPlanCloseService.save(mdcPlanClose); public Result<?> add(@RequestBody MdcPlanCloseVo mdcPlanClose) { if (StringUtils.isBlank(mdcPlanClose.getEquipmentIds())) { return Result.error("æªéæ©è®¾å¤ï¼è¯·ææ¥ï¼"); } boolean result = mdcPlanCloseService.addPlanClose(mdcPlanClose); if (!result) { return Result.error("æ·»å 失败ï¼"); } return Result.OK("æ·»å æåï¼"); } @@ -80,8 +90,8 @@ * @param mdcPlanClose * @return */ @AutoLog(value = "mdc计ååæºç»´æ¤è¡¨-ç¼è¾") @ApiOperation(value = "mdc计ååæºç»´æ¤è¡¨-ç¼è¾", notes = "mdc计ååæºç»´æ¤è¡¨-ç¼è¾") @AutoLog(value = "mdc(计å/é计å)åæºç»´æ¤è¡¨-ç¼è¾") @ApiOperation(value = "mdc(计å/é计å)åæºç»´æ¤è¡¨-ç¼è¾", notes = "mdc(计å/é计å)åæºç»´æ¤è¡¨-ç¼è¾") @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) public Result<?> edit(@RequestBody MdcPlanClose mdcPlanClose) { mdcPlanCloseService.updateById(mdcPlanClose); @@ -94,8 +104,8 @@ * @param id * @return */ @AutoLog(value = "mdc计ååæºç»´æ¤è¡¨-éè¿idå é¤") @ApiOperation(value = "mdc计ååæºç»´æ¤è¡¨-éè¿idå é¤", notes = "mdc计ååæºç»´æ¤è¡¨-éè¿idå é¤") @AutoLog(value = "mdc(计å/é计å)åæºç»´æ¤è¡¨-éè¿idå é¤") @ApiOperation(value = "mdc(计å/é计å)åæºç»´æ¤è¡¨-éè¿idå é¤", notes = "mdc(计å/é计å)åæºç»´æ¤è¡¨-éè¿idå é¤") @DeleteMapping(value = "/delete") public Result<?> delete(@RequestParam(name = "id", required = true) String id) { mdcPlanCloseService.removeById(id); @@ -108,8 +118,8 @@ * @param ids * @return */ @AutoLog(value = "mdc计ååæºç»´æ¤è¡¨-æ¹éå é¤") @ApiOperation(value = "mdc计ååæºç»´æ¤è¡¨-æ¹éå é¤", notes = "mdc计ååæºç»´æ¤è¡¨-æ¹éå é¤") @AutoLog(value = "mdc(计å/é计å)åæºç»´æ¤è¡¨-æ¹éå é¤") @ApiOperation(value = "mdc(计å/é计å)åæºç»´æ¤è¡¨-æ¹éå é¤", notes = "mdc(计å/é计å)åæºç»´æ¤è¡¨-æ¹éå é¤") @DeleteMapping(value = "/deleteBatch") public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { this.mdcPlanCloseService.removeByIds(Arrays.asList(ids.split(","))); @@ -122,8 +132,8 @@ * @param id * @return */ @AutoLog(value = "mdc计ååæºç»´æ¤è¡¨-éè¿idæ¥è¯¢") @ApiOperation(value = "mdc计ååæºç»´æ¤è¡¨-éè¿idæ¥è¯¢", notes = "mdc计ååæºç»´æ¤è¡¨-éè¿idæ¥è¯¢") @AutoLog(value = "mdc(计å/é计å)åæºç»´æ¤è¡¨-éè¿idæ¥è¯¢") @ApiOperation(value = "mdc(计å/é计å)åæºç»´æ¤è¡¨-éè¿idæ¥è¯¢", notes = "mdc(计å/é计å)åæºç»´æ¤è¡¨-éè¿idæ¥è¯¢") @GetMapping(value = "/queryById") public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { MdcPlanClose mdcPlanClose = mdcPlanCloseService.getById(id); @@ -134,11 +144,17 @@ * 导åºexcel * * @param request * @param mdcPlanClose * @param mdcPlanCloseVo */ @RequestMapping(value = "/exportXls") public ModelAndView exportXls(HttpServletRequest request, MdcPlanClose mdcPlanClose) { return super.exportXls(request, mdcPlanClose, MdcPlanClose.class, "mdc计ååæºç»´æ¤è¡¨"); public ModelAndView exportXls(HttpServletRequest request, MdcPlanCloseVo mdcPlanCloseVo) { LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); String userId = user.getId(); String title = "mdcé计ååæº"; if (mdcPlanCloseVo.getCloseType().equals(CommonConstant.STATUS_1)) { title = "mdc计ååæº"; } return mdcPlanCloseService.exportXls(userId, mdcPlanCloseVo, title); } /** lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcPlanClose.java
@@ -7,7 +7,6 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import org.jeecg.common.aspect.annotation.Dict; import org.jeecg.common.system.base.entity.JeecgEntity; import org.jeecgframework.poi.excel.annotation.Excel; @@ -28,25 +27,35 @@ private static final long serialVersionUID = 3761395731884048515L; /** * æ¥æ */ @Excel(name = "æ¥æ", width = 15) @ApiModelProperty(value = "æ¥æ") private String theDate; /** * 设å¤ç¼å· */ @Excel(name = "设å¤ç¼å·", width = 15) @ApiModelProperty(value = "设å¤ç¼å·") private String equipmentId; /** * 计ååæºç±»å */ @Excel(name = "计ååæºç±»å", width = 15) @ApiModelProperty(value = "计ååæºç±»å") private String planCloseType; /** * 计ååæºæ¶é´ç±»å */ @Excel(name = "计ååæºæ¶é´ç±»å", width = 15) @ApiModelProperty(value = "计ååæºæ¶é´ç±»å") @Dict(dicCode = "mdc_plan_type") private String planCloseTimeType; /** * æ¶é¿ï¼åéï¼ */ @Excel(name = "æ¶é¿ï¼åéï¼", width = 15) @ApiModelProperty(value = "æ¶é¿ï¼åéï¼") private Integer planCloseTimeLong; /** * åæºç±»å(1:计å,2:é计å) */ @ApiModelProperty(value = "åæºç±»å(1:计å,2:é计å)") private String closeType; /** * 夿³¨ */ @Excel(name = "夿³¨", width = 15) lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunMonitoringSpeedJob.java
@@ -20,8 +20,6 @@ * @Description: çæ§è®¾å¤è¿è¡åæ°ä»»å¡ * @date 2024/1/16 17:36 */ @PersistJobDataAfterExecution @DisallowConcurrentExecution @Slf4j public class RunMonitoringSpeedJob implements Job { lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentShiftStatisticalProcessJob.java
@@ -20,8 +20,6 @@ * @author: LiuS * @create: 2023-07-24 10:26 */ @PersistJobDataAfterExecution @DisallowConcurrentExecution @Slf4j public class RunningAllEquipmentShiftStatisticalProcessJob implements Job { lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentStatisticalProcessJob.java
@@ -20,8 +20,6 @@ * @author: LiuS * @create: 2023-04-14 13:53 */ @PersistJobDataAfterExecution @DisallowConcurrentExecution @Slf4j public class RunningAllEquipmentStatisticalProcessJob implements Job { lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentTraceProcessJob.java
@@ -20,8 +20,6 @@ * @author: LiuS * @create: 2023-04-12 10:39 */ @PersistJobDataAfterExecution @DisallowConcurrentExecution @Slf4j public class RunningAllEquipmentTraceProcessJob implements Job { lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningEquipmentStatusJob.java
@@ -39,8 +39,6 @@ * @Description: å©ç¨çæ£å¸¸å¼ï¼è®¾å¤ç¶æé¿ææ ååæ¥è¦ * @date 2024/1/17 14:10 */ @PersistJobDataAfterExecution @DisallowConcurrentExecution @Slf4j public class RunningEquipmentStatusJob implements Job { lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningMonitoringSpeedJob.java
@@ -33,8 +33,6 @@ * @Description: çæ§è®¾å¤è¿è¡è½¬éä¸NCç¨åºè®¾å®è½¬éå¯¹æ¯ * @date 2024/3/4 16:14 */ @PersistJobDataAfterExecution @DisallowConcurrentExecution @Slf4j public class RunningMonitoringSpeedJob implements Job { lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningOverallEquipmentEfficiencyJob.java
@@ -20,8 +20,6 @@ * @author: LiuS * @create: 2023-07-24 10:26 */ @PersistJobDataAfterExecution @DisallowConcurrentExecution @Slf4j public class RunningOverallEquipmentEfficiencyJob implements Job { lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningOvertimeDurationJob.java
@@ -30,8 +30,6 @@ * @Description: 设å¤å çæ¶é¿ç®æ³ç»è®¡ * @date 2024/1/24 17:12 */ @PersistJobDataAfterExecution @DisallowConcurrentExecution @Slf4j public class RunningOvertimeDurationJob implements Job { lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningProcessCountJob.java
@@ -19,8 +19,6 @@ * @author Lius * @date 2023/11/22 10:17 */ @PersistJobDataAfterExecution @DisallowConcurrentExecution @Slf4j public class RunningProcessCountJob implements Job { lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/TransferTableDataJob.java
@@ -24,8 +24,6 @@ * @author Lius * @date 2024/4/3 10:39 */ @PersistJobDataAfterExecution @DisallowConcurrentExecution @Slf4j public class TransferTableDataJob implements Job { lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentMapper.java
@@ -16,7 +16,7 @@ public interface EquipmentMapper extends BaseMapper<Equipment> { @Select(" SELECT name FROM SysObjects Where XType='U' AND name = '${saveTableName}' ") @Select(" SELECT name FROM SysObjects WHERE name = '${saveTableName}' ") String checkTableExists(@Param("saveTableName") String saveTableName); @Select(" SELECT COUNT(CollectTime) num FROM ${saveTableName} WHERE CollectTime < '${day}' ") @@ -28,6 +28,6 @@ @Delete(" delete from ${tableName} where CollectTime < '${day}' ") void deleteTableData(@Param("tableName") String saveTableName, @Param("day") String day); @Insert(" SELECT * INTO ${tableName} FROM ${lastTableName} WHERE CollectTime < '${date}' ") @Insert(" CREATE TABLE ${tableName} AS SELECT * FROM ${lastTableName} WHERE CollectTime < '${date}' ") void insertNoTableData(@Param("tableName") String tableName, @Param("lastTableName") String lastTableName, @Param("date") String date); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcPlanCloseMapper.java
@@ -2,7 +2,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.mdc.entity.MdcPlanClose; import org.jeecg.modules.mdc.vo.MdcPlanCloseVo; /** * @Description: mdc计ååæºç»´æ¤è¡¨ @@ -12,4 +16,12 @@ */ public interface MdcPlanCloseMapper extends BaseMapper<MdcPlanClose> { /** * å页æ¥è¯¢ * * @param page * @param mdcPlanClose * @return */ IPage<MdcPlanClose> pageList(Page<MdcPlanClose> page, @Param("mdcPlanClose") MdcPlanCloseVo mdcPlanClose); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentWorklineMapper.xml
@@ -3,26 +3,26 @@ <mapper namespace="org.jeecg.modules.mdc.mapper.EquipmentWorklineMapper"> <select id="getMacingDataList" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDto"> select top 1 [${tableName}].* from [${tableName}] order by CollectTime desc select top 1 ${tableName}.* from ${tableName} order by CollectTime desc </select> <select id="findRunningData" resultType="java.lang.String"> SELECT ProductCount FROM [${tableName}] WHERE ProductCount <> '' AND CollectTime BETWEEN #{ startTime } AND #{ endTime } GROUP BY ProductCount ORDER BY ProductCount SELECT ProductCount FROM ${tableName} WHERE ProductCount <> '' AND CollectTime BETWEEN #{ startTime } AND #{ endTime } GROUP BY ProductCount ORDER BY ProductCount </select> <select id="getEquipProgramNum" resultType="org.jeecg.modules.mdc.dto.EquipmentMachingDto"> select Programnumber,CollectTime from [${tableName}] where CollectTime > #{startTime} and CollectTime <= #{endTime} and Programnumber is not null select Programnumber,CollectTime from ${tableName} where CollectTime > #{startTime} and CollectTime <= #{endTime} and Programnumber is not null </select> <select id="findProductCountStartTime" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDto"> SELECT TOP 1 [${tableName}].* FROM [${tableName}] WHERE ProductCount = #{ productCount } AND CollectTime BETWEEN #{ startTime } AND #{ endTime } ORDER BY CollectTime ASC SELECT TOP 1 ${tableName}.* FROM [${tableName}] WHERE ProductCount = #{ productCount } AND CollectTime BETWEEN #{ startTime } AND #{ endTime } ORDER BY CollectTime ASC </select> <select id="findProductCountEndTime" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDto"> SELECT TOP 1 [${tableName}].* FROM [${tableName}] WHERE ProductCount = #{ productCount } AND CollectTime BETWEEN #{ startTime } AND #{ endTime } ORDER BY CollectTime DESC SELECT TOP 1 ${tableName}.* FROM ${tableName} WHERE ProductCount = #{ productCount } AND CollectTime BETWEEN #{ startTime } AND #{ endTime } ORDER BY CollectTime DESC </select> <select id="getDataList" resultType="java.util.Map"> select top 1 [${tableName}].* from [${tableName}] order by CollectTime desc select top 1 ${tableName}.* from ${tableName} order by CollectTime desc </select> </mapper> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcPlanCloseMapper.xml
@@ -2,4 +2,35 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="org.jeecg.modules.mdc.mapper.MdcPlanCloseMapper"> <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcPlanClose"> SELECT * FROM mdc_plan_close <where> <if test="mdcPlanClose.equipmentId != null and mdcPlanClose.equipmentId != ''"> AND equipment_id = #{ mdcPlanClose.equipmentId } </if> <if test="mdcPlanClose.planCloseType != null and mdcPlanClose.planCloseType != ''"> AND plan_close_type = #{ mdcPlanClose.planCloseType } </if> <if test="mdcPlanClose.theDate != null and mdcPlanClose.theDate != ''"> AND the_date LIKE CONCAT('%',#{ mdcPlanClose.theDate },'%') </if> <if test="mdcPlanClose.startTime != null and mdcPlanClose.startTime != ''"> AND the_date >= #{ mdcPlanClose.startTime } </if> <if test="mdcPlanClose.endTime != null and mdcPlanClose.endTime != ''"> AND the_date <= #{mdcPlanClose.endTime } </if> <if test="mdcPlanClose.equipmentIdList != null and mdcPlanClose.equipmentIdList.size() > 0 "> AND equipment_id IN <foreach collection="mdcPlanClose.equipmentIdList" item="id" index="index" open="(" close=")" separator=","> #{ id } </foreach> </if> AND close_type = #{ mdcPlanClose.closeType } </where> ORDER BY the_date DESC, equipment_id ASC </select> </mapper> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcPlanCloseService.java
@@ -1,8 +1,13 @@ package org.jeecg.modules.mdc.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.mdc.entity.MdcPlanClose; import org.jeecg.modules.mdc.vo.MdcPlanCloseVo; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; /** @@ -14,4 +19,33 @@ public interface IMdcPlanCloseService extends IService<MdcPlanClose> { BigDecimal findPlanTimeDuration(BigDecimal actualWorkDayCount, String planCloseType); /** * å页æ¥è¯¢ * * @param userId * @param page * @param mdcPlanClose * @param req * @return */ IPage<MdcPlanClose> pageList(String userId, Page<MdcPlanClose> page, MdcPlanCloseVo mdcPlanClose, HttpServletRequest req); /** * æ·»å * * @param mdcPlanClose * @return */ boolean addPlanClose(MdcPlanCloseVo mdcPlanClose); /** * å¯¼åº * * @param userId * @param mdcPlanCloseVo * @param title * @return */ ModelAndView exportXls(String userId, MdcPlanCloseVo mdcPlanCloseVo, String title); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcPlanCloseServiceImpl.java
@@ -2,15 +2,29 @@ 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; import org.jeecg.modules.mdc.constant.MdcConstant; import org.apache.commons.lang.StringUtils; import org.apache.shiro.SecurityUtils; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.mdc.entity.MdcPassRate; import org.jeecg.modules.mdc.entity.MdcPlanClose; import org.jeecg.modules.mdc.mapper.MdcPlanCloseMapper; import org.jeecg.modules.mdc.service.IMdcEquipmentService; import org.jeecg.modules.mdc.service.IMdcPlanCloseService; import org.jeecg.modules.mdc.vo.MdcPlanCloseVo; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import org.springframework.stereotype.Service; import org.springframework.web.servlet.ModelAndView; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.util.Arrays; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -23,27 +37,155 @@ @Service public class MdcPlanCloseServiceImpl extends ServiceImpl<MdcPlanCloseMapper, MdcPlanClose> implements IMdcPlanCloseService { @Resource private IMdcEquipmentService mdcEquipmentService; /** * å页æ¥è¯¢ * * @param userId * @param page * @param mdcPlanClose * @param req * @return */ @Override public IPage<MdcPlanClose> pageList(String userId, Page<MdcPlanClose> page, MdcPlanCloseVo mdcPlanClose, HttpServletRequest req) { List<String> equipmentIds = new ArrayList<>(); if (StringUtils.isNotEmpty(mdcPlanClose.getParentId()) && StringUtils.isEmpty(mdcPlanClose.getEquipmentId())) { if ("2".equals(mdcPlanClose.getTypeTree())) { //é¨é¨å±çº§ equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcPlanClose.getParentId()); } else { //产线å±çº§ equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcPlanClose.getParentId()); } } else if (StringUtils.isNotEmpty(mdcPlanClose.getEquipmentId())) { //åå°è®¾å¤ä¿¡æ¯ mdcPlanClose.setEquipmentIdList(Collections.singletonList(mdcPlanClose.getEquipmentId())); } else { //æ¥è¯¢ç¨æ·æ¥æçææè®¾å¤ä¿¡æ¯ if ("2".equals(mdcPlanClose.getTypeTree())) { //é¨é¨å±çº§ equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); } else { //产线å±çº§ equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); } } if (mdcPlanClose.getEquipmentIdList() == null || mdcPlanClose.getEquipmentIdList().isEmpty()) { mdcPlanClose.setEquipmentIdList(equipmentIds); } if (mdcPlanClose.getEquipmentIdList() == null || mdcPlanClose.getEquipmentIdList().isEmpty()) { return null; } return this.baseMapper.pageList(page, mdcPlanClose); } /** * æ·»å * * @param mdcPlanCloseVo * @return */ @Override public boolean addPlanClose(MdcPlanCloseVo mdcPlanCloseVo) { String[] equipmentIdList = mdcPlanCloseVo.getEquipmentIds().split(","); List<MdcPlanClose> planCloseList = new ArrayList<>(); for (String equipmentId : equipmentIdList) { MdcPlanClose mdcPlanClose = new MdcPlanClose(); mdcPlanClose.setEquipmentId(equipmentId); mdcPlanClose.setPlanCloseType(mdcPlanCloseVo.getPlanCloseType()); mdcPlanClose.setPlanCloseTimeLong(mdcPlanCloseVo.getPlanCloseTimeLong()); mdcPlanClose.setTheDate(mdcPlanCloseVo.getTheDate()); mdcPlanClose.setCloseType(mdcPlanCloseVo.getCloseType()); mdcPlanClose.setRemark(mdcPlanClose.getRemark()); planCloseList.add(mdcPlanClose); } this.saveBatch(planCloseList); return true; } @Override public ModelAndView exportXls(String userId, MdcPlanCloseVo mdcPlanClose, String title) { LambdaQueryWrapper<MdcPlanClose> queryWrapper = new LambdaQueryWrapper<>(); List<String> equipmentIds = new ArrayList<>(); if (StringUtils.isNotEmpty(mdcPlanClose.getParentId()) && StringUtils.isEmpty(mdcPlanClose.getEquipmentId())) { if ("2".equals(mdcPlanClose.getTypeTree())) { //é¨é¨å±çº§ equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcPlanClose.getParentId()); } else { //产线å±çº§ equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcPlanClose.getParentId()); } } else if (StringUtils.isNotEmpty(mdcPlanClose.getEquipmentId())) { //åå°è®¾å¤ä¿¡æ¯ mdcPlanClose.setEquipmentIdList(Collections.singletonList(mdcPlanClose.getEquipmentId())); } else { //æ¥è¯¢ç¨æ·æ¥æçææè®¾å¤ä¿¡æ¯ if ("2".equals(mdcPlanClose.getTypeTree())) { //é¨é¨å±çº§ equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); } else { //产线å±çº§ equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); } } if (mdcPlanClose.getEquipmentIdList() == null || mdcPlanClose.getEquipmentIdList().isEmpty()) { mdcPlanClose.setEquipmentIdList(equipmentIds); } if (mdcPlanClose.getEquipmentIdList() == null || mdcPlanClose.getEquipmentIdList().isEmpty()) { return null; } else { queryWrapper.in(MdcPlanClose::getEquipmentId, mdcPlanClose.getEquipmentIdList()); } if (StringUtils.isNotEmpty(mdcPlanClose.getEquipmentId())) { queryWrapper.eq(MdcPlanClose::getEquipmentId, mdcPlanClose.getEquipmentId()); } if (StringUtils.isNotEmpty(mdcPlanClose.getPlanCloseType())) { queryWrapper.eq(MdcPlanClose::getPlanCloseType, mdcPlanClose.getPlanCloseType()); } if (StringUtils.isNotEmpty(mdcPlanClose.getStartTime()) && StringUtils.isNotEmpty(mdcPlanClose.getEndTime())) { queryWrapper.between(MdcPlanClose::getTheDate, mdcPlanClose.getStartTime(), mdcPlanClose.getEndTime()); } queryWrapper.orderByDesc(MdcPlanClose::getTheDate).orderByDesc(MdcPlanClose::getEquipmentId); ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); List<MdcPlanClose> mdcPlanCloses = this.baseMapper.selectList(queryWrapper); // å¯¼åºæä»¶åç§° mv.addObject(NormalExcelConstants.FILE_NAME, title + "å表"); mv.addObject(NormalExcelConstants.CLASS, MdcPlanClose.class); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); mv.addObject(NormalExcelConstants.PARAMS, new ExportParams(title + "åè¡¨æ°æ®", "导åºäºº:" + user.getRealname(), title)); //update-end---author:wangshuai ---date:20211227 forï¼[JTC-116]导åºäººåæ»äº------------ mv.addObject(NormalExcelConstants.DATA_LIST, mdcPlanCloses); return mv; } @Override public BigDecimal findPlanTimeDuration(BigDecimal actualWorkDayCount, String planCloseType) { BigDecimal result = new BigDecimal("0"); List<MdcPlanClose> mdcPlanCloses = this.baseMapper.selectList(new LambdaQueryWrapper<MdcPlanClose>().in(MdcPlanClose::getPlanCloseType, Arrays.asList(planCloseType.split(",")))); if (mdcPlanCloses != null && !mdcPlanCloses.isEmpty()) { for (MdcPlanClose mdcPlanClose : mdcPlanCloses) { switch (mdcPlanClose.getPlanCloseTimeType()) { case MdcConstant.DAY: result = result.add(actualWorkDayCount.multiply(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong()))); break; case MdcConstant.WEEK: result = result.add(new BigDecimal("4").multiply(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong()))); break; case MdcConstant.MONTH: result = result.add(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong())); break; default: break; } } } // List<MdcPlanClose> mdcPlanCloses = this.baseMapper.selectList(new LambdaQueryWrapper<MdcPlanClose>().in(MdcPlanClose::getPlanCloseType, Arrays.asList(planCloseType.split(",")))); // if (mdcPlanCloses != null && !mdcPlanCloses.isEmpty()) { // for (MdcPlanClose mdcPlanClose : mdcPlanCloses) { // switch (mdcPlanClose.getPlanCloseTimeType()) { // case MdcConstant.DAY: // result = result.add(actualWorkDayCount.multiply(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong()))); // break; // case MdcConstant.WEEK: // result = result.add(new BigDecimal("4").multiply(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong()))); // break; // case MdcConstant.MONTH: // result = result.add(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong())); // break; // default: // break; // } // } // } return result; } } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcShiftServiceImpl.java
@@ -5,19 +5,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.sun.xml.bind.v2.TODO; import org.apache.commons.lang3.StringUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.mdc.entity.MdcShift; import org.jeecg.modules.mdc.mapper.MdcShiftMapper; import org.jeecg.modules.mdc.service.IMdcShiftService; import org.jeecg.modules.mdc.service.IMdcShiftSubService; import org.jeecgframework.poi.excel.annotation.Excel; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -114,8 +111,10 @@ @Transactional(rollbackFor = Exception.class) public boolean changeDefaultShift(String id) { MdcShift mdcShift = this.baseMapper.selectOne(new LambdaQueryWrapper<MdcShift>().eq(MdcShift::getDefaultShift, "true")); mdcShift.setDefaultShift("false"); this.baseMapper.updateById(mdcShift); if (mdcShift != null) { mdcShift.setDefaultShift("false"); this.baseMapper.updateById(mdcShift); } MdcShift defaultShift = this.baseMapper.selectById(id); defaultShift.setDefaultShift("true"); this.baseMapper.updateById(defaultShift); lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcPlanCloseVo.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,24 @@ package org.jeecg.modules.mdc.vo; import lombok.Data; import java.util.List; /** * @author Lius * @date 2024/12/2 15:25 */ @Data public class MdcPlanCloseVo { private String equipmentId; private String planCloseType; private Integer planCloseTimeLong; private String startTime; private String endTime; private String theDate; private String parentId; private String typeTree; private List<String> equipmentIdList; private String equipmentIds; private String closeType; }