Browse Source

앰버전관리 테스트 전 소스 커밋

dwkim 2 years ago
parent
commit
3f3849b113

+ 1 - 0
src/main/java/com/oqpo/api/config/WebMvcConfig.java

@@ -42,6 +42,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
42 42
                         .excludePathPatterns("/api/pop/info-pop")
43 43
                         .excludePathPatterns("/api/member/find-id")
44 44
                         .excludePathPatterns("/api/member/find-pw")
45
+                        .excludePathPatterns("/api/verinfo/info-lastver")
45 46
                         .excludePathPatterns("/api/file/download/**");
46 47
             }
47 48
 

+ 27 - 0
src/main/java/com/oqpo/api/entity/system/VerInfoEntity.java

@@ -0,0 +1,27 @@
1
+package com.oqpo.api.entity.system;
2
+
3
+import lombok.Getter;
4
+import lombok.Setter;
5
+import lombok.ToString;
6
+
7
+import java.io.Serializable;
8
+
9
+@Getter
10
+@Setter
11
+@ToString
12
+public class VerInfoEntity implements Serializable {
13
+    private static final long serialVersionUID = -921350664624919620L;
14
+
15
+    private String appNo;
16
+    private String devTpCd;
17
+    private String devTpNm;
18
+    private String appVer;
19
+    private String desVer;
20
+    private String appVerDt;
21
+    private String delYn;
22
+    private String addDt;
23
+    private String addId;
24
+    private String chgDt;
25
+    private String chgId;
26
+
27
+}

+ 20 - 0
src/main/java/com/oqpo/api/mapper/system/VerInfoMapper.java

@@ -0,0 +1,20 @@
1
+package com.oqpo.api.mapper.system;
2
+
3
+import com.oqpo.api.entity.system.VerInfoEntity;
4
+import com.oqpo.api.web.dto.request.GridRequest;
5
+import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
9
+
10
+@Mapper
11
+public interface VerInfoMapper {
12
+
13
+    List<VerInfoEntity> selectVerAppGridList(GridRequest gridRequest) throws Exception;
14
+    int selectVerAppGridCnt() throws Exception;
15
+    int insertVerInfo(@Param("userId") String userId, VerInfoEntity entity) throws Exception;
16
+    int updateDelVerInfo(@Param("userId") String userId, @Param("appNo") String  appNo) throws Exception;
17
+    VerInfoEntity selectVerAppInfo( @Param("appNo") String  appNo) throws Exception;
18
+    String selectLastVerInfo() throws Exception;
19
+
20
+}

+ 101 - 0
src/main/java/com/oqpo/api/service/system/VerInfoService.java

@@ -0,0 +1,101 @@
1
+package com.oqpo.api.service.system;
2
+
3
+
4
+import com.oqpo.api.entity.system.VerInfoEntity;
5
+import com.oqpo.api.exception.GlobalException;
6
+import com.oqpo.api.mapper.system.VerInfoMapper;
7
+import com.oqpo.api.service.CommonService;
8
+import com.oqpo.api.web.dto.request.GridRequest;
9
+import com.oqpo.api.web.dto.request.VerInfo.SaveVerInfoRequest;
10
+import com.oqpo.api.web.dto.response.GridResponse;
11
+import com.oqpo.api.web.dto.response.ver.VerInfoResponse;
12
+import com.oqpo.api.web.dto.response.ver.VerInfoSearchResponse;
13
+import lombok.extern.slf4j.Slf4j;
14
+import org.springframework.beans.factory.annotation.Autowired;
15
+import org.springframework.stereotype.Service;
16
+import org.springframework.transaction.annotation.Transactional;
17
+
18
+import java.util.List;
19
+import java.util.stream.Collectors;
20
+
21
+@Service
22
+@Slf4j
23
+public class VerInfoService extends CommonService {
24
+    @Autowired
25
+    private VerInfoMapper verInfoMapper;
26
+
27
+    /*
28
+     버전 그리드 리스트 조회
29
+    */
30
+    public GridResponse appVerGridList(GridRequest gridRequest) throws Exception {
31
+        int gridPage = gridRequest.getGridPage();
32
+        int gridSize = gridRequest.getGridSize();
33
+        int gridRecords = verInfoMapper.selectVerAppGridCnt();
34
+        int gridTotal = fnCalculateGridTotal(gridSize, gridRecords);
35
+        List<VerInfoEntity> entities = verInfoMapper.selectVerAppGridList(gridRequest);
36
+        List<Object> gridRows = entities.stream()
37
+                .map(m -> VerInfoSearchResponse.builder()
38
+                        .viewCd("R")
39
+                        .appNo((m.getAppNo()))
40
+                        .appVer(m.getAppVer())
41
+                        .desVer(m.getDesVer())
42
+                        .appVerDt(m.getAppVerDt())
43
+                        .build())
44
+                .collect(Collectors.toList());
45
+        return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
46
+    }
47
+
48
+
49
+    /*
50
+      앱버전정보 - 저장
51
+     */
52
+    @Transactional
53
+    public void saveAppVer(String userId, SaveVerInfoRequest entity) throws Exception {
54
+        try {
55
+            VerInfoEntity vientity = new VerInfoEntity();
56
+            vientity.setAppVer(entity.getAppVer());
57
+            vientity.setDesVer(entity.getDesVer());
58
+            verInfoMapper.insertVerInfo(userId, vientity) ;
59
+        } catch (GlobalException e) {
60
+            e.getStackTrace();
61
+            throw new GlobalException(e.getSystemMessageCode());
62
+        } catch (Exception e) {
63
+            e.getStackTrace();
64
+            throw new RuntimeException();
65
+        }
66
+    }
67
+
68
+    /*
69
+      앱버전정보 - 삭제
70
+     */
71
+    @Transactional
72
+    public void delAppVer(String userId, String appNo) throws Exception {
73
+        try {
74
+            verInfoMapper.updateDelVerInfo(userId, appNo) ;
75
+        } catch (GlobalException e) {
76
+            e.getStackTrace();
77
+            throw new GlobalException(e.getSystemMessageCode());
78
+        } catch (Exception e) {
79
+            e.getStackTrace();
80
+            throw new RuntimeException();
81
+        }
82
+    }
83
+
84
+    /*
85
+    버전 최신버전값 전송
86
+    */
87
+    public VerInfoResponse selectLastVerInfo( ) throws Exception {
88
+        String appNo = verInfoMapper.selectLastVerInfo();
89
+        VerInfoEntity entity = verInfoMapper.selectVerAppInfo(appNo);
90
+        return VerInfoResponse.toDTO(entity );
91
+    }
92
+
93
+    /* 버전 정보*/
94
+    public VerInfoResponse selectVerAppInfo(String appNo) throws Exception {
95
+
96
+        VerInfoEntity entity = verInfoMapper.selectVerAppInfo(appNo);
97
+        return VerInfoResponse.toDTO(entity );
98
+    }
99
+
100
+
101
+}

+ 122 - 0
src/main/java/com/oqpo/api/web/controller/system/VerInfoController.java

@@ -0,0 +1,122 @@
1
+package com.oqpo.api.web.controller.system;
2
+
3
+import com.oqpo.api.enums.DataMessageCode;
4
+import com.oqpo.api.enums.SystemMessageCode;
5
+import com.oqpo.api.mapper.system.VerInfoMapper;
6
+import com.oqpo.api.service.system.JobService;
7
+import com.oqpo.api.service.system.VerInfoService;
8
+import com.oqpo.api.web.dto.request.VerInfo.SaveVerInfoRequest;
9
+import com.oqpo.api.web.dto.request.VerInfo.VerInfoGridRequest;
10
+import com.oqpo.api.web.dto.request.code.SaveCodeRequest;
11
+import com.oqpo.api.web.dto.request.job.JobGridRequest;
12
+import com.oqpo.api.web.dto.response.DataResponse;
13
+import com.oqpo.api.web.dto.response.GridResponse;
14
+import com.oqpo.api.web.dto.response.SaveResponse;
15
+import com.oqpo.api.web.dto.response.stinfo.store.StoreInfoResponse;
16
+import com.oqpo.api.web.dto.response.ver.VerInfoResponse;
17
+import io.swagger.annotations.ApiImplicitParam;
18
+import io.swagger.annotations.ApiImplicitParams;
19
+import io.swagger.annotations.ApiOperation;
20
+import lombok.extern.slf4j.Slf4j;
21
+import org.springframework.beans.factory.annotation.Autowired;
22
+import org.springframework.http.ResponseEntity;
23
+import org.springframework.web.bind.annotation.*;
24
+import springfox.documentation.annotations.ApiIgnore;
25
+
26
+import javax.validation.Valid;
27
+
28
+@Slf4j
29
+@RestController
30
+@RequestMapping("/api/verinfo")
31
+public class VerInfoController {
32
+    @Autowired
33
+    private VerInfoService verInfoService;
34
+
35
+    /**
36
+     * 설명 : 앱버전 상세 그리드 리스트
37
+     *
38
+     * @param verInfoGridRequest
39
+     * @return
40
+     * @throws Exception
41
+     */
42
+    @ApiImplicitParams({
43
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header")
44
+    })
45
+    @ApiOperation(value = "앱버전 그리드 리스트")
46
+    @PostMapping("/detail-grid-list")
47
+    public ResponseEntity<GridResponse> appVerGridList(@RequestBody @Valid VerInfoGridRequest verInfoGridRequest) throws Exception {
48
+        return ResponseEntity.ok(verInfoService.appVerGridList( verInfoGridRequest.toDTO(verInfoGridRequest)));
49
+    }
50
+
51
+
52
+    /**
53
+     * 설명 : 앱버전정보 저장
54
+     *
55
+     * @param userId
56
+     * @param saveVerInfoRequest
57
+     * @return SaveResponse
58
+     * @throws Exception
59
+     */
60
+    @ApiImplicitParams({
61
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header")
62
+    })
63
+    @ApiOperation(value = "앱버전정보 저장")
64
+    @PostMapping("/save-verinfo")
65
+    public ResponseEntity<SaveResponse> saveVerInfo(@ApiIgnore String userId, @RequestBody @Valid SaveVerInfoRequest saveVerInfoRequest) throws Exception {
66
+        verInfoService.saveAppVer(userId, saveVerInfoRequest);
67
+        return ResponseEntity.ok(SaveResponse.toDTO(SystemMessageCode.SAVE_OK));
68
+    }
69
+
70
+
71
+    /**
72
+     * 설명 : 앱버전  정보
73
+     *
74
+     * @param appNo
75
+     * @return
76
+     * @throws Exception
77
+     */
78
+    @ApiImplicitParams({
79
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header"),
80
+            @ApiImplicitParam(name = "appNo", value = "앱버전번호", required = true, dataType = "String", paramType = "query")
81
+    })
82
+    @ApiOperation(value = "앱버전 정보")
83
+    @GetMapping("/info-verinfo")
84
+    public ResponseEntity<VerInfoResponse> infoVerInfo(@RequestParam(value = "appNo") String appNo) throws Exception {
85
+        return ResponseEntity.ok(verInfoService.selectVerAppInfo(appNo));
86
+    }
87
+
88
+
89
+    /**
90
+     * 설명 : 앱버전정보 삭제
91
+     *
92
+     * @param userId
93
+     * @param appNo
94
+     * @return SaveResponse
95
+     * @throws Exception
96
+     */
97
+    @ApiImplicitParams({
98
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header"),
99
+            @ApiImplicitParam(name = "appNo", value = "앱버전번호", required = true, dataType = "String", paramType = "query")
100
+    })
101
+    @ApiOperation(value = "앱버전정보 삭제")
102
+    @PostMapping("/del-verinfo")
103
+    public ResponseEntity<SaveResponse> delVerInfo(@ApiIgnore String userId,@RequestParam(value = "appNo") String appNo ) throws Exception {
104
+        verInfoService.delAppVer(userId, appNo);
105
+        return ResponseEntity.ok(SaveResponse.toDTO(SystemMessageCode.DELETE_OK));
106
+    }
107
+
108
+    /**
109
+     * 설명 : 앱 최신버전정보
110
+     *
111
+     * @param
112
+     * @return
113
+     * @throws Exception
114
+     */
115
+    @ApiOperation(value = "앱 최신버전정보")
116
+    @GetMapping("/info-lastver")
117
+    public ResponseEntity<VerInfoResponse> selectLastVer() throws Exception {
118
+        return ResponseEntity.ok(verInfoService.selectLastVerInfo());
119
+    }
120
+
121
+
122
+}

+ 23 - 0
src/main/java/com/oqpo/api/web/dto/request/VerInfo/SaveVerInfoRequest.java

@@ -0,0 +1,23 @@
1
+package com.oqpo.api.web.dto.request.VerInfo;
2
+
3
+import com.oqpo.api.entity.oper.AfflSaleInfoEntity;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.*;
6
+
7
+import javax.validation.constraints.NotBlank;
8
+import java.util.ArrayList;
9
+import java.util.List;
10
+
11
+@Getter
12
+@Setter
13
+public class SaveVerInfoRequest {
14
+    @NotBlank
15
+    @ApiModelProperty(value = "C")
16
+    private String viewCd;
17
+
18
+    @ApiModelProperty(value = "APP버전")
19
+    private String appVer;
20
+
21
+    @ApiModelProperty(value = "버전설명")
22
+    private String desVer;
23
+}

+ 16 - 0
src/main/java/com/oqpo/api/web/dto/request/VerInfo/VerInfoGridRequest.java

@@ -0,0 +1,16 @@
1
+package com.oqpo.api.web.dto.request.VerInfo;
2
+
3
+import com.oqpo.api.web.dto.request.GridRequest;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Getter;
6
+import lombok.Setter;
7
+
8
+
9
+@Getter
10
+@Setter
11
+public class VerInfoGridRequest extends GridRequest {
12
+
13
+    protected VerInfoGridRequest(Integer gridSize, Integer gridPage, String sidx, String sord, Boolean pagingYn, Integer gridFirst) {
14
+        super(gridSize, gridPage, sidx, sord, pagingYn, gridFirst);
15
+    }
16
+}

+ 0 - 1
src/main/java/com/oqpo/api/web/dto/request/oper/ntice/SaveNticeRequest.java

@@ -38,7 +38,6 @@ public class SaveNticeRequest {
38 38
     @ApiModelProperty(value = "공지내용")
39 39
     private String nticeDesc;
40 40
 
41
-    @NotBlank
42 41
     @ApiModelProperty(value = "삭제여부")
43 42
     private String delYn;
44 43
 

+ 44 - 0
src/main/java/com/oqpo/api/web/dto/response/ver/VerInfoResponse.java

@@ -0,0 +1,44 @@
1
+package com.oqpo.api.web.dto.response.ver;
2
+
3
+import com.fasterxml.jackson.annotation.JsonInclude;
4
+import com.oqpo.api.entity.oper.AfflEntity;
5
+import com.oqpo.api.entity.oper.AfflSaleInfoEntity;
6
+import com.oqpo.api.entity.oper.FileEntity;
7
+import com.oqpo.api.entity.system.VerInfoEntity;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.*;
10
+
11
+import java.util.List;
12
+import java.util.stream.Collectors;
13
+
14
+@Getter
15
+@Setter
16
+@Builder
17
+@AllArgsConstructor(access = AccessLevel.PROTECTED)
18
+@JsonInclude(JsonInclude.Include.ALWAYS)
19
+public class VerInfoResponse {
20
+
21
+    @ApiModelProperty(value = "앱버전번호")
22
+    private String appNo;
23
+
24
+    @ApiModelProperty(value = "APP버전")
25
+    private String appVer;
26
+
27
+    @ApiModelProperty(value = "버전설명")
28
+    private String desVer;
29
+
30
+    @ApiModelProperty(value = "버전생성일")
31
+    private String appVerDt;
32
+
33
+    public static VerInfoResponse toDTO(VerInfoEntity entity) {
34
+        if (entity == null) return null;
35
+        return VerInfoResponse.builder()
36
+                .appNo(entity.getAppNo())
37
+                .appVer(entity.getAppVer())
38
+                .desVer(entity.getDesVer())
39
+                .appVerDt(entity.getAppVerDt())
40
+                .build();
41
+    }
42
+
43
+
44
+}

+ 28 - 0
src/main/java/com/oqpo/api/web/dto/response/ver/VerInfoSearchResponse.java

@@ -0,0 +1,28 @@
1
+package com.oqpo.api.web.dto.response.ver;
2
+
3
+import com.fasterxml.jackson.annotation.JsonInclude;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.*;
6
+
7
+@Getter
8
+@Setter
9
+@Builder
10
+@AllArgsConstructor(access = AccessLevel.PROTECTED)
11
+@JsonInclude(JsonInclude.Include.ALWAYS)
12
+public class VerInfoSearchResponse {
13
+    @ApiModelProperty(value = "CRUD")
14
+    private String viewCd;
15
+
16
+    @ApiModelProperty(value = "앱버전번호")
17
+    private String appNo;
18
+
19
+    @ApiModelProperty(value = "APP버전")
20
+    private String appVer;
21
+
22
+    @ApiModelProperty(value = "버전설명")
23
+    private String desVer;
24
+
25
+    @ApiModelProperty(value = "버전생성일")
26
+    private String appVerDt;
27
+
28
+}

+ 67 - 0
src/main/resources/mybatis/sqlmaps/system/VerInfo.xml

@@ -0,0 +1,67 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+
4
+<mapper namespace="com.oqpo.api.mapper.system.VerInfoMapper">
5
+
6
+    <select id="selectVerAppGridList" resultType="com.oqpo.api.entity.system.VerInfoEntity">
7
+        SELECT /* selectVerAppGridList */
8
+                app_no, devi_tp_cd, fn_code_nm('DEVI_TP_CD', devi_tp_cd) as devi_tp_nm, app_ver, des_ver, date_format(app_ver_dt,'%Y.%m.%d %H:%i:%s') AS app_ver_dt
9
+                , del_yn, date_format(add_dt,'%Y.%m.%d %H:%i:%s') AS  add_dt, add_id
10
+        FROM np_ver_info
11
+        WHERE del_yn = 'N'
12
+        <choose>
13
+            <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
14
+                <if test="gridRequest.sidx == 'job_no'.toString()">
15
+                    <if test="gridRequest.sord == 'asc'.toString()">
16
+                        order by app_no asc
17
+                    </if>
18
+                    <if test="gridRequest.sord == 'desc'.toString()">
19
+                        order by app_no desc
20
+                    </if>
21
+                </if>
22
+            </when>
23
+            <otherwise>
24
+                order by app_no desc
25
+            </otherwise>
26
+        </choose>
27
+        <if test="gridRequest.pagingYn == true">
28
+            limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
29
+        </if>
30
+    </select>
31
+
32
+    <select id="selectVerAppGridCnt" resultType="int">
33
+        select count(*)
34
+        FROM np_ver_info
35
+        WHERE del_yn = 'N'
36
+    </select>
37
+
38
+
39
+    <insert id="insertVerInfo" >
40
+        insert into np_ver_info
41
+        (app_no, devi_tp_cd, app_ver, des_ver, app_ver_dt, del_yn, add_dt, add_id, chg_dt, chg_id)
42
+        values
43
+        (fn_get_key_no(35), 'SA', #{entity.appVer}, #{entity.desVer}, now(), 'N', now(), #{userId}, now(), #{userId})
44
+    </insert>
45
+
46
+    <update id="updateDelVerInfo" >
47
+        UPDATE np_ver_info SET
48
+                del_yn = 'Y',
49
+                chg_dt = now(),
50
+                chg_id = #{userId}
51
+         WHERE app_no = #{appNo}
52
+    </update>
53
+
54
+    <select id="selectLastVerInfo" resultType="String">
55
+        SELECT /* selectLastVerInfo */
56
+                nvl(max(app_no),'0.0.0') as app_no
57
+        FROM np_ver_info
58
+        WHERE del_yn = 'N'
59
+    </select>
60
+
61
+    <select id="selectVerAppInfo" resultType="com.oqpo.api.entity.system.VerInfoEntity">
62
+        SELECT /* selectVerAppInfo */
63
+                app_no, app_ver, des_ver
64
+        FROM np_ver_info
65
+        WHERE app_no = #{appNo}
66
+    </select>
67
+</mapper>