init setting
This commit is contained in:
8
.gitignore
vendored
Normal file
8
.gitignore
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
.idea/
|
||||||
|
.DS_Store
|
||||||
|
clfd-shop-web.iml
|
||||||
|
target/
|
||||||
|
.settings/
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
src/main/resources/rebel.xml
|
||||||
274
pom.xml
Normal file
274
pom.xml
Normal file
@@ -0,0 +1,274 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>kr.co.jinwoosi.clfd</groupId>
|
||||||
|
<artifactId>clfd-shop-web</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>Color food SaaS system</name>
|
||||||
|
<description>사용자 맞춤형 컬러푸드 샾</description>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>mvn2</id>
|
||||||
|
<url>https://repo1.maven.org/maven2/</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>egovframe</id>
|
||||||
|
<url>https://maven.egovframe.go.kr/maven/</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<egovframework.rte.version>3.6.0</egovframework.rte.version>
|
||||||
|
<jstl.version>1.2</jstl.version>
|
||||||
|
<tiles.version>3.0.5</tiles.version>
|
||||||
|
<slf4j.version>1.7.21</slf4j.version>
|
||||||
|
<logback.version>1.1.7</logback.version>
|
||||||
|
<jackson.databind.version>2.7.3</jackson.databind.version>
|
||||||
|
<mybatis.spring.version>1.2.5</mybatis.spring.version>
|
||||||
|
<commons-dbcp.version>1.4</commons-dbcp.version>
|
||||||
|
<log4jdbc.version>1.2</log4jdbc.version>
|
||||||
|
<mysql-connector.version>5.1.38</mysql-connector.version>
|
||||||
|
<!-- 한글설정 -->
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>egovframework.rte</groupId>
|
||||||
|
<artifactId>egovframework.rte.ptl.mvc</artifactId>
|
||||||
|
<version>${egovframework.rte.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>commons-logging</artifactId>
|
||||||
|
<groupId>commons-logging</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>log4j-slf4j-impl</artifactId>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>egovframework.rte</groupId>
|
||||||
|
<artifactId>egovframework.rte.psl.dataaccess</artifactId>
|
||||||
|
<version>${egovframework.rte.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>log4j-slf4j-impl</artifactId>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>egovframework.rte</groupId>
|
||||||
|
<artifactId>egovframework.rte.fdl.security</artifactId>
|
||||||
|
<version>${egovframework.rte.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>jstl</artifactId>
|
||||||
|
<version>${jstl.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.tiles</groupId>
|
||||||
|
<artifactId>tiles-jsp</artifactId>
|
||||||
|
<version>${tiles.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-dbcp</groupId>
|
||||||
|
<artifactId>commons-dbcp</artifactId>
|
||||||
|
<version>${commons-dbcp.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis</groupId>
|
||||||
|
<artifactId>mybatis-spring</artifactId>
|
||||||
|
<version>${mybatis.spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-fileupload</groupId>
|
||||||
|
<artifactId>commons-fileupload</artifactId>
|
||||||
|
<version>1.3.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>2.5</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.sourceforge.jexcelapi</groupId>
|
||||||
|
<artifactId>jxl</artifactId>
|
||||||
|
<version>2.6.10</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi</artifactId>
|
||||||
|
<version>3.14</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<version>3.14</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>${jackson.databind.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>jcl-over-slf4j</artifactId>
|
||||||
|
<version>${slf4j.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<version>${logback.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.googlecode.log4jdbc</groupId>
|
||||||
|
<artifactId>log4jdbc</artifactId>
|
||||||
|
<version>${log4jdbc.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- junit 테스트 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-test</artifactId>
|
||||||
|
<version>4.3.20.RELEASE</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.12</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.oracle</groupId>
|
||||||
|
<artifactId>ojdbc6</artifactId>
|
||||||
|
<version>11.2.0.4</version>
|
||||||
|
<scope>system</scope>
|
||||||
|
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/ojdbc6.jar</systemPath>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- servlet설정 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/javax.servlet.jsp/javax.servlet.jsp-api -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet.jsp</groupId>
|
||||||
|
<artifactId>javax.servlet.jsp-api</artifactId>
|
||||||
|
<version>2.3.3</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.18</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- DB의 datetime과 모델의 LocalDateTime을 매핑 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis</groupId>
|
||||||
|
<artifactId>mybatis-typehandlers-jsr310</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.mail</groupId>
|
||||||
|
<artifactId>javax.mail-api</artifactId>
|
||||||
|
<version>1.6.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.mail</groupId>
|
||||||
|
<artifactId>javax.mail</artifactId>
|
||||||
|
<version>1.6.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.json/json -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.json</groupId>
|
||||||
|
<artifactId>json</artifactId>
|
||||||
|
<version>20210307</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.gson</groupId>
|
||||||
|
<artifactId>gson</artifactId>
|
||||||
|
<version>2.8.7</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-core</artifactId>
|
||||||
|
<version>2.17.0</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-slf4j-impl</artifactId>
|
||||||
|
<version>2.17.0</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>2.4</version>
|
||||||
|
<configuration>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.12.4</version>
|
||||||
|
<configuration>
|
||||||
|
<skipTests>true</skipTests>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.base.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.util.LocalDateTimeDeserializer;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.util.LocalDateTimeSerializer;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
public class ClfdBaseModel {
|
||||||
|
private Long regId;
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
||||||
|
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||||
|
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||||
|
private LocalDateTime regDt;
|
||||||
|
private Long updId;
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
||||||
|
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||||
|
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||||
|
private LocalDateTime updDt;
|
||||||
|
private Long delId;
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
||||||
|
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||||
|
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||||
|
private LocalDateTime delDt;
|
||||||
|
private String recSt;
|
||||||
|
|
||||||
|
private Integer start;
|
||||||
|
private Integer length;
|
||||||
|
private String sort;
|
||||||
|
private String sortOrd;
|
||||||
|
private Boolean pagingYn;
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.bod.web;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodArtiSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.service.BodArtiService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class ClfdBodController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BodArtiService bodArtiService;
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/bod/notice/list.do")
|
||||||
|
public String noticeList() {
|
||||||
|
return "clfd/bod/notice/list";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/bod/list.json")
|
||||||
|
@ResponseBody
|
||||||
|
public HashMap<String, Object> boardListJson(BodArtiSearch bodArtiSearch) {
|
||||||
|
HashMap<String, Object> result = new HashMap<>();
|
||||||
|
result.put("boardList", bodArtiService.selectList(bodArtiSearch));
|
||||||
|
result.put("result", "success");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/bod/notice/dtl.do")
|
||||||
|
public String noticeDtl(Model model, HttpServletRequest request, BodArtiSearch bodArtiSearch) {
|
||||||
|
bodArtiService.updateHit(Long.parseLong(request.getParameter("artiId")));
|
||||||
|
model.addAttribute("bodArti", bodArtiService.select(bodArtiSearch));
|
||||||
|
return "clfd/bod/notice/dtl";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.mapper;
|
||||||
|
|
||||||
|
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsAns;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsAnsSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.mapper.BaseMapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface DgnsAnsMapper extends BaseMapper<DgnsAns, DgnsAnsSearch> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.mapper;
|
||||||
|
|
||||||
|
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsAsk;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsAskSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.mapper.BaseMapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface DgnsAskMapper extends BaseMapper<DgnsAsk, DgnsAskSearch> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.mapper;
|
||||||
|
|
||||||
|
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsDtl;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsDtlSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.mapper.BaseMapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface DgnsDtlMapper extends BaseMapper<DgnsDtl, DgnsDtlSearch> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.mapper;
|
||||||
|
|
||||||
|
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsList;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsListSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.mapper.BaseMapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface DgnsListMapper extends BaseMapper<DgnsList, DgnsListSearch> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.mapper;
|
||||||
|
|
||||||
|
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.Dgns;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.mapper.BaseMapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface DgnsMapper extends BaseMapper<Dgns, DgnsSearch> {
|
||||||
|
|
||||||
|
List<DgnsSearch> skinTypeStats(DgnsSearch dgnsSearch);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.mapper;
|
||||||
|
|
||||||
|
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.SkTy;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.SkTySearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.mapper.BaseMapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SkTyMapper extends BaseMapper<SkTy, SkTySearch> {
|
||||||
|
}
|
||||||
46
src/main/java/kr/co/jinwoosi/clfd/clfd/dgns/model/Dgns.java
Normal file
46
src/main/java/kr/co/jinwoosi/clfd/clfd/dgns/model/Dgns.java
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.model;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.base.model.ClfdBaseModel;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class Dgns extends ClfdBaseModel {
|
||||||
|
private Long dgnsId;
|
||||||
|
private Long userId;
|
||||||
|
private Long skTyId;
|
||||||
|
private Integer dgnsCnt;
|
||||||
|
private Double odTotalScore;
|
||||||
|
private Double srTotalScore;
|
||||||
|
private Double pnTotalScore;
|
||||||
|
private Double wtTotalScore;
|
||||||
|
private Long odDgnsDtlId;
|
||||||
|
private Long srDgnsDtlId;
|
||||||
|
private Long pnDgnsDtlId;
|
||||||
|
private Long wtDgnsDtlId;
|
||||||
|
|
||||||
|
// 진단 상세
|
||||||
|
private DgnsDtl odDgnsDtl;
|
||||||
|
private DgnsDtl srDgnsDtl;
|
||||||
|
private DgnsDtl pnDgnsDtl;
|
||||||
|
private DgnsDtl wtDgnsDtl;
|
||||||
|
// 피부타입
|
||||||
|
private SkTy skTy;
|
||||||
|
private Long skTyCount;
|
||||||
|
private String skTyCd;
|
||||||
|
|
||||||
|
private String dgnsCntRct; // Y:사용자의 최근 피부테스트 결과 조회
|
||||||
|
|
||||||
|
public List<DgnsDtl> getDgnsDtlList() {
|
||||||
|
return new ArrayList<>(Arrays.asList(odDgnsDtl, srDgnsDtl, pnDgnsDtl, wtDgnsDtl));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@ToString
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DgnsAns {
|
||||||
|
private Long dgnsAnsId;
|
||||||
|
private Long dgnsAskId;
|
||||||
|
private String dgnsAnsCont;
|
||||||
|
private int dgnsAnsOrd;
|
||||||
|
@JsonIgnore
|
||||||
|
private Double dgnsScore;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.model;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@ToString
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DgnsAnsSearch extends DgnsAns {
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.model;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@ToString
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DgnsAsk {
|
||||||
|
private Long dgnsAskId;
|
||||||
|
private String dgnsAskCont;
|
||||||
|
private String dgnsTyCd;
|
||||||
|
private int dgnsAskOrd;
|
||||||
|
|
||||||
|
private List<DgnsAns> dgnsAnsList;
|
||||||
|
|
||||||
|
public DgnsAsk(Long dgnsAskId) {
|
||||||
|
this.dgnsAskId = dgnsAskId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.model;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DgnsAskSearch extends DgnsAsk {
|
||||||
|
public DgnsAskSearch(Long dgnsAskId) {
|
||||||
|
super(dgnsAskId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DgnsDtl {
|
||||||
|
private Long dgnsDtlId;
|
||||||
|
private String dgnsTyCd;
|
||||||
|
private String dgnsCont;
|
||||||
|
private Double dgnsMin;
|
||||||
|
private Double dgnsMax;
|
||||||
|
private String dgnsSkTyDtlCd;
|
||||||
|
private String dgnsSkTyDtlContKr;
|
||||||
|
private String dgnsSkTyDtlContEn;
|
||||||
|
|
||||||
|
public boolean isBetweenWithDgnsDtl(Double totalDgnsScore) {
|
||||||
|
return dgnsMin <= totalDgnsScore && totalDgnsScore <= dgnsMax;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.model;
|
||||||
|
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DgnsDtlSearch extends DgnsDtl {
|
||||||
|
public DgnsDtlSearch(Long dgnsDtlId) {
|
||||||
|
super.setDgnsDtlId(dgnsDtlId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.model;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.base.model.ClfdBaseModel;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class DgnsList extends ClfdBaseModel {
|
||||||
|
private Long dgnsListId;
|
||||||
|
private Long dgnsAskId;
|
||||||
|
private Long dgnsAnsId;
|
||||||
|
private Long dgnsId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.model;
|
||||||
|
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DgnsListSearch extends DgnsList {
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.model;
|
||||||
|
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DgnsSearch extends Dgns {
|
||||||
|
}
|
||||||
17
src/main/java/kr/co/jinwoosi/clfd/clfd/dgns/model/SkTy.java
Normal file
17
src/main/java/kr/co/jinwoosi/clfd/clfd/dgns/model/SkTy.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.model;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class SkTy {
|
||||||
|
private Long skTyId;
|
||||||
|
private String skTyCd;
|
||||||
|
private String skTyNm;
|
||||||
|
private String skTyDtl;
|
||||||
|
|
||||||
|
public SkTy(String skTyCd) {
|
||||||
|
this.skTyCd = skTyCd;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.model;
|
||||||
|
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class SkTySearch extends SkTy{
|
||||||
|
public SkTySearch(String skTyCd) {
|
||||||
|
super(skTyCd);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.mapper.DgnsAnsMapper;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsAns;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsAnsSearch;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DgnsAnsService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DgnsAnsMapper dgnsAnsMapper;
|
||||||
|
|
||||||
|
public List<DgnsAns> selectList(DgnsAnsSearch dgnsAnsSearch) {
|
||||||
|
return dgnsAnsMapper.selectList(dgnsAnsSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DgnsAns select(DgnsAnsSearch dgnsAnsSearch) {
|
||||||
|
return dgnsAnsMapper.select(dgnsAnsSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.mapper.DgnsAskMapper;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsAns;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsAnsSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsAsk;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsAskSearch;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DgnsAskService {
|
||||||
|
|
||||||
|
public static List<DgnsAsk> cashedDgnsAskList = null;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DgnsAskMapper dgnsAskMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DgnsAnsService dgnsAnsService;
|
||||||
|
|
||||||
|
public List<DgnsAsk> selectList(DgnsAskSearch dgnsAskSearch) {
|
||||||
|
return dgnsAskMapper.selectList(dgnsAskSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DgnsAsk select(DgnsAskSearch dgnsAskSearch) {
|
||||||
|
return dgnsAskMapper.select(dgnsAskSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DgnsAsk> selectListWithDgnsAns(DgnsAskSearch dgnsAskSearch) {
|
||||||
|
List<DgnsAsk> dgnsAskList = selectList(dgnsAskSearch);
|
||||||
|
List<DgnsAns> dgnsAnsList = dgnsAnsService.selectList(new DgnsAnsSearch());
|
||||||
|
dgnsAskList.forEach(dgnsAsk ->
|
||||||
|
dgnsAsk.setDgnsAnsList(
|
||||||
|
dgnsAnsList
|
||||||
|
.stream()
|
||||||
|
.filter(dgnsAns -> dgnsAsk.getDgnsAskId() == dgnsAns.getDgnsAskId())
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return dgnsAskList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DgnsAsk> getCashedDgnsAskList(boolean refresh) {
|
||||||
|
if (refresh || cashedDgnsAskList == null) {
|
||||||
|
cashedDgnsAskList = selectListWithDgnsAns(new DgnsAskSearch());
|
||||||
|
}
|
||||||
|
return cashedDgnsAskList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.mapper.DgnsDtlMapper;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsDtl;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsDtlSearch;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DgnsDtlService {
|
||||||
|
|
||||||
|
public static List<DgnsDtl> cashedDgnsDtlList = null;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DgnsDtlMapper dgnsDtlMapper;
|
||||||
|
|
||||||
|
public List<DgnsDtl> selectList(DgnsDtlSearch dgnsDtlSearch) {
|
||||||
|
return dgnsDtlMapper.selectList(dgnsDtlSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DgnsDtl select(DgnsDtlSearch dgnsDtlSearch) {
|
||||||
|
return dgnsDtlMapper.select(dgnsDtlSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DgnsDtl> getCashedDgnsDtlList(boolean refresh) {
|
||||||
|
if (refresh || cashedDgnsDtlList == null) {
|
||||||
|
cashedDgnsDtlList = selectList(new DgnsDtlSearch());
|
||||||
|
}
|
||||||
|
return cashedDgnsDtlList;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.mapper.DgnsListMapper;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsList;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.vo.DgnsSelection;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DgnsListService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DgnsListMapper dgnsListMapper;
|
||||||
|
|
||||||
|
public void saveDgnsList(Long userId, Long dgnsId, List<DgnsSelection> dgnsSelectionList) {
|
||||||
|
for(DgnsSelection dgnsSelection : dgnsSelectionList) {
|
||||||
|
DgnsList dgnsList = new DgnsList();
|
||||||
|
dgnsList.setRegId(userId);
|
||||||
|
dgnsList.setDgnsId(dgnsId);
|
||||||
|
dgnsList.setDgnsAskId(Long.parseLong(dgnsSelection.getDgnsAskId()));
|
||||||
|
dgnsList.setDgnsAnsId(Long.parseLong(dgnsSelection.getDgnsAnsId()));
|
||||||
|
dgnsListMapper.insert(dgnsList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,210 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.mapper.DgnsMapper;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.*;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.vo.DgnsSelection;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.User;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DgnsService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DgnsMapper dgnsMapper;
|
||||||
|
@Autowired
|
||||||
|
private DgnsAskService dgnsAskService;
|
||||||
|
@Autowired
|
||||||
|
private DgnsDtlService dgnsDtlService;
|
||||||
|
@Autowired
|
||||||
|
private SkTyService skTyService;
|
||||||
|
|
||||||
|
public List<Dgns> selectList(DgnsSearch dgnsSearch) {
|
||||||
|
List<Dgns> dgnsList = dgnsMapper.selectList(dgnsSearch);
|
||||||
|
List<DgnsDtl> dgnsDtlList = dgnsDtlService.getCashedDgnsDtlList(false);
|
||||||
|
List<SkTy> skTyList = skTyService.getCashedSkTyList(false);
|
||||||
|
for (Dgns dgns : dgnsList) {
|
||||||
|
// 진단 상세 저장
|
||||||
|
for (DgnsDtl dgnsDtl : dgnsDtlList) {
|
||||||
|
Long dgnsDtlId = dgnsDtl.getDgnsDtlId();
|
||||||
|
if (dgnsDtlId.equals(dgns.getOdDgnsDtlId())) {
|
||||||
|
dgns.setOdDgnsDtl(dgnsDtl);
|
||||||
|
} else if (dgnsDtlId.equals(dgns.getSrDgnsDtlId())) {
|
||||||
|
dgns.setSrDgnsDtl(dgnsDtl);
|
||||||
|
} else if (dgnsDtlId.equals(dgns.getPnDgnsDtlId())) {
|
||||||
|
dgns.setPnDgnsDtl(dgnsDtl);
|
||||||
|
} else if (dgnsDtlId.equals(dgns.getWtDgnsDtlId())) {
|
||||||
|
dgns.setWtDgnsDtl(dgnsDtl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 피부타입 저장
|
||||||
|
for (SkTy skTy : skTyList) {
|
||||||
|
if (dgns.getSkTyId().equals(skTy.getSkTyId())) {
|
||||||
|
dgns.setSkTy(skTy);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dgnsList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dgns select(DgnsSearch dgnsSearch) {
|
||||||
|
Dgns dgns = dgnsMapper.select(dgnsSearch);
|
||||||
|
if (dgns==null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// 피부타입 저장
|
||||||
|
SkTySearch skTySearch = new SkTySearch();
|
||||||
|
skTySearch.setSkTyId(dgns.getSkTyId());
|
||||||
|
SkTy skTy = skTyService.select(skTySearch);
|
||||||
|
dgns.setSkTy(skTy);
|
||||||
|
// 진단상세 저장
|
||||||
|
List<DgnsDtl> dgnsDtlList = dgnsDtlService.getCashedDgnsDtlList(false);
|
||||||
|
dgns.setOdDgnsDtl(findDgnsDtlById(dgnsDtlList, dgns.getOdDgnsDtlId()));
|
||||||
|
dgns.setSrDgnsDtl(findDgnsDtlById(dgnsDtlList, dgns.getSrDgnsDtlId()));
|
||||||
|
dgns.setPnDgnsDtl(findDgnsDtlById(dgnsDtlList, dgns.getPnDgnsDtlId()));
|
||||||
|
dgns.setWtDgnsDtl(findDgnsDtlById(dgnsDtlList, dgns.getWtDgnsDtlId()));
|
||||||
|
return dgns;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 진단 결과를 저장
|
||||||
|
public void saveDgns(Long userId, Dgns dgns) {
|
||||||
|
dgns.setUserId(userId);
|
||||||
|
dgns.setRegId(userId);
|
||||||
|
DgnsSearch dgnsCountSearch = new DgnsSearch();
|
||||||
|
dgnsCountSearch.setUserId(userId);
|
||||||
|
dgnsCountSearch.setRecSt("Y");
|
||||||
|
dgns.setDgnsCnt(dgnsMapper.count(dgnsCountSearch) + 1); // 진단회차 저장
|
||||||
|
dgnsMapper.insert(dgns);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dgns examDgns(List<DgnsSelection> dgnsSelectionList) {
|
||||||
|
Dgns dgns = new Dgns();
|
||||||
|
List<DgnsAsk> dgnsAskList = dgnsAskService.getCashedDgnsAskList(false);
|
||||||
|
List<DgnsDtl> dgnsDtlList = dgnsDtlService.getCashedDgnsDtlList(false);
|
||||||
|
dgns.setOdTotalScore(calculateDgnsTotalScore("OD", dgnsAskList, dgnsSelectionList));
|
||||||
|
dgns.setSrTotalScore(calculateDgnsTotalScore("SR", dgnsAskList, dgnsSelectionList));
|
||||||
|
dgns.setPnTotalScore(calculateDgnsTotalScore("PN", dgnsAskList, dgnsSelectionList));
|
||||||
|
dgns.setWtTotalScore(calculateDgnsTotalScore("WT", dgnsAskList, dgnsSelectionList));
|
||||||
|
dgns.setOdDgnsDtl(findDgnsDtlByScore("OD", dgnsDtlList, dgns.getOdTotalScore()));
|
||||||
|
dgns.setSrDgnsDtl(findDgnsDtlByScore("SR", dgnsDtlList, dgns.getSrTotalScore()));
|
||||||
|
dgns.setPnDgnsDtl(findDgnsDtlByScore("PN", dgnsDtlList, dgns.getPnTotalScore()));
|
||||||
|
dgns.setWtDgnsDtl(findDgnsDtlByScore("WT", dgnsDtlList, dgns.getWtTotalScore()));
|
||||||
|
dgns.setOdDgnsDtlId(dgns.getOdDgnsDtl().getDgnsDtlId());
|
||||||
|
dgns.setSrDgnsDtlId(dgns.getSrDgnsDtl().getDgnsDtlId());
|
||||||
|
dgns.setPnDgnsDtlId(dgns.getPnDgnsDtl().getDgnsDtlId());
|
||||||
|
dgns.setWtDgnsDtlId(dgns.getWtDgnsDtl().getDgnsDtlId());
|
||||||
|
dgns.setSkTy(skTyService.selectSkTyByDgnsDtlList(dgns.getDgnsDtlList()));
|
||||||
|
dgns.setSkTyId(dgns.getSkTy().getSkTyId());
|
||||||
|
return dgns;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dgns examDgnsByScore(String odScore, String srScore, String pnScore, String wtScore) {
|
||||||
|
Dgns dgns = new Dgns();
|
||||||
|
List<DgnsDtl> dgnsDtlList = dgnsDtlService.getCashedDgnsDtlList(false);
|
||||||
|
dgns.setOdTotalScore(Double.parseDouble(odScore));
|
||||||
|
dgns.setSrTotalScore(Double.parseDouble(srScore));
|
||||||
|
dgns.setPnTotalScore(Double.parseDouble(pnScore));
|
||||||
|
dgns.setWtTotalScore(Double.parseDouble(wtScore));
|
||||||
|
dgns.setOdDgnsDtl(findDgnsDtlByScore("OD", dgnsDtlList, dgns.getOdTotalScore()));
|
||||||
|
dgns.setSrDgnsDtl(findDgnsDtlByScore("SR", dgnsDtlList, dgns.getSrTotalScore()));
|
||||||
|
dgns.setPnDgnsDtl(findDgnsDtlByScore("PN", dgnsDtlList, dgns.getPnTotalScore()));
|
||||||
|
dgns.setWtDgnsDtl(findDgnsDtlByScore("WT", dgnsDtlList, dgns.getWtTotalScore()));
|
||||||
|
dgns.setOdDgnsDtlId(dgns.getOdDgnsDtl().getDgnsDtlId());
|
||||||
|
dgns.setSrDgnsDtlId(dgns.getSrDgnsDtl().getDgnsDtlId());
|
||||||
|
dgns.setPnDgnsDtlId(dgns.getPnDgnsDtl().getDgnsDtlId());
|
||||||
|
dgns.setWtDgnsDtlId(dgns.getWtDgnsDtl().getDgnsDtlId());
|
||||||
|
dgns.setSkTy(skTyService.selectSkTyByDgnsDtlList(dgns.getDgnsDtlList()));
|
||||||
|
dgns.setSkTyId(dgns.getSkTy().getSkTyId());
|
||||||
|
return dgns;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double calculateDgnsTotalScore(String dgnsTyCd, List<DgnsAsk> dgnsAskList, List<DgnsSelection> dgnsSelectionList) {
|
||||||
|
Double totalScore = 0.0;
|
||||||
|
List<DgnsAsk> filteredDgnsAskList = dgnsAskList.stream().filter(dgnsAsk -> dgnsAsk.getDgnsTyCd().equals(dgnsTyCd)).collect(Collectors.toList());
|
||||||
|
for (DgnsAsk dgnsAsk : filteredDgnsAskList) {
|
||||||
|
DgnsSelection dgnsSelection = dgnsSelectionList
|
||||||
|
.stream()
|
||||||
|
.filter(ds -> ds.getDgnsAskId().equals(String.valueOf(dgnsAsk.getDgnsAskId())))
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
.stream()
|
||||||
|
.findFirst().orElseThrow(RuntimeException::new);
|
||||||
|
DgnsAns dgnsAns = dgnsAsk.getDgnsAnsList()
|
||||||
|
.stream()
|
||||||
|
.filter(da -> String.valueOf(da.getDgnsAnsId()).equals(dgnsSelection.getDgnsAnsId()))
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
.stream()
|
||||||
|
.findFirst().orElseThrow(RuntimeException::new);
|
||||||
|
totalScore += dgnsAns.getDgnsScore();
|
||||||
|
}
|
||||||
|
return totalScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DgnsDtl findDgnsDtlByScore(String dgnsTyCd, List<DgnsDtl> dgnsDtlList, Double totalScore) {
|
||||||
|
return dgnsDtlList.stream()
|
||||||
|
.filter(dgnsDtl -> dgnsDtl.getDgnsTyCd().equals(dgnsTyCd))
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
.stream()
|
||||||
|
.filter(dgnsDtl -> dgnsDtl.isBetweenWithDgnsDtl(totalScore))
|
||||||
|
.findFirst()
|
||||||
|
.orElseThrow(RuntimeException::new);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DgnsDtl findDgnsDtlById(List<DgnsDtl> dgnsDtlList, Long dgnsDtlId) {
|
||||||
|
return dgnsDtlList.stream()
|
||||||
|
.filter(dgnsDtl -> dgnsDtl.getDgnsDtlId().equals(dgnsDtlId))
|
||||||
|
.findFirst()
|
||||||
|
.orElseThrow(RuntimeException::new);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDgnsResultText(User user, Dgns dgns) {
|
||||||
|
StringBuilder result = new StringBuilder();
|
||||||
|
if (user!= null && user.getUserNm() !=null) {
|
||||||
|
result.append(user.getUserNm()).append("님은 ");
|
||||||
|
} else {
|
||||||
|
result.append("당신은 ");
|
||||||
|
}
|
||||||
|
|
||||||
|
result.append(dgns.getSkTy().getSkTyCd()).append(" 타입으로 ");
|
||||||
|
result.append(dgns.getOdDgnsDtl().getDgnsCont()).append(", ");
|
||||||
|
result.append(dgns.getSrDgnsDtl().getDgnsCont()).append(", ");
|
||||||
|
result.append(dgns.getPnDgnsDtl().getDgnsCont()).append(", ");
|
||||||
|
result.append(dgns.getWtDgnsDtl().getDgnsCont()).append("입니다.\n");
|
||||||
|
|
||||||
|
result.append(dgns.getSkTy().getSkTyDtl());
|
||||||
|
|
||||||
|
return result.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDgnsResultTitleText(Dgns dgns) {
|
||||||
|
Integer cnt = dgns.getDgnsCnt();
|
||||||
|
if (cnt != null) {
|
||||||
|
return cnt+"회차 테스트 종합분석 결과";
|
||||||
|
} else {
|
||||||
|
return "진단 종합분석 결과";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDgnsResultTime(Dgns dgns) {
|
||||||
|
LocalDateTime regDt = dgns.getRegDt();
|
||||||
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH시 mm분");
|
||||||
|
if (regDt == null) {
|
||||||
|
ZonedDateTime now = ZonedDateTime.now(ZoneId.of("Asia/Seoul"));
|
||||||
|
return now.format(dateTimeFormatter);
|
||||||
|
} else {
|
||||||
|
return regDt.format(dateTimeFormatter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DgnsSearch> skinTypeStats(DgnsSearch dgnsSearch) {
|
||||||
|
return dgnsMapper.skinTypeStats(dgnsSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.mapper.SkTyMapper;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsDtl;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.SkTy;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.SkTySearch;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SkTyService {
|
||||||
|
|
||||||
|
public static List<SkTy> cashedSkTyList = null;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SkTyMapper skTyMapper;
|
||||||
|
|
||||||
|
public List<SkTy> selectList(SkTySearch skTySearch) {
|
||||||
|
return skTyMapper.selectList(skTySearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SkTy select(SkTySearch skTySearch) {
|
||||||
|
return skTyMapper.select(skTySearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SkTy selectSkTyByDgnsDtlList(List<DgnsDtl> dgnsDtlList) {
|
||||||
|
StringBuilder skTyCdSb = new StringBuilder();
|
||||||
|
for(DgnsDtl dgnsDtl : dgnsDtlList) {
|
||||||
|
skTyCdSb.append(dgnsDtl.getDgnsSkTyDtlCd());
|
||||||
|
}
|
||||||
|
String skTyCd = skTyCdSb.toString();
|
||||||
|
List<SkTy> skTyList = getCashedSkTyList(false);
|
||||||
|
return skTyList.stream()
|
||||||
|
.filter(skTy -> skTy.getSkTyCd().equals(skTyCd))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SkTy> getCashedSkTyList(boolean refresh) {
|
||||||
|
if (refresh || cashedSkTyList == null) {
|
||||||
|
cashedSkTyList = selectList(new SkTySearch());
|
||||||
|
}
|
||||||
|
return cashedSkTyList;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.vo;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DgnsSelection {
|
||||||
|
private String dgnsTyCd;
|
||||||
|
private String dgnsAskId;
|
||||||
|
private String dgnsAskOrd;
|
||||||
|
private String dgnsAnsId;
|
||||||
|
private String dgnsAnsOrd;
|
||||||
|
|
||||||
|
public DgnsSelection(String dgnsAskId, String dgnsAnsId) {
|
||||||
|
this.dgnsAskId = dgnsAskId;
|
||||||
|
this.dgnsAnsId = dgnsAnsId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.vo;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DgnsSelectionWrapper {
|
||||||
|
private List<DgnsSelection> dgnsSelectionList;
|
||||||
|
}
|
||||||
@@ -0,0 +1,243 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.dgns.web;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.Dgns;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.service.DgnsAskService;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.service.DgnsListService;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.service.DgnsService;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.vo.DgnsSelection;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.site.service.ClfdSiteService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.cd.model.CdDtl;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.cd.service.CdDtlService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.User;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class DgnsController {
|
||||||
|
@Autowired
|
||||||
|
private ClfdSiteService clfdSiteService;
|
||||||
|
@Autowired
|
||||||
|
private DgnsAskService dgnsAskService;
|
||||||
|
@Autowired
|
||||||
|
private DgnsService dgnsService;
|
||||||
|
@Autowired
|
||||||
|
private DgnsListService dgnsListService;
|
||||||
|
@Autowired
|
||||||
|
private CdDtlService cdDtlService;
|
||||||
|
|
||||||
|
@RequestMapping("/clfd/main.do")
|
||||||
|
public String diagnosisMainPage(HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||||
|
if (clfdSiteService.visitClfdSite(request, response, model) == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return "clfd/main";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/dgns/survey.do", method = RequestMethod.GET)
|
||||||
|
public String dgnsPageGet(HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||||
|
if (clfdSiteService.visitClfdSite(request, response, model) == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return "clfd/dgns/survey";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/clfd/dgns/survey.json")
|
||||||
|
@ResponseBody
|
||||||
|
public HashMap<String, Object> dgnsSurvey() {
|
||||||
|
HashMap<String, Object> result = new HashMap<>();
|
||||||
|
try {
|
||||||
|
result.put("result", "success");
|
||||||
|
result.put("dgnsAskList", dgnsAskService.getCashedDgnsAskList(false));
|
||||||
|
result.put("dgnsTyCdList", cdDtlService.selectList(new CdDtl("dgnsTyCd")));
|
||||||
|
} catch (Exception e) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "진단항목을 가져오는 중 에러가 발생하였습니다.");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/dgns/surveyExam.do",method = RequestMethod.GET)
|
||||||
|
public String dgnsSurveyExamDoGet() {
|
||||||
|
return "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/dgns/surveyExam.do", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public HashMap<String, Object> dgnsSurveyExamDo(HttpServletRequest request, @RequestBody List<DgnsSelection> dgnsSelectionList) {
|
||||||
|
HashMap<String, Object> result = new HashMap<>();
|
||||||
|
String userRole= (String) request.getSession().getAttribute("userRole");
|
||||||
|
User user = (User) request.getSession().getAttribute("user");
|
||||||
|
|
||||||
|
Dgns dgns = dgnsService.examDgns(dgnsSelectionList);
|
||||||
|
|
||||||
|
if (user != null && userRole.equals("ROLE_USER")) {
|
||||||
|
dgnsService.saveDgns(user.getUserId(), dgns);
|
||||||
|
dgnsListService.saveDgnsList(user.getUserId(), dgns.getDgnsId(), dgnsSelectionList);
|
||||||
|
}
|
||||||
|
|
||||||
|
result.put("result", "success");
|
||||||
|
result.put("odScore", dgns.getOdTotalScore());
|
||||||
|
result.put("srScore", dgns.getSrTotalScore());
|
||||||
|
result.put("pnScore", dgns.getPnTotalScore());
|
||||||
|
result.put("wtScore", dgns.getWtTotalScore());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/dgns/list.do")
|
||||||
|
public String dgnsList (HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||||
|
if (clfdSiteService.visitClfdSite(request, response, model) == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "clfd/dgns/list";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/dgns/list.json")
|
||||||
|
@ResponseBody
|
||||||
|
public HashMap<String, Object> dgnsListJson(HttpServletRequest request, HttpServletResponse response, DgnsSearch dgnsSearch) {
|
||||||
|
HashMap<String, Object> result = new HashMap<>();
|
||||||
|
|
||||||
|
User user = (User)request.getSession().getAttribute("user");
|
||||||
|
if (user == null) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "사용자를 찾을 수 없습니다.");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
dgnsSearch.setUserId(user.getUserId());
|
||||||
|
dgnsSearch.setSortOrd("DESC");
|
||||||
|
dgnsSearch.setRecSt("Y");
|
||||||
|
dgnsSearch.setSort("DGNS_CNT");
|
||||||
|
List<Dgns> dgnsList = dgnsService.selectList(dgnsSearch);
|
||||||
|
result.put("result", "success");
|
||||||
|
result.put("dgnsList", dgnsList);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/dgns/dtl.do")
|
||||||
|
public String dgnsDtl(@RequestParam("dgns") String dgnsId, HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||||
|
User user = (User)request.getSession().getAttribute("user");
|
||||||
|
|
||||||
|
if (clfdSiteService.visitClfdSite(request, response, model) == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
DgnsSearch dgnsSearch = new DgnsSearch();
|
||||||
|
dgnsSearch.setUserId(user.getUserId());
|
||||||
|
dgnsSearch.setDgnsId(Long.parseLong(dgnsId));
|
||||||
|
Dgns dgns = dgnsService.select(dgnsSearch);
|
||||||
|
|
||||||
|
model.addAttribute("dgnsTitle", dgnsService.getDgnsResultTitleText(dgns));
|
||||||
|
model.addAttribute("dgnsTime", dgnsService.getDgnsResultTime(dgns));
|
||||||
|
model.addAttribute("user", user);
|
||||||
|
model.addAttribute("skTy", dgns.getSkTy());
|
||||||
|
model.addAttribute("odScore", dgns.getOdTotalScore());
|
||||||
|
model.addAttribute("srScore", dgns.getSrTotalScore());
|
||||||
|
model.addAttribute("pnScore", dgns.getPnTotalScore());
|
||||||
|
model.addAttribute("wtScore", dgns.getWtTotalScore());
|
||||||
|
if(dgns.getOdTotalScore() < 11) {
|
||||||
|
model.addAttribute("odScorePercent", String.format("%.2f", (dgns.getOdTotalScore()-4)*2/13*50));
|
||||||
|
} else {
|
||||||
|
model.addAttribute("odScorePercent", String.format("%.2f", 50 + (dgns.getOdTotalScore()-10.5)*2/11*50));
|
||||||
|
}
|
||||||
|
if(dgns.getSrTotalScore() < 11) {
|
||||||
|
model.addAttribute("srScorePercent", String.format("%.2f", (dgns.getSrTotalScore()-4)*2/9*50));
|
||||||
|
} else {
|
||||||
|
model.addAttribute("srScorePercent", String.format("%.2f", 50 + (dgns.getSrTotalScore()-10.5)*2/27*50));
|
||||||
|
}
|
||||||
|
if(dgns.getPnTotalScore() < 11) {
|
||||||
|
model.addAttribute("pnScorePercent", String.format("%.2f", (dgns.getPnTotalScore()-4)*2/13*50));
|
||||||
|
} else {
|
||||||
|
model.addAttribute("pnScorePercent", String.format("%.2f", 50 + (dgns.getPnTotalScore()-10.5)*2/11*50));
|
||||||
|
}
|
||||||
|
if(dgns.getWtTotalScore() < 23) {
|
||||||
|
model.addAttribute("wtScorePercent", String.format("%.2f", (dgns.getWtTotalScore()-9)*2/27*50));
|
||||||
|
} else {
|
||||||
|
model.addAttribute("wtScorePercent", String.format("%.2f", 50 + (dgns.getWtTotalScore()-22.5)*2/27*50));
|
||||||
|
}
|
||||||
|
model.addAttribute("resultText", dgnsService.getDgnsResultText(user, dgns));
|
||||||
|
return "clfd/dgns/dtl";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/dgns/result.do")
|
||||||
|
public String dgnsResult(@RequestParam Map<String, String> params, HttpServletRequest request, Model model) {
|
||||||
|
User user = (User) request.getSession().getAttribute("user");
|
||||||
|
|
||||||
|
String odScore = params.get("od");
|
||||||
|
String srScore = params.get("sr");
|
||||||
|
String pnScore = params.get("pn");
|
||||||
|
String wtScore = params.get("wt");
|
||||||
|
|
||||||
|
if (odScore == null || srScore == null || pnScore == null || wtScore == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
Dgns dgns = dgnsService.examDgnsByScore(odScore, srScore, pnScore, wtScore);
|
||||||
|
|
||||||
|
if (dgns == null || dgns.getSkTy() == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
model.addAttribute("dgnsTitle", dgnsService.getDgnsResultTitleText(dgns));
|
||||||
|
model.addAttribute("dgnsTime", dgnsService.getDgnsResultTime(dgns));
|
||||||
|
model.addAttribute("user", user);
|
||||||
|
model.addAttribute("skTy", dgns.getSkTy());
|
||||||
|
model.addAttribute("odScore", dgns.getOdTotalScore());
|
||||||
|
model.addAttribute("srScore", dgns.getSrTotalScore());
|
||||||
|
model.addAttribute("pnScore", dgns.getPnTotalScore());
|
||||||
|
model.addAttribute("wtScore", dgns.getWtTotalScore());
|
||||||
|
if(dgns.getOdTotalScore() < 11) {
|
||||||
|
model.addAttribute("odScorePercent", String.format("%.2f", (dgns.getOdTotalScore()-4)*2/13*50));
|
||||||
|
} else {
|
||||||
|
model.addAttribute("odScorePercent", String.format("%.2f", 50 + (dgns.getOdTotalScore()-10.5)*2/11*50));
|
||||||
|
}
|
||||||
|
if(dgns.getSrTotalScore() < 11) {
|
||||||
|
model.addAttribute("srScorePercent", String.format("%.2f", (dgns.getSrTotalScore()-4)*2/9*50));
|
||||||
|
} else {
|
||||||
|
model.addAttribute("srScorePercent", String.format("%.2f", 50 + (dgns.getSrTotalScore()-10.5)*2/27*50));
|
||||||
|
}
|
||||||
|
if(dgns.getPnTotalScore() < 11) {
|
||||||
|
model.addAttribute("pnScorePercent", String.format("%.2f", (dgns.getPnTotalScore()-4)*2/13*50));
|
||||||
|
} else {
|
||||||
|
model.addAttribute("pnScorePercent", String.format("%.2f", 50 + (dgns.getPnTotalScore()-10.5)*2/11*50));
|
||||||
|
}
|
||||||
|
if(dgns.getWtTotalScore() < 23) {
|
||||||
|
model.addAttribute("wtScorePercent", String.format("%.2f", (dgns.getWtTotalScore()-9)*2/27*50));
|
||||||
|
} else {
|
||||||
|
model.addAttribute("wtScorePercent", String.format("%.2f", 50 + (dgns.getWtTotalScore()-22.5)*2/27*50));
|
||||||
|
}
|
||||||
|
model.addAttribute("resultText", dgnsService.getDgnsResultText(user, dgns));
|
||||||
|
|
||||||
|
return "clfd/dgns/dtl";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value="/system/stats/skinType.mng", method=RequestMethod.GET)
|
||||||
|
public String skinTypeList(){
|
||||||
|
return "system/satis/skinTypeList";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value="/system/stats/skinType.json", method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> skinTypeList(DgnsSearch dgnsSearch){
|
||||||
|
Map<String , Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
result.put("data", dgnsService.skinTypeStats(dgnsSearch));
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.intro.web;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class IntroController {
|
||||||
|
|
||||||
|
@RequestMapping("/clfd/intro.do")
|
||||||
|
public String diagnosisMainPage(HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||||
|
String userRole = (String) request.getSession().getAttribute("userRole");
|
||||||
|
model.addAttribute("loginYn", userRole);
|
||||||
|
return "clfd/intro";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.prod.mapper;
|
||||||
|
|
||||||
|
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.prod.model.ProdLike;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.prod.model.ProdLikeSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.mapper.BaseMapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface ProdLikeMapper extends BaseMapper<ProdLike, ProdLikeSearch> {
|
||||||
|
int deleteAndReturnCount(ProdLike prodLike);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.prod.model;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.base.model.ClfdBaseModel;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class ProdLike extends ClfdBaseModel {
|
||||||
|
private Long prodLikeId;
|
||||||
|
private Long prodId;
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
public ProdLike(Long prodLikeId) {
|
||||||
|
this.prodLikeId = prodLikeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProdLike(Long prodId, Long userId) {
|
||||||
|
this.prodId = prodId;
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.prod.model;
|
||||||
|
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@ToString
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ProdLikeSearch extends ProdLike{
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.prod.service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.prod.model.ProdLike;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.prod.mapper.ProdMapper;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.prod.model.Prod;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.prod.model.ProdSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.cd.model.CdDtl;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.cd.service.CdDtlService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ClfdProdService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProdMapper prodMapper;
|
||||||
|
@Autowired
|
||||||
|
private CdDtlService cdDtlService;
|
||||||
|
@Autowired
|
||||||
|
private ProdLikeService prodLikeService;
|
||||||
|
|
||||||
|
public List<Prod> selectList(ProdSearch prodSearch) {
|
||||||
|
return prodMapper.selectList(prodSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Prod> selectListWithLike(ProdSearch prodSearch, Long userId) {
|
||||||
|
List<Prod> prodList = this.selectList(prodSearch);
|
||||||
|
prodList.forEach(prod -> {
|
||||||
|
ProdLike prodLike = prodLikeService.select(prod.getProdId(), userId);
|
||||||
|
prod.setLike(prodLike != null);
|
||||||
|
});
|
||||||
|
return prodList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Prod select(ProdSearch prodSearch) {
|
||||||
|
return prodMapper.select(prodSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Prod selectWithLike(ProdSearch prodSearch, Long userId) {
|
||||||
|
Prod prod = prodMapper.select(prodSearch);
|
||||||
|
if (prod!=null) {
|
||||||
|
ProdLike prodLike = prodLikeService.select(prod.getProdId(), userId);
|
||||||
|
prod.setLike(prodLike != null);
|
||||||
|
}
|
||||||
|
return prod;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(Prod prod) {
|
||||||
|
prodMapper.update(prod);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<CdDtl> getProdTyCdDtlList() {
|
||||||
|
CdDtl cdDtl = new CdDtl();
|
||||||
|
cdDtl.setCdId("prodTy");
|
||||||
|
return cdDtlService.selectList(cdDtl);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void plusRcmdNo(Prod prod) {
|
||||||
|
Long rcmdNo = prod.getRcmdNo();
|
||||||
|
if (rcmdNo==null || rcmdNo < 0) {
|
||||||
|
rcmdNo = 0L;
|
||||||
|
}
|
||||||
|
prod.setRcmdNo(++rcmdNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void minusRcmdNo(Prod prod) {
|
||||||
|
Long rcmdNo = prod.getRcmdNo();
|
||||||
|
if (rcmdNo==null || rcmdNo-1 < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
prod.setRcmdNo(--rcmdNo);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.prod.service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.prod.mapper.ProdLikeMapper;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.prod.model.ProdLike;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.prod.model.ProdLikeSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.prod.model.Prod;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.prod.model.ProdSearch;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.dao.DuplicateKeyException;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ProdLikeService {
|
||||||
|
@Autowired
|
||||||
|
private ProdLikeMapper prodLikeMapper;
|
||||||
|
@Autowired
|
||||||
|
private ClfdProdService clfdProdService;
|
||||||
|
|
||||||
|
public ProdLike select(Long prodId, Long userId) {
|
||||||
|
ProdLikeSearch prodLikeSearch = new ProdLikeSearch();
|
||||||
|
prodLikeSearch.setProdId(prodId);
|
||||||
|
prodLikeSearch.setUserId(userId);
|
||||||
|
return prodLikeMapper.select(prodLikeSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insert(Long prodId, Long userId) {
|
||||||
|
try {
|
||||||
|
prodLikeMapper.insert(new ProdLike(prodId, userId));
|
||||||
|
ProdSearch prodSearch = new ProdSearch();
|
||||||
|
prodSearch.setProdId(prodId);
|
||||||
|
Prod prod = clfdProdService.select(prodSearch);
|
||||||
|
clfdProdService.plusRcmdNo(prod);
|
||||||
|
clfdProdService.update(prod);
|
||||||
|
} catch (DuplicateKeyException e) {
|
||||||
|
throw new RuntimeException("이미 좋아요를 하였습니다.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete(Long prodId, Long userId) {
|
||||||
|
if (prodLikeMapper.deleteAndReturnCount(new ProdLike(prodId, userId)) < 1) {
|
||||||
|
throw new RuntimeException("일지하는 항목이 없습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
ProdSearch prodSearch = new ProdSearch();
|
||||||
|
prodSearch.setProdId(prodId);
|
||||||
|
Prod prod = clfdProdService.select(prodSearch);
|
||||||
|
clfdProdService.minusRcmdNo(prod);
|
||||||
|
clfdProdService.update(prod);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.prod.web;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.Dgns;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.dgns.service.DgnsService;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.prod.service.ClfdProdService;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.site.service.ClfdSiteService;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.prod.model.Prod;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.prod.model.ProdSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.cd.model.CdDtl;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.cd.service.CdDtlService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.User;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class ClfdProdController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ClfdSiteService clfdSiteService;
|
||||||
|
@Autowired
|
||||||
|
private ClfdProdService clfdProdService;
|
||||||
|
@Autowired
|
||||||
|
private DgnsService dgnsService;
|
||||||
|
@Resource(name = "cdDtlService")
|
||||||
|
private CdDtlService cdDtlService;
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/prod/list.do")
|
||||||
|
public String clfdProdListPage(HttpServletRequest request, HttpServletResponse response, Model model,
|
||||||
|
@RequestParam(value = "searchText", required = false) String searchText) {
|
||||||
|
HttpSession session = request.getSession();
|
||||||
|
User user = (User) session.getAttribute("user");
|
||||||
|
model.addAttribute("user", user);
|
||||||
|
|
||||||
|
if(user != null) {
|
||||||
|
DgnsSearch dgnsSearch = new DgnsSearch();
|
||||||
|
dgnsSearch.setUserId(user.getUserId());
|
||||||
|
dgnsSearch.setDgnsCntRct("Y");
|
||||||
|
// 사용자의 최근 테스트 결과 정보
|
||||||
|
Dgns dgns = dgnsService.select(dgnsSearch);
|
||||||
|
model.addAttribute("dgnsRct", dgns);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clfdSiteService.visitClfdSite(request, response, model) == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (searchText == null) {
|
||||||
|
searchText = "";
|
||||||
|
}
|
||||||
|
model.addAttribute("searchText", searchText);
|
||||||
|
|
||||||
|
String[] prodTyArray = request.getParameterValues("prodTyArray");
|
||||||
|
|
||||||
|
if (prodTyArray != null) {
|
||||||
|
model.addAttribute("mProdTyList", new ArrayList(Arrays.asList(prodTyArray)));
|
||||||
|
}
|
||||||
|
|
||||||
|
String mSkTyCus = request.getParameter("skTyCus");
|
||||||
|
model.addAttribute("mSkTyCus", mSkTyCus);
|
||||||
|
|
||||||
|
String mSkTy = request.getParameter("skTy");
|
||||||
|
model.addAttribute("mSkTy", mSkTy);
|
||||||
|
|
||||||
|
String sortToken = request.getParameter("sortToken");
|
||||||
|
if (sortToken == null) {
|
||||||
|
sortToken = "";
|
||||||
|
}
|
||||||
|
model.addAttribute("sortToken", sortToken);
|
||||||
|
|
||||||
|
String mSideBar = request.getParameter("mSideBar");
|
||||||
|
if (mSideBar == null) {
|
||||||
|
mSideBar = "off";
|
||||||
|
}
|
||||||
|
model.addAttribute("mSideBar", mSideBar);
|
||||||
|
|
||||||
|
try {
|
||||||
|
model.addAttribute("prodTyCdDtlList", cdDtlService.selectList(new CdDtl("prodTy")));
|
||||||
|
model.addAttribute("skTyList", cdDtlService.selectList(new CdDtl("baumanTy")));
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return "clfd/prod/list";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/prod/list.json")
|
||||||
|
@ResponseBody
|
||||||
|
public HashMap<String, Object> clfdProdListJson(HttpServletRequest request, ProdSearch prodSearch) {
|
||||||
|
User user = (User) request.getSession().getAttribute("user");
|
||||||
|
HashMap<String, Object> result = new HashMap<>();
|
||||||
|
String[] prodTyArray = request.getParameterValues("prodTyArray[]");
|
||||||
|
|
||||||
|
if (prodTyArray != null) {
|
||||||
|
prodSearch.setProdTyList(new ArrayList(Arrays.asList(prodTyArray)));
|
||||||
|
}
|
||||||
|
|
||||||
|
prodSearch.setShowSt("Y");
|
||||||
|
if (user == null) {
|
||||||
|
result.put("prodList", clfdProdService.selectList(prodSearch));
|
||||||
|
} else {
|
||||||
|
result.put("prodList", clfdProdService.selectListWithLike(prodSearch, user.getUserId()));
|
||||||
|
}
|
||||||
|
result.put("result", "success");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/prod/dtl.do")
|
||||||
|
public String clfdProdDtlPage(HttpServletRequest request, HttpServletResponse response, Model model,
|
||||||
|
@RequestParam(value = "prod", required = false) Long prodId) {
|
||||||
|
|
||||||
|
User user = (User) request.getSession().getAttribute("user");
|
||||||
|
|
||||||
|
if (prodId == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
ProdSearch prodSearch = new ProdSearch();
|
||||||
|
prodSearch.setProdId(prodId);
|
||||||
|
Prod prod;
|
||||||
|
if (user == null) {
|
||||||
|
prod = clfdProdService.select(prodSearch);
|
||||||
|
} else {
|
||||||
|
prod = clfdProdService.selectWithLike(prodSearch, user.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prod == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clfdSiteService.visitClfdSite(request, response, model) == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
model.addAttribute("prodTyCdDtlList", cdDtlService.selectList(new CdDtl("prodTy")));
|
||||||
|
model.addAttribute("skTyList", cdDtlService.selectList(new CdDtl("baumanTy")));
|
||||||
|
model.addAttribute("prod", prod);
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return "clfd/prod/dtl";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/recommend/prod/list.json", method = RequestMethod.GET)
|
||||||
|
@ResponseBody
|
||||||
|
public HashMap<String, Object> recommendProductList(ProdSearch prodSearch) {
|
||||||
|
HashMap<String, Object> result = new HashMap<>();
|
||||||
|
result.put("productGbn", cdDtlService.selectList(new CdDtl("prodTy")));
|
||||||
|
result.put("recommendList", clfdProdService.selectList(prodSearch));
|
||||||
|
result.put("result", "success");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.prod.web;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.prod.service.ProdLikeService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.User;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class ProdLikeController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProdLikeService prodLikeService;
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/prod/like.json", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public HashMap<String, Object> prodLike(HttpServletRequest request,
|
||||||
|
@RequestParam(value = "prodId") String prodId,
|
||||||
|
@RequestParam(value = "like") Boolean like) {
|
||||||
|
HashMap<String, Object> result = new HashMap<>();
|
||||||
|
User user = (User) request.getSession().getAttribute("user");
|
||||||
|
if (user == null) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "회원만 이용 가능한 서비스입니다.");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (like) {
|
||||||
|
try {
|
||||||
|
prodLikeService.insert(Long.parseLong(prodId), user.getUserId());
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
prodLikeService.delete(Long.parseLong(prodId), user.getUserId());
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.put("result", "success");
|
||||||
|
result.put("like", like);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.site.service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.user.service.ClfdUserService;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.menu.model.Menu;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.menu.model.MenuConnHist;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.menu.service.MenuConnHistService;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.menu.service.MenuService;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.site.model.Site;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.site.service.SiteService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.util.HttpUtil;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.util.StrUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.web.servlet.LocaleResolver;
|
||||||
|
import org.springframework.web.servlet.support.RequestContextUtils;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ClfdSiteService {
|
||||||
|
|
||||||
|
@Resource (name="siteService")
|
||||||
|
private SiteService siteService;
|
||||||
|
|
||||||
|
@Resource (name="cmsMenuService")
|
||||||
|
private MenuService menuService;
|
||||||
|
|
||||||
|
@Resource (name="cmsMenuConnHistService")
|
||||||
|
private MenuConnHistService menuConnHistService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ClfdUserService clfdUserService;
|
||||||
|
|
||||||
|
public String visitClfdSite(HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||||
|
Site site = getSite(request, response, model);
|
||||||
|
model.addAttribute("menuList", menuService.selectJson(site.getSiteId()));
|
||||||
|
Menu menu = getMenu(site, request, model);
|
||||||
|
return forwardMenu(site, menu, model, request);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Site getSite(HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||||
|
Site result = null;
|
||||||
|
|
||||||
|
if (request != null && response != null && model != null) {
|
||||||
|
String servletPath = request.getServletPath();
|
||||||
|
String domain = request.getServerName();
|
||||||
|
if(request.getServerPort() != 80) {
|
||||||
|
domain += ":"+request.getServerPort();
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] urlArray = servletPath.split("/");
|
||||||
|
String contextPath = urlArray[1];
|
||||||
|
|
||||||
|
List<Site> siteList = siteService.selectJson();
|
||||||
|
|
||||||
|
/* 멀티 사이트 */
|
||||||
|
for(Site site : siteList) {
|
||||||
|
String[] domainArray = site.getDomain().split(",");
|
||||||
|
for(int i=0;i<domainArray.length;i++){
|
||||||
|
if(domain.equals(domainArray[i].trim()) && StrUtil.isEmpty(site.getStartUrl())) {
|
||||||
|
result = site;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Site site : siteList) {
|
||||||
|
String[] domainArray = site.getDomain().split(",");
|
||||||
|
for(int i=0;i<domainArray.length;i++){
|
||||||
|
/**
|
||||||
|
* 2021-02-15 홍석진
|
||||||
|
* 도메인이 '*' 일때는 도메인 판별 안하도록 변경
|
||||||
|
* 도메인 판별 기능은 보안을 위해 추후 사용
|
||||||
|
* ex) 도청내부에서만 접속 가능하도록 허용시킬 경우
|
||||||
|
* **/
|
||||||
|
if (StringUtils.isEmpty(site.getDomain()) || site.getDomain().equals("*")) {
|
||||||
|
if(contextPath.equals(site.getStartUrl())) {
|
||||||
|
result = site;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(domain.equals(domainArray[i].trim()) && contextPath.equals(site.getStartUrl())) {
|
||||||
|
result = site;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//사이트에 설정 된 언어에 따라 Locale변경
|
||||||
|
Locale locale = new Locale(result.getLang().getLangTp());
|
||||||
|
LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(request);
|
||||||
|
localeResolver.setLocale(request, response, locale);
|
||||||
|
|
||||||
|
//관련사이트 조회
|
||||||
|
//RelSiteSearch relSiteSearch = new RelSiteSearch();
|
||||||
|
//relSiteSearch.setSiteId (result.getSiteId ());
|
||||||
|
//model.addAttribute ("relSite",relsiteService.selectList(relSiteSearch));
|
||||||
|
|
||||||
|
model.addAttribute("currentSite", result);
|
||||||
|
model.addAttribute("siteList", siteList);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private Menu getMenu(Site site, HttpServletRequest request, Model model) {
|
||||||
|
Menu menu = null;
|
||||||
|
|
||||||
|
if (request != null && model != null) {
|
||||||
|
String servletPath = request.getServletPath();
|
||||||
|
if(!StrUtil.isEmpty(site.getStartUrl())) servletPath = servletPath.substring(site.getStartUrl().length()+1);
|
||||||
|
servletPath = servletPath.replace(".do", "");
|
||||||
|
servletPath = servletPath.substring(1);
|
||||||
|
|
||||||
|
menu = menuService.selectCurrentMenu(site.getSiteId(), servletPath);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 사이드 메뉴 정보 생성
|
||||||
|
*/
|
||||||
|
model.addAttribute("sideMenu", menuService.selectParentMenu(site.getSiteId(), menu));
|
||||||
|
}
|
||||||
|
return menu;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String forwardMenu(Site site, Menu menu, Model model, HttpServletRequest request) {
|
||||||
|
String viewName = null;
|
||||||
|
if (request != null && model != null) {
|
||||||
|
model.addAttribute("menu", menu);
|
||||||
|
//메뉴 접속 정보 저장
|
||||||
|
MenuConnHist menuConnHist = new MenuConnHist();
|
||||||
|
menuConnHist.setMenuId(menu.getMenuId());
|
||||||
|
menuConnHist.setMenuConnIp(HttpUtil.getClientIp(request));
|
||||||
|
menuConnHist.setRegId(clfdUserService.getUserId());
|
||||||
|
menuConnHistService.insert(menuConnHist); //메뉴 접속 정보 저장
|
||||||
|
System.out.println("menu.getMenuTp()=" + menu.getMenuTp());
|
||||||
|
|
||||||
|
|
||||||
|
String startUrl = site.getStartUrl();
|
||||||
|
|
||||||
|
if (startUrl.equals("clfd")) {
|
||||||
|
// CLFD 사이트
|
||||||
|
viewName = getClfdViewName(menu, startUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return viewName;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getClfdViewName(Menu menu, String startUrl) {
|
||||||
|
/**
|
||||||
|
* 2021-02-16 홍석진
|
||||||
|
* 현재 clfd 사이트 메뉴 타입은 pgm만 사용
|
||||||
|
*/
|
||||||
|
if("pgm".equals(menu.getMenuTp().trim())){
|
||||||
|
if(menu.getUpperMenuId() != null){
|
||||||
|
return startUrl +"/"+menu.getUpperMenu().getMenuUrl()+"/"+menu.getMenuUrl();
|
||||||
|
}else{
|
||||||
|
return startUrl + "/"+menu.getMenuUrl();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.sms.service;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.sms.vo.SmsState;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.sms.vo.SmsVo;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SmsService {
|
||||||
|
|
||||||
|
@Value("${sms.api.url}")
|
||||||
|
private String smsApiUrl;
|
||||||
|
|
||||||
|
@Value("${sms.api.key}")
|
||||||
|
private String smsApiKey;
|
||||||
|
|
||||||
|
@Value("${sms.api.sendNumber}")
|
||||||
|
private String smsApiSendNumber;
|
||||||
|
|
||||||
|
public SmsVo sendSmsAuthKey(String receiveNumber) {
|
||||||
|
String message = "인증번호 전송에 실패하였습니다.";
|
||||||
|
try {
|
||||||
|
if (StringUtils.isEmpty(receiveNumber)) {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
|
||||||
|
String smsAuthKey = getSmsAuthKey();
|
||||||
|
String msg = "[컬러푸드] 인증번호 ["+smsAuthKey+"]를 입력해 주세요.";
|
||||||
|
URL url = new URL(smsApiUrl);
|
||||||
|
Map<String, Object> params = new LinkedHashMap<>();
|
||||||
|
params.put("api_key", smsApiKey);
|
||||||
|
params.put("msg", msg);
|
||||||
|
params.put("callback", smsApiSendNumber);
|
||||||
|
params.put("dstaddr", receiveNumber);
|
||||||
|
params.put("send_reserve", "0");
|
||||||
|
|
||||||
|
StringBuilder postData = new StringBuilder();
|
||||||
|
for (Map.Entry<String, Object> param : params.entrySet()) {
|
||||||
|
if (postData.length() != 0) postData.append('&');
|
||||||
|
postData.append(URLEncoder.encode(param.getKey(), "UTF-8"));
|
||||||
|
postData.append('=');
|
||||||
|
postData.append(URLEncoder.encode(String.valueOf(param.getValue()), "UTF-8"));
|
||||||
|
}
|
||||||
|
byte[] postDataBytes = postData.toString().getBytes("UTF-8");
|
||||||
|
|
||||||
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||||
|
conn.setRequestMethod("POST");
|
||||||
|
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
conn.setRequestProperty("Content-Length", String.valueOf(postDataBytes.length));
|
||||||
|
conn.setDoOutput(true);
|
||||||
|
|
||||||
|
conn.getOutputStream().write(postDataBytes);
|
||||||
|
|
||||||
|
Reader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int c; (c = in.read()) >= 0; ) {
|
||||||
|
sb.append((char) c);
|
||||||
|
}
|
||||||
|
String response = sb.toString();
|
||||||
|
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
JsonNode root = mapper.readTree(response);
|
||||||
|
String returnCode = root.get("result").asText();
|
||||||
|
if (returnCode.equals("100")) {
|
||||||
|
return SmsVo.builder()
|
||||||
|
.smsState(SmsState.SUCCESS)
|
||||||
|
.smsAuthKey(smsAuthKey)
|
||||||
|
.message("인증번호를 전송하였습니다.")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
message = "휴대폰 번호를 입력해주세요.";
|
||||||
|
}
|
||||||
|
|
||||||
|
return SmsVo.builder()
|
||||||
|
.smsState(SmsState.FAIL)
|
||||||
|
.message(message)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMS 인증 번호를 생성한다.
|
||||||
|
* @return SMS 인증번호
|
||||||
|
*/
|
||||||
|
public String getSmsAuthKey() {
|
||||||
|
int AUTH_KEY_LENGTH = 6;
|
||||||
|
Random rand = new Random();
|
||||||
|
String numStr = "";
|
||||||
|
for(int i=0;i<AUTH_KEY_LENGTH;i++) {
|
||||||
|
String ran = Integer.toString(rand.nextInt(9)+1);
|
||||||
|
numStr += ran;
|
||||||
|
}
|
||||||
|
return numStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.sms.vo;
|
||||||
|
|
||||||
|
public enum SmsState {
|
||||||
|
SUCCESS, FAIL
|
||||||
|
}
|
||||||
16
src/main/java/kr/co/jinwoosi/clfd/clfd/sms/vo/SmsVo.java
Normal file
16
src/main/java/kr/co/jinwoosi/clfd/clfd/sms/vo/SmsVo.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.sms.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ToString
|
||||||
|
@NoArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
public class SmsVo {
|
||||||
|
private SmsState smsState;
|
||||||
|
private String smsAuthKey;
|
||||||
|
private String message;
|
||||||
|
}
|
||||||
@@ -0,0 +1,176 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.sms.web;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.sms.service.SmsService;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.sms.vo.SmsState;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.sms.vo.SmsVo;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.user.service.ClfdUserService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.User;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class SmsAuthController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SmsService smsService;
|
||||||
|
@Autowired
|
||||||
|
private ClfdUserService clfdUserService;
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/sms/send.json", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, String> smsSend(HttpServletRequest request, @RequestParam("phone") String phone) {
|
||||||
|
Map<String, String> result = new HashMap<String, String>();
|
||||||
|
HttpSession session = request.getSession();
|
||||||
|
|
||||||
|
SmsVo smsVo = smsService.sendSmsAuthKey(phone);
|
||||||
|
if (smsVo.getSmsState() == SmsState.SUCCESS) {
|
||||||
|
session.setAttribute("smsAuthKey", smsVo.getSmsAuthKey());
|
||||||
|
session.setAttribute("phone", phone);
|
||||||
|
result.put("result", "success");
|
||||||
|
} else {
|
||||||
|
result.put("result", "fail");
|
||||||
|
}
|
||||||
|
result.put("message", smsVo.getMessage());
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/sms/check.json", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, String> smsCheck(HttpServletRequest request, @RequestParam("smsAuthKey") String smsAuthKey,
|
||||||
|
@RequestParam("phone") String phone) {
|
||||||
|
Map<String, String> result = new HashMap<String, String>();
|
||||||
|
HttpSession session = request.getSession();
|
||||||
|
String sessionSmsAuthKey = (String) session.getAttribute("smsAuthKey");
|
||||||
|
String sessionPhone = (String) session.getAttribute("phone");
|
||||||
|
|
||||||
|
if (sessionSmsAuthKey != null && sessionSmsAuthKey.equals(smsAuthKey) &&
|
||||||
|
sessionPhone != null && sessionPhone.equals(phone)) {
|
||||||
|
result.put("result", "success");
|
||||||
|
result.put("message", "인증이 완료되었습니다.");
|
||||||
|
} else if (sessionPhone == null || !sessionPhone.equals(phone)) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "인증 휴대폰 번호가 다릅니다.");
|
||||||
|
} else {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "인증 번호가 다릅니다.");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/sms/find/id.json", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> smsFindId(HttpServletRequest request, @RequestParam("smsAuthKey") String smsAuthKey,
|
||||||
|
@RequestParam("phone") String phone) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
HttpSession session = request.getSession();
|
||||||
|
String sessionSmsAuthKey = (String) session.getAttribute("smsAuthKey");
|
||||||
|
String sessionPhone = (String) session.getAttribute("phone");
|
||||||
|
|
||||||
|
if (sessionSmsAuthKey != null && sessionSmsAuthKey.equals(smsAuthKey) &&
|
||||||
|
sessionPhone != null && sessionPhone.equals(phone)) {
|
||||||
|
|
||||||
|
List<String> findIds = clfdUserService.findLoginIdByPhone(phone);
|
||||||
|
if (findIds.size() == 0) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "해당 휴대폰 번호로 가입된 아이디가 없습니다.");
|
||||||
|
} else {
|
||||||
|
result.put("result", "success");
|
||||||
|
result.put("data", findIds);
|
||||||
|
result.put("message", "아이디 찾기를 완료하였습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (sessionPhone == null || !sessionPhone.equals(phone)) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "인증 휴대폰 번호가 다릅니다.");
|
||||||
|
} else {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "인증 번호가 다릅니다.");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/sms/find/pw.json", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> smsFindPw(HttpServletRequest request,
|
||||||
|
@RequestParam("smsAuthKey") String smsAuthKey,
|
||||||
|
@RequestParam("phone") String phone,
|
||||||
|
@RequestParam("loginId") String loginId
|
||||||
|
) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
HttpSession session = request.getSession();
|
||||||
|
String sessionSmsAuthKey = (String) session.getAttribute("smsAuthKey");
|
||||||
|
String sessionPhone = (String) session.getAttribute("phone");
|
||||||
|
|
||||||
|
if (sessionSmsAuthKey != null && sessionSmsAuthKey.equals(smsAuthKey) &&
|
||||||
|
sessionPhone != null && sessionPhone.equals(phone)) {
|
||||||
|
|
||||||
|
Map<String, Object> pwResult = clfdUserService.findPasswordForSms(loginId, phone);
|
||||||
|
Boolean isFind = (Boolean) pwResult.get("isFind");
|
||||||
|
if (!isFind) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", pwResult.get("message"));
|
||||||
|
} else {
|
||||||
|
result.put("result", "success");
|
||||||
|
result.put("data", pwResult);
|
||||||
|
result.put("message", pwResult.get("message"));
|
||||||
|
}
|
||||||
|
} else if (sessionPhone == null || !sessionPhone.equals(phone)) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "인증 휴대폰 번호가 다릅니다.");
|
||||||
|
} else {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "인증 번호가 다릅니다.");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/sms/update-phone.json", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, String> smsUpdatePhone(HttpServletRequest request,
|
||||||
|
@RequestParam("smsAuthKey") String smsAuthKey,
|
||||||
|
@RequestParam("phone") String phone) {
|
||||||
|
Map<String, String> result = new HashMap<String, String>();
|
||||||
|
User loginUser = (User) request.getSession().getAttribute("user");
|
||||||
|
HttpSession session = request.getSession();
|
||||||
|
String sessionSmsAuthKey = (String) session.getAttribute("smsAuthKey");
|
||||||
|
String sessionPhone = (String) session.getAttribute("phone");
|
||||||
|
|
||||||
|
if (loginUser == null || StringUtils.isEmpty(loginUser.getUserId())) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "로그인 확인에 실패하였습니다.");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sessionSmsAuthKey != null && sessionSmsAuthKey.equals(smsAuthKey) &&
|
||||||
|
sessionPhone != null && sessionPhone.equals(phone)) {
|
||||||
|
User updateUser = new User();
|
||||||
|
updateUser.setUserId(loginUser.getUserId());
|
||||||
|
updateUser.setPhone(phone);
|
||||||
|
try {
|
||||||
|
clfdUserService.updateUser(updateUser);
|
||||||
|
result.put("result", "success");
|
||||||
|
result.put("message", "휴대폰 번호를 수정하였습니다.");
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
result.put("result", "success");
|
||||||
|
result.put("message", "인증은 하였지만 휴대폰 번호 수정에 실패하였습니다.");
|
||||||
|
}
|
||||||
|
} else if (sessionPhone == null || !sessionPhone.equals(phone)) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "인증 휴대폰 번호가 다릅니다.");
|
||||||
|
} else {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "인증 번호가 다릅니다.");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,350 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.user.service;
|
||||||
|
|
||||||
|
import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.mail.MailService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.mapper.UserMapper;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.User;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.UserRole;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.UserSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.service.UserRoleService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.service.UserService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.util.StrUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ClfdUserService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
@Autowired
|
||||||
|
private UserRoleService userRoleService;
|
||||||
|
@Autowired
|
||||||
|
private UserMapper userMapper;
|
||||||
|
@Autowired
|
||||||
|
private PasswordEncoder passwordEncoder;
|
||||||
|
@Autowired
|
||||||
|
private MailService mailService;
|
||||||
|
|
||||||
|
public Map<String, Object> selectUser(UserSearch userSearch) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
User user = userMapper.select(userSearch);
|
||||||
|
|
||||||
|
if (user == null) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "사용자를 찾을 수 없습니다.");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
UserRole userRole = new UserRole();
|
||||||
|
userRole.setUserId(user.getUserId());
|
||||||
|
userRole = userRoleService.select(userRole);
|
||||||
|
|
||||||
|
result.put("result", "success");
|
||||||
|
result.put("user", user);
|
||||||
|
result.put("role", userRole.getRoleAuth());
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateUser(User user) {
|
||||||
|
userMapper.update(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> updatePwd(Long userId, String userLoginId, String password, String newPassword) throws Exception {
|
||||||
|
Map<String, String> result = new HashMap<>();
|
||||||
|
|
||||||
|
String encryptPassword = StrUtil.encryptSha512(password, userLoginId);
|
||||||
|
String encryptNewPassword = StrUtil.encryptSha512(newPassword, userLoginId);
|
||||||
|
|
||||||
|
if (userPwdCheck(new UserSearch(userId, encryptPassword)) < 1) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "기존 비밀번호가 일치하지 않습니다.");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encryptPassword.equals(encryptNewPassword)) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "이전 비밀번호와 같은 비밀번호 입니다.");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
User user = new User();
|
||||||
|
user.setUserId(userId);
|
||||||
|
user.setUpdId(userId);
|
||||||
|
user.setUserPwd(encryptNewPassword);
|
||||||
|
|
||||||
|
try {
|
||||||
|
updateUser(user);
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "비밀번호를 변경하는 중 오류가 발생하였습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
result.put("result", "success");
|
||||||
|
result.put("message", "비밀번호가 변경되었습니다.");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int userPwdCheck(UserSearch userSearch) {
|
||||||
|
return userMapper.userPwdCheck(userSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void join(User user) {
|
||||||
|
UserSearch userSearch = new UserSearch();
|
||||||
|
userSearch.setUserLoginId(user.getUserLoginId());
|
||||||
|
|
||||||
|
if (userService.checkIdDuplicate(userSearch) > 0) {
|
||||||
|
throw new RuntimeException("사용자를 등록하는 도중 오류가 발생하였습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SMS 인증 일 경우 authStCd를 1로 처리
|
||||||
|
*/
|
||||||
|
user.setAuthStCd("1");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 이메일 인증 부분 주석처리
|
||||||
|
*/
|
||||||
|
// String authKey = StrUtil.getRandomPassword(16);
|
||||||
|
// String authCode = passwordEncoder.encode(authKey);
|
||||||
|
// user.setAuthKey(authKey);
|
||||||
|
|
||||||
|
userService.insert(user);
|
||||||
|
|
||||||
|
Long userId = user.getUserId();
|
||||||
|
|
||||||
|
UserRole userRole = new UserRole();
|
||||||
|
userRole.setUserId(userId);
|
||||||
|
String userTyCd = user.getUserTyCd();
|
||||||
|
|
||||||
|
if (userTyCd != null) {
|
||||||
|
if (userTyCd.equals("U")) {
|
||||||
|
userRole.setRoleAuth("ROLE_USER");
|
||||||
|
userRoleService.insert(userRole);
|
||||||
|
} else if (userTyCd.equals("M")) {
|
||||||
|
userRole.setRoleAuth("ROLE_MANAGER");
|
||||||
|
userRoleService.insert(userRole);
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("사용자 타입 코드가 명시되지 않았습니다.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("사용자 타입 코드가 명시되지 않았습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 이메일 인증 부분 주석처리
|
||||||
|
*/
|
||||||
|
// String email = null;
|
||||||
|
// if (userTyCd.equals("J")) {
|
||||||
|
// email = user.getManagerEmail();
|
||||||
|
// } else if (userTyCd.equals("U")) {
|
||||||
|
// email = user.getEmail();
|
||||||
|
// }
|
||||||
|
// if (email != null) {
|
||||||
|
// mailService.gmailSend(
|
||||||
|
// email,
|
||||||
|
// MailService.EmailTitle.JOIN_AUTH.getTitle(),
|
||||||
|
// mailService.getLoginMailText(user.getUserLoginId(), authCode)
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 접속 사용자 아이디(번호)를 가져 온다.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Long getUserId() {
|
||||||
|
if ("anonymousUser".equals(EgovUserDetailsHelper.getAuthenticatedUser())) return null;
|
||||||
|
|
||||||
|
User user = (User) EgovUserDetailsHelper.getAuthenticatedUser();
|
||||||
|
if (user != null) {
|
||||||
|
return user.getUserId();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 접속 사용자의 로그인 아이디를 가져온다.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getUserLoginId() {
|
||||||
|
User user =
|
||||||
|
(User) EgovUserDetailsHelper.getAuthenticatedUser();
|
||||||
|
if (user != null) {
|
||||||
|
return user.getUserLoginId();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 접속한 사용자의 이름을 가져온다.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getUserName() {
|
||||||
|
User user =
|
||||||
|
(User) EgovUserDetailsHelper.getAuthenticatedUser();
|
||||||
|
if (user != null) {
|
||||||
|
return user.getUserNm();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 이메일 인증을 처리
|
||||||
|
*
|
||||||
|
* @return 이메일 인증에 성공하면 true, 실패하면 false
|
||||||
|
*/
|
||||||
|
public boolean emailAuth(String id, String authCode) {
|
||||||
|
UserSearch userSearch = new UserSearch();
|
||||||
|
userSearch.setUserLoginId(id);
|
||||||
|
User user = userMapper.select(userSearch);
|
||||||
|
// 인증할 사용자가 없는 경우
|
||||||
|
if (user == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (user.getAuthStCd() == null) {
|
||||||
|
if (passwordEncoder.matches(user.getAuthKey(), authCode)) {
|
||||||
|
User updateUser = new User();
|
||||||
|
updateUser.setUserId(user.getUserId());
|
||||||
|
updateUser.setUserLoginId(id);
|
||||||
|
updateUser.setAuthStCd("1");
|
||||||
|
userMapper.update(updateUser);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (user.getAuthStCd().equals("1")) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 아이디 찾기를 처리 (휴대폰 인증 시 사용)
|
||||||
|
*
|
||||||
|
* @return 찾은 아이디 목록을 반환
|
||||||
|
*/
|
||||||
|
public List<String> findLoginIdByPhone(String phone) {
|
||||||
|
UserSearch userSearch = new UserSearch();
|
||||||
|
userSearch.setFindIdByPhoneFlag(true);
|
||||||
|
userSearch.setPhone(phone);
|
||||||
|
List<User> users = userMapper.selectList(userSearch);
|
||||||
|
List<String> loginIdList = users.stream().map(User::getUserLoginId).collect(Collectors.toList());
|
||||||
|
return loginIdList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 비밀번호 찾기를 처리 (휴대폰 인증 시 사용)
|
||||||
|
*
|
||||||
|
* @return Map<String, Object>
|
||||||
|
* isFind: true, false
|
||||||
|
* loginId: -
|
||||||
|
* password: -
|
||||||
|
* message: -
|
||||||
|
*/
|
||||||
|
public Map<String, Object> findPasswordForSms(String loginId, String phone) {
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
UserSearch userSearch = new UserSearch();
|
||||||
|
userSearch.setFindPwByPhoneAndIdFlag(true);
|
||||||
|
userSearch.setPhone(phone);
|
||||||
|
userSearch.setUserLoginId(loginId);
|
||||||
|
List<User> users = userMapper.selectList(userSearch);
|
||||||
|
if (users.size() == 0) {
|
||||||
|
result.put("isFind", Boolean.FALSE);
|
||||||
|
result.put("message", "아이디와 휴대폰 번호를 확인하세요.");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
User user = users.get(0);
|
||||||
|
String tempPassword = StrUtil.getRandomPassword(10);
|
||||||
|
|
||||||
|
String encryptPassword = null;
|
||||||
|
try {
|
||||||
|
encryptPassword = StrUtil.encryptSha512(tempPassword, user.getUserLoginId());
|
||||||
|
} catch (Exception e) {
|
||||||
|
result.put("isFind", Boolean.FALSE);
|
||||||
|
result.put("message", "비밀번호 찾기중 문제가 발생하였습니다.");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result.put("isFind", Boolean.TRUE);
|
||||||
|
result.put("loginId", user.getUserLoginId());
|
||||||
|
result.put("password", tempPassword);
|
||||||
|
result.put("message", "비밀번호 찾기를 완료하였습니다.");
|
||||||
|
|
||||||
|
User updateUser = new User();
|
||||||
|
Long userId = user.getUserId();
|
||||||
|
updateUser.setUserId(userId);
|
||||||
|
updateUser.setUpdId(userId);
|
||||||
|
updateUser.setUserPwd(encryptPassword);
|
||||||
|
updateUser(updateUser);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 아이디 찾기를 처리 (이메일 인증 시 사용)
|
||||||
|
*
|
||||||
|
* @return 아이디를 찾으면 true, 아이디를 못찾으면 false
|
||||||
|
*/
|
||||||
|
public boolean findIdByEmail(String email) {
|
||||||
|
UserSearch userSearch = new UserSearch();
|
||||||
|
userSearch.setEmail(email);
|
||||||
|
List<User> users = userMapper.selectList(userSearch);
|
||||||
|
if (users.size() == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
List<String> loginIdList = users.stream().map(User::getUserLoginId).collect(Collectors.toList());
|
||||||
|
mailService.gmailSend(
|
||||||
|
email,
|
||||||
|
MailService.EmailTitle.FIND_ID.getTitle(),
|
||||||
|
mailService.getFindIdText(loginIdList)
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 비밀번호 찾기를 처리 (이메일 인증 시 사용)
|
||||||
|
*
|
||||||
|
* @return 입력한 아이디가 존재하고 해당 아이디의 이메일과 입력한 이메일이 동일하면 true, 아이디를 못찾거나 이메일이 다르면 false
|
||||||
|
*/
|
||||||
|
public boolean findPassword(String userLoginId, String email) throws Exception {
|
||||||
|
UserSearch userSearch = new UserSearch();
|
||||||
|
userSearch.setUserLoginId(userLoginId);
|
||||||
|
List<User> userLoginIdList = userMapper.selectList(userSearch);
|
||||||
|
if (userLoginIdList.size() == 0) {
|
||||||
|
return false;
|
||||||
|
} else if (!userLoginIdList.get(0).getEmail().equals(email)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String tempPassword = StrUtil.getRandomPassword(10);
|
||||||
|
mailService.gmailSend(
|
||||||
|
email,
|
||||||
|
MailService.EmailTitle.FIND_PW.getTitle(),
|
||||||
|
mailService.getFindPasswordText(tempPassword)
|
||||||
|
);
|
||||||
|
|
||||||
|
String encryptPassword = StrUtil.encryptSha512(tempPassword, userLoginId);
|
||||||
|
User user = new User();
|
||||||
|
Long userId = userLoginIdList.get(0).getUserId();
|
||||||
|
user.setUserId(userId);
|
||||||
|
user.setUpdId(userId);
|
||||||
|
user.setUserPwd(encryptPassword);
|
||||||
|
updateUser(user);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,245 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.user.web;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.site.service.ClfdSiteService;
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.user.service.ClfdUserService;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.company.model.Company;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.company.service.CompanyService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.cd.model.CdDtl;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.cd.service.CdDtlService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.User;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.UserSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.service.UserService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class ClfdUserController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ClfdUserService clfdUserService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ClfdSiteService clfdSiteService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompanyService companyService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CdDtlService cdDtlService;
|
||||||
|
|
||||||
|
@RequestMapping("/clfd/user/join.do")
|
||||||
|
public String joinPage(HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||||
|
if (clfdUserService.getUserId() != null) {
|
||||||
|
return "redirect:/";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clfdSiteService.visitClfdSite(request, response, model) == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return "clfd/user/join";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/clfd/user/joinCorp.do")
|
||||||
|
public String joinCorpPage(HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||||
|
model.addAttribute("companyGbnList", cdDtlService.selectList(new CdDtl("companyGbn")));
|
||||||
|
if (clfdUserService.getUserId() != null) {
|
||||||
|
return "redirect:/";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clfdSiteService.visitClfdSite(request, response, model) == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return "clfd/user/joinCorp";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/clfd/pr/myPage.do")
|
||||||
|
public String myPage(HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||||
|
User user = (User) request.getSession().getAttribute("user");
|
||||||
|
if (clfdSiteService.visitClfdSite(request, response, model) == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
model.addAttribute("user", user);
|
||||||
|
return "clfd/pr/myPage";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/pr/pwd/update.json", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, String> pwdUpdate(HttpServletRequest request, @RequestBody HashMap<String, Object> requestParam) throws Exception {
|
||||||
|
Map<String, String> result = new HashMap<String, String>();
|
||||||
|
|
||||||
|
User sessionUser = (User) request.getSession().getAttribute("user");
|
||||||
|
if (sessionUser == null) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "사용자를 찾을 수 없습니다.");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Long userId = sessionUser.getUserId();
|
||||||
|
String userLoginId = sessionUser.getUserLoginId();
|
||||||
|
String password = (String) requestParam.get("password");
|
||||||
|
String newPassword = (String) requestParam.get("newPassword");
|
||||||
|
|
||||||
|
return clfdUserService.updatePwd(userId, userLoginId, password, newPassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/clfd/pr/myPage.json")
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> myPageApi(HttpServletRequest request) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
User sessionUser = (User) request.getSession().getAttribute("user");
|
||||||
|
if (sessionUser == null) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "사용자를 찾을 수 없습니다.");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return clfdUserService.selectUser(new UserSearch(sessionUser.getUserId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/clfd/pr/myPage/update.json")
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, String> myPageUpdateApi(HttpServletRequest request, User user) {
|
||||||
|
Map<String, String> result = new HashMap<String, String>();
|
||||||
|
User sessionUser = (User) request.getSession().getAttribute("user");
|
||||||
|
if (sessionUser == null) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "사용자를 찾을 수 없습니다.");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
user.setUpdId(sessionUser.getUserId());
|
||||||
|
user.setUserId(sessionUser.getUserId());
|
||||||
|
clfdUserService.updateUser(user);
|
||||||
|
|
||||||
|
result.put("result", "success");
|
||||||
|
result.put("message", "정보가 수정되었습니다.");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/user/join/duplicate.json", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, String> checkIdDuplicate(UserSearch userSearch) {
|
||||||
|
Map<String, String> result = new HashMap<String, String>();
|
||||||
|
if (userService.checkIdDuplicate(userSearch) > 0) {
|
||||||
|
result.put("result", "exist");
|
||||||
|
result.put("message", "사용 중인 아이디입니다. 다른 아이디를 입력해주세요.");
|
||||||
|
} else {
|
||||||
|
result.put("result", "nonExist");
|
||||||
|
result.put("message", "사용 가능합니다.");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/user/join/join.json", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> join(HttpServletRequest request, User user) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SMS 인증 시 적용
|
||||||
|
*/
|
||||||
|
HttpSession session = request.getSession();
|
||||||
|
String sessionSmsAuthKey = (String) session.getAttribute("smsAuthKey");
|
||||||
|
if (sessionSmsAuthKey == null && !sessionSmsAuthKey.equals(user.getSmsAuthKey())) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "인증 번호가 다릅니다.");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
user.setUserTyCd("U");
|
||||||
|
clfdUserService.join(user);
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/user/join/joinCorp.json", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> joinCorp(HttpServletRequest request, User user, Company company) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SMS 인증 시 적용
|
||||||
|
*/
|
||||||
|
HttpSession session = request.getSession();
|
||||||
|
String sessionSmsAuthKey = (String) session.getAttribute("smsAuthKey");
|
||||||
|
if (sessionSmsAuthKey == null && !sessionSmsAuthKey.equals(user.getSmsAuthKey())) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "인증 번호가 다릅니다.");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
user.setUserTyCd("M");
|
||||||
|
companyService.insert(company);
|
||||||
|
clfdUserService.join(user);
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/clfd/user/findId.do")
|
||||||
|
public String findId(HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||||
|
if (clfdUserService.getUserId() != null) {
|
||||||
|
return "redirect:/";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clfdSiteService.visitClfdSite(request, response, model) == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return "clfd/user/findId";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/clfd/user/findPassword.do")
|
||||||
|
public String findPassword(HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||||
|
if (clfdUserService.getUserId() != null) {
|
||||||
|
return "redirect:/";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clfdSiteService.visitClfdSite(request, response, model) == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return "clfd/user/findPassword";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/clfd/company/list.json", method = RequestMethod.GET)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> list(Company company) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
result.put("data", companyService.select(company));
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.user.web;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.clfd.user.service.ClfdUserService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class MailAuthController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ClfdUserService clfdUserService;
|
||||||
|
|
||||||
|
@RequestMapping(value="/clfd/join/auth.json", method= RequestMethod.GET)
|
||||||
|
@ResponseBody
|
||||||
|
public String joinAuth(@RequestParam("id") String id, @RequestParam("authCode") String authCode) {
|
||||||
|
boolean isAuth = false;
|
||||||
|
try {
|
||||||
|
isAuth = clfdUserService.emailAuth(id, authCode);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return "처리중 예외가 발생하였습니다.";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isAuth) {
|
||||||
|
return "인증이 완료되었습니다.";
|
||||||
|
} else {
|
||||||
|
return "인증값이 올바르지 않습니다.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 이메일 인증시 아이디 찾기
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/clfd/find/id.json", method = RequestMethod.GET)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, String> findId(@RequestParam("email") String email) {
|
||||||
|
Map<String, String> result = new HashMap<String, String>();
|
||||||
|
boolean isFindId = clfdUserService.findIdByEmail(email);
|
||||||
|
|
||||||
|
if (isFindId) {
|
||||||
|
result.put("result", "success");
|
||||||
|
result.put("message", "해당 이메일로 가입한 아이디를 보내드렸습니다.");
|
||||||
|
} else {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "등록되지 않은 이메일입니다.");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 이메일 인증시 비밀번호 찾기
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/clfd/find/password.json", method = RequestMethod.GET)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, String> findPassword(@RequestParam("userLoginId") String userLoginId, @RequestParam("email") String email) throws Exception {
|
||||||
|
Map<String, String> result = new HashMap<String, String>();
|
||||||
|
boolean isFindPassword = clfdUserService.findPassword(userLoginId, email);
|
||||||
|
|
||||||
|
if (isFindPassword) {
|
||||||
|
result.put("result", "success");
|
||||||
|
result.put("message", "해당 이메일로 임시 비밀번호를 보내드렸습니다.");
|
||||||
|
} else {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "아이디나 이메일 정보를 확인해주세요.");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.util;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||||
|
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
public class LocalDateTimeDeserializer extends JsonDeserializer<LocalDateTime> {
|
||||||
|
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LocalDateTime deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
|
||||||
|
return LocalDateTime.parse(jsonParser.getText(), DATE_FORMAT);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.clfd.util;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||||
|
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
public class LocalDateTimeSerializer extends JsonSerializer<LocalDateTime> {
|
||||||
|
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(LocalDateTime localDateTime, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
|
||||||
|
jsonGenerator.writeString(localDateTime.format(DATE_FORMAT));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.banner.mapper;
|
||||||
|
|
||||||
|
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.banner.model.Banner;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.banner.model.BannerSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.mapper.BaseMapper;
|
||||||
|
|
||||||
|
@Mapper (value="bannerMapper")
|
||||||
|
public interface BannerMapper extends BaseMapper<Banner, BannerSearch> {
|
||||||
|
|
||||||
|
}
|
||||||
103
src/main/java/kr/co/jinwoosi/clfd/conts/banner/model/Banner.java
Normal file
103
src/main/java/kr/co/jinwoosi/clfd/conts/banner/model/Banner.java
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.banner.model;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.model.BaseModel;
|
||||||
|
|
||||||
|
public class Banner extends BaseModel{
|
||||||
|
|
||||||
|
private Long bannerId;
|
||||||
|
private String bannerTp;
|
||||||
|
private String bannerNm;
|
||||||
|
private String bannerAlt;
|
||||||
|
private String linkUrl;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date startDt;
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date endDt;
|
||||||
|
|
||||||
|
private Long fileId;
|
||||||
|
private Long siteId;
|
||||||
|
private Boolean useSt;
|
||||||
|
|
||||||
|
private String bannerTpNm;
|
||||||
|
private String bannerTpLabel;
|
||||||
|
|
||||||
|
public Long getBannerId() {
|
||||||
|
return bannerId;
|
||||||
|
}
|
||||||
|
public void setBannerId(Long bannerId) {
|
||||||
|
this.bannerId = bannerId;
|
||||||
|
}
|
||||||
|
public String getBannerTp() {
|
||||||
|
return bannerTp;
|
||||||
|
}
|
||||||
|
public void setBannerTp(String bannerTp) {
|
||||||
|
this.bannerTp = bannerTp;
|
||||||
|
}
|
||||||
|
public String getBannerNm() {
|
||||||
|
return bannerNm;
|
||||||
|
}
|
||||||
|
public void setBannerNm(String bannerNm) {
|
||||||
|
this.bannerNm = bannerNm;
|
||||||
|
}
|
||||||
|
public String getBannerAlt() {
|
||||||
|
return bannerAlt;
|
||||||
|
}
|
||||||
|
public void setBannerAlt(String bannerAlt) {
|
||||||
|
this.bannerAlt = bannerAlt;
|
||||||
|
}
|
||||||
|
public String getLinkUrl() {
|
||||||
|
return linkUrl;
|
||||||
|
}
|
||||||
|
public void setLinkUrl(String linkUrl) {
|
||||||
|
this.linkUrl = linkUrl;
|
||||||
|
}
|
||||||
|
public Date getStartDt() {
|
||||||
|
return startDt;
|
||||||
|
}
|
||||||
|
public void setStartDt(Date startDt) {
|
||||||
|
this.startDt = startDt;
|
||||||
|
}
|
||||||
|
public Date getEndDt() {
|
||||||
|
return endDt;
|
||||||
|
}
|
||||||
|
public void setEndDt(Date endDt) {
|
||||||
|
this.endDt = endDt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getFileId() {
|
||||||
|
return fileId;
|
||||||
|
}
|
||||||
|
public void setFileId(Long fileId) {
|
||||||
|
this.fileId = fileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getSiteId() {
|
||||||
|
return siteId;
|
||||||
|
}
|
||||||
|
public void setSiteId(Long siteId) {
|
||||||
|
this.siteId = siteId;
|
||||||
|
}
|
||||||
|
public Boolean getUseSt() {
|
||||||
|
return useSt;
|
||||||
|
}
|
||||||
|
public void setUseSt(Boolean useSt) {
|
||||||
|
this.useSt = useSt;
|
||||||
|
}
|
||||||
|
public String getBannerTpNm() {
|
||||||
|
return bannerTpNm;
|
||||||
|
}
|
||||||
|
public void setBannerTpNm(String bannerTpNm) {
|
||||||
|
this.bannerTpNm = bannerTpNm;
|
||||||
|
}
|
||||||
|
public String getBannerTpLabel() {
|
||||||
|
return bannerTpLabel;
|
||||||
|
}
|
||||||
|
public void setBannerTpLabel(String bannerTpLabel) {
|
||||||
|
this.bannerTpLabel = bannerTpLabel;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.banner.model;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
public class BannerSearch extends Banner{
|
||||||
|
|
||||||
|
private List<Long> bannerIdIn;
|
||||||
|
private String bannerNmLike;
|
||||||
|
private String linkUrlLike;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date startDtThanOrEquals;
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date startDtLessOrEquals;
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date endDtThanOrEquals;
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date endDtLessOrEquals;
|
||||||
|
|
||||||
|
public List<Long> getBannerIdIn() {
|
||||||
|
return bannerIdIn;
|
||||||
|
}
|
||||||
|
public void setBannerIdIn(List<Long> bannerIdIn) {
|
||||||
|
this.bannerIdIn = bannerIdIn;
|
||||||
|
}
|
||||||
|
public String getBannerNmLike() {
|
||||||
|
return bannerNmLike;
|
||||||
|
}
|
||||||
|
public void setBannerNmLike(String bannerNmLike) {
|
||||||
|
this.bannerNmLike = bannerNmLike;
|
||||||
|
}
|
||||||
|
public String getLinkUrlLike() {
|
||||||
|
return linkUrlLike;
|
||||||
|
}
|
||||||
|
public void setLinkUrlLike(String linkUrlLike) {
|
||||||
|
this.linkUrlLike = linkUrlLike;
|
||||||
|
}
|
||||||
|
public Date getStartDtThanOrEquals() {
|
||||||
|
return startDtThanOrEquals;
|
||||||
|
}
|
||||||
|
public void setStartDtThanOrEquals(Date startDtThanOrEquals) {
|
||||||
|
this.startDtThanOrEquals = startDtThanOrEquals;
|
||||||
|
}
|
||||||
|
public Date getStartDtLessOrEquals() {
|
||||||
|
return startDtLessOrEquals;
|
||||||
|
}
|
||||||
|
public void setStartDtLessOrEquals(Date startDtLessOrEquals) {
|
||||||
|
this.startDtLessOrEquals = startDtLessOrEquals;
|
||||||
|
}
|
||||||
|
public Date getEndDtThanOrEquals() {
|
||||||
|
return endDtThanOrEquals;
|
||||||
|
}
|
||||||
|
public void setEndDtThanOrEquals(Date endDtThanOrEquals) {
|
||||||
|
this.endDtThanOrEquals = endDtThanOrEquals;
|
||||||
|
}
|
||||||
|
public Date getEndDtLessOrEquals() {
|
||||||
|
return endDtLessOrEquals;
|
||||||
|
}
|
||||||
|
public void setEndDtLessOrEquals(Date endDtLessOrEquals) {
|
||||||
|
this.endDtLessOrEquals = endDtLessOrEquals;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.banner.service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.banner.model.Banner;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.banner.model.BannerSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.service.BaseService;
|
||||||
|
|
||||||
|
public interface BannerService extends BaseService<Banner, BannerSearch> {
|
||||||
|
|
||||||
|
void insert(Banner banner, Long itemId);
|
||||||
|
|
||||||
|
void update(Banner banner, Long itemId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.banner.service.impl;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.banner.mapper.BannerMapper;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.banner.model.Banner;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.banner.model.BannerSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.banner.service.BannerService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.service.impl.BaseServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.framework.file.model.FileInfo;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.file.model.FileItem;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.file.service.FileItemService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.file.service.FileService;
|
||||||
|
|
||||||
|
@Service(value="bannerService")
|
||||||
|
public class BannerServiceImpl extends BaseServiceImpl<Banner, BannerSearch, BannerMapper> implements BannerService {
|
||||||
|
|
||||||
|
@Resource (name="fileItemService")
|
||||||
|
private FileItemService fileItemService;
|
||||||
|
|
||||||
|
@Resource (name="fileService")
|
||||||
|
private FileService fileService;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Resource (name="bannerMapper")
|
||||||
|
protected void setMapper (BannerMapper mapper) {
|
||||||
|
super.setMapper (mapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insert(Banner banner, Long itemId) {
|
||||||
|
FileInfo file = new FileInfo();
|
||||||
|
fileService.insert(file);
|
||||||
|
|
||||||
|
FileItem fileItem = new FileItem();
|
||||||
|
fileItem.setFileId(file.getFileId());
|
||||||
|
fileItem.setItemId(itemId);
|
||||||
|
fileItemService.updateFileId(fileItem);
|
||||||
|
|
||||||
|
banner.setFileId(file.getFileId());
|
||||||
|
insert(banner);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(Banner banner, Long itemId) {
|
||||||
|
if(itemId != null) { //첨부파일 교체 시
|
||||||
|
fileService.deleteFileItem(banner.getFileId());
|
||||||
|
|
||||||
|
FileItem fileItem = new FileItem();
|
||||||
|
fileItem.setFileId(banner.getFileId());
|
||||||
|
fileItem.setItemId(itemId);
|
||||||
|
fileItemService.updateFileId(fileItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
update(banner);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.banner.web;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.banner.model.Banner;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.banner.model.BannerSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.banner.service.BannerService;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.site.service.SiteService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.web.BaseController;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.file.service.FileService;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class BannerController extends BaseController {
|
||||||
|
|
||||||
|
@Value("#{prop['AppConf.filePath.popup']}")
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
@Resource (name="fileService")
|
||||||
|
private FileService fileService;
|
||||||
|
|
||||||
|
@Resource (name="bannerService")
|
||||||
|
private BannerService bannerService;
|
||||||
|
|
||||||
|
@Resource (name="siteService")
|
||||||
|
private SiteService siteService;
|
||||||
|
|
||||||
|
@RequestMapping (value="/system/banner/list.mng", method=RequestMethod.GET)
|
||||||
|
public String list(Model model) {
|
||||||
|
model.addAttribute("siteList", siteService.selectJson());
|
||||||
|
|
||||||
|
return "system/banner/list";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value="/system/banner/list.json", method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> list(HttpServletRequest request, BannerSearch bannerSearch) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
String sort = request.getParameter("columns[" + request.getParameter("order[0][column]") + "][name]");
|
||||||
|
String sortOder = request.getParameter("order[0][dir]");
|
||||||
|
bannerSearch.setSort(sort);
|
||||||
|
bannerSearch.setSortOrd(sortOder);
|
||||||
|
bannerSearch.setPagingYn(true);
|
||||||
|
|
||||||
|
int totalCount = bannerService.count(bannerSearch);
|
||||||
|
result.put("recordsTotal", totalCount);
|
||||||
|
result.put("recordsFiltered", totalCount);
|
||||||
|
result.put("data", bannerService.selectList(bannerSearch));
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value="/system/banner/view.json", method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> detail(HttpServletRequest request, BannerSearch bannerSearch) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
result.put("data", bannerService.select(bannerSearch));
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value="/system/banner/insert.json", method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> insert(HttpServletRequest request, Banner banner, Long itemId) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
banner.setRegId(getUserId());
|
||||||
|
bannerService.insert(banner, itemId);
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value="/system/banner/update.json", method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> update(HttpServletRequest request, Banner banner, Long itemId) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
banner.setUpdId(getUserId());
|
||||||
|
bannerService.update(banner, itemId);
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value="/system/banner/delete.json", method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> delete (HttpServletRequest request, BannerSearch bannerSearch) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
bannerSearch.setDelId(getUserId());
|
||||||
|
bannerService.delete(bannerSearch);
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("massge", e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value="/public/banner/list.json", method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> bannerList(HttpServletRequest request, BannerSearch bannerSearch){
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
result.put("data", bannerService.selectList(bannerSearch));
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.mapper;
|
||||||
|
|
||||||
|
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodArti;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodArtiSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.mapper.BaseMapper;
|
||||||
|
|
||||||
|
@Mapper (value="bodArtiMapper")
|
||||||
|
public interface BodArtiMapper extends BaseMapper<BodArti, BodArtiSearch> {
|
||||||
|
|
||||||
|
void updateHit(Long artiId);
|
||||||
|
|
||||||
|
void updateArtiGrp(BodArti bodArti);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.mapper;
|
||||||
|
|
||||||
|
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodCmnt;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodCmntSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.mapper.BaseMapper;
|
||||||
|
|
||||||
|
@Mapper (value="bodCmntMapper")
|
||||||
|
public interface BodCmntMapper extends BaseMapper<BodCmnt, BodCmntSearch> {
|
||||||
|
|
||||||
|
void updateCmntGrp(BodCmnt bodCmnt);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.Bod;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.mapper.BaseMapper;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.Role;
|
||||||
|
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||||
|
|
||||||
|
@Mapper (value="bodMapper")
|
||||||
|
public interface BodMapper extends BaseMapper<Bod, BodSearch> {
|
||||||
|
|
||||||
|
List<Role> selectRoleList(Role role);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.mapper;
|
||||||
|
|
||||||
|
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodRole;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.mapper.BaseMapper;
|
||||||
|
|
||||||
|
@Mapper (value="bodRoleMapper")
|
||||||
|
public interface BodRoleMapper extends BaseMapper<BodRole, BodRole> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
175
src/main/java/kr/co/jinwoosi/clfd/conts/bod/model/Bod.java
Normal file
175
src/main/java/kr/co/jinwoosi/clfd/conts/bod/model/Bod.java
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.model;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.model.BaseModel;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.cd.model.CdDtl;
|
||||||
|
|
||||||
|
public class Bod extends BaseModel{
|
||||||
|
|
||||||
|
private Long bodId;
|
||||||
|
private String bodTp;
|
||||||
|
private String bodNm;
|
||||||
|
private String bodHeader;
|
||||||
|
private String bodFooter;
|
||||||
|
private Integer bodOrder;
|
||||||
|
private Boolean cmntYn;
|
||||||
|
private Boolean answYn;
|
||||||
|
private Boolean scrtYn;
|
||||||
|
private Integer artiCnt;
|
||||||
|
private Integer fileUploadCnt;
|
||||||
|
private String newArtiDt;
|
||||||
|
private Boolean useSt;
|
||||||
|
|
||||||
|
List<String> notiRoleList;
|
||||||
|
List<String> writeRoleList;
|
||||||
|
List<String> scrtRoleList;
|
||||||
|
List<String> answRoleList;
|
||||||
|
|
||||||
|
private CdDtl bodTpCd;
|
||||||
|
|
||||||
|
public CdDtl getBodTpCd() {
|
||||||
|
return bodTpCd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBodTpCd(CdDtl bodTpCd) {
|
||||||
|
this.bodTpCd = bodTpCd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getNotiRoleList() {
|
||||||
|
return notiRoleList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNotiRoleList(List<String> notiRoleList) {
|
||||||
|
this.notiRoleList = notiRoleList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getWriteRoleList() {
|
||||||
|
return writeRoleList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWriteRoleList(List<String> writeRoleList) {
|
||||||
|
this.writeRoleList = writeRoleList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getScrtRoleList() {
|
||||||
|
return scrtRoleList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScrtRoleList(List<String> scrtRoleList) {
|
||||||
|
this.scrtRoleList = scrtRoleList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAnswRoleList() {
|
||||||
|
return answRoleList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnswRoleList(List<String> answRoleList) {
|
||||||
|
this.answRoleList = answRoleList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getArtiCnt() {
|
||||||
|
return artiCnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArtiCnt(Integer artiCnt) {
|
||||||
|
this.artiCnt = artiCnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getBodId() {
|
||||||
|
return bodId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBodId(Long bodId) {
|
||||||
|
this.bodId = bodId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBodTp() {
|
||||||
|
return bodTp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBodTp(String bodTp) {
|
||||||
|
this.bodTp = bodTp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBodNm() {
|
||||||
|
return bodNm;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBodNm(String bodNm) {
|
||||||
|
this.bodNm = bodNm;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBodHeader() {
|
||||||
|
return bodHeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBodHeader(String bodHeader) {
|
||||||
|
this.bodHeader = bodHeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBodFooter() {
|
||||||
|
return bodFooter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBodFooter(String bodFooter) {
|
||||||
|
this.bodFooter = bodFooter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getCmntYn() {
|
||||||
|
return cmntYn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmntYn(Boolean cmntYn) {
|
||||||
|
this.cmntYn = cmntYn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getAnswYn() {
|
||||||
|
return answYn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnswYn(Boolean answYn) {
|
||||||
|
this.answYn = answYn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getScrtYn() {
|
||||||
|
return scrtYn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScrtYn(Boolean scrtYn) {
|
||||||
|
this.scrtYn = scrtYn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getFileUploadCnt() {
|
||||||
|
return fileUploadCnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFileUploadCnt(Integer fileUploadCnt) {
|
||||||
|
this.fileUploadCnt = fileUploadCnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getUseSt() {
|
||||||
|
return useSt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUseSt(Boolean useSt) {
|
||||||
|
this.useSt = useSt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getBodOrder() {
|
||||||
|
return bodOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBodOrder(Integer bodOrder) {
|
||||||
|
this.bodOrder = bodOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNewArtiDt() {
|
||||||
|
return newArtiDt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewArtiDt(String newArtiDt) {
|
||||||
|
this.newArtiDt = newArtiDt;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.model;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.model.BaseModel;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.User;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@ToString
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class BodArti extends BaseModel{
|
||||||
|
private Long artiId;
|
||||||
|
private Long bodId;
|
||||||
|
private Integer depth;
|
||||||
|
private String title;
|
||||||
|
private String cont;
|
||||||
|
private Boolean scrtYn;
|
||||||
|
private Boolean notiYn;
|
||||||
|
private Long fileId;
|
||||||
|
private Integer filePrview;
|
||||||
|
private Long hit;
|
||||||
|
private String bodNm;
|
||||||
|
private String regDate;
|
||||||
|
private String regNm;
|
||||||
|
|
||||||
|
private User user;
|
||||||
|
private Bod bod;
|
||||||
|
private Integer fileCnt;
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.model;
|
||||||
|
|
||||||
|
public class BodArtiSearch extends BodArti{
|
||||||
|
|
||||||
|
private String titleLike;
|
||||||
|
private String contLike;
|
||||||
|
|
||||||
|
public String getContLike() {
|
||||||
|
return contLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContLike(String contLike) {
|
||||||
|
this.contLike = contLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitleLike() {
|
||||||
|
return titleLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitleLike(String titleLike) {
|
||||||
|
this.titleLike = titleLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.model;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.model.BaseModel;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.User;
|
||||||
|
|
||||||
|
public class BodCmnt extends BaseModel{
|
||||||
|
|
||||||
|
private Long cmntId;
|
||||||
|
private Long artiId;
|
||||||
|
private Long cmntGrp;
|
||||||
|
private Integer depth;
|
||||||
|
private String cont;
|
||||||
|
|
||||||
|
private User user;
|
||||||
|
|
||||||
|
public User getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
public void setUser(User user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
public Integer getDepth() {
|
||||||
|
return depth;
|
||||||
|
}
|
||||||
|
public void setDepth(Integer depth) {
|
||||||
|
this.depth = depth;
|
||||||
|
}
|
||||||
|
public Long getCmntId() {
|
||||||
|
return cmntId;
|
||||||
|
}
|
||||||
|
public void setCmntId(Long cmntId) {
|
||||||
|
this.cmntId = cmntId;
|
||||||
|
}
|
||||||
|
public Long getArtiId() {
|
||||||
|
return artiId;
|
||||||
|
}
|
||||||
|
public void setArtiId(Long artiId) {
|
||||||
|
this.artiId = artiId;
|
||||||
|
}
|
||||||
|
public String getCont() {
|
||||||
|
return cont;
|
||||||
|
}
|
||||||
|
public void setCont(String cont) {
|
||||||
|
this.cont = cont;
|
||||||
|
}
|
||||||
|
public Long getCmntGrp() {
|
||||||
|
return cmntGrp;
|
||||||
|
}
|
||||||
|
public void setCmntGrp(Long cmntGrp) {
|
||||||
|
this.cmntGrp = cmntGrp;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.model;
|
||||||
|
|
||||||
|
public class BodCmntSearch extends BodCmnt{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.model;
|
||||||
|
|
||||||
|
public class BodRole {
|
||||||
|
|
||||||
|
private Long bodId;
|
||||||
|
private String roleAuth;
|
||||||
|
private String authTp;
|
||||||
|
|
||||||
|
public Long getBodId() {
|
||||||
|
return bodId;
|
||||||
|
}
|
||||||
|
public void setBodId(Long bodId) {
|
||||||
|
this.bodId = bodId;
|
||||||
|
}
|
||||||
|
public String getRoleAuth() {
|
||||||
|
return roleAuth;
|
||||||
|
}
|
||||||
|
public void setRoleAuth(String roleAuth) {
|
||||||
|
this.roleAuth = roleAuth;
|
||||||
|
}
|
||||||
|
public String getAuthTp() {
|
||||||
|
return authTp;
|
||||||
|
}
|
||||||
|
public void setAuthTp(String authTp) {
|
||||||
|
this.authTp = authTp;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.model;
|
||||||
|
|
||||||
|
public class BodSearch extends Bod{
|
||||||
|
|
||||||
|
private String bodNmLike;
|
||||||
|
|
||||||
|
public String getBodNmLike() {
|
||||||
|
return bodNmLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBodNmLike(String bodNmLike) {
|
||||||
|
this.bodNmLike = bodNmLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodArti;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodArtiSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.service.BaseService;
|
||||||
|
|
||||||
|
public interface BodArtiService extends BaseService<BodArti, BodArtiSearch> {
|
||||||
|
|
||||||
|
void updateHit(Long artiId);
|
||||||
|
|
||||||
|
void insert(BodArti bodArti, Long[] itemIdList);
|
||||||
|
|
||||||
|
void update(BodArti bodArti, Long[] itemIdList);
|
||||||
|
|
||||||
|
void insert(BodArti bodArti, Long itemId);
|
||||||
|
|
||||||
|
void update(BodArti bodArti, Long itemId);
|
||||||
|
|
||||||
|
boolean isAuthScrt(Long artiId, Long userId);
|
||||||
|
|
||||||
|
boolean isAuthUpdate(Long artiId, Long userId);
|
||||||
|
|
||||||
|
boolean isAuthUpdate(BodArti bodArti, Long userId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodCmntSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodCmnt;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.service.BaseService;
|
||||||
|
|
||||||
|
public interface BodCmntService extends BaseService<BodCmnt, BodCmntSearch> {
|
||||||
|
|
||||||
|
boolean isAuthUpdate(Long cmntId, Long userId);
|
||||||
|
|
||||||
|
boolean isAuthUpdate(BodCmnt bodCmnt, Long userId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodRole;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.service.BaseService;
|
||||||
|
|
||||||
|
public interface BodRoleService extends BaseService<BodRole, BodRole> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.Bod;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.service.BaseService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.Role;
|
||||||
|
|
||||||
|
public interface BodService extends BaseService<Bod, BodSearch> {
|
||||||
|
|
||||||
|
void insert(Bod bod, String[] writeRole, String[] notiRole, String[] scrtRole, String[] answRole);
|
||||||
|
void update(Bod bod, String[] writeRole, String[] notiRole, String[] scrtRole, String[] answRole);
|
||||||
|
|
||||||
|
List<Bod> selectJson();
|
||||||
|
Bod selectJson(Long bodId);
|
||||||
|
void initJson();
|
||||||
|
|
||||||
|
boolean isAuthInsert(Bod bod, Long userId);
|
||||||
|
boolean isAuthInsert(Long bodId, Long userId);
|
||||||
|
|
||||||
|
boolean isAuthNoti(Bod bod, Long userId);
|
||||||
|
boolean isAuthNoti(Long bodId, Long userId);
|
||||||
|
|
||||||
|
boolean isAuthAnsw(Bod bod, Long userId);
|
||||||
|
boolean isAuthAnsw(Long bodId, Long userId);
|
||||||
|
List<Role> selectRoleList(Role role);
|
||||||
|
}
|
||||||
@@ -0,0 +1,218 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.service.impl;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.mapper.BodArtiMapper;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.Bod;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodArti;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodArtiSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.service.BodArtiService;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.service.BodService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.service.impl.BaseServiceImpl;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.file.model.FileInfo;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.file.model.FileItem;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.file.service.FileItemService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.file.service.FileService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.UserRole;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.UserSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.service.UserRoleService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.service.UserService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service(value="bodArtiService")
|
||||||
|
public class BodArtiServiceImpl extends BaseServiceImpl<BodArti, BodArtiSearch, BodArtiMapper> implements BodArtiService {
|
||||||
|
|
||||||
|
@Resource (name="userService")
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@Resource (name="userRoleService")
|
||||||
|
private UserRoleService userRoleService;
|
||||||
|
|
||||||
|
@Resource (name="bodService")
|
||||||
|
private BodService bodService;
|
||||||
|
|
||||||
|
@Resource (name="fileItemService")
|
||||||
|
private FileItemService fileItemService;
|
||||||
|
|
||||||
|
@Resource (name="fileService")
|
||||||
|
private FileService fileService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Resource (name="bodArtiMapper")
|
||||||
|
protected void setMapper (BodArtiMapper mapper) {
|
||||||
|
super.setMapper (mapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BodArti select(BodArtiSearch bodArtiSearch) {
|
||||||
|
BodArti bodArti = super.select(bodArtiSearch);
|
||||||
|
|
||||||
|
UserSearch userSearch;
|
||||||
|
List<Bod> bodList = bodService.selectJson();
|
||||||
|
for(Bod bod : bodList) {
|
||||||
|
if(bodArti.getBodId().equals(bod.getBodId())) {
|
||||||
|
bodArti.setBod(bod);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
userSearch = new UserSearch();
|
||||||
|
userSearch.setUserId(bodArti.getRegId());
|
||||||
|
bodArti.setUser(userService.select(userSearch));
|
||||||
|
return bodArti;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BodArti> selectList(BodArtiSearch bodArtiSearch) {
|
||||||
|
List<BodArti> result = new ArrayList<BodArti>();
|
||||||
|
List<BodArti> bodArtiList = super.selectList(bodArtiSearch);
|
||||||
|
|
||||||
|
UserSearch userSearch;
|
||||||
|
List<Bod> bodList = bodService.selectJson();
|
||||||
|
for(BodArti bodArti : bodArtiList) {
|
||||||
|
for(Bod bod : bodList) {
|
||||||
|
if(bodArti.getBodId().equals(bod.getBodId())) {
|
||||||
|
bodArti.setBod(bod);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
userSearch = new UserSearch();
|
||||||
|
userSearch.setUserId(bodArti.getRegId());
|
||||||
|
bodArti.setUser(userService.select(userSearch));
|
||||||
|
|
||||||
|
result.add(bodArti);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateHit(Long artiId) {
|
||||||
|
mapper.updateHit(artiId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insert(BodArti bodArti) {
|
||||||
|
super.insert(bodArti);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insert(BodArti bodArti, Long[] itemIdList) {
|
||||||
|
FileInfo file = new FileInfo();
|
||||||
|
fileService.insert(file);
|
||||||
|
|
||||||
|
FileItem fileItem;
|
||||||
|
for(Long itemId : itemIdList) {
|
||||||
|
fileItem = new FileItem();
|
||||||
|
fileItem.setFileId(file.getFileId());
|
||||||
|
fileItem.setItemId(itemId);
|
||||||
|
fileItemService.updateFileId(fileItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
bodArti.setFileId(file.getFileId());
|
||||||
|
insert(bodArti);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(BodArti bodArti, Long[] itemIdList) {
|
||||||
|
for(Long itemId : itemIdList) {
|
||||||
|
FileItem fileItem = new FileItem();
|
||||||
|
fileItem.setFileId(bodArti.getFileId());
|
||||||
|
fileItem.setItemId(itemId);
|
||||||
|
fileItemService.updateFileId(fileItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
update(bodArti);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insert(BodArti bodArti, Long itemId) {
|
||||||
|
FileInfo file = new FileInfo();
|
||||||
|
fileService.insert(file);
|
||||||
|
|
||||||
|
FileItem fileItem = new FileItem();
|
||||||
|
fileItem.setFileId(file.getFileId());
|
||||||
|
fileItem.setItemId(itemId);
|
||||||
|
fileItemService.updateFileId(fileItem);
|
||||||
|
|
||||||
|
bodArti.setFileId(file.getFileId());
|
||||||
|
insert(bodArti);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(BodArti bodArti, Long itemId) {
|
||||||
|
if(itemId != null) { //첨부파일 교체 시
|
||||||
|
fileService.deleteFileItem(bodArti.getFileId());
|
||||||
|
|
||||||
|
FileItem fileItem = new FileItem();
|
||||||
|
fileItem.setFileId(bodArti.getFileId());
|
||||||
|
fileItem.setItemId(itemId);
|
||||||
|
fileItemService.updateFileId(fileItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
update(bodArti);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 비밀글 보기 권한이 있는지 조회한다.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isAuthScrt(Long artiId, Long userId) {
|
||||||
|
if(userId != null) {
|
||||||
|
BodArtiSearch bodArtiSearch = new BodArtiSearch();
|
||||||
|
bodArtiSearch.setArtiId(artiId);
|
||||||
|
BodArti bodArti = select(bodArtiSearch);
|
||||||
|
if(bodArti.getRegId().compareTo(userId) == 0) {
|
||||||
|
return true;
|
||||||
|
}else {
|
||||||
|
Bod bod = bodArti.getBod();
|
||||||
|
List<String> scrtRoleList = bod.getScrtRoleList();
|
||||||
|
if(scrtRoleList.size() > 0) {
|
||||||
|
List<String> roleList = new ArrayList<String>();
|
||||||
|
UserRole userRoleSearch = new UserRole();
|
||||||
|
userRoleSearch.setUserId(userId);
|
||||||
|
List<UserRole> userRoleList = userRoleService.selectList(userRoleSearch);
|
||||||
|
for(UserRole userRole : userRoleList) {
|
||||||
|
roleList.add(userRole.getRoleAuth());
|
||||||
|
}
|
||||||
|
for(String role : roleList) {
|
||||||
|
if(scrtRoleList.contains(role)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 수정권한이 있는지 조회한다.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isAuthUpdate(Long artiId, Long userId) {
|
||||||
|
if(userId != null) {
|
||||||
|
BodArtiSearch bodArtiSearch = new BodArtiSearch();
|
||||||
|
bodArtiSearch.setArtiId(artiId);
|
||||||
|
BodArti bodArti = select(bodArtiSearch);
|
||||||
|
return isAuthUpdate(bodArti, userId);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean isAuthUpdate(BodArti bodArti, Long userId) {
|
||||||
|
if(userId != null) {
|
||||||
|
if(bodArti.getRegId().compareTo(userId) == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.mapper.BodCmntMapper;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodCmnt;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodCmntSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.service.BodCmntService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.service.impl.BaseServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.UserSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.service.UserService;
|
||||||
|
|
||||||
|
@Service(value="bodCmntService")
|
||||||
|
public class BodCmntServiceImpl extends BaseServiceImpl<BodCmnt, BodCmntSearch, BodCmntMapper> implements BodCmntService {
|
||||||
|
|
||||||
|
@Resource (name="userService")
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Resource (name="bodCmntMapper")
|
||||||
|
protected void setMapper (BodCmntMapper mapper) {
|
||||||
|
super.setMapper (mapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BodCmnt> selectList(BodCmntSearch s) {
|
||||||
|
List<BodCmnt> result = new ArrayList<BodCmnt>();
|
||||||
|
|
||||||
|
UserSearch userSearch;
|
||||||
|
List<BodCmnt> bodCmntList = super.selectList(s);
|
||||||
|
for(BodCmnt bodCmnt : bodCmntList) {
|
||||||
|
userSearch = new UserSearch();
|
||||||
|
userSearch.setUserId(bodCmnt.getRegId());
|
||||||
|
bodCmnt.setUser(userService.select(userSearch));
|
||||||
|
result.add(bodCmnt);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BodCmnt select(BodCmntSearch s) {
|
||||||
|
BodCmnt bodCmnt = super.select(s);
|
||||||
|
UserSearch userSearch = new UserSearch();
|
||||||
|
userSearch.setUserId(bodCmnt.getRegId());
|
||||||
|
bodCmnt.setUser(userService.select(userSearch));
|
||||||
|
return bodCmnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insert(BodCmnt bodCmnt) {
|
||||||
|
super.insert(bodCmnt);
|
||||||
|
if(bodCmnt.getCmntGrp() == null) {
|
||||||
|
bodCmnt.setCmntGrp(bodCmnt.getCmntId());
|
||||||
|
mapper.updateCmntGrp(bodCmnt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAuthUpdate(Long cmntId, Long userId) {
|
||||||
|
if(userId != null) {
|
||||||
|
BodCmntSearch bodCmntSearch = new BodCmntSearch();
|
||||||
|
bodCmntSearch.setCmntId(cmntId);
|
||||||
|
BodCmnt bodCmnt = select(bodCmntSearch);
|
||||||
|
return isAuthUpdate(bodCmnt, userId);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAuthUpdate(BodCmnt bodCmnt, Long userId) {
|
||||||
|
if(userId != null) {
|
||||||
|
if(bodCmnt.getRegId().compareTo(userId) == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.service.impl;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.mapper.BodRoleMapper;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodRole;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.service.BodRoleService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.service.impl.BaseServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service(value="bodRoleService")
|
||||||
|
public class BodRoleImpl extends BaseServiceImpl<BodRole, BodRole, BodRoleMapper> implements BodRoleService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Resource (name="bodRoleMapper")
|
||||||
|
protected void setMapper (BodRoleMapper mapper) {
|
||||||
|
super.setMapper (mapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,306 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.mapper.BodMapper;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.Bod;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodRole;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.service.BodRoleService;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.service.BodService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.service.impl.BaseServiceImpl;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.util.ApplicationHelper;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.util.CdUtil;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.util.Constants;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.framework.cd.model.CdDtl;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.Role;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.UserRole;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.service.UserRoleService;
|
||||||
|
|
||||||
|
@Service(value="bodService")
|
||||||
|
public class BodServiceImpl extends BaseServiceImpl<Bod, BodSearch, BodMapper> implements BodService {
|
||||||
|
|
||||||
|
@Resource (name="bodRoleService")
|
||||||
|
private BodRoleService bodRoleService;
|
||||||
|
|
||||||
|
@Resource (name="userRoleService")
|
||||||
|
private UserRoleService userRoleService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Resource (name="bodMapper")
|
||||||
|
protected void setMapper (BodMapper mapper) {
|
||||||
|
super.setMapper (mapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Bod select(BodSearch bodSearch) {
|
||||||
|
Bod bod = super.select(bodSearch);
|
||||||
|
|
||||||
|
List<CdDtl> cdDtlList = CdUtil.cdDtlList("board");
|
||||||
|
for(CdDtl cdDtl : cdDtlList) {
|
||||||
|
if(cdDtl.getCdDtlId().equals(bod.getBodTp())) {
|
||||||
|
bod.setBodTpCd(cdDtl);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BodRole bodRoleSearch = new BodRole();
|
||||||
|
bodRoleSearch.setBodId(bodSearch.getBodId());
|
||||||
|
List<BodRole> bodRoleList = bodRoleService.selectList(bodRoleSearch);
|
||||||
|
|
||||||
|
List<String> notiRoleList = new ArrayList<String>();
|
||||||
|
List<String> writeRoleList = new ArrayList<String>();
|
||||||
|
List<String> scrtRoleList = new ArrayList<String>();
|
||||||
|
List<String> answRoleList = new ArrayList<String>();
|
||||||
|
for(BodRole bodRole : bodRoleList) {
|
||||||
|
if(Constants.BOD_ROLE_TYPE_NOTI.equals(bodRole.getAuthTp())) notiRoleList.add(bodRole.getRoleAuth());
|
||||||
|
if(Constants.BOD_ROLE_TYPE_WRITE.equals(bodRole.getAuthTp())) writeRoleList.add(bodRole.getRoleAuth());
|
||||||
|
if(Constants.BOD_ROLE_TYPE_SCRT.equals(bodRole.getAuthTp())) scrtRoleList.add(bodRole.getRoleAuth());
|
||||||
|
if(Constants.BOD_ROLE_TYPE_ANSW.equals(bodRole.getAuthTp())) answRoleList.add(bodRole.getRoleAuth());
|
||||||
|
}
|
||||||
|
|
||||||
|
bod.setNotiRoleList(notiRoleList);
|
||||||
|
bod.setWriteRoleList(writeRoleList);
|
||||||
|
bod.setScrtRoleList(scrtRoleList);
|
||||||
|
bod.setAnswRoleList(answRoleList);
|
||||||
|
|
||||||
|
return bod;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Bod> selectList(BodSearch bodSearch) {
|
||||||
|
List<String> writeRoleList,scrtRoleList,answRoleList;
|
||||||
|
|
||||||
|
BodRole bodRoleSearch;
|
||||||
|
List<BodRole> bodRoleList;
|
||||||
|
|
||||||
|
List<CdDtl> cdDtlList = CdUtil.cdDtlList("board");
|
||||||
|
List<Bod> resultList = new ArrayList<Bod>();
|
||||||
|
List<Bod> bodList = super.selectList(bodSearch);
|
||||||
|
for(Bod bod : bodList) {
|
||||||
|
bodRoleSearch = new BodRole();
|
||||||
|
bodRoleSearch.setBodId(bod.getBodId());
|
||||||
|
bodRoleList = bodRoleService.selectList(bodRoleSearch);
|
||||||
|
|
||||||
|
List<String> notiRoleList = new ArrayList<String>();
|
||||||
|
writeRoleList = new ArrayList<String>();
|
||||||
|
scrtRoleList = new ArrayList<String>();
|
||||||
|
answRoleList = new ArrayList<String>();
|
||||||
|
for(BodRole bodRole : bodRoleList) {
|
||||||
|
if(Constants.BOD_ROLE_TYPE_NOTI.equals(bodRole.getAuthTp())) notiRoleList.add(bodRole.getRoleAuth());
|
||||||
|
if(Constants.BOD_ROLE_TYPE_WRITE.equals(bodRole.getAuthTp())) writeRoleList.add(bodRole.getRoleAuth());
|
||||||
|
if(Constants.BOD_ROLE_TYPE_SCRT.equals(bodRole.getAuthTp())) scrtRoleList.add(bodRole.getRoleAuth());
|
||||||
|
if(Constants.BOD_ROLE_TYPE_ANSW.equals(bodRole.getAuthTp())) answRoleList.add(bodRole.getRoleAuth());
|
||||||
|
}
|
||||||
|
bod.setNotiRoleList(notiRoleList);
|
||||||
|
bod.setWriteRoleList(writeRoleList);
|
||||||
|
bod.setScrtRoleList(scrtRoleList);
|
||||||
|
bod.setAnswRoleList(answRoleList);
|
||||||
|
|
||||||
|
for(CdDtl cdDtl : cdDtlList) {
|
||||||
|
if(cdDtl.getCdDtlId().equals(bod.getBodTp())) {
|
||||||
|
bod.setBodTpCd(cdDtl);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resultList.add(bod);
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insert(Bod bod, String[] writeRole, String[] notiRole, String[] scrtRole, String[] answRole) {
|
||||||
|
insert(bod);
|
||||||
|
updateBodRole(bod.getBodId(), writeRole, notiRole, scrtRole, answRole);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(Bod bod, String[] writeRole, String[] notiRole, String[] scrtRole, String[] answRole) {
|
||||||
|
update(bod);
|
||||||
|
updateBodRole(bod.getBodId(), writeRole, notiRole, scrtRole, answRole);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateBodRole(Long bodId, String[] writeRole, String[] notiRole, String[] scrtRole, String[] answRole) {
|
||||||
|
BodRole bodRole = new BodRole();
|
||||||
|
bodRole.setBodId(bodId);
|
||||||
|
bodRoleService.delete(bodRole);
|
||||||
|
|
||||||
|
if(writeRole != null) { //쓰기그룹
|
||||||
|
for(String roleAuth : writeRole) {
|
||||||
|
bodRole.setAuthTp(Constants.BOD_ROLE_TYPE_WRITE);
|
||||||
|
bodRole.setRoleAuth(roleAuth);
|
||||||
|
bodRoleService.insert(bodRole);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(notiRole != null) { //공지관리그룹
|
||||||
|
for(String roleAuth : notiRole) {
|
||||||
|
bodRole.setAuthTp(Constants.BOD_ROLE_TYPE_NOTI);
|
||||||
|
bodRole.setRoleAuth(roleAuth);
|
||||||
|
bodRoleService.insert(bodRole);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(scrtRole != null) { //비밀글관리그룹
|
||||||
|
for(String roleAuth : scrtRole) {
|
||||||
|
bodRole.setAuthTp(Constants.BOD_ROLE_TYPE_SCRT);
|
||||||
|
bodRole.setRoleAuth(roleAuth);
|
||||||
|
bodRoleService.insert(bodRole);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(answRole != null) { //답변관리 그룹
|
||||||
|
for(String roleAuth : answRole) {
|
||||||
|
bodRole.setAuthTp(Constants.BOD_ROLE_TYPE_ANSW);
|
||||||
|
bodRole.setRoleAuth(roleAuth);
|
||||||
|
bodRoleService.insert(bodRole);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Bod> selectJson() {
|
||||||
|
if(ApplicationHelper.getBodList() == null) {
|
||||||
|
initJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ApplicationHelper.getBodList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Bod selectJson(Long bodId) {
|
||||||
|
List<Bod> bodList = selectJson();
|
||||||
|
|
||||||
|
Bod bod = null;
|
||||||
|
for(Bod bd : bodList) {
|
||||||
|
if(bd.getBodId().compareTo(bodId) == 0) {
|
||||||
|
bod = bd;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bod;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initJson() {
|
||||||
|
BodSearch bodSearch = new BodSearch();
|
||||||
|
List<Bod> bodList = selectList(bodSearch);
|
||||||
|
|
||||||
|
ApplicationHelper.setBodList(bodList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 등록 권한이 있는지 체크한다.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isAuthInsert(Long bodId, Long userId) {
|
||||||
|
if(userId != null) {
|
||||||
|
Bod bod = selectJson(bodId);
|
||||||
|
return isAuthInsert(bod, userId);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean isAuthInsert(Bod bod, Long userId) {
|
||||||
|
if(userId != null) {
|
||||||
|
List<String> writeRoleList = bod.getWriteRoleList();
|
||||||
|
// if(writeRoleList.size() > 0) {
|
||||||
|
List<String> roleList = new ArrayList<String>();
|
||||||
|
UserRole userRoleSearch = new UserRole();
|
||||||
|
userRoleSearch.setUserId(userId);
|
||||||
|
List<UserRole> userRoleList = userRoleService.selectList(userRoleSearch);
|
||||||
|
for(UserRole userRole : userRoleList) {
|
||||||
|
roleList.add(userRole.getRoleAuth());
|
||||||
|
}
|
||||||
|
for(String role : roleList) {
|
||||||
|
if(writeRoleList.contains(role)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// }else {
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 공지글 게시권한이 있는지 체크한다.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isAuthNoti(Long bodId, Long userId) {
|
||||||
|
if(userId != null) {
|
||||||
|
Bod bod = selectJson(bodId);
|
||||||
|
return isAuthNoti(bod, userId);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAuthNoti(Bod bod, Long userId) {
|
||||||
|
if(userId != null) {
|
||||||
|
List<String> notiRoleList = bod.getNotiRoleList();
|
||||||
|
if(notiRoleList.size() > 0) {
|
||||||
|
List<String> roleList = new ArrayList<String>();
|
||||||
|
UserRole userRoleSearch = new UserRole();
|
||||||
|
userRoleSearch.setUserId(userId);
|
||||||
|
List<UserRole> userRoleList = userRoleService.selectList(userRoleSearch);
|
||||||
|
for(UserRole userRole : userRoleList) {
|
||||||
|
roleList.add(userRole.getRoleAuth());
|
||||||
|
}
|
||||||
|
for(String role : roleList) {
|
||||||
|
if(notiRoleList.contains(role)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 답변 권한이 있는지 체크한다.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isAuthAnsw(Long bodId, Long userId) {
|
||||||
|
if(userId != null) {
|
||||||
|
Bod bod = selectJson(bodId);
|
||||||
|
return isAuthAnsw(bod, userId);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAuthAnsw(Bod bod, Long userId) {
|
||||||
|
if(userId != null && bod.getAnswYn() != null && bod.getAnswYn()) {
|
||||||
|
List<String> answRoleList = bod.getAnswRoleList();
|
||||||
|
// if(answRoleList.size() > 0) {
|
||||||
|
List<String> roleList = new ArrayList<String>();
|
||||||
|
UserRole userRoleSearch = new UserRole();
|
||||||
|
userRoleSearch.setUserId(userId);
|
||||||
|
List<UserRole> userRoleList = userRoleService.selectList(userRoleSearch);
|
||||||
|
for(UserRole userRole : userRoleList) {
|
||||||
|
roleList.add(userRole.getRoleAuth());
|
||||||
|
}
|
||||||
|
for(String role : roleList) {
|
||||||
|
if(answRoleList.contains(role)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// }else {
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Role> selectRoleList(Role role) {
|
||||||
|
return mapper.selectRoleList(role);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,271 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.web;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodArti;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodArtiSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.service.BodArtiService;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.service.BodService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.web.BaseController;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.User;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.service.UserService;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class BodArtiController extends BaseController {
|
||||||
|
|
||||||
|
@Resource (name="bodArtiService")
|
||||||
|
private BodArtiService bodArtiService;
|
||||||
|
|
||||||
|
@Resource (name="bodService")
|
||||||
|
private BodService bodService;
|
||||||
|
|
||||||
|
@Resource (name="userService")
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@RequestMapping (value="/system/bodArti/list.mng", method=RequestMethod.GET)
|
||||||
|
public String list(Model model) {
|
||||||
|
model.addAttribute("bodList", bodService.selectJson());
|
||||||
|
return "system/bodArti/list";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value={"/public/bodArti/list.json","/system/bodArti/list.json"})
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> list(HttpServletRequest request, BodArtiSearch bodArtiSearch) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
String sort = request.getParameter("columns[" + request.getParameter("order[0][column]") + "][name]");
|
||||||
|
String sortOder = request.getParameter("order[0][dir]");
|
||||||
|
bodArtiSearch.setSort(sort);
|
||||||
|
bodArtiSearch.setSortOrd(sortOder);
|
||||||
|
bodArtiSearch.setPagingYn(true);
|
||||||
|
|
||||||
|
User user = (User) request.getSession().getAttribute("user");
|
||||||
|
|
||||||
|
if(user.getUserTyCd().equals("J")){
|
||||||
|
bodArtiSearch.setRegId(user.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
int totalCount = bodArtiService.count(bodArtiSearch);
|
||||||
|
result.put("recordsTotal", totalCount);
|
||||||
|
result.put("recordsFiltered", totalCount);
|
||||||
|
result.put("data", bodArtiService.selectList(bodArtiSearch));
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value="/system/bodArti/noticeList.json", method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> noticeList(HttpServletRequest request, BodArtiSearch bodArtiSearch) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
String sort = request.getParameter("columns[" + request.getParameter("order[0][column]") + "][name]");
|
||||||
|
String sortOder = request.getParameter("order[0][dir]");
|
||||||
|
bodArtiSearch.setSort(sort);
|
||||||
|
bodArtiSearch.setSortOrd(sortOder);
|
||||||
|
bodArtiSearch.setPagingYn(true);
|
||||||
|
bodArtiSearch.setNotiYn(true);
|
||||||
|
|
||||||
|
int totalCount = bodArtiService.count(bodArtiSearch);
|
||||||
|
result.put("recordsTotal", totalCount);
|
||||||
|
result.put("recordsFiltered", totalCount);
|
||||||
|
result.put("data", bodArtiService.selectList(bodArtiSearch));
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/system/bodArti/insert.json", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> insert(HttpServletRequest request, BodArti bodArti) {
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
try{
|
||||||
|
bodArti.setRegId(getUserId());
|
||||||
|
User user = (User) request.getSession().getAttribute("user");
|
||||||
|
bodArti.setRegNm(user.getUserNm());
|
||||||
|
bodArti.setNotiYn(true);
|
||||||
|
bodArtiService.insert(bodArti);
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value={"/system/bodArti/view.json"})
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> view(BodArtiSearch bodArtiSearch) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
result.put("data", bodArtiService.select(bodArtiSearch));
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/system/bodArti/update.json", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> update(BodArtiSearch bodArtiSearch){
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
try {
|
||||||
|
bodArtiService.update(bodArtiSearch);
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 답변 등록
|
||||||
|
*/
|
||||||
|
@RequestMapping (value={"/public/bodArti/multi/insertAnsw.json"}, method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> insertAnsw(BodArti bodArti, Long[] itemIdList) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
if(bodService.isAuthAnsw(bodArti.getBodId(), getUserId())) { //게시물 등록 권한이 존재하는지 확인
|
||||||
|
bodArti.setRegId(getUserId());
|
||||||
|
bodArtiService.insert(bodArti, itemIdList);
|
||||||
|
|
||||||
|
result.put("result", "success");
|
||||||
|
}else {
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", "등록 권한이 없습니다.");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value={"/public/bodArti/multi/insert.json"}, method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> insert( BodArti bodArti, Long[] itemIdList) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
bodArti.setRegId(getUserId());
|
||||||
|
bodArtiService.insert(bodArti, itemIdList);
|
||||||
|
result.put("fileId", bodArti.getFileId());
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value={"/public/bodArti/one/insert.json"}, method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> insert(BodArti bodArti, Long itemId) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
bodArti.setRegId(getUserId());
|
||||||
|
bodArtiService.insert(bodArti, itemId);
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value={"/public/bodArti/multi/update.json"}, method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> update(BodArti bodArti, Long[] itemIdList) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
bodArti.setUpdId(getUserId());
|
||||||
|
bodArtiService.update(bodArti, itemIdList);
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value={"/public/bodArti/one/update.json"}, method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> update(BodArti bodArti, Long itemId) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
bodArti.setUpdId(getUserId());
|
||||||
|
bodArtiService.update(bodArti, itemId);
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value={"/system/bodArti/delete.json"}, method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> delete(BodArti bodArti) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
bodArti.setDelId(getUserId());
|
||||||
|
bodArtiService.delete(bodArti);
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 비밀글 조회권한이 있는지 체크한다.
|
||||||
|
*/
|
||||||
|
@RequestMapping (value={"/public/bodArti/isScrt.json"})
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> isScrt(@RequestParam(required=true) Long artiId) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
if(bodArtiService.isAuthScrt(artiId, getUserId())) {
|
||||||
|
result.put("result", "success");
|
||||||
|
}else {
|
||||||
|
result.put("result", "noAuth");
|
||||||
|
result.put("message", "조회 권한이 없습니다.");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.web;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodCmnt;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodCmntSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.service.BodCmntService;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.web.BaseController;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class BodCmntController extends BaseController {
|
||||||
|
|
||||||
|
@Resource (name="bodCmntService")
|
||||||
|
private BodCmntService bodCmntService;
|
||||||
|
|
||||||
|
@RequestMapping (value="/public/bodCmnt/insert.json", method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> insert(HttpServletRequest request, BodCmnt bodCmnt) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
bodCmnt.setRegId(getUserId());
|
||||||
|
bodCmnt.setUpdId(getUserId());
|
||||||
|
bodCmntService.insert(bodCmnt);
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value="/public/bodCmnt/list.json", method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> list(HttpServletRequest request, BodCmntSearch bodCmntSearch) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
result.put("data", bodCmntService.selectList(bodCmntSearch));
|
||||||
|
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value="/public/bodCmnt/delete.json", method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> delete(HttpServletRequest request, BodCmnt bodCmnt) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
bodCmnt.setRegId(getUserId());
|
||||||
|
bodCmnt.setUpdId(getUserId());
|
||||||
|
bodCmntService.delete(bodCmnt);
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value="/public/bodCmnt/update.json", method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> update(HttpServletRequest request, BodCmnt bodCmnt) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
bodCmnt.setRegId(getUserId());
|
||||||
|
bodCmnt.setUpdId(getUserId());
|
||||||
|
bodCmntService.update(bodCmnt);
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.bod.web;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.Bod;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.model.BodSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.bod.service.BodService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.web.BaseController;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.cd.service.CdDtlService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.Role;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class BodController extends BaseController {
|
||||||
|
|
||||||
|
@Resource (name="bodService")
|
||||||
|
private BodService bodService;
|
||||||
|
|
||||||
|
@Resource(name="cdDtlService")
|
||||||
|
private CdDtlService cdDtlService;
|
||||||
|
|
||||||
|
@RequestMapping (value="/system/bod/list.mng", method=RequestMethod.GET)
|
||||||
|
public String list(Model model) {
|
||||||
|
model.addAttribute("cdDtlBodTypeList", cdDtlService.selectCdDtlList("board"));
|
||||||
|
return "system/bod/list";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value="/system/bod/list.json", method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> list(HttpServletRequest request, BodSearch bodSearch, Boolean pagingYn) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
String sort = request.getParameter("columns[" + request.getParameter("order[0][column]") + "][name]");
|
||||||
|
String sortOder = request.getParameter("order[0][dir]");
|
||||||
|
bodSearch.setSort(sort);
|
||||||
|
bodSearch.setSortOrd(sortOder);
|
||||||
|
bodSearch.setPagingYn(pagingYn);
|
||||||
|
|
||||||
|
int totalCount = bodService.count(bodSearch);
|
||||||
|
result.put("recordsTotal", totalCount);
|
||||||
|
result.put("recordsFiltered", totalCount);
|
||||||
|
|
||||||
|
result.put("data", bodService.selectList(bodSearch));
|
||||||
|
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value="/system/bod/view.mng", method=RequestMethod.GET)
|
||||||
|
public String view(Model model, BodSearch bodSearch) {
|
||||||
|
Bod bod = bodService.select(bodSearch);
|
||||||
|
model.addAttribute("bod", bod);
|
||||||
|
|
||||||
|
Role role = new Role();
|
||||||
|
model.addAttribute("roleList", bodService.selectRoleList(role));
|
||||||
|
return "system/bod/view";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value="/system/bod/insert.mng", method=RequestMethod.GET)
|
||||||
|
public String insert(Model model) {
|
||||||
|
Role role = new Role();
|
||||||
|
model.addAttribute("roleList", bodService.selectRoleList(role));
|
||||||
|
return "system/bod/insert";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value="/system/bod/insert.json", method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> insert(HttpServletRequest request, Bod bod) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
String[] writeRole = request.getParameterValues("writeRole");
|
||||||
|
String[] notiRole = request.getParameterValues("notiRole");
|
||||||
|
String[] scrtRole = request.getParameterValues("scrtRole");
|
||||||
|
String[] answRole = request.getParameterValues("answRole");
|
||||||
|
|
||||||
|
bod.setRegId(getUserId());
|
||||||
|
bodService.insert(bod, writeRole, notiRole, scrtRole, answRole);
|
||||||
|
|
||||||
|
bodService.initJson();
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value="/system/bod/update.json", method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> update(HttpServletRequest request, Bod bod) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
String[] writeRole = request.getParameterValues("writeRole");
|
||||||
|
String[] notiRole = request.getParameterValues("notiRole");
|
||||||
|
String[] scrtRole = request.getParameterValues("scrtRole");
|
||||||
|
String[] answRole = request.getParameterValues("answRole");
|
||||||
|
|
||||||
|
bod.setUpdId(getUserId());
|
||||||
|
bodService.update(bod, writeRole, notiRole, scrtRole, answRole);
|
||||||
|
|
||||||
|
bodService.initJson();
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping (value="/system/bod/delete.json", method=RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> delete(Bod bod) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
bod.setDelId(getUserId());
|
||||||
|
bodService.delete(bod);
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.company.mapper;
|
||||||
|
|
||||||
|
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.company.model.Company;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.mapper.BaseMapper;
|
||||||
|
|
||||||
|
@Mapper(value="companyMapper")
|
||||||
|
public interface CompanyMapper extends BaseMapper<Company, Company> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.company.model;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.model.BaseModel;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class Company extends BaseModel {
|
||||||
|
|
||||||
|
private Long companyId;
|
||||||
|
private String companyGbn;
|
||||||
|
private String companyNm;
|
||||||
|
private String saupjaNo;
|
||||||
|
private String ownerName;
|
||||||
|
private String telNo;
|
||||||
|
private String faxNo;
|
||||||
|
private String companySiteUrl;
|
||||||
|
private String addrM;
|
||||||
|
private String addrD;
|
||||||
|
private String imageDir;
|
||||||
|
private String companyLogo;
|
||||||
|
|
||||||
|
private String companyGbnNm;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.company.service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.company.model.Company;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.service.BaseService;
|
||||||
|
|
||||||
|
public interface CompanyService extends BaseService<Company, Company> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.company.service.impl;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.company.mapper.CompanyMapper;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.company.model.Company;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.company.service.CompanyService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.service.impl.BaseServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@Service(value = "companyService")
|
||||||
|
public class CompanyServiceImpl extends BaseServiceImpl<Company, Company, CompanyMapper> implements CompanyService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Resource(name="companyMapper")
|
||||||
|
protected void setMapper (CompanyMapper mapper) {
|
||||||
|
super.setMapper(mapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.company.web;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.company.model.Company;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.company.service.CompanyService;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.prod.model.Prod;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.web.BaseController;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class CompanyController extends BaseController {
|
||||||
|
|
||||||
|
@Value("#{prop['AppConf.filePath.image']}")
|
||||||
|
private String imgUrl;
|
||||||
|
|
||||||
|
@Resource(name = "companyService")
|
||||||
|
private CompanyService companyService;
|
||||||
|
|
||||||
|
@RequestMapping(value = "/system/company/list.mng", method = RequestMethod.GET)
|
||||||
|
public String list(Model model, Company company) {
|
||||||
|
model.addAttribute("companyInfo", companyService.select(company));
|
||||||
|
return "system/company/list";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/system/company/list.json", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> list(Company company) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
try {
|
||||||
|
result.put("data", companyService.select(company));
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/system/company/update.json", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> update(@RequestParam(required = false, value = "uploadFile") MultipartFile multipartFile, Company company) {
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
try {
|
||||||
|
if (multipartFile == null || multipartFile.isEmpty()) {
|
||||||
|
} else {
|
||||||
|
File dirPath = new File(imgUrl);
|
||||||
|
if (!dirPath.isDirectory()) {
|
||||||
|
dirPath.mkdir();
|
||||||
|
}
|
||||||
|
Company fileInfo = companyService.select(company);
|
||||||
|
if (fileInfo.getImageDir() != null && fileInfo.getCompanyLogo() != null) {
|
||||||
|
String filePath = imgUrl + fileInfo.getImageDir() + '_' + fileInfo.getCompanyLogo();
|
||||||
|
File deleteFile = new File(filePath);
|
||||||
|
deleteFile.delete();
|
||||||
|
}
|
||||||
|
String uuidPath = UUID.randomUUID().toString();
|
||||||
|
String fileName = multipartFile.getOriginalFilename().replaceAll(" ", "_");
|
||||||
|
company.setImageDir(uuidPath);
|
||||||
|
company.setCompanyLogo(fileName);
|
||||||
|
|
||||||
|
File file = new File(imgUrl + uuidPath + '_' + fileName);
|
||||||
|
try {
|
||||||
|
multipartFile.transferTo(file);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
company.setUpdId(getUserId());
|
||||||
|
companyService.update(company);
|
||||||
|
result.put("result", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result.put("result", "fail");
|
||||||
|
result.put("message", e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.cont.mapper;
|
||||||
|
|
||||||
|
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContBkmak;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContBkmakSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.mapper.BaseMapper;
|
||||||
|
|
||||||
|
@Mapper (value="contBkmakMapper")
|
||||||
|
public interface ContBkmakMapper extends BaseMapper<ContBkmak, ContBkmakSearch> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.cont.mapper;
|
||||||
|
|
||||||
|
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContItemHist;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContItemHistSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.mapper.BaseMapper;
|
||||||
|
|
||||||
|
@Mapper (value="contItemHistMapper")
|
||||||
|
public interface ContItemHistMapper extends BaseMapper<ContItemHist, ContItemHistSearch> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.cont.mapper;
|
||||||
|
|
||||||
|
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContItem;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContItemSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.mapper.BaseMapper;
|
||||||
|
|
||||||
|
@Mapper (value="contItemMapper")
|
||||||
|
public interface ContItemMapper extends BaseMapper<ContItem, ContItemSearch> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.cont.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.Cont;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.mapper.BaseMapper;
|
||||||
|
|
||||||
|
@Mapper (value="contMapper")
|
||||||
|
public interface ContMapper extends BaseMapper<Cont, ContSearch> {
|
||||||
|
|
||||||
|
List<Map<String, Object>> dynamic(ContSearch contSearch);
|
||||||
|
String selectSerial();
|
||||||
|
}
|
||||||
38
src/main/java/kr/co/jinwoosi/clfd/conts/cont/model/Cont.java
Normal file
38
src/main/java/kr/co/jinwoosi/clfd/conts/cont/model/Cont.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.cont.model;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.model.BaseModel;
|
||||||
|
|
||||||
|
public class Cont extends BaseModel{
|
||||||
|
|
||||||
|
private Long contId;
|
||||||
|
private String contNm;
|
||||||
|
|
||||||
|
private ContItem contItem;
|
||||||
|
private Boolean bookmarkYn;
|
||||||
|
|
||||||
|
public Long getContId() {
|
||||||
|
return contId;
|
||||||
|
}
|
||||||
|
public void setContId(Long contId) {
|
||||||
|
this.contId = contId;
|
||||||
|
}
|
||||||
|
public String getContNm() {
|
||||||
|
return contNm;
|
||||||
|
}
|
||||||
|
public void setContNm(String contNm) {
|
||||||
|
this.contNm = contNm;
|
||||||
|
}
|
||||||
|
public ContItem getContItem() {
|
||||||
|
return contItem;
|
||||||
|
}
|
||||||
|
public void setContItem(ContItem contItem) {
|
||||||
|
this.contItem = contItem;
|
||||||
|
}
|
||||||
|
public Boolean getBookmarkYn() {
|
||||||
|
return bookmarkYn;
|
||||||
|
}
|
||||||
|
public void setBookmarkYn(Boolean bookmarkYn) {
|
||||||
|
this.bookmarkYn = bookmarkYn;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.cont.model;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.model.BaseModel;
|
||||||
|
|
||||||
|
public class ContBkmak extends BaseModel{
|
||||||
|
|
||||||
|
private Long contId;
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
public Long getContId() {
|
||||||
|
return contId;
|
||||||
|
}
|
||||||
|
public void setContId(Long contId) {
|
||||||
|
this.contId = contId;
|
||||||
|
}
|
||||||
|
public Long getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
public void setUserId(Long userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.cont.model;
|
||||||
|
|
||||||
|
public class ContBkmakSearch extends ContBkmak{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.cont.model;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.model.BaseModel;
|
||||||
|
|
||||||
|
public class ContItem extends BaseModel{
|
||||||
|
|
||||||
|
private Long contItemId;
|
||||||
|
private String contItemNm;
|
||||||
|
private Long contId;
|
||||||
|
private String cont;
|
||||||
|
private Long langId;
|
||||||
|
|
||||||
|
public Long getContItemId() {
|
||||||
|
return contItemId;
|
||||||
|
}
|
||||||
|
public void setContItemId(Long contItemId) {
|
||||||
|
this.contItemId = contItemId;
|
||||||
|
}
|
||||||
|
public String getContItemNm() {
|
||||||
|
return contItemNm;
|
||||||
|
}
|
||||||
|
public void setContItemNm(String contItemNm) {
|
||||||
|
this.contItemNm = contItemNm;
|
||||||
|
}
|
||||||
|
public Long getContId() {
|
||||||
|
return contId;
|
||||||
|
}
|
||||||
|
public void setContId(Long contId) {
|
||||||
|
this.contId = contId;
|
||||||
|
}
|
||||||
|
public String getCont() {
|
||||||
|
return cont;
|
||||||
|
}
|
||||||
|
public void setCont(String cont) {
|
||||||
|
this.cont = cont;
|
||||||
|
}
|
||||||
|
public Long getLangId() {
|
||||||
|
return langId;
|
||||||
|
}
|
||||||
|
public void setLangId(Long langId) {
|
||||||
|
this.langId = langId;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.cont.model;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.model.BaseModel;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.User;
|
||||||
|
|
||||||
|
public class ContItemHist extends BaseModel{
|
||||||
|
|
||||||
|
private Long contItemHistId;
|
||||||
|
private String contItemNm;
|
||||||
|
private Long contId;
|
||||||
|
private String cont;
|
||||||
|
private Long langId;
|
||||||
|
private String contRegId;
|
||||||
|
private String contRegNm;
|
||||||
|
|
||||||
|
private User user;
|
||||||
|
|
||||||
|
public User getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
public void setUser(User user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
public Long getContItemHistId() {
|
||||||
|
return contItemHistId;
|
||||||
|
}
|
||||||
|
public void setContItemHistId(Long contItemHistId) {
|
||||||
|
this.contItemHistId = contItemHistId;
|
||||||
|
}
|
||||||
|
public String getContItemNm() {
|
||||||
|
return contItemNm;
|
||||||
|
}
|
||||||
|
public void setContItemNm(String contItemNm) {
|
||||||
|
this.contItemNm = contItemNm;
|
||||||
|
}
|
||||||
|
public Long getContId() {
|
||||||
|
return contId;
|
||||||
|
}
|
||||||
|
public void setContId(Long contId) {
|
||||||
|
this.contId = contId;
|
||||||
|
}
|
||||||
|
public String getCont() {
|
||||||
|
return cont;
|
||||||
|
}
|
||||||
|
public void setCont(String cont) {
|
||||||
|
this.cont = cont;
|
||||||
|
}
|
||||||
|
public Long getLangId() {
|
||||||
|
return langId;
|
||||||
|
}
|
||||||
|
public void setLangId(Long langId) {
|
||||||
|
this.langId = langId;
|
||||||
|
}
|
||||||
|
public String getContRegId() {
|
||||||
|
return contRegId;
|
||||||
|
}
|
||||||
|
public void setContRegId(String contRegId) {
|
||||||
|
this.contRegId = contRegId;
|
||||||
|
}
|
||||||
|
public String getContRegNm() {
|
||||||
|
return contRegNm;
|
||||||
|
}
|
||||||
|
public void setContRegNm(String contRegNm) {
|
||||||
|
this.contRegNm = contRegNm;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.cont.model;
|
||||||
|
|
||||||
|
public class ContItemHistSearch extends ContItemHist{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.cont.model;
|
||||||
|
|
||||||
|
public class ContItemSearch extends ContItem{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.cont.model;
|
||||||
|
|
||||||
|
public class ContSearch extends Cont{
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.cont.service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContBkmakSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContBkmak;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.service.BaseService;
|
||||||
|
|
||||||
|
public interface ContBkmakService extends BaseService<ContBkmak, ContBkmakSearch> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.cont.service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContItemHist;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContItemHistSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.service.BaseService;
|
||||||
|
|
||||||
|
public interface ContItemHistService extends BaseService<ContItemHist, ContItemHistSearch> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.cont.service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContItem;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContItemSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.service.BaseService;
|
||||||
|
|
||||||
|
public interface ContItemService extends BaseService<ContItem, ContItemSearch> {
|
||||||
|
|
||||||
|
ContItem selectLast(ContItemSearch contItemSearch);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.cont.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContItem;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContItemHist;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.Cont;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.service.BaseService;
|
||||||
|
|
||||||
|
public interface ContService extends BaseService<Cont, ContSearch> {
|
||||||
|
|
||||||
|
Cont select(ContSearch contSearch, Long langId);
|
||||||
|
|
||||||
|
void insert (Cont cont, List<ContItem> contItemList, List<ContItemHist> contItemHistList);
|
||||||
|
|
||||||
|
void update (Cont cont, List<ContItem> contItemList, List<ContItemHist> contItemHistList);
|
||||||
|
|
||||||
|
List<Map<String, Object>> dynamic(ContSearch contSearch);
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.cont.service.impl;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.mapper.ContBkmakMapper;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContBkmak;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContBkmakSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.service.ContBkmakService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.service.impl.BaseServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service(value="contBkmakService")
|
||||||
|
public class ContBkmakServiceImpl extends BaseServiceImpl<ContBkmak, ContBkmakSearch, ContBkmakMapper> implements ContBkmakService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Resource (name="contBkmakMapper")
|
||||||
|
protected void setMapper (ContBkmakMapper mapper) {
|
||||||
|
super.setMapper (mapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package kr.co.jinwoosi.clfd.conts.cont.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.mapper.ContItemHistMapper;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContItemHist;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.model.ContItemHistSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.conts.cont.service.ContItemHistService;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.base.service.impl.BaseServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.model.UserSearch;
|
||||||
|
import kr.co.jinwoosi.clfd.framework.security.service.UserService;
|
||||||
|
|
||||||
|
@Service(value="contItemHistService")
|
||||||
|
public class ContItemHistServiceImpl extends BaseServiceImpl<ContItemHist, ContItemHistSearch, ContItemHistMapper> implements ContItemHistService {
|
||||||
|
|
||||||
|
@Resource (name="userService")
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Resource (name="contItemHistMapper")
|
||||||
|
protected void setMapper (ContItemHistMapper mapper) {
|
||||||
|
super.setMapper (mapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ContItemHist> selectList(ContItemHistSearch contItemHistSearch) {
|
||||||
|
List<ContItemHist> result = new ArrayList<ContItemHist>();
|
||||||
|
List<ContItemHist> contItemHistList = super.selectList(contItemHistSearch);
|
||||||
|
UserSearch userSearch;
|
||||||
|
for(ContItemHist contItemHist : contItemHistList) {
|
||||||
|
userSearch = new UserSearch();
|
||||||
|
userSearch.setUserId(contItemHist.getRegId());
|
||||||
|
contItemHist.setUser(userService.select(userSearch));
|
||||||
|
result.add(contItemHist);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user