From 0e31fd20a1be8899f0ade4b7b7fb0e8d196624bf Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 23 一月 2024 15:17:11 +0800
Subject: [PATCH] 开发业务接口
---
server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java | 260 ++++++++++++++++++++++++++++++--
server/service/src/main/java/com/doumee/service/business/ApplyChangeService.java | 5
server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java | 46 +++-
server/service/src/main/java/com/doumee/dao/business/model/ApplyChagneDetail.java | 16 +
server/platform/src/main/java/com/doumee/api/business/TaxesController.java | 2
server/service/src/main/java/com/doumee/dao/business/join/ApplyChagneDetailJoinMapper.java | 4
server/service/src/main/java/com/doumee/dao/business/model/ApplyChange.java | 7
server/service/src/main/java/com/doumee/core/utils/Constants.java | 16 +
server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java | 64 +++++++
server/platform/src/main/java/com/doumee/api/business/InsuranceApplyController.java | 6
server/platform/src/main/java/com/doumee/api/business/ApplyChangeController.java | 28 +++
server/service/src/main/java/com/doumee/service/business/InsuranceApplyService.java | 2
server/service/src/main/java/com/doumee/dao/business/model/ApplyDetail.java | 4
13 files changed, 417 insertions(+), 43 deletions(-)
diff --git a/server/platform/src/main/java/com/doumee/api/business/ApplyChangeController.java b/server/platform/src/main/java/com/doumee/api/business/ApplyChangeController.java
index 9f1a364..db4f1c4 100644
--- a/server/platform/src/main/java/com/doumee/api/business/ApplyChangeController.java
+++ b/server/platform/src/main/java/com/doumee/api/business/ApplyChangeController.java
@@ -37,6 +37,34 @@
public ApiResponse create(@RequestBody ApplyChange applyChange) {
return ApiResponse.success(applyChangeService.create(applyChange));
}
+ @PreventRepeat
+ @ApiOperation("骞冲彴閫�鍥炴姇淇�")
+ @PostMapping("/back")
+ @RequiresPermissions("business:applychange:back")
+ public ApiResponse back(@RequestBody ApplyChange applyChange) {
+ return ApiResponse.success(applyChangeService.back(applyChange));
+ }
+ @PreventRepeat
+ @ApiOperation("骞冲彴澶勭悊閫�鍥炵敵璇�")
+ @PostMapping("/dealBackApply")
+ @RequiresPermissions("business:applychange:dealBackApply")
+ public ApiResponse dealBackApply(@RequestBody ApplyChange applyChange) {
+ return ApiResponse.success(applyChangeService.dealBackApply(applyChange));
+ }
+ @PreventRepeat
+ @ApiOperation("骞冲彴涓婁紶鎵瑰崟")
+ @PostMapping("/uploadPidan")
+ @RequiresPermissions("business:applychange:uploadPidan")
+ public ApiResponse uploadPidan(@RequestBody ApplyChange applyChange) {
+ return ApiResponse.success(applyChangeService.uploadPidan(applyChange));
+ }
+ @PreventRepeat
+ @ApiOperation("骞冲彴淇敼鎵瑰崟")
+ @PostMapping("/editPidan")
+ @RequiresPermissions("business:applychange:editPidan")
+ public ApiResponse editPidan(@RequestBody ApplyChange applyChange) {
+ return ApiResponse.success(applyChangeService.editPidan(applyChange));
+ }
@ApiOperation("鏍规嵁ID鍒犻櫎")
@GetMapping("/delete/{id}")
diff --git a/server/platform/src/main/java/com/doumee/api/business/InsuranceApplyController.java b/server/platform/src/main/java/com/doumee/api/business/InsuranceApplyController.java
index c9e41f3..95e5981 100644
--- a/server/platform/src/main/java/com/doumee/api/business/InsuranceApplyController.java
+++ b/server/platform/src/main/java/com/doumee/api/business/InsuranceApplyController.java
@@ -69,6 +69,12 @@
public ApiResponse dealBackApply(@RequestBody InsuranceApply insuranceApply) {
return ApiResponse.success(insuranceApplyService.dealBackApply(insuranceApply));
}
+ @ApiOperation("骞冲彴淇敼淇濋櫓鍗�")
+ @PostMapping("/editBaoxiandan")
+ @RequiresPermissions("business:insuranceapply:editBaoxiandan")
+ public ApiResponse editBaoxiandan(@RequestBody InsuranceApply insuranceApply) {
+ return ApiResponse.success(insuranceApplyService.editBaoxiandan(insuranceApply));
+ }
@ApiOperation("鏍规嵁ID鍒犻櫎")
@GetMapping("/delete/{id}")
diff --git a/server/platform/src/main/java/com/doumee/api/business/TaxesController.java b/server/platform/src/main/java/com/doumee/api/business/TaxesController.java
index 22f281e..044a194 100644
--- a/server/platform/src/main/java/com/doumee/api/business/TaxesController.java
+++ b/server/platform/src/main/java/com/doumee/api/business/TaxesController.java
@@ -99,7 +99,7 @@
@ApiOperation("鏍规嵁ID鏌ヨ")
@GetMapping("/{id}")
@RequiresPermissions("business:taxes:query")
- public ApiResponse findById(@PathVariable Integer id) {
+ public ApiResponse<Taxes> findById(@PathVariable Integer id) {
return ApiResponse.success(taxesService.findById(id));
}
}
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 200e527..c6d746e 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
@@ -367,7 +367,9 @@
BD_APPLY_PDF(8, "淇濆崟鐢宠琛≒DF ", "淇濆崟鐢宠琛≒DF "),
BD_SIGNED_PDF(9, "绛剧讲鍚庝繚鍗曠敵璇疯〃PDF", "绛剧讲鍚庝繚鍗曠敵璇疯〃PDF"),
COM_SING_IMG(10, "浼佷笟鍗扮珷", "浼佷笟鍗扮珷"),
- BD_DONE_PDF(10, "鏈�缁堟姤鍗�", "鏈�缁堟姤鍗�"),
+ BD_DONE_PDF(11, "鏈�缁堟姤鍗�", "鏈�缁堟姤鍗�"),
+
+ CA_PD_PDF(12, "鏈�缁堟姤鍗�", "鏈�缁堟姤鍗�"),
;
@@ -634,13 +636,15 @@
PLATFORM_CHECK_PASS(11, "鎶曚繚瀹℃牳閫氳繃",""),
CA_PLATFORM_CHECK_PASS_NO(12, "閫�鍥炴姇淇�","鎻愪氦鎰忚锛�${param}"),
CA_PLATFORM_AGREE_BACK_APPLY(13, "鍚屾剰閫�鍥炵敵璇�","鎻愪氦鎰忚锛�${param}"),
- CA_PLATFORM_CHECK_APPROVE(14, "鎵瑰崟瀹屾垚",""),
+ CA_PLATFORM_APPROVE(14, "鎵瑰崟瀹屾垚","淇濋櫓鐢熸晥璧锋湡锛�${param1}鍙樻洿涓�${param2}"),
CA_PLATFORM_CHECK_SIGNATURE(15, "浼佷笟绛剧珷",""),
CA_COMPANY_EDIT(16, "鎵瑰崟淇敼","鎻愪氦鎰忚锛�${param1}\n${param2}"),
CA_COMPANY_COMMIT(17, "鎻愪氦鎶曚繚","鎻愪氦鎰忚锛�${param}"),
CA_COMPANY_BACK_APPLY(18, "鐢宠閫�鍥�","鎻愪氦鎰忚锛�${param}"),
CA_COMPANY_CLOSE(19, "鍏抽棴璁㈠崟",""),
CA_PALTFORM_REFUSE_APPLY(20, "椹冲洖閫�鍥炵敵璇�",""),
+ CA_PALTFORM_EDIT_PIDAN(21, "淇敼鎵瑰崟","淇敼鍘熷洜锛�${param}"),
+ PALTFORM_EDIT_BD(22, "淇敼淇濆崟","淇敼鍘熷洜锛�${param}"),
;
// 鎴愬憳鍙橀噺
private String name;
@@ -775,6 +779,14 @@
}
return solutions.getPrice().multiply(new BigDecimal(cycle));
}
+ public static BigDecimal countDetailFee(int timeUnit ,BigDecimal price,Date startDate, Date endDate){
+ //鏌ヨ淇濋櫓瀹為檯鍛ㄦ湡
+ Integer cycle = DateUtil.calculateBetween(endDate,startDate,timeUnit);
+ if(cycle==-1){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏃ユ湡淇℃伅閿欒!");
+ }
+ return Constants.formatBigdecimal(price).multiply(new BigDecimal(cycle));
+ }
public enum ApplyChangeStatus {
diff --git a/server/service/src/main/java/com/doumee/dao/business/join/ApplyChagneDetailJoinMapper.java b/server/service/src/main/java/com/doumee/dao/business/join/ApplyChagneDetailJoinMapper.java
index c2e9ec8..d4a1025 100644
--- a/server/service/src/main/java/com/doumee/dao/business/join/ApplyChagneDetailJoinMapper.java
+++ b/server/service/src/main/java/com/doumee/dao/business/join/ApplyChagneDetailJoinMapper.java
@@ -2,7 +2,10 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.doumee.dao.business.model.ApplyChagneDetail;
+import com.doumee.dao.business.model.ApplyDetail;
import com.github.yulichang.base.mapper.MPJJoinMapper;
+
+import java.util.List;
/**
* @author 姹熻箘韫�
@@ -10,4 +13,5 @@
*/
public interface ApplyChagneDetailJoinMapper extends MPJJoinMapper<ApplyChagneDetail> {
+ void insertBatchSomeColumn(List<ApplyDetail> addList);
}
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/ApplyChagneDetail.java b/server/service/src/main/java/com/doumee/dao/business/model/ApplyChagneDetail.java
index ada6639..5d82952 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/ApplyChagneDetail.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/ApplyChagneDetail.java
@@ -67,11 +67,11 @@
@ApiModelProperty(value = "瀹為檯淇濋櫓鐢熸晥姝㈡湡")
@ExcelColumn(name="瀹為檯淇濋櫓鐢熸晥姝㈡湡")
- private String endTime;
+ private Date endTime;
@ApiModelProperty(value = "瀹為檯淇濋櫓鐢熸晥璧锋湡")
@ExcelColumn(name="瀹為檯淇濋櫓鐢熸晥璧锋湡")
- private String startTime;
+ private Date startTime;
@ApiModelProperty(value = "鏈�杩戞搷浣滄椂闂�")
@ExcelColumn(name="鏈�杩戞搷浣滄椂闂�")
@@ -79,7 +79,7 @@
@ApiModelProperty(value = "娲鹃仯鍗曚綅缂栫爜锛堝叧鑱攄ispatch_unit)")
@ExcelColumn(name="娲鹃仯鍗曚綅缂栫爜锛堝叧鑱攄ispatch_unit)")
- private String duId;
+ private Integer duId;
@ApiModelProperty(value = "宸ョ缂栫爜", example = "1")
@ExcelColumn(name="宸ョ缂栫爜")
@@ -113,4 +113,14 @@
@TableField(exist = false)
private String workTypeName;
+
+ @ApiModelProperty(value = "淇濋櫓璐圭敤(浜�/澶╋級", example = "1")
+ @TableField(exist = false)
+ private BigDecimal solutionPrice;
+
+ @ApiModelProperty(value = "淇濋櫓鏃堕棿鍗曚綅0澶� 1鍗婃湀 2鏈� 3骞�", example = "1")
+ @TableField(exist = false)
+ private Integer solutionTimeUnit;
+
+
}
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/ApplyChange.java b/server/service/src/main/java/com/doumee/dao/business/model/ApplyChange.java
index 7ee93e8..9395c4c 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/ApplyChange.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/ApplyChange.java
@@ -162,4 +162,11 @@
@TableField(exist = false)
private Integer companyId;
+ @ApiModelProperty(value = "鎵瑰崟闄勪欢瀵硅薄")
+ @TableField(exist = false)
+ private Multifile pidanFile;
+ @ApiModelProperty(value = "澶勭悊浼佷笟鐢宠鐘舵�� 0鍚屾剰 1椹冲洖")
+ @TableField(exist = false)
+ private int dealBackApply;
+
}
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/ApplyDetail.java b/server/service/src/main/java/com/doumee/dao/business/model/ApplyDetail.java
index 0ecb3e6..d12e3b8 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/ApplyDetail.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/ApplyDetail.java
@@ -67,11 +67,11 @@
@ApiModelProperty(value = "瀹為檯淇濋櫓鐢熸晥姝㈡湡")
@ExcelColumn(name="瀹為檯淇濋櫓鐢熸晥姝㈡湡")
- private String endTime;
+ private Date endTime;
@ApiModelProperty(value = "瀹為檯淇濋櫓鐢熸晥璧锋湡")
@ExcelColumn(name="瀹為檯淇濋櫓鐢熸晥璧锋湡")
- private String startTime;
+ private Date startTime;
@ApiModelProperty(value = "韬唤璇佸彿鐮�")
@ExcelColumn(name="韬唤璇佸彿鐮�")
diff --git a/server/service/src/main/java/com/doumee/service/business/ApplyChangeService.java b/server/service/src/main/java/com/doumee/service/business/ApplyChangeService.java
index 3e27eda..4a42bc6 100644
--- a/server/service/src/main/java/com/doumee/service/business/ApplyChangeService.java
+++ b/server/service/src/main/java/com/doumee/service/business/ApplyChangeService.java
@@ -4,6 +4,8 @@
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.dto.ApplyChangeOptDTO;
import com.doumee.dao.business.model.ApplyChange;
+import com.doumee.dao.business.model.InsuranceApply;
+
import java.util.List;
/**
@@ -22,6 +24,7 @@
Integer create(ApplyChange applyChange);
Integer back(ApplyChange param);
Integer dealBackApply(ApplyChange param);
+ Integer uploadPidan(ApplyChange insuranceApply);
/**
* 涓婚敭鍒犻櫎
*
@@ -103,4 +106,6 @@
void changeOpt(ApplyChangeOptDTO applyChangeOptDTO);
ApplyChange findDetail(Integer id);
+
+ Integer editPidan(ApplyChange applyChange);
}
diff --git a/server/service/src/main/java/com/doumee/service/business/InsuranceApplyService.java b/server/service/src/main/java/com/doumee/service/business/InsuranceApplyService.java
index 62cef76..855388f 100644
--- a/server/service/src/main/java/com/doumee/service/business/InsuranceApplyService.java
+++ b/server/service/src/main/java/com/doumee/service/business/InsuranceApplyService.java
@@ -112,4 +112,6 @@
Integer check(InsuranceApply insuranceApply);
InsuranceApply findDetailForExport(InsuranceApply model);
+
+ Integer editBaoxiandan(InsuranceApply param);
}
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
index 847d831..3b4aaf7 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
@@ -63,6 +63,8 @@
private MemberMapper memberMapper;
@Autowired
+ private MultifileMapper multifileMapper;
+ @Autowired
private DuSolutionMapper duSolutionMapper;
@Autowired
private DuWorktypeMapper duWorktypeMapper;
@@ -113,6 +115,215 @@
return 1;
}
+
+ @Override
+ @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+ public Integer uploadPidan(ApplyChange param) {
+ if(param.getId() == null
+ || param.getValidCode() == null
+ || param.getApplyStartTime() == null
+ || param.getPidanFile() == null
+ ||StringUtils.isBlank( param.getPidanFile().getFileurl())
+ ||StringUtils.isBlank( param.getPidanFile() .getName())){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+
+ ApplyChange model = applyChangeMapper.selectById(param.getId());
+ if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ if(!Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.SIGNATURE.getKey())){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
+ }
+
+ LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ ApplyChange update = new ApplyChange();
+ update.setEditDate(new Date());
+ update.setEditor(user.getId());
+ update.setStatus(Constants.ApplyChangeStatus.APPROVE.getKey());
+ update.setCheckDate(update.getEditDate());
+ update.setCheckInfo(param.getCheckInfo());
+ update.setCheckUserId(user.getId());
+ update.setId(model.getId());
+ update.setValidCode(param.getValidCode());
+ update.setApplyStartTime(model.getApplyStartTime());
+ applyChangeMapper.updateById(update);
+
+ param.getPidanFile().setIsdeleted(Constants.ZERO);
+ param.getPidanFile().setCreator(user.getId());
+ param.getPidanFile().setObjId(update.getId());
+ param.getPidanFile().setCreateDate(update.getEditDate());
+ param.getPidanFile().setObjType(Constants.MultiFile.CA_PD_PDF.getKey());
+ param.getPidanFile().setType(Constants.TWO);
+ multifileMapper.insert(param.getPidanFile());
+
+ update.setApplyId(model.getApplyId());
+ long times = param.getApplyStartTime().getTime() - model.getValidTime().getTime();
+ //澶勭悊鍔犲噺淇濇槑缁嗘暟鎹�
+ dealDetailsValidTime(update,times);
+
+
+ Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_PLATFORM_APPROVE;
+ String info = "";
+ if(model.getValidTime()!=null && model.getValidTime().getTime()/1000!= param.getApplyStartTime().getTime()/1000){
+ info =applyLogType.getInfo();
+ info = info.replace("${param1}",DateUtil.getPlusTime2(model.getValidTime()));
+ info = info.replace("${param2}",DateUtil.getPlusTime2(param.getApplyStartTime()));
+ }
+ ApplyLog log = new ApplyLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(),JSONObject.toJSONString(model), JSONObject.toJSONString(update));
+ applyLogMapper.insert(log);
+
+ return 1;
+
+ }
+ @Override
+ @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+ public Integer editPidan(ApplyChange param) {
+ if(param.getId() == null
+ || param.getValidCode() == null
+ || param.getPidanFile() == null
+ || param.getCheckInfo() == null
+ ||StringUtils.isBlank( param.getPidanFile().getFileurl())
+ ||StringUtils.isBlank( param.getPidanFile() .getName())){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+
+ ApplyChange model = applyChangeMapper.selectById(param.getId());
+ if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ if(!Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.APPROVE.getKey())){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇峰綋鍓嶄笉鏀寔璇ユ搷浣渵");
+ }
+
+ LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ ApplyChange update = new ApplyChange();
+ update.setEditDate(new Date());
+ update.setEditor(user.getId());
+ update.setCheckDate(update.getEditDate());
+ update.setCheckInfo(param.getCheckInfo());
+ update.setCheckUserId(user.getId());
+ update.setId(model.getId());
+ update.setValidCode(param.getValidCode());
+ applyChangeMapper.updateById(update);
+ //鍒犻櫎鍘熸湁鐨勪繚鍗曚俊鎭�
+ multifileMapper.delete(new UpdateWrapper<Multifile>().lambda()
+ .set(Multifile::getIsdeleted,Constants.ZERO)
+ .eq(Multifile::getIsdeleted,Constants.ZERO)
+ .eq(Multifile::getObjId,update.getId())
+ .eq(Multifile::getObjType,Constants.MultiFile.CA_PD_PDF.getKey())
+ );
+ param.getPidanFile().setIsdeleted(Constants.ZERO);
+ param.getPidanFile().setObjId(update.getId());
+ param.getPidanFile().setCreator(user.getId());
+ param.getPidanFile().setCreateDate(update.getEditDate());
+ param.getPidanFile().setObjType(Constants.MultiFile.CA_PD_PDF.getKey());
+ param.getPidanFile().setType(Constants.TWO);
+ multifileMapper.insert(param.getPidanFile());
+
+ Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_PALTFORM_EDIT_PIDAN;
+ String info = applyLogType.getInfo();
+ info = info.replace("${param}",param.getCheckInfo());
+ ApplyLog log = new ApplyLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(),JSONObject.toJSONString(model), JSONObject.toJSONString(update));
+ applyLogMapper.insert(log);
+
+ return 1;
+
+ }
+
+ /**
+ * 澶勭悊鍔犲噺淇濇槑缁嗘暟鎹�
+ * @param update
+ * @param times
+ */
+ private void dealDetailsValidTime(ApplyChange update,long times) {
+ List<ApplyChagneDetail> detailList = applyChagneDetailJoinMapper.selectJoinList(ApplyChagneDetail.class,
+ new MPJLambdaWrapper<ApplyChagneDetail>()
+ .selectAll(ApplyChagneDetail.class)
+ .selectAs(Solutions::getTimeUnit,ApplyChagneDetail::getSolutionTimeUnit)
+ .selectAs(Solutions::getPrice,ApplyChagneDetail::getSolutionPrice)
+ .leftJoin(ApplyChange.class, ApplyChange::getId, ApplyChagneDetail::getApplyChangeId)
+ .leftJoin(Solutions.class, Solutions::getId, ApplyChange::getSolutionsId)
+ .eq(ApplyChagneDetail::getApplyChangeId,update.getId())
+ .eq(ApplyChagneDetail::getIsdeleted,Constants.ZERO) );
+ if(detailList ==null || detailList.size()==0){
+ return;
+ }
+ List<ApplyDetail> addList = new ArrayList<>();
+ List<Integer> reduceMembers = new ArrayList<>();
+ BigDecimal totalFee = new BigDecimal(0);
+ BigDecimal currentFee = new BigDecimal(0);
+
+ for(ApplyChagneDetail detail : detailList){
+ if(Constants.equalsInteger(detail.getType(),Constants.ZERO)){
+ //鍔犱繚
+ ApplyDetail add = new ApplyDetail();
+ add.setApplyId(update.getApplyId());
+ add.setValidCode(update.getValidCode());
+ add.setFee(detail.getFee());
+ add.setIsdeleted(Constants.ZERO);
+ add.setCreator(update.getEditor());
+ add.setCreateDate(update.getEditDate());
+ add.setMemberId(detail.getMemberId());
+ add.setMemberName(detail.getMemberName());
+ add.setWorktypeId(detail.getWorktypeId());
+ add.setDuId(detail.getDuId());
+ add.setStartTime(update.getApplyStartTime());
+ add.setEndTime(detail.getEndTime());
+ add.setFee(Constants.countDetailFee(detail.getSolutionTimeUnit(),detail.getSolutionPrice(), add.getStartTime(),add.getEndTime()));
+ if(DateUtil.daysBetweenDates(add.getStartTime(),new Date() )>=0){
+ //濡傛灉宸蹭骇鐢熻垂鐢紝璁$畻宸蹭骇鐢熻垂鐢�
+ add.setCurrentFee(Constants.countDetailFee(detail.getSolutionTimeUnit(),detail.getSolutionPrice(), add.getStartTime(),new Date()));
+ }
+ addList.add(add);
+ totalFee.add(add.getFee());
+ currentFee.add(add.getCurrentFee());
+ }else{
+ //鍑忎繚鎿嶄綔
+ //鏌ヨ鍛樺伐鏄湪涓诲崟涓� 鏄惁瀛樺湪鐢熸晥涓殑鏁版嵁
+ ApplyDetail oldModel = applyDetailJoinMapper.selectOne(new QueryWrapper<ApplyDetail>().lambda()
+ .eq(ApplyDetail::getApplyId, update.getApplyId())
+ .eq(ApplyDetail::getMemberId, detail.getMemberId())
+ .orderByDesc(ApplyDetail::getCreateDate)
+ .last("limit 1"));
+ if(oldModel == null || oldModel.getStartTime()==null || oldModel.getStartTime().getTime() > update.getApplyStartTime().getTime()){
+ throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鐢ㄦ埛銆�"+detail.getMemberName()+"銆戝師淇濆崟淇℃伅鏈夎锛屽綋鍓嶇敵璇蜂笉鏀寔鍑忎繚澶勭悊锛�");
+ }
+ BigDecimal updateFee = (Constants.countDetailFee(detail.getSolutionTimeUnit(),detail.getSolutionPrice(), oldModel.getStartTime(),update.getApplyStartTime()));
+ BigDecimal updateCurrentFee = new BigDecimal(0);
+ if(DateUtil.daysBetweenDates(update.getApplyStartTime(),new Date() )>0){
+ //濡傛灉鐢熸晥鏃堕棿 鏄粖澶╀箣鍓嶏紝閫�鍥炲凡浜х敓璐圭敤锛岃绠楀凡浜х敓璐圭敤(鎬昏垂鐢�-宸蹭骇鐢熻垂鐢�)
+ updateCurrentFee = updateFee.subtract(oldModel.getCurrentFee());
+ }
+ applyDetailJoinMapper.update(null, new UpdateWrapper<ApplyDetail>().lambda()
+ .setSql(" fee = ifnull(fee,0)+"+updateFee)
+ .setSql(" current_fee = "+updateFee)
+ .set(ApplyDetail::getEditor,update.getEditor())
+ .set(ApplyDetail::getEditDate,update.getEditDate())
+ .eq(ApplyDetail::getId,oldModel.getApplyId())
+ );
+ totalFee.add(updateFee);
+ currentFee.add(updateCurrentFee);
+
+ }
+ }
+ if(addList!=null && addList.size()>0){
+ applyChagneDetailJoinMapper.insertBatchSomeColumn(addList);
+ }
+ if(totalFee.compareTo(new BigDecimal(0)) != 0){
+ //濡傛灉淇濆崟閲戦鍙戠敓缂栫爜锛屾洿鏂版�讳繚鍗曢噾棰�
+ insuranceApplyMapper.update(null, new UpdateWrapper<InsuranceApply>().lambda()
+ .setSql(" fee = ifnull(fee,0)+"+totalFee)
+ .setSql(" current_fee = ifnull(current_fee,0)+"+currentFee)
+ .set(InsuranceApply::getEditor,update.getEditor())
+ .set(InsuranceApply::getEditDate,update.getEditDate())
+ .eq(InsuranceApply::getId,update.getApplyId())
+ );
+
+ }
+
+ }
+
/**
* 骞冲彴閫�鍥炴姇淇�
* @param param
@@ -129,28 +340,46 @@
if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
throw new BusinessException(ResponseStatus.DATA_EMPTY);
}
- if(Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey())
- ||Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.APPROVE.getKey())){
- //宸叉彁浜ゅ拰宸插畬鎴愮姸鎬佷笉鏀寔瀹℃牳涓嶉�氳繃
- throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
- }
+
LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ Constants.ApplyLogType applyLogType = null;
+ String info = "";
ApplyChange update = new ApplyChange();
+ if(param.getDealBackApply() ==1){
+ //濡傛灉鏄┏鍥�,鍙兘鍙┏鍥炲凡绛剧珷鐘舵�佷笅鐨勯��鍥炵敵璇风姸鎬佽繘琛屾搷浣�
+ if(!Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey())){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
+ }
+ applyLogType = Constants.ApplyLogType.CA_PALTFORM_REFUSE_APPLY;
+ info = applyLogType.getInfo();
+ info = info.replace("${param}", param.getCheckInfo());
+ update.setStatus(Constants.ApplyChangeStatus.SIGNATURE.getKey());
+ }else{
+ //濡傛灉鏄悓鎰�,涓ょ鐢宠閫�鍥炵姸鎬侀兘鍙搷浣�
+ if(!(Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey())
+ ||Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.RETURN_APPLY_UPLOAD.getKey()))){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
+ }
+ applyLogType = Constants.ApplyLogType.CA_PALTFORM_REFUSE_APPLY;
+ if( Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey())){
+ update.setStatus(Constants.ApplyChangeStatus.SIGNATURE.getKey());
+ }else if( Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.RETURN_APPLY_UPLOAD.getKey())){
+ update.setStatus(Constants.ApplyChangeStatus.UPLOAD.getKey());
+ }
+ }
update.setEditDate(new Date());
update.setEditor(user.getId());
- update.setStatus(Constants.ApplyChangeStatus.PALTFORM_CHECK_PASS_NO.getKey());
+ //鍚屾剰閫�鍥烇紝鐩存帴鍥炲埌鏈�鍒濈姸鎬侊紝濡傛灉椹冲洖閫�鍥炵敵璇凤紝鍒欎繚鍗曠姸鎬佸洖鍒板緟涓婁紶淇濋櫓鍗�
update.setCheckDate(update.getEditDate());
update.setCheckInfo(param.getCheckInfo());
update.setCheckUserId(user.getId());
update.setId(model.getId());
applyChangeMapper.updateById(update);
- Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_PLATFORM_CHECK_PASS_NO;
- String info =applyLogType.getInfo();
- info = info.replace("${param}", update.getCheckInfo());
- ApplyLog log = new ApplyLog(update,applyLogType.getName(),info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update));
+ ApplyLog log = new ApplyLog(update,applyLogType.getName(),info,update.getId(),applyLogType.getKey(),JSONObject.toJSONString(model), JSONObject.toJSONString(update));
applyLogMapper.insert(log);
return 1;
+
}
@@ -281,13 +510,12 @@
List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectList(new QueryWrapper<ApplyDetail>().lambda()
.eq(ApplyDetail::getApplyId, applyChange.getApplyId())
.eq(ApplyDetail::getMemberId, applyChagneDetail.getMemberId())
- .le(ApplyDetail::getStartTime, "now()")
- .ge(ApplyDetail::getEndTime, "now()"));
+ .orderByDesc(ApplyDetail::getCreateDate));
if (applyDetailList.size() > Constants.ONE) {
throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "鍑忎繚浜哄憳銆�" + applyChagneDetail.getMemberName() + "銆戜繚鍗曚俊鎭紓甯革紝瀛樺湪澶氭潯鏁版嵁");
}
ApplyDetail applyDetail = applyDetailList.get(Constants.ZERO);
- if (applyChange.getValidTime().compareTo(DateUtil.StringToDate(applyDetail.getEndTime())) <= 0) {
+ if (applyChange.getValidTime().compareTo(applyDetail.getEndTime()) <= 0) {
throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "鍑忎繚浜哄憳銆�" + applyChagneDetail.getMemberName() + "銆戜繚鍗曚繚闅滄棩鏈熻嚦锛氥��" + applyDetail.getEndTime() + "銆戞棤娉曢�氳繃鏈鐢宠");
}
applyChagneDetail.setCreateDate(new Date());
@@ -296,8 +524,8 @@
applyChagneDetail.setApplyChangeId(applyChange.getId());
applyChagneDetail.setType(Constants.ONE);
applyChagneDetail.setFee(
- Constants.countDetailFee(solutions,DateUtil.stringToDate(applyDetail.getEndTime(),"yyyy-MM-dd HH:mm:ss"),DateUtil.stringToDate(applyDetail.getStartTime(),"yyyy-MM-dd HH:mm:ss"))
- .subtract(Constants.countDetailFee(solutions,applyChange.getValidTime(),DateUtil.stringToDate(applyDetail.getStartTime(),"yyyy-MM-dd HH:mm:ss")))
+ Constants.countDetailFee(solutions, applyDetail.getEndTime(),applyDetail.getStartTime())
+ .subtract(Constants.countDetailFee(solutions,applyChange.getValidTime(), applyDetail.getStartTime()))
);
applyChagneDetailJoinMapper.insert(applyChagneDetail);
}
@@ -407,7 +635,7 @@
throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "鎹㈠巶浜哄憳銆�" + applyChagneDetail.getMemberName() + "銆戜繚鍗曚俊鎭紓甯革紝瀛樺湪澶氭潯鏁版嵁");
}
ApplyDetail applyDetail = applyDetailList.get(Constants.ZERO);
- if(applyChange.getValidTime().compareTo(DateUtil.StringToDate(applyDetail.getEndTime()))<=0){
+ if(applyChange.getValidTime().compareTo( applyDetail.getEndTime())<=0){
throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "鎹㈠巶浜哄憳銆�" + applyChagneDetail.getMemberName() + "銆戜繚鍗曚繚闅滄棩鏈熻嚦锛氥��"+applyDetail.getEndTime()+"銆戞棤娉曢�氳繃鏈鐢宠");
}
//楠岃瘉娲鹃仯鍗曚綅淇℃伅 涓庡伐绉嶄俊鎭� 鏄惁瀛樺湪
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
index 760d0d0..3e0c4ff 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
@@ -128,9 +128,11 @@
if(!Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.SIGNATURE.getKey())){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
}
- if(insuranceApply.getApplyEndTime()== null || insuranceApply.getStartTime().getTime()>insuranceApply.getApplyEndTime().getTime() ){
+ if(model.getApplyEndTime()== null || insuranceApply.getStartTime().getTime()>insuranceApply.getApplyEndTime().getTime() ){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风敓鏁堝懆鏈熸椂闂翠笉绗﹀悎瑕佹眰锛岃纭鍚庝慨鏀归噸璇晘");
}
+ //璁$畻瀹為檯鎴鏃堕棿
+ Date actEndTime = new Date(insuranceApply.getApplyEndTime().getTime() + (insuranceApply.getStartTime().getTime() - model.getApplyStartTime().getTime()));
LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
InsuranceApply update = new InsuranceApply();
update.setEditDate(new Date());
@@ -141,12 +143,13 @@
update.setCheckUserId(user.getId());
update.setId(model.getId());
update.setCode(insuranceApply.getCode());
- update.setEndTime(model.getApplyEndTime());
+ update.setEndTime(actEndTime);
update.setStartTime(insuranceApply.getStartTime());
insuranceApplyMapper.updateById(update);
insuranceApply.getBaoxiandanFile().setIsdeleted(Constants.ZERO);
insuranceApply.getBaoxiandanFile().setCreator(user.getId());
+ insuranceApply.getToubaodanFile().setObjId(update.getId());
insuranceApply.getBaoxiandanFile().setCreateDate(update.getEditDate());
insuranceApply.getBaoxiandanFile().setObjType(Constants.MultiFile.BD_DONE_PDF.getKey());
insuranceApply.getBaoxiandanFile().setType(Constants.TWO);
@@ -162,6 +165,60 @@
}
ApplyLog log = new ApplyLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(),JSONObject.toJSONString(model), JSONObject.toJSONString(update));
applyLogMapper.insert(log);
+ return 1;
+
+ }
+ @Override
+ @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+ public Integer editBaoxiandan(InsuranceApply param) {
+ if(param.getId() == null
+ || param.getCode() == null
+ || param.getBaoxiandanFile() == null
+ || param.getCheckInfo() == null
+ ||StringUtils.isBlank( param.getBaoxiandanFile().getFileurl())
+ ||StringUtils.isBlank( param.getBaoxiandanFile() .getName())){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+
+ InsuranceApply model = insuranceApplyMapper.selectById(param.getId());
+ if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ if(!Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey())){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇峰綋鍓嶄笉鏀寔璇ユ搷浣渵");
+ }
+
+ LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ InsuranceApply update = new InsuranceApply();
+ update.setEditDate(new Date());
+ update.setEditor(user.getId());
+ update.setCheckDate(update.getEditDate());
+ update.setCheckInfo(param.getCheckInfo());
+ update.setCheckUserId(user.getId());
+ update.setId(model.getId());
+ update.setCode(param.getCode());
+ insuranceApplyMapper.updateById(update);
+ //鍒犻櫎鍘熸湁鐨勪繚鍗曚俊鎭�
+ multifileMapper.delete(new UpdateWrapper<Multifile>().lambda()
+ .set(Multifile::getIsdeleted,Constants.ZERO)
+ .eq(Multifile::getIsdeleted,Constants.ZERO)
+ .eq(Multifile::getObjId,update.getId())
+ .eq(Multifile::getObjType,Constants.MultiFile.BD_DONE_PDF.getKey())
+ );
+ param.getBaoxiandanFile().setIsdeleted(Constants.ZERO);
+ param.getBaoxiandanFile().setObjId(update.getId());
+ param.getBaoxiandanFile().setCreator(user.getId());
+ param.getBaoxiandanFile().setCreateDate(update.getEditDate());
+ param.getBaoxiandanFile().setObjType(Constants.MultiFile.BD_DONE_PDF.getKey());
+ param.getBaoxiandanFile().setType(Constants.TWO);
+ multifileMapper.insert(param.getBaoxiandanFile());
+
+ Constants.ApplyLogType applyLogType = Constants.ApplyLogType.PALTFORM_EDIT_BD;
+ String info = applyLogType.getInfo();
+ info = info.replace("${param}",param.getCheckInfo());
+ ApplyLog log = new ApplyLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(),JSONObject.toJSONString(model), JSONObject.toJSONString(update));
+ applyLogMapper.insert(log);
+
return 1;
}
@@ -208,8 +265,6 @@
}
update.setEditDate(new Date());
update.setEditor(user.getId());
- //鍚屾剰閫�鍥烇紝鐩存帴鍥炲埌鏈�鍒濈姸鎬侊紝濡傛灉椹冲洖閫�鍥炵敵璇凤紝鍒欎繚鍗曠姸鎬佸洖鍒板緟涓婁紶淇濋櫓鍗�
- update.setStatus(insuranceApply.getDealBackApply() ==0?Constants.InsuranceApplyStatus.UPLOAD.getKey():Constants.InsuranceApplyStatus.SIGNATURE.getKey());
update.setCheckDate(update.getEditDate());
update.setCheckInfo(insuranceApply.getCheckInfo());
update.setCheckUserId(user.getId());
@@ -252,6 +307,7 @@
insuranceApply.getToubaodanFile().setIsdeleted(Constants.ZERO);
insuranceApply.getToubaodanFile().setCreator(user.getId());
+ insuranceApply.getToubaodanFile().setObjId(update.getId());
insuranceApply.getToubaodanFile().setCreateDate(update.getEditDate());
insuranceApply.getToubaodanFile().setObjType(Constants.MultiFile.BD_APPLY_PDF.getKey());
insuranceApply.getToubaodanFile().setType(Constants.TWO);
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java
index 8f35fa4..62e836d 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java
@@ -209,27 +209,43 @@
if(model==null || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
throw new BusinessException(ResponseStatus.DATA_EMPTY);
}
- //鏌ヨ鏄庣粏鍒楄〃
- List<TaxDetial> detialList = getJoinDetailListById(id);
- List<TaxDetial> applyList = new ArrayList<>();//鎶曚繚鍜屽姞鍑忎繚
- List<TaxDetial> delList = new ArrayList<>();//鍐茬孩鍗�
- if(detialList!=null){
- for(TaxDetial d :delList){
- d.setSolutionName(model.getSolutionName());
- d.setFee(Constants.formatBigdecimal(d.getFee()));
- d.setTotalFee(Constants.formatBigdecimal(d.getTotalFee()));
- if(Constants.equalsInteger(d.getType(),Constants.ZERO) || Constants.equalsInteger(d.getType(),Constants.ONE)){
- applyList.add(d);
- }else if(Constants.equalsInteger(d.getType(),Constants.TWO)){
- delList.add(d);
+ if(Constants.equalsInteger(model.getType(),Constants.ZERO)){
+ List<TaxDetial> detialList = getDetailsApplysListById(id);
+ model.setApplyList(detialList);
+ }else{
+ //鏌ヨ鏄庣粏鍒楄〃
+ List<TaxDetial> detialList = getJoinDetailListById(id);
+ List<TaxDetial> applyList = new ArrayList<>();//鎶曚繚鍜屽姞鍑忎繚
+ List<TaxDetial> delList = new ArrayList<>();//鍐茬孩鍗�
+ if(detialList!=null){
+ for(TaxDetial d :delList){
+ d.setSolutionName(model.getSolutionName());
+ d.setFee(Constants.formatBigdecimal(d.getFee()));
+ d.setTotalFee(Constants.formatBigdecimal(d.getTotalFee()));
+ if(Constants.equalsInteger(d.getType(),Constants.ZERO) || Constants.equalsInteger(d.getType(),Constants.ONE)){
+ applyList.add(d);
+ }else if(Constants.equalsInteger(d.getType(),Constants.TWO)){
+ delList.add(d);
+ }
}
}
+ model.setApplyList(applyList);
+ model.setDelTaxList(delList);
}
- model.setApplyList(applyList);
- model.setDelTaxList(delList);
return model;
}
+ private List<TaxDetial> getDetailsApplysListById(Integer id) {
+ MPJLambdaWrapper<TaxDetial> queryWrapper = new MPJLambdaWrapper<>();
+ queryWrapper.selectAll(TaxDetial.class);
+ queryWrapper.selectAs(InsuranceApply::getCode,TaxDetial::getApplyCode);
+ queryWrapper.selectAs(Solutions::getName,TaxDetial::getSolutionName);
+ queryWrapper.leftJoin(InsuranceApply.class,InsuranceApply::getId,TaxDetial::getInsuranceApplyId);
+ queryWrapper.leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId);
+ List<TaxDetial> detialList = taxDetailJoinMapper.selectJoinList(TaxDetial.class,queryWrapper.orderByAsc(TaxDetial::getType));
+ return detialList;
+ }
+
@Override
public Taxes findOne(Taxes taxes) {
QueryWrapper<Taxes> wrapper = new QueryWrapper<>(taxes);
--
Gitblit v1.9.3