From 94ed71de2eb6212168e62c2c2c294b86644b87d4 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期一, 18 三月 2024 14:09:20 +0800
Subject: [PATCH] git ch
---
server/service/src/main/java/com/doumee/core/utils/Constants.java | 93 +++++++++++++++++++++++
server/service/src/main/java/com/doumee/service/business/UnionApplyService.java | 7 +
server/service/src/main/java/com/doumee/dao/business/dto/SaveUnionApplyDTO.java | 36 +++++++++
server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java | 3
server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java | 80 ++++++++++++++++++++
5 files changed, 218 insertions(+), 1 deletions(-)
diff --git a/server/service/src/main/java/com/doumee/core/utils/Constants.java b/server/service/src/main/java/com/doumee/core/utils/Constants.java
index 9d91bb1..65e3905 100644
--- a/server/service/src/main/java/com/doumee/core/utils/Constants.java
+++ b/server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -564,7 +564,7 @@
SYSTEM(0, "绯荤粺鐢ㄦ埛", "绠$悊鍛�",Arrays.asList(0,1,2,3,4,5,6,7,8,9,10,11)),
COMPANY(1, "浼佷笟鐢ㄦ埛", "浼佷笟",Arrays.asList(-1)),
- ZHUBO(2, "涓绘挱", "涓绘挱",Arrays.asList(-1)),
+ ZHUBO(2, "鍟嗘埛", "鍟嗘埛",Arrays.asList(-1)),
;
// 鎴愬憳鍙橀噺
private String name;
@@ -844,6 +844,97 @@
}
}
+ public enum UnionApplyStatus {
+ UPLOAD(1, "寰呬笂浼犳姇淇濆崟","",0),
+ ;
+ // 鎴愬憳鍙橀噺
+ private String name;
+ private String info;
+ private int key;
+ private int collectStatus;
+
+
+ // 鏋勯�犳柟娉�
+ UnionApplyStatus(int key, String name,String info,int collectStatus) {
+ this.name = name;
+ this.key = key;
+ this.info = info;
+ this.collectStatus = collectStatus;
+ }
+
+ // 鏅�氭柟娉�
+ public static String getName(int index) {
+ for (UnionApplyStatus c : UnionApplyStatus.values()) {
+ if (c.getKey() == index) {
+ return c.name;
+ }
+ }
+ return null;
+ }
+ public static List<Integer> getKesByStatus(Integer collectStatus) {
+ List<Integer> list = new ArrayList<>();
+ if(collectStatus!=null){
+ for (UnionApplyStatus c : UnionApplyStatus.values()) {
+ if (Constants.equalsInteger(c.getCollectStatus() ,collectStatus)) {
+ list.add(c.getKey());
+ }
+ }
+ }
+ return list;
+ }
+ public static Integer getCollectStatus(Integer index) {
+ for (UnionApplyStatus c : UnionApplyStatus.values()) {
+ if (Constants.equalsInteger(c.getKey() , index)) {
+ return c.collectStatus;
+ }
+ }
+ return null;
+ }
+ public static String getInfo(int index) {
+ for (UnionApplyStatus c : UnionApplyStatus.values()) {
+ if (c.getKey() == index) {
+ return c.info;
+ }
+ }
+ return null;
+ }
+
+ // get set 鏂规硶
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getKey() {
+ return key;
+ }
+
+ public void setKey(int key) {
+ this.key = key;
+ }
+
+ public String getInfo() {
+ return info;
+ }
+
+ public void setInfo(String info) {
+ this.info = info;
+ }
+
+ public int getCollectStatus() {
+ return collectStatus;
+ }
+
+ public void setCollectStatus(int collectStatus) {
+ this.collectStatus = collectStatus;
+ }
+ }
+
+
+
public enum InsuranceApplyStatus {
UPLOAD(0, "鎻愪氦鎶曚繚","",0),
PLATFORM_RETURN(1, "瀹℃牳涓嶉�氳繃","鎻愪氦鎰忚锛�${param}",4),
diff --git a/server/service/src/main/java/com/doumee/dao/business/dto/SaveUnionApplyDTO.java b/server/service/src/main/java/com/doumee/dao/business/dto/SaveUnionApplyDTO.java
new file mode 100644
index 0000000..3d4bbab
--- /dev/null
+++ b/server/service/src/main/java/com/doumee/dao/business/dto/SaveUnionApplyDTO.java
@@ -0,0 +1,36 @@
+package com.doumee.dao.business.dto;
+
+import com.doumee.core.annotation.excel.ExcelColumn;
+import java.util.Date;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.models.auth.In;
+import lombok.Data;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @Author : Rk
+ * @create 2024/3/15 14:42
+ */
+@Data
+public class SaveUnionApplyDTO {
+
+ @ApiModelProperty(value = "鏂规鍩虹鏁版嵁涓婚敭")
+ private Integer baseSolutionId;
+
+ @ApiModelProperty(value = "淇濆崟涓婚敭 澶氫釜浠�,鍒嗗壊")
+ private List<Integer> applyIds;
+
+ @ApiModelProperty(value = "寮�濮嬫棩鏈�")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date startDate;
+
+ @ApiModelProperty(value = "缁撴潫鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date endDate;
+
+
+}
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java b/server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java
index 412f5c3..36ade21 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java
@@ -214,6 +214,9 @@
@TableField(exist = false)
private Integer timeUnit;
+ @ApiModelProperty(value = "鏂规鍩虹鐗堟湰涓婚敭", example = "1")
+ @TableField(exist = false)
+ private Integer solutionBaseId;
@ApiModelProperty(value = "鏈�鏂扮増鏈殑鏂规涓婚敭", example = "1")
@TableField(exist = false)
diff --git a/server/service/src/main/java/com/doumee/service/business/UnionApplyService.java b/server/service/src/main/java/com/doumee/service/business/UnionApplyService.java
index b5346b2..354081f 100644
--- a/server/service/src/main/java/com/doumee/service/business/UnionApplyService.java
+++ b/server/service/src/main/java/com/doumee/service/business/UnionApplyService.java
@@ -2,6 +2,7 @@
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
+import com.doumee.dao.business.dto.SaveUnionApplyDTO;
import com.doumee.dao.business.model.UnionApply;
import java.util.List;
@@ -94,4 +95,10 @@
* @return long
*/
long count(UnionApply unionApply);
+
+ /**
+ * 淇濆崟鍚堝苟
+ * @param saveUnionApplyDTO
+ */
+ void merge(SaveUnionApplyDTO saveUnionApplyDTO);
}
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java
index 2acd28e..b9450d7 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java
@@ -1,20 +1,35 @@
package com.doumee.service.business.impl;
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
+import com.doumee.core.model.LoginUserInfo;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
+import com.doumee.core.utils.Constants;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.UnionApplyMapper;
+import com.doumee.dao.business.dto.SaveUnionApplyDTO;
+import com.doumee.dao.business.join.InsuranceApplyJoinMapper;
+import com.doumee.dao.business.model.InsuranceApply;
+import com.doumee.dao.business.model.Solutions;
import com.doumee.dao.business.model.UnionApply;
import com.doumee.service.business.UnionApplyService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import io.swagger.models.auth.In;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
+import java.math.BigDecimal;
+import java.util.Date;
import java.util.List;
+import java.util.Objects;
/**
* 鍚堝苟鎶曚繚鍗曚俊鎭〃Service瀹炵幇
@@ -26,6 +41,9 @@
@Autowired
private UnionApplyMapper unionApplyMapper;
+
+ @Autowired
+ private InsuranceApplyJoinMapper insuranceApplyJoinMapper;
@Override
public Integer create(UnionApply unionApply) {
@@ -166,4 +184,66 @@
QueryWrapper<UnionApply> wrapper = new QueryWrapper<>(unionApply);
return unionApplyMapper.selectCount(wrapper);
}
+
+
+ @Override
+ public void merge(SaveUnionApplyDTO saveUnionApplyDTO){
+ LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ if(user.getType().equals(Constants.TWO)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲晢鎴风敤鎴凤紝鏃犳硶杩涜璇ユ搷浣�");
+ }
+ if(Objects.isNull(saveUnionApplyDTO)
+ || Objects.isNull(saveUnionApplyDTO.getApplyIds())
+ || Objects.isNull(saveUnionApplyDTO.getStartDate())
+ || Objects.isNull(saveUnionApplyDTO.getEndDate())
+ ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ List<InsuranceApply> insuranceApplyList = insuranceApplyJoinMapper.selectJoinList(InsuranceApply.class,
+ new MPJLambdaWrapper<InsuranceApply>()
+ .selectAll(InsuranceApply.class)
+ .selectAs(InsuranceApply::getSolutionBaseId,Solutions::getBaseId)
+ .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
+ .eq(InsuranceApply::getIsdeleted, Constants.ZERO)
+ .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.PLATFORM_CHECK_PASS.getKey())
+ .eq(Solutions::getBaseId,saveUnionApplyDTO.getBaseSolutionId())
+ .in(InsuranceApply::getId,saveUnionApplyDTO.getApplyIds())
+ .isNull(InsuranceApply::getUnionApplyId)
+ );
+ //鏌ヨ鏁版嵁鏄惁瀛樺湪鏈浜庡鎵归�氳繃鐨勬暟鎹�
+ if(insuranceApplyList.size()!=saveUnionApplyDTO.getApplyIds().size()){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀛樺湪鏁版嵁宸插鐞嗭紝璇峰埛鏂伴噸璇�");
+ }
+
+ UnionApply unionApply = new UnionApply();
+ unionApply.setCreateDate(new Date());
+ unionApply.setCreator(user.getId());
+ unionApply.setCompanyId(user.getCompanyId());
+ unionApply.setStartTime(saveUnionApplyDTO.getStartDate());
+ unionApply.setEndTime(saveUnionApplyDTO.getEndDate());
+ unionApply.setCheckDate(new Date());
+ unionApply.setStatus(Constants.UnionApplyStatus.UPLOAD.getKey());
+ unionApply.setCheckUserId(user.getId());
+ unionApply.setFee(insuranceApplyList.stream().map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
+ unionApply.setCurrentFee(BigDecimal.ZERO);
+ unionApplyMapper.insert(unionApply);
+
+ insuranceApplyJoinMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda()
+ .set(InsuranceApply::getUnionApplyId,unionApply.getId())
+ .set(InsuranceApply::getCheckDate,new Date())
+ .set(InsuranceApply::getCheckUserId,user.getId())
+ .in(InsuranceApply::getId,saveUnionApplyDTO.getApplyIds()));
+
+ }
+
+
+ public void cancelMerge(Integer id){
+ LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ if(user.getType().equals(Constants.TWO)){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲晢鎴风敤鎴凤紝鏃犳硶杩涜璇ユ搷浣�");
+ }
+
+ }
+
+
}
--
Gitblit v1.9.3