Merge branch 'dev' into 'deploy-dev-front'
Dev See merge request korea-research/korea-research!95
This commit is contained in:
@@ -11,8 +11,10 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.servlet.LocaleResolver;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
@@ -81,4 +83,14 @@ public class FrontWebMvcConfig implements WebMvcConfigurer {
|
||||
lci.setParamName("lang");
|
||||
return lci;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RestTemplate restTemplate() {
|
||||
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
|
||||
factory.setConnectTimeout(5000);
|
||||
factory.setReadTimeout(10000);
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
restTemplate.setRequestFactory(factory);
|
||||
return restTemplate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package app.module.front.config.application.bean;
|
||||
|
||||
import org.jasypt.encryption.StringEncryptor;
|
||||
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
|
||||
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
|
||||
@Configuration
|
||||
public class JasyptConfig {
|
||||
@Value("${jasypt.encryptor.password}")
|
||||
private String jasyptPassword;
|
||||
|
||||
@Value("${jasypt.encryptor.algorithm}")
|
||||
private String jasyptAlgorithm;
|
||||
|
||||
@Bean("jasyptStringEncryptor")
|
||||
public StringEncryptor stringEncryptor() {
|
||||
SimpleStringPBEConfig config = new SimpleStringPBEConfig();
|
||||
config.setPassword(jasyptPassword); // 암호화할 때 사용하는 키
|
||||
config.setPoolSize("1"); // 인스턴스 pool
|
||||
config.setAlgorithm(jasyptAlgorithm); // 암호화 알고리즘
|
||||
config.setStringOutputType("base64"); // 인코딩 방식
|
||||
config.setKeyObtentionIterations("1000"); // 반복할 해싱 회수
|
||||
config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator"); // salt 생성 클래스
|
||||
config.setIvGeneratorClassName("org.jasypt.iv.RandomIvGenerator");
|
||||
|
||||
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
|
||||
encryptor.setConfig(config);
|
||||
return encryptor;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package app.module.front.config.application.bean;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.io.IOException;
|
||||
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@MapperScan(
|
||||
basePackages = { "app.module.front.**.persistence", "app.module.core.**.persistence" },
|
||||
annotationClass = org.apache.ibatis.annotations.Mapper.class,
|
||||
sqlSessionFactoryRef = "kriSqlSessionFactory")
|
||||
@EnableTransactionManagement
|
||||
public class KRIConfig {
|
||||
|
||||
@Value("${mybatis.mapper-locations.kri}")
|
||||
private String mybatisMapper;
|
||||
|
||||
@Primary
|
||||
@Bean(name = "kriDataSource")
|
||||
@ConfigurationProperties(prefix = "spring.datasource.kri")
|
||||
public DataSource kriDataSource() {
|
||||
return DataSourceBuilder.create().build();
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean(name = "kriSqlSessionFactory")
|
||||
public SqlSessionFactory kriSqlSessionFactory(@Qualifier("kriDataSource") DataSource dataSource) throws Exception {
|
||||
SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean();
|
||||
sessionFactoryBean.setVfs(SpringBootVFS.class);
|
||||
configureSqlSessionFactory(sessionFactoryBean, dataSource);
|
||||
return sessionFactoryBean.getObject();
|
||||
}
|
||||
|
||||
protected void configureSqlSessionFactory(SqlSessionFactoryBean sessionFactoryBean, DataSource dataSource) throws IOException {
|
||||
sessionFactoryBean.setDataSource(dataSource);
|
||||
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||
sessionFactoryBean.setMapperLocations(resolver.getResources(mybatisMapper));
|
||||
|
||||
org.apache.ibatis.session.Configuration configuration = new org.apache.ibatis.session.Configuration();
|
||||
configuration.setMapUnderscoreToCamelCase(true);
|
||||
sessionFactoryBean.setConfiguration(configuration);
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean(name = "kriSqlSessionTemplate")
|
||||
public SqlSessionTemplate kriSqlSessionTemplate(@Qualifier("kriSqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
|
||||
SqlSessionTemplate sqlSessionTemplate = new SqlSessionTemplate(sqlSessionFactory);
|
||||
return sqlSessionTemplate;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package app.module.front.usecase.article.comment.createArticleComment.adapter.web;
|
||||
|
||||
import app.module.core.usecase.article.comment.createArticleComment.ports.CreateArticleCommentPortIn;
|
||||
import app.module.core.usecase.article.comment.createArticleComment.ports.application.domain.CreateArticleComment;
|
||||
import app.module.core.usecase.article.comment.createArticleComment.ports.application.domain.CreateArticleCommentCmd;
|
||||
import app.module.front.usecase.article.comment.createArticleComment.adapter.web.model.CreateArticleCommentReqVO;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class CreateArticleCommentController {
|
||||
|
||||
private final CreateArticleCommentPortIn createArticleCommentPortIn;
|
||||
|
||||
@PostMapping(path = "/api/front/board/articles/comment/create")
|
||||
ResponseEntity<?> operate(@Valid CreateArticleCommentReqVO reqVO, BindingResult bindingResult) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
.body(bindingResult.getFieldErrors());
|
||||
}
|
||||
|
||||
CreateArticleComment comment =
|
||||
createArticleCommentPortIn.operate(
|
||||
new CreateArticleCommentCmd(reqVO.getArticleId(), reqVO.getCommentContent()))
|
||||
.orElseThrow();
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(comment);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package app.module.front.usecase.article.comment.createArticleComment.adapter.web.model;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class CreateArticleCommentReqVO {
|
||||
|
||||
private Long articleId;
|
||||
@NotBlank(message = "{valid.article.comment.required}")
|
||||
private String commentContent;
|
||||
|
||||
public String getCommentContent() {
|
||||
return StringEscapeUtils.escapeHtml4(commentContent);
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package app.module.front.usecase.article.comment.getArticleComments.adapter.web;
|
||||
|
||||
import app.module.core.usecase.article.comment.getArticleComments.ports.GetArticleCommentsPortIn;
|
||||
import app.module.core.usecase.article.comment.getArticleComments.ports.application.domain.GetArticleComments;
|
||||
import app.module.core.usecase.article.comment.getArticleComments.ports.application.domain.GetArticleCommentsCmd;
|
||||
import app.module.front.usecase.article.comment.getArticleComments.adapter.web.model.GetArticleCommentsReqVO;
|
||||
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.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class GetArticleCommentsController {
|
||||
|
||||
private final GetArticleCommentsPortIn getArticleCommentsPortIn;
|
||||
|
||||
@GetMapping(path = "/api/front/board/articles/comments")
|
||||
ResponseEntity<?> operate(
|
||||
@PageableDefault(sort = "id", direction = Sort.Direction.DESC, page = 0, size = 10) Pageable pageable,
|
||||
GetArticleCommentsReqVO reqVO) {
|
||||
|
||||
Page<GetArticleComments> comments =
|
||||
getArticleCommentsPortIn.operate(pageable,
|
||||
new GetArticleCommentsCmd(reqVO.getArticleId()));
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(comments);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package app.module.front.usecase.article.comment.getArticleComments.adapter.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetArticleCommentsReqVO {
|
||||
|
||||
private Long articleId;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package app.module.front.usecase.article.comment.removeArticleComment.adapter.web;
|
||||
|
||||
import app.module.core.usecase.article.comment.removeArticleComment.ports.RemoveArticleCommentPortIn;
|
||||
import app.module.core.usecase.article.comment.removeArticleComment.ports.application.domain.RemoveArticleCommentCmd;
|
||||
import app.module.front.usecase.article.comment.removeArticleComment.adapter.web.model.RemoveArticleCommentReqVO;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class RemoveArticleCommentController {
|
||||
|
||||
private final RemoveArticleCommentPortIn removeArticleCommentPortIn;
|
||||
|
||||
@DeleteMapping(path = "/api/front/board/articles/comment/remove")
|
||||
ResponseEntity<?> operate(@Valid RemoveArticleCommentReqVO reqVO, BindingResult bindingResult) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
.body(bindingResult.getFieldErrors());
|
||||
}
|
||||
|
||||
removeArticleCommentPortIn.operate(new RemoveArticleCommentCmd(reqVO.getRemoveId()));
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package app.module.front.usecase.article.comment.removeArticleComment.adapter.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class RemoveArticleCommentReqVO {
|
||||
|
||||
private Long removeId;
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package app.module.front.usecase.article.comment.updateArticleComment.adapter.web;
|
||||
|
||||
import app.module.core.usecase.article.comment.updateArticleComment.ports.UpdateArticleCommentPortIn;
|
||||
import app.module.core.usecase.article.comment.updateArticleComment.ports.application.domain.UpdateArticleComment;
|
||||
import app.module.core.usecase.article.comment.updateArticleComment.ports.application.domain.UpdateArticleCommentCmd;
|
||||
import app.module.front.usecase.article.comment.updateArticleComment.adapter.web.model.UpdateArticleCommentReqVO;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class UpdateArticleCommentController {
|
||||
|
||||
private final UpdateArticleCommentPortIn updateArticleCommentPortIn;
|
||||
|
||||
@PutMapping(path = "/api/front/board/articles/comment/update")
|
||||
ResponseEntity<?> operate(@Valid UpdateArticleCommentReqVO reqVO, BindingResult bindingResult) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
.body(bindingResult.getFieldErrors());
|
||||
}
|
||||
|
||||
UpdateArticleComment comment =
|
||||
updateArticleCommentPortIn.operate(
|
||||
new UpdateArticleCommentCmd(
|
||||
reqVO.getCommentId(),
|
||||
reqVO.getCommentContent(),
|
||||
reqVO.getArticleId()))
|
||||
.orElseThrow();
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(comment);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package app.module.front.usecase.article.comment.updateArticleComment.adapter.web.model;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class UpdateArticleCommentReqVO {
|
||||
|
||||
private Long commentId;
|
||||
@NotBlank(message = "{valid.article.comment.required}")
|
||||
private String commentContent;
|
||||
private Long articleId;
|
||||
|
||||
public String getCommentContent() {
|
||||
return StringEscapeUtils.escapeHtml4(commentContent);
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package app.module.front.usecase.article.createArticle.adapters.web;
|
||||
|
||||
import app.module.core.usecase.article.createArticle.ports.CreateArticlePortIn;
|
||||
import app.module.core.usecase.article.createArticle.ports.application.domain.CreateArticle;
|
||||
import app.module.core.usecase.article.createArticle.ports.application.domain.CreateArticleCmd;
|
||||
import app.module.front.usecase.article.createArticle.adapters.web.model.CreateArticleReqVO;
|
||||
import app.module.front.usecase.article.createArticle.adapters.web.validator.CreateArticleValidator;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class CreateArticleController {
|
||||
|
||||
private final CreateArticlePortIn createArticlePortIn;
|
||||
private final CreateArticleValidator createArticleValidator;
|
||||
|
||||
@PostMapping(path = "/api/front/board/articles/create")
|
||||
ResponseEntity<?> operate(@Valid CreateArticleReqVO reqVO, BindingResult bindingResult) {
|
||||
createArticleValidator.validate(reqVO, bindingResult);
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
.body(bindingResult.getFieldErrors());
|
||||
}
|
||||
|
||||
CreateArticle article =
|
||||
createArticlePortIn
|
||||
.operate(
|
||||
new CreateArticleCmd(
|
||||
reqVO.getTitle(),
|
||||
reqVO.getContent(),
|
||||
reqVO.getVisible(),
|
||||
reqVO.getStartDate(),
|
||||
reqVO.getEndDate(),
|
||||
reqVO.getFileMappingId()))
|
||||
.orElseThrow();
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(article);
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package app.module.front.usecase.article.createArticle.adapters.web.model;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class CreateArticleReqVO {
|
||||
|
||||
@NotBlank(message = "{valid.common.required}")
|
||||
private String title;
|
||||
|
||||
@NotBlank(message = "{valid.common.required}")
|
||||
private String content;
|
||||
|
||||
@NotNull(message = "{valid.common.required}")
|
||||
private Boolean visible;
|
||||
|
||||
@NotNull(message = "{valid.common.required}")
|
||||
private LocalDateTime startDate;
|
||||
|
||||
@NotNull(message = "{valid.common.required}")
|
||||
private LocalDateTime endDate;
|
||||
|
||||
private List<String> fileMappingId;
|
||||
|
||||
public String getTitle() {
|
||||
return StringEscapeUtils.escapeHtml4(title);
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return StringEscapeUtils.escapeHtml4(content);
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package app.module.front.usecase.article.createArticle.adapters.web.validator;
|
||||
|
||||
import app.module.core.config.application.util.MessageUtil;
|
||||
import app.module.front.usecase.article.createArticle.adapters.web.model.CreateArticleReqVO;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.validation.Validator;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class CreateArticleValidator implements Validator {
|
||||
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> clazz) {
|
||||
return CreateArticleReqVO.class.equals(clazz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(Object target, Errors errors) {
|
||||
CreateArticleReqVO vo = (CreateArticleReqVO) target;
|
||||
|
||||
LocalDateTime startDate = vo.getStartDate();
|
||||
LocalDateTime endDate = vo.getEndDate();
|
||||
|
||||
// 게시일 날짜 체크
|
||||
if (startDate == null) {
|
||||
errors.rejectValue(
|
||||
"startDate", "valid.common.required",
|
||||
messageUtil.getMessage("valid.common.required"));
|
||||
}
|
||||
|
||||
if (endDate == null) {
|
||||
errors.rejectValue(
|
||||
"endDate", "valid.common.required",
|
||||
messageUtil.getMessage("valid.common.required"));
|
||||
}
|
||||
|
||||
if (startDate != null && endDate != null) {
|
||||
if (!startDate.isBefore(endDate)) {
|
||||
errors.rejectValue(
|
||||
"startDate",
|
||||
"valid.common.date.invalid",
|
||||
messageUtil.getMessage("valid.common.date.invalid"));
|
||||
errors.rejectValue(
|
||||
"endDate",
|
||||
"valid.common.date.invalid",
|
||||
messageUtil.getMessage("valid.common.date.invalid"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package app.module.front.usecase.article.createArticleUI;
|
||||
|
||||
import app.module.front.usecase.article.createArticleUI.model.CreateArticleUIReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class CreateArticleUIController {
|
||||
|
||||
@GetMapping(path = "/board/articles/create")
|
||||
String operate(
|
||||
Model model,
|
||||
@ModelAttribute("reqVO") CreateArticleUIReqVO reqVO) {
|
||||
|
||||
return "board/articles/create";
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package app.module.front.usecase.article.createArticleUI.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class CreateArticleUIReqVO {
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package app.module.front.usecase.article.getArticle.adapters.web;
|
||||
|
||||
import app.module.core.usecase.article.getArticle.ports.GetArticlePortIn;
|
||||
import app.module.core.usecase.article.getArticle.ports.application.domain.GetArticleCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class GetArticleController {
|
||||
|
||||
private final GetArticlePortIn getArticlePortIn;
|
||||
|
||||
@GetMapping(path = "/api/front/board/articles/{id}")
|
||||
ResponseEntity<?> operate(@PathVariable Long id) {
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(getArticlePortIn.operate(new GetArticleCmd(id)).orElseThrow());
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package app.module.front.usecase.article.getArticleUI.adapters.web;
|
||||
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import app.module.core.usecase.article.getArticle.ports.GetArticlePortIn;
|
||||
import app.module.core.usecase.article.getArticle.ports.application.domain.GetArticle;
|
||||
import app.module.core.usecase.article.getArticle.ports.application.domain.GetArticleCmd;
|
||||
import app.module.front.usecase.article.getArticleUI.adapters.web.model.GetArticleUIReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class GetArticleUIController {
|
||||
|
||||
private final GetArticlePortIn getArticlePortIn;
|
||||
|
||||
@GetMapping(path = "/board/articles/{id}")
|
||||
String operate(
|
||||
Model model,
|
||||
@PathVariable @ModelAttribute("id") Long id,
|
||||
@ModelAttribute("reqVO") GetArticleUIReqVO reqVO) {
|
||||
|
||||
GetArticle getArticle =
|
||||
getArticlePortIn.operate(new GetArticleCmd(id)).orElseThrow();
|
||||
|
||||
// 로그인 사용자와 게시물 작성자가 동일한지 체크
|
||||
model.addAttribute("isAuthor",
|
||||
getArticle.getCreatedBy().equals(CommonUtil.getLoginUsername()));
|
||||
model.addAttribute("article", getArticle);
|
||||
|
||||
return "board/articles/{id}";
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package app.module.front.usecase.article.getArticleUI.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetArticleUIReqVO {
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package app.module.front.usecase.article.getArticles.adapters.web;
|
||||
|
||||
import app.module.core.usecase.article.getArticles.ports.GetArticlesPortIn;
|
||||
import app.module.core.usecase.article.getArticles.ports.application.domain.GetArticles;
|
||||
import app.module.core.usecase.article.getArticles.ports.application.domain.GetArticlesCmd;
|
||||
import app.module.front.usecase.article.getArticles.adapters.web.model.GetArticlesReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class GetArticlesController {
|
||||
|
||||
private final GetArticlesPortIn getArticlesPortIn;
|
||||
|
||||
@GetMapping(path = "/api/board/articles")
|
||||
ResponseEntity<?> operate(@PageableDefault Pageable pageable, GetArticlesReqVO reqVO) {
|
||||
Page<GetArticles> articles =
|
||||
getArticlesPortIn.operate(
|
||||
pageable,
|
||||
new GetArticlesCmd(
|
||||
reqVO.getSearchField(), reqVO.getSearchValue(), reqVO.getSearchOpen()));
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(articles);
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package app.module.front.usecase.article.getArticles.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetArticlesReqVO {
|
||||
|
||||
private String searchField;
|
||||
private String searchValue;
|
||||
private String searchOpen;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package app.module.front.usecase.article.getArticlesUI;
|
||||
|
||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
import app.module.front.usecase.article.getArticlesUI.model.GetArticlesUIReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class GetArticlesUIController {
|
||||
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
|
||||
@GetMapping(path = "/board/articles")
|
||||
String operate(
|
||||
Model model,
|
||||
@ModelAttribute("reqVO") GetArticlesUIReqVO reqVO) {
|
||||
|
||||
model.addAttribute("pageRows", uiCodeListPortIn.connect("code.pageable.rows"));
|
||||
|
||||
return "board/articles";
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package app.module.front.usecase.article.getArticlesUI.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.thymeleaf.util.StringUtils;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetArticlesUIReqVO {
|
||||
|
||||
private Integer page;
|
||||
private String sort;
|
||||
private Integer size;
|
||||
private String searchField;
|
||||
private String searchValue;
|
||||
private String searchOpen;
|
||||
|
||||
public Integer getPage() {
|
||||
// 요청 페이지 넘버 - 초기값 `0`
|
||||
return page != null ? page : 0;
|
||||
}
|
||||
|
||||
public String getSort() {
|
||||
// 정렬 값 - 초기값 `orderNo 내림차순`
|
||||
return StringUtils.isEmpty(sort) ? "orderNo,DESC" : sort;
|
||||
}
|
||||
|
||||
public Integer getSize() {
|
||||
// 페이지 당 아이템 수 - 초기값 `10`
|
||||
return size != null ? size : 10;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package app.module.front.usecase.article.removeArticles.adapters.web;
|
||||
|
||||
import app.module.core.usecase.article.removeArticles.ports.RemoveArticlesPortIn;
|
||||
import app.module.core.usecase.article.removeArticles.ports.application.domain.RemoveArticlesCmd;
|
||||
import app.module.front.usecase.article.removeArticles.adapters.web.model.RemoveArticlesReqVO;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class RemoveArticlesController {
|
||||
|
||||
private final RemoveArticlesPortIn removeArticlesPortIn;
|
||||
|
||||
@DeleteMapping(path = "/api/front/board/articles/remove")
|
||||
ResponseEntity<?> operate(@Valid RemoveArticlesReqVO reqVO, BindingResult bindingResult) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
.body(bindingResult.getFieldErrors());
|
||||
}
|
||||
|
||||
removeArticlesPortIn.operate(new RemoveArticlesCmd(reqVO.getSelectIds()));
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package app.module.front.usecase.article.removeArticles.adapters.web.model;
|
||||
|
||||
import java.util.Set;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class RemoveArticlesReqVO {
|
||||
|
||||
private Set<Long> selectIds;
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package app.module.front.usecase.article.updateArticle.adapters.web;
|
||||
|
||||
import app.module.core.usecase.article.updateArticle.ports.UpdateArticlePortIn;
|
||||
import app.module.core.usecase.article.updateArticle.ports.application.domain.UpdateArticleCmd;
|
||||
import app.module.front.usecase.article.updateArticle.adapters.web.model.UpdateArticleReqVO;
|
||||
import app.module.front.usecase.article.updateArticle.adapters.web.validator.UpdateArticleValidator;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
class UpdateArticleController {
|
||||
|
||||
private final UpdateArticlePortIn updateArticlePortIn;
|
||||
private final UpdateArticleValidator updateArticleValidator;
|
||||
|
||||
@PutMapping(path = "/api/front/board/articles/update")
|
||||
ResponseEntity<?> operate(@Valid UpdateArticleReqVO reqVO, BindingResult bindingResult) {
|
||||
updateArticleValidator.validate(reqVO, bindingResult);
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
.body(bindingResult.getFieldErrors());
|
||||
}
|
||||
|
||||
updateArticlePortIn.operate(
|
||||
new UpdateArticleCmd(
|
||||
reqVO.getId(),
|
||||
reqVO.getTitle(),
|
||||
reqVO.getContent(),
|
||||
reqVO.getVisible(),
|
||||
reqVO.getOrderNo(),
|
||||
reqVO.getStartDate(),
|
||||
reqVO.getEndDate(),
|
||||
reqVO.getFileMappingId()));
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package app.module.front.usecase.article.updateArticle.adapters.web.model;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class UpdateArticleReqVO {
|
||||
|
||||
@NotNull(message = "{valid.common.required}")
|
||||
private Long id;
|
||||
|
||||
@NotBlank(message = "{valid.common.required}")
|
||||
private String title;
|
||||
|
||||
@NotBlank(message = "{valid.common.required}")
|
||||
private String content;
|
||||
|
||||
@NotNull(message = "{valid.common.required}")
|
||||
private Boolean visible;
|
||||
|
||||
@NotNull(message = "{valid.common.required}")
|
||||
private Integer orderNo;
|
||||
|
||||
@NotNull(message = "{valid.common.required}")
|
||||
private LocalDateTime startDate;
|
||||
|
||||
@NotNull(message = "{valid.common.required}")
|
||||
private LocalDateTime endDate;
|
||||
|
||||
private List<String> fileMappingId;
|
||||
|
||||
public String getTitle() {
|
||||
return StringEscapeUtils.escapeHtml4(title);
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return StringEscapeUtils.escapeHtml4(content);
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package app.module.front.usecase.article.updateArticle.adapters.web.validator;
|
||||
|
||||
import app.module.core.config.application.util.MessageUtil;
|
||||
import app.module.front.usecase.article.updateArticle.adapters.web.model.UpdateArticleReqVO;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.validation.Validator;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class UpdateArticleValidator implements Validator {
|
||||
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> clazz) {
|
||||
return UpdateArticleReqVO.class.equals(clazz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(Object target, Errors errors) {
|
||||
UpdateArticleReqVO vo = (UpdateArticleReqVO) target;
|
||||
|
||||
LocalDateTime startDate = vo.getStartDate();
|
||||
LocalDateTime endDate = vo.getEndDate();
|
||||
|
||||
// 게시일 날짜 체크
|
||||
if (startDate == null) {
|
||||
errors.rejectValue(
|
||||
"startDate", "valid.common.required",
|
||||
messageUtil.getMessage("valid.common.required"));
|
||||
}
|
||||
|
||||
if (endDate == null) {
|
||||
errors.rejectValue(
|
||||
"endDate", "valid.common.required",
|
||||
messageUtil.getMessage("valid.common.required"));
|
||||
}
|
||||
|
||||
if (startDate != null && endDate != null) {
|
||||
if (!startDate.isBefore(endDate)) {
|
||||
errors.rejectValue(
|
||||
"startDate",
|
||||
"valid.common.date.invalid",
|
||||
messageUtil.getMessage("valid.common.date.invalid"));
|
||||
errors.rejectValue(
|
||||
"endDate",
|
||||
"valid.common.date.invalid",
|
||||
messageUtil.getMessage("valid.common.date.invalid"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package app.module.front.usecase.article.updateArticleUI.adapters.web;
|
||||
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import app.module.core.usecase.article.getArticle.ports.GetArticlePortIn;
|
||||
import app.module.core.usecase.article.getArticle.ports.application.domain.GetArticleCmd;
|
||||
import app.module.front.usecase.article.updateArticleUI.adapters.web.model.UpdateArticleUIReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class UpdateArticleUIController {
|
||||
|
||||
private final GetArticlePortIn getArticlePortIn;
|
||||
|
||||
@GetMapping(path = "/board/articles/update/{id}")
|
||||
String operate(
|
||||
Model model,
|
||||
@PathVariable @ModelAttribute("id") Long id,
|
||||
@ModelAttribute("reqVO") UpdateArticleUIReqVO reqVO) {
|
||||
|
||||
getArticlePortIn.operate(new GetArticleCmd(id))
|
||||
.filter(article -> article.getCreatedBy().equals(CommonUtil.getLoginUsername()))
|
||||
.orElseThrow(() -> new RuntimeException("수정 권한이 없는 사용자입니다."));
|
||||
|
||||
return "board/articles/update/{id}";
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package app.module.front.usecase.article.updateArticleUI.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class UpdateArticleUIReqVO {
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import app.module.core.config.application.enums.DailySort;
|
||||
import app.module.core.config.application.enums.DailyTargetStatus;
|
||||
import app.module.core.config.application.enums.MonthStatus;
|
||||
import app.module.core.config.application.util.DailyUtil;
|
||||
import app.module.core.config.constants.DailyRecordConstants;
|
||||
import app.module.front.usecase.daily.calendar.adapters.persistence.model.DailyRecordCalendarDto;
|
||||
import app.module.front.usecase.daily.calendar.adapters.persistence.model.MonthlyStatusDto;
|
||||
import app.module.front.usecase.daily.calendar.ports.RecordCalendarPortOut;
|
||||
@@ -34,7 +35,7 @@ public class RecordCalendarDao implements RecordCalendarPortOut {
|
||||
public List<RecordCalendar> operate(RecordCalendarCmd command) {
|
||||
List<DailyRecordCalendarDto> calendarList = this.getCalendarList(command);
|
||||
List<DailyRecordStatusDto> statusList = this.getDailyRecordStatus(command);
|
||||
MonthlyStatusDto monthlyStatus = this.getBankExist(command);
|
||||
MonthlyStatusDto monthlyStatus = this.getMonthlyStatus(command);
|
||||
|
||||
String pathFormat = "/record/%s/%s/%s";
|
||||
|
||||
@@ -65,6 +66,16 @@ public class RecordCalendarDao implements RecordCalendarPortOut {
|
||||
refine.setRegistrable(dailyUtil.isRegisterPossible(refine.getStartDate(), refine.getEndDate()));
|
||||
refine.setModifiable(dailyUtil.isModifiable(refine.getStartDate(), refine.getEndDate()));
|
||||
|
||||
if (calendar.getGroupNo() == 1) {
|
||||
Long carryOver = this.getMonthlyCarryOver(command);
|
||||
|
||||
if (!LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMM")).equals(command.getSearchMonth()) && carryOver == null) {
|
||||
carryOver = 0L;
|
||||
}
|
||||
|
||||
refine.setCarryOver(carryOver);
|
||||
}
|
||||
|
||||
DailyRecordStatusDto findStatus = statusList.stream()
|
||||
.filter(f -> Objects.equals(calendar.getDailyId(), f.getDailyId()))
|
||||
.findFirst().orElse(null);
|
||||
@@ -136,9 +147,18 @@ public class RecordCalendarDao implements RecordCalendarPortOut {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDataNoneCountBySomeDayAfter(Long householdSeq) {
|
||||
public MonthlyStatusDto getMonthlyStatus(RecordCalendarCmd command) {
|
||||
MonthlyStatusDto detail = recordCalendarMapper.getMonthlyStatus(command);
|
||||
|
||||
return recordCalendarMapper.getDataNoneCountBySomeDayAfter(householdSeq);
|
||||
return detail == null ? new MonthlyStatusDto(MonthStatus.NONE, MonthStatus.NONE, MonthStatus.NONE) : detail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDataNoneCountBySomeDayAfter(Long householdSeq) {
|
||||
// 검색 당일을 제외하여 -1 처리
|
||||
int limitDay = DailyRecordConstants.REGISTER_LIMIT_DAY - 1;
|
||||
|
||||
return recordCalendarMapper.getDataNoneCountBySomeDayAfter(householdSeq, limitDay);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -174,6 +194,17 @@ public class RecordCalendarDao implements RecordCalendarPortOut {
|
||||
return refineList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정월의 월초이월금 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 월초이월금
|
||||
*/
|
||||
private Long getMonthlyCarryOver(RecordCalendarCmd command) {
|
||||
|
||||
return recordCalendarMapper.getMonthlyCarryOver(command);
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정월의 일계부 등록 상태 조회
|
||||
*
|
||||
@@ -189,18 +220,6 @@ public class RecordCalendarDao implements RecordCalendarPortOut {
|
||||
return statusList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정월의 월별 작성 상태 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return true=등록완료, false=미등록
|
||||
*/
|
||||
private MonthlyStatusDto getBankExist(RecordCalendarCmd command) {
|
||||
MonthlyStatusDto detail = recordCalendarMapper.getMonthlyStatus(command);
|
||||
|
||||
return detail == null ? new MonthlyStatusDto(MonthStatus.NONE, MonthStatus.NONE, MonthStatus.NONE) : detail;
|
||||
}
|
||||
|
||||
/**
|
||||
* 미작성 목록 조회
|
||||
*
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package app.module.front.usecase.daily.calendar.adapters.persistence;
|
||||
|
||||
import app.module.front.usecase.daily.calendar.adapters.persistence.model.DailyRecordCalendarDto;
|
||||
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordStatusDto;
|
||||
import app.module.front.usecase.daily.calendar.adapters.persistence.model.DailyRecordCalendarDto;
|
||||
import app.module.front.usecase.daily.calendar.adapters.persistence.model.MonthlyStatusDto;
|
||||
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendarCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -18,6 +19,13 @@ public interface RecordCalendarMapper {
|
||||
*/
|
||||
List<DailyRecordCalendarDto> getCalendarByDailyRecord(RecordCalendarCmd command);
|
||||
|
||||
/**
|
||||
* 특정월의 월초이월금 조회
|
||||
* @param command 검색 조건
|
||||
* @return 월초이월금
|
||||
*/
|
||||
Long getMonthlyCarryOver(RecordCalendarCmd command);
|
||||
|
||||
/**
|
||||
* 특정월의 월별 작성 상태 조회
|
||||
*
|
||||
@@ -27,12 +35,13 @@ public interface RecordCalendarMapper {
|
||||
MonthlyStatusDto getMonthlyStatus(RecordCalendarCmd command);
|
||||
|
||||
/**
|
||||
* 3일전 ~ 15일전 미등록된 데이터 개수 조회
|
||||
* 등록가능 기간에 미등록된 데이터 개수 조회
|
||||
*
|
||||
* @param householdSeq 임가회원 일련번호
|
||||
* @param limitDay 전일로부터 x일전 검색 일
|
||||
* @return 미등록 건 수
|
||||
*/
|
||||
Integer getDataNoneCountBySomeDayAfter(Long householdSeq);
|
||||
Integer getDataNoneCountBySomeDayAfter(@Param("householdSeq") Long householdSeq, @Param("limitDay") Integer limitDay);
|
||||
|
||||
/**
|
||||
* 최신 등록일 데이터 조회
|
||||
|
||||
@@ -27,6 +27,6 @@ public class MonthlyStatusDto {
|
||||
*/
|
||||
public boolean isBankNone() {
|
||||
return (MonthStatus.NONE.equals(bankInput) || bankInput == null)
|
||||
&& (MonthStatus.NONE.equals(bankOutput) || bankOutput == null);
|
||||
|| (MonthStatus.NONE.equals(bankOutput) || bankOutput == null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class RecordCalendarUIController {
|
||||
|
||||
model.addAttribute("reqVO", reqVO);
|
||||
|
||||
model.addAttribute("dailyDataNone", recordCalendarPortIn.getDataNoneCountBySomeDayAfter());
|
||||
model.addAttribute("dailyDataNone", recordCalendarPortIn.getDailyNone(reqVO));
|
||||
|
||||
return "record/calendar";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package app.module.front.usecase.daily.calendar.ports;
|
||||
|
||||
import app.module.front.usecase.daily.calendar.adapters.persistence.model.MonthlyStatusDto;
|
||||
import app.module.front.usecase.daily.calendar.adapters.web.model.RecordCalendarUIReqVO;
|
||||
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendar;
|
||||
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendarCmd;
|
||||
|
||||
@@ -17,9 +19,10 @@ public interface RecordCalendarPortIn {
|
||||
/**
|
||||
* 특정기간의 데이터 미등록 여부 조회
|
||||
*
|
||||
* @return true=미등록 데이터 있음, false=없음
|
||||
* @param reqVO 검색 조건
|
||||
* @return 미등록 데이터
|
||||
*/
|
||||
boolean getDataNoneCountBySomeDayAfter();
|
||||
String getDailyNone(RecordCalendarUIReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 일계부 최신 데이터 등록일 조회
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package app.module.front.usecase.daily.calendar.ports;
|
||||
|
||||
import app.module.front.usecase.daily.calendar.adapters.persistence.model.MonthlyStatusDto;
|
||||
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendar;
|
||||
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendarCmd;
|
||||
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordStatusDto;
|
||||
@@ -9,6 +10,8 @@ import java.util.List;
|
||||
public interface RecordCalendarPortOut {
|
||||
List<RecordCalendar> operate(RecordCalendarCmd command);
|
||||
|
||||
MonthlyStatusDto getMonthlyStatus(RecordCalendarCmd command);
|
||||
|
||||
int getDataNoneCountBySomeDayAfter(Long householdSeq);
|
||||
|
||||
DailyRecordStatusDto getLatestDate(Long householdSeq);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package app.module.front.usecase.daily.calendar.ports.application;
|
||||
|
||||
import app.module.front.config.application.util.AuthUtil;
|
||||
import app.module.front.usecase.daily.calendar.adapters.persistence.model.MonthlyStatusDto;
|
||||
import app.module.front.usecase.daily.calendar.adapters.web.model.RecordCalendarUIReqVO;
|
||||
import app.module.front.usecase.daily.calendar.ports.RecordCalendarPortIn;
|
||||
import app.module.front.usecase.daily.calendar.ports.RecordCalendarPortOut;
|
||||
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendar;
|
||||
@@ -25,10 +27,24 @@ public class RecordCalendarService implements RecordCalendarPortIn {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getDataNoneCountBySomeDayAfter() {
|
||||
int dataNoneCount = portOut.getDataNoneCountBySomeDayAfter(AuthUtil.getUserSeq());
|
||||
public String getDailyNone(RecordCalendarUIReqVO reqVO) {
|
||||
RecordCalendarCmd command = new RecordCalendarCmd(
|
||||
reqVO.getSearchMonth(),
|
||||
reqVO.getHouseholdSeq());
|
||||
|
||||
return dataNoneCount != 0;
|
||||
int dataNoneCount = portOut.getDataNoneCountBySomeDayAfter(command.getHouseholdSeq());
|
||||
MonthlyStatusDto monthly = portOut.getMonthlyStatus(command);
|
||||
|
||||
String returnValue = "DONE";
|
||||
if (dataNoneCount != 0) {
|
||||
returnValue = "DATA_NONE";
|
||||
} else if (monthly != null && monthly.isForestNone()) {
|
||||
returnValue = "FOREST_NONE";
|
||||
} else if (monthly != null && monthly.isBankNone()) {
|
||||
returnValue = "BANK_NONE";
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,8 +16,7 @@ public class RecordCalendar {
|
||||
private Integer no;
|
||||
private Integer start;
|
||||
private Integer end;
|
||||
//TODO : JsonIgnore
|
||||
// @JsonIgnore
|
||||
@JsonIgnore
|
||||
private LocalDate startDate;
|
||||
@JsonIgnore
|
||||
private LocalDate endDate;
|
||||
@@ -25,4 +24,8 @@ public class RecordCalendar {
|
||||
private boolean isModifiable;
|
||||
private List<CalendarChildren> children;
|
||||
private List<CalendarChildren> monthly;
|
||||
/**
|
||||
* 월초이월금
|
||||
*/
|
||||
private Long carryOver;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
package app.module.front.usecase.daily.expense.adapters.persistence;
|
||||
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import app.module.core.config.application.util.SftpFileDeleteUtil;
|
||||
import app.module.core.usecase.file.updateFile.adapters.persistence.UpdateFileMapper;
|
||||
import app.module.front.usecase.daily.expense.adapters.persistence.model.DailyExpenseDto;
|
||||
import app.module.front.usecase.daily.expense.ports.DailyExpensePortOut;
|
||||
import app.module.front.usecase.daily.expense.ports.application.domain.CreateDailyExpenseCmd;
|
||||
import app.module.front.usecase.daily.expense.ports.application.domain.GetDailyExpenseCmd;
|
||||
import app.module.front.usecase.daily.expense.ports.application.domain.RemoveDailyExpenseCmd;
|
||||
import com.jcraft.jsch.JSchException;
|
||||
import com.jcraft.jsch.SftpException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
@@ -15,22 +21,27 @@ import java.util.List;
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class DailyExpenseDao implements DailyExpensePortOut {
|
||||
private final DailyExpenseMapper dailyExpenseMapper;
|
||||
private final DailyExpenseMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<DailyExpenseDto> list(GetDailyExpenseCmd command) {
|
||||
return dailyExpenseMapper.getDailyExpenseList(command);
|
||||
return mapper.getDailyExpenseList(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DailyExpenseDto> monthList(GetDailyExpenseCmd command) {
|
||||
return mapper.getDailyExpenseMonthList(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(GetDailyExpenseCmd findCmd, CreateDailyExpenseCmd command) {
|
||||
Integer existCount = dailyExpenseMapper.getRecordExistCount(findCmd);
|
||||
Integer existCount = mapper.getRecordExistCount(findCmd);
|
||||
if (existCount == 0) {
|
||||
dailyExpenseMapper.createDailyExpense(command);
|
||||
mapper.createDailyExpense(command);
|
||||
|
||||
log.debug("[CreateDailyExpense] record={}", command);
|
||||
} else {
|
||||
dailyExpenseMapper.updateDailyExpense(command);
|
||||
mapper.updateDailyExpense(command);
|
||||
|
||||
log.debug("[UpdateDailyExpense] record={}", command);
|
||||
}
|
||||
@@ -38,9 +49,10 @@ public class DailyExpenseDao implements DailyExpensePortOut {
|
||||
|
||||
@Override
|
||||
public void remove(GetDailyExpenseCmd findCmd, RemoveDailyExpenseCmd command) {
|
||||
Integer existCount = dailyExpenseMapper.getRecordExistCount(findCmd);
|
||||
Integer existCount = mapper.getRecordExistCount(findCmd);
|
||||
if (existCount != 0) {
|
||||
dailyExpenseMapper.removeDailyExpense(command);
|
||||
mapper.removeDailyExpense(command);
|
||||
mapper.removeDailyExpenseReceipt(command);
|
||||
|
||||
log.debug("[RemoveDailyExpense] record={}", command);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package app.module.front.usecase.daily.expense.adapters.persistence;
|
||||
|
||||
import app.module.front.usecase.daily.expense.ports.application.domain.CreateDailyExpenseCmd;
|
||||
import app.module.front.usecase.daily.expense.adapters.persistence.model.DailyExpenseDto;
|
||||
import app.module.front.usecase.daily.expense.ports.application.domain.CreateDailyExpenseCmd;
|
||||
import app.module.front.usecase.daily.expense.ports.application.domain.GetDailyExpenseCmd;
|
||||
import app.module.front.usecase.daily.expense.ports.application.domain.RemoveDailyExpenseCmd;
|
||||
import app.module.front.usecase.daily.expense.adapters.web.model.DailyExpenseUIReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@@ -12,13 +11,21 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface DailyExpenseMapper {
|
||||
/**
|
||||
* 일계부 지출 목록 조회
|
||||
* 특정 그룹일의 일계부 지출 목록 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 수입 목록
|
||||
*/
|
||||
List<DailyExpenseDto> getDailyExpenseList(GetDailyExpenseCmd command);
|
||||
|
||||
/**
|
||||
* 특정월의 일계부 지출 목록 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 지출 목록
|
||||
*/
|
||||
List<DailyExpenseDto> getDailyExpenseMonthList(GetDailyExpenseCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 지출 데이터 존재 여부
|
||||
*
|
||||
@@ -47,4 +54,11 @@ public interface DailyExpenseMapper {
|
||||
* @param command 삭제 데이터
|
||||
*/
|
||||
void removeDailyExpense(RemoveDailyExpenseCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 지출 영수증 삭제
|
||||
*
|
||||
* @param command 삭제 데이터
|
||||
*/
|
||||
void removeDailyExpenseReceipt(RemoveDailyExpenseCmd command);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import app.module.front.usecase.daily.income.adapters.web.model.DailyInputType;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DailyExpenseDto {
|
||||
@@ -19,6 +21,8 @@ public class DailyExpenseDto {
|
||||
private String unitSelf;
|
||||
private Long price;
|
||||
private Long estimatedValue;
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
|
||||
/**
|
||||
* 수정 가능 여부
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.module.front.usecase.daily.expense.adapters.persistence.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DailyExpenseMonthDto {
|
||||
private Long dailyRecordSeq;
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
private List<DailyExpenseDto> children;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package app.module.front.usecase.daily.expense.ports;
|
||||
|
||||
import app.module.front.usecase.daily.expense.adapters.persistence.model.DailyExpenseDto;
|
||||
import app.module.front.usecase.daily.expense.adapters.persistence.model.DailyExpenseMonthDto;
|
||||
import app.module.front.usecase.daily.expense.adapters.web.model.CreateDailyExpenseReqVO;
|
||||
import app.module.front.usecase.daily.expense.adapters.web.model.DailyExpenseUIReqVO;
|
||||
import app.module.front.usecase.daily.expense.adapters.web.model.RemoveDailyExpenseReqVO;
|
||||
@@ -9,13 +10,21 @@ import java.util.List;
|
||||
|
||||
public interface DailyExpensePortIn {
|
||||
/**
|
||||
* 일계부 지출 조회
|
||||
* 특정 그룹일의 일계부 지출 조회
|
||||
*
|
||||
* @param reqVO 검색 조건
|
||||
* @return 지출 목록
|
||||
*/
|
||||
List<DailyExpenseDto> list(DailyExpenseUIReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 특정월의 일계부 수입 조회
|
||||
*
|
||||
* @param reqVO 검색 조건
|
||||
* @return 수입 목록
|
||||
*/
|
||||
List<DailyExpenseMonthDto> monthList(DailyExpenseUIReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 일계부 지출 조회
|
||||
*
|
||||
|
||||
@@ -4,6 +4,8 @@ import app.module.front.usecase.daily.expense.adapters.persistence.model.DailyEx
|
||||
import app.module.front.usecase.daily.expense.ports.application.domain.CreateDailyExpenseCmd;
|
||||
import app.module.front.usecase.daily.expense.ports.application.domain.GetDailyExpenseCmd;
|
||||
import app.module.front.usecase.daily.expense.ports.application.domain.RemoveDailyExpenseCmd;
|
||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||
import app.module.front.usecase.daily.income.ports.application.domain.GetDailyIncomeCmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -16,6 +18,14 @@ public interface DailyExpensePortOut {
|
||||
*/
|
||||
List<DailyExpenseDto> list(GetDailyExpenseCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 지출 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 지출 목록
|
||||
*/
|
||||
List<DailyExpenseDto> monthList(GetDailyExpenseCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 지출 등록
|
||||
*
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package app.module.front.usecase.daily.expense.ports.application;
|
||||
|
||||
import app.module.core.config.constants.DailyRecordConstants;
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
||||
import app.module.front.config.application.util.AuditUtil;
|
||||
import app.module.front.config.constants.CommonConstants;
|
||||
import app.module.front.usecase.daily.expense.adapters.persistence.model.DailyExpenseDto;
|
||||
import app.module.front.usecase.daily.expense.adapters.persistence.model.DailyExpenseMonthDto;
|
||||
import app.module.front.usecase.daily.expense.adapters.web.model.CreateDailyExpenseReqVO;
|
||||
import app.module.front.usecase.daily.expense.adapters.web.model.DailyExpenseUIReqVO;
|
||||
import app.module.front.usecase.daily.expense.adapters.web.model.RemoveDailyExpenseReqVO;
|
||||
@@ -14,11 +16,13 @@ import app.module.front.usecase.daily.expense.ports.DailyExpensePortOut;
|
||||
import app.module.front.usecase.daily.expense.ports.application.domain.CreateDailyExpenseCmd;
|
||||
import app.module.front.usecase.daily.expense.ports.application.domain.GetDailyExpenseCmd;
|
||||
import app.module.front.usecase.daily.expense.ports.application.domain.RemoveDailyExpenseCmd;
|
||||
import app.module.core.usecase.daily.record.ports.application.DailyRecordService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -29,12 +33,30 @@ public class DailyExpenseService implements DailyExpensePortIn {
|
||||
|
||||
@Override
|
||||
public List<DailyExpenseDto> list(DailyExpenseUIReqVO reqVO) {
|
||||
return this.getRefineList(reqVO);
|
||||
return this.getRefineList(reqVO, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DailyExpenseMonthDto> monthList(DailyExpenseUIReqVO reqVO) {
|
||||
List<DailyExpenseDto> list = this.getRefineList(reqVO, false);
|
||||
|
||||
List<DailyExpenseMonthDto> monthList = new ArrayList<>();
|
||||
List<Long> recordSeqList = list.stream().map(DailyExpenseDto::getDailyRecordSeq).distinct().toList();
|
||||
for (Long seq : recordSeqList) {
|
||||
DailyExpenseMonthDto month = new DailyExpenseMonthDto();
|
||||
month.setDailyRecordSeq(seq);
|
||||
month.setStartDate(list.stream().filter(f -> Objects.equals(f.getDailyRecordSeq(), seq)).map(DailyExpenseDto::getStartDate).findFirst().orElse(null));
|
||||
month.setEndDate(list.stream().filter(f -> Objects.equals(f.getDailyRecordSeq(), seq)).map(DailyExpenseDto::getEndDate).findFirst().orElse(null));
|
||||
month.setChildren(list.stream().filter(f -> Objects.equals(f.getDailyRecordSeq(), seq)).collect(Collectors.toList()));
|
||||
monthList.add(month);
|
||||
}
|
||||
|
||||
return monthList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DailyExpenseDto detail(DailyExpenseUIReqVO reqVO) {
|
||||
List<DailyExpenseDto> list = this.getRefineList(reqVO);
|
||||
List<DailyExpenseDto> list = this.getRefineList(reqVO, true);
|
||||
if (list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -45,14 +67,17 @@ public class DailyExpenseService implements DailyExpensePortIn {
|
||||
/**
|
||||
* 목록 데이터 조회
|
||||
*
|
||||
* @param reqVO 검색 조건
|
||||
* @param reqVO 검색 조건
|
||||
* @param dayGroup 일 그룹 조건(true=일, false=월)
|
||||
* @return 공통 처리된 목록
|
||||
*/
|
||||
private List<DailyExpenseDto> getRefineList(DailyExpenseUIReqVO reqVO) {
|
||||
List<DailyExpenseDto> list = portOut.list(new GetDailyExpenseCmd(reqVO.getSearchMonth(),
|
||||
private List<DailyExpenseDto> getRefineList(DailyExpenseUIReqVO reqVO, boolean dayGroup) {
|
||||
GetDailyExpenseCmd command = new GetDailyExpenseCmd(reqVO.getSearchMonth(),
|
||||
reqVO.getGroupNo(),
|
||||
reqVO.getHouseholdSeq(),
|
||||
reqVO.getId()));
|
||||
reqVO.getId());
|
||||
|
||||
List<DailyExpenseDto> list = dayGroup ? portOut.list(command) : portOut.monthList(command);
|
||||
|
||||
List<UICodeElement> recordUnit = uiCodeListPortIn.connect("code.record.unit");
|
||||
|
||||
@@ -98,8 +123,8 @@ public class DailyExpenseService implements DailyExpensePortIn {
|
||||
formVO.getId(),
|
||||
formVO.getDailyRecordSeq(),
|
||||
formVO.getInputType(),
|
||||
"2", // [정책] 2 고정
|
||||
(formVO.getCredit() ? "52210" : null), // [정책] 외상판매 Y 일 경우 수입부호 52210 적재
|
||||
DailyRecordConstants.EXPENSE_CATEGORY,
|
||||
(formVO.getCredit() ? DailyRecordConstants.EXPENSE_INCOME_MARK : null),
|
||||
formVO.getCredit(),
|
||||
formVO.getExpenseKind(),
|
||||
formVO.getSourcePurpose(),
|
||||
@@ -110,7 +135,7 @@ public class DailyExpenseService implements DailyExpensePortIn {
|
||||
formVO.getEstimatedValue()));
|
||||
|
||||
portOut.create(findCmd, command);
|
||||
|
||||
formVO.setId(command.getId());
|
||||
dailyRecordPortIn.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo(), findCmd.getHouseholdSeq());
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,11 @@ public class DailyFarmingDao implements DailyFarmingPortOut {
|
||||
return mapper.getDailyFarmingList(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DailyFarmingDto> monthList(GetDailyFarmingCmd command) {
|
||||
return mapper.getDailyFarmingMonthList(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(GetDailyFarmingCmd findCmd, CreateDailyFarmingCmd command) {
|
||||
Integer existCount = mapper.getRecordExistCount(findCmd);
|
||||
|
||||
@@ -4,6 +4,8 @@ import app.module.front.usecase.daily.farming.adapters.persistence.model.DailyFa
|
||||
import app.module.front.usecase.daily.farming.ports.application.domain.CreateDailyFarmingCmd;
|
||||
import app.module.front.usecase.daily.farming.ports.application.domain.GetDailyFarmingCmd;
|
||||
import app.module.front.usecase.daily.farming.ports.application.domain.RemoveDailyFarmingCmd;
|
||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||
import app.module.front.usecase.daily.income.ports.application.domain.GetDailyIncomeCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@@ -11,13 +13,21 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface DailyFarmingMapper {
|
||||
/**
|
||||
* 일계부 자가농업 목록 조회
|
||||
* 특정 그룹일의 일계부 자가농업 목록 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 수입 목록
|
||||
* @return 자가농업 목록
|
||||
*/
|
||||
List<DailyFarmingDto> getDailyFarmingList(GetDailyFarmingCmd command);
|
||||
|
||||
/**
|
||||
* 특정월의 일계부 자가농업 목록 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 자가농업 목록
|
||||
*/
|
||||
List<DailyFarmingDto> getDailyFarmingMonthList(GetDailyFarmingCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 자가농업 데이터 존재 여부
|
||||
*
|
||||
|
||||
@@ -3,6 +3,8 @@ package app.module.front.usecase.daily.farming.adapters.persistence.model;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DailyFarmingDto {
|
||||
@@ -17,6 +19,8 @@ public class DailyFarmingDto {
|
||||
private String unitLabel;
|
||||
private String unitSelf;
|
||||
private Long estimatedValue;
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
|
||||
/**
|
||||
* 수정 가능 여부
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package app.module.front.usecase.daily.farming.adapters.persistence.model;
|
||||
|
||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DailyFarmingMonthDto {
|
||||
private Long dailyRecordSeq;
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
private List<DailyFarmingDto> children;
|
||||
}
|
||||
@@ -2,21 +2,32 @@ package app.module.front.usecase.daily.farming.ports;
|
||||
|
||||
|
||||
import app.module.front.usecase.daily.farming.adapters.persistence.model.DailyFarmingDto;
|
||||
import app.module.front.usecase.daily.farming.adapters.persistence.model.DailyFarmingMonthDto;
|
||||
import app.module.front.usecase.daily.farming.adapters.web.model.CreateDailyFarmingReqVO;
|
||||
import app.module.front.usecase.daily.farming.adapters.web.model.DailyFarmingUIReqVO;
|
||||
import app.module.front.usecase.daily.farming.adapters.web.model.RemoveDailyFarmingReqVO;
|
||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeMonthDto;
|
||||
import app.module.front.usecase.daily.income.adapters.web.model.DailyIncomeUIReqVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DailyFarmingPortIn {
|
||||
/**
|
||||
* 일계부 자가농업 조회
|
||||
* 특정 그룹일의 일계부 자가농업 조회
|
||||
*
|
||||
* @param reqVO 검색 조건
|
||||
* @return 자가농업 목록
|
||||
*/
|
||||
List<DailyFarmingDto> list(DailyFarmingUIReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 특정월의 일계부 자가농업 조회
|
||||
*
|
||||
* @param reqVO 검색 조건
|
||||
* @return 자가농업 목록
|
||||
*/
|
||||
List<DailyFarmingMonthDto> monthList(DailyFarmingUIReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 일계부 자가농업 조회
|
||||
*
|
||||
|
||||
@@ -5,6 +5,8 @@ import app.module.front.usecase.daily.farming.adapters.persistence.model.DailyFa
|
||||
import app.module.front.usecase.daily.farming.ports.application.domain.CreateDailyFarmingCmd;
|
||||
import app.module.front.usecase.daily.farming.ports.application.domain.GetDailyFarmingCmd;
|
||||
import app.module.front.usecase.daily.farming.ports.application.domain.RemoveDailyFarmingCmd;
|
||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||
import app.module.front.usecase.daily.income.ports.application.domain.GetDailyIncomeCmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -17,6 +19,14 @@ public interface DailyFarmingPortOut {
|
||||
*/
|
||||
List<DailyFarmingDto> list(GetDailyFarmingCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 자가농업 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 자가농업 목록
|
||||
*/
|
||||
List<DailyFarmingDto> monthList(GetDailyFarmingCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 자가농업 등록
|
||||
*
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package app.module.front.usecase.daily.farming.ports.application;
|
||||
|
||||
import app.module.core.config.application.util.DailyUtil;
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
||||
import app.module.front.config.application.util.AuditUtil;
|
||||
import app.module.front.config.constants.CommonConstants;
|
||||
import app.module.front.usecase.daily.farming.adapters.persistence.model.DailyFarmingDto;
|
||||
import app.module.front.usecase.daily.farming.adapters.persistence.model.DailyFarmingMonthDto;
|
||||
import app.module.front.usecase.daily.farming.adapters.web.model.CreateDailyFarmingReqVO;
|
||||
import app.module.front.usecase.daily.farming.adapters.web.model.DailyFarmingUIReqVO;
|
||||
import app.module.front.usecase.daily.farming.adapters.web.model.RemoveDailyFarmingReqVO;
|
||||
@@ -18,24 +20,47 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DailyFarmingService implements DailyFarmingPortIn {
|
||||
private final DailyFarmingPortOut portOut;
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
private final DailyRecordPortIn dailyRecordPortIn;
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
private final DailyUtil dailyUtil;
|
||||
|
||||
@Override
|
||||
public List<DailyFarmingDto> list(DailyFarmingUIReqVO reqVO) {
|
||||
return this.getRefineList(reqVO);
|
||||
return this.getRefineList(reqVO, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DailyFarmingMonthDto> monthList(DailyFarmingUIReqVO reqVO) {
|
||||
List<DailyFarmingDto> list = this.getRefineList(reqVO, false);
|
||||
|
||||
List<DailyFarmingMonthDto> monthList = new ArrayList<>();
|
||||
List<Long> recordSeqList = list.stream().map(DailyFarmingDto::getDailyRecordSeq).distinct().toList();
|
||||
for (Long seq : recordSeqList) {
|
||||
DailyFarmingMonthDto month = new DailyFarmingMonthDto();
|
||||
month.setDailyRecordSeq(seq);
|
||||
month.setStartDate(list.stream().filter(f -> Objects.equals(f.getDailyRecordSeq(), seq)).map(DailyFarmingDto::getStartDate).findFirst().orElse(null));
|
||||
month.setEndDate(list.stream().filter(f -> Objects.equals(f.getDailyRecordSeq(), seq)).map(DailyFarmingDto::getEndDate).findFirst().orElse(null));
|
||||
month.setChildren(list.stream().filter(f -> Objects.equals(f.getDailyRecordSeq(), seq)).collect(Collectors.toList()));
|
||||
monthList.add(month);
|
||||
}
|
||||
|
||||
return monthList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DailyFarmingDto detail(DailyFarmingUIReqVO reqVO) {
|
||||
List<DailyFarmingDto> list = this.getRefineList(reqVO);
|
||||
List<DailyFarmingDto> list = this.getRefineList(reqVO, true);
|
||||
if (list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -46,14 +71,17 @@ public class DailyFarmingService implements DailyFarmingPortIn {
|
||||
/**
|
||||
* 목록 데이터 조회
|
||||
*
|
||||
* @param reqVO 검색 조건
|
||||
* @param reqVO 검색 조건
|
||||
* @param dayGroup 일 그룹 조건(true=일, false=월)
|
||||
* @return 공통 처리된 목록
|
||||
*/
|
||||
private List<DailyFarmingDto> getRefineList(DailyFarmingUIReqVO reqVO) {
|
||||
List<DailyFarmingDto> list = portOut.list(new GetDailyFarmingCmd(reqVO.getSearchMonth(),
|
||||
private List<DailyFarmingDto> getRefineList(DailyFarmingUIReqVO reqVO, boolean dayGroup) {
|
||||
GetDailyFarmingCmd command = new GetDailyFarmingCmd(reqVO.getSearchMonth(),
|
||||
reqVO.getGroupNo(),
|
||||
reqVO.getHouseholdSeq(),
|
||||
reqVO.getId()));
|
||||
reqVO.getId());
|
||||
|
||||
List<DailyFarmingDto> list = dayGroup ? portOut.list(command) : portOut.monthList(command);
|
||||
|
||||
List<UICodeElement> recordFarming = uiCodeListPortIn.connect("code.record.farming");
|
||||
List<UICodeElement> recordUnit = uiCodeListPortIn.connect("code.record.unit");
|
||||
@@ -101,30 +129,14 @@ public class DailyFarmingService implements DailyFarmingPortIn {
|
||||
formVO.getHouseholdSeq(),
|
||||
formVO.getId());
|
||||
|
||||
String incomeMark = null;
|
||||
String expenseMark = null;
|
||||
if (!"code.record.farming.self".equals(formVO.getProductCode())) {
|
||||
List<UICodeElement> recordFarming = uiCodeListPortIn.connect("code.record.farming");
|
||||
String returnValue = null;
|
||||
for (UICodeElement codeSetup : recordFarming) {
|
||||
if (codeSetup.getId().equalsIgnoreCase(formVO.getProductCode())) {
|
||||
returnValue = codeSetup.getCodeValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (returnValue != null) {
|
||||
incomeMark = returnValue.split(",")[0];
|
||||
expenseMark = returnValue.split(",")[1];
|
||||
}
|
||||
}
|
||||
HashMap<String, String> markMap = dailyUtil.getMarkByFarming(uiCodeListPortIn.connect("code.record.farming"), formVO.getProductCode());
|
||||
|
||||
CreateDailyFarmingCmd command = AuditUtil.create(
|
||||
new CreateDailyFarmingCmd(
|
||||
formVO.getId(),
|
||||
formVO.getDailyRecordSeq(),
|
||||
incomeMark,
|
||||
expenseMark,
|
||||
markMap.get("incomeMark"),
|
||||
markMap.get("expenseMark"),
|
||||
formVO.getProductCode(),
|
||||
formVO.getProductSelf(),
|
||||
formVO.getUsage(),
|
||||
|
||||
@@ -22,6 +22,11 @@ public class DailyForestryDao implements DailyForestryPortOut {
|
||||
return mapper.getDailyForestryList(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DailyForestryDto> monthList(GetDailyForestryCmd command) {
|
||||
return mapper.getDailyForestryMonthList(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(GetDailyForestryCmd findCmd, CreateDailyForestryCmd command) {
|
||||
Integer existCount = mapper.getRecordExistCount(findCmd);
|
||||
|
||||
@@ -5,6 +5,8 @@ import app.module.front.usecase.daily.forestry.adapters.persistence.model.DailyF
|
||||
import app.module.front.usecase.daily.forestry.ports.application.domain.CreateDailyForestryCmd;
|
||||
import app.module.front.usecase.daily.forestry.ports.application.domain.GetDailyForestryCmd;
|
||||
import app.module.front.usecase.daily.forestry.ports.application.domain.RemoveDailyForestryCmd;
|
||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||
import app.module.front.usecase.daily.income.ports.application.domain.GetDailyIncomeCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@@ -12,13 +14,21 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface DailyForestryMapper {
|
||||
/**
|
||||
* 일계부 자가임업 목록 조회
|
||||
* 특정 그룹일의 일계부 자가임업 목록 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 수입 목록
|
||||
* @return 자가임업 목록
|
||||
*/
|
||||
List<DailyForestryDto> getDailyForestryList(GetDailyForestryCmd command);
|
||||
|
||||
/**
|
||||
* 특정월의 일계부 자가임업 목록 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 자가임업 목록
|
||||
*/
|
||||
List<DailyForestryDto> getDailyForestryMonthList(GetDailyForestryCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 자가임업 데이터 존재 여부
|
||||
*
|
||||
|
||||
@@ -3,6 +3,8 @@ package app.module.front.usecase.daily.forestry.adapters.persistence.model;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DailyForestryDto {
|
||||
@@ -15,6 +17,8 @@ public class DailyForestryDto {
|
||||
private String unitLabel;
|
||||
private String unitSelf;
|
||||
private Long estimatedValue;
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
|
||||
/**
|
||||
* 수정 가능 여부
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package app.module.front.usecase.daily.forestry.adapters.persistence.model;
|
||||
|
||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DailyForestryMonthDto {
|
||||
private Long dailyRecordSeq;
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
private List<DailyForestryDto> children;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package app.module.front.usecase.daily.forestry.ports;
|
||||
|
||||
import app.module.front.usecase.daily.forestry.adapters.persistence.model.DailyForestryDto;
|
||||
import app.module.front.usecase.daily.forestry.adapters.persistence.model.DailyForestryMonthDto;
|
||||
import app.module.front.usecase.daily.forestry.adapters.web.model.CreateDailyForestryReqVO;
|
||||
import app.module.front.usecase.daily.forestry.adapters.web.model.DailyForestryUIReqVO;
|
||||
import app.module.front.usecase.daily.forestry.adapters.web.model.RemoveDailyForestryReqVO;
|
||||
@@ -9,13 +10,21 @@ import java.util.List;
|
||||
|
||||
public interface DailyForestryPortIn {
|
||||
/**
|
||||
* 일계부 자가임업 조회
|
||||
* 특정 그룹일의 일계부 자가임업 조회
|
||||
*
|
||||
* @param reqVO 검색 조건
|
||||
* @return 자가임업 목록
|
||||
*/
|
||||
List<DailyForestryDto> list(DailyForestryUIReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 특정월의 일계부 자가임업 조회
|
||||
*
|
||||
* @param reqVO 검색 조건
|
||||
* @return 자가임업 목록
|
||||
*/
|
||||
List<DailyForestryMonthDto> monthList(DailyForestryUIReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 일계부 자가임업 조회
|
||||
*
|
||||
|
||||
@@ -4,6 +4,8 @@ import app.module.front.usecase.daily.forestry.adapters.persistence.model.DailyF
|
||||
import app.module.front.usecase.daily.forestry.ports.application.domain.CreateDailyForestryCmd;
|
||||
import app.module.front.usecase.daily.forestry.ports.application.domain.GetDailyForestryCmd;
|
||||
import app.module.front.usecase.daily.forestry.ports.application.domain.RemoveDailyForestryCmd;
|
||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||
import app.module.front.usecase.daily.income.ports.application.domain.GetDailyIncomeCmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -16,6 +18,14 @@ public interface DailyForestryPortOut {
|
||||
*/
|
||||
List<DailyForestryDto> list(GetDailyForestryCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 자가임업 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 자가임업 목록
|
||||
*/
|
||||
List<DailyForestryDto> monthList(GetDailyForestryCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 자가임업 등록
|
||||
*
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package app.module.front.usecase.daily.forestry.ports.application;
|
||||
|
||||
import app.module.core.config.constants.DailyRecordConstants;
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
||||
import app.module.front.config.application.util.AuditUtil;
|
||||
import app.module.front.config.constants.CommonConstants;
|
||||
import app.module.front.usecase.daily.forestry.adapters.persistence.model.DailyForestryDto;
|
||||
import app.module.front.usecase.daily.forestry.adapters.persistence.model.DailyForestryMonthDto;
|
||||
import app.module.front.usecase.daily.forestry.adapters.web.model.CreateDailyForestryReqVO;
|
||||
import app.module.front.usecase.daily.forestry.adapters.web.model.DailyForestryUIReqVO;
|
||||
import app.module.front.usecase.daily.forestry.adapters.web.model.RemoveDailyForestryReqVO;
|
||||
@@ -14,12 +16,14 @@ import app.module.front.usecase.daily.forestry.ports.DailyForestryPortOut;
|
||||
import app.module.front.usecase.daily.forestry.ports.application.domain.CreateDailyForestryCmd;
|
||||
import app.module.front.usecase.daily.forestry.ports.application.domain.GetDailyForestryCmd;
|
||||
import app.module.front.usecase.daily.forestry.ports.application.domain.RemoveDailyForestryCmd;
|
||||
import app.module.core.usecase.daily.record.ports.application.DailyRecordService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -31,12 +35,30 @@ public class DailyForestryService implements DailyForestryPortIn {
|
||||
|
||||
@Override
|
||||
public List<DailyForestryDto> list(DailyForestryUIReqVO reqVO) {
|
||||
return this.getRefineList(reqVO);
|
||||
return this.getRefineList(reqVO, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DailyForestryMonthDto> monthList(DailyForestryUIReqVO reqVO) {
|
||||
List<DailyForestryDto> list = this.getRefineList(reqVO, false);
|
||||
|
||||
List<DailyForestryMonthDto> monthList = new ArrayList<>();
|
||||
List<Long> recordSeqList = list.stream().map(DailyForestryDto::getDailyRecordSeq).distinct().toList();
|
||||
for (Long seq : recordSeqList) {
|
||||
DailyForestryMonthDto month = new DailyForestryMonthDto();
|
||||
month.setDailyRecordSeq(seq);
|
||||
month.setStartDate(list.stream().filter(f -> Objects.equals(f.getDailyRecordSeq(), seq)).map(DailyForestryDto::getStartDate).findFirst().orElse(null));
|
||||
month.setEndDate(list.stream().filter(f -> Objects.equals(f.getDailyRecordSeq(), seq)).map(DailyForestryDto::getEndDate).findFirst().orElse(null));
|
||||
month.setChildren(list.stream().filter(f -> Objects.equals(f.getDailyRecordSeq(), seq)).collect(Collectors.toList()));
|
||||
monthList.add(month);
|
||||
}
|
||||
|
||||
return monthList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DailyForestryDto detail(DailyForestryUIReqVO reqVO) {
|
||||
List<DailyForestryDto> list = this.getRefineList(reqVO);
|
||||
List<DailyForestryDto> list = this.getRefineList(reqVO, true);
|
||||
if (list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -48,13 +70,16 @@ public class DailyForestryService implements DailyForestryPortIn {
|
||||
* 목록 데이터 조회
|
||||
*
|
||||
* @param reqVO 검색 조건
|
||||
* @param dayGroup 일 그룹 조건(true=일, false=월)
|
||||
* @return 공통 처리된 목록
|
||||
*/
|
||||
private List<DailyForestryDto> getRefineList(DailyForestryUIReqVO reqVO) {
|
||||
List<DailyForestryDto> list = portOut.list(new GetDailyForestryCmd(reqVO.getSearchMonth(),
|
||||
private List<DailyForestryDto> getRefineList(DailyForestryUIReqVO reqVO, boolean dayGroup) {
|
||||
GetDailyForestryCmd command = new GetDailyForestryCmd(reqVO.getSearchMonth(),
|
||||
reqVO.getGroupNo(),
|
||||
reqVO.getHouseholdSeq(),
|
||||
reqVO.getId()));
|
||||
reqVO.getId());
|
||||
|
||||
List<DailyForestryDto> list = dayGroup ? portOut.list(command) : portOut.monthList(command);
|
||||
|
||||
List<UICodeElement> recordUnit = uiCodeListPortIn.connect("code.record.unit");
|
||||
|
||||
@@ -99,7 +124,7 @@ public class DailyForestryService implements DailyForestryPortIn {
|
||||
new CreateDailyForestryCmd(
|
||||
formVO.getId(),
|
||||
formVO.getDailyRecordSeq(),
|
||||
"81011", // [정책] 81011 고정
|
||||
DailyRecordConstants.FORESTRY_EXPENSE_MARK,
|
||||
formVO.getProductName(),
|
||||
formVO.getUsage(),
|
||||
formVO.getQuantity(),
|
||||
|
||||
@@ -15,22 +15,27 @@ import java.util.List;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DailyIncomeDao implements DailyIncomePortOut {
|
||||
private final DailyIncomeMapper dailyIncomeMapper;
|
||||
private final DailyIncomeMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<DailyIncomeDto> list(GetDailyIncomeCmd command) {
|
||||
return dailyIncomeMapper.getDailyIncomeList(command);
|
||||
return mapper.getDailyIncomeList(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DailyIncomeDto> monthList(GetDailyIncomeCmd command) {
|
||||
return mapper.getDailyIncomeMonthList(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(GetDailyIncomeCmd findCmd, CreateDailyIncomeCmd command) {
|
||||
Integer existCount = dailyIncomeMapper.getRecordExistCount(findCmd);
|
||||
Integer existCount = mapper.getRecordExistCount(findCmd);
|
||||
if (existCount == 0) {
|
||||
dailyIncomeMapper.createDailyIncome(command);
|
||||
mapper.createDailyIncome(command);
|
||||
|
||||
log.debug("[CreateDailyIncome] record={}", command);
|
||||
} else {
|
||||
dailyIncomeMapper.updateDailyIncome(command);
|
||||
mapper.updateDailyIncome(command);
|
||||
|
||||
log.debug("[UpdateDailyIncome] record={}", command);
|
||||
}
|
||||
@@ -38,9 +43,10 @@ public class DailyIncomeDao implements DailyIncomePortOut {
|
||||
|
||||
@Override
|
||||
public void remove(GetDailyIncomeCmd findCmd, RemoveDailyIncomeCmd command) {
|
||||
Integer existCount = dailyIncomeMapper.getRecordExistCount(findCmd);
|
||||
Integer existCount = mapper.getRecordExistCount(findCmd);
|
||||
if (existCount != 0) {
|
||||
dailyIncomeMapper.removeDailyIncome(command);
|
||||
mapper.removeDailyIncome(command);
|
||||
mapper.removeDailyIncomeReceipt(command);
|
||||
|
||||
log.debug("[RemoveDailyIncome] record={}", command);
|
||||
}
|
||||
|
||||
@@ -11,13 +11,21 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface DailyIncomeMapper {
|
||||
/**
|
||||
* 일계부 수입 목록 조회
|
||||
* 특정 그룹일의 일계부 수입 목록 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 수입 목록
|
||||
*/
|
||||
List<DailyIncomeDto> getDailyIncomeList(GetDailyIncomeCmd command);
|
||||
|
||||
/**
|
||||
* 특정월의 일계부 수입 목록 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 수입 목록
|
||||
*/
|
||||
List<DailyIncomeDto> getDailyIncomeMonthList(GetDailyIncomeCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 수입 데이터 존재 여부
|
||||
*
|
||||
@@ -46,4 +54,11 @@ public interface DailyIncomeMapper {
|
||||
* @param command 삭제 데이터
|
||||
*/
|
||||
void removeDailyIncome(RemoveDailyIncomeCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 수입 영수증 삭제
|
||||
*
|
||||
* @param command 삭제 데이터
|
||||
*/
|
||||
void removeDailyIncomeReceipt(RemoveDailyIncomeCmd command);
|
||||
}
|
||||
|
||||
@@ -3,9 +3,13 @@ package app.module.front.usecase.daily.income.adapters.persistence.model;
|
||||
import app.module.front.usecase.daily.income.adapters.web.model.DailyInputType;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class DailyIncomeDto {
|
||||
private Long id;
|
||||
private Long dailyRecordSeq;
|
||||
@@ -21,6 +25,8 @@ public class DailyIncomeDto {
|
||||
private String unitSelf;
|
||||
private Long price;
|
||||
private Long estimatedValue;
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
|
||||
/**
|
||||
* 수정 가능 여부
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package app.module.front.usecase.daily.income.adapters.persistence.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class DailyIncomeMonthDto {
|
||||
private Long dailyRecordSeq;
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
private List<DailyIncomeDto> children;
|
||||
}
|
||||
@@ -12,5 +12,4 @@ public enum DailyInputType {
|
||||
* 영수증 입력
|
||||
*/
|
||||
OCR,
|
||||
;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.module.front.usecase.daily.income.adapters.web.model;
|
||||
|
||||
import app.module.front.usecase.daily.receipt.adapters.web.model.ReceiptItem;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ReceiptReqVO {
|
||||
private String date;
|
||||
private String cardOrCash;
|
||||
private String storeName;
|
||||
private List<ReceiptItem> items;
|
||||
private int totalPrice;
|
||||
private String responseBody;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package app.module.front.usecase.daily.income.ports;
|
||||
|
||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeMonthDto;
|
||||
import app.module.front.usecase.daily.income.adapters.web.model.CreateDailyIncomeReqVO;
|
||||
import app.module.front.usecase.daily.income.adapters.web.model.DailyIncomeUIReqVO;
|
||||
import app.module.front.usecase.daily.income.adapters.web.model.RemoveDailyIncomeReqVO;
|
||||
@@ -9,13 +10,21 @@ import java.util.List;
|
||||
|
||||
public interface DailyIncomePortIn {
|
||||
/**
|
||||
* 일계부 수입 조회
|
||||
* 특정 그룹일의 일계부 수입 조회
|
||||
*
|
||||
* @param reqVO 검색 조건
|
||||
* @return 수입 목록
|
||||
*/
|
||||
List<DailyIncomeDto> list(DailyIncomeUIReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 특정월의 일계부 수입 조회
|
||||
*
|
||||
* @param reqVO 검색 조건
|
||||
* @return 수입 목록
|
||||
*/
|
||||
List<DailyIncomeMonthDto> monthList(DailyIncomeUIReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 일계부 수입 조회
|
||||
*
|
||||
|
||||
@@ -16,6 +16,14 @@ public interface DailyIncomePortOut {
|
||||
*/
|
||||
List<DailyIncomeDto> list(GetDailyIncomeCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 수입 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 수입 목록
|
||||
*/
|
||||
List<DailyIncomeDto> monthList(GetDailyIncomeCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 수입 등록
|
||||
*
|
||||
|
||||
@@ -7,6 +7,7 @@ import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElemen
|
||||
import app.module.front.config.application.util.AuditUtil;
|
||||
import app.module.front.config.constants.CommonConstants;
|
||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeMonthDto;
|
||||
import app.module.front.usecase.daily.income.adapters.web.model.CreateDailyIncomeReqVO;
|
||||
import app.module.front.usecase.daily.income.adapters.web.model.DailyIncomeUIReqVO;
|
||||
import app.module.front.usecase.daily.income.adapters.web.model.RemoveDailyIncomeReqVO;
|
||||
@@ -15,11 +16,13 @@ import app.module.front.usecase.daily.income.ports.DailyIncomePortOut;
|
||||
import app.module.front.usecase.daily.income.ports.application.domain.CreateDailyIncomeCmd;
|
||||
import app.module.front.usecase.daily.income.ports.application.domain.GetDailyIncomeCmd;
|
||||
import app.module.front.usecase.daily.income.ports.application.domain.RemoveDailyIncomeCmd;
|
||||
import app.module.core.usecase.daily.record.ports.application.DailyRecordService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -30,12 +33,30 @@ public class DailyIncomeService implements DailyIncomePortIn {
|
||||
|
||||
@Override
|
||||
public List<DailyIncomeDto> list(DailyIncomeUIReqVO reqVO) {
|
||||
return this.getRefineList(reqVO);
|
||||
return this.getRefineList(reqVO, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DailyIncomeMonthDto> monthList(DailyIncomeUIReqVO reqVO) {
|
||||
List<DailyIncomeDto> list = this.getRefineList(reqVO, false);
|
||||
|
||||
List<DailyIncomeMonthDto> monthList = new ArrayList<>();
|
||||
List<Long> recordSeqList = list.stream().map(DailyIncomeDto::getDailyRecordSeq).distinct().toList();
|
||||
for (Long seq : recordSeqList) {
|
||||
DailyIncomeMonthDto month = new DailyIncomeMonthDto();
|
||||
month.setDailyRecordSeq(seq);
|
||||
month.setStartDate(list.stream().filter(f -> Objects.equals(f.getDailyRecordSeq(), seq)).map(DailyIncomeDto::getStartDate).findFirst().orElse(null));
|
||||
month.setEndDate(list.stream().filter(f -> Objects.equals(f.getDailyRecordSeq(), seq)).map(DailyIncomeDto::getEndDate).findFirst().orElse(null));
|
||||
month.setChildren(list.stream().filter(f -> Objects.equals(f.getDailyRecordSeq(), seq)).collect(Collectors.toList()));
|
||||
monthList.add(month);
|
||||
}
|
||||
|
||||
return monthList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DailyIncomeDto detail(DailyIncomeUIReqVO reqVO) {
|
||||
List<DailyIncomeDto> list = this.getRefineList(reqVO);
|
||||
List<DailyIncomeDto> list = this.getRefineList(reqVO, true);
|
||||
if (list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -46,14 +67,17 @@ public class DailyIncomeService implements DailyIncomePortIn {
|
||||
/**
|
||||
* 목록 데이터 조회
|
||||
*
|
||||
* @param reqVO 검색 조건
|
||||
* @param reqVO 검색 조건
|
||||
* @param dayGroup 일 그룹 조건(true=일, false=월)
|
||||
* @return 공통 처리된 목록
|
||||
*/
|
||||
private List<DailyIncomeDto> getRefineList(DailyIncomeUIReqVO reqVO) {
|
||||
List<DailyIncomeDto> list = portOut.list(new GetDailyIncomeCmd(reqVO.getSearchMonth(),
|
||||
private List<DailyIncomeDto> getRefineList(DailyIncomeUIReqVO reqVO, boolean dayGroup) {
|
||||
GetDailyIncomeCmd command = new GetDailyIncomeCmd(reqVO.getSearchMonth(),
|
||||
reqVO.getGroupNo(),
|
||||
reqVO.getHouseholdSeq(),
|
||||
reqVO.getId()));
|
||||
reqVO.getId());
|
||||
|
||||
List<DailyIncomeDto> list = dayGroup ? portOut.list(command) : portOut.monthList(command);
|
||||
|
||||
List<UICodeElement> recordCrop = uiCodeListPortIn.connect("code.record.crop");
|
||||
List<UICodeElement> recordUnit = uiCodeListPortIn.connect("code.record.unit");
|
||||
@@ -114,7 +138,9 @@ public class DailyIncomeService implements DailyIncomePortIn {
|
||||
formVO.getPrice(),
|
||||
formVO.getEstimatedValue()));
|
||||
|
||||
|
||||
portOut.create(findCmd, command);
|
||||
formVO.setId(command.getId());
|
||||
|
||||
dailyRecordPortIn.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo(), findCmd.getHouseholdSeq());
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package app.module.front.usecase.daily.power.adapters.persistence;
|
||||
|
||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
import app.module.front.usecase.daily.power.adapters.persistence.model.DailyPowerDto;
|
||||
import app.module.front.usecase.daily.power.ports.DailyPowerPortOut;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.CreateDailyPowerCmd;
|
||||
@@ -16,22 +15,27 @@ import java.util.List;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DailyPowerDao implements DailyPowerPortOut {
|
||||
private final DailyPowerMapper dailyPowerMapper;
|
||||
private final DailyPowerMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<DailyPowerDto> list(GetDailyPowerCmd command) {
|
||||
return dailyPowerMapper.getDailyPowerList(command);
|
||||
return mapper.getDailyPowerList(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DailyPowerDto> monthList(GetDailyPowerCmd command) {
|
||||
return mapper.getDailyPowerMonthList(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(GetDailyPowerCmd findCmd, CreateDailyPowerCmd command) {
|
||||
Integer existCount = dailyPowerMapper.getRecordExistCount(findCmd);
|
||||
Integer existCount = mapper.getRecordExistCount(findCmd);
|
||||
if (existCount == 0) {
|
||||
dailyPowerMapper.createDailyPower(command);
|
||||
mapper.createDailyPower(command);
|
||||
|
||||
log.debug("[CreateDailyPower] record={}", command);
|
||||
} else {
|
||||
dailyPowerMapper.updateDailyPower(command);
|
||||
mapper.updateDailyPower(command);
|
||||
|
||||
log.debug("[UpdateDailyPower] record={}", command);
|
||||
}
|
||||
@@ -39,9 +43,9 @@ public class DailyPowerDao implements DailyPowerPortOut {
|
||||
|
||||
@Override
|
||||
public void remove(GetDailyPowerCmd findCmd, RemoveDailyPowerCmd command) {
|
||||
Integer existCount = dailyPowerMapper.getRecordExistCount(findCmd);
|
||||
Integer existCount = mapper.getRecordExistCount(findCmd);
|
||||
if (existCount != 0) {
|
||||
dailyPowerMapper.removeDailyPower(command);
|
||||
mapper.removeDailyPower(command);
|
||||
|
||||
log.debug("[RemoveDailyPower] record={}", command);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package app.module.front.usecase.daily.power.adapters.persistence;
|
||||
|
||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||
import app.module.front.usecase.daily.income.ports.application.domain.GetDailyIncomeCmd;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.CreateDailyPowerCmd;
|
||||
import app.module.front.usecase.daily.power.adapters.persistence.model.DailyPowerDto;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.GetDailyPowerCmd;
|
||||
@@ -12,13 +14,21 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface DailyPowerMapper {
|
||||
/**
|
||||
* 일계부 동력 사용시간 목록 조회
|
||||
* 특정 그룹일의 일계부 동력 사용시간 목록 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 동력 사용시간 목록
|
||||
*/
|
||||
List<DailyPowerDto> getDailyPowerList(GetDailyPowerCmd command);
|
||||
|
||||
/**
|
||||
* 특정월의 일계부 동력 사용시간 목록 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 동력 사용시간 목록
|
||||
*/
|
||||
List<DailyPowerDto> getDailyPowerMonthList(GetDailyPowerCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 동력 사용시간 데이터 존재 여부
|
||||
*
|
||||
|
||||
@@ -3,6 +3,8 @@ package app.module.front.usecase.daily.power.adapters.persistence.model;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DailyPowerDto {
|
||||
@@ -11,6 +13,8 @@ public class DailyPowerDto {
|
||||
private String equipmentName;
|
||||
private String ownedHours;
|
||||
private String leasedHours;
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
|
||||
/**
|
||||
* 수정 가능 여부
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.module.front.usecase.daily.power.adapters.persistence.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DailyPowerMonthDto {
|
||||
private Long dailyRecordSeq;
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
private List<DailyPowerDto> children;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package app.module.front.usecase.daily.power.ports;
|
||||
|
||||
|
||||
import app.module.front.usecase.daily.power.adapters.persistence.model.DailyPowerDto;
|
||||
import app.module.front.usecase.daily.power.adapters.persistence.model.DailyPowerMonthDto;
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.CreateDailyPowerReqVO;
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.DailyPowerUIReqVO;
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.RemoveDailyPowerReqVO;
|
||||
@@ -10,13 +10,21 @@ import java.util.List;
|
||||
|
||||
public interface DailyPowerPortIn {
|
||||
/**
|
||||
* 일계부 동력 사용시간 조회
|
||||
* 특정 그룹일의 일계부 동력 사용시간 조회
|
||||
*
|
||||
* @param reqVO 검색 조건
|
||||
* @return 동력 사용시간 목록
|
||||
*/
|
||||
List<DailyPowerDto> list(DailyPowerUIReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 특정월의 일계부 동력 사용시간 조회
|
||||
*
|
||||
* @param reqVO 검색 조건
|
||||
* @return 동력 사용시간 목록
|
||||
*/
|
||||
List<DailyPowerMonthDto> monthList(DailyPowerUIReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 일계부 동력 사용시간 조회
|
||||
*
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package app.module.front.usecase.daily.power.ports;
|
||||
|
||||
|
||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||
import app.module.front.usecase.daily.income.ports.application.domain.GetDailyIncomeCmd;
|
||||
import app.module.front.usecase.daily.power.adapters.persistence.model.DailyPowerDto;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.CreateDailyPowerCmd;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.GetDailyPowerCmd;
|
||||
@@ -17,6 +19,14 @@ public interface DailyPowerPortOut {
|
||||
*/
|
||||
List<DailyPowerDto> list(GetDailyPowerCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 동력 사용시간 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 동력 사용시간 목록
|
||||
*/
|
||||
List<DailyPowerDto> monthList(GetDailyPowerCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 동력 사용시간 등록
|
||||
*
|
||||
|
||||
@@ -3,6 +3,7 @@ package app.module.front.usecase.daily.power.ports.application;
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import app.module.front.config.application.util.AuditUtil;
|
||||
import app.module.front.usecase.daily.power.adapters.persistence.model.DailyPowerDto;
|
||||
import app.module.front.usecase.daily.power.adapters.persistence.model.DailyPowerMonthDto;
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.CreateDailyPowerReqVO;
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.DailyPowerUIReqVO;
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.RemoveDailyPowerReqVO;
|
||||
@@ -11,11 +12,13 @@ import app.module.front.usecase.daily.power.ports.DailyPowerPortOut;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.CreateDailyPowerCmd;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.GetDailyPowerCmd;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.RemoveDailyPowerCmd;
|
||||
import app.module.core.usecase.daily.record.ports.application.DailyRecordService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -25,12 +28,30 @@ public class DailyPowerService implements DailyPowerPortIn {
|
||||
|
||||
@Override
|
||||
public List<DailyPowerDto> list(DailyPowerUIReqVO reqVO) {
|
||||
return this.getRefineList(reqVO);
|
||||
return this.getRefineList(reqVO, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DailyPowerMonthDto> monthList(DailyPowerUIReqVO reqVO) {
|
||||
List<DailyPowerDto> list = this.getRefineList(reqVO, false);
|
||||
|
||||
List<DailyPowerMonthDto> monthList = new ArrayList<>();
|
||||
List<Long> recordSeqList = list.stream().map(DailyPowerDto::getDailyRecordSeq).distinct().toList();
|
||||
for (Long seq : recordSeqList) {
|
||||
DailyPowerMonthDto month = new DailyPowerMonthDto();
|
||||
month.setDailyRecordSeq(seq);
|
||||
month.setStartDate(list.stream().filter(f -> Objects.equals(f.getDailyRecordSeq(), seq)).map(DailyPowerDto::getStartDate).findFirst().orElse(null));
|
||||
month.setEndDate(list.stream().filter(f -> Objects.equals(f.getDailyRecordSeq(), seq)).map(DailyPowerDto::getEndDate).findFirst().orElse(null));
|
||||
month.setChildren(list.stream().filter(f -> Objects.equals(f.getDailyRecordSeq(), seq)).collect(Collectors.toList()));
|
||||
monthList.add(month);
|
||||
}
|
||||
|
||||
return monthList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DailyPowerDto detail(DailyPowerUIReqVO reqVO) {
|
||||
List<DailyPowerDto> list = this.getRefineList(reqVO);
|
||||
List<DailyPowerDto> list = this.getRefineList(reqVO, true);
|
||||
if (list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -44,11 +65,13 @@ public class DailyPowerService implements DailyPowerPortIn {
|
||||
* @param reqVO 검색 조건
|
||||
* @return 공통 처리된 목록
|
||||
*/
|
||||
private List<DailyPowerDto> getRefineList(DailyPowerUIReqVO reqVO) {
|
||||
return portOut.list(new GetDailyPowerCmd(reqVO.getSearchMonth(),
|
||||
private List<DailyPowerDto> getRefineList(DailyPowerUIReqVO reqVO, boolean dayGroup) {
|
||||
GetDailyPowerCmd command = new GetDailyPowerCmd(reqVO.getSearchMonth(),
|
||||
reqVO.getGroupNo(),
|
||||
reqVO.getHouseholdSeq(),
|
||||
reqVO.getId()));
|
||||
reqVO.getId());
|
||||
|
||||
return dayGroup ? portOut.list(command) : portOut.monthList(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package app.module.front.usecase.daily.receipt.adapters.persistence;
|
||||
|
||||
import app.module.core.config.application.annotation.CreateCommand;
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import app.module.front.usecase.daily.receipt.adapters.web.model.CreateReceiptHasFileReqVO;
|
||||
import app.module.front.usecase.daily.receipt.ports.DailyReceiptPortOut;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DailyReceiptDao implements DailyReceiptPortOut {
|
||||
private final DailyReceiptMapper dailyReceiptMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@CreateCommand
|
||||
public void insertReceiptMappingFile(CreateReceiptHasFileReqVO command) {
|
||||
dailyReceiptMapper.insertReceiptMappingFile(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer selectReceiptCount(String inputType) {
|
||||
|
||||
return dailyReceiptMapper.selectReceiptCount(inputType, CommonUtil.getLoginUsername());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package app.module.front.usecase.daily.receipt.adapters.persistence;
|
||||
|
||||
import app.module.front.usecase.daily.receipt.adapters.web.model.CreateReceiptHasFileReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface DailyReceiptMapper {
|
||||
|
||||
|
||||
/**
|
||||
* 일계부 수입 파일 매핑
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 중복 개수
|
||||
*/
|
||||
Integer insertReceiptMappingFile(CreateReceiptHasFileReqVO command);
|
||||
|
||||
/**
|
||||
* 일계부 수입 파일 매핑
|
||||
*
|
||||
* @param inputType 수입/지출
|
||||
* @param userId 사용자 아이디
|
||||
* @return 중복 개수
|
||||
*/
|
||||
Integer selectReceiptCount(@Param("inputType") String inputType,@Param("userId")String userId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
package app.module.front.usecase.daily.receipt.adapters.web;
|
||||
|
||||
import app.module.core.config.application.enums.FileUploadType;
|
||||
import app.module.core.config.application.exception.NoRecordDataException;
|
||||
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import app.module.core.usecase.file.createFile.ports.CreateFilePortIn;
|
||||
import app.module.core.usecase.file.createFile.ports.application.domain.CreateFile;
|
||||
import app.module.core.usecase.file.createFile.ports.application.domain.CreateFileCmd;
|
||||
import app.module.core.usecase.file.saveToStorage.ports.SaveToStoragePortIn;
|
||||
import app.module.core.usecase.file.saveToStorage.ports.application.domain.SaveToStorage;
|
||||
import app.module.front.usecase.daily.expense.adapters.web.model.CreateDailyExpenseReqVO;
|
||||
import app.module.front.usecase.daily.expense.ports.DailyExpensePortIn;
|
||||
import app.module.front.usecase.daily.income.adapters.web.model.CreateDailyIncomeReqVO;
|
||||
import app.module.front.usecase.daily.income.adapters.web.model.DailyInputType;
|
||||
import app.module.front.usecase.daily.income.adapters.web.model.RemoveDailyIncomeReqVO;
|
||||
import app.module.front.usecase.daily.income.ports.DailyIncomePortIn;
|
||||
import app.module.front.usecase.daily.receipt.adapters.web.model.*;
|
||||
import app.module.front.usecase.daily.receipt.ports.DailyReceiptPortIn;
|
||||
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/api/record/receipt")
|
||||
public class DailyReceiptController {
|
||||
|
||||
private final DailyRecordPortIn dailyRecordPortIn;
|
||||
private final DailyIncomePortIn dailyIncomePortIn;
|
||||
private final SaveToStoragePortIn saveToStoragePortIn;
|
||||
private final CreateFilePortIn createFilePortIn;
|
||||
private final RestTemplate restTemplate;
|
||||
private final DailyReceiptPortIn dailyReceiptPortIn;
|
||||
private final DailyExpensePortIn dailyExpensePortIn;
|
||||
|
||||
/**
|
||||
* 일계부 영수증 등록
|
||||
*/
|
||||
@PostMapping(path = "")
|
||||
ResponseEntity<?> operate( @RequestPart(value = "file") MultipartFile file) throws IOException {
|
||||
// 파일 유효성 검사
|
||||
if (file == null || file.isEmpty()) {
|
||||
log.warn("파일이 비어 있거나 null입니다.");
|
||||
return ResponseEntity.badRequest().body(new ReceiptResVO("파일이 비어 있습니다."));
|
||||
}
|
||||
if (file.getName() == null || file.getName().isEmpty() || file.getName().contains("..")) {
|
||||
log.warn("잘못된 파일 이름: {}", file.getName());
|
||||
return ResponseEntity.badRequest().body(new ReceiptResVO("잘못된 파일 이름입니다."));
|
||||
}
|
||||
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
ReceiptResVO receiptResponse = new ReceiptResVO();
|
||||
try {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
|
||||
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
|
||||
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
|
||||
body.add("file", file.getResource());
|
||||
body.add("file_name", originalFilename);
|
||||
|
||||
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(body, headers);
|
||||
ResponseEntity<String> response = restTemplate.postForEntity(
|
||||
"http://115.68.193.117:9870/receipt?file_name=" + "?file_name=" + originalFilename, requestEntity, String.class);
|
||||
|
||||
if (response.getStatusCode().is2xxSuccessful() && response.getBody() != null) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
receiptResponse = mapper.readValue(response.getBody(), ReceiptResVO.class);
|
||||
receiptResponse.setResponseBody(response.getBody());
|
||||
|
||||
log.info("파싱된 ReceiptResVO: {}", mapper.writeValueAsString(receiptResponse));
|
||||
log.info("OCR API SUCCESS : fileName={}", originalFilename);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(receiptResponse);
|
||||
} else {
|
||||
log.error("OCR API FAIL: status={}", response.getStatusCode());
|
||||
receiptResponse.setError("OCR API FAIL: HTTP " + response.getStatusCodeValue());
|
||||
return ResponseEntity.status(response.getStatusCodeValue()).body(receiptResponse);
|
||||
}
|
||||
} catch (HttpClientErrorException e) {
|
||||
log.error("OCR API FAIL : status={}, message={}", e.getStatusCode(), e.getResponseBodyAsString());
|
||||
receiptResponse.setError("OCR API FAIL: " + e.getStatusCode() + " - " + e.getResponseBodyAsString());
|
||||
return ResponseEntity.status(e.getStatusCode().value()).body(receiptResponse);
|
||||
} catch (Exception e) {
|
||||
log.error("OCR API FAIL : fileName={}, error={}", file.getName(), e.getMessage());
|
||||
receiptResponse.setError("OCR API FAIL: " + e.getMessage());
|
||||
return ResponseEntity.status(500).body(receiptResponse);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 일계부 영수증 수입/수출 등록 처리
|
||||
*
|
||||
* @param searchMonth 검색 월(yyyyMM)
|
||||
* @param groupNo 검색 그룹
|
||||
* @param id 수입 일련번호
|
||||
* @param reqVOList 영수증 데이터
|
||||
*/
|
||||
@PostMapping(path = "/{inputType}/{searchMonth}/{groupNo}/form/{id}")
|
||||
ResponseEntity<?> createReceipt(
|
||||
@PathVariable("inputType") String inputType,
|
||||
@PathVariable("searchMonth") String searchMonth,
|
||||
@PathVariable("groupNo") String groupNo,
|
||||
@PathVariable("id") String id,
|
||||
@RequestPart(value = "reqVO") List<CreateReceiptFileReqVO> reqVOList,
|
||||
@RequestPart(value = "file") List<MultipartFile> files ) throws IOException {
|
||||
|
||||
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo);
|
||||
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
MultipartFile file = files.get(i);
|
||||
CreateReceiptFileReqVO createReceiptFileReqVO = reqVOList.get(i);
|
||||
|
||||
// storage 에 물리적 파일 저장. `LOCAL` or `S3`
|
||||
SaveToStorage saveToStorage =
|
||||
saveToStoragePortIn
|
||||
.operate(createReceiptFileReqVO.getFileUploadType(), file)
|
||||
.orElseThrow(() -> new RuntimeException("물리적 파일 저장에 실패했습니다."));
|
||||
|
||||
// DB 에 파일정보 저장
|
||||
CreateFile createFile =
|
||||
createFilePortIn
|
||||
.operate(
|
||||
new CreateFileCmd(
|
||||
saveToStorage.getType(),
|
||||
saveToStorage.getPath(),
|
||||
saveToStorage.getName(),
|
||||
saveToStorage.getOriginName(),
|
||||
saveToStorage.getFileLength(),
|
||||
dailyRecord.getId(),
|
||||
createReceiptFileReqVO.getOcr().getResponseBody()
|
||||
))
|
||||
.orElseThrow(() -> new RuntimeException("업로드 파일정보 DB 저장에 실패했습니다."));
|
||||
|
||||
// 1. 레코드 저장
|
||||
for(ReceiptItem item : createReceiptFileReqVO.getOcr().getItems()){
|
||||
if("income".equals(inputType)) {
|
||||
CreateDailyIncomeReqVO formVO = new CreateDailyIncomeReqVO();
|
||||
formVO.setSearchMonth(searchMonth);
|
||||
formVO.setGroupNo(Integer.parseInt(groupNo));
|
||||
formVO.setId(Long.parseLong(id));
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
formVO.setInputType(DailyInputType.OCR);
|
||||
formVO.setCredit(false);
|
||||
formVO.setSourcePurpose(createReceiptFileReqVO.getOcr().getStoreName());
|
||||
formVO.setIncomeKind(item.getName());
|
||||
formVO.setQuantity((double) item.getQuantity());
|
||||
formVO.setPrice((long) item.getTotalPrice());
|
||||
log.debug("formVO: {}", formVO);
|
||||
dailyIncomePortIn.create(formVO);
|
||||
//has 파일에 매핑 시키기
|
||||
dailyReceiptPortIn.insertReceiptMappingFile(new CreateReceiptHasFileReqVO(FileUploadType.INCOME.getName(),formVO.getId(),createFile.getId()));
|
||||
|
||||
}else if ("expense".equals(inputType)) {
|
||||
|
||||
CreateDailyExpenseReqVO formVO = new CreateDailyExpenseReqVO();
|
||||
formVO.setSearchMonth(searchMonth);
|
||||
formVO.setGroupNo(Integer.parseInt(groupNo));
|
||||
formVO.setId(Long.parseLong(id));
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
formVO.setInputType(DailyInputType.OCR);
|
||||
|
||||
formVO.setCredit(false);
|
||||
formVO.setSourcePurpose(createReceiptFileReqVO.getOcr().getStoreName());
|
||||
formVO.setExpenseKind(item.getName());
|
||||
formVO.setQuantity((double) item.getQuantity());
|
||||
formVO.setPrice((long) item.getTotalPrice());
|
||||
|
||||
log.debug("formVO: {}", formVO);
|
||||
|
||||
dailyExpensePortIn.create(formVO);
|
||||
|
||||
//has 파일에 매핑 시키기
|
||||
dailyReceiptPortIn.insertReceiptMappingFile(new CreateReceiptHasFileReqVO(FileUploadType.EXPENSE.getName(),formVO.getId(),createFile.getId()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body("");
|
||||
}
|
||||
|
||||
/**
|
||||
* 일계부 영수증 개수 확인
|
||||
*
|
||||
*/
|
||||
@GetMapping(path = "/{inputType}/count")
|
||||
ResponseEntity<?> receiptCount(@PathVariable("inputType") String inputType) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body( dailyReceiptPortIn.selectReceiptCount(inputType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 일계부 유효성 체크 및 데이터 조회
|
||||
*
|
||||
* @param searchMonth 검색 월(yyyyMM)
|
||||
* @param groupNo 검색 그룹
|
||||
*/
|
||||
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
|
||||
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||
log.debug("getRecordUIReq: {}", reqVO);
|
||||
|
||||
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
|
||||
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||
throw new NoRecordDataException();
|
||||
}
|
||||
return dailyRecord;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package app.module.front.usecase.daily.receipt.adapters.web.model;
|
||||
|
||||
import app.module.core.config.application.enums.FileUploadType;
|
||||
import app.module.front.usecase.daily.income.adapters.web.model.ReceiptReqVO;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class CreateReceiptFileReqVO {
|
||||
private FileUploadType fileUploadType;
|
||||
private ReceiptReqVO ocr;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.module.front.usecase.daily.receipt.adapters.web.model;
|
||||
|
||||
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||
import app.module.core.config.application.enums.DailyInputType;
|
||||
import app.module.core.config.application.enums.FileUploadType;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CreateReceiptHasFileReqVO extends AuditCommand {
|
||||
private String type;
|
||||
private Long receiptId;
|
||||
private Long fileId;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.module.front.usecase.daily.receipt.adapters.web.model;
|
||||
|
||||
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||
import app.module.core.config.application.enums.FileUploadType;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CreateReceiptUploadFileReqVO extends AuditCommand {
|
||||
private Long fileId;
|
||||
private Long dailyRecordSeq;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.module.front.usecase.daily.receipt.adapters.web.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class ReceiptItem {
|
||||
private String name;
|
||||
private int price;
|
||||
private int quantity;
|
||||
@JsonAlias("total_price")
|
||||
private int totalPrice;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package app.module.front.usecase.daily.receipt.adapters.web.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class ReceiptResVO {
|
||||
@JsonAlias("date")
|
||||
private String date;
|
||||
|
||||
@JsonAlias("card/cash")
|
||||
private String cardOrCash;
|
||||
|
||||
@JsonAlias("store_name")
|
||||
private String storeName;
|
||||
|
||||
private List<ReceiptItem> items;
|
||||
|
||||
@JsonAlias("total_price")
|
||||
private int totalPrice;
|
||||
|
||||
private String responseBody;
|
||||
private String error;
|
||||
|
||||
|
||||
public ReceiptResVO(String error) {
|
||||
this.error = error;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package app.module.front.usecase.daily.receipt.ports;
|
||||
|
||||
import app.module.front.usecase.daily.receipt.adapters.web.model.CreateReceiptHasFileReqVO;
|
||||
|
||||
|
||||
public interface DailyReceiptPortIn {
|
||||
|
||||
/**
|
||||
* 일계부 영수증 파일 매핑 추가
|
||||
*
|
||||
*/
|
||||
void insertReceiptMappingFile(CreateReceiptHasFileReqVO formVO);
|
||||
|
||||
/**
|
||||
* 일계부 영수증 파일 개수
|
||||
*
|
||||
*/
|
||||
Integer selectReceiptCount(String inputType);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package app.module.front.usecase.daily.receipt.ports;
|
||||
|
||||
import app.module.front.usecase.daily.receipt.adapters.web.model.CreateReceiptHasFileReqVO;
|
||||
|
||||
|
||||
public interface DailyReceiptPortOut {
|
||||
|
||||
/**
|
||||
* 일계부 수입 영수증 매핑
|
||||
*
|
||||
|
||||
* @param command 수입 영수증 매핑 검색 조건
|
||||
*/
|
||||
void insertReceiptMappingFile(CreateReceiptHasFileReqVO command);
|
||||
|
||||
/**
|
||||
* 일계부 수입 영수증 매핑
|
||||
*
|
||||
|
||||
* @param inputType 수출/수입
|
||||
*/
|
||||
Integer selectReceiptCount(String inputType);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package app.module.front.usecase.daily.receipt.ports.application;
|
||||
|
||||
import app.module.front.usecase.daily.receipt.adapters.web.model.CreateReceiptHasFileReqVO;
|
||||
import app.module.front.usecase.daily.receipt.ports.DailyReceiptPortIn;
|
||||
import app.module.front.usecase.daily.receipt.ports.DailyReceiptPortOut;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DailyReceiptService implements DailyReceiptPortIn {
|
||||
private final DailyReceiptPortOut portOut;
|
||||
|
||||
|
||||
@Override
|
||||
public void insertReceiptMappingFile(CreateReceiptHasFileReqVO formVO) {
|
||||
portOut.insertReceiptMappingFile(formVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer selectReceiptCount(String inputType) {
|
||||
return portOut.selectReceiptCount(inputType);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package app.module.front.usecase.daily.record.adapters.web;
|
||||
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||
import app.module.core.config.application.enums.DailyTargetStatus;
|
||||
import app.module.core.usecase.daily.record.adapters.web.model.CreateDailyRecordReqVO;
|
||||
@@ -81,4 +82,14 @@ public class DailyRecordController {
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 일계부 해당 달 말일일경우 DONE이 아닌 일계부 Alert 창 처리
|
||||
*
|
||||
* @param searchMonth 검색 월(yyyyMM)
|
||||
*/
|
||||
@GetMapping(path = "/alert/{searchMonth}")
|
||||
ResponseEntity<?> selectNoRegister(@PathVariable("searchMonth") String searchMonth) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(dailyRecordPortIn.selectNoRegister(searchMonth, AuthUtil.getUserSeq()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package app.module.front.usecase.daily.status.adapters.persistence;
|
||||
|
||||
import app.module.front.usecase.daily.status.adapters.persistence.model.DailyItemStatusDto;
|
||||
import app.module.front.usecase.daily.status.adapters.persistence.model.DailyMonthStatusDto;
|
||||
import app.module.front.usecase.daily.status.ports.DailyStatusPortOut;
|
||||
import app.module.front.usecase.daily.status.ports.application.domain.GetDailyStatusCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class DailyStatusDao implements DailyStatusPortOut {
|
||||
private final DailyStatusMapper dailyStatusMapper;
|
||||
|
||||
@Override
|
||||
public DailyMonthStatusDto operate(GetDailyStatusCmd command) {
|
||||
DailyMonthStatusDto detail = dailyStatusMapper.getDailyStatusByMonth(command);
|
||||
List<DailyItemStatusDto> countList = dailyStatusMapper.getDailyStatusByItemCount(command);
|
||||
List<DailyItemStatusDto> valueList = dailyStatusMapper.getDailyStatusByItemValue(command);
|
||||
|
||||
int totalInput = 0;
|
||||
if (detail != null) {
|
||||
for (DailyItemStatusDto item : countList) {
|
||||
totalInput = totalInput + item.getInputCount();
|
||||
|
||||
for (DailyItemStatusDto value : valueList) {
|
||||
if (item.getStep().equals(value.getStep())) {
|
||||
item.setTotalValue(value.getTotalValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
detail.setTotalInput(totalInput);
|
||||
detail.setItemList(countList);
|
||||
}
|
||||
|
||||
return detail;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package app.module.front.usecase.daily.status.adapters.persistence;
|
||||
|
||||
import app.module.front.usecase.daily.status.adapters.persistence.model.DailyItemStatusDto;
|
||||
import app.module.front.usecase.daily.status.adapters.persistence.model.DailyMonthStatusDto;
|
||||
import app.module.front.usecase.daily.status.ports.application.domain.GetDailyStatusCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DailyStatusMapper {
|
||||
/**
|
||||
* 월별 입력 현황 조회
|
||||
* @param command 검색 조건
|
||||
* @return 월별 입력 현황
|
||||
*/
|
||||
DailyMonthStatusDto getDailyStatusByMonth(GetDailyStatusCmd command);
|
||||
|
||||
/**
|
||||
* 항목별 월별 입력 현황 건 수 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 항목별 월별 현황 건 수
|
||||
*/
|
||||
List<DailyItemStatusDto> getDailyStatusByItemCount(GetDailyStatusCmd command);
|
||||
|
||||
/**
|
||||
* 항목별 월별 입력 현황 값(금액/시간) 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 항목별 월별 현황 값(금액/시간)
|
||||
*/
|
||||
List<DailyItemStatusDto> getDailyStatusByItemValue(GetDailyStatusCmd command);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package app.module.front.usecase.daily.status.adapters.persistence.model;
|
||||
|
||||
import app.module.core.config.application.enums.DailySort;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DailyItemStatusDto {
|
||||
/**
|
||||
* 항목
|
||||
*/
|
||||
private DailySort step;
|
||||
/**
|
||||
* 대상일
|
||||
*/
|
||||
private Integer dayCount;
|
||||
/**
|
||||
* 완료일(작성일)
|
||||
*/
|
||||
private Integer doneCount;
|
||||
/**
|
||||
* 작성중일(등록 건수)
|
||||
*/
|
||||
private Integer inputCount;
|
||||
/**
|
||||
* 집계 수
|
||||
*/
|
||||
private String totalValue;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package app.module.front.usecase.daily.status.adapters.persistence.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DailyMonthStatusDto {
|
||||
/**
|
||||
* 대상일
|
||||
*/
|
||||
private Integer dayCount;
|
||||
/**
|
||||
* 완료일(작성일)
|
||||
*/
|
||||
private Integer doneCount;
|
||||
/**
|
||||
* 총 등록 수
|
||||
*/
|
||||
private Integer totalInput;
|
||||
|
||||
/**
|
||||
* 항목별 월별 현황
|
||||
*/
|
||||
List<DailyItemStatusDto> itemList;
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package app.module.front.usecase.daily.status.adapters.web;
|
||||
|
||||
import app.module.core.config.application.enums.DailySort;
|
||||
import app.module.core.config.application.exception.NoMatchingURIException;
|
||||
import app.module.front.usecase.daily.expense.adapters.web.model.DailyExpenseUIReqVO;
|
||||
import app.module.front.usecase.daily.expense.ports.DailyExpensePortIn;
|
||||
import app.module.front.usecase.daily.farming.adapters.web.model.DailyFarmingUIReqVO;
|
||||
import app.module.front.usecase.daily.farming.ports.DailyFarmingPortIn;
|
||||
import app.module.front.usecase.daily.forestry.adapters.web.model.DailyForestryUIReqVO;
|
||||
import app.module.front.usecase.daily.forestry.ports.DailyForestryPortIn;
|
||||
import app.module.front.usecase.daily.income.adapters.web.model.DailyIncomeUIReqVO;
|
||||
import app.module.front.usecase.daily.income.ports.DailyIncomePortIn;
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.DailyPowerUIReqVO;
|
||||
import app.module.front.usecase.daily.power.ports.DailyPowerPortIn;
|
||||
import app.module.front.usecase.daily.status.adapters.web.model.DailyStatusUIReqVO;
|
||||
import app.module.front.usecase.daily.status.ports.DailyStatusPortIn;
|
||||
import app.module.front.usecase.daily.work.adapters.web.model.DailyWorkUIReqVO;
|
||||
import app.module.front.usecase.daily.work.ports.DailyWorkPortIn;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/status/daily")
|
||||
public class DailyStatusUIController {
|
||||
private final DailyStatusPortIn dailyStatusPortIn;
|
||||
private final DailyIncomePortIn dailyIncomePortIn;
|
||||
private final DailyWorkPortIn dailyWorkPortIn;
|
||||
private final DailyExpensePortIn dailyExpensePortIn;
|
||||
private final DailyPowerPortIn dailyPowerPortIn;
|
||||
private final DailyForestryPortIn dailyForestryPortIn;
|
||||
private final DailyFarmingPortIn dailyFarmingPortIn;
|
||||
|
||||
/**
|
||||
* 일계부 입력 현황 화면
|
||||
*
|
||||
* @param model Model
|
||||
*/
|
||||
@GetMapping(path = "")
|
||||
public String index(Model model, @ModelAttribute DailyStatusUIReqVO reqVO) {
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
|
||||
model.addAttribute("reqVO", reqVO);
|
||||
|
||||
model.addAttribute("detail", dailyStatusPortIn.operate(reqVO));
|
||||
|
||||
return "status/daily";
|
||||
}
|
||||
|
||||
/**
|
||||
* 일계부 입력 현황 상세 화면
|
||||
*
|
||||
* @param model Model
|
||||
* @param step 조회 항목
|
||||
* @param searchMonth 검색 월
|
||||
*/
|
||||
@GetMapping(path = "/{step}/{searchMonth}")
|
||||
public String detail(Model model, @PathVariable("step") String step, @PathVariable("searchMonth") String searchMonth) {
|
||||
if (DailySort.INCOME.name().equalsIgnoreCase(step)) {
|
||||
model.addAttribute("step", DailySort.INCOME);
|
||||
model.addAttribute("list", dailyIncomePortIn.monthList(new DailyIncomeUIReqVO(searchMonth, "")));
|
||||
} else if (DailySort.WORK.name().equalsIgnoreCase(step)) {
|
||||
model.addAttribute("step", DailySort.WORK);
|
||||
model.addAttribute("list", dailyWorkPortIn.monthList(new DailyWorkUIReqVO(searchMonth, "")));
|
||||
} else if (DailySort.EXPENSE.name().equalsIgnoreCase(step)) {
|
||||
model.addAttribute("step", DailySort.EXPENSE);
|
||||
model.addAttribute("list", dailyExpensePortIn.monthList(new DailyExpenseUIReqVO(searchMonth, "")));
|
||||
} else if (DailySort.POWER.name().equalsIgnoreCase(step)) {
|
||||
model.addAttribute("step", DailySort.POWER);
|
||||
model.addAttribute("list", dailyPowerPortIn.monthList(new DailyPowerUIReqVO(searchMonth, "")));
|
||||
} else if (DailySort.FORESTRY.name().equalsIgnoreCase(step)) {
|
||||
model.addAttribute("step", DailySort.FORESTRY);
|
||||
model.addAttribute("list", dailyForestryPortIn.monthList(new DailyForestryUIReqVO(searchMonth, "")));
|
||||
} else if (DailySort.FARMING.name().equalsIgnoreCase(step)) {
|
||||
model.addAttribute("step", DailySort.FARMING);
|
||||
model.addAttribute("list", dailyFarmingPortIn.monthList(new DailyFarmingUIReqVO(searchMonth, "")));
|
||||
} else {
|
||||
throw new NoMatchingURIException("잘못된 접근");
|
||||
}
|
||||
|
||||
model.addAttribute("searchMonth", searchMonth);
|
||||
return String.format("status/daily/detail-%s", step);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package app.module.front.usecase.daily.status.adapters.web.model;
|
||||
|
||||
import app.module.core.config.application.util.DailyUtil;
|
||||
import app.module.front.usecase.daily.calendar.adapters.web.model.RecordCalendarUIReqVO;
|
||||
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import org.apache.tika.utils.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString(callSuper = true)
|
||||
public class DailyStatusUIReqVO extends DailyUIReqVO {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RecordCalendarUIReqVO.class);
|
||||
private static DailyUtil dailyUtil;
|
||||
|
||||
public DailyStatusUIReqVO() {
|
||||
setSearchMonth(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMM")));
|
||||
}
|
||||
|
||||
/**
|
||||
* 검색 월 목록
|
||||
*
|
||||
* @return 현재 날짜 기준 최대 13개월전까지의 검색 월
|
||||
*/
|
||||
public List<LocalDate> getMonthList() {
|
||||
LocalDate currentMonth = LocalDate.now();
|
||||
List<LocalDate> monthList = new ArrayList<>();
|
||||
monthList.add(currentMonth);
|
||||
for (int i = 1 ; i <= 13; i++) {
|
||||
monthList.add(currentMonth.minusMonths(i));
|
||||
}
|
||||
|
||||
return monthList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package app.module.front.usecase.daily.status.ports;
|
||||
|
||||
|
||||
import app.module.front.usecase.daily.status.adapters.persistence.model.DailyMonthStatusDto;
|
||||
import app.module.front.usecase.daily.status.adapters.web.model.DailyStatusUIReqVO;
|
||||
|
||||
public interface DailyStatusPortIn {
|
||||
/**
|
||||
* 특정월의 일계부 입력 현황
|
||||
*
|
||||
* @param reqVO 검색 조건
|
||||
* @return 특정월의 일계부 입력 현황
|
||||
*/
|
||||
DailyMonthStatusDto operate(DailyStatusUIReqVO reqVO);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.module.front.usecase.daily.status.ports;
|
||||
|
||||
import app.module.front.usecase.daily.status.adapters.persistence.model.DailyMonthStatusDto;
|
||||
import app.module.front.usecase.daily.status.ports.application.domain.GetDailyStatusCmd;
|
||||
|
||||
public interface DailyStatusPortOut {
|
||||
/**
|
||||
* 특정월의 일계부 입력 현황
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 특정월의 일계부 입력 현황
|
||||
*/
|
||||
DailyMonthStatusDto operate(GetDailyStatusCmd command);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package app.module.front.usecase.daily.status.ports.application;
|
||||
|
||||
import app.module.front.usecase.daily.status.adapters.persistence.model.DailyMonthStatusDto;
|
||||
import app.module.front.usecase.daily.status.adapters.web.model.DailyStatusUIReqVO;
|
||||
import app.module.front.usecase.daily.status.ports.DailyStatusPortIn;
|
||||
import app.module.front.usecase.daily.status.ports.DailyStatusPortOut;
|
||||
import app.module.front.usecase.daily.status.ports.application.domain.GetDailyStatusCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DailyStatusService implements DailyStatusPortIn {
|
||||
private final DailyStatusPortOut portOut;
|
||||
|
||||
@Override
|
||||
public DailyMonthStatusDto operate(DailyStatusUIReqVO reqVO) {
|
||||
return portOut.operate(new GetDailyStatusCmd(reqVO.getSearchMonth(), reqVO.getHouseholdSeq()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package app.module.front.usecase.daily.status.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class GetDailyStatusCmd {
|
||||
/**
|
||||
* 검색 월(yyyyMM)
|
||||
*/
|
||||
private String recordMonth;
|
||||
/**
|
||||
* 임가 일련번호
|
||||
*/
|
||||
private Long householdSeq;
|
||||
}
|
||||
@@ -15,22 +15,27 @@ import java.util.List;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DailyWorkDao implements DailyWorkPortOut {
|
||||
private final DailyWorkMapper dailyWorkMapper;
|
||||
private final DailyWorkMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<DailyWorkDto> list(GetDailyWorkCmd command) {
|
||||
return dailyWorkMapper.getDailyWorkList(command);
|
||||
return mapper.getDailyWorkList(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DailyWorkDto> monthList(GetDailyWorkCmd command) {
|
||||
return mapper.getDailyWorkMonthList(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(GetDailyWorkCmd findCmd, CreateDailyWorkCmd command) {
|
||||
Integer existCount = dailyWorkMapper.getRecordExistCount(findCmd);
|
||||
Integer existCount = mapper.getRecordExistCount(findCmd);
|
||||
if (existCount == 0) {
|
||||
dailyWorkMapper.createDailyWork(command);
|
||||
mapper.createDailyWork(command);
|
||||
|
||||
log.debug("[CreateDailyWork] record={}", command);
|
||||
} else {
|
||||
dailyWorkMapper.updateDailyWork(command);
|
||||
mapper.updateDailyWork(command);
|
||||
|
||||
log.debug("[UpdateDailyWork] record={}", command);
|
||||
}
|
||||
@@ -38,9 +43,9 @@ public class DailyWorkDao implements DailyWorkPortOut {
|
||||
|
||||
@Override
|
||||
public void remove(GetDailyWorkCmd findCmd, RemoveDailyWorkCmd command) {
|
||||
Integer existCount = dailyWorkMapper.getRecordExistCount(findCmd);
|
||||
Integer existCount = mapper.getRecordExistCount(findCmd);
|
||||
if (existCount != 0) {
|
||||
dailyWorkMapper.removeDailyWork(command);
|
||||
mapper.removeDailyWork(command);
|
||||
|
||||
log.debug("[RemoveDailyWork] record={}", command);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package app.module.front.usecase.daily.work.adapters.persistence;
|
||||
|
||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||
import app.module.front.usecase.daily.income.ports.application.domain.GetDailyIncomeCmd;
|
||||
import app.module.front.usecase.daily.work.ports.application.domain.CreateDailyWorkCmd;
|
||||
import app.module.front.usecase.daily.work.adapters.persistence.model.DailyWorkDto;
|
||||
import app.module.front.usecase.daily.work.ports.application.domain.GetDailyWorkCmd;
|
||||
@@ -12,13 +14,21 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface DailyWorkMapper {
|
||||
/**
|
||||
* 일계부 임업노동 목록 조회
|
||||
* 특정 그룹일의 일계부 임업노동 목록 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 임업노동 목록
|
||||
*/
|
||||
List<DailyWorkDto> getDailyWorkList(GetDailyWorkCmd command);
|
||||
|
||||
/**
|
||||
* 특정월의 일계부 임업노동 목록 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 임업노동 목록
|
||||
*/
|
||||
List<DailyWorkDto> getDailyWorkMonthList(GetDailyWorkCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 임업노동 데이터 존재 여부
|
||||
*
|
||||
|
||||
@@ -6,6 +6,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Slf4j
|
||||
@Getter
|
||||
@@ -35,6 +36,8 @@ public class DailyWorkDto {
|
||||
private String sharedFHours;
|
||||
private String volunteerMHours;
|
||||
private String volunteerFHours;
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
|
||||
/**
|
||||
* 수정 가능 여부
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user