From 4a36a12d40453f7686e5f2664f19601b9f6b9ae2 Mon Sep 17 00:00:00 2001
From: Fancy <Fancy.fx@outlook.com>
Date: 星期四, 22 八月 2024 14:39:52 +0800
Subject: [PATCH] order status
---
pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/order/OrderSv.java | 41 ++++++++++++++++++++
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrAssemblyPlan.java | 3 +
pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/order/OrderCtrl.java | 45 +++++++++++++---------
pms-parent/pms-global/src/main/resources/mapper/PrOrderMapper.xml | 4 +
pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml | 2 +
5 files changed, 75 insertions(+), 20 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 70cfb90..fcf0b62 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
@@ -43,6 +43,9 @@
@JSONField(serializeUsing= ObjectWriterImplToString.class)
public Long orderId;
+ @TableField(exist = false)
+ public String orderName;
+
/**
* 鎵规瀹炰綋缂栧彿
*/
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 8a0a22c..7a21c13 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml
@@ -29,6 +29,8 @@
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"/>
+ <association property="orderName" column="order_id" javaType="java.lang.Long"
+ select="com.dy.pmsGlobal.daoPr.PrOrderMapper.selectOrderNameById" fetchType="eager" />
<collection property="process" ofType="com.dy.pmsGlobal.pojoPr.PrProductionProcess"
select="com.dy.pmsGlobal.daoPr.PrProductionProcessMapper.selectByPrimaryKey" fetchType="eager"
column="process_id"/>
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PrOrderMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PrOrderMapper.xml
index 705cb10..6bfacd5 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PrOrderMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PrOrderMapper.xml
@@ -33,7 +33,9 @@
from pr_order
where id = #{id,jdbcType=BIGINT}
</select>
-
+ <select id="selectOrderNameById" parameterType="java.lang.Long" resultType="String">
+ select name from pr_order where id=#{orderId,jdbcType=BIGINT}
+ </select>
<select id="exists" resultType="java.lang.Boolean">
select count(1) from pr_order where name = #{name}
<if test="id != null">
diff --git a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/order/OrderCtrl.java b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/order/OrderCtrl.java
index 3bd5971..199160f 100644
--- a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/order/OrderCtrl.java
+++ b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/order/OrderCtrl.java
@@ -21,17 +21,19 @@
*/
@Slf4j
@RestController
-@RequestMapping(path="order")
+@RequestMapping(path = "order")
public class OrderCtrl {
private OrderSv sv;
+
@Autowired
public void setAssemblySv(OrderSv orderSv) {
this.sv = orderSv;
}
- @PostMapping(path="save")
+
+ @PostMapping(path = "save")
@SsoPowerAop(power = "10200001")
@Log("淇濆瓨璁㈠崟淇℃伅")
- public BaseResponse<Boolean> save(@RequestBody @Valid PrOrder order){
+ public BaseResponse<Boolean> save(@RequestBody @Valid PrOrder order) {
int count = sv.save(order);
if (count <= 0) {
return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�");
@@ -42,13 +44,14 @@
/**
* 鏇存柊
+ *
* @param order
* @return
*/
- @PostMapping(path="update")
+ @PostMapping(path = "update")
@SsoPowerAop(power = "10200001")
@Log("淇敼璁㈠崟淇℃伅")
- public BaseResponse<Boolean> update(@RequestBody @Valid PrOrder order){
+ public BaseResponse<Boolean> update(@RequestBody @Valid PrOrder order) {
int count = sv.update(order);
if (count <= 0) {
return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�");
@@ -59,13 +62,14 @@
/**
* 鍒犻櫎璁㈠崟淇℃伅
+ *
* @param id
* @return
*/
- @GetMapping(path="delete")
+ @GetMapping(path = "delete")
@SsoPowerAop(power = "10300001")
@Log("鍒犻櫎璁㈠崟淇℃伅")
- public BaseResponse<Boolean> delete(String id){
+ public BaseResponse<Boolean> delete(String id) {
int count = sv.delete(Long.parseLong(id));
if (count <= 0) {
return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�");
@@ -76,46 +80,49 @@
/**
* 鏍规嵁ID鏌ヨ
+ *
* @return
*/
- @GetMapping(path="one")
+ @GetMapping(path = "one")
@SsoPowerAop(power = "10200000")
@Log("鏍规嵁ID鏌ヨ璁㈠崟淇℃伅")
- public BaseResponse<PrOrder> one(String id){
- PrOrder plan=sv.selectById(id);
+ public BaseResponse<PrOrder> one(String id) {
+ PrOrder plan = sv.selectById(id);
return BaseResponseUtils.buildSuccess(plan);
}
/**
* 鍒嗛〉鏌ヨ
+ *
* @param vo
* @return
*/
- @PostMapping(path="some")
+ @PostMapping(path = "some")
@SsoPowerAop(power = "10200000")
@Log("鍒嗛〉鏌ヨ璁㈠崟淇℃伅")
- public BaseResponse<QueryResultVo<List<PrOrder>>> some(@RequestBody QueryVo vo){
- QueryResultVo<List<PrOrder>> list = sv.selectSome(vo) ;
+ public BaseResponse<QueryResultVo<List<PrOrder>>> some(@RequestBody QueryVo vo) {
+ QueryResultVo<List<PrOrder>> list = sv.selectSome(vo);
return BaseResponseUtils.buildSuccess(list);
}
/**
* 鏌ヨ鎵�鏈夎鍗�
+ *
* @return
*/
- @GetMapping(path="all")
+ @GetMapping(path = "all")
@SsoPowerAop(power = "10300000")
@Log("鏌ヨ鎵�鏈変骇鍝�")
- public BaseResponse<List<PrOrder>> all(){
+ public BaseResponse<List<PrOrder>> all() {
QueryVo vo = new QueryVo();
return BaseResponseUtils.buildSuccess(sv.selectAll(vo));
}
- @PostMapping(path="updateStatus")
+ @PostMapping(path = "updateStatus")
@SsoPowerAop(power = "10200001")
- @Log("鏇存柊浠诲姟璁″垝鐘舵��")
- public BaseResponse<Boolean> updateStatus(@RequestBody PrAssemblyPlan plan){
- int count = 0;//sv.updateStatus(plan);
+ @Log("鏇存柊璁㈠崟鐘舵��")
+ public BaseResponse<Boolean> updateStatus(@RequestBody PrOrder order) {
+ int count = 0; //sv.updateStatus(plan);
if (count <= 0) {
return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�");
} else {
diff --git a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/order/OrderSv.java b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/order/OrderSv.java
index db2edf4..3cf6817 100644
--- a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/order/OrderSv.java
+++ b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/order/OrderSv.java
@@ -6,6 +6,7 @@
import com.dy.pmsGlobal.pojoBa.BaUser;
import com.dy.pmsGlobal.pojoPr.*;
import com.dy.pmsGlobal.util.UserUtil;
+import com.dy.pmsProduct.taskPlan.PlanStatusEnum;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -14,6 +15,8 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
@@ -151,4 +154,42 @@
}
return orderList;
}
+ /**
+ * 鍙洿鏂扮姸鎬�,涓嶆洿鏂板叾浠栧瓧娈�
+ * @param plan
+ * 鏇存柊鐘舵�� 濡傛灉鏈夊湪鎵ц涓殑浠诲姟,涓嶈鏆傚仠
+ * @return
+ */
+ /* @Transactional
+ public int updateStatus(PrOrder plan) {
+ if(plan.status == PlanStatusEnum.NORMAL.getCode()){
+ PrAssemblyPlan assemblyPlan = assemblyDao.selectByPrimaryKey(plan.id);
+ assemblyPlan.status = plan.status;
+ extractedCheck(assemblyPlan);
+ }
+ PrAssemblyPlan param = new PrAssemblyPlan();
+ param.id =plan.id;
+ param.status = plan.status;
+ return assemblyDao.updateByPrimaryKeySelective(param);
+ }
+ private void extractedCheck(PrAssemblyPlan plan) {
+ PrProductionProcess process = processDao.selectByPrimaryKey(plan.processId);
+ if(process == null || !process.proId.equals(plan.proId)){
+ throw new RuntimeException("浜у搧涓庣敓浜ф祦绋嬩笉鍖归厤");
+ }
+ //寮�濮嬫棩鏈熻灏忎簬缁撴潫鏃ユ湡
+ if(plan.startDate.compareTo(plan.endDate) > 0){
+ throw new RuntimeException("寮�濮嬫棩鏈熶笉鑳藉ぇ浜庣粨鏉熸棩鏈�");
+ }
+ //Fancy add 2024/07/09 濡傛灉鐘舵�佷负鎵ц ,鍒欑粨鏉熸棩鏈熷繀椤诲ぇ浜庣瓑浜庡綋鍓嶆棩鏈�
+ if(plan.status == PlanStatusEnum.NORMAL.getCode()){
+ String endDateStr = plan.getEndDate();
+ LocalDate endDate = LocalDate.parse(endDateStr, DateTimeFormatter.ISO_LOCAL_DATE);
+ LocalDate nextDay = endDate.plusDays(1);
+ LocalDate today = LocalDate.now(); // 鑾峰彇褰撳墠鏃ユ湡
+ if (nextDay.isBefore(today)) {
+ throw new RuntimeException("鎵ц鐘舵�佺粨鏉熸棩鏈熷繀椤诲ぇ浜庣瓑浜庡綋鍓嶆棩鏈�,璇蜂慨鏀圭粨鏉熸棩鏈�");
+ }
+ }
+ }*/
}
\ No newline at end of file
--
Gitblit v1.8.0