lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentOvertimeController.java
@@ -139,7 +139,9 @@ */ @RequestMapping(value = "/exportXls") public ModelAndView exportXls(HttpServletRequest request, MdcEquipmentOvertime mdcEquipmentOvertime) { return super.exportXls(request, mdcEquipmentOvertime, MdcEquipmentOvertime.class, "设备加班管理"); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); String userId = user.getId(); return mdcEquipmentOvertimeService.exportXls(userId, mdcEquipmentOvertime); } /** lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentOvertime.java
@@ -28,6 +28,37 @@ private static final long serialVersionUID = -7163039765166584824L; @TableField(exist = false) @Excel(name = "设备编号", width = 20) private String equipmentId; @TableField(exist = false) @Excel(name = "设备名称", width = 20) private String equipmentName; /** * 生效日期 */ @Excel(name = "生效日期", width = 15) @TableField(exist = false) private String effectiveDate; /** * 班次开始时间 */ @Excel(name = "班次开始时间", width = 20) @ApiModelProperty("班次开始时间") @TableField(exist = false) private String startDate; /** * 班次结束时间 */ @Excel(name = "班次结束时间", width = 20) @ApiModelProperty("班次结束时间") @TableField(exist = false) private String endDate; /** * 工作日历id */ @@ -53,35 +84,6 @@ @Excel(name = "备注") @ApiModelProperty(value = "备注") private String remark; @TableField(exist = false) private String equipmentId; @TableField(exist = false) private String equipmentName; /** * 生效日期 */ @Excel(name = "生效日期", width = 15) @TableField(exist = false) private String effectiveDate; /** * 班次开始时间 */ @Excel(name = "班次开始时间", width = 20, format = "HH:mm:ss") @ApiModelProperty("班次开始时间") @TableField(exist = false) private String startDate; /** * 班次结束时间 */ @Excel(name = "班次结束时间", width = 20, format = "HH:mm:ss") @ApiModelProperty("班次结束时间") @TableField(exist = false) private String endDate; /** * 前台传入 判断每个id lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentOvertimeMapper.java
@@ -7,6 +7,8 @@ import org.apache.ibatis.annotations.Param; import org.jeecg.modules.mdc.entity.MdcEquipmentOvertime; import java.util.List; /** * @Description: 设备加班管理 * @Author: Lius @@ -24,4 +26,11 @@ */ IPage<MdcEquipmentOvertime> pageList(Page<MdcEquipmentOvertime> page, @Param("mdcEquipmentOvertime") MdcEquipmentOvertime mdcEquipmentOvertime); /** * list列表 * @param mdcEquipmentOvertime * @return */ List<MdcEquipmentOvertime> list(@Param("mdcEquipmentOvertime") MdcEquipmentOvertime mdcEquipmentOvertime); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentOvertimeMapper.xml
@@ -39,4 +39,42 @@ </where> order by t2.effective_date asc </select> <!--list列表--> <select id="list" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentOvertime"> SELECT t1.id, t2.equipment_id equipmentId, t4.equipment_name equipmentName, t2.effective_date effectiveDate, t3.start_date startDate, t3.end_date endDate, t1.start_time startTime, t1.end_time endTime, t1.remark remark, t1.create_by createBy, t1.create_time createTime, t1.update_by updateBy, t1.update_time updateTime FROM mdc_equipment_overtime t1 LEFT JOIN mdc_device_calendar t2 ON t1.calendar_id = t2.id LEFT JOIN mdc_shift_sub t3 ON t3.id = t2.shift_sub_id LEFT JOIN mdc_equipment t4 ON t4.equipment_id = t2.equipment_id <where> <if test="mdcEquipmentOvertime.equipmentName != null and mdcEquipmentOvertime.equipmentName != '' "> AND t4.equipment_name LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentName}),'%') </if> <if test="mdcEquipmentOvertime.equipmentId != null and mdcEquipmentOvertime.equipmentId != '' "> AND t2.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentId}),'%') </if> <if test="mdcEquipmentOvertime.mdcSectionIds != null and mdcEquipmentOvertime.mdcSectionIds.size() > 0 "> AND t2.equipment_id IN <foreach collection="mdcEquipmentOvertime.mdcSectionIds" item="id" index="index" open="(" close=")" separator=","> #{ id } </foreach> </if> </where> order by t2.effective_date asc </select> </mapper> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentOvertimeService.java
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.mdc.entity.MdcEquipmentOvertime; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; @@ -26,4 +27,14 @@ * @return */ IPage<MdcEquipmentOvertime> pageList(String userId, Page<MdcEquipmentOvertime> page, MdcEquipmentOvertime mdcEquipmentOvertime, HttpServletRequest req); /** * 导出 * * @param userId * @param mdcEquipmentOvertime * @return */ ModelAndView exportXls(String userId, MdcEquipmentOvertime mdcEquipmentOvertime); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentOvertimeServiceImpl.java
@@ -5,11 +5,18 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang.StringUtils; import org.apache.shiro.SecurityUtils; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.mdc.entity.MdcEquipmentOvertime; import org.jeecg.modules.mdc.entity.MdcNoplanClose; import org.jeecg.modules.mdc.mapper.MdcEquipmentOvertimeMapper; import org.jeecg.modules.mdc.service.IMdcEquipmentOvertimeService; import org.jeecg.modules.mdc.service.IMdcEquipmentService; 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; @@ -63,4 +70,58 @@ } return this.baseMapper.pageList(page, mdcEquipmentOvertime); } /** * 导出 * * @param userId * @param mdcEquipmentOvertime * @return */ @Override public ModelAndView exportXls(String userId, MdcEquipmentOvertime mdcEquipmentOvertime) { List<String> equipmentIds = new ArrayList<>(); if (StringUtils.isNotEmpty(mdcEquipmentOvertime.getParentId()) && StringUtils.isEmpty(mdcEquipmentOvertime.getEquipmentId())) { if ("2".equals(mdcEquipmentOvertime.getTypeTree())) { //部门层级 equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcEquipmentOvertime.getParentId()); } else { //产线层级 equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcEquipmentOvertime.getParentId()); } } else if (StringUtils.isNotEmpty(mdcEquipmentOvertime.getEquipmentId())) { //单台设备信息 mdcEquipmentOvertime.setMdcSectionIds(Collections.singletonList(mdcEquipmentOvertime.getEquipmentId())); } else { //查询用户拥有的所有设备信息 if ("2".equals(mdcEquipmentOvertime.getTypeTree())) { //部门层级 equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); } else { //产线层级 equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); } } if (mdcEquipmentOvertime.getMdcSectionIds() == null || mdcEquipmentOvertime.getMdcSectionIds().isEmpty()) { mdcEquipmentOvertime.setMdcSectionIds(equipmentIds); } if (mdcEquipmentOvertime.getMdcSectionIds() == null || mdcEquipmentOvertime.getMdcSectionIds().isEmpty()) { return null; } // Step.2 AutoPoi 导出Excel ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); List<MdcEquipmentOvertime> mdcEquipmentOvertimes = this.baseMapper.list(mdcEquipmentOvertime); // 导出文件名称 mv.addObject(NormalExcelConstants.FILE_NAME, "加班管理列表"); mv.addObject(NormalExcelConstants.CLASS, MdcEquipmentOvertime.class); //获取当前登录用户 //update-begin---author:wangshuai ---date:20211227 for:[JTC-116]导出人写死了------------ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("加班管理列表数据", "导出人:"+user.getRealname(), "加班管理")); //update-end---author:wangshuai ---date:20211227 for:[JTC-116]导出人写死了------------ mv.addObject(NormalExcelConstants.DATA_LIST, mdcEquipmentOvertimes); return mv; } } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcNoplanCloseServiceImpl.java
@@ -312,7 +312,7 @@ //获取当前登录用户 //update-begin---author:wangshuai ---date:20211227 for:[JTC-116]导出人写死了------------ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("非计划停机维护列表数据", "导出人:"+user.getRealname(), "导出信息")); mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("非计划停机维护列表数据", "导出人:"+user.getRealname(), "非计划停机维护")); //update-end---author:wangshuai ---date:20211227 for:[JTC-116]导出人写死了------------ mv.addObject(NormalExcelConstants.DATA_LIST, mdcNoplanCloses); return mv;