From 379af9bd87545e674a08316333a21e1fcaccf3a6 Mon Sep 17 00:00:00 2001 From: liuxm <liuxm_a@163.com> Date: 星期二, 04 六月 2024 09:15:45 +0800 Subject: [PATCH] 安装运维生产计划;生产计划部分修改 --- pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrAssemblyPlan.java | 2 pms-parent/pms-global/src/main/resources/mapper/PrProductionProcessMapper.xml | 6 pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblyPlanCtrl.java | 17 ++ pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java | 18 ++ pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrDevOpsPlan.java | 15 + pms-parent/pms-global/src/main/resources/mapper/PrDevOpsPlanMapper.xml | 119 ++++++------------- pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml | 2 pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/DevOpsPlanCtrl.java | 105 +++++++++++++++++ pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/DevOpsSv.java | 60 ++++++++++ 9 files changed, 254 insertions(+), 90 deletions(-) diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrAssemblyPlan.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrAssemblyPlan.java index e6c5281..603ef80 100644 --- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrAssemblyPlan.java +++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrAssemblyPlan.java @@ -78,6 +78,8 @@ public String proName; @TableField(exist = false) public String batchNo; + @TableField(exist = false) + public String processName; /** * 鍒涘缓鏃堕棿 diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrDevOpsPlan.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrDevOpsPlan.java index 1e54d1a..921a9e8 100644 --- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrDevOpsPlan.java +++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrDevOpsPlan.java @@ -2,6 +2,7 @@ import com.alibaba.fastjson2.annotation.JSONField; import com.alibaba.fastjson2.writer.ObjectWriterImplToString; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.dy.common.po.BaseEntity; @@ -32,10 +33,10 @@ */ public String name; - /** - * 鐐逛綅鏁伴噺 - */ - public Integer num; +// /** +// * 鐐逛綅鏁伴噺 +// */ +// public Integer num; /** * 鐘舵��:姝e父(1)銆佹殏鍋�(0)銆佺粨鏉�(-1) @@ -46,7 +47,11 @@ * 鍒涘缓浜� */ @JSONField(serializeUsing= ObjectWriterImplToString.class) - public String creator; + public Long creator; + @TableField(exist = false) + public String creatorName; +// @TableField(exist = false) +// public String proName; /** * 鍒涘缓鏃堕棿 diff --git a/pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml index 85d3a5d..0660179 100644 --- a/pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml +++ b/pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml @@ -24,6 +24,8 @@ select="com.dy.pmsGlobal.daoBa.BaUserMapper.selectNameByUserId" fetchType="eager" /> <association property="batchNo" column="batch_id" javaType="java.lang.Long" select="com.dy.pmsGlobal.daoPr.PrBatchNumberMapper.selectBatchNoById" fetchType="eager" /> + <association property="processName" column="process_id" javaType="java.lang.Long" + select="com.dy.pmsGlobal.daoPr.PrProductionProcessMapper.selectProcessNameById" fetchType="eager" /> </resultMap> <sql id="Base_Column_List"> diff --git a/pms-parent/pms-global/src/main/resources/mapper/PrDevOpsPlanMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PrDevOpsPlanMapper.xml index 37e54d6..567af34 100644 --- a/pms-parent/pms-global/src/main/resources/mapper/PrDevOpsPlanMapper.xml +++ b/pms-parent/pms-global/src/main/resources/mapper/PrDevOpsPlanMapper.xml @@ -5,20 +5,22 @@ <mapper namespace="com.dy.pmsGlobal.daoPr.PrDevOpsPlanMapper"> <resultMap id="BaseResultMap" type="com.dy.pmsGlobal.pojoPr.PrDevOpsPlan"> - <id property="id" column="id" jdbcType="BIGINT"/> - <result property="name" column="name" jdbcType="VARCHAR"/> - <result property="num" column="num" jdbcType="INTEGER"/> - <result property="status" column="status" jdbcType="TINYINT"/> - <result property="creator" column="creator" jdbcType="VARCHAR"/> - <result property="dt" column="dt" jdbcType="TIMESTAMP"/> - <result property="startDate" column="start_date" jdbcType="VARCHAR"/> - <result property="endDate" column="end_date" jdbcType="VARCHAR"/> - <result property="deleted" column="deleted" jdbcType="TINYINT"/> - <result property="content" column="content" jdbcType="VARCHAR"/> + <id property="id" column="id" jdbcType="BIGINT"/> + <result property="name" column="name" jdbcType="VARCHAR"/> +<!-- <result property="num" column="num" jdbcType="INTEGER"/>--> + <result property="status" column="status" jdbcType="TINYINT"/> + <result property="creator" column="creator" jdbcType="VARCHAR"/> + <result property="dt" column="dt" jdbcType="TIMESTAMP"/> + <result property="startDate" column="start_date" jdbcType="VARCHAR"/> + <result property="endDate" column="end_date" jdbcType="VARCHAR"/> + <result property="deleted" column="deleted" jdbcType="TINYINT"/> + <result property="content" column="content" jdbcType="VARCHAR"/> + <association property="creatorName" column="creator" javaType="java.lang.Long" + select="com.dy.pmsGlobal.daoBa.BaUserMapper.selectNameByUserId" fetchType="eager" /> </resultMap> <sql id="Base_Column_List"> - id,name,num, + id,name, status,creator,dt, start_date,end_date,deleted, content @@ -37,11 +39,10 @@ </delete> <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPr.PrDevOpsPlan" useGeneratedKeys="true"> insert into pr_dev_ops_plan - ( id,name,num - ,status,creator,dt + ( id,name,status,creator,dt ,start_date,end_date,deleted ,content) - values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{num,jdbcType=INTEGER} + values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR} ,#{status,jdbcType=TINYINT},#{creator,jdbcType=VARCHAR},#{dt,jdbcType=TIMESTAMP} ,#{startDate,jdbcType=VARCHAR},#{endDate,jdbcType=VARCHAR},#{deleted,jdbcType=TINYINT} ,#{content,jdbcType=VARCHAR}) @@ -51,7 +52,6 @@ <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">id,</if> <if test="name != null">name,</if> - <if test="num != null">num,</if> <if test="status != null">status,</if> <if test="creator != null">creator,</if> <if test="dt != null">dt,</if> @@ -63,7 +63,6 @@ <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null">#{id,jdbcType=BIGINT},</if> <if test="name != null">#{name,jdbcType=VARCHAR},</if> - <if test="num != null">#{num,jdbcType=INTEGER},</if> <if test="status != null">#{status,jdbcType=TINYINT},</if> <if test="creator != null">#{creator,jdbcType=VARCHAR},</if> <if test="dt != null">#{dt,jdbcType=TIMESTAMP},</if> @@ -78,9 +77,6 @@ <set> <if test="name != null"> name = #{name,jdbcType=VARCHAR}, - </if> - <if test="num != null"> - num = #{num,jdbcType=INTEGER}, </if> <if test="status != null"> status = #{status,jdbcType=TINYINT}, @@ -110,7 +106,6 @@ update pr_dev_ops_plan set name = #{name,jdbcType=VARCHAR}, - num = #{num,jdbcType=INTEGER}, status = #{status,jdbcType=TINYINT}, creator = #{creator,jdbcType=VARCHAR}, dt = #{dt,jdbcType=TIMESTAMP}, @@ -126,36 +121,18 @@ <include refid="Base_Column_List" /> from pr_dev_ops_plan <trim prefix="where" suffixOverrides="and"> - <if test="id != null"> - id = #{id,jdbcType=BIGINT} and - </if> - <if test="name != null"> - name = #{name,jdbcType=VARCHAR} and - </if> - <if test="num != null"> - num = #{num,jdbcType=INTEGER} and - </if> - <if test="status != null"> - status = #{status,jdbcType=TINYINT} and - </if> - <if test="creator != null"> - creator = #{creator,jdbcType=VARCHAR} and - </if> - <if test="dt != null"> - dt = #{dt,jdbcType=TIMESTAMP} and - </if> - <if test="startDate != null"> - start_date = #{startDate,jdbcType=VARCHAR} and - </if> - <if test="endDate != null"> - end_date = #{endDate,jdbcType=VARCHAR} and - </if> - <if test="deleted != null"> - deleted = #{deleted,jdbcType=TINYINT} and - </if> - <if test="content != null"> - content = #{content,jdbcType=VARCHAR} and - </if> + <if test="name != null"> + name = #{name,jdbcType=VARCHAR} and + </if> + <if test="status != null"> + status = #{status,jdbcType=TINYINT} and + </if> + <if test="startDate != null and startDate != '' "> + start_date = #{startDate,jdbcType=VARCHAR} and + </if> + <if test="endDate != null and endDate != '' "> + end_date = #{endDate,jdbcType=VARCHAR} and + </if> </trim> order by id desc <trim prefix="limit " > @@ -169,36 +146,18 @@ select count(1) from pr_dev_ops_plan <trim prefix="where" suffixOverrides="and"> - <if test="id != null"> - id = #{id,jdbcType=BIGINT} and - </if> - <if test="name != null"> - name = #{name,jdbcType=VARCHAR} and - </if> - <if test="num != null"> - num = #{num,jdbcType=INTEGER} and - </if> - <if test="status != null"> - status = #{status,jdbcType=TINYINT} and - </if> - <if test="creator != null"> - creator = #{creator,jdbcType=VARCHAR} and - </if> - <if test="dt != null"> - dt = #{dt,jdbcType=TIMESTAMP} and - </if> - <if test="startDate != null"> - start_date = #{startDate,jdbcType=VARCHAR} and - </if> - <if test="endDate != null"> - end_date = #{endDate,jdbcType=VARCHAR} and - </if> - <if test="deleted != null"> - deleted = #{deleted,jdbcType=TINYINT} and - </if> - <if test="content != null"> - content = #{content,jdbcType=VARCHAR} and - </if> + <if test="name != null"> + name = #{name,jdbcType=VARCHAR} and + </if> + <if test="status != null"> + status = #{status,jdbcType=TINYINT} and + </if> + <if test="startDate != null and startDate != '' "> + start_date = #{startDate,jdbcType=VARCHAR} and + </if> + <if test="endDate != null and endDate != '' "> + end_date = #{endDate,jdbcType=VARCHAR} and + </if> </trim> </select> diff --git a/pms-parent/pms-global/src/main/resources/mapper/PrProductionProcessMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PrProductionProcessMapper.xml index abea33b..a195aee 100644 --- a/pms-parent/pms-global/src/main/resources/mapper/PrProductionProcessMapper.xml +++ b/pms-parent/pms-global/src/main/resources/mapper/PrProductionProcessMapper.xml @@ -28,7 +28,11 @@ </sql> - + <select id="selectProcessNameById" resultType="java.lang.String"> + select name + from pr_production_process + where id = #{id,jdbcType=BIGINT} + </select> <select id="selectByProcess" resultMap="com.dy.pmsGlobal.daoPr.PrProductionNodeMapper.BaseResultMap"> select * from pr_production_node diff --git a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblyPlanCtrl.java b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblyPlanCtrl.java index 363ac83..6dbf964 100644 --- a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblyPlanCtrl.java +++ b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblyPlanCtrl.java @@ -86,6 +86,23 @@ } } + @PostMapping(path="updateStatus") + @SsoPowerAop(power = "-1") + @Log("鏇存柊浠诲姟璁″垝鐘舵��") + public BaseResponse<Boolean> updateStatus(@RequestBody PrAssemblyPlan plan){ + int count; + try { + count = sv.updateStatus(plan); + }catch (Exception e){ + log.error("鏇存柊缁勮浠诲姟璁″垝寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + if (count <= 0) { + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + } else { + return BaseResponseUtils.buildSuccess(true); + } + } /** * 鏍规嵁ID鏌ヨ * @return diff --git a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java index 6f2600d..3466bb7 100644 --- a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java +++ b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java @@ -85,6 +85,7 @@ return assemblyDao.insertSelective(plan); } + @Transactional public int update(PrAssemblyPlan plan){ PrAssemblyPlan origPlan = assemblyDao.selectByPrimaryKey(plan.id); PrBatchNumber batch = batchDao.selectByPrimaryKey(origPlan.batchId); @@ -100,7 +101,7 @@ } - + @Transactional public int addEquip(Long planId,int num){ PrAssemblyPlan plan = assemblyDao.selectByPrimaryKey(planId); PrBatchNumber batch = batchDao.selectByPrimaryKey(plan.batchId); @@ -134,7 +135,7 @@ return insertBatchEquip(list); } - public int insertBatchEquip(List<PrEquip> list) { + private int insertBatchEquip(List<PrEquip> list) { int count = 0; for (int i = 0; i < list.size(); i += BATCH_SIZE) { List<PrEquip> subList = list.subList(i, Math.min(i + BATCH_SIZE, list.size())); @@ -224,4 +225,17 @@ public List<PrEquip> selectEquipByBatchId(Long batchId) { return equipDao.selectByBatchId(batchId); } + + /** + * 鍙洿鏂扮姸鎬�,涓嶆洿鏂板叾浠栧瓧娈� + * @param plan + * @return + */ + @Transactional + public int updateStatus(PrAssemblyPlan plan) { + PrAssemblyPlan param = new PrAssemblyPlan(); + param.id =plan.id; + param.status = plan.status; + return assemblyDao.updateByPrimaryKeySelective(plan); + } } diff --git a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/DevOpsPlanCtrl.java b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/DevOpsPlanCtrl.java index 78c1e23..4be3c4b 100644 --- a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/DevOpsPlanCtrl.java +++ b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/DevOpsPlanCtrl.java @@ -1,8 +1,19 @@ package com.dy.pmsProduct.taskPlan; +import com.dy.common.aop.SsoPowerAop; +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.common.webUtil.QueryResultVo; +import com.dy.pmsGlobal.aop.Log; +import com.dy.pmsGlobal.pojoPr.PrDevOpsPlan; +import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Objects; /** * 瀹夎杩愮淮浠诲姟璁″垝 @@ -11,4 +22,94 @@ @RestController @RequestMapping(path="devOps") public class DevOpsPlanCtrl { + private DevOpsSv sv; + @Autowired + public void setSv(DevOpsSv sv) { + this.sv = sv; + } + + + @PostMapping(path="save") + @SsoPowerAop(power = "-1") + @Log("淇濆瓨缁勮浠诲姟璁″垝") + public BaseResponse<Boolean> save(@RequestBody @Valid PrDevOpsPlan plan, BindingResult bindingResult){ + if (bindingResult != null && bindingResult.hasErrors()) { + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + int count; + try { + count = sv.save(plan); + }catch (Exception e){ + log.error("淇濆瓨缁勮浠诲姟璁″垝寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + if (count <= 0) { + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + } else { + return BaseResponseUtils.buildSuccess(true); + } + } + + /** + * 鏇存柊 + * @param plan + * @param bindingResult + * @return + */ + @PostMapping(path="update") + @SsoPowerAop(power = "-1") + @Log("鏇存柊缁勮浠诲姟璁″垝") + public BaseResponse<Boolean> update(@RequestBody @Valid PrDevOpsPlan plan, BindingResult bindingResult){ + int count; + try { + if (bindingResult != null && bindingResult.hasErrors()) { + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + count = sv.update(plan); + }catch (Exception e){ + log.error("鏇存柊缁勮浠诲姟璁″垝寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + if (count <= 0) { + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + } else { + return BaseResponseUtils.buildSuccess(true); + } + } + + /** + * 鏍规嵁ID鏌ヨ + * @return + */ + @GetMapping(path="one") + @SsoPowerAop(power = "-1") + @Log("鏍规嵁ID鏌ヨ缁勮浠诲姟璁″垝") + public BaseResponse<PrDevOpsPlan> one(Long id){ + try{ + PrDevOpsPlan plan=sv.selectById(id); + return BaseResponseUtils.buildSuccess(plan); + }catch (Exception e){ + log.error("鏍规嵁ID鏌ヨ缁勮浠诲姟璁″垝寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } + + /** + * 鍒嗛〉鏌ヨ + * @param vo + * @return + */ + @PostMapping(path="some") + @SsoPowerAop(power = "-1") + @Log("鍒嗛〉鏌ヨ缁勮浠诲姟璁″垝") + public BaseResponse<QueryResultVo<List<PrDevOpsPlan>>> some(@RequestBody QueryVo vo){ + try { + QueryResultVo<List<PrDevOpsPlan>> list = sv.selectSome(vo) ; + return BaseResponseUtils.buildSuccess(list); + }catch (Exception e){ + log.error("鍒嗛〉鏌ヨ缁勮浠诲姟璁″垝寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } + } diff --git a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/DevOpsSv.java b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/DevOpsSv.java new file mode 100644 index 0000000..23846b8 --- /dev/null +++ b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/DevOpsSv.java @@ -0,0 +1,60 @@ +package com.dy.pmsProduct.taskPlan; + +import com.dy.common.webFilter.UserTokenContext; +import com.dy.common.webUtil.QueryResultVo; +import com.dy.pmsGlobal.daoPr.PrDevOpsPlanMapper; +import com.dy.pmsGlobal.pojoBa.BaUser; +import com.dy.pmsGlobal.pojoPr.PrDevOpsPlan; +import com.dy.pmsGlobal.util.UserUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.common.utils.PojoUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +@Slf4j +@Service +public class DevOpsSv { + private PrDevOpsPlanMapper devOpsDao; + private UserUtil userUtil; + + @Autowired + public void setDevOpsDao(PrDevOpsPlanMapper devOpsDao) { + this.devOpsDao = devOpsDao; + } + @Autowired + public void setUserUtil(UserUtil userUtil) { + this.userUtil = userUtil; + } + public PrDevOpsPlan selectById(Long id) { + return devOpsDao.selectByPrimaryKey(id); + } + + @Transactional + public int save(PrDevOpsPlan plan) { + BaUser loginUser = userUtil.getUser(UserTokenContext.get()); + if(loginUser!=null){ + plan.creator = loginUser.id; + } + plan.deleted = false; + return devOpsDao.insertSelective(plan); + } + @Transactional + public int update(PrDevOpsPlan plan) { + return devOpsDao.updateByPrimaryKeySelective(plan); + } + public QueryResultVo<List<PrDevOpsPlan>> selectSome(QueryVo queryVo) { + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); + //鏌ヨ绗﹀悎鏉′欢鐨勮褰曟�绘暟 + Long itemTotal = devOpsDao.selectSomeCount(params); + QueryResultVo<List<PrDevOpsPlan>> rsVo = new QueryResultVo<>(queryVo.pageSize, queryVo.pageCurr) ; + //璁$畻鍒嗛〉绛変俊鎭� + rsVo.calculateAndSet(itemTotal, params); + //鏌ヨ绗﹀悎鏉′欢鐨勮褰� + rsVo.obj = devOpsDao.selectSome(params); + return rsVo ; + } +} -- Gitblit v1.8.0