diff --git a/src/main/java/cokr/xit/fims/crdn/dao/CrdnTeamMapper.java b/src/main/java/cokr/xit/fims/crdn/dao/CrdnTeamMapper.java
index 1cdda9c4..8448d8cc 100644
--- a/src/main/java/cokr/xit/fims/crdn/dao/CrdnTeamMapper.java
+++ b/src/main/java/cokr/xit/fims/crdn/dao/CrdnTeamMapper.java
@@ -28,7 +28,25 @@ public interface CrdnTeamMapper extends AbstractMapper {
* @param team 단속팀 정보
* @return 저장된 정보 수
*/
- int removeTeamInfo(Team team);
+ int deleteTeamInfo(Team team);
+
+ /**단속팀 정보를 등록한다.
+ * @param team 단속팀 정보
+ * @return 단속팀 정보
+ */
+ int insertTeamInfo(Team team);
+
+ /**단속팀 정보를 수정한다.
+ * @param team 단속팀 정보
+ * @return 단속팀 정보
+ */
+ int updateTeamInfo(Team team);
+
+ /**단속팀명으로 단속팀 정보를 조회한다.
+ * @param team 단속팀 정보
+ * @return 단속팀 정보
+ */
+ DataObject selectTeamInfoByName(Team team);
/**단속팀 정보를 조회한다.
* @param teamId 단속팀 ID
diff --git a/src/main/java/cokr/xit/fims/crdn/service/CrdnStngService.java b/src/main/java/cokr/xit/fims/crdn/service/CrdnStngService.java
index ce4b69c1..19ae2c31 100644
--- a/src/main/java/cokr/xit/fims/crdn/service/CrdnStngService.java
+++ b/src/main/java/cokr/xit/fims/crdn/service/CrdnStngService.java
@@ -4,6 +4,7 @@ import java.util.List;
import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.ExmptnVhcl;
+import cokr.xit.fims.crdn.Team;
import cokr.xit.fims.crdn.parsing.LayoutDescriptor;
import cokr.xit.foundation.data.DataObject;
@@ -33,6 +34,12 @@ public interface CrdnStngService {
*/
boolean removeTeamInfo(String teamId);
+ /** 단속팀 정보를 저장한다.
+ * @param team 단속팀 정보
+ * @return 저장여부
+ */
+ boolean saveTeamInfo(Team team);
+
/** 단속팀 정보을 조회한다.
* @param teamId 단속팀 ID
* @return 단속팀 정보
diff --git a/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngBean.java b/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngBean.java
index 8370f0d3..21593928 100644
--- a/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngBean.java
+++ b/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngBean.java
@@ -234,7 +234,7 @@ public class CrdnStngBean extends AbstractComponent {
return crdnTeamMapper.selectRemovedTeamList(query);
}
- /**단속팀 정보를 등록한다.
+ /**단속팀 정보를 삭제한다.
* @param teamId 단속팀 ID
* @return 저장 여부
*
- 저장됐으면 true
@@ -246,7 +246,55 @@ public class CrdnStngBean extends AbstractComponent {
Team team = new Team();
team.setTeamId(teamId);
team.setRemovedBy(currentUser().getId());
- return crdnTeamMapper.removeTeamInfo(team) == 1 ? true : false;
+ return crdnTeamMapper.deleteTeamInfo(team) == 1 ? true : false;
+ }
+
+ /**단속팀 정보를 저장한다.
+ * @param teamId 단속팀 ID
+ * @return 저장 여부
+ * - 저장됐으면 true
+ * - 그렇지 않으면 false
+ *
+ */
+ public boolean saveTeamInfo(Team team) {
+ DataObject teamInfo = crdnTeamMapper.selectTeamInfoByName(team);
+
+ boolean result = false;
+
+ if(teamInfo != null) {
+ boolean differ = false;
+ if(!ifEmpty(team.getCrdnSeCd(), () -> "").equals(teamInfo.string("CRDN_SE_CD"))) {
+ differ = true;
+ }
+ if(!ifEmpty(team.getTeamer1(), () -> "").equals(teamInfo.string("TEAMER_1"))) {
+ differ = true;
+ }
+ if(!ifEmpty(team.getTeamer2(), () -> "").equals(teamInfo.string("TEAMER_2"))) {
+ differ = true;
+ }
+ if(!ifEmpty(team.getTeamer3(), () -> "").equals(teamInfo.string("TEAMER_3"))) {
+ differ = true;
+ }
+ if(!ifEmpty(team.getTeamer4(), () -> "").equals(teamInfo.string("TEAMER_4"))) {
+ differ = true;
+ }
+
+ if(differ) {
+ Team del = new Team();
+ del.setTeamId(teamInfo.string("TEAM_ID"));
+ del.setRemovedBy(currentUser().getId());
+ crdnTeamMapper.deleteTeamInfo(del);
+
+ result = crdnTeamMapper.insertTeamInfo(team) == 1 ? true : false;
+ } else {
+ team.setTeamId(teamInfo.string("TEAM_ID"));
+ result = crdnTeamMapper.updateTeamInfo(team) == 1 ? true : false;
+ }
+ } else {
+ result = crdnTeamMapper.insertTeamInfo(team) == 1 ? true : false;
+ }
+
+ return result;
}
/**단속팀 정보를 조회한다.
@@ -323,4 +371,5 @@ public class CrdnStngBean extends AbstractComponent {
return exmptnVhclMapper.selectExemptionVehicleHistoryList(exmptnVhclId);
}
+
}
diff --git a/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngServiceBean.java b/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngServiceBean.java
index 9773ccc4..eab232d6 100644
--- a/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngServiceBean.java
+++ b/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngServiceBean.java
@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.ExmptnVhcl;
+import cokr.xit.fims.crdn.Team;
import cokr.xit.fims.crdn.parsing.LayoutDescriptor;
import cokr.xit.fims.crdn.service.CrdnStngService;
import cokr.xit.foundation.component.AbstractServiceBean;
@@ -44,6 +45,12 @@ public class CrdnStngServiceBean extends AbstractServiceBean implements CrdnStng
return crdnStngBean.removeTeamInfo(teamId);
}
+
+ @Override
+ public boolean saveTeamInfo(Team team) {
+ return crdnStngBean.saveTeamInfo(team);
+ }
+
@Override
public DataObject getTeamInfo(String teamId) {
return crdnStngBean.selectTeamInfo(teamId);
diff --git a/src/main/java/cokr/xit/fims/crdn/web/Crdn07Controller.java b/src/main/java/cokr/xit/fims/crdn/web/Crdn07Controller.java
index fa1344b7..f9530c10 100644
--- a/src/main/java/cokr/xit/fims/crdn/web/Crdn07Controller.java
+++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn07Controller.java
@@ -12,6 +12,7 @@ import cokr.xit.base.user.ManagedUser;
import cokr.xit.base.user.dao.UserMapper;
import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.crdn.CrdnQuery;
+import cokr.xit.fims.crdn.Team;
import cokr.xit.fims.crdn.dao.GlobalStngMapper;
import cokr.xit.fims.crdn.service.CrdnStngService;
@@ -29,6 +30,7 @@ public class Crdn07Controller extends ApplicationController {
, getTeamList = "/010/list.do"
, getRemovedTeamList = "/010/removedTeamList.do"
, removeTeamInfo = "/010/remove.do"
+ , saveTeamInfo = "/010/save.do"
, getTeamInfo = "/010/info.do"
;
}
@@ -110,6 +112,30 @@ public class Crdn07Controller extends ApplicationController {
}
+ /** 단속팀 정보를 저장한다.
+ * {@link CrdnStngService#saveTeamInfo(team)} 참고
+ * @param team 단속팀 정보
+ * @return jsonView
+ *
{
+ * "saved": 저장되었으면 true, 그렇지 않으면 false
+ * }
+ */
+ public ModelAndView saveTeamInfo(Team team) {
+
+ boolean saved = false;
+
+ ManagedUser currentUser = userMapper.getUser(currentUser().getAccount(), currentUser().getInstitute());
+ String curDeptCode = currentUser.getDeptCode();
+ String sggCd = globalStngMapper.selectSggCd(curDeptCode);
+ team.setSggCd(sggCd);
+
+ saved = crdnStngService.saveTeamInfo(team);
+
+ return new ModelAndView("jsonView")
+ .addObject("saved", saved);
+
+ }
+
/**단속팀 정보를 조회한다.
* {@link CrdnStngService#getTeamInfo(String)} 참고
* @param crdn 단속
diff --git a/src/main/java/cokr/xit/fims/task/web/BpvController.java b/src/main/java/cokr/xit/fims/task/web/BpvController.java
index 6a5ebbe4..73bb8d64 100644
--- a/src/main/java/cokr/xit/fims/task/web/BpvController.java
+++ b/src/main/java/cokr/xit/fims/task/web/BpvController.java
@@ -10,6 +10,7 @@ import org.springframework.web.servlet.ModelAndView;
import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.ExmptnVhcl;
+import cokr.xit.fims.crdn.Team;
import cokr.xit.fims.cvlc.CrdnCvlcpt;
import cokr.xit.fims.excl.CrdnReReg;
import cokr.xit.fims.excl.ExclQuery;
@@ -319,6 +320,12 @@ public class BpvController {
return super.removeTeamInfo(teamId);
}
+ @Override
+ @RequestMapping(name="전용차로과태료업무 단속팀 정보 저장", value=METHOD_URL.saveTeamInfo)
+ public ModelAndView saveTeamInfo(Team team) {
+ return super.saveTeamInfo(team);
+ }
+
@Override
@RequestMapping(name="전용차로과태료업무 단속팀 정보 조회", value=METHOD_URL.getTeamInfo)
public ModelAndView getTeamInfo(String teamId) {
diff --git a/src/main/java/cokr/xit/fims/task/web/PvsController.java b/src/main/java/cokr/xit/fims/task/web/PvsController.java
index adba1918..25a4005e 100644
--- a/src/main/java/cokr/xit/fims/task/web/PvsController.java
+++ b/src/main/java/cokr/xit/fims/task/web/PvsController.java
@@ -9,6 +9,7 @@ import org.springframework.web.servlet.ModelAndView;
import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.crdn.CrdnQuery;
+import cokr.xit.fims.crdn.Team;
import cokr.xit.fims.cvlc.CrdnCvlcpt;
import cokr.xit.fims.excl.CrdnReReg;
import cokr.xit.fims.excl.ExclQuery;
@@ -326,11 +327,17 @@ public class PvsController {
}
@Override
- @RequestMapping(name="전용차로과태료업무 단속팀 정보 삭제", value=METHOD_URL.removeTeamInfo)
+ @RequestMapping(name="주정차과태료업무 단속팀 정보 삭제", value=METHOD_URL.removeTeamInfo)
public ModelAndView removeTeamInfo(String teamId) {
return super.removeTeamInfo(teamId);
}
+ @Override
+ @RequestMapping(name="주정차과태료업무 단속팀 정보 저장", value=METHOD_URL.saveTeamInfo)
+ public ModelAndView saveTeamInfo(Team team) {
+ return super.saveTeamInfo(team);
+ }
+
@Override
@RequestMapping(name="주정차과태료업무 단속팀 정보 조회", value=METHOD_URL.getTeamInfo)
public ModelAndView getTeamInfo(String teamId) {
diff --git a/src/main/resources/sql/mapper/fims/crdn/crdn-team-mapper.xml b/src/main/resources/sql/mapper/fims/crdn/crdn-team-mapper.xml
index ddbef6db..26803de1 100644
--- a/src/main/resources/sql/mapper/fims/crdn/crdn-team-mapper.xml
+++ b/src/main/resources/sql/mapper/fims/crdn/crdn-team-mapper.xml
@@ -40,8 +40,8 @@ SELECT A.TEAM_ID
ORDER BY A.MDFCN_DT
-
-/* 단속팀 정보 삭제(crdnTeamMapper.removeTeamInfo) */
+
+/* 단속팀 정보 삭제(crdnTeamMapper.deleteTeamInfo) */
UPDATE TB_TEAM_INFO
SET USE_YN = 'N'
, MDFCN_DT =
@@ -49,6 +49,78 @@ UPDATE TB_TEAM_INFO
WHERE TEAM_ID = #{teamId}
+
+/* 단속팀 정보 등록(crdnTeamMapper.insertTeamInfo) */
+
+SELECT
+ LPAD(CAST(IFNULL(MAX(TEAM_ID) + 1, 1) AS INT), 10, '0')
+ AS NEW_ID
+FROM TB_TEAM_INFO
+
+INSERT
+ INTO TB_TEAM_INFO (
+ TEAM_ID
+ , SGG_CD
+ , TASK_SE_CD
+ , OGDP_SE_CD
+ , TEAM_NM
+ , CRDN_SE_CD
+ , TEAMER_1
+ , TEAMER_2
+ , TEAMER_3
+ , TEAMER_4
+ , ETC_CN
+ , USE_YN
+ , REG_DT
+ , RGTR
+ , MDFCN_DT
+ , MDFR
+ ) VALUES (
+ #{teamId}
+ , #{sggCd}
+ , #{taskSeCd}
+ , #{ogdpSeCd}
+ , #{teamNm}
+ , #{crdnSeCd}
+ , #{teamer1}
+ , #{teamer2}
+ , #{teamer3}
+ , #{teamer4}
+ , #{etcCn}
+ , 'Y'
+ ,
+ , #{createdBy}
+ ,
+ , #{modifiedBy}
+ )
+
+
+
+/* 단속팀 정보 수정(crdnTeamMapper.updateTeamInfo) */
+UPDATE TB_TEAM_INFO
+ SET ETC_CN = #{etcCn}
+ , MDFCN_DT =
+ , MDFR = #{modifiedBy}
+ WHERE TEAM_ID = #{teamId}
+
+
+
+