fix: 거주자/장애인 심의대상 상세 목록 fix

dev
minuk926 3 years ago
parent ed2d00964e
commit 9b4ec3377b

@ -131,10 +131,10 @@ public class ResidentAndDisabledController {
@Operation(summary = "거주자/장애인 의견진술 심의등록 상세 목록" , description = "거주자/장애인 의견진술 심의등록 상세 목록")
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "msDatagb", description = "데이타구분(1-거주자, 2-장애인)", required = true, example = "1"),
@Parameter(in = ParameterIn.QUERY, name = "msSdate", description = "심사시작일", required = true, example = "2021-01-04"),
@Parameter(in = ParameterIn.QUERY, name = "msEdate", description = "심사종료일", required = true, example = "2021-01-05"),
@Parameter(in = ParameterIn.QUERY, name = "msChasu", description = "차수", required = false, example = "3"),
@Parameter(in = ParameterIn.QUERY, name = "msuTeam", description = "팀코드", required = true, example = "002")
@Parameter(in = ParameterIn.QUERY, name = "msSdate", description = "심사시작일", required = true, example = "2021-09-10"),
@Parameter(in = ParameterIn.QUERY, name = "msEdate", description = "심사종료일", required = true, example = "2021-09-11"),
@Parameter(in = ParameterIn.QUERY, name = "msChasu", description = "차수", required = true, example = "12"),
@Parameter(in = ParameterIn.QUERY, name = "msuTeam", description = "팀코드", required = false, example = "003")
})
@GetMapping(value="/detail", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findJudgeDetails(

@ -0,0 +1,68 @@
package com.xit.biz.ctgy.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDate;
@Schema(name = "JudgeDetailDto", description = "심사등록상세")
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class JudgeDetailDto {
@Schema(required = true, title = "민원코드", example = " ", description = "민원코드")
private Long msMaincode;
@Schema(required = true, title = "접수번호", example = " ", description = "Input Description...")
private String msSeq;
@Schema(required = true, title = "차량번호", example = " ", description = "Input Description...")
private String msCarnum;
@Schema(required = true, title = "년도", example = " ", description = "Input Description...")
private String msYear;
@Schema(required = true, title = "차수", example = " ", description = "Input Description...")
private Long msChasu;
@Schema(required = true, title = "심사시작일", example = " ", description = "Input Description...")
@JsonFormat(pattern="yyyy-MM-dd")
private LocalDate msSdate;
@Schema(required = true, title = "심사시작시간", example = " ", description = "Input Description...")
private String msStartsi;
@Schema(required = true, title = "심사종료일", example = " ", description = "Input Description...")
@JsonFormat(pattern="yyyy-MM-dd")
private LocalDate msEdate;
@Schema(required = true, title = "심사마감일", example = " ", description = "Input Description...")
@JsonFormat(pattern="yyyy-MM-dd")
private LocalDate msCdate;
@Schema(required = true, title = "심사마감시간", example = " ", description = "Input Description...")
private String msClosesi;
@Schema(required = false, title = "단속일자", example = " ", description = "Input Description...")
@JsonFormat(pattern="yyyy-MM-dd")
private LocalDate msWdate;
@Schema(required = false, title = "단속장소", example = " ", description = "Input Description...")
private String msPos;
@Schema(required = false, title = "결과코드", example = " ", description = "Input Description...")
private String msResult;
@Schema(required = false, title = "단속시간", example = " ", description = "Input Description...")
private String msJbtime;
@Schema(title = "데이타구분", example = "1", description = "데이타구분: 1-거주자,2-장애인")
private String msDatagb;
}

@ -1,11 +1,45 @@
package com.xit.biz.ctgy.mapper;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.JudgeTargetDto;
import com.xit.core.support.CamelCaseMap;
import org.apache.commons.collections4.map.LinkedMap;
import org.apache.ibatis.annotations.Mapper;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Mapper
public interface IResidentAndDisabledMapper {
void insertJudgeTargetIntoSelect(JudgeTargetDto dto);
/**
* && total
* @param dto JudgeListDto
* @return Map
*/
Map<String,Object> selectTotByJudgeTeamAndChasu(JudgeListDto dto);
/**
* &&
* @param dto JudgeListDto
* @return List<Map>
*/
List<Map<String,Object>> selectTotJudgeUsersByJudgeTeamAndChasu(JudgeListDto dto);
/**
*
* @param dto JudgeListDto
* @return List<Map>
*/
List<Map<String,Object>> selectJudgeTargetByCarnum(JudgeListDto dto);
/**
*
* @param map Map
* @return List<Map>
*/
List<Map<String,Object>> selectJudgeResultByCarnum(Map<String,Object> map);
}

@ -1,9 +1,9 @@
package com.xit.biz.ctgy.repository;
import com.xit.biz.ctgy.dto.GnRecallScDto;
import com.xit.biz.ctgy.dto.JudgeDetailDto;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.JudgeTargetDto;
import com.xit.biz.ctgy.entity.MinSimsa680;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@ -44,7 +44,7 @@ public interface IResidentAndDisabledRepositoryCustom {
* @param dto JudgeListDto
* @return List<MinSimsa680>
*/
List<MinSimsa680> findJudgeDetails(final JudgeListDto dto);
List<JudgeDetailDto> findJudgeDetails(final JudgeListDto dto);
/**
* /

@ -9,9 +9,11 @@ import com.querydsl.jpa.JPAExpressions;
import com.querydsl.jpa.impl.JPAQueryFactory;
import com.xit.biz.ctgy.CtgyConstants;
import com.xit.biz.ctgy.dto.GnRecallScDto;
import com.xit.biz.ctgy.dto.JudgeDetailDto;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.JudgeTargetDto;
import com.xit.biz.ctgy.entity.MinSimsa680;
import com.xit.biz.ctgy.entity.MinSimsa680Sc;
import com.xit.core.util.Checks;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
@ -27,6 +29,7 @@ import static com.xit.biz.ctgy.entity.QGnRecallSc.gnRecallSc;
import static com.xit.biz.ctgy.entity.QMinSimsa680.minSimsa680;
import static com.xit.biz.ctgy.entity.QMinSimsa680Sc.minSimsa680Sc;
import static com.xit.biz.ctgy.entity.QMinSimsaUser680.minSimsaUser680;
import static com.xit.biz.ctgy.entity.QMinSimsaUser680Sc.minSimsaUser680Sc;
import static com.xit.biz.ctgy.entity.QMinUserinfo.minUserinfo;
/**
@ -208,32 +211,32 @@ public class IResidentAndDisabledRepositoryImpl implements IResidentAndDisabledR
}
@Override
public List<MinSimsa680> findJudgeDetails(final JudgeListDto dto) {
public List<JudgeDetailDto> findJudgeDetails(final JudgeListDto dto) {
BooleanBuilder builder = new BooleanBuilder();
builder.and(minSimsa680.msSdate.gt(dto.getMsSdate()).or(minSimsa680.msSdate.eq(dto.getMsSdate())));
builder.and(minSimsa680.msEdate.lt(dto.getMsEdate()).or(minSimsa680.msEdate.eq(dto.getMsEdate())));
builder.and(minSimsa680Sc.msSdate.gt(dto.getMsSdate()).or(minSimsa680Sc.msSdate.eq(dto.getMsSdate())));
builder.and(minSimsa680Sc.msEdate.lt(dto.getMsEdate()).or(minSimsa680Sc.msEdate.eq(dto.getMsEdate())));
if (!Checks.isEmpty(dto.getMsuTeam())) {
builder.and(minSimsaUser680.msuTeam.eq(dto.getMsuTeam()));
builder.and(minSimsaUser680Sc.msuTeam.eq(dto.getMsuTeam()));
}
List<MinSimsa680> rslt =
List<JudgeDetailDto> rslt =
queryFactory
.select(Projections.fields(MinSimsa680.class,
minSimsa680.msSeq,
minSimsa680.msCarnum,
minSimsa680.msMaincode))
.from(minSimsaUser680)
.join(minSimsa680)
.on(minSimsa680.msMaincode.eq(minSimsaUser680.msuMaincode))
.select(Projections.fields(JudgeDetailDto.class,
minSimsa680Sc.msSeq,
minSimsa680Sc.msCarnum,
minSimsa680Sc.msMaincode))
.from(minSimsaUser680Sc)
.join(minSimsa680Sc)
.on(minSimsa680Sc.msMaincode.eq(minSimsaUser680Sc.msuMaincode))
.join(minUserinfo)
.on(minSimsaUser680.msuUserid.eq(minUserinfo.userid))
.on(minSimsaUser680Sc.msuUserid.eq(minUserinfo.userid))
.where(builder)
.groupBy(minSimsa680.msCarnum,
minSimsa680.msSeq,
minSimsa680.msMaincode)
.orderBy(minSimsa680.msSeq.asc())
.groupBy(minSimsa680Sc.msCarnum,
minSimsa680Sc.msSeq,
minSimsa680Sc.msMaincode)
.orderBy(minSimsa680Sc.msSeq.asc())
.fetch();
return rslt;

@ -1,6 +1,7 @@
package com.xit.biz.ctgy.service;
import com.xit.biz.ctgy.dto.GnRecallScDto;
import com.xit.biz.ctgy.dto.JudgeDetailDto;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.JudgeTargetDto;
import com.xit.biz.ctgy.entity.MinSimsa680;
@ -10,6 +11,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;
/**
* /
@ -54,9 +56,9 @@ public interface IResidentAndDisabledService {
/**
* /
* @param dto JudgeListDto
* @return List<MinSimsa680>
* @return Map
*/
List<MinSimsa680> findJudgeDetails(final JudgeListDto dto);
Map<String,Object> findJudgeDetails(final JudgeListDto dto);
/**
* /

@ -15,6 +15,7 @@ import com.xit.biz.ctgy.service.IResidentAndDisabledService;
import com.xit.core.constant.ErrorCode;
import com.xit.core.exception.CustomBaseException;
import com.xit.core.support.jpa.JpaUtil;
import com.xit.core.util.Checks;
import com.xit.core.util.DateUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -33,7 +34,9 @@ import javax.validation.constraints.NotNull;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
@ -175,7 +178,34 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
}
@Override
public List<MinSimsa680> findJudgeDetails(JudgeListDto dto) {
return repository.findJudgeDetails(dto);
public Map<String,Object> findJudgeDetails(JudgeListDto dto) {
Map<String, Object> resultMap = new HashMap<>();
// team && 팀별 부과현황 조회
Map<String, Object> teamMap = mapper.selectTotByJudgeTeamAndChasu(dto);
if(Checks.isEmpty(teamMap)) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND);
dto.setMsuTeam(String.valueOf(teamMap.get("msuTeam")));
List<Map<String, Object>> totJudgeUserList = mapper.selectTotJudgeUsersByJudgeTeamAndChasu(dto);
totJudgeUserList.add(teamMap);
List<Map<String,Object>> judgeCarList = mapper.selectJudgeTargetByCarnum(dto);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("msDatagb", dto.getMsDatagb());
paramMap.put("msChasu", dto.getMsChasu());
paramMap.put("msSdate", dto.getMsSdate());
paramMap.put("msEdate", dto.getMsEdate());
paramMap.put("msuTeam", dto.getMsuTeam());
List<Map<String,Object>> resultList = judgeCarList.stream().peek((m) -> {
paramMap.put("msSeq", m.get("msSeq"));
paramMap.put("msCarnum", m.get("msCarnum"));
m.put("simsa", mapper.selectJudgeResultByCarnum(paramMap));
}).collect(Collectors.toList());
resultMap.put("totUserList", totJudgeUserList);
resultMap.put("resultList", resultList);
return resultMap;
}
}

@ -5,6 +5,7 @@ import org.springframework.jdbc.support.JdbcUtils;
import java.util.LinkedHashMap;
import java.util.Map;
@SuppressWarnings("rawtypes")
public class CamelCaseLinkedMap extends LinkedHashMap {
@Override

@ -4,7 +4,8 @@ import org.springframework.jdbc.support.JdbcUtils;
import java.util.HashMap;
public class CamelCaseMap extends HashMap {
@SuppressWarnings("ALL")
public class CamelCaseMap<K, V> extends HashMap {
@Override
public Object put(Object key, Object value){

@ -22,44 +22,53 @@ WHERE USERID = MSU_USERID
AND MS_DATAGB = '1'
AND MSU_TEAM = '003'
AND MS_CHASU = 12
AND MS_SDATE = '2021-09-10'
AND MS_EDATE = '2021-09-11'
AND MS_SDATE >= '2021-09-10'
AND MS_EDATE <= '2021-09-11'
GROUP BY USERID, NAME
ORDER BY USERID, NAME;
SELECT MS_SEQ, MS_CARNUM, MS_MAINCODE
FROM MIN_USERINFO,
FROM -- MIN_USERINFO,
MIN_SIMSA_USER680_SC,
MIN_SIMSA680_SC
WHERE USERID = MSU_USERID
AND MS_MAINCODE = MSU_MAINCODE
WHERE MS_MAINCODE = MSU_MAINCODE
AND MS_DATAGB = '1'
AND MSU_TEAM = '003'
AND MS_CHASU = 12
AND MS_SDATE = '2021-09-10'
AND MS_EDATE = '2021-09-11'
AND MS_SDATE >= '2021-09-10'
AND MS_EDATE <= '2021-09-11'
GROUP BY MS_CARNUM, MS_SEQ, MS_MAINCODE
ORDER BY MS_SEQ;
-- 부과여부
SELECT MSU_MAINCODE,
USERID,
NAME,
(SELECT CDNAME FROM MIN_MAINCODE WHERE C2 = '5' AND C3 = MSU_RESULT) MSURESULT,
(SELECT CDNAME FROM MIN_MAINCODE WHERE C2 = '5' AND C3 = MS_RESULT) MSRESULT
FROM MIN_USERINFO,
MIN_SIMSA_USER680_SC,
MIN_SIMSA680_SC
WHERE USERID = MSU_USERID
AND MS_MAINCODE = MSU_MAINCODE
AND MS_DATAGB = '1'
AND MSU_TEAM = '003'
--AND MS_SEQ =
--AND MS_CARNUM =
AND MS_CHASU = 12
AND MS_SDATE = '2021-09-10'
AND MS_EDATE = '2021-09-11'
ORDER BY USERID, NAME;
-- 심사자별 부과여부
SELECT MSS.MS_MAINCODE,
MSU.MSU_USERID,
MU.NAME,
(SELECT CDNAME FROM MIN_MAINCODE WHERE C2 = '5' AND C3 = MSU.MSU_RESULT) MSURESULT,
(SELECT CDNAME FROM MIN_MAINCODE WHERE C2 = '5' AND C3 = MSS.MS_RESULT) MSRESULT
FROM MIN_SIMSA680_SC MSS,
MIN_SIMSA_USER680_SC MSU,
MIN_USERINFO MU,
(
SELECT CODE_CD, CODE_NM
FROM TB_CMM_CODE_S
WHERE CODE_GRP_ID = 'TRAFFIC'
AND CODE_LCD = 'GANGNAM_SIMSA'
AND CODE_MCD = 'RESULT'
) CC
WHERE MSS.MS_MAINCODE = MSU.MSU_MAINCODE
AND MSU.MSU_USERID = MU.USERID
AND MSS.MS_DATAGB = '1'
AND MSS.MS_CHASU = 12
AND MSS.MS_SDATE >= '2021-09-10'
AND MSS.MS_EDATE <= '2021-09-11'
AND MSU.MSU_TEAM = '003'
AND MS_SEQ = 2021000018
AND MS_CARNUM = '85조4947'
AND MS_MAINCODE = 3856
AND MSS.MS_RESULT = CC.CODE_CD
AND MSU.MSU_RESULT = CC.CODE_CD
ORDER BY MU.USERID, MU.NAME;
-- excel
SELECT MS_SEQ, DECODE(MSU_RESULT, '2', 'O', '') BU, DECODE(MSU_RESULT, '1', 'O', '') MIBU, MSU_REASON

@ -38,6 +38,94 @@
sc_datagb
from gn_recall_sc
where sc_code = #{scCode}
</insert>
<select id="selectTotByJudgeTeamAndChasu" parameterType="com.xit.biz.ctgy.dto.JudgeListDto" resultType="camelCaseMap">
/* residentanddisabled-mapper|selectTotByJudgeTeamAndChasu|julim */
SELECT MSV.msu_team
, '결과' as name
, NVL(SUM(DECODE(MSS.ms_result, '2', 1, 0)), 0) bu
, NVL(SUM(DECODE(MSS.ms_result, '1', 1, 0)), 0) mibu
, NVL(SUM(DECODE(MSS.ms_result, '1', 1, '2', 1, 0)), 0) tot
FROM min_simsa680_sc MSS,
msu680_sc_view MSV
WHERE MSS.ms_maincode = MSV.msu_maincode
<if test='msuTeam != null and msuTeam != ""'>
AND MSV.msu_team = #{msuTeam}
</if>
AND MSS.ms_datagb = #{msDatagb}
AND MSS.ms_chasu = #{msChasu}
AND MSS.ms_sdate &gt;= #{msSdate}
AND MSS.ms_edate &lt;= #{msEdate}
GROUP BY MSV.msu_team, MSS.ms_chasu
</select>
<select id="selectTotJudgeUsersByJudgeTeamAndChasu" parameterType="com.xit.biz.ctgy.dto.JudgeListDto" resultType="camelCaseMap">
/* residentanddisabled-mapper|selectTotJudgeUsersByJudgeTeamAndChasu|julim */
SELECT MSU.msu_userid
, MU.name
, SUM(DECODE(MSU_RESULT, '2', 1, 0)) bu
, SUM(DECODE(MSU_RESULT, '1', 1, 0)) mibu
, SUM(DECODE(MSU_RESULT, '1', 1, '2', 1, 0)) tot
FROM min_simsa680_sc MSS,
min_simsa_user680_sc MSU,
min_userinfo MU
WHERE MSS.ms_maincode = MSU.msu_maincode
AND MSS.ms_datagb = #{msDatagb}
AND MSS.ms_chasu = #{msChasu}
AND MSS.ms_sdate &gt;= #{msSdate}
AND MSS.ms_edate &lt;= #{msEdate}
AND MSU.msu_team = #{msuTeam}
AND MSU.msu_userid = MU.userid
GROUP BY MSU.msu_userid, MU.name
</select>
<select id="selectJudgeTargetByCarnum" parameterType="com.xit.biz.ctgy.dto.JudgeListDto" resultType="camelCaseLinkedMap">
/* residentanddisabled-mapper|selectJudgeTargetByCarnum|julim */
SELECT MSS.ms_maincode
, MSS.ms_seq
, MSS.ms_carnum
FROM min_simsa680_sc MSS,
min_simsa_user680_sc MSU
WHERE MSS.ms_maincode = MSU.msu_maincode
AND MSS.ms_datagb = #{msDatagb}
AND MSS.ms_chasu = #{msChasu}
AND MSS.ms_sdate &gt;= #{msSdate}
AND MSS.ms_edate &lt;= #{msEdate}
AND MSU.msu_team = #{msuTeam}
GROUP BY MSS.ms_maincode, MSS.ms_seq, MSS.ms_carnum
</select>
<select id="selectJudgeResultByCarnum" parameterType="map" resultType="camelCaseLinkedMap">
/* residentanddisabled-mapper|selectJudgeResultByCarnum|julim */
SELECT MSS.ms_maincode
, MSS.ms_seq
, MSS.ms_carnum
, MU.name
, (SELECT code_nm
FROM tb_cmm_code_s
WHERE code_grp_id = 'TRAFFIC'
AND code_lcd = 'GANGNAM_SIMSA'
AND code_mcd = 'RESULT'
AND code_cd = MSS.ms_result) as ms_result
, (SELECT code_nm
FROM tb_cmm_code_s
WHERE code_grp_id = 'TRAFFIC'
AND code_lcd = 'GANGNAM_SIMSA'
AND code_mcd = 'RESULT'
AND code_cd = MSU.msu_result) as msu_result
FROM min_simsa680_sc MSS,
min_simsa_user680_sc MSU,
min_userinfo MU
WHERE MSS.ms_maincode = MSU.msu_maincode
AND MSS.ms_datagb = #{msDatagb}
AND MSS.ms_chasu = #{msChasu}
AND MSS.ms_sdate &gt;= #{msSdate}
AND MSS.ms_edate &lt;= #{msEdate}
AND MSS.ms_seq = #{msSeq}
AND MSS.ms_carnum = #{msCarnum}
AND MSU.msu_team = #{msuTeam}
AND MSU.msu_userid = MU.userid
ORDER BY MSU.msu_userid, MU.userid
</select>
</mapper>
Loading…
Cancel
Save