aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsStandardProcessController.java
@@ -9,9 +9,12 @@ import com.aps.common.security.annotation.RequiresPermissions; import com.aps.core.domain.ApsStandardProcess; import com.aps.core.service.IApsStandardProcessService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.util.List; @@ -22,6 +25,8 @@ * @date 2025-04-23 */ @Tag(name = "标准工序", description = "标准工序接口") @RestController @RequestMapping("/standardProcess") public class ApsStandardProcessController extends BaseController @@ -32,7 +37,9 @@ /** * 查询标准工序列表 */ @RequiresPermissions("core:standardProcess:list") @Operation(summary = "查询标准工序列表", description = "分页查询") @RequiresPermissions("aps:standardProcess:list") @GetMapping("/list") public TableDataInfo list(ApsStandardProcess apsStandardProcess) { @@ -44,7 +51,8 @@ /** * 导出标准工序列表 */ @RequiresPermissions("core:standardProcess:export") @Operation(summary = "导出标准工序列表", description = "导出Excel") @RequiresPermissions("aps:standardProcess:export") @Log(title = "标准工序", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, ApsStandardProcess apsStandardProcess) @@ -57,7 +65,8 @@ /** * 获取标准工序详细信息 */ @RequiresPermissions("core:standardProcess:query") @Operation(summary = "获取标准工序详细信息", description = "根据id获取") @RequiresPermissions("aps:standardProcess:query") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { @@ -67,7 +76,8 @@ /** * 新增标准工序 */ @RequiresPermissions("core:standardProcess:add") @Operation(summary = "新增标准工序", description = "单个增加") @RequiresPermissions("aps:standardProcess:add") @Log(title = "标准工序", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody ApsStandardProcess apsStandardProcess) @@ -78,7 +88,8 @@ /** * 修改标准工序 */ @RequiresPermissions("core:standardProcess:edit") @Operation(summary = "修改标准工序", description = "单个修改") @RequiresPermissions("aps:standardProcess:edit") @Log(title = "标准工序", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody ApsStandardProcess apsStandardProcess) @@ -89,11 +100,34 @@ /** * 删除标准工序 */ @RequiresPermissions("core:standardProcess:remove") @Operation(summary = "删除标准工序", description = "批量删除") @RequiresPermissions("aps:standardProcess:remove") @Log(title = "标准工序", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(apsStandardProcessService.deleteApsStandardProcessByIds(ids)); } /** * 导入标准工序数据 */ @Operation(summary = "导入标准工序数据", description = "增量导入") @RequiresPermissions("aps:standardProcess:importData") @PostMapping("/importData") public AjaxResult importData(MultipartFile file) throws Exception { ExcelUtil<ApsStandardProcess> util = new ExcelUtil<>(ApsStandardProcess.class); List<ApsStandardProcess> tempList = util.importExcel(file.getInputStream()); //判断导入数据是否为空 if (!tempList.isEmpty()) { Boolean res = apsStandardProcessService.importData(tempList); if(res){ return AjaxResult.success("导入成功!"); }else{ return AjaxResult.error("导入失败!"); } } else { return AjaxResult.error("模板内容为空"); } } } aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsStandardProcess.java
@@ -2,8 +2,11 @@ import com.aps.common.core.annotation.Excel; import com.aps.common.core.web.domain.BaseEntity; import io.swagger.v3.oas.annotations.media.Schema; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import java.math.BigDecimal; /** * 标准工序对象 aps_standard_process @@ -11,61 +14,77 @@ * @author hjy * @date 2025-04-23 */ @Schema(description = "标准工序实体") public class ApsStandardProcess extends BaseEntity { private static final long serialVersionUID = 1L; /** 主键id */ @Schema(description = "主键id", type = "Long") private Long id; /** 工序编码 */ @Schema(description = "工序编码", type = "String") @Excel(name = "工序编码") private String processNumber; /** 工序名称 */ @Schema(description = "工序名称", type = "String") @Excel(name = "工序名称") private String processName; /** 资源组 */ @Schema(description = "资源组", type = "String") @Excel(name = "资源组") private String resourceGroupName; /** 产能模型: 独占/合批 */ @Excel(name = "产能模型: 独占/合批") @Schema(description = "产能模型", type = "String") @Excel(name = "产能模型") private String model; /** 设计产能 */ @Schema(description = "设计产能", type = "String") @Excel(name = "设计产能") private String designCapacity; private BigDecimal designCapacity; /** 工厂Id */ @Excel(name = "工厂Id") @Schema(description = "工厂Id", type = "String") // @Excel(name = "工厂Id") private String plantId; /** 工厂 */ @Schema(description = "工厂", type = "String") @Excel(name = "工厂") private String plant; /** 车间Id */ @Excel(name = "车间Id") @Schema(description = "车间Id", type = "String") // @Excel(name = "车间Id") private String workShopId; /** 车间 */ @Schema(description = "车间", type = "String") @Excel(name = "车间") private String workShop; /** 日历Id */ @Excel(name = "日历Id") @Schema(description = "日历Id", type = "Long") // @Excel(name = "日历Id") private Long workCalenderId; /** 删除标志(0代表存在 2代表删除) */ @Schema(description = "删除标志(0代表存在 2代表删除)", type = "String") private String delFlag; /** 产能模型Id */ @Excel(name = "产能模型Id") @Schema(description = "产能模型Id", type = "Long") // @Excel(name = "产能模型Id") private Long modelId; /** 日历描述 */ @Schema(description = "日历描述", type = "String") @Excel(name = "日历描述") private String workCalender; @@ -119,12 +138,12 @@ return model; } public void setDesignCapacity(String designCapacity) public void setDesignCapacity(BigDecimal designCapacity) { this.designCapacity = designCapacity; } public String getDesignCapacity() public BigDecimal getDesignCapacity() { return designCapacity; } aps-modules/aps-core/src/main/java/com/aps/core/service/IApsStandardProcessService.java
@@ -59,4 +59,11 @@ * @return 结果 */ public int deleteApsStandardProcessById(Long id); /** * 导入数据 * @param tempList * @return */ public boolean importData(List<ApsStandardProcess> tempList); } aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsStandardProcessServiceImpl.java
@@ -1,6 +1,7 @@ package com.aps.core.service.impl; import com.aps.common.core.utils.DateUtils; import com.aps.common.security.utils.SecurityUtils; import com.aps.core.domain.ApsStandardProcess; import com.aps.core.mapper.ApsStandardProcessMapper; import com.aps.core.service.IApsStandardProcessService; @@ -55,6 +56,7 @@ public int insertApsStandardProcess(ApsStandardProcess apsStandardProcess) { apsStandardProcess.setCreateTime(DateUtils.getNowDate()); apsStandardProcess.setCreateBy(SecurityUtils.getUsername()); return apsStandardProcessMapper.insertApsStandardProcess(apsStandardProcess); } @@ -68,6 +70,7 @@ public int updateApsStandardProcess(ApsStandardProcess apsStandardProcess) { apsStandardProcess.setUpdateTime(DateUtils.getNowDate()); apsStandardProcess.setUpdateBy(SecurityUtils.getUsername()); return apsStandardProcessMapper.updateApsStandardProcess(apsStandardProcess); } @@ -94,4 +97,26 @@ { return apsStandardProcessMapper.deleteApsStandardProcessById(id); } /** * 导入数据 * @param tempList * @return true/false */ @Override public boolean importData(List<ApsStandardProcess> tempList) { try { if (!tempList.isEmpty()) { tempList.forEach(temp->{ temp.setCreateBy(SecurityUtils.getUsername()); temp.setCreateTime(DateUtils.getNowDate()); apsStandardProcessMapper.insertApsStandardProcess(temp); }); } } catch (Exception e) { e.printStackTrace(); return false; } return true; } } aps-modules/aps-core/src/main/resources/mapper/core/ApsStandardProcessMapper.xml
@@ -55,7 +55,6 @@ <insert id="insertApsStandardProcess" parameterType="ApsStandardProcess"> insert into aps_standard_process <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">id,</if> <if test="processNumber != null">process_number,</if> <if test="processName != null">process_name,</if> <if test="resourceGroupName != null">resource_group_name,</if> @@ -75,7 +74,6 @@ <if test="workCalender != null">work_calender,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null">#{id},</if> <if test="processNumber != null">#{processNumber},</if> <if test="processName != null">#{processName},</if> <if test="resourceGroupName != null">#{resourceGroupName},</if> aps-modules/aps-core/src/main/resources/mapper/core/ApsWorkCalendarMapper.xml
@@ -84,7 +84,7 @@ <if test="type != null">type = #{type},</if> <if test="effectiveDate != null">effective_date = #{effectiveDate},</if> <if test="expiringDate != null">expiring_date = #{expiringDate},</if> <if test="content != null">content = #{content},</if> <if test="content != null">content = #{content , typeHandler=com.aps.core.typeHandler.JsonTypeHandler, jdbcType=OTHER},</if> <if test="applicableFactory != null">applicable_factory = #{applicableFactory},</if> <if test="applicableWorkshop != null">applicable_workshop = #{applicableWorkshop},</if> <if test="applicableProcess != null">applicable_process = #{applicableProcess},</if>