sfd
2025-05-22 8ad701d7f9a2c37e61b1ff53587be9851962d26b
修改导出模板
已修改8个文件
已添加2个文件
已删除2个文件
176 ■■■■■ 文件已修改
aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsGasPipelineCapacityPlanController.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsGasPipelineMoController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsGasPipelinePredictionController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsGasPipelineCapacityPlan.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsGasPipelineCapacityPlanMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/service/IApsGasPipelineCapacityPlanService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipelineCapacityPlanServiceImpl.java 84 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/resources/mapper/core/ApsGasPipelineCapacityPlanMapper.xml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/resources/templates/上传气体工单数据模板.xlsx 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/resources/templates/上传气体预测数据模板.xlsx 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/resources/templates/气体工单数据模板v1.0.xlsx 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/resources/templates/气体预测数据模板v1.0.xlsx 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsGasPipelineCapacityPlanController.java
@@ -24,7 +24,7 @@
/**
 * æ°”体管路产能规划Controller
 *
 *
 * @author hjy
 * @date 2025-04-24
 */
@@ -32,8 +32,7 @@
@Tag(name = "气体管路产能规划", description = "气体管路产能规划接口")
@RestController
@RequestMapping("/gasPipelineCapacityPlan")
public class ApsGasPipelineCapacityPlanController extends BaseController
{
public class ApsGasPipelineCapacityPlanController extends BaseController {
    @Autowired
    private IApsGasPipelineCapacityPlanService apsGasPipelineCapacityPlanService;
@@ -46,43 +45,42 @@
    @Operation(summary = "查询气体管路产能规划列表", description = "分页查询")
    @RequiresPermissions("aps:gasPipelineCapacityPlan:list")
    @GetMapping("/list")
    public TableDataInfo list(ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan)
    {
    public TableDataInfo list(ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) {
//        startPage();
        List<ApsGasPipelineCapacityPlan> list = apsGasPipelineCapacityPlanService.selectApsGasPipelineCapacityPlanList(apsGasPipelineCapacityPlan);
        ApsStandardProcess apsStandardProcess = new ApsStandardProcess();
        apsStandardProcess.setMajor(apsGasPipelineCapacityPlan.getMajor());
        apsStandardProcess.setPlant(apsGasPipelineCapacityPlan.getOrgCode());
        List<ApsStandardProcess> processList = apsStandardProcessService.selectApsStandardProcessListAll(apsStandardProcess);
        if(list.isEmpty()){
            for(ApsStandardProcess apsStandardProcessTemp : processList){
        if (list.isEmpty()) {
            for (ApsStandardProcess apsStandardProcessTemp : processList) {
                ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlanTemp = new ApsGasPipelineCapacityPlan();
                apsGasPipelineCapacityPlanTemp.setProcessName(apsStandardProcessTemp.getProcessName());
                apsGasPipelineCapacityPlanTemp.setOrgCode(apsStandardProcessTemp.getPlant());
                list.add(apsGasPipelineCapacityPlanTemp);
            }
        }
        if(processList.size()>list.size()){
        if (processList.size() > list.size()) {
            List<String> newProcess = new ArrayList<>();
            for(ApsStandardProcess apsStandardProcessTemp : processList){
            for (ApsStandardProcess apsStandardProcessTemp : processList) {
                boolean flag = true;
                for(ApsGasPipelineCapacityPlan temp : list){
                    if(apsStandardProcessTemp.getProcessName().equals(temp.getProcessName())){
                for (ApsGasPipelineCapacityPlan temp : list) {
                    if (apsStandardProcessTemp.getProcessName().equals(temp.getProcessName())) {
                        flag = false;
                        break;
                    }
                }
                if(flag){
                if (flag) {
                    newProcess.add(apsStandardProcessTemp.getProcessName());
                }
            }
            for(String processName : newProcess){
            for (String processName : newProcess) {
                ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlanTemp = new ApsGasPipelineCapacityPlan();
                apsGasPipelineCapacityPlanTemp.setProcessName(processName);
                list.add(apsGasPipelineCapacityPlanTemp);
            }
        }
        list.sort((a, b)->a.getProcessName().compareTo(b.getProcessName()));
        list.sort((a, b) -> a.getProcessName().compareTo(b.getProcessName()));
        return getDataTable(list);
    }
@@ -93,11 +91,30 @@
    @RequiresPermissions("aps:gasPipelineCapacityPlan:export")
    @Log(title = "气体管路产能规划", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan)
    {
    public void export(HttpServletResponse response, ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) {
        List<ApsGasPipelineCapacityPlan> list = apsGasPipelineCapacityPlanService.selectApsGasPipelineCapacityPlanList(apsGasPipelineCapacityPlan);
        ExcelUtil<ApsGasPipelineCapacityPlan> util = new ExcelUtil<ApsGasPipelineCapacityPlan>(ApsGasPipelineCapacityPlan.class);
        util.exportExcel(response, list, "气体管路产能规划数据");
    }
    /**
     * å¤åˆ¶æ°”体管路产能规划
     */
    @Operation(summary = "复制气体管路产能规划", description = "复制")
//    @RequiresPermissions("aps:gasPipelineCapacityPlan:copy")
    @Log(title = "复制气体管路产能规划", businessType = BusinessType.INSERT)
    @PutMapping("/copy")
    public AjaxResult copy(
            // æ ¼å¼ï¼šyyyy-MM
            @RequestParam String date,
            @RequestParam String factory,
            // æ ¼å¼ï¼šyyyy-MM
            @RequestParam String toStart,
            // æ ¼å¼ï¼šyyyy-MM
            @RequestParam String toEnd) {
        apsGasPipelineCapacityPlanService.copyPlan(date, factory, toStart, toEnd);
        return success();
    }
    /**
@@ -106,8 +123,7 @@
    @Operation(summary = "获取气体管路产能规划详细信息", description = "根据id获取")
    @RequiresPermissions("aps:gasPipelineCapacityPlan:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(apsGasPipelineCapacityPlanService.selectApsGasPipelineCapacityPlanById(id));
    }
@@ -118,14 +134,13 @@
    @RequiresPermissions("aps:gasPipelineCapacityPlan:add")
    @Log(title = "气体管路产能规划", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody List<ApsGasPipelineCapacityPlan> apsGasPipelineCapacityPlan)
    {
    public AjaxResult add(@RequestBody List<ApsGasPipelineCapacityPlan> apsGasPipelineCapacityPlan) {
        apsGasPipelineCapacityPlan.forEach(apsGasPipelineCapacityPlanTemp -> {
            if(apsGasPipelineCapacityPlanTemp.getId()==null){
            if (apsGasPipelineCapacityPlanTemp.getId() == null) {
                apsGasPipelineCapacityPlanTemp.setCreateBy(SecurityUtils.getUsername());
                apsGasPipelineCapacityPlanTemp.setCreateTime(DateUtils.getNowDate());
                apsGasPipelineCapacityPlanService.insertApsGasPipelineCapacityPlan(apsGasPipelineCapacityPlanTemp);
            }else{
            } else {
                apsGasPipelineCapacityPlanTemp.setUpdateBy(SecurityUtils.getUsername());
                apsGasPipelineCapacityPlanTemp.setUpdateTime(DateUtils.getNowDate());
                apsGasPipelineCapacityPlanService.updateApsGasPipelineCapacityPlan(apsGasPipelineCapacityPlanTemp);
@@ -141,8 +156,7 @@
    @RequiresPermissions("aps:gasPipelineCapacityPlan:edit")
    @Log(title = "气体管路产能规划", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan)
    {
    public AjaxResult edit(@RequestBody ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) {
        return toAjax(apsGasPipelineCapacityPlanService.updateApsGasPipelineCapacityPlan(apsGasPipelineCapacityPlan));
    }
@@ -152,9 +166,8 @@
    @Operation(summary = "删除气体管路产能规划", description = "批量删除")
    @RequiresPermissions("aps:gasPipelineCapacityPlan:remove")
    @Log(title = "气体管路产能规划", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(apsGasPipelineCapacityPlanService.deleteApsGasPipelineCapacityPlanByIds(ids));
    }
}
aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsGasPipelineMoController.java
@@ -130,11 +130,11 @@
     */
    @SneakyThrows
    @Operation(summary = "下载气体工单数据导入模板", description = "下载气体工单数据导入模板")
    @RequiresPermissions("gasPipeline:mo:template")
    @Log(title = "下载气体工单数据导入模板", businessType = BusinessType.EXPORT)
//    @RequiresPermissions("gasPipeline:mo:template")
//    @Log(title = "下载气体工单数据导入模板", businessType = BusinessType.EXPORT)
    @GetMapping("/template")
    public ResponseEntity<ByteArrayResource> exportTemplate() {
        byte[] file = IOUtils.resourceToByteArray("/templates/上传气体工单数据模板.xlsx");
        byte[] file = IOUtils.resourceToByteArray("/templates/气体工单数据模板v1.0.xlsx");
        ByteArrayResource resource = new ByteArrayResource(file);
        return ResponseEntity.ok()
                .header(HttpHeaders.CONTENT_DISPOSITION,
aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsGasPipelinePredictionController.java
@@ -70,11 +70,11 @@
     */
    @SneakyThrows
    @Operation(summary = "下载气体预测数据导入模板", description = "下载气体预测数据导入模板")
    @RequiresPermissions("gasPipeline:prediction:template")
    @Log(title = "下载气体预测数据导入模板", businessType = BusinessType.EXPORT)
//    @RequiresPermissions("gasPipeline:prediction:template")
//    @Log(title = "下载气体预测数据导入模板", businessType = BusinessType.EXPORT)
    @GetMapping("/template")
    public ResponseEntity<ByteArrayResource> exportTemplate() {
        byte[] file = IOUtils.resourceToByteArray("/templates/上传气体预测数据模板.xlsx");
        byte[] file = IOUtils.resourceToByteArray("/templates/气体预测数据模板v1.0.xlsx");
        ByteArrayResource resource = new ByteArrayResource(file);
        return ResponseEntity.ok()
                .header(HttpHeaders.CONTENT_DISPOSITION,
aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsGasPipelineCapacityPlan.java
@@ -2,6 +2,7 @@
import com.aps.common.core.annotation.Excel;
import com.aps.common.core.web.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@@ -20,6 +21,7 @@
    private static final long serialVersionUID = 1L;
    /** ä¸»é”®id */
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @Schema(description = "主键id", type = "Long")
    private Long id;
aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsGasPipelineCapacityPlanMapper.java
@@ -61,4 +61,6 @@
     * @return ç»“æžœ
     */
    public int deleteApsGasPipelineCapacityPlanByIds(Long[] ids);
    void deleteByDateAndFactory(String year, String month, String factory);
}
aps-modules/aps-core/src/main/java/com/aps/core/service/IApsGasPipelineCapacityPlanService.java
@@ -59,4 +59,6 @@
     * @return ç»“æžœ
     */
    public int deleteApsGasPipelineCapacityPlanById(Long id);
    void copyPlan(String date, String factory, String toStart, String toEnd);
}
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipelineCapacityPlanServiceImpl.java
@@ -5,56 +5,59 @@
import com.aps.core.domain.ApsGasPipelineCapacityPlan;
import com.aps.core.mapper.ApsGasPipelineCapacityPlanMapper;
import com.aps.core.service.IApsGasPipelineCapacityPlanService;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
 * æ°”体管路产能规划Service业务层处理
 *
 *
 * @author hjy
 * @date 2025-04-24
 */
@Service
public class ApsGasPipelineCapacityPlanServiceImpl implements IApsGasPipelineCapacityPlanService
{
public class ApsGasPipelineCapacityPlanServiceImpl implements IApsGasPipelineCapacityPlanService {
    @Autowired
    private ApsGasPipelineCapacityPlanMapper apsGasPipelineCapacityPlanMapper;
    /**
     * æŸ¥è¯¢æ°”体管路产能规划
     *
     *
     * @param id æ°”体管路产能规划主键
     * @return æ°”体管路产能规划
     */
    @Override
    public ApsGasPipelineCapacityPlan selectApsGasPipelineCapacityPlanById(Long id)
    {
    public ApsGasPipelineCapacityPlan selectApsGasPipelineCapacityPlanById(Long id) {
        return apsGasPipelineCapacityPlanMapper.selectApsGasPipelineCapacityPlanById(id);
    }
    /**
     * æŸ¥è¯¢æ°”体管路产能规划列表
     *
     *
     * @param apsGasPipelineCapacityPlan æ°”体管路产能规划
     * @return æ°”体管路产能规划
     */
    @Override
    public List<ApsGasPipelineCapacityPlan> selectApsGasPipelineCapacityPlanList(ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan)
    {
    public List<ApsGasPipelineCapacityPlan> selectApsGasPipelineCapacityPlanList(ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) {
        return apsGasPipelineCapacityPlanMapper.selectApsGasPipelineCapacityPlanList(apsGasPipelineCapacityPlan);
    }
    /**
     * æ–°å¢žæ°”体管路产能规划
     *
     *
     * @param apsGasPipelineCapacityPlan æ°”体管路产能规划
     * @return ç»“æžœ
     */
    @Override
    public int insertApsGasPipelineCapacityPlan(ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan)
    {
    public int insertApsGasPipelineCapacityPlan(ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) {
        apsGasPipelineCapacityPlan.setCreateTime(DateUtils.getNowDate());
        apsGasPipelineCapacityPlan.setCreateBy(SecurityUtils.getUsername());
        return apsGasPipelineCapacityPlanMapper.insertApsGasPipelineCapacityPlan(apsGasPipelineCapacityPlan);
@@ -62,13 +65,12 @@
    /**
     * ä¿®æ”¹æ°”体管路产能规划
     *
     *
     * @param apsGasPipelineCapacityPlan æ°”体管路产能规划
     * @return ç»“æžœ
     */
    @Override
    public int updateApsGasPipelineCapacityPlan(ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan)
    {
    public int updateApsGasPipelineCapacityPlan(ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) {
        apsGasPipelineCapacityPlan.setUpdateTime(DateUtils.getNowDate());
        apsGasPipelineCapacityPlan.setUpdateBy(SecurityUtils.getUsername());
        return apsGasPipelineCapacityPlanMapper.updateApsGasPipelineCapacityPlan(apsGasPipelineCapacityPlan);
@@ -76,25 +78,65 @@
    /**
     * æ‰¹é‡åˆ é™¤æ°”体管路产能规划
     *
     *
     * @param ids éœ€è¦åˆ é™¤çš„æ°”体管路产能规划主键
     * @return ç»“æžœ
     */
    @Override
    public int deleteApsGasPipelineCapacityPlanByIds(Long[] ids)
    {
    public int deleteApsGasPipelineCapacityPlanByIds(Long[] ids) {
        return apsGasPipelineCapacityPlanMapper.deleteApsGasPipelineCapacityPlanByIds(ids);
    }
    /**
     * åˆ é™¤æ°”体管路产能规划信息
     *
     *
     * @param id æ°”体管路产能规划主键
     * @return ç»“æžœ
     */
    @Override
    public int deleteApsGasPipelineCapacityPlanById(Long id)
    {
    public int deleteApsGasPipelineCapacityPlanById(Long id) {
        return apsGasPipelineCapacityPlanMapper.deleteApsGasPipelineCapacityPlanById(id);
    }
    @SneakyThrows
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void copyPlan(String date, String factory, String toStart, String toEnd) {
        String[] dtSrc = date.split("-");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
        Calendar dtStart = Calendar.getInstance();
        dtStart.setTime(sdf.parse(toStart));
        dtStart.set(Calendar.DAY_OF_MONTH, 1);
        Calendar dtEnd = Calendar.getInstance();
        dtEnd.setTime(sdf.parse(toEnd));
        dtEnd.set(Calendar.DAY_OF_MONTH, 2);
        ApsGasPipelineCapacityPlan plan = new ApsGasPipelineCapacityPlan();
        plan.setYear(Integer.valueOf(dtSrc[0]).toString());
        plan.setMonth(Integer.valueOf(dtSrc[1]).toString());
        plan.setOrgCode(factory);
        List<ApsGasPipelineCapacityPlan> templatePlans = apsGasPipelineCapacityPlanMapper.selectApsGasPipelineCapacityPlanList(plan);
        while (dtStart.before(dtEnd)) {
            String year = dtStart.get(Calendar.YEAR) + "";
            String month = (dtStart.get(Calendar.MONTH) + 1) + "";
            apsGasPipelineCapacityPlanMapper.deleteByDateAndFactory(
                    year,
                    month,
                    factory
            );
            templatePlans.forEach(p -> {
                p.setYear(year);
                p.setMonth(month);
                p.setCreateBy(SecurityUtils.getUsername());
                p.setCreateTime(new Date());
                p.setUpdateBy(null);
                p.setUpdateTime(null);
                apsGasPipelineCapacityPlanMapper.insertApsGasPipelineCapacityPlan(p);
            });
            dtStart.add(Calendar.MONTH, 1);
        }
    }
}
aps-modules/aps-core/src/main/resources/mapper/core/ApsGasPipelineCapacityPlanMapper.xml
@@ -133,4 +133,11 @@
            #{id}
        </foreach>
    </delete>
    <delete id="deleteByDateAndFactory" >
        delete from aps_gas_pipeline_capacity_plan
               where year = #{year}
                   and month = #{month}
                   and org_code = #{factory}
    </delete>
</mapper>
aps-modules/aps-core/src/main/resources/templates/ÉÏ´«ÆøÌ幤µ¥Êý¾ÝÄ£°å.xlsx
Binary files differ
aps-modules/aps-core/src/main/resources/templates/ÉÏ´«ÆøÌåÔ¤²âÊý¾ÝÄ£°å.xlsx
Binary files differ
aps-modules/aps-core/src/main/resources/templates/ÆøÌ幤µ¥Êý¾ÝÄ£°åv1.0.xlsx
Binary files differ
aps-modules/aps-core/src/main/resources/templates/ÆøÌåÔ¤²âÊý¾ÝÄ£°åv1.0.xlsx
Binary files differ