임산물현황 추가 팝업까지 + 값체크.
This commit is contained in:
@@ -16,7 +16,6 @@ class GetMonthlyInputStatusDao implements GetMonthlyInputStatusPortOut {
|
||||
private final GetMonthlyInputStatusMapper mapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Optional<GetMonthlyInputStatus> operate(GetMonthlyInputStatusCmd command) {
|
||||
GetMonthlyInputStatus secArticle = mapper.getMonthlyInputStatus(command);
|
||||
|
||||
@@ -24,4 +23,7 @@ class GetMonthlyInputStatusDao implements GetMonthlyInputStatusPortOut {
|
||||
|
||||
return Optional.of(secArticle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -9,4 +9,5 @@ public interface GetMonthlyInputStatusMapper {
|
||||
|
||||
GetMonthlyInputStatus getMonthlyInputStatus(GetMonthlyInputStatusCmd command);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,4 +8,5 @@ import java.util.Optional;
|
||||
public interface GetMonthlyInputStatusPortIn {
|
||||
|
||||
Optional<GetMonthlyInputStatus> operate(GetMonthlyInputStatusCmd command);
|
||||
|
||||
}
|
||||
@@ -8,4 +8,5 @@ import java.util.Optional;
|
||||
public interface GetMonthlyInputStatusPortOut {
|
||||
|
||||
Optional<GetMonthlyInputStatus> operate(GetMonthlyInputStatusCmd command);
|
||||
|
||||
}
|
||||
@@ -24,4 +24,12 @@ public class GetMonthlyInputStatus {
|
||||
private String createdBy;
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
|
||||
public String getKoreanMonth() {
|
||||
if (month != null && month.contains("-")) {
|
||||
String[] parts = month.split("-");
|
||||
return parts[0] + "년 " + Integer.parseInt(parts[1]) + "월";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,4 +11,5 @@ import lombok.Setter;
|
||||
@EqualsAndHashCode
|
||||
public class GetMonthlyInputStatusCmd {
|
||||
private Long id;
|
||||
private Long householdSeq;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package app.module.core.usecase.monthly.getPrevMonthlyInputStatus.adapters.persistence;
|
||||
|
||||
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.GetPrevMonthlyInputStatusPortOut;
|
||||
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatus;
|
||||
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatusCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class GetPrevMonthlyInputStatusDao implements GetPrevMonthlyInputStatusPortOut {
|
||||
|
||||
private final GetPrevMonthlyInputStatusMapper mapper;
|
||||
|
||||
@Override
|
||||
public Optional<GetPrevMonthlyInputStatus> operate(GetPrevMonthlyInputStatusCmd command) {
|
||||
GetPrevMonthlyInputStatus secArticle = mapper.getPrevMonthlyInputStatus(command);
|
||||
|
||||
|
||||
|
||||
return Optional.ofNullable(secArticle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.module.core.usecase.monthly.getPrevMonthlyInputStatus.adapters.persistence;
|
||||
|
||||
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatus;
|
||||
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatusCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface GetPrevMonthlyInputStatusMapper {
|
||||
|
||||
GetPrevMonthlyInputStatus getPrevMonthlyInputStatus(GetPrevMonthlyInputStatusCmd command);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports;
|
||||
|
||||
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatus;
|
||||
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatusCmd;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface GetPrevMonthlyInputStatusPortIn {
|
||||
|
||||
Optional<GetPrevMonthlyInputStatus> operate(GetPrevMonthlyInputStatusCmd command);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports;
|
||||
|
||||
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatus;
|
||||
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatusCmd;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface GetPrevMonthlyInputStatusPortOut {
|
||||
|
||||
Optional<GetPrevMonthlyInputStatus> operate(GetPrevMonthlyInputStatusCmd command);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application;
|
||||
|
||||
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.GetPrevMonthlyInputStatusPortIn;
|
||||
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.GetPrevMonthlyInputStatusPortOut;
|
||||
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatus;
|
||||
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatusCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class GetPrevMonthlyInputStatusService implements GetPrevMonthlyInputStatusPortIn {
|
||||
|
||||
private final GetPrevMonthlyInputStatusPortOut portOut;
|
||||
|
||||
@Override
|
||||
public Optional<GetPrevMonthlyInputStatus> operate(GetPrevMonthlyInputStatusCmd command) {
|
||||
return portOut.operate(command);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain;
|
||||
|
||||
import app.module.core.config.application.enums.MonthStatus;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetPrevMonthlyInputStatus {
|
||||
private Long id;
|
||||
private Long householdSeq;
|
||||
private String month;
|
||||
private MonthStatus forestProductStatus;
|
||||
private MonthStatus bankAutoTransferStatus;
|
||||
|
||||
private LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetPrevMonthlyInputStatusCmd {
|
||||
private Long id;
|
||||
private Long householdSeq;
|
||||
}
|
||||
@@ -24,7 +24,6 @@ class GetForestProductsDao implements GetForestProductsPortOut {
|
||||
private final GetForestProductsMapper mapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Page<GetForestProducts> operate(Pageable pageable, GetForestProductsCmd command) {
|
||||
// 게시물 목록 얻기
|
||||
List<GetForestProductsDto> contents =
|
||||
@@ -63,63 +62,4 @@ class GetForestProductsDao implements GetForestProductsPortOut {
|
||||
contents.isEmpty() ? 0 : contents.get(0).getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public List<GetForestProducts> operateList(GetForestProductsCmd command) {
|
||||
/*// 검색조건 초기화
|
||||
Specification<Article> spec = (root, query, criteriaBuilder) -> null;
|
||||
|
||||
// 검색어 - like 검색
|
||||
if (!StringUtils.isEmpty(command.getSearchField())) {
|
||||
spec =
|
||||
spec.and(
|
||||
(root, query, builder) ->
|
||||
builder.like(
|
||||
root.get(command.getSearchField()),
|
||||
"%" + command.getSearchValue() + "%"));
|
||||
}
|
||||
|
||||
// 공개여부 검색
|
||||
if (!StringUtils.isEmpty(command.getSearchOpen())) {
|
||||
spec =
|
||||
spec.and(
|
||||
((root, query, criteriaBuilder) ->
|
||||
criteriaBuilder.equal(
|
||||
root.get("visible"), Boolean.valueOf(command.getSearchOpen()))));
|
||||
}
|
||||
|
||||
List<Article> result = getArticlesRepo.findAll(spec);
|
||||
|
||||
return result.stream()
|
||||
.map(
|
||||
article ->
|
||||
new GetArticles(
|
||||
article.getId(),
|
||||
article.getUpdatedBy(),
|
||||
article.getUpdatedAt(),
|
||||
article.getTitle(),
|
||||
article.getContent(),
|
||||
article.getVisible(),
|
||||
article.getStartDate(),
|
||||
article.getEndDate(),
|
||||
article.getOrderNo(),
|
||||
article.getUploadFiles().stream()
|
||||
// 목록에 보여줄 대표이미지만 담는다
|
||||
.filter(
|
||||
uploadFile -> uploadFile.getType()
|
||||
.equals(FileUploadType.EXAMPLE_REP))
|
||||
.map(
|
||||
uploadFile ->
|
||||
new GetArticleFiles(
|
||||
uploadFile.getId(),
|
||||
uploadFile.getType(),
|
||||
uploadFile.getPath(),
|
||||
uploadFile.getName(),
|
||||
uploadFile.getOriginName(),
|
||||
uploadFile.getFileLength()))
|
||||
.findFirst()
|
||||
.orElse(null)))
|
||||
.collect(Collectors.toList());*/
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,5 @@ public interface GetForestProductsMapper {
|
||||
List<GetForestProductsDto> getForestProducts(
|
||||
@Param("pageable") Pageable pageable, @Param("cmd") GetForestProductsCmd cmd);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -11,5 +11,4 @@ public interface GetForestProductsPortIn {
|
||||
|
||||
Page<GetForestProducts> operate(Pageable pageable, GetForestProductsCmd command);
|
||||
|
||||
List<GetForestProducts> operateList(GetForestProductsCmd command);
|
||||
}
|
||||
@@ -11,5 +11,4 @@ public interface GetForestProductsPortOut {
|
||||
|
||||
Page<GetForestProducts> operate(Pageable pageable, GetForestProductsCmd command);
|
||||
|
||||
List<GetForestProducts> operateList(GetForestProductsCmd command);
|
||||
}
|
||||
@@ -22,8 +22,4 @@ class GetForestProductsService implements GetForestProductsPortIn {
|
||||
return portOut.operate(pageable, command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GetForestProducts> operateList(GetForestProductsCmd command) {
|
||||
return portOut.operateList(command);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package app.module.core.usecase.product.getMonthlyForestProducts.adapters.persistence;
|
||||
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.adapters.persistence.model.GetMonthlyForestProductsDto;
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.ports.GetMonthlyForestProductsPortOut;
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.ports.application.domain.GetMonthlyForestProducts;
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.ports.application.domain.GetMonthlyForestProductsCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class GetMonthlyForestProductsDao implements GetMonthlyForestProductsPortOut {
|
||||
|
||||
private final GetMonthlyForestProductsMapper mapper;
|
||||
|
||||
@Override
|
||||
public Page<GetMonthlyForestProducts> operate(Pageable pageable, GetMonthlyForestProductsCmd command) {
|
||||
// 게시물 목록 얻기
|
||||
List<GetMonthlyForestProductsDto> contents =
|
||||
ListUtils.emptyIfNull(mapper.getMonthlyForestProducts(pageable, command));
|
||||
|
||||
return new PageImpl<>(
|
||||
contents.stream()
|
||||
.map(
|
||||
article ->
|
||||
new GetMonthlyForestProducts(
|
||||
article.getId(),
|
||||
article.getHouseholdSeq(),
|
||||
article.getStreetNum(),
|
||||
article.getLandType(),
|
||||
article.getTown(),
|
||||
article.getAvailableArea(),
|
||||
article.getCropName(),
|
||||
article.getCropCode(),
|
||||
article.getLandArea(),
|
||||
article.getMonth(),
|
||||
article.getMainYield(),
|
||||
article.getMainYieldUnitCode(),
|
||||
article.getMainSaleAmount(),
|
||||
article.getMainSaleUnitCode(),
|
||||
article.getSubYield(),
|
||||
article.getSubYieldUnitCode(),
|
||||
article.getSubSaleAmount(),
|
||||
article.getSubSaleUnitCode(),
|
||||
article.getMonthlyInputStatusId(),
|
||||
article.getCreatedAt(),
|
||||
article.getCreatedBy(),
|
||||
article.getUpdatedAt(),
|
||||
article.getUpdatedBy()))
|
||||
.collect(Collectors.toList()),
|
||||
pageable,
|
||||
contents.isEmpty() ? 0 : contents.get(0).getTotal());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package app.module.core.usecase.product.getMonthlyForestProducts.adapters.persistence;
|
||||
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.adapters.persistence.model.GetMonthlyForestProductsDto;
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.ports.application.domain.GetMonthlyForestProductsCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface GetMonthlyForestProductsMapper {
|
||||
List<GetMonthlyForestProductsDto> getMonthlyForestProducts(
|
||||
@Param("pageable") Pageable pageable, @Param("cmd") GetMonthlyForestProductsCmd cmd);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package app.module.core.usecase.product.getMonthlyForestProducts.adapters.persistence.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class GetMonthlyForestProductsDto {
|
||||
|
||||
private Long id;
|
||||
private Long householdSeq;
|
||||
|
||||
private String streetNum;
|
||||
private String landType;
|
||||
private String town;
|
||||
|
||||
private Integer availableArea;
|
||||
private String cropName;
|
||||
private String cropCode;
|
||||
private Integer landArea;
|
||||
|
||||
private String month;
|
||||
|
||||
private BigDecimal mainYield;
|
||||
private String mainYieldUnitCode;
|
||||
private BigDecimal mainSaleAmount;
|
||||
private String mainSaleUnitCode;
|
||||
|
||||
private BigDecimal subYield;
|
||||
private String subYieldUnitCode;
|
||||
private BigDecimal subSaleAmount;
|
||||
private String subSaleUnitCode;
|
||||
|
||||
private Long monthlyInputStatusId;
|
||||
|
||||
private LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
|
||||
private Long total;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package app.module.core.usecase.product.getMonthlyForestProducts.ports;
|
||||
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.ports.application.domain.GetMonthlyForestProducts;
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.ports.application.domain.GetMonthlyForestProductsCmd;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
public interface GetMonthlyForestProductsPortIn {
|
||||
|
||||
Page<GetMonthlyForestProducts> operate(Pageable pageable, GetMonthlyForestProductsCmd command);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package app.module.core.usecase.product.getMonthlyForestProducts.ports;
|
||||
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.ports.application.domain.GetMonthlyForestProducts;
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.ports.application.domain.GetMonthlyForestProductsCmd;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
public interface GetMonthlyForestProductsPortOut {
|
||||
|
||||
Page<GetMonthlyForestProducts> operate(Pageable pageable, GetMonthlyForestProductsCmd command);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package app.module.core.usecase.product.getMonthlyForestProducts.ports.application;
|
||||
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.ports.GetMonthlyForestProductsPortIn;
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.ports.GetMonthlyForestProductsPortOut;
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.ports.application.domain.GetMonthlyForestProducts;
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.ports.application.domain.GetMonthlyForestProductsCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class GetMonthlyForestProductsService implements GetMonthlyForestProductsPortIn {
|
||||
|
||||
private final GetMonthlyForestProductsPortOut portOut;
|
||||
|
||||
@Override
|
||||
public Page<GetMonthlyForestProducts> operate(Pageable pageable, GetMonthlyForestProductsCmd command) {
|
||||
return portOut.operate(pageable, command);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package app.module.core.usecase.product.getMonthlyForestProducts.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetMonthlyForestProducts {
|
||||
|
||||
private Long id;
|
||||
private Long householdSeq;
|
||||
|
||||
private String streetNum;
|
||||
private String landType;
|
||||
private String town;
|
||||
|
||||
private Integer availableArea;
|
||||
private String cropName;
|
||||
private String cropCode;
|
||||
private Integer landArea;
|
||||
|
||||
private String month;
|
||||
|
||||
private BigDecimal mainYield;
|
||||
private String mainYieldUnitCode;
|
||||
private BigDecimal mainSaleAmount;
|
||||
private String mainSaleUnitCode;
|
||||
|
||||
private BigDecimal subYield;
|
||||
private String subYieldUnitCode;
|
||||
private BigDecimal subSaleAmount;
|
||||
private String subSaleUnitCode;
|
||||
|
||||
private Long monthlyInputStatusId;
|
||||
|
||||
private LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.module.core.usecase.product.getMonthlyForestProducts.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetMonthlyForestProductsCmd {
|
||||
|
||||
private Long monthlyInputStatusId;
|
||||
private Long householdSeq;
|
||||
}
|
||||
@@ -20,6 +20,9 @@
|
||||
FROM monthly_input_status a
|
||||
WHERE a.id = #{id}
|
||||
AND a.is_deleted = false
|
||||
<if test="householdSeq != null">
|
||||
AND a.household_seq = #{householdSeq}
|
||||
</if>
|
||||
|
||||
</if>
|
||||
</select>
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper
|
||||
namespace="app.module.core.usecase.monthly.getPrevMonthlyInputStatus.adapters.persistence.GetPrevMonthlyInputStatusMapper">
|
||||
<select id="getPrevMonthlyInputStatus"
|
||||
resultType="app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatus">
|
||||
|
||||
<if test="id != null">
|
||||
SELECT
|
||||
a.id AS id,
|
||||
a.household_seq AS householdSeq,
|
||||
a.month AS month,
|
||||
a.forest_product_status AS forestProductStatus,
|
||||
a.bank_auto_transfer_status AS bankAutoTransferStatus,
|
||||
a.created_at AS createdAt,
|
||||
a.created_by AS createdBy,
|
||||
a.updated_at AS updatedAt,
|
||||
a.updated_by AS updatedBy
|
||||
FROM monthly_input_status a
|
||||
WHERE a.is_deleted = false
|
||||
AND a.forest_product_status != 'NONE'
|
||||
AND a.household_seq = #{householdSeq}
|
||||
AND a.month = (
|
||||
SELECT TO_CHAR(TO_DATE(month, 'YYYY-MM') - INTERVAL '1 month', 'YYYY-MM')
|
||||
FROM monthly_input_status
|
||||
WHERE is_deleted = false AND id = #{id}
|
||||
);
|
||||
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -70,4 +70,9 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper
|
||||
namespace="app.module.core.usecase.product.getMonthlyForestProducts.adapters.persistence.GetMonthlyForestProductsMapper">
|
||||
|
||||
<select id="getMonthlyForestProducts"
|
||||
resultType="app.module.core.usecase.product.getMonthlyForestProducts.adapters.persistence.model.GetMonthlyForestProductsDto">
|
||||
/* getForestProducts : 게시물 리스트 */
|
||||
SELECT
|
||||
|
||||
a.id AS id,
|
||||
a.household_seq AS householdSeq,
|
||||
a.street_num AS streetNum,
|
||||
a.land_type AS landType,
|
||||
a.town AS town,
|
||||
a.available_area AS availableArea,
|
||||
a.crop_name AS cropName,
|
||||
a.crop_code AS cropCode,
|
||||
a.land_area AS landArea,
|
||||
a.month AS month,
|
||||
a.main_yield AS mainYield,
|
||||
a.main_yield_unit_code AS mainYieldUnitCode,
|
||||
a.main_sale_amount AS mainSaleAmount,
|
||||
a.main_sale_unit_code AS mainSaleUnitCode,
|
||||
a.sub_yield AS subYield,
|
||||
a.sub_yield_unit_code AS subYieldUnitCode,
|
||||
a.sub_sale_amount AS subSaleAmount,
|
||||
a.sub_sale_unit_code AS subSaleUnitCode,
|
||||
a.monthly_input_status_id AS monthlyInputStatusId,
|
||||
a.created_at AS createdAt,
|
||||
a.created_by AS createdBy,
|
||||
a.updated_at AS updatedAt,
|
||||
a.updated_by AS updatedBy,
|
||||
COUNT(*) OVER () AS total
|
||||
FROM forest_product a
|
||||
WHERE a.is_deleted = false
|
||||
|
||||
<if test="cmd.monthlyInputStatusId != null">
|
||||
AND a.monthly_input_status_id = #{cmd.monthlyInputStatusId}
|
||||
</if>
|
||||
<if test="cmd.householdSeq != null">
|
||||
AND a.household_seq = #{cmd.householdSeq}
|
||||
</if>
|
||||
|
||||
<if test="pageable.sort != null and !pageable.sort.isEmpty()">
|
||||
ORDER BY
|
||||
<foreach collection="pageable.sort" item="order" separator=",">
|
||||
<choose>
|
||||
<when test="order.property eq 'household'">a.household_seq</when>
|
||||
<when test="order.property eq 'updatedBy'">a.updated_by</when>
|
||||
<when test="order.property eq 'updatedAt'">a.updated_at</when>
|
||||
<when test="order.property eq 'createdBy'">a.created_by</when>
|
||||
<when test="order.property eq 'createdAt'">a.created_at</when>
|
||||
<otherwise>a.id</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="order.direction.toString() eq 'DESC'">DESC</when>
|
||||
<otherwise>ASC</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,94 @@
|
||||
package app.module.front.usecase.info.monthly.createMonthlyUI.adapters.web;
|
||||
|
||||
import app.module.core.config.application.enums.MonthStatus;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.GetMonthlyInputStatusPortIn;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.GetMonthlyInputStatussPortIn;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatuss;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatussCmd;
|
||||
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.GetPrevMonthlyInputStatusPortIn;
|
||||
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatus;
|
||||
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatusCmd;
|
||||
import app.module.core.usecase.product.getForestProduct.ports.GetForestProductPortIn;
|
||||
import app.module.core.usecase.product.getForestProducts.ports.GetForestProductsPortIn;
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.ports.GetMonthlyForestProductsPortIn;
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.ports.application.domain.GetMonthlyForestProducts;
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.ports.application.domain.GetMonthlyForestProductsCmd;
|
||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
import app.module.front.config.application.util.AuthUtil;
|
||||
import app.module.front.usecase.info.monthly.createMonthlyUI.adapters.web.model.CreateMonthlyReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class CreateMonthlyUIController {
|
||||
|
||||
|
||||
private final GetPrevMonthlyInputStatusPortIn portIn;
|
||||
private final GetMonthlyInputStatusPortIn getMonthlyInputStatusPortIn;
|
||||
private final GetMonthlyForestProductsPortIn getMonthlyForestProductsPortIn;
|
||||
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
|
||||
@GetMapping(path = "/info/monthly/create/{id}")
|
||||
String operate(Model model,
|
||||
@PathVariable Long id,
|
||||
@PageableDefault(sort = "createAt", direction = Sort.Direction.DESC, page = 0, size = 100) Pageable pageable) {
|
||||
// 전달 입력 상태 취득 , 데이터가 없을 경우 null
|
||||
// 이전달 입력상태:NONE일 경우도 null
|
||||
|
||||
GetPrevMonthlyInputStatus pastMonthlyInfo =
|
||||
portIn.operate(
|
||||
new GetPrevMonthlyInputStatusCmd(
|
||||
id, AuthUtil.getUserSeq())).orElse(null);
|
||||
|
||||
//현재 달 입력 상태 취득
|
||||
GetMonthlyInputStatus currentMonthlyInfo =
|
||||
getMonthlyInputStatusPortIn.operate(
|
||||
new GetMonthlyInputStatusCmd(
|
||||
id, AuthUtil.getUserSeq())).orElse(null);
|
||||
|
||||
|
||||
// 전달 입력 리스트 취득
|
||||
Page<GetMonthlyForestProducts> pastList = Page.empty();
|
||||
if (pastMonthlyInfo != null) {
|
||||
pastList = getMonthlyForestProductsPortIn.operate(
|
||||
pageable,
|
||||
new GetMonthlyForestProductsCmd(
|
||||
pastMonthlyInfo.getId(), AuthUtil.getUserSeq()));
|
||||
}
|
||||
|
||||
// 이번달 입력 리스트 취득
|
||||
Page<GetMonthlyForestProducts> currentList = Page.empty();
|
||||
if (currentMonthlyInfo != null) {
|
||||
currentList = getMonthlyForestProductsPortIn.operate(
|
||||
pageable,
|
||||
new GetMonthlyForestProductsCmd(
|
||||
currentMonthlyInfo.getId(), AuthUtil.getUserSeq()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
model.addAttribute("pastMonthlyInfo", pastMonthlyInfo);
|
||||
model.addAttribute("currentMonthlyInfo", currentMonthlyInfo);
|
||||
model.addAttribute("pastList", pastList);
|
||||
model.addAttribute("currentList", currentList);
|
||||
|
||||
|
||||
model.addAttribute("purposeList", uiCodeListPortIn.connect("code.purpose"));
|
||||
model.addAttribute("unitList", uiCodeListPortIn.connect("code.record.unit"));
|
||||
|
||||
model.addAttribute("MonthStatus", MonthStatus.class);
|
||||
|
||||
return "info/monthly/{id}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.module.front.usecase.info.monthly.createMonthlyUI.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class CreateMonthlyReqVO {
|
||||
|
||||
private String searchField;
|
||||
private String searchValue;
|
||||
}
|
||||
@@ -1,17 +1,11 @@
|
||||
package app.module.front.usecase.info.monthly.getMonthlysUI.adapters.web;
|
||||
|
||||
import app.module.core.config.application.enums.MonthStatus;
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import app.module.core.usecase.household.getHousehold.ports.GetHouseholdPortIn;
|
||||
import app.module.core.usecase.household.getHousehold.ports.application.domain.GetHouseholdCmd;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.GetMonthlyInputStatussPortIn;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatuss;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatussCmd;
|
||||
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNotices;
|
||||
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNoticesCmd;
|
||||
import app.module.front.config.application.util.AuthUtil;
|
||||
import app.module.front.usecase.info.monthly.getMonthlysUI.adapters.web.model.GetMontylyssReqVO;
|
||||
import app.module.front.usecase.info.monthly.getMonthlysUI.adapters.web.model.GetMonthlyssReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -23,7 +17,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class GetMontylysUIController {
|
||||
class GetMonthlysUIController {
|
||||
|
||||
|
||||
private final GetMonthlyInputStatussPortIn portIn;
|
||||
@@ -32,7 +26,7 @@ class GetMontylysUIController {
|
||||
@GetMapping(path = "/info/monthly")
|
||||
String operate(Model model,
|
||||
@PageableDefault(sort = "month", direction = Sort.Direction.DESC, page = 0, size = 13) Pageable pageable,
|
||||
GetMontylyssReqVO reqVO) {
|
||||
GetMonthlyssReqVO reqVO) {
|
||||
|
||||
Page<GetMonthlyInputStatuss> list =
|
||||
portIn.operate(
|
||||
@@ -9,7 +9,7 @@ import lombok.Setter;
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetMontylyssReqVO {
|
||||
public class GetMonthlyssReqVO {
|
||||
|
||||
private String searchField;
|
||||
private String searchValue;
|
||||
@@ -20,8 +20,9 @@ uri.front.info.user.password=\uBE44\uBC00\uBC88\uD638 \uD655\uC778
|
||||
uri.front.info.notice=\uACF5\uC9C0\uC0AC\uD56D
|
||||
uri.front.info.notice.{{pathVar}}=\uACF5\uC9C0\uC0AC\uD56D
|
||||
uri.front.info.notice.path=/info/notice
|
||||
uri.front.info.monthly=\uC6D4\uBCC4 \uC784\uC0B0\uBB3C \uD604\uD669
|
||||
uri.front.info.monthly=\uC784\uC0B0\uBB3C \uD604\uD669
|
||||
uri.front.info.monthly.path=/info/monthly
|
||||
uri.front.info.monthly.create.{{pathVar}}=\uC784\uC0B0\uBB3C \uD604\uD669
|
||||
uri.front.info.bank=\uC740\uD589 \uC790\uB3D9\uC774\uCCB4 \uB0B4\uC5ED
|
||||
uri.front.info.bank.path=/info/bank
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ let kri = {
|
||||
};
|
||||
kri.menu = new Object;
|
||||
kri.logger = new Object();
|
||||
|
||||
kri.form = new Object();
|
||||
/* kri.menu */
|
||||
/**
|
||||
* 스크립트로 페이지 이동
|
||||
@@ -74,3 +74,65 @@ kri.logger.warn = function(message){
|
||||
};
|
||||
|
||||
|
||||
kri.form.error = function(errorList){
|
||||
let isResetDone = false;
|
||||
|
||||
$(errorList).each((idx, oj) => {
|
||||
const target = $('[name="' + oj.field + '"]');
|
||||
let infoBox = null;
|
||||
if (!isResetDone) {
|
||||
const formElement = target.closest('form');
|
||||
if (formElement.length > 0) {
|
||||
$(formElement).find('.component-input').removeClass('input-invalid');
|
||||
$(formElement).find('.input-flex-group').removeClass('invalid');
|
||||
$(formElement).find('.select-group').removeClass('select-invalid');
|
||||
$(formElement).find('.input-info').each(function () {
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
isResetDone = true;
|
||||
}
|
||||
|
||||
if (target.length > 0) {
|
||||
|
||||
const component = target.closest('.component-input');
|
||||
if(component){
|
||||
component.addClass('input-invalid');
|
||||
//연결된 구조 일 경우 상위에 변경
|
||||
if(target.closest('.input-flex-group').length > 0){
|
||||
infoBox = target.closest('.input-flex-group').find('.input-info');
|
||||
} else {
|
||||
infoBox = component.find('.input-info');
|
||||
}
|
||||
|
||||
if (infoBox.length === 0) {
|
||||
if(target.closest('.input-flex-group').length > 0){
|
||||
infoBox = $('<ul class="input-info"></ul>').appendTo(target.closest('.input-flex-group'));
|
||||
target.closest('.input-flex-group').addClass('invalid');
|
||||
} else {
|
||||
infoBox = $('<ul class="input-info"></ul>').appendTo(component);
|
||||
}
|
||||
}
|
||||
infoBox.html('<li>' + oj.message + '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
if (target.data('type') === 'select') {
|
||||
|
||||
const component = target.closest('.select-group');
|
||||
if (component) {
|
||||
component.addClass('select-invalid');
|
||||
|
||||
infoBox = component.find('.input-info');
|
||||
if (infoBox.length === 0) {
|
||||
infoBox = $('<ul class="input-info"></ul>').appendTo(component);
|
||||
}
|
||||
|
||||
infoBox.html('<li>' + oj.message + '</li>');
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<ul class="product-col-list">
|
||||
|
||||
<li th:each="item : ${list.content}" th:classappend="${item.forestProductStatus != MonthStatus.NONE} ? ' complete'">
|
||||
<a href="">
|
||||
<a th:href="@{/info/monthly/create/{id}(id=${item.id})}">
|
||||
<p class="list-tit" th:text="${item.koreanMonth}"></p>
|
||||
<span class="tag" th:text="${item.forestProductStatus.desc}"></span>
|
||||
</a>
|
||||
@@ -27,8 +27,7 @@
|
||||
<script th:inline="javascript">
|
||||
let ENV = {
|
||||
httpUrl: {
|
||||
root: /*[[#{uri.front.info.notice.path}]]*/'detailUrl',
|
||||
notice: /*[[#{uri.front.info.notice.path}]]*/'noticeUrl'
|
||||
root: /*[[#{uri.front.info.monthly.path}]]*/'rootUrl'
|
||||
},
|
||||
module:{
|
||||
confirmPopup : null
|
||||
|
||||
581
front/src/main/resources/templates/info/monthly/{id}.html
Normal file
581
front/src/main/resources/templates/info/monthly/{id}.html
Normal file
@@ -0,0 +1,581 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout-none}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<div layout:fragment="content" th:classappend="'mypage-wrap'">
|
||||
<main id="content" role="main">
|
||||
<div class="inner">
|
||||
<hgroup class="tit-group">
|
||||
<h3>
|
||||
[[${currentMonthlyInfo.koreanMonth}]]의 <br>
|
||||
<strong>임산물 현황 <span>[[${currentList.totalElements}]]</span>건 등록</strong> 되었습니다.
|
||||
</h3>
|
||||
<p>임산물 현황을 등록해 주세요.</p>
|
||||
</hgroup>
|
||||
|
||||
<section class="regist-item-area">
|
||||
<p class="total" th:style="${currentList.totalElements == 0 ? 'display:none':''}">
|
||||
<span>총 <strong>1</strong>건</span>
|
||||
<button type="button" class="btn-reset">
|
||||
<i class="ico-reset ico-small" aria-hidden="true"></i>
|
||||
<span>초기화</span>
|
||||
</button>
|
||||
</p>
|
||||
<div class="item-list" th:style="${currentList.totalElements == 0 ? 'display:none':''}" id="listBody">
|
||||
<div class="list-item">
|
||||
<div class="item-tit-group">
|
||||
<p class="item-name">송이<span>400평</span> </p>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="delete"><span class="hide-txt">삭제</span></button>
|
||||
<button type="button" class="edit"><span class="hide-txt">수정</span></button>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="detail-list">
|
||||
<li><span>서화면 서화리 161-1</span></li>
|
||||
<li><p>지목</p><span>임야</span></li>
|
||||
<li><p>가능면적</p><span>600평</span></li>
|
||||
<li><p>주생산물 수확량 / 판매량</p><span>35kg / 10kg</span></li>
|
||||
<li><p>부생산물 수확량 / 판매량</p><span>7kg / 2kg</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-m btn-secondary btn-full" style="margin-bottom:1.2rem" id="addItemBtn" onclick="formControl.addOpen()">
|
||||
<i class="ico-add ico-small" aria-hidden="true"></i>
|
||||
<span class="btn-txt">추가 등록</span>
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn btn-m btn-link btn-full" th:if="${pastMonthlyInfo != null && currentList.totalElements == 0}" id="callPastInfoBtn">
|
||||
<span class="btn-txt">이전 정보 불러오기</span>
|
||||
</button>
|
||||
|
||||
|
||||
<div class="component-input align-center" th:if="${currentList.totalElements == 0}" id="forestProductStatusDiv">
|
||||
<label class="checkbox-inner">
|
||||
<input type="checkbox" id="forestProductStatus" name="forestProductStatus" th:value="${MonthStatus.NOTHING}" onchange="formControl.handleCheckboxChange()">
|
||||
<span class="checkbox-item">
|
||||
<span class="checkbox-txt">이번달 등록내용 없음</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<ul class="info-bullet-list">
|
||||
<li>
|
||||
임업과 관련하여 재배 및 채취된 모든 임산물(목재 포함)을 기록해주세요.
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- 하단 고정 버튼 -->
|
||||
<div class="component-btns fixed">
|
||||
<div class="btns-row">
|
||||
<!-- 비활성화 스타일/ 버튼 속성 disable 추가-->
|
||||
<button type="button" class="btn btn-l btn-primary" id="complateBtn" disabled>
|
||||
<span class="btn-txt">등록 완료</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- 모달 팝업 -->
|
||||
<div class="layer-wrap">
|
||||
<div class="component-modal mypage-wrap addPopup" data-props-dimm-click="true">
|
||||
<div class="modal-dimm"></div>
|
||||
<div class="modal-frame">
|
||||
<div class="modal-container">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-tit">임산물 현황 등록</h3>
|
||||
</div>
|
||||
<div class="modal-content">
|
||||
<div class="modal-content-inner">
|
||||
|
||||
<form id="forestForm">
|
||||
<article class="alert-box full green">
|
||||
<ul>
|
||||
<li>임업과 관련하여 재배 및 채취된 모든 임산물(목재 포함)을 기록해주세요.</li>
|
||||
</ul>
|
||||
</article>
|
||||
|
||||
<p class="form-desc">필수입력</p>
|
||||
|
||||
<section class="form-group">
|
||||
<!-- 읍면동 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="town" class="label-txt">
|
||||
읍면동
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="text" id="town" placeholder="읍면동을 입력해 주세요" name="town" maxlength="10">
|
||||
</div>
|
||||
</div>
|
||||
<!-- 지번 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="streetNum" class="label-txt">
|
||||
지번
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="text" id="streetNum" placeholder="지번을 입력해 주세요" name="streetNum" maxlength="10">
|
||||
</div>
|
||||
</div>
|
||||
<!-- 지목 -->
|
||||
<div class="select-group">
|
||||
<div class="select-label">
|
||||
<p class="label-txt">
|
||||
지목
|
||||
</p>
|
||||
</div>
|
||||
<div id="landTypeSelect" class="component-select bottom-sheet" data-props-default="지목을 선택해 주세요" data-props-type="bottomSheet">
|
||||
<input type="hidden" id="landType" name="landType" data-type="select">
|
||||
<button type="button" class="select-box">
|
||||
<span class="select-txt"></span>
|
||||
</button>
|
||||
<div class="select-options">
|
||||
<div class="select-header">
|
||||
<p>지목</p>
|
||||
<button type="button" class="select-close">
|
||||
<span class="hide-txt">닫기</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="select-scroll">
|
||||
<ul class="">
|
||||
<th:block th:each="item : ${purposeList}">
|
||||
<li class="option" th:data-value="${item.id}" th:text="${item.codeText}" >option1</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 가능 면적 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="availableArea" class="label-txt">
|
||||
가능 면적<span>(평)</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="text" id="availableArea" placeholder="가능 면적을 입력해 주세요" name="availableArea" class="limitDecimalLength">
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<hr>
|
||||
|
||||
<section class="form-group">
|
||||
<!-- 재배 작물명 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="cropName" class="label-txt">
|
||||
재배 작물명
|
||||
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="text" id="cropName" placeholder="재배 작물명을 입력해 주세요" name="cropName" maxlength="10">
|
||||
</div>
|
||||
<ul class="guide-info">
|
||||
<li>예 : 수확</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- 면적 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="landArea" class="label-txt">
|
||||
면적<span>(평)</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="text" id="landArea" placeholder="작업 면적을 입력해 주세요" name="landArea" class="limitDecimalLength">
|
||||
</div>
|
||||
<ul class="guide-info">
|
||||
<li>예 : 180, 6</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<hr>
|
||||
|
||||
<section class="form-group">
|
||||
<!-- 주생산물 수확량 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="mainYield" class="label-txt">
|
||||
주생산물 수확량
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="number" id="mainYield" placeholder="수확량을 입력해 주세요" name="mainYield" class="limitDecimalLength">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 단위 -->
|
||||
<div class="select-group">
|
||||
<div class="select-label">
|
||||
<p class="label-txt">
|
||||
단위
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div id="mainYieldUnitCodeSelect" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
|
||||
<input type="hidden" name="mainYieldUnitCode" id="mainYieldUnitCode" data-type="select">
|
||||
<button type="button" class="select-box">
|
||||
<span class="select-txt"></span>
|
||||
</button>
|
||||
<div class="select-options">
|
||||
<div class="select-header">
|
||||
<p>단위</p>
|
||||
<button type="button" class="select-close">
|
||||
<span class="hide-txt">닫기</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="select-scroll">
|
||||
<ul class="">
|
||||
<th:block th:each="item : ${unitList}">
|
||||
<li class="option" th:data-value="${item.id}" th:text="${item.codeText}" >option1</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<hr>
|
||||
|
||||
<section class="form-group">
|
||||
<!-- 주생산물 판매량 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="mainSaleAmount" class="label-txt">
|
||||
주생산물 판매량
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="number" id="mainSaleAmount" placeholder="판매량을 입력해 주세요" name="mainSaleAmount" class="limitDecimalLength">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 단위 -->
|
||||
<div class="select-group">
|
||||
<div class="select-label">
|
||||
<p class="label-txt">
|
||||
단위
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div id="mainSaleUnitCodeSelect" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
|
||||
<input type="hidden" name="mainSaleUnitCode" id="mainSaleUnitCode" data-type="select">
|
||||
<button type="button" class="select-box">
|
||||
<span class="select-txt"></span>
|
||||
</button>
|
||||
<div class="select-options">
|
||||
<div class="select-header">
|
||||
<p>단위</p>
|
||||
<button type="button" class="select-close">
|
||||
<span class="hide-txt">닫기</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="select-scroll">
|
||||
<ul class="">
|
||||
<th:block th:each="item : ${unitList}">
|
||||
<li class="option" th:data-value="${item.id}" th:text="${item.codeText}" >option1</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<hr>
|
||||
|
||||
<section class="form-group">
|
||||
<!-- 부생산물 수확량 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="subYield" class="label-txt">
|
||||
부생산물 수확량
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="number" id="subYield" placeholder="수확량을 입력해 주세요" name="subYield" class="limitDecimalLength">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 단위 -->
|
||||
<div class="select-group">
|
||||
<div class="select-label">
|
||||
<p class="label-txt">
|
||||
단위
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div id="subYieldUnitCodeSelect" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
|
||||
<input type="hidden" name="subYieldUnitCode" id="subYieldUnitCode" data-type="select">
|
||||
<button type="button" class="select-box">
|
||||
<span class="select-txt"></span>
|
||||
</button>
|
||||
<div class="select-options">
|
||||
<div class="select-header">
|
||||
<p>단위</p>
|
||||
<button type="button" class="select-close">
|
||||
<span class="hide-txt">닫기</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="select-scroll">
|
||||
<ul class="">
|
||||
<th:block th:each="item : ${unitList}">
|
||||
<li class="option" th:data-value="${item.id}" th:text="${item.codeText}" >option1</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<hr>
|
||||
|
||||
<section class="form-group">
|
||||
<!-- 부생산물 판매량 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="subSaleAmount" class="label-txt">
|
||||
부생산물 판매량
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="number" id="subSaleAmount" placeholder="판매량을 입력해 주세요" name="subSaleAmount" class="limitDecimalLength">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 단위 -->
|
||||
<div class="select-group">
|
||||
<div class="select-label">
|
||||
<p class="label-txt">
|
||||
단위
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div id="subSaleUnitCodeSelect" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
|
||||
<input type="hidden" name="subSaleUnitCode" id="subSaleUnitCode" data-type="select">
|
||||
<button type="button" class="select-box">
|
||||
<span class="select-txt"></span>
|
||||
</button>
|
||||
<div class="select-options">
|
||||
<div class="select-header">
|
||||
<p>단위</p>
|
||||
<button type="button" class="select-close">
|
||||
<span class="hide-txt">닫기</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="select-scroll">
|
||||
<ul class="">
|
||||
<th:block th:each="item : ${unitList}">
|
||||
<li class="option" th:data-value="${item.id}" th:text="${item.codeText}" >option1</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<div class="component-btns">
|
||||
<div class="btns-row">
|
||||
<button type="button" class="btn btn-full btn-l btn-primary" onclick="formControl.addData()">
|
||||
<span class="btn-txt">등록</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="modal-close"></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- //모달 팝업 -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script th:inline="javascript">
|
||||
let ENV = {
|
||||
httpUrl: {
|
||||
root: /*[[#{uri.front.info.monthly.path}]]*/'rootUrl'
|
||||
},
|
||||
module:{
|
||||
addPopup : null
|
||||
},
|
||||
data: {
|
||||
addProducts: []
|
||||
},
|
||||
target:{
|
||||
nothingCheck : document.getElementById("forestProductStatus"),
|
||||
addBtn:{
|
||||
button: null,
|
||||
icon : null
|
||||
}
|
||||
},
|
||||
submitted: false,
|
||||
};
|
||||
let formControl = {
|
||||
init(){
|
||||
this._bindUI();
|
||||
this._listener();
|
||||
},
|
||||
_bindUI(){
|
||||
ENV.module.addPopup = document.querySelector(".addPopup").ui;
|
||||
// ENV.target.addBtn.button = document.getElementById("addItemBtn");
|
||||
// ENV.target.addBtn.icon = button.querySelector("i");
|
||||
|
||||
},
|
||||
_listener(){
|
||||
//소수점
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const inputs = document.querySelectorAll(".limitDecimalLength");
|
||||
|
||||
inputs.forEach(input => {
|
||||
input.addEventListener("input", () => {
|
||||
let val = input.value;
|
||||
|
||||
val = val.replace(/[^0-9.]/g, '');
|
||||
const parts = val.split('.');
|
||||
if (parts.length > 2) {
|
||||
val = parts[0] + '.' + parts.slice(1).join('');
|
||||
}
|
||||
if (parts.length === 2) {
|
||||
parts[1] = parts[1].slice(0, 2);
|
||||
val = parts[0] + '.' + parts[1];
|
||||
}
|
||||
if (val.length > 10) {
|
||||
val = val.slice(0, 10);
|
||||
}
|
||||
|
||||
input.value = val;
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
checkNextBtn(){
|
||||
|
||||
},
|
||||
// button
|
||||
//TODO 하나로 바꿔야함
|
||||
handleCheckboxChange(){
|
||||
const isChecked = document.getElementById("forestProductStatus").checked;
|
||||
this.addButtonOnOff(!isChecked);
|
||||
},
|
||||
addButtonOnOff(isEnabled){
|
||||
const button = document.getElementById("addItemBtn");
|
||||
const icon = button.querySelector("i");
|
||||
|
||||
if (isEnabled) {
|
||||
button.disabled = false;
|
||||
icon.classList.remove("ico-add-disabled");
|
||||
icon.classList.add("ico-add");
|
||||
} else {
|
||||
button.disabled = true;
|
||||
icon.classList.remove("ico-add");
|
||||
icon.classList.add("ico-add-disabled");
|
||||
}
|
||||
},
|
||||
// button
|
||||
addOpen(){
|
||||
ENV.module.addPopup.open();
|
||||
},
|
||||
addData(){
|
||||
const form = document.getElementById('forestForm');
|
||||
|
||||
const landTypeSelect = document.getElementById('ndTypeSelect');
|
||||
const mainYieldUnitCodeSelect = document.getElementById('mainYieldUnitCodeSelect');
|
||||
const mainSaleUnitCodeSelect = document.getElementById('mainSaleUnitCodeSelect');
|
||||
const subYieldUnitCodeSelect = document.getElementById('subYieldUnitCodeSelect');
|
||||
const subSaleUnitCodeSelect = document.getElementById('subSaleUnitCodeSelect');
|
||||
|
||||
if (landTypeSelect && landTypeSelect.value) {
|
||||
form.landType.value = landTypeSelect.value;
|
||||
}
|
||||
if (mainYieldUnitCodeSelect && mainYieldUnitCodeSelect.value) {
|
||||
form.mainYieldUnitCode.value = mainYieldUnitCodeSelect.value;
|
||||
}
|
||||
if (mainSaleUnitCodeSelect && mainSaleUnitCodeSelect.value) {
|
||||
form.mainSaleUnitCode.value = mainSaleUnitCodeSelect.value;
|
||||
}
|
||||
if (subYieldUnitCodeSelect && subYieldUnitCodeSelect.value) {
|
||||
form.subYieldUnitCode.value = subYieldUnitCodeSelect.value;
|
||||
}
|
||||
if (subSaleUnitCodeSelect && subSaleUnitCodeSelect.value) {
|
||||
form.subSaleUnitCode.value = subSaleUnitCodeSelect.value;
|
||||
}
|
||||
|
||||
const errorData = [];
|
||||
|
||||
if(!form.cropName.value) {
|
||||
const data = {field:'cropName', message: '재배 작물명을 입력해주세요.'}
|
||||
errorData.push(data);
|
||||
}
|
||||
if(form.mainYield.value && !form.mainYieldUnitCode.value) {
|
||||
const data = {field:'mainYieldUnitCode', message: '단위를 선택해주세요.'}
|
||||
errorData.push(data);
|
||||
}
|
||||
if(form.mainSaleAmount.value && !form.mainSaleUnitCode.value) {
|
||||
const data = {field:'mainSaleUnitCode', message: '단위를 선택해주세요.'}
|
||||
errorData.push(data);
|
||||
}
|
||||
|
||||
if(form.subYield.value && !form.subYieldUnitCode.value) {
|
||||
const data = {field:'subYieldUnitCode', message: '단위를 선택해주세요.'}
|
||||
errorData.push(data);
|
||||
}
|
||||
if(form.subSaleAmount.value && !form.subSaleUnitCode.value) {
|
||||
const data = {field:'subSaleUnitCode', message: '단위를 선택해주세요.'}
|
||||
errorData.push(data);
|
||||
}
|
||||
kri.form.error(errorData)
|
||||
|
||||
if(errorData.length > 0) {
|
||||
const formData = new FormData(form);
|
||||
|
||||
const data = {};
|
||||
formData.forEach((value, key) => {
|
||||
data[key] = value;
|
||||
});
|
||||
ENV.data.addProducts.push(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
</section>
|
||||
|
||||
</html>
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
<html layout:decorate="~{layout/layout-none}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
<div class="select-scroll">
|
||||
<ul class="">
|
||||
<th:block th:each="item : ${regionMainList}">
|
||||
<li class="option" th:data-value="${item.codeValue}" th:text="${item.codeText}">option1</li>
|
||||
<li class="option" th:data-value="${item.id}" th:text="${item.codeText}">option1</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -187,7 +187,7 @@
|
||||
<div class="select-scroll">
|
||||
<ul class="">
|
||||
<th:block th:each="item : ${regionSubList}">
|
||||
<li class="option" th:data-value="${item.codeValue}" th:text="${item.codeText}" >option1</li>
|
||||
<li class="option" th:data-value="${item.id}" th:text="${item.codeText}" >option1</li>
|
||||
</th:block>
|
||||
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user