소스 검색

정산검수현황 API 구현

marseyes 2 년 전
부모
커밋
1b03d8042b

+ 4 - 0
src/main/java/com/oqpo/api/mapper/sttlmng/SttlReqMapper.java

@@ -55,4 +55,8 @@ public interface SttlReqMapper {
55 55
 
56 56
     int updateStlMgntBaseInfo4SttlReqProc(@Param("userId") String userId, StlMgntBaseInfoEntity entity) throws Exception;
57 57
 
58
+    int updateStlMgntBaseInfo4SttlConfirm(@Param("userId") String userId, StlMgntBaseInfoEntity entity) throws Exception;
59
+
60
+    int updateStlMgntBaseInfo4SttlReject(@Param("userId") String userId, StlMgntBaseInfoEntity entity) throws Exception;
61
+
58 62
 }

+ 62 - 0
src/main/java/com/oqpo/api/service/sttlmng/SttlInspectStateService.java

@@ -0,0 +1,62 @@
1
+package com.oqpo.api.service.sttlmng;
2
+
3
+
4
+import com.oqpo.api.entity.loanmng.LoanMgntBaseInfoEntity;
5
+import com.oqpo.api.entity.loanmng.LoanMgntDtlHstEntity;
6
+import com.oqpo.api.entity.oper.UserMngEntity;
7
+import com.oqpo.api.entity.rtnmng.RtnProcInfoPtclEntity;
8
+import com.oqpo.api.entity.settmng.StlMgntBaseInfoEntity;
9
+import com.oqpo.api.entity.settmng.StlMgntDtlPtclEntity;
10
+import com.oqpo.api.entity.stinfo.StoreBaseInfoEntity;
11
+import com.oqpo.api.entity.stockmng.WhsProcInfoPtclEntity;
12
+import com.oqpo.api.enums.*;
13
+import com.oqpo.api.mapper.loanmng.DsptMngMapper;
14
+import com.oqpo.api.mapper.oper.UserMngMapper;
15
+import com.oqpo.api.mapper.stinfo.StoreBaseInfoMapper;
16
+import com.oqpo.api.mapper.sttlmng.SttlReqMapper;
17
+import com.oqpo.api.service.CommonService;
18
+import com.oqpo.api.util.DateUtil;
19
+import com.oqpo.api.util.StringUtil;
20
+import com.oqpo.api.web.dto.request.GridRequest;
21
+import com.oqpo.api.web.dto.request.sttlmng.*;
22
+import com.oqpo.api.web.dto.response.GridResponse;
23
+import com.oqpo.api.web.dto.response.loanmng.StlDtlListResponse;
24
+import com.oqpo.api.web.dto.response.sttlmng.SttlMngInfoResponse;
25
+import com.oqpo.api.web.dto.response.sttlmng.SttlReqResponse;
26
+import lombok.extern.slf4j.Slf4j;
27
+import org.springframework.beans.factory.annotation.Autowired;
28
+import org.springframework.stereotype.Service;
29
+import org.springframework.transaction.annotation.Transactional;
30
+
31
+import java.util.List;
32
+import java.util.stream.Collectors;
33
+
34
+@Service
35
+@Slf4j
36
+public class SttlInspectStateService extends CommonService {
37
+
38
+    @Autowired
39
+    private SttlReqMapper sttlReqMapper;
40
+
41
+    /* 정산확정  */
42
+    @Transactional
43
+    public void confirmSttl(String userId, SttlConfirmRequest sttlConfirmRequest) throws Exception {
44
+        // 정산관리기본정보 - 정산상태코드 변경
45
+        StlMgntBaseInfoEntity infoEntity = new StlMgntBaseInfoEntity();
46
+        infoEntity.setSttlMgntUnqNo(sttlConfirmRequest.getSttlMgntUnqNo());
47
+        infoEntity.setSttlStCd(SttlStCd.STTL_CONFIRM.getCd());
48
+        sttlReqMapper.updateStlMgntBaseInfo4SttlConfirm(userId, infoEntity);
49
+    }
50
+
51
+    /* 정산반려  */
52
+    @Transactional
53
+    public void rejectSttl(String userId, SttlRejectRequest sttlRejectRequest) throws Exception {
54
+        // 정산관리기본정보 - 정산상태코드, 정산반려사유 변경
55
+        StlMgntBaseInfoEntity infoEntity = new StlMgntBaseInfoEntity();
56
+        infoEntity.setSttlMgntUnqNo(sttlRejectRequest.getSttlMgntUnqNo());
57
+        infoEntity.setSttlStCd(SttlStCd.STTL_REJECT.getCd());
58
+        infoEntity.setSttlRjctRsn(sttlRejectRequest.getSttlRjctRsn());
59
+        sttlReqMapper.updateStlMgntBaseInfo4SttlReject(userId, infoEntity);
60
+    }
61
+
62
+}

+ 64 - 0
src/main/java/com/oqpo/api/web/controller/sttlmng/SttlInspectStateController.java

@@ -0,0 +1,64 @@
1
+package com.oqpo.api.web.controller.sttlmng;
2
+
3
+import com.oqpo.api.enums.SystemMessageCode;
4
+import com.oqpo.api.service.sttlmng.SttlInspectStateService;
5
+import com.oqpo.api.web.dto.request.sttlmng.*;
6
+import com.oqpo.api.web.dto.response.SaveResponse;
7
+import io.swagger.annotations.Api;
8
+import io.swagger.annotations.ApiImplicitParam;
9
+import io.swagger.annotations.ApiImplicitParams;
10
+import io.swagger.annotations.ApiOperation;
11
+import lombok.extern.slf4j.Slf4j;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.http.ResponseEntity;
14
+import org.springframework.web.bind.annotation.*;
15
+import springfox.documentation.annotations.ApiIgnore;
16
+
17
+import javax.validation.Valid;
18
+
19
+@Slf4j
20
+@RestController
21
+@RequestMapping("/api/sttl/inspect/state")
22
+@Api(tags = {"정산검수현황 (SttlInspectStateController)"})
23
+public class SttlInspectStateController {
24
+
25
+    @Autowired
26
+    private SttlInspectStateService sttlInspectStateService;
27
+
28
+    /**
29
+     * 설명 : 정산확정
30
+     *
31
+     * @param userId
32
+     * @param sttlConfirmRequest
33
+     * @return SaveResponse
34
+     * @throws Exception
35
+     */
36
+    @ApiImplicitParams({
37
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header")
38
+    })
39
+    @ApiOperation(value = "정산확정")
40
+    @PostMapping("/sttl-confirm")
41
+    public ResponseEntity<SaveResponse> confirmSttl(@ApiIgnore String userId, @RequestBody @Valid SttlConfirmRequest sttlConfirmRequest) throws Exception {
42
+        sttlInspectStateService.confirmSttl(userId, sttlConfirmRequest);
43
+        return ResponseEntity.ok(SaveResponse.toDTO(SystemMessageCode.SAVE_OK));
44
+    }
45
+
46
+    /**
47
+     * 설명 : 정산반려
48
+     *
49
+     * @param userId
50
+     * @param sttlRejectRequest
51
+     * @return SaveResponse
52
+     * @throws Exception
53
+     */
54
+    @ApiImplicitParams({
55
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header")
56
+    })
57
+    @ApiOperation(value = "정산반려")
58
+    @PostMapping("/sttl-reject")
59
+    public ResponseEntity<SaveResponse> rejectSttl(@ApiIgnore String userId, @RequestBody @Valid SttlRejectRequest sttlRejectRequest) throws Exception {
60
+        sttlInspectStateService.rejectSttl(userId, sttlRejectRequest);
61
+        return ResponseEntity.ok(SaveResponse.toDTO(SystemMessageCode.SAVE_OK));
62
+    }
63
+
64
+}

+ 18 - 0
src/main/java/com/oqpo/api/web/dto/request/sttlmng/SttlConfirmRequest.java

@@ -0,0 +1,18 @@
1
+package com.oqpo.api.web.dto.request.sttlmng;
2
+
3
+import io.swagger.annotations.ApiModelProperty;
4
+import lombok.Getter;
5
+import lombok.NonNull;
6
+import lombok.Setter;
7
+
8
+import java.util.List;
9
+
10
+@Getter
11
+@Setter
12
+public class SttlConfirmRequest {
13
+
14
+    @ApiModelProperty(value = "정산관리고유번호")
15
+    @NonNull
16
+    private String sttlMgntUnqNo;
17
+
18
+}

+ 20 - 0
src/main/java/com/oqpo/api/web/dto/request/sttlmng/SttlRejectRequest.java

@@ -0,0 +1,20 @@
1
+package com.oqpo.api.web.dto.request.sttlmng;
2
+
3
+import io.swagger.annotations.ApiModelProperty;
4
+import lombok.Getter;
5
+import lombok.NonNull;
6
+import lombok.Setter;
7
+
8
+@Getter
9
+@Setter
10
+public class SttlRejectRequest {
11
+
12
+    @ApiModelProperty(value = "정산관리고유번호")
13
+    @NonNull
14
+    private String sttlMgntUnqNo;
15
+
16
+    @ApiModelProperty(value = "정산반려사유")
17
+    @NonNull
18
+    private String sttlRjctRsn;
19
+
20
+}

+ 19 - 0
src/main/resources/mybatis/sqlmaps/sttlmng/SttlReq.xml

@@ -386,4 +386,23 @@
386 386
         WHERE sttl_mgnt_unq_no = #{entity.sttlMgntUnqNo}
387 387
     </update>
388 388
 
389
+    <update id="updateStlMgntBaseInfo4SttlConfirm" >
390
+        /* SttlReqMapper.updateStlMgntBaseInfo4SttlConfirm */
391
+        UPDATE stl_mgnt_base_info SET
392
+        sttl_st_cd = #{entity.sttlStCd},
393
+        sys_chg_dttm = NOW(),
394
+        sys_chg_id = #{userId}
395
+        WHERE sttl_mgnt_unq_no = #{entity.sttlMgntUnqNo}
396
+    </update>
397
+
398
+    <update id="updateStlMgntBaseInfo4SttlReject" >
399
+        /* SttlReqMapper.updateStlMgntBaseInfo4SttlReject */
400
+        UPDATE stl_mgnt_base_info SET
401
+        sttl_st_cd = #{entity.sttlStCd},
402
+        sttl_rjct_rsn = #{entity.sttlRjctRsn},
403
+        sys_chg_dttm = NOW(),
404
+        sys_chg_id = #{userId}
405
+        WHERE sttl_mgnt_unq_no = #{entity.sttlMgntUnqNo}
406
+    </update>
407
+
389 408
 </mapper>