From ffe9c08011d25c39880d107a5f3de249d309c1b4 Mon Sep 17 00:00:00 2001 From: qushaowei <qushaowei@163.com> Date: 星期一, 13 十一月 2023 12:37:56 +0800 Subject: [PATCH] Merge branch 'master' of http://117.34.109.166:18448/r/mdc_430 into develop --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentThreshold.java | 61 +++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentThresholdServiceImpl.java | 18 ++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/GenerateDeviceCalendarJob.java | 62 +++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDriveTypeParamConfigController.java | 8 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentThresholdMapper.xml | 5 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDriveTypeParamConfigService.java | 5 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentThresholdService.java | 14 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentThresholdMapper.java | 15 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDeviceCalendarServiceImpl.java | 42 +++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDriveTypeParamConfigServiceImpl.java | 19 ++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentThresholdController.java | 164 ++++++++++++++++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcBigScreenEquipmentDto.java | 2 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDeviceCalendarService.java | 6 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcWorkshopInfoMapper.xml | 3 14 files changed, 423 insertions(+), 1 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDriveTypeParamConfigController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDriveTypeParamConfigController.java index 984bb08..3a2fe2b 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDriveTypeParamConfigController.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDriveTypeParamConfigController.java @@ -169,4 +169,12 @@ return Result.OK(result); } + @AutoLog(value = "椹卞姩鍙傛暟閰嶇疆-鏍规嵁鎺у埗绯荤粺绫诲瀷鑾峰彇鍙傛暟") + @ApiOperation(value = "椹卞姩鍙傛暟閰嶇疆-鏍规嵁鎺у埗绯荤粺绫诲瀷鑾峰彇鍙傛暟", notes = "椹卞姩鍙傛暟閰嶇疆-鏍规嵁鎺у埗绯荤粺绫诲瀷鑾峰彇鍙傛暟") + @GetMapping(value = "/getDriveParamOptionsByType") + public Result<List<OptionsDto>> getDriveParamOptionsByType(@RequestParam(name = "controlSystemType", required = true) String controlSystemType) { + List<OptionsDto> result = mdcDriveTypeParamConfigService.getDriveParamOptionsByType(controlSystemType); + return Result.OK(result); + } + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentThresholdController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentThresholdController.java new file mode 100644 index 0000000..3010565 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentThresholdController.java @@ -0,0 +1,164 @@ +package org.jeecg.modules.mdc.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.modules.mdc.entity.MdcEquipmentThreshold; +import org.jeecg.modules.mdc.service.IMdcEquipmentThresholdService; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; + +/** + * @Description: 璁惧鍙傛暟闃堝�艰〃 + * @Author: Lius + * @Date: 2023-11-08 + * @Version: V1.0 + */ +@Slf4j +@Api(tags = "璁惧鍙傛暟闃堝�艰〃") +@RestController +@RequestMapping("/mdc/mdcEquipmentThreshold") +public class MdcEquipmentThresholdController extends JeecgController<MdcEquipmentThreshold, IMdcEquipmentThresholdService> { + + @Resource + private IMdcEquipmentThresholdService mdcEquipmentThresholdService; + + /** + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param mdcEquipmentThreshold + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "璁惧鍙傛暟闃堝�艰〃-鍒嗛〉鍒楄〃鏌ヨ") + @ApiOperation(value = "璁惧鍙傛暟闃堝�艰〃-鍒嗛〉鍒楄〃鏌ヨ", notes = "璁惧鍙傛暟闃堝�艰〃-鍒嗛〉鍒楄〃鏌ヨ") + @GetMapping(value = "/list") + public Result<?> queryPageList(MdcEquipmentThreshold mdcEquipmentThreshold, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper<MdcEquipmentThreshold> queryWrapper = QueryGenerator.initQueryWrapper(mdcEquipmentThreshold, req.getParameterMap()); + Page<MdcEquipmentThreshold> page = new Page<MdcEquipmentThreshold>(pageNo, pageSize); + IPage<MdcEquipmentThreshold> pageList = mdcEquipmentThresholdService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 娣诲姞 + * + * @param mdcEquipmentThreshold + * @return + */ + @AutoLog(value = "璁惧鍙傛暟闃堝�艰〃-娣诲姞") + @ApiOperation(value = "璁惧鍙傛暟闃堝�艰〃-娣诲姞", notes = "璁惧鍙傛暟闃堝�艰〃-娣诲姞") + @PostMapping(value = "/add") + public Result<?> add(@RequestBody MdcEquipmentThreshold mdcEquipmentThreshold) { + String chineseName = mdcEquipmentThreshold.getChineseName(); + mdcEquipmentThreshold.setEnglishName(chineseName.substring(0, chineseName.indexOf("("))); + mdcEquipmentThreshold.setChineseName(chineseName.substring(mdcEquipmentThreshold.getEnglishName().length() + 1, chineseName.length() - 1)); + mdcEquipmentThresholdService.save(mdcEquipmentThreshold); + return Result.OK("娣诲姞鎴愬姛锛�"); + } + + /** + * 缂栬緫 + * + * @param mdcEquipmentThreshold + * @return + */ + @AutoLog(value = "璁惧鍙傛暟闃堝�艰〃-缂栬緫") + @ApiOperation(value = "璁惧鍙傛暟闃堝�艰〃-缂栬緫", notes = "璁惧鍙傛暟闃堝�艰〃-缂栬緫") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result<?> edit(@RequestBody MdcEquipmentThreshold mdcEquipmentThreshold) { + String chineseName = mdcEquipmentThreshold.getChineseName(); + mdcEquipmentThreshold.setEnglishName(chineseName.substring(0, chineseName.indexOf("("))); + mdcEquipmentThreshold.setChineseName(chineseName.substring(mdcEquipmentThreshold.getEnglishName().length() + 1, chineseName.length() - 1)); + mdcEquipmentThresholdService.save(mdcEquipmentThreshold); + mdcEquipmentThresholdService.updateById(mdcEquipmentThreshold); + return Result.OK("缂栬緫鎴愬姛!"); + } + + /** + * 閫氳繃id鍒犻櫎 + * + * @param id + * @return + */ + @AutoLog(value = "璁惧鍙傛暟闃堝�艰〃-閫氳繃id鍒犻櫎") + @ApiOperation(value = "璁惧鍙傛暟闃堝�艰〃-閫氳繃id鍒犻櫎", notes = "璁惧鍙傛暟闃堝�艰〃-閫氳繃id鍒犻櫎") + @DeleteMapping(value = "/delete") + public Result<?> delete(@RequestParam(name = "id", required = true) String id) { + mdcEquipmentThresholdService.removeById(id); + return Result.OK("鍒犻櫎鎴愬姛!"); + } + + /** + * 鎵归噺鍒犻櫎 + * + * @param ids + * @return + */ + @AutoLog(value = "璁惧鍙傛暟闃堝�艰〃-鎵归噺鍒犻櫎") + @ApiOperation(value = "璁惧鍙傛暟闃堝�艰〃-鎵归噺鍒犻櫎", notes = "璁惧鍙傛暟闃堝�艰〃-鎵归噺鍒犻櫎") + @DeleteMapping(value = "/deleteBatch") + public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + this.mdcEquipmentThresholdService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("鎵归噺鍒犻櫎鎴愬姛锛�"); + } + + /** + * 閫氳繃id鏌ヨ + * + * @param id + * @return + */ + @AutoLog(value = "璁惧鍙傛暟闃堝�艰〃-閫氳繃id鏌ヨ") + @ApiOperation(value = "璁惧鍙傛暟闃堝�艰〃-閫氳繃id鏌ヨ", notes = "璁惧鍙傛暟闃堝�艰〃-閫氳繃id鏌ヨ") + @GetMapping(value = "/queryById") + public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { + MdcEquipmentThreshold mdcEquipmentThreshold = mdcEquipmentThresholdService.getById(id); + String englishName = mdcEquipmentThreshold.getEnglishName(); + String chineseName = mdcEquipmentThreshold.getChineseName(); + mdcEquipmentThreshold.setChineseName(englishName + "(" + chineseName + ")"); + return Result.OK(mdcEquipmentThreshold); + } + + /** + * 瀵煎嚭excel + * + * @param request + * @param mdcEquipmentThreshold + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, MdcEquipmentThreshold mdcEquipmentThreshold) { + return super.exportXls(request, mdcEquipmentThreshold, MdcEquipmentThreshold.class, "璁惧鍙傛暟闃堝�艰〃"); + } + + /** + * 閫氳繃excel瀵煎叆鏁版嵁 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, MdcEquipmentThreshold.class); + } + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcBigScreenEquipmentDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcBigScreenEquipmentDto.java index d10b4c9..4817b6b 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcBigScreenEquipmentDto.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcBigScreenEquipmentDto.java @@ -21,6 +21,8 @@ private Integer equipmentStatus; + private String equId; + /** * 鍧愭爣-宸� */ diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentThreshold.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentThreshold.java new file mode 100644 index 0000000..f21a23f --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentThreshold.java @@ -0,0 +1,61 @@ +package org.jeecg.modules.mdc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecg.common.system.base.entity.JeecgEntity; +import org.jeecgframework.poi.excel.annotation.Excel; + +import java.io.Serializable; + +/** + * @Description: 璁惧鍙傛暟闃堝�艰〃 + * @Author: Lius + * @Date: 2023-11-08 + * @Version: V1.0 + */ +@Data +@TableName("mdc_equipment_threshold") +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "mdc_equipment_threshold瀵硅薄", description = "璁惧鍙傛暟闃堝�艰〃") +public class MdcEquipmentThreshold extends JeecgEntity implements Serializable { + + private static final long serialVersionUID = 8899682324080635365L; + + /** + * 鎺у埗绯荤粺绫诲瀷 + */ + @Excel(name = "鎺у埗绯荤粺绫诲瀷", width = 15) + @ApiModelProperty(value = "鎺у埗绯荤粺绫诲瀷") + private String controlSystemType; + /** + * 涓枃鍚嶇О + */ + @Excel(name = "涓枃鍚嶇О", width = 15) + @ApiModelProperty(value = "涓枃鍚嶇О") + private String chineseName; + /** + * 鑻辨枃鍚嶇О + */ + @Excel(name = "鑻辨枃鍚嶇О", width = 15) + @ApiModelProperty(value = "鑻辨枃鍚嶇О") + private String englishName; + /** + * 涓婇檺 + */ + @Excel(name = "涓婇檺", width = 15) + @ApiModelProperty(value = "涓婇檺") + private Integer maxThreshold; + /** + * 涓嬮檺 + */ + @Excel(name = "涓嬮檺", width = 15) + @ApiModelProperty(value = "涓嬮檺") + private Integer minThreshold; + + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/GenerateDeviceCalendarJob.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/GenerateDeviceCalendarJob.java new file mode 100644 index 0000000..dd1f9b7 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/GenerateDeviceCalendarJob.java @@ -0,0 +1,62 @@ +package org.jeecg.modules.mdc.job; + +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.util.DateUtils; +import org.jeecg.modules.mdc.service.IMdcDeviceCalendarService; +import org.jeecg.modules.mdc.util.ThrowableUtil; +import org.jeecg.modules.quartz.entity.QuartzJob; +import org.jeecg.modules.quartz.entity.SysQuartzLog; +import org.jeecg.modules.quartz.service.IQuartzJobService; +import org.jeecg.modules.quartz.service.ISysQuartzLogService; +import org.jeecg.modules.system.service.ISysAnnouncementService; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +/** + * @author Lius + * @date 2023/11/6 17:45 + */ +@Slf4j +public class GenerateDeviceCalendarJob implements Job { + + @Resource + private IQuartzJobService quartzJobService; + + @Resource + private ISysQuartzLogService sysQuartzLogService; + + @Resource + private ISysAnnouncementService sysAnnouncementService; + + @Resource + private IMdcDeviceCalendarService mdcDeviceCalendarService; + + @Override + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + SysQuartzLog quartzLog = new SysQuartzLog(); + quartzLog.setCreateTime(new Date()); + List<QuartzJob> byJobClassName = this.quartzJobService.findByJobClassName(this.getClass().getName()); + if (byJobClassName != null && !byJobClassName.isEmpty()) { + quartzLog.setJobId(byJobClassName.get(0).getId()); + } + log.info("瀹氭椂鐢熸垚璁惧宸ヤ綔鏃ュ巻浠诲姟 GenerateDeviceCalendarJob start! 鏃堕棿:" + DateUtils.now()); + long startTime = System.currentTimeMillis(); + try { + mdcDeviceCalendarService.generateDeviceCalendar(); + quartzLog.setIsSuccess(0); + } catch (Exception e) { + quartzLog.setIsSuccess(-1); + quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e)); + // 鍙戦�佹秷鎭�氱煡 + sysAnnouncementService.jobSendMessage("瀹氭椂鐢熸垚鍙屼紤鏃ヤ换鍔�", quartzLog.getExceptionDetail()); + } + long endTime = System.currentTimeMillis(); + quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime))); + sysQuartzLogService.save(quartzLog); + } +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentThresholdMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentThresholdMapper.java new file mode 100644 index 0000000..64fe360 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentThresholdMapper.java @@ -0,0 +1,15 @@ +package org.jeecg.modules.mdc.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.mdc.entity.MdcEquipmentThreshold; + +/** + * @Description: 璁惧鍙傛暟闃堝�艰〃 + * @Author: Lius + * @Date: 2023-11-08 + * @Version: V1.0 + */ +public interface MdcEquipmentThresholdMapper extends BaseMapper<MdcEquipmentThreshold> { + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentThresholdMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentThresholdMapper.xml new file mode 100644 index 0000000..9e6876b --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentThresholdMapper.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!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.MdcEquipmentThresholdMapper"> + +</mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcWorkshopInfoMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcWorkshopInfoMapper.xml index 1a0ecf1..f0f340f 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcWorkshopInfoMapper.xml +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcWorkshopInfoMapper.xml @@ -14,7 +14,8 @@ mew.coordinate_left coordinateLeft, mew.coordinate_top coordinateTop, mew.vw vw, - mew.vh vh + mew.vh vh, + me.id equId FROM EquipmentLog a INNER JOIN ( SELECT EquipmentID, MAX ( CollectTime ) 'maxgdtime' FROM EquipmentLog GROUP BY EquipmentID ) b ON a.EquipmentID= b.EquipmentID diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDeviceCalendarService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDeviceCalendarService.java index a8a00ee..4c2ce4a 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDeviceCalendarService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDeviceCalendarService.java @@ -66,4 +66,10 @@ * @return */ BigDecimal computeShiftTimeCount(String shiftSubId, String equipmentId, String validDate); + + /** + * 鐢熸垚璁惧宸ヤ綔鏃ュ巻 + */ + void generateDeviceCalendar(); + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDriveTypeParamConfigService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDriveTypeParamConfigService.java index efcac99..27e26e5 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDriveTypeParamConfigService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDriveTypeParamConfigService.java @@ -34,4 +34,9 @@ */ List<OptionsDto> getDriveParamOptions(); + /** + * 鏍规嵁鎺у埗绯荤粺绫诲瀷鑾峰彇鍙傛暟 + */ + List<OptionsDto> getDriveParamOptionsByType(String controlSystemType); + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentThresholdService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentThresholdService.java new file mode 100644 index 0000000..e0f6077 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentThresholdService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.mdc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.mdc.entity.MdcEquipmentThreshold; + +/** + * @Description: 璁惧鍙傛暟闃堝�艰〃 + * @Author: Lius + * @Date: 2023-11-08 + * @Version: V1.0 + */ +public interface IMdcEquipmentThresholdService extends IService<MdcEquipmentThreshold> { + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDeviceCalendarServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDeviceCalendarServiceImpl.java index 5d3eec2..06d005d 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDeviceCalendarServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDeviceCalendarServiceImpl.java @@ -6,11 +6,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang3.StringUtils; import org.jeecg.modules.mdc.entity.MdcDeviceCalendar; +import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.entity.MdcShiftSub; +import org.jeecg.modules.mdc.entity.MdcVacationManagement; import org.jeecg.modules.mdc.mapper.MdcDeviceCalendarMapper; import org.jeecg.modules.mdc.service.IMdcDeviceCalendarService; import org.jeecg.modules.mdc.service.IMdcEquipmentService; import org.jeecg.modules.mdc.service.IMdcShiftSubService; +import org.jeecg.modules.mdc.service.IMdcVacationManagementService; import org.jeecg.modules.mdc.vo.EquipmentCalendarVo; import org.jeecg.modules.mdc.vo.MdcDeviceCalendarQueryVo; import org.jeecg.modules.mdc.vo.MdcDeviceCalendarVo; @@ -20,6 +23,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; +import java.time.LocalDate; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -37,6 +41,9 @@ private IMdcEquipmentService mdcEquipmentService; @Resource private IMdcShiftSubService mdcShiftSubService; + + @Resource + private IMdcVacationManagementService mdcVacationManagementService; /** * 鍒嗛〉鍒楄〃鏌ヨ @@ -178,4 +185,39 @@ return new BigDecimal(shiftCount).multiply(new BigDecimal("8")).multiply(new BigDecimal("60")); } + /** + * 鑷姩鐢熸垚璁惧宸ヤ綔鏃ュ巻 + */ + @Override + public void generateDeviceCalendar() { + // 鏆傚畾姣忓ぉ鏅氫笂11鐐规墽琛� + //鏌ヨ榛樿鐝埗 + List<MdcDeviceCalendarVo> acquiesceShift = this.baseMapper.findAcquiesceShift(); + // 鑾峰彇鏄庢棩鏃ユ湡 + String localDate = LocalDate.now().plusDays(1).toString(); + // 鑾峰彇璁惧鍒楄〃 + List<MdcEquipment> equipmentList = mdcEquipmentService.list(); + List<MdcDeviceCalendar> result = new ArrayList<>(); + for (MdcEquipment mdcEquipment : equipmentList) { + List<MdcDeviceCalendar> list = super.list(new LambdaQueryWrapper<MdcDeviceCalendar>().eq(MdcDeviceCalendar::getEquipmentId, mdcEquipment.getEquipmentId()).eq(MdcDeviceCalendar::getEffectiveDate, localDate.replaceAll("-", ""))); + if (list == null || list.isEmpty()) { + List<MdcVacationManagement> vacationManagementList = mdcVacationManagementService.list(new LambdaQueryWrapper<MdcVacationManagement>().eq(MdcVacationManagement::getEquipmentId, mdcEquipment.getEquipmentId()).eq(MdcVacationManagement::getVacationDate, localDate)); + if (vacationManagementList == null || vacationManagementList.isEmpty()) { + String effectiveDate = localDate.replaceAll("-", ""); + for (MdcDeviceCalendarVo mdcDeviceCalendarVo : acquiesceShift) { + MdcDeviceCalendar mdcDeviceCalendar = new MdcDeviceCalendar(); + mdcDeviceCalendar.setEquipmentId(mdcEquipment.getEquipmentId()); + mdcDeviceCalendar.setEffectiveDate(effectiveDate); + mdcDeviceCalendar.setShiftId(mdcDeviceCalendarVo.getShiftId()); + mdcDeviceCalendar.setShiftSubId(mdcDeviceCalendarVo.getShiftSubId()); + result.add(mdcDeviceCalendar); + } + } + } + } + if (!result.isEmpty()) { + super.saveBatch(result); + } + } + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDriveTypeParamConfigServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDriveTypeParamConfigServiceImpl.java index f9d398c..e04fc94 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDriveTypeParamConfigServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDriveTypeParamConfigServiceImpl.java @@ -1,5 +1,6 @@ package org.jeecg.modules.mdc.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.jeecg.common.constant.CommonConstant; import org.jeecg.modules.mdc.dto.OptionsDto; @@ -59,4 +60,22 @@ } return result; } + + /** + * 鏍规嵁鎺у埗绯荤粺绫诲瀷鑾峰彇鍙傛暟 + */ + @Override + public List<OptionsDto> getDriveParamOptionsByType(String controlSystemType) { + List<OptionsDto> result = new ArrayList<>(); + List<MdcDriveTypeParamConfig> mdcDriveTypeParamConfigList = super.list(new LambdaQueryWrapper<MdcDriveTypeParamConfig>().eq(MdcDriveTypeParamConfig::getControlSystemType, controlSystemType).eq(MdcDriveTypeParamConfig::getCurveGenerationFlags, CommonConstant.YN_Y)); + if (mdcDriveTypeParamConfigList != null && !mdcDriveTypeParamConfigList.isEmpty()) { + for (MdcDriveTypeParamConfig mdcDriveTypeParamConfig : mdcDriveTypeParamConfigList) { + OptionsDto optionsDto = new OptionsDto(); + optionsDto.setLabel(mdcDriveTypeParamConfig.getEnglishName() + "(" + mdcDriveTypeParamConfig.getChineseName() + ")"); + optionsDto.setValue(mdcDriveTypeParamConfig.getEnglishName() + "(" + mdcDriveTypeParamConfig.getChineseName() + ")"); + result.add(optionsDto); + } + } + return result; + } } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentThresholdServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentThresholdServiceImpl.java new file mode 100644 index 0000000..80c3b92 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentThresholdServiceImpl.java @@ -0,0 +1,18 @@ +package org.jeecg.modules.mdc.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.mdc.entity.MdcEquipmentThreshold; +import org.jeecg.modules.mdc.mapper.MdcEquipmentThresholdMapper; +import org.jeecg.modules.mdc.service.IMdcEquipmentThresholdService; +import org.springframework.stereotype.Service; + +/** + * @Description: 璁惧鍙傛暟闃堝�艰〃 + * @Author: Lius + * @Date: 2023-11-08 + * @Version: V1.0 + */ +@Service +public class MdcEquipmentThresholdServiceImpl extends ServiceImpl<MdcEquipmentThresholdMapper, MdcEquipmentThreshold> implements IMdcEquipmentThresholdService { + +} -- Gitblit v1.9.3