From 3948f4fc637d8439bc2a2e44c449e968b3c0fb15 Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期五, 26 一月 2024 08:58:21 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/general/GeneralCtrl.java |  189 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 189 insertions(+), 0 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/general/GeneralCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/general/GeneralCtrl.java
new file mode 100644
index 0000000..dabaf7f
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/general/GeneralCtrl.java
@@ -0,0 +1,189 @@
+package com.dy.pipIrrSell.general;
+
+import com.dy.common.aop.SsoAop;
+import com.dy.common.webUtil.BaseResponse;
+import com.dy.common.webUtil.BaseResponseUtils;
+import com.dy.common.webUtil.QueryResultVo;
+import com.dy.common.webUtil.ResultCodeMsg;
+import com.dy.pipIrrGlobal.pojoBa.BaClient;
+import com.dy.pipIrrGlobal.pojoSe.SeAudits;
+import com.dy.pipIrrGlobal.pojoSe.SeGeneral;
+import com.dy.pipIrrGlobal.voSe.VoGeneral;
+import com.dy.pipIrrSell.general.dto.DtoGeneral;
+import com.dy.pipIrrSell.general.qo.QoGeneral;
+import com.dy.pipIrrSell.general.qo.QoToAudit;
+import com.dy.pipIrrSell.result.SellResultCode;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.MediaType;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.*;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-01-24 19:01
+ * @LastEditTime 2024-01-24 19:01
+ * @Description
+ */
+
+@Slf4j
+@Tag(name = "鎬昏处绠$悊", description = "鎬昏处绠$悊")
+@RestController
+@RequestMapping(path="general")
+@RequiredArgsConstructor
+public class GeneralCtrl {
+    private final GeneralSv generalSv;
+
+    /**
+     * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鎬昏处璁板綍
+     * 鏌ヨ鍓嶅厛鐢熸垚鏈敓鎴愮殑鎬昏处璁板綍
+     * @param vo
+     * @return
+     */
+    @Operation(summary = "鑾峰彇鎬昏处璁板綍", description = "鑾峰彇鎬昏处璁板綍")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "杩斿洖涓�椤靛啘鎴锋暟鎹紙BaseResponse.content:QueryResultVo[{}]锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = BaClient.class))}
+            )
+    })
+    @GetMapping(path = "get_generals")
+    @SsoAop()
+    public BaseResponse<QueryResultVo<List<VoGeneral>>> getOperates(QoGeneral vo){
+        try {
+            add_general();
+            QueryResultVo<List<VoGeneral>> res = generalSv.getGenerals(vo);
+            return BaseResponseUtils.buildSuccess(res);
+        } catch (Exception e) {
+            log.error("鏌ヨ浜ゆ槗璁板綍寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage()) ;
+        }
+    }
+
+    /**
+     * 鐢熸垚鎬昏处
+     *      鑾峰彇鏈敓鎴愭�昏处鐨勪氦鏄撴棩鏈熷垪琛紙褰撳ぉ鐨勪氦鏄撹褰曚笉鐢熸垚鎬昏处锛�
+     *      灏嗘寚瀹氭棩鏈熺殑浜ゆ槗璁板綍姹囨�诲埌鎬昏处琛�
+     * @return
+     */
+    public void add_general(){
+        // 鑾峰彇鏈敓鎴愭�昏处鐨勪氦鏄撴棩鏈熷垪琛紙褰撳ぉ鐨勪氦鏄撹褰曚笉鐢熸垚鎬昏处锛�
+        List<Map<String, Object>> list_operateDate = Optional.ofNullable(generalSv.getDatesOfNotInGenerals()).orElse(new ArrayList<>());
+        if(list_operateDate.size() > 0) {
+            for(int i = 0; i < list_operateDate.size(); i++) {
+                String operateDate = list_operateDate.get(i).get("operateDate").toString();
+                // 鏍规嵁浜ゆ槗鏃ユ湡鑾峰彇鎬昏处璁板綍鍒楄〃锛堝緟鐢熸垚鐨勶級
+                List<SeGeneral> list_general = Optional.ofNullable(generalSv.getGeneralByOperateDate(operateDate)).orElse(new ArrayList<>());
+                if(list_general.size() > 0) {
+                    for(int j = 0; j < list_general.size(); j++) {
+                        SeGeneral general = list_general.get(j);
+                        generalSv.addGeneral(general);
+                    }
+                }
+
+            }
+        }
+    }
+
+    /**
+     * 瀹℃牳鎬昏处
+     *  1. 淇敼鎬昏处瀹℃牳鐘舵��
+     *  2. 娣诲姞鎬昏处瀹℃牳璁板綍
+     * @param po
+     * @param bindingResult
+     * @return
+     */
+    @Operation(summary = "瀹℃牳鎬昏处", description = "瀹℃牳鎬昏处")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = Boolean.class))}
+            )
+    })
+    @PostMapping(path = "audit", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @Transactional(rollbackFor = Exception.class)
+    @SsoAop()
+    public BaseResponse<Boolean> audit(@RequestBody @Valid DtoGeneral po, BindingResult bindingResult){
+        if(bindingResult != null && bindingResult.hasErrors()){
+            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+        }
+        Long generalId = po.getGeneralId();
+        Byte auditStatus = po.getAuditStatus();
+        String auditOpinion = po.getAuditOpinion();
+        Long operator = po.getOperator();
+        Date auditTime = new Date();
+
+        if(generalId == null) {
+            return BaseResponseUtils.buildFail(SellResultCode.GENERAL_ID_CANNOT_BE_NULL.getMessage());
+        }
+
+        /**
+         * 鍒ゆ柇鎬昏处鏄惁瀛樺湪
+         */
+        if(generalSv.getGeneralById(generalId) == null) {
+            return BaseResponseUtils.buildFail(SellResultCode.GENERAL_NOT_EXIST.getMessage());
+        }
+
+        /**
+         * 淇敼鎬昏处瀹℃牳鐘舵��
+         */
+        SeGeneral seGeneral = new SeGeneral();
+        seGeneral.setId(generalId);
+        seGeneral.setAuditStatus(auditStatus);
+        Integer rec_updateGeneral = Optional.ofNullable(generalSv.updateGeneral(seGeneral)).orElse(0);
+        if(rec_updateGeneral == 0) {
+            return BaseResponseUtils.buildFail(SellResultCode.GENERAL_AUDIT_FAIL.getMessage());
+        }
+
+        /**
+         * 娣诲姞鎬昏处瀹℃牳璁板綍
+         */
+        SeAudits seAudits = new SeAudits();
+        seAudits.setGeneralId(generalId);
+        seAudits.setAuditStatus(auditStatus);
+        seAudits.setAuditOpinion(auditOpinion);
+        seAudits.setOperator(operator);
+        seAudits.setOperateDt(auditTime);
+        Integer rec_addAucits = Optional.ofNullable(generalSv.addAudits(seAudits)).orElse(0);
+        if(rec_addAucits == 0) {
+            return BaseResponseUtils.buildFail(SellResultCode.AUDITS_ADD_FAIL.getMessage());
+        }
+
+        return BaseResponseUtils.buildSuccess() ;
+    }
+
+    @Operation(summary = "鑾峰緱寰呭鏍镐氦鏄撴眹鎬昏褰�", description = "杩斿洖寰呭鏍镐氦鏄撴眹鎬昏褰�")
+    @ApiResponses(value = {
+            @ApiResponse(
+                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+                    description = "杩斿洖涓�椤靛啘鎴锋暟鎹紙BaseResponse.content:QueryResultVo[{}]锛�",
+                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+                            schema = @Schema(implementation = BaClient.class))}
+            )
+    })
+    @GetMapping(path = "getToAudit")
+    @SsoAop()
+    public BaseResponse<Map> getToAudit(QoToAudit vo){
+        try {
+            Map res = generalSv.getToAudit(vo);
+            return BaseResponseUtils.buildSuccess(res);
+        } catch (Exception e) {
+            log.error("鏌ヨ浜ゆ槗姹囨�昏褰曞紓甯�", e);
+            return BaseResponseUtils.buildException(e.getMessage()) ;
+        }
+    }
+}

--
Gitblit v1.8.0