From 142dedfcf17712637376baa60be607b923dd249b Mon Sep 17 00:00:00 2001 From: sfd <sun.sunshine@163.com> Date: 星期二, 20 五月 2025 10:47:54 +0800 Subject: [PATCH] Merge branch 'dev' of http://192.168.50.149:8085/r/aps-backend into dev --- aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlate/ApsPlateRequireDateController.java | 73 ++++++++++++ aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlate/ApsPlateRequireDate.java | 82 +++++++++++++ aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlateRequireDateMapper.xml | 41 ++++++ aps-modules/aps-core/src/main/java/com/aps/core/service/ApsPlate/ApsPlateRequireDateService.java | 25 ++++ aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateRequireDateMapper.java | 23 +++ aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlate/ApsPlatePlanController.java | 9 + aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlate/ApsPlateRequireDateServiceImpl.java | 72 ++++++++++++ 7 files changed, 325 insertions(+), 0 deletions(-) diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlate/ApsPlatePlanController.java b/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlate/ApsPlatePlanController.java index 8a6440a..b5e7c16 100644 --- a/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlate/ApsPlatePlanController.java +++ b/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlate/ApsPlatePlanController.java @@ -10,10 +10,15 @@ import com.aps.common.security.utils.DictUtils; import com.aps.core.domain.ApsPlate.ApsPlatePlan; import com.aps.core.domain.ApsPlate.ApsPlatePlanTemp; +import com.aps.core.domain.ApsPlate.ApsPlateRequireDate; import com.aps.core.domain.export.ApsPlatePlanExport; +import com.aps.core.service.ApsPlate.ApsPlateRequireDateService; import com.aps.core.service.ApsPlate.IApsPlatePlanService; import com.aps.core.service.ApsPlate.IApsPlatePlanTempService; import com.aps.system.api.domain.SysDictData; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -30,6 +35,7 @@ * @author ruoyi * @date 2025-04-08 */ +@Tag(name = "閽i噾璁″垝鍒楄〃", description = "閽i噾璁″垝鍒楄〃") @RestController @RequestMapping("/apsPlatePlan") public class ApsPlatePlanController extends BaseController { @@ -37,6 +43,9 @@ private IApsPlatePlanService apsPlatePlanService; @Autowired private IApsPlatePlanTempService apsPlatePlanTempService; + @Resource + private ApsPlateRequireDateService apsPlateRequireDateService; + /** * 鏌ヨ閽i噾璁″垝绠$悊鍒楄〃 */ diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlate/ApsPlateRequireDateController.java b/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlate/ApsPlateRequireDateController.java new file mode 100644 index 0000000..2566073 --- /dev/null +++ b/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlate/ApsPlateRequireDateController.java @@ -0,0 +1,73 @@ +package com.aps.core.controller.mainPlan.ApsPlate; + + +import com.aps.common.core.utils.poi.ExcelUtil; +import com.aps.common.core.web.domain.AjaxResult; +import com.aps.common.log.annotation.Log; +import com.aps.common.log.enums.BusinessType; +import com.aps.common.security.annotation.RequiresPermissions; +import com.aps.core.domain.ApsPlate.ApsPlateRequireDate; +import com.aps.core.service.ApsPlate.ApsPlateRequireDateService; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +@Tag(name = "閽i噾宸ュ崟闇�姹傛棩鏈熺鐞�", description = "閽i噾宸ュ崟闇�姹傛棩鏈熺鐞�") +@RestController +@RequestMapping("/plateRequireDate") +public class ApsPlateRequireDateController { + + @Resource + private ApsPlateRequireDateService apsPlateRequireDateService; + + @RequiresPermissions("plateRequireDate:list") + @GetMapping("/list") + @Tag(name = "鏌ヨ鍒楄〃") + public Page<ApsPlateRequireDate> list(Page<ApsPlateRequireDate> page,ApsPlateRequireDate apsPlateRequireDate){ + return apsPlateRequireDateService.pagingList(page, apsPlateRequireDate); + } + + + /** + * 瀵煎叆Excel鏁版嵁 + * @param file + * @return + * @throws Exception + */ + @Operation(summary = "瀵煎叆宸ュ崟闇�姹傛棩鏈�", description = "瀵煎叆宸ュ崟闇�姹傛棩鏈�") + @RequiresPermissions("plateRequireDate:import") + @Log(title = "瀵煎叆宸ュ崟闇�姹傛棩鏈�", businessType = BusinessType.IMPORT) + @PostMapping("/importRequireDate") + public AjaxResult importRequireDate(MultipartFile file) throws Exception { + ExcelUtil<ApsPlateRequireDate> util = new ExcelUtil<ApsPlateRequireDate>(ApsPlateRequireDate.class); + List<ApsPlateRequireDate> plateRequireDateList = util.importExcel(file.getInputStream()); + if (!plateRequireDateList.isEmpty()) { + try { + apsPlateRequireDateService.batchSave(plateRequireDateList); + } catch (Exception e) { + throw new RuntimeException(e); + } + } else { + return AjaxResult.error("妯℃澘鍐呭涓虹┖"); + } + return AjaxResult.success("瀵煎叆鎴愬姛锛�"); + } + + /** + * 鏍规嵁id鍒犻櫎宸ュ崟闇�姹傛棩鏈� + * */ + @Operation(summary = "鍒犻櫎闇�姹傛棩鏈�", description = "鍒犻櫎闇�姹傛棩鏈�") + @Log(title = "鍒犻櫎闇�姹傛棩鏈�", businessType = BusinessType.DELETE) + @PostMapping("/deleteRequireDate") + @RequiresPermissions("plateRequireDate:delete") + public AjaxResult deleteRequireDate(@RequestBody List<Long> idList) { + apsPlateRequireDateService.batchDelete(idList); + return AjaxResult.success("鍒犻櫎鎴愬姛锛�"); + } + +} diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlate/ApsPlateRequireDate.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlate/ApsPlateRequireDate.java new file mode 100644 index 0000000..2926f5f --- /dev/null +++ b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlate/ApsPlateRequireDate.java @@ -0,0 +1,82 @@ +package com.aps.core.domain.ApsPlate; + +import com.aps.common.core.annotation.Excel; +import com.aps.common.core.web.domain.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 宸ュ崟璁″垝闇�姹傛棩鏈熻〃 + * @TableName aps_plate_require_date + */ +@EqualsAndHashCode(callSuper = true) +@TableName(value ="aps_plate_require_date") +@Data +public class ApsPlateRequireDate extends BaseEntity implements Serializable { + /** + * 涓婚敭ID + */ + @TableId(value = "id") + private Long id; + + /** + * 宸ュ崟Id + */ + @TableField(value = "plan_id") + private Long planId; + + /** + * 璁㈠崟鍙� + */ + @Excel(name = "宸ュ崟鍙�") + @TableField(value = "doc_no") + private String docNo; + + /** + * 宸ュ崟闇�姹傛椂闂� + */ + @Excel(name = "闇�姹傛棩鏈�") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @TableField(value = "require_date") + private Date requireDate; + + /** + * 鏄惁鍒犻櫎 0鍚� 1鏄� + */ + @TableField(value = "del_flag") + private Integer delFlag; + + /** + * + */ + @TableField(value = "create_by") + private String createBy; + + /** + * + */ + @TableField(value = "create_time") + private Date createTime; + + /** + * + */ + @TableField(value = "update_by") + private String updateBy; + + /** + * + */ + @TableField(value = "update_time") + private Date updateTime; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateRequireDateMapper.java b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateRequireDateMapper.java new file mode 100644 index 0000000..a8b068e --- /dev/null +++ b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateRequireDateMapper.java @@ -0,0 +1,23 @@ +package com.aps.core.mapper; + +import com.aps.core.domain.ApsPlate.ApsPlateRequireDate; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +import java.util.List; + +/** +* @author zhl +* @description 閽堝琛ㄣ�恆ps_plate_require_date(宸ュ崟璁″垝闇�姹傛棩鏈熻〃)銆戠殑鏁版嵁搴撴搷浣淢apper +* @createDate 2025-05-19 16:51:36 +* @Entity com.aps.core.domain.ApsPlate.ApsPlateRequireDate +*/ +public interface ApsPlateRequireDateMapper extends BaseMapper<ApsPlateRequireDate> { + + int deleteByDocNoList(List<String> list,String updateBy); + + int batchInsert(List<ApsPlateRequireDate> list); +} + + + + diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/ApsPlate/ApsPlateRequireDateService.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/ApsPlate/ApsPlateRequireDateService.java new file mode 100644 index 0000000..2d4a28e --- /dev/null +++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/ApsPlate/ApsPlateRequireDateService.java @@ -0,0 +1,25 @@ +package com.aps.core.service.ApsPlate; + +import com.aps.common.core.web.domain.AjaxResult; +import com.aps.core.domain.ApsPlate.ApsPlateRequireDate; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** +* @author zhl +* @description 閽堝琛ㄣ�恆ps_plate_require_date(宸ュ崟璁″垝闇�姹傛棩鏈熻〃)銆戠殑鏁版嵁搴撴搷浣淪ervice +* @createDate 2025-05-19 16:51:36 +*/ +public interface ApsPlateRequireDateService extends IService<ApsPlateRequireDate> { + + @Transactional + void batchSave(List<ApsPlateRequireDate> list); + + + int batchDelete(List<Long> idList); + + Page<ApsPlateRequireDate> pagingList(Page<ApsPlateRequireDate> page, ApsPlateRequireDate requireDate); +} diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlate/ApsPlateRequireDateServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlate/ApsPlateRequireDateServiceImpl.java new file mode 100644 index 0000000..a4aefe2 --- /dev/null +++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlate/ApsPlateRequireDateServiceImpl.java @@ -0,0 +1,72 @@ +package com.aps.core.service.impl.ApsPlate; + +import cn.hutool.core.util.IdUtil; +import com.aps.common.security.utils.SecurityUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.aps.core.domain.ApsPlate.ApsPlateRequireDate; +import com.aps.core.service.ApsPlate.ApsPlateRequireDateService; +import com.aps.core.mapper.ApsPlateRequireDateMapper; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * @author zhl + * @description 閽堝琛ㄣ�恆ps_plate_require_date(宸ュ崟璁″垝闇�姹傛棩鏈熻〃)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇 + * @createDate 2025-05-19 16:51:36 + */ +@Service +public class ApsPlateRequireDateServiceImpl extends ServiceImpl<ApsPlateRequireDateMapper, ApsPlateRequireDate> + implements ApsPlateRequireDateService { + + @Resource + private ApsPlateRequireDateMapper apsPlateRequireDateMapper; + + + @Transactional + @Override + public void batchSave(List<ApsPlateRequireDate> list) { + if (!list.isEmpty()) { + list.forEach(apsPlateRequireDate -> { + apsPlateRequireDate.setId(IdUtil.getSnowflakeNextId()); + apsPlateRequireDate.setCreateBy(SecurityUtils.getUsername()); + }); + int batchSize = 1000; + for (int i = 0; i < list.size(); i += batchSize) { + int end = Math.min(i + batchSize, list.size()); + List<ApsPlateRequireDate> batch = list.subList(i, end); + List<String> docNoList = batch.stream().map(ApsPlateRequireDate::getDocNo).distinct().toList(); + apsPlateRequireDateMapper.deleteByDocNoList(docNoList, SecurityUtils.getUsername()); + apsPlateRequireDateMapper.batchInsert(batch); + } + } + } + + + + @Override + public int batchDelete(List<Long> idList){ + //TODO: 鏍规嵁idList鎵归噺鍒犻櫎 + LambdaUpdateWrapper<ApsPlateRequireDate> queryWrapper = new LambdaUpdateWrapper<>(); + queryWrapper.in(ApsPlateRequireDate::getId, idList); + queryWrapper.set(ApsPlateRequireDate::getDelFlag, 0); + return apsPlateRequireDateMapper.update(queryWrapper); + } + + @Override + public Page<ApsPlateRequireDate> pagingList(Page<ApsPlateRequireDate> page, ApsPlateRequireDate requireDate){ + LambdaQueryWrapper<ApsPlateRequireDate> queryWrapper=new LambdaQueryWrapper<>(); + queryWrapper.eq(ApsPlateRequireDate::getDelFlag,0); + queryWrapper.like( null!=requireDate.getDocNo(), ApsPlateRequireDate::getDocNo,requireDate.getDocNo()); + return apsPlateRequireDateMapper.selectPage(page, queryWrapper); + } +} + + + + diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlateRequireDateMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlateRequireDateMapper.xml new file mode 100644 index 0000000..e7e787a --- /dev/null +++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlateRequireDateMapper.xml @@ -0,0 +1,41 @@ +<?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="com.aps.core.mapper.ApsPlateRequireDateMapper"> + + <resultMap id="BaseResultMap" type="com.aps.core.domain.ApsPlate.ApsPlateRequireDate"> + <id property="id" column="id" /> + <result property="planId" column="plan_id" /> + <result property="docNo" column="doc_no" /> + <result property="requireDate" column="require_date" /> + <result property="delFlag" column="del_flag" /> + <result property="createBy" column="create_by" /> + <result property="createTime" column="create_time" /> + <result property="updateBy" column="update_by" /> + <result property="updateTime" column="update_time" /> + </resultMap> + + <sql id="Base_Column_List"> + id,plan_id,doc_no,require_date,del_flag,create_by, + create_time,update_by,update_time + </sql> + + <update id="deleteByDocNoList" parameterType="String"> + update aps_plate_require_date + set del_flag = 1, update_time = now(),update_by=#{updateBy} + where doc_no in + <foreach collection="list" item="item" open="(" separator="," close=")"> + #{item} + </foreach> + </update> + + <insert id="batchInsert" parameterType="com.aps.core.domain.ApsPlate.ApsPlateRequireDate"> + insert into aps_plate_require_date + (id,plan_id,doc_no,require_date,del_flag,create_by,create_time) + values + <foreach item="item" collection="list" separator="," index="index"> + (#{item.id},#{item.planId},#{item.docNo},#{item.requireDate},0,#{item.createBy},now()) + </foreach> + </insert> +</mapper> -- Gitblit v1.9.3