¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.dto; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * @Description: EchartsDto |
| | | * @Date:2021/5/20 |
| | | * @Version:V1.0 |
| | | */ |
| | | @Data |
| | | @Accessors(chain = true) |
| | | public class EchartsDto { |
| | | |
| | | public EchartsDto() { |
| | | |
| | | } |
| | | |
| | | public EchartsDto(String code, String name, String value, String total, String percentage) { |
| | | this.code = code; |
| | | this.name = name; |
| | | this.value = value; |
| | | this.total = total; |
| | | this.percentage = percentage; |
| | | } |
| | | |
| | | /** |
| | | * code |
| | | */ |
| | | private String code; |
| | | /** |
| | | * name |
| | | */ |
| | | private String name; |
| | | /** |
| | | * å¼ |
| | | */ |
| | | private String value; |
| | | |
| | | /** |
| | | * æ»æ° |
| | | */ |
| | | private String total; |
| | | |
| | | /** |
| | | * å æ¯ |
| | | */ |
| | | private String percentage; |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.entity; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | |
| | | /** |
| | | * @Description: âé¦é¡µè½¦é´äºä¿è®¡å |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-08-22 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Data |
| | | @TableName("eam_factory_second_maint_plan") |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="eam_factory_second_maint_plan对象", description="âé¦é¡µè½¦é´äºä¿è®¡å") |
| | | public class EamFactorySecondMaintPlan { |
| | | |
| | | /**主é®*/ |
| | | @TableId(type = IdType.ASSIGN_ID) |
| | | @ApiModelProperty(value = "主é®") |
| | | private String id; |
| | | /**å建人*/ |
| | | @Excel(name = "å建人", width = 15) |
| | | @ApiModelProperty(value = "å建人") |
| | | private String createBy; |
| | | /**å建æ¶é´*/ |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | private Date createTime; |
| | | /**æ´æ°äºº*/ |
| | | @Excel(name = "æ´æ°äºº", width = 15) |
| | | @ApiModelProperty(value = "æ´æ°äºº") |
| | | private String updateBy; |
| | | /**æ´æ°æ¶é´*/ |
| | | @ApiModelProperty(value = "æ´æ°æ¶é´") |
| | | private Date updateTime; |
| | | /**å 餿 è®°*/ |
| | | @Excel(name = "å 餿 è®°", width = 15) |
| | | @ApiModelProperty(value = "å 餿 è®°") |
| | | private Integer delFlag; |
| | | /**å·¥åID*/ |
| | | @Excel(name = "å·¥åID", width = 15) |
| | | @ApiModelProperty(value = "å·¥åID") |
| | | private String factoryId; |
| | | /**å·¥ååç§°*/ |
| | | @Excel(name = "å·¥ååç§°", width = 15) |
| | | @ApiModelProperty(value = "å·¥ååç§°") |
| | | private String factoryName; |
| | | /**计åæä»½*/ |
| | | @Excel(name = "计åæä»½", width = 15) |
| | | @ApiModelProperty(value = "计åæä»½") |
| | | private String monthPlan; |
| | | /**æ°é*/ |
| | | @Excel(name = "æ°é", width = 15) |
| | | @ApiModelProperty(value = "æ°é") |
| | | private String quantity; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.jeecg.modules.eam.dto.EchartsDto; |
| | | import org.jeecg.modules.eam.entity.EamEquipment; |
| | | |
| | | import java.util.List; |
| | |
| | | */ |
| | | List<EamEquipment> selectThreeMaintenanceEquipmentList(@Param(Constants.WRAPPER) Wrapper<EamEquipment> queryWrapper); |
| | | |
| | | /** |
| | | * 设å¤ç®¡çé¦é¡µ |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | List<EchartsDto> echartsList(List<String> ids); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.eam.entity.EamFactorySecondMaintPlan; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * @Description: âé¦é¡µè½¦é´äºä¿è®¡å |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-08-22 |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface EamFactorySecondMaintPlanMapper extends BaseMapper<EamFactorySecondMaintPlan> { |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | IPage<EamReportRepairDto> queryPageList(Page<EamReportRepairDto> page, @Param(Constants.WRAPPER) QueryWrapper<EamReportRepairDto> queryWrapper); |
| | | |
| | | /** |
| | | * å表æ¥è¯¢ |
| | | * @param queryWrapper |
| | | * @return |
| | | */ |
| | | List<EamReportRepairDto> queryList(@Param(Constants.WRAPPER) QueryWrapper<EamReportRepairDto> queryWrapper); |
| | | } |
| | |
| | | on e.id = ext.id |
| | | ${ew.customSqlSegment} |
| | | </select> |
| | | <select id="echartsList" resultType="org.jeecg.modules.eam.dto.EchartsDto"> |
| | | SELECT COUNT |
| | | ( t.technology_status ) AS "value", |
| | | item.item_text AS "name", |
| | | item.item_value AS "code", |
| | | ( SELECT COUNT ( a.id ) FROM eam_equipment_extend a WHERE a.technology_status IS NOT NULL |
| | | <if test="ids != null and ids != ''"> |
| | | AND a.id IN |
| | | <foreach collection="ids" item="id" index="index" open="(" close=")" separator=","> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | ) AS "total", |
| | | concat ( |
| | | round( |
| | | ISNULL ( |
| | | COUNT ( t.id ) / ( SELECT COUNT ( a.id ) FROM eam_equipment_extend a WHERE a.technology_status IS NOT NULL |
| | | <if test="ids != null and ids != ''"> |
| | | AND a.id IN |
| | | <foreach collection="ids" item="id" index="index" open="(" close=")" separator=","> |
| | | #{id} |
| | | </foreach> |
| | | </if>), |
| | | 0 |
| | | ) * 100, |
| | | 2 |
| | | ), |
| | | '%' |
| | | ) AS "percentage" |
| | | FROM |
| | | sys_dict c |
| | | LEFT JOIN sys_dict_item item ON c.id = item.dict_id |
| | | LEFT JOIN eam_equipment_extend t ON t.technology_status = item.item_value |
| | | <if test="ids != null and ids != ''"> |
| | | AND t.id IN |
| | | <foreach collection="ids" item="id" index="index" open="(" close=")" separator=","> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | WHERE |
| | | c.dict_code = 'equipment_technology_status' |
| | | GROUP BY |
| | | item.item_text, |
| | | t.technology_status, |
| | | item.item_value |
| | | ORDER BY |
| | | item.item_value |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.eam.mapper.EamFactorySecondMaintPlanMapper"> |
| | | |
| | | </mapper> |
| | |
| | | and aar.del_flag=0 |
| | | ${ew.customSqlSegment} |
| | | </select> |
| | | <select id="queryList" resultType="org.jeecg.modules.eam.dto.EamReportRepairDto"> |
| | | select wmo.*, e.equipment_code, e.equipment_name,e.equipment_model, e.installation_position, |
| | | aar.operation_certificate, power_off_restart, batch_first_piece, variable_factors, |
| | | variable_factors_value, execute_nc, accident_phenomenon, measure, causing_results |
| | | from eam_report_repair wmo |
| | | inner join eam_equipment e |
| | | on wmo.equipment_id = e.id |
| | | and e.del_flag=0 |
| | | left join eam_report_accidents_register aar |
| | | on wmo.id = aar.report_id |
| | | and aar.del_flag=0 |
| | | ${ew.customSqlSegment} |
| | | </select> |
| | | </mapper> |
| | |
| | | package org.jeecg.modules.eam.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.eam.dto.EchartsDto; |
| | | import org.jeecg.modules.eam.entity.EamEquipment; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.eam.request.EamEquipmentQuery; |
| | |
| | | * è·åå¯çæä¸ä¿å·¥åç设å¤å表 |
| | | */ |
| | | List<EamEquipment> selectThreeMaintenanceEquipmentList(); |
| | | |
| | | /** |
| | | * 设å¤ç®¡çé¦é¡µ-ææ¯ç¶æ |
| | | * @return |
| | | */ |
| | | List<EchartsDto> echartsList(); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.service; |
| | | |
| | | import org.jeecg.modules.eam.entity.EamFactorySecondMaintPlan; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * @Description: âé¦é¡µè½¦é´äºä¿è®¡å |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-08-22 |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface IEamFactorySecondMaintPlanService extends IService<EamFactorySecondMaintPlan> { |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.eam.dto.EamReportRepairDto; |
| | | import org.jeecg.modules.eam.dto.EchartsDto; |
| | | import org.jeecg.modules.eam.entity.*; |
| | | import org.jeecg.modules.eam.request.EamReportRepairQuery; |
| | | import org.jeecg.modules.eam.request.EamReportRepairRequest; |
| | |
| | | */ |
| | | EamReportRepair reportRepairFromThirdMaintenance(String equipmentId, String reportUser, List<EamThirdMaintenanceOrderDetail> detailList); |
| | | |
| | | /** |
| | | * 设å¤ç®¡çé¦é¡µ-è®¾å¤æ¥ä¿®æ
éæ
åµ |
| | | * @return |
| | | */ |
| | | List<EchartsDto> reportRepairList(); |
| | | } |
| | |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.eam.aspect.annotation.EquipmentHistoryLog; |
| | | import org.jeecg.modules.eam.constant.*; |
| | | import org.jeecg.modules.eam.dto.EchartsDto; |
| | | import org.jeecg.modules.eam.entity.EamEquipment; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentExtend; |
| | | import org.jeecg.modules.eam.mapper.EamEquipmentMapper; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 设å¤ç®¡çé¦é¡µ-ææ¯ç¶æ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<EchartsDto> echartsList(){ |
| | | QueryWrapper<EamEquipment> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("e.del_flag", CommonConstant.DEL_FLAG_0); |
| | | //ç¨æ·æ°æ®æé |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (sysUser == null) { |
| | | return null; |
| | | } |
| | | if (StringUtils.isNotBlank(sysUser.getEamEquipmentIds())) { |
| | | //éæ©äºè®¾å¤ï¼æ ¹æ®è®¾å¤idè¿æ»¤è®¾å¤ |
| | | List<String> equipArr = Arrays.asList(sysUser.getEamEquipmentIds().split(",")); |
| | | queryWrapper.in("e.equipment_code", equipArr); |
| | | } else { |
| | | //没æéæ©è®¾å¤ï¼æ ¹æ®ä¸å¿è¿æ»¤è®¾å¤ |
| | | List<BaseFactoryUser> baseFactoryUserList=baseFactoryUserService. |
| | | list(new LambdaQueryWrapper<BaseFactoryUser>().eq(BaseFactoryUser::getUserId,sysUser.getId())); |
| | | if(!CollectionUtils.isEmpty(baseFactoryUserList)){ |
| | | Set<String> factoryIds = baseFactoryUserList.stream().map(BaseFactoryUser::getFactoryId).collect(Collectors.toSet()); |
| | | Set<String> factoryCode= baseFactoryService.listByIds(factoryIds).stream().map(BaseFactory::getOrgCode).collect(Collectors.toSet()); |
| | | queryWrapper.in("e.factory_org_code", factoryCode); |
| | | }else { |
| | | return null; |
| | | } |
| | | } |
| | | List<String> ids=this.baseMapper.queryList(queryWrapper).stream().map(EamEquipment::getId).collect(Collectors.toList()); |
| | | return this.baseMapper.echartsList(ids); |
| | | } |
| | | |
| | | /** |
| | | * è·åææç产线idï¼å
嫿æä¸çº§ï¼ |
| | | */ |
| | | private void getAllProductionIds(List<MdcProduction> productionList, String productionId, List<String> allProductionIds) { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.service.impl; |
| | | |
| | | import org.jeecg.modules.eam.entity.EamFactorySecondMaintPlan; |
| | | import org.jeecg.modules.eam.mapper.EamFactorySecondMaintPlanMapper; |
| | | import org.jeecg.modules.eam.service.IEamFactorySecondMaintPlanService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | /** |
| | | * @Description: âé¦é¡µè½¦é´äºä¿è®¡å |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-08-22 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Service |
| | | public class EamFactorySecondMaintPlanServiceImpl extends ServiceImpl<EamFactorySecondMaintPlanMapper, EamFactorySecondMaintPlan> implements IEamFactorySecondMaintPlanService { |
| | | |
| | | } |
| | |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.eam.aspect.annotation.EquipmentHistoryLog; |
| | | import org.jeecg.modules.eam.constant.*; |
| | | import org.jeecg.modules.eam.dto.EamRepairOrderDto; |
| | | import org.jeecg.modules.eam.dto.EamReportRepairDto; |
| | | import org.jeecg.modules.eam.dto.EchartsDto; |
| | | import org.jeecg.modules.eam.entity.*; |
| | | import org.jeecg.modules.eam.mapper.EamReportRepairMapper; |
| | | import org.jeecg.modules.eam.request.EamReportRepairQuery; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | eamEquipmentExtendService.updateEquipmentRepairStatus(entity.getEquipmentId(), EquipmentRepairStatus.WAIT_REPAIR.name()); |
| | | return entity; |
| | | } |
| | | |
| | | public List<EchartsDto> reportRepairList() { |
| | | List<EchartsDto> echartsDtoList = new ArrayList<>(); |
| | | |
| | | // ç¨æ·æ°æ®æéæ£æ¥ |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (sysUser == null) { |
| | | return echartsDtoList; // è¿å空å表èénull |
| | | } |
| | | |
| | | QueryWrapper<EamReportRepairDto> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("wmo.del_flag", CommonConstant.DEL_FLAG_0); |
| | | |
| | | // 设å¤è¿æ»¤é»è¾ |
| | | if (StringUtils.isNotBlank(sysUser.getEamEquipmentIds())) { |
| | | List<String> equipArr = Arrays.asList(sysUser.getEamEquipmentIds().split(",")); |
| | | queryWrapper.in("e.equipment_code", equipArr); |
| | | } else { |
| | | List<BaseFactoryUser> baseFactoryUserList = baseFactoryUserService |
| | | .list(new LambdaQueryWrapper<BaseFactoryUser>() |
| | | .eq(BaseFactoryUser::getUserId, sysUser.getId())); |
| | | |
| | | if (CollectionUtils.isEmpty(baseFactoryUserList)) { |
| | | return echartsDtoList; // è¿å空å表èénull |
| | | } |
| | | |
| | | Set<String> factoryIds = baseFactoryUserList.stream() |
| | | .map(BaseFactoryUser::getFactoryId) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | Set<String> factoryCodes = baseFactoryService.listByIds(factoryIds) |
| | | .stream() |
| | | .map(BaseFactory::getOrgCode) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | queryWrapper.in("e.factory_org_code", factoryCodes); |
| | | } |
| | | |
| | | // è·ååºç¡æ°æ® |
| | | List<EamReportRepairDto> baseList = this.baseMapper.queryList(queryWrapper); |
| | | int totalCount = baseList.size(); |
| | | |
| | | // è·ååæºæ°é |
| | | int shutdownCount = this.baseMapper.queryList( |
| | | queryWrapper.clone().eq("breakdown_flag", "1") |
| | | ).size(); |
| | | |
| | | // 计ç®è¿è¡æ°é |
| | | int runningCount = totalCount - shutdownCount; |
| | | |
| | | // å¤çé¶å¼æ
åµ |
| | | if (totalCount == 0) { |
| | | // æ·»å ææé¶å¼æ°æ®é¡¹ |
| | | addZeroValueData(echartsDtoList, "æ¥ä¿®æ»æ°", "bx"); |
| | | addZeroValueData(echartsDtoList, "åæºæ»æ°", "stop"); |
| | | addZeroValueData(echartsDtoList, "è¿è¡æ»æ°", "run"); |
| | | return echartsDtoList; |
| | | } |
| | | |
| | | // 计ç®ç¾åæ¯ |
| | | BigDecimal total = new BigDecimal(totalCount); |
| | | String bxPercentage = calculatePercentage(totalCount, BigDecimal.valueOf(totalCount)); |
| | | String stopPercentage = calculatePercentage(shutdownCount, BigDecimal.valueOf(totalCount)); |
| | | String runPercentage = calculatePercentage(runningCount, BigDecimal.valueOf(totalCount)); |
| | | |
| | | // æå»ºè¿åæ°æ® |
| | | echartsDtoList.add(createEchartsDto("æ¥ä¿®æ»æ°", "bx", totalCount, bxPercentage)); |
| | | echartsDtoList.add(createEchartsDto("åæºæ»æ°", "stop", shutdownCount, stopPercentage)); |
| | | echartsDtoList.add(createEchartsDto("è¿è¡æ»æ°", "run", runningCount, runPercentage)); |
| | | |
| | | return echartsDtoList; |
| | | } |
| | | |
| | | // è¾
婿¹æ³ï¼æ·»å é¶å¼æ°æ® |
| | | private void addZeroValueData(List<EchartsDto> list, String name, String code) { |
| | | EchartsDto dto = new EchartsDto(); |
| | | dto.setName(name); |
| | | dto.setCode(code); |
| | | dto.setValue("0"); |
| | | dto.setPercentage("0.00%"); |
| | | list.add(dto); |
| | | } |
| | | |
| | | // è¾
婿¹æ³ï¼è®¡ç®ç¾åæ¯ |
| | | private String calculatePercentage(int value, BigDecimal total) { |
| | | return new BigDecimal(value) |
| | | .multiply(new BigDecimal(100)) |
| | | .divide(total, 2, RoundingMode.HALF_UP) + "%"; |
| | | } |
| | | |
| | | // è¾
婿¹æ³ï¼å建EchartsDto对象 |
| | | private EchartsDto createEchartsDto(String name, String code, int value, String percentage) { |
| | | EchartsDto dto = new EchartsDto(); |
| | | dto.setName(name); |
| | | dto.setCode(code); |
| | | dto.setValue(String.valueOf(value)); |
| | | dto.setPercentage(percentage); |
| | | return dto; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLDecoder; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.eam.entity.EamFactorySecondMaintPlan; |
| | | import org.jeecg.modules.eam.service.IEamFactorySecondMaintPlanService; |
| | | import java.util.Date; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecgframework.poi.excel.ExcelImportUtil; |
| | | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| | | import org.jeecgframework.poi.excel.entity.ExportParams; |
| | | import org.jeecgframework.poi.excel.entity.ImportParams; |
| | | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | import com.alibaba.fastjson.JSON; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | /** |
| | | * @Description: âé¦é¡µè½¦é´äºä¿è®¡å |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-08-22 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags="âé¦é¡µè½¦é´äºä¿è®¡å") |
| | | @RestController |
| | | @RequestMapping("/eam/eamFactorySecondMaintPlan") |
| | | public class EamFactorySecondMaintPlanController extends JeecgController<EamFactorySecondMaintPlan, IEamFactorySecondMaintPlanService> { |
| | | @Autowired |
| | | private IEamFactorySecondMaintPlanService eamFactorySecondMaintPlanService; |
| | | |
| | | /** |
| | | * å页å表æ¥è¯¢ |
| | | * |
| | | * @param eamFactorySecondMaintPlan |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "âé¦é¡µè½¦é´äºä¿è®¡å-å页å表æ¥è¯¢") |
| | | @ApiOperation(value="âé¦é¡µè½¦é´äºä¿è®¡å-å页å表æ¥è¯¢", notes="âé¦é¡µè½¦é´äºä¿è®¡å-å页å表æ¥è¯¢") |
| | | @GetMapping(value = "/list") |
| | | public Result<?> queryPageList(EamFactorySecondMaintPlan eamFactorySecondMaintPlan, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<EamFactorySecondMaintPlan> queryWrapper = QueryGenerator.initQueryWrapper(eamFactorySecondMaintPlan, req.getParameterMap()); |
| | | Page<EamFactorySecondMaintPlan> page = new Page<EamFactorySecondMaintPlan>(pageNo, pageSize); |
| | | IPage<EamFactorySecondMaintPlan> pageList = eamFactorySecondMaintPlanService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * æ·»å |
| | | * |
| | | * @param eamFactorySecondMaintPlan |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "âé¦é¡µè½¦é´äºä¿è®¡å-æ·»å ") |
| | | @ApiOperation(value="âé¦é¡µè½¦é´äºä¿è®¡å-æ·»å ", notes="âé¦é¡µè½¦é´äºä¿è®¡å-æ·»å ") |
| | | @PostMapping(value = "/add") |
| | | public Result<?> add(@RequestBody EamFactorySecondMaintPlan eamFactorySecondMaintPlan) { |
| | | eamFactorySecondMaintPlanService.save(eamFactorySecondMaintPlan); |
| | | return Result.OK("æ·»å æåï¼"); |
| | | } |
| | | |
| | | /** |
| | | * ç¼è¾ |
| | | * |
| | | * @param eamFactorySecondMaintPlan |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "âé¦é¡µè½¦é´äºä¿è®¡å-ç¼è¾") |
| | | @ApiOperation(value="âé¦é¡µè½¦é´äºä¿è®¡å-ç¼è¾", notes="âé¦é¡µè½¦é´äºä¿è®¡å-ç¼è¾") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
| | | public Result<?> edit(@RequestBody EamFactorySecondMaintPlan eamFactorySecondMaintPlan) { |
| | | eamFactorySecondMaintPlanService.updateById(eamFactorySecondMaintPlan); |
| | | 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) { |
| | | eamFactorySecondMaintPlanService.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.eamFactorySecondMaintPlanService.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) { |
| | | EamFactorySecondMaintPlan eamFactorySecondMaintPlan = eamFactorySecondMaintPlanService.getById(id); |
| | | return Result.OK(eamFactorySecondMaintPlan); |
| | | } |
| | | |
| | | /** |
| | | * 导åºexcel |
| | | * |
| | | * @param request |
| | | * @param eamFactorySecondMaintPlan |
| | | */ |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, EamFactorySecondMaintPlan eamFactorySecondMaintPlan) { |
| | | return super.exportXls(request, eamFactorySecondMaintPlan, EamFactorySecondMaintPlan.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, EamFactorySecondMaintPlan.class); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | 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.modules.eam.dto.EchartsDto; |
| | | import org.jeecg.modules.eam.entity.EamFactorySecondMaintPlan; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentService; |
| | | import org.jeecg.modules.eam.service.IEamFactorySecondMaintPlanService; |
| | | import org.jeecg.modules.eam.service.IEamReportRepairService; |
| | | import org.jeecg.modules.eam.service.IEamThirdMaintenanceOrderService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author Lyh |
| | | * @Description: EAMé¦é¡µæ¥å£ |
| | | * @date 2024/3/13 14:27 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = "EAMé¦é¡µæ¥å£") |
| | | @RestController |
| | | @RequestMapping("/eam/home") |
| | | public class EamHomeController { |
| | | @Autowired |
| | | private IEamEquipmentService iEamEquipmentService; |
| | | |
| | | @Autowired |
| | | private IEamReportRepairService iEamReportRepairService; |
| | | |
| | | @Autowired |
| | | private IEamThirdMaintenanceOrderService iEamThirdMaintenanceOrderService; |
| | | |
| | | @Autowired |
| | | private IEamFactorySecondMaintPlanService iEamFactorySecondMaintPlanService; |
| | | |
| | | /** |
| | | * 设å¤ç®¡çé¦é¡µ-ææ¯ç¶æä¸è®¾å¤æ¥ä¿®æ
éæ
åµ |
| | | * @param |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "设å¤ç®¡çé¦é¡µ-ææ¯ç¶æä¸è®¾å¤æ¥ä¿®æ
éæ
åµ", notes = "设å¤ç®¡çé¦é¡µ-ææ¯ç¶æä¸è®¾å¤æ¥ä¿®æ
éæ
åµ") |
| | | @GetMapping(value = "/techornology") |
| | | public Result<?> techOrNology() { |
| | | //ææ¯ç¶æ |
| | | List<EchartsDto> echartsDtoList=iEamEquipmentService.echartsList(); |
| | | //è®¾å¤æ¥ä¿®æ
éæ
åµ |
| | | List<EchartsDto> echartsDtoList1=iEamReportRepairService.reportRepairList(); |
| | | Map<String,Object> map=new HashMap<>(); |
| | | map.put("jszt",echartsDtoList); |
| | | map.put("bxqk",echartsDtoList1); |
| | | return Result.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * 设å¤ç®¡çé¦é¡µ-ä¸çº§ä¿å
» |
| | | * @param |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "设å¤ç®¡çé¦é¡µ-ä¸çº§ä¿å
»", notes = "设å¤ç®¡çé¦é¡µ-ä¸çº§ä¿å
»") |
| | | @GetMapping(value = "/maintenance") |
| | | public Result<?> maintenance() { |
| | | //ä¸çº§ä¿å
» |
| | | List<EchartsDto> echartsDtoList = iEamThirdMaintenanceOrderService.selectList(); |
| | | return Result.ok(echartsDtoList); |
| | | } |
| | | |
| | | /** |
| | | * 设å¤ç®¡çé¦é¡µ-äºä¿å表 |
| | | * @param |
| | | */ |
| | | @ApiOperation(value = "设å¤ç®¡çé¦é¡µ-äºä¿å表", notes = "设å¤ç®¡çé¦é¡µ-äºä¿å表") |
| | | @GetMapping(value = "/secondmaintenance") |
| | | public Result<?> secondmaintenance() { |
| | | //äºçº§ä¿å
» |
| | | List<EamFactorySecondMaintPlan> echartsDtoList = iEamFactorySecondMaintPlanService.list(); |
| | | return Result.ok(echartsDtoList); |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * å表æ¥è¯¢ |
| | | */ |
| | | List<EamThirdMaintenanceOrder> queryAsList(@Param(Constants.WRAPPER) QueryWrapper<EamThirdMaintenanceOrder> queryWrapper); |
| | | |
| | | /** |
| | | * å表æ¥è¯¢ |
| | | * @param queryWrapper |
| | | * @return |
| | | */ |
| | |
| | | LEFT JOIN eam_base_factory f ON f.org_code = SUBSTRING ( e.factory_org_code , 1, 6 ) |
| | | ${ew.customSqlSegment} |
| | | </select> |
| | | <select id="queryAsList" resultType="org.jeecg.modules.eam.entity.EamThirdMaintenanceOrder"> |
| | | select wmo.*, e.equipment_code, e.equipment_name, e.equipment_model,f.process_instance_id as 'procInstId', |
| | | f.process_definition_key, |
| | | f.process_definition_id, |
| | | f.process_instance_id |
| | | from eam_third_maintenance_order wmo |
| | | inner join eam_equipment e |
| | | on wmo.equipment_id = e.id |
| | | left join flow_my_business f on f.data_id=wmo.id |
| | | ${ew.customSqlSegment} |
| | | </select> |
| | | </mapper> |
| | |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.modules.eam.dto.EamThirdMaintenanceOrderExport; |
| | | import org.jeecg.modules.eam.dto.EamThirdMaintenanceOrderExportYj; |
| | | import org.jeecg.modules.eam.dto.EchartsDto; |
| | | import org.jeecg.modules.eam.entity.EamThirdMaintenanceOrder; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.eam.request.EamThirdMaintenanceQuery; |
| | |
| | | * æ¹éæå°å 工设å¤ä¸çº§ä¿å
»éªæ¶å |
| | | */ |
| | | List<EamThirdMaintenanceOrderExport> exportAcceptance(String ids); |
| | | |
| | | /** |
| | | * 设å¤ç®¡çé¦é¡µ-ä¸ä¿è®¡å |
| | | * @return |
| | | */ |
| | | List<EchartsDto> selectList(); |
| | | } |
| | |
| | | import org.jeecg.modules.eam.dto.EamThirdMaintenanceOrderExport; |
| | | import org.jeecg.modules.eam.dto.EamThirdMaintenanceOrderExport; |
| | | import org.jeecg.modules.eam.dto.EamThirdMaintenanceOrderExportYj; |
| | | import org.jeecg.modules.eam.dto.EchartsDto; |
| | | import org.jeecg.modules.eam.entity.*; |
| | | import org.jeecg.modules.eam.mapper.EamThirdMaintenanceOrderMapper; |
| | | import org.jeecg.modules.eam.request.EamThirdMaintenanceBaseResponse; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 设å¤ç®¡çé¦é¡µ-ä¸ä¿è®¡å |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<EchartsDto> selectList() { |
| | | List<EchartsDto> echartsDtos = new ArrayList<>(); |
| | | |
| | | // ç¨æ·æ°æ®æéæ£æ¥ |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (sysUser == null) { |
| | | return echartsDtos; // è¿å空å表èénull |
| | | } |
| | | |
| | | QueryWrapper<EamThirdMaintenanceOrder> queryWrapper = new QueryWrapper<>(); |
| | | |
| | | // 设å¤è¿æ»¤é»è¾ |
| | | if (StringUtils.isNotBlank(sysUser.getEamEquipmentIds())) { |
| | | List<String> equipArr = Arrays.asList(sysUser.getEamEquipmentIds().split(",")); |
| | | queryWrapper.in("e.equipment_code", equipArr); |
| | | } else { |
| | | List<BaseFactoryUser> baseFactoryUserList = baseFactoryUserService |
| | | .list(new LambdaQueryWrapper<BaseFactoryUser>() |
| | | .eq(BaseFactoryUser::getUserId, sysUser.getId())); |
| | | |
| | | if (CollectionUtils.isEmpty(baseFactoryUserList)) { |
| | | return echartsDtos; // è¿å空å表èénull |
| | | } |
| | | |
| | | Set<String> factoryIds = baseFactoryUserList.stream() |
| | | .map(BaseFactoryUser::getFactoryId) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | Set<String> factoryCodes = baseFactoryService.listByIds(factoryIds) |
| | | .stream() |
| | | .map(BaseFactory::getOrgCode) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | queryWrapper.in("e.factory_org_code", factoryCodes); |
| | | } |
| | | |
| | | // è·åå½åå¹´æåä¸ä¸¤ä¸ªæçå¹´æå符串 |
| | | String currentYearMonth = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM")); |
| | | String nextMonth = LocalDate.now().plusMonths(1).format(DateTimeFormatter.ofPattern("yyyy-MM")); |
| | | String nextNextMonth = LocalDate.now().plusMonths(2).format(DateTimeFormatter.ofPattern("yyyy-MM")); |
| | | |
| | | // æ¬æä¸ä¿è®¡åæ»æ° |
| | | List<EamThirdMaintenanceOrder> currentMonthOrders = this.baseMapper.queryAsList( |
| | | queryWrapper.clone().like("maintenance_date", currentYearMonth) |
| | | ); |
| | | echartsDtos.add(new EchartsDto("bysbzs", "æ¬æä¸ä¿è®¡åæ»æ°", |
| | | String.valueOf(currentMonthOrders.size()), null, null)); |
| | | |
| | | // æ¬æå®æ |
| | | List<EamThirdMaintenanceOrder> currentMonthCompleted = this.baseMapper.queryAsList( |
| | | queryWrapper.clone().like("maintenance_date", currentYearMonth) |
| | | .eq("maintenance_status", ThirdMaintenanceStatusEnum.COMPLETE.name()) |
| | | ); |
| | | echartsDtos.add(new EchartsDto("bwc", "æ¬æå®æ", |
| | | String.valueOf(currentMonthCompleted.size()), null, null)); |
| | | |
| | | // 䏿ä¸ä¿è®¡å |
| | | List<EamThirdMaintenanceOrder> nextMonthOrders = this.baseMapper.queryAsList( |
| | | queryWrapper.clone().like("maintenance_date", nextMonth) |
| | | ); |
| | | echartsDtos.add(new EchartsDto("xysb", "䏿ä¸ä¿è®¡å", |
| | | String.valueOf(nextMonthOrders.size()), null, null)); |
| | | |
| | | // ä¸ä¸æä¸ä¿è®¡å |
| | | List<EamThirdMaintenanceOrder> nextNextMonthOrders = this.baseMapper.queryAsList( |
| | | queryWrapper.clone().like("maintenance_date", nextNextMonth) |
| | | ); |
| | | echartsDtos.add(new EchartsDto("xxysb", "ä¸ä¸æä¸ä¿è®¡å", |
| | | String.valueOf(nextNextMonthOrders.size()), null, null)); |
| | | |
| | | return echartsDtos; |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°å·¥åç¶æ |
| | | */ |
| | | private void updateOrderStatus(Result result, EamThirdMaintenanceRequest request, EamThirdMaintenanceOrder order, LoginUser user) { |