feat: 주정차 심의 상세 반영

dev
Lim Jonguk 3 years ago
parent a0a2a5a768
commit 82ea5cda78

@ -56,7 +56,7 @@ public class MinSimsa680 { //implements Serializable {
@Schema(required = true, title = "심사마감일시", example = " ", description = "Input Description...") @Schema(required = true, title = "심사마감일시", example = " ", description = "Input Description...")
@Column(name = "ms_cdate", nullable = false) @Column(name = "ms_cdate", nullable = false)
private java.sql.Date msCdate; private LocalDate msCdate;
@Schema(required = true, title = "심사마감시간", example = " ", description = "Input Description...") @Schema(required = true, title = "심사마감시간", example = " ", description = "Input Description...")
@Column(name = "ms_closesi", nullable = false) @Column(name = "ms_closesi", nullable = false)

@ -1,11 +1,42 @@
package com.xit.biz.ctgy.mapper; package com.xit.biz.ctgy.mapper;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.ParkingTargetDto; import com.xit.biz.ctgy.dto.ParkingTargetDto;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface IParkingMapper { public interface IParkingMapper {
void insertParkingJudgeTargetIntoSelect(ParkingTargetDto dto); void insertParkingJudgeTargetIntoSelect(ParkingTargetDto dto);
/**
* && total
* @param dto JudgeListDto
* @return Map
*/
Map<String,Object> selectTotByParkingJurgeTeamAndChasu(JudgeListDto dto);
/**
* &&
* @param dto JudgeListDto
* @return List<Map>
*/
List<Map<String,Object>> selectTotParkingUsersByJudgeTeamAndChasu(JudgeListDto dto);
/**
*
* @param dto JudgeListDto
* @return List<Map>
*/
List<Map<String,Object>> selectParkingJurgeTargetByCarnum(JudgeListDto dto);
/**
*
* @param map Map
* @return List<Map>
*/
List<Map<String,Object>> selectParkingJudgeResultByCarnum(Map<String,Object> map);
} }

@ -12,8 +12,6 @@ import com.xit.biz.ctgy.dto.GnRecallScDto;
import com.xit.biz.ctgy.dto.JudgeDetailDto; import com.xit.biz.ctgy.dto.JudgeDetailDto;
import com.xit.biz.ctgy.dto.JudgeListDto; import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.JudgeTargetDto; 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 com.xit.core.util.Checks;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
@ -26,9 +24,7 @@ import java.util.List;
import static com.xit.biz.cmm.entity.QCmmCodeS.cmmCodeS; import static com.xit.biz.cmm.entity.QCmmCodeS.cmmCodeS;
import static com.xit.biz.ctgy.entity.QGnRecallSc.gnRecallSc; 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.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.QMinSimsaUser680Sc.minSimsaUser680Sc;
import static com.xit.biz.ctgy.entity.QMinUserinfo.minUserinfo; import static com.xit.biz.ctgy.entity.QMinUserinfo.minUserinfo;

@ -2,17 +2,23 @@ package com.xit.biz.ctgy.service;
import com.xit.biz.ctgy.dto.JudgeListDto; import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.ParkingTargetDto; import com.xit.biz.ctgy.dto.ParkingTargetDto;
import com.xit.biz.ctgy.entity.MinSimsa680;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import java.util.List; import java.util.List;
import java.util.Map;
public interface IParkingService { public interface IParkingService {
//Page<MinSimsa680GroupDto> findMinSimsa680Groups(MinSimsa680 minSimsa680, Pageable pageable);
Page<JudgeListDto> findParkings(final JudgeListDto dto, Pageable pageable); Page<JudgeListDto> findParkings(final JudgeListDto dto, Pageable pageable);
List<MinSimsa680> findParkingDetails(final JudgeListDto dto);
/**
*
* @param dto JudgeListDto
* @return Map
*/
Map<String,Object> findParkingDetails(final JudgeListDto dto);
List<ParkingTargetDto> findParkingJudgeTargets(final ParkingTargetDto dto) ; List<ParkingTargetDto> findParkingJudgeTargets(final ParkingTargetDto dto) ;
// Page<MinSimsa680> findAll(final MinSimsa680 minSimsa680, Pageable pageable); // Page<MinSimsa680> findAll(final MinSimsa680 minSimsa680, Pageable pageable);

@ -3,7 +3,6 @@ package com.xit.biz.ctgy.service.impl;
import com.xit.biz.ctgy.CtgyConstants; import com.xit.biz.ctgy.CtgyConstants;
import com.xit.biz.ctgy.dto.JudgeListDto; import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.ParkingTargetDto; import com.xit.biz.ctgy.dto.ParkingTargetDto;
import com.xit.biz.ctgy.entity.MinSimsa680;
import com.xit.biz.ctgy.entity.MinSimsaUser680; import com.xit.biz.ctgy.entity.MinSimsaUser680;
import com.xit.biz.ctgy.entity.MinUserinfo; import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.biz.ctgy.entity.Tf680Recall; import com.xit.biz.ctgy.entity.Tf680Recall;
@ -13,13 +12,16 @@ import com.xit.biz.ctgy.service.IParkingService;
import com.xit.core.constant.ErrorCode; import com.xit.core.constant.ErrorCode;
import com.xit.core.exception.CustomBaseException; import com.xit.core.exception.CustomBaseException;
import com.xit.core.support.jpa.JpaUtil; import com.xit.core.support.jpa.JpaUtil;
import com.xit.core.util.Checks;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
@ -52,9 +54,42 @@ public class ParkingService implements IParkingService {
} }
@Override @Override
@Transactional(readOnly = true) public Map<String,Object> findParkingDetails(JudgeListDto dto) {
public List<MinSimsa680> findParkingDetails(final JudgeListDto dto) { Map<String, Object> resultMap = new HashMap<>();
return repository.findParkingDetails(dto);
// team && 팀별 부과현황 조회
Map<String, Object> teamMap = mapper.selectTotByParkingJurgeTeamAndChasu(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.selectTotParkingUsersByJudgeTeamAndChasu(dto);
totJudgeUserList.add(teamMap);
List<Map<String,Object>> judgeCarList = mapper.selectParkingJurgeTargetByCarnum(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.selectParkingJudgeResultByCarnum(paramMap));
// Map<String,Object> usersMap = mapper.selectJudgeResultByCarnum(paramMap)
// .stream()
// .reduce((preMap, curMap) -> {
// preMap.putAll(curMap);
// return preMap;
// }).orElse(null);
// m.putAll(usersMap);
}).collect(Collectors.toList());
resultMap.put("totData", totJudgeUserList);
resultMap.put("judgeData", resultList);
return resultMap;
} }
@Override @Override

@ -41,4 +41,91 @@
join tf680_dong TD join tf680_dong TD
on TJ.mj_dong = TD.do_code on TJ.mj_dong = TD.do_code
</insert> </insert>
<select id="selectTotByParkingJurgeTeamAndChasu" parameterType="com.xit.biz.ctgy.dto.JudgeListDto" resultType="camelCaseLinkedMap">
/* parking-mapper|selectTotByParkingJurgeTeamAndChasu|julim */
SELECT MV.msu_team
, NVL(SUM(DECODE(MS.ms_result, '2', 1, 0)), 0) bu
, 0 as seo
, NVL(SUM(DECODE(MS.ms_result, '1', 1, 0)), 0) mibu
, NVL(SUM(DECODE(MS.ms_result, '1', 1, '2', 1, 0)), 0) tot
, '결과' as name
FROM min_simsa680 MS,
msu680_view MV
WHERE MS.ms_maincode = MV.msu_maincode
<if test='msuTeam != null and msuTeam != ""'>
AND MV.msu_team = #{msuTeam}
</if>
AND MS.ms_chasu = #{msChasu}
AND MS.ms_sdate &gt;= #{msSdate}
AND MS.ms_edate &lt;= #{msEdate}
GROUP BY MV.msu_team, MS.ms_chasu
</select>
<select id="selectTotParkingUsersByJudgeTeamAndChasu" parameterType="com.xit.biz.ctgy.dto.JudgeListDto" resultType="camelCaseLinkedMap">
/* parking-mapper|selectTotParkingUsersByJudgeTeamAndChasu|julim */
SELECT SUM(DECODE(MSU_RESULT, '2', 1, 0)) bu
, 0 as seo
, SUM(DECODE(MSU_RESULT, '1', 1, 0)) mibu
, SUM(DECODE(MSU_RESULT, '1', 1, '2', 1, 0)) tot
, MU.name
FROM min_simsa680 MS,
min_simsa_user680 MSU,
min_userinfo MU
WHERE MS.ms_maincode = MSU.msu_maincode
AND MS.ms_chasu = #{msChasu}
AND MS.ms_sdate &gt;= #{msSdate}
AND MS.ms_edate &lt;= #{msEdate}
AND MSU.msu_team = #{msuTeam}
AND MSU.msu_userid = MU.userid
GROUP BY MSU.msu_userid, MU.name
ORDER BY MSU.msu_userid, MU.name
</select>
<select id="selectParkingJurgeTargetByCarnum" parameterType="com.xit.biz.ctgy.dto.JudgeListDto" resultType="camelCaseLinkedMap">
/* parking-mapper|selectParkingJurgeTargetByCarnum|julim */
SELECT MS.ms_maincode
, MS.ms_seq
, MS.ms_carnum
FROM min_simsa680 MS,
min_simsa_user680 MSU
WHERE MS.ms_maincode = MSU.msu_maincode
AND MS.ms_chasu = #{msChasu}
AND MS.ms_sdate &gt;= #{msSdate}
AND MS.ms_edate &lt;= #{msEdate}
AND MSU.msu_team = #{msuTeam}
GROUP BY MS.ms_maincode, MS.ms_seq, MS.ms_carnum
</select>
<select id="selectParkingJudgeResultByCarnum" parameterType="map" resultType="camelCaseLinkedMap">
/* parking-mapper|selectParkingJudgeResultByCarnum|julim */
SELECT MS.ms_maincode
, MS.ms_seq
, MS.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 = MS.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 MS,
min_simsa_user680 MSU,
min_userinfo MU
WHERE MS.ms_maincode = MSU.msu_maincode
AND MS.ms_chasu = #{msChasu}
AND MS.ms_sdate &gt;= #{msSdate}
AND MS.ms_edate &lt;= #{msEdate}
AND MS.ms_seq = #{msSeq}
AND MS.ms_carnum = #{msCarnum}
AND MSU.msu_team = #{msuTeam}
AND MSU.msu_userid = MU.userid
ORDER BY MSU.msu_userid, MU.name
</select>
</mapper> </mapper>
Loading…
Cancel
Save