From 5db66ef6fb108de06df182189d822f3f5ebdd557 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 23 一月 2024 16:52:53 +0800
Subject: [PATCH] 开发业务接口
---
server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java | 50 +++++
server/service/src/main/java/com/doumee/dao/business/model/SettleClaims.java | 3
server/service/src/main/java/com/doumee/service/business/SettleClaimsService.java | 17 +
server/platform/src/main/java/com/doumee/api/business/SettleClaimsController.java | 52 +++++
server/service/src/main/java/com/doumee/dao/business/model/ApplyLog.java | 4
server/service/src/main/java/com/doumee/core/utils/Constants.java | 58 +++++
server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java | 328 ++++++++++++++++++++++++++++++++++++
server/service/src/main/java/com/doumee/dao/business/model/SettleClaimsLog.java | 12 +
8 files changed, 504 insertions(+), 20 deletions(-)
diff --git a/server/platform/src/main/java/com/doumee/api/business/SettleClaimsController.java b/server/platform/src/main/java/com/doumee/api/business/SettleClaimsController.java
index fb2f5fa..548de7a 100644
--- a/server/platform/src/main/java/com/doumee/api/business/SettleClaimsController.java
+++ b/server/platform/src/main/java/com/doumee/api/business/SettleClaimsController.java
@@ -3,6 +3,8 @@
import com.doumee.api.BaseController;
import com.doumee.core.annotation.excel.ExcelExporter;
import com.doumee.core.annotation.pr.PreventRepeat;
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.ApiResponse;
import com.doumee.core.model.PageWrap;
import com.doumee.core.model.PageData;
@@ -37,7 +39,51 @@
public ApiResponse create(@RequestBody SettleClaims settleClaims) {
return ApiResponse.success(settleClaimsService.create(settleClaims));
}
-
+ @ApiOperation("娣诲姞鎶ユ鍙�")
+ @PostMapping("/addCode")
+ @RequiresPermissions("business:settleclaims:addCode")
+ public ApiResponse addCode(@RequestBody SettleClaims settleClaims) {
+ return ApiResponse.success(settleClaimsService.addCode(settleClaims));
+ }
+ @ApiOperation("鐞嗚禂澶勭悊")
+ @PostMapping("/dealBiz")
+ @RequiresPermissions("business:settleclaims:dealBiz")
+ public ApiResponse dealBiz(@RequestBody SettleClaims settleClaims) {
+ return ApiResponse.success(settleClaimsService.dealBiz(settleClaims));
+ }
+ @ApiOperation("缁撴鎻愪氦")
+ @PostMapping("/doneCommit")
+ @RequiresPermissions("business:settleclaims:doneCommit")
+ public ApiResponse doneCommit(@RequestBody SettleClaims settleClaims) {
+ return ApiResponse.success(settleClaimsService.doneCommit(settleClaims));
+ }
+ @ApiOperation("鎾ら攢鐢宠")
+ @PostMapping("/back")
+ @RequiresPermissions("business:settleclaims:back")
+ public ApiResponse back(@RequestBody SettleClaims settleClaims) {
+ return ApiResponse.success(settleClaimsService.back(settleClaims));
+ }
+ @ApiOperation("澶囨敞鏍囩")
+ @PostMapping("/remark")
+ @RequiresPermissions("business:settleclaims:remark")
+ public ApiResponse remark(@RequestBody SettleClaims settleClaims) {
+ return ApiResponse.success(settleClaimsService.remark(settleClaims));
+ }
+ @ApiOperation("璧勬枡纭")
+ @PostMapping("/confirm")
+ @RequiresPermissions("business:settleclaims:confirm")
+ public ApiResponse confirm(@RequestBody SettleClaims settleClaims) {
+ return ApiResponse.success(settleClaimsService.confirm(settleClaims));
+ }
+ @ApiOperation("璧勬枡涓嬭浇")
+ @PostMapping("/exportFiles")
+ @RequiresPermissions("business:locks:exportExcel")
+ public void exportExcel(@RequestParam Integer id,HttpServletResponse response) {
+ if(id == null){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ settleClaimsService.exportFiles(id,response);
+ }
@ApiOperation("鏍规嵁ID鍒犻櫎")
@GetMapping("/delete/{id}")
@RequiresPermissions("business:settleclaims:delete")
@@ -84,7 +130,7 @@
@ApiOperation("鏍规嵁ID鏌ヨ")
@GetMapping("/{id}")
@RequiresPermissions("business:settleclaims:query")
- public ApiResponse findById(@PathVariable Integer id) {
- return ApiResponse.success(settleClaimsService.findById(id));
+ public ApiResponse<SettleClaims> findById(@PathVariable Integer id) {
+ return ApiResponse.success(settleClaimsService.getSettleClaimsDetail(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 d80f3b3..4fdef25 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
@@ -7,7 +7,11 @@
import org.apache.commons.lang3.StringUtils;
import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.math.BigDecimal;
+import java.net.URL;
import java.net.URLDecoder;
import java.util.*;
import java.util.Date;
@@ -844,8 +848,9 @@
public enum SettleClaimsStatus {
WAIT_ACCEPTANCE(0, "寰呭彈鐞�"),
RETURN_ACCEPTANCE(1, "閫�鍥炲彈鐞�"),
- CONFIRM_INFORMATION(2, "纭璧勬枡"),
- FINISH_ACCEPTANCE(3, "瀹屾垚鍙楃悊"),
+ DEAL_ING(2, "鍙楃悊涓�"),
+ CONFIRM_INFORMATION(3, "纭璧勬枡"),
+ FINISH_ACCEPTANCE(4, "瀹屾垚鍙楃悊"),
;
// 鎴愬憳鍙橀噺
private String name;
@@ -888,15 +893,15 @@
public enum SettleClaimsLogType {
UPLOAD(0, "鎻愪氦鎶ユ","鎻愪氦鎰忚锛�${param}"),
PLATFORM_RETURN(1, "骞冲彴閫�鍥�","鎻愪氦鎰忚锛�${param}"),
- CONFIRM_INFORMATION(2, "骞冲彴纭璧勬枡","鎻愪氦鎰忚锛�${param}"),
+ PLATFORM_CONFIRM_INFORMATION(2, "骞冲彴纭璧勬枡",""),
PLATFORM_FINISH(3, "骞冲彴瀹屾垚鍙楃悊","鎻愪氦鎰忚锛�${param}"),
UPDATE_DATA(4, "淇敼淇℃伅","鎻愪氦鎰忚锛�${param}"),
SUPPLEMENT(5, "琛ュ厖璇存槑","鎻愪氦鎰忚锛�${param}"),
- COMPANY_APPLY_RETURN(6, "骞冲彴鐞嗚禂澶勭悊","鎻愪氦鎰忚锛�${param}"),
- COMPANY_APPLY_CLOSE(7, "骞冲彴澶囨敞鏍囩",""),
- PLATFORM_AGREE_BACK(8, "骞冲彴娣诲姞鎶ユ鍙�",""),
+ PLATFORM_LP_DEAL(6, "骞冲彴鐞嗚禂澶勭悊","鎻愪氦鎰忚锛�${param}"),
+ PLATFORM_REMARK(7, "骞冲彴澶囨敞鏍囩",""),
+ PLATFORM_ADDCODE(8, "骞冲彴娣诲姞鎶ユ鍙�",""),
PLATFORM_UN_AGREE_BACK(9, "浼佷笟涓嬭浇璧勬枡",""),
- COMPANY_EDIT(10, "骞冲彴涓嬭浇璧勬枡",""),
+ PLATFORM_DOWNLOAD(10, "骞冲彴涓嬭浇璧勬枡",""),
PLATFORM_CHECK_PASS(11, "骞冲彴涓婁紶璧勬枡",""),
;
// 鎴愬憳鍙橀噺
@@ -1208,4 +1213,43 @@
this.des = des;
}
}
+
+ public static File getFileByNetFile(String url,String fileName) {
+ //瀵规湰鍦版枃浠跺懡鍚�
+ File file = null;
+ try {
+ URL urlfile;
+ InputStream inStream = null;
+ OutputStream os = null;
+ try {
+ file = File.createTempFile("", fileName);
+ //涓嬭浇
+ urlfile = new URL(url);
+ inStream = urlfile.openStream();
+ os = new FileOutputStream(file);
+ int bytesRead = 0;
+ byte[] buffer = new byte[8192];
+ while ((bytesRead = inStream.read(buffer, 0, 8192)) != -1) {
+ os.write(buffer, 0, bytesRead);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ if (null != os) {
+ os.close();
+ }
+ if (null != inStream) {
+ inStream.close();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }catch (Exception e){
+
+ }
+
+ return file;
+ }
}
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/ApplyLog.java b/server/service/src/main/java/com/doumee/dao/business/model/ApplyLog.java
index 8b8f1fe..9f8389c 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/ApplyLog.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/ApplyLog.java
@@ -28,7 +28,7 @@
this.content=content;
this.applyId = apply.getId();
this.createDate =apply.getEditDate();
- this.editor =apply.getEditor();
+ this.creator =apply.getEditor();
this.status = apply.getStatus();
this.objId=objId;
this.objType = objType;
@@ -40,7 +40,7 @@
this.content=content;
this.applyId = apply.getId();
this.createDate =apply.getEditDate();
- this.editor =apply.getEditor();
+ this.creator =apply.getEditor();
this.status = apply.getStatus();
this.objId=objId;
this.objType = objType;
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/SettleClaims.java b/server/service/src/main/java/com/doumee/dao/business/model/SettleClaims.java
index 430055a..1687cae 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/SettleClaims.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/SettleClaims.java
@@ -90,7 +90,10 @@
@ApiModelProperty(value = "璐圭敤", example = "1")
@ExcelColumn(name="璐圭敤")
private BigDecimal fee;
+ @ApiModelProperty(value = "瀹℃牳鏃堕棿")
+ @ExcelColumn(name="瀹℃牳鏃堕棿")
+ private Date checkDate;
@ApiModelProperty(value = "鏈�杩戞搷浣滃娉�")
@ExcelColumn(name="鏈�杩戞搷浣滃娉�")
private String checkInfo;
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/SettleClaimsLog.java b/server/service/src/main/java/com/doumee/dao/business/model/SettleClaimsLog.java
index f03388e..d7f3458 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/SettleClaimsLog.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/SettleClaimsLog.java
@@ -20,7 +20,19 @@
@ApiModel("鐞嗚碃鎿嶄綔鍘嗗彶琛�")
@TableName("`settle_claims_log`")
public class SettleClaimsLog {
+ public SettleClaimsLog(){
+ }
+ public SettleClaimsLog(SettleClaims apply,String title,String content,Integer objId,Integer objType, String before,String after){
+ this.title =title;
+ this.content=content;
+ this.createDate =apply.getEditDate();
+ this.creator =apply.getEditor();
+ this.objId=objId;
+ this.objType = objType;
+ this.beforeContent=before;
+ this.afterContent=after;
+ }
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "涓婚敭", example = "1")
@ExcelColumn(name="涓婚敭")
diff --git a/server/service/src/main/java/com/doumee/service/business/SettleClaimsService.java b/server/service/src/main/java/com/doumee/service/business/SettleClaimsService.java
index 26a06f6..4845671 100644
--- a/server/service/src/main/java/com/doumee/service/business/SettleClaimsService.java
+++ b/server/service/src/main/java/com/doumee/service/business/SettleClaimsService.java
@@ -4,6 +4,9 @@
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.dto.SCSupplementDTO;
import com.doumee.dao.business.model.SettleClaims;
+import io.swagger.models.auth.In;
+
+import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@@ -111,4 +114,18 @@
long count(SettleClaims settleClaims);
SettleClaims getSettleClaimsDetail(Integer id);
+
+ void exportFiles(Integer id, HttpServletResponse response);
+
+ Integer addCode(SettleClaims settleClaims);
+
+ Integer dealBiz(SettleClaims settleClaims);
+
+ Integer doneCommit(SettleClaims settleClaims);
+
+ Integer remark(SettleClaims settleClaims);
+
+ Integer confirm(SettleClaims settleClaims);
+
+ Integer back(SettleClaims settleClaims);
}
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 3b4aaf7..0203ee3 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
@@ -158,9 +158,13 @@
multifileMapper.insert(param.getPidanFile());
update.setApplyId(model.getApplyId());
- long times = param.getApplyStartTime().getTime() - model.getValidTime().getTime();
- //澶勭悊鍔犲噺淇濇槑缁嗘暟鎹�
- dealDetailsValidTime(update,times);
+ if(Constants.equalsInteger(model.getType(),Constants.ZERO)){
+ //濡傛灉鏄姞鍑忎繚鐢宠 澶勭悊鍔犲噺淇濇槑缁嗘暟鎹�
+ dealDetailsValidTime(update);
+ }else{
+ //濡傛灉鏄崲鍘傜敵璇� 澶勭悊鏄庣粏鏁版嵁
+ dealDetailsDUdata(update);
+ }
Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_PLATFORM_APPROVE;
@@ -234,9 +238,45 @@
/**
* 澶勭悊鍔犲噺淇濇槑缁嗘暟鎹�
* @param update
- * @param times
*/
- private void dealDetailsValidTime(ApplyChange update,long times) {
+ private void dealDetailsDUdata(ApplyChange update ) {
+ 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;
+ }
+ for(ApplyChagneDetail detail : detailList){
+ //鏌ヨ鍛樺伐鏄湪涓诲崟涓� 鏄惁瀛樺湪鐢熸晥涓殑鏁版嵁
+ 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 ){
+ throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鐢ㄦ埛銆�"+detail.getMemberName()+"銆戝師淇濆崟淇℃伅鏈夎锛屽綋鍓嶇敵璇蜂笉鏀寔鍑忎繚澶勭悊锛�");
+ }
+ applyDetailJoinMapper.update(null, new UpdateWrapper<ApplyDetail>().lambda()
+ .set(ApplyDetail::getEditor,update.getEditor())
+ .set(ApplyDetail::getWorktypeId,detail.getWorktypeId())
+ .set(ApplyDetail::getDuId,detail.getDuId())
+ .set(ApplyDetail::getEditDate,update.getEditDate())
+ .eq(ApplyDetail::getId,oldModel.getApplyId())
+ );
+
+ }
+ }
+ /**
+ * 澶勭悊鍔犲噺淇濇槑缁嗘暟鎹�
+ * @param update
+ */
+ private void dealDetailsValidTime(ApplyChange update ) {
List<ApplyChagneDetail> detailList = applyChagneDetailJoinMapper.selectJoinList(ApplyChagneDetail.class,
new MPJLambdaWrapper<ApplyChagneDetail>()
.selectAll(ApplyChagneDetail.class)
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java
index dd31f43..af31cda 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java
@@ -1,5 +1,8 @@
package com.doumee.service.business.impl;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.LoginUserInfo;
@@ -22,13 +25,20 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.core.util.CollectionUtils;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
+import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
+import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -44,6 +54,8 @@
@Autowired
private SettleClaimsLogMapper settleClaimsLogMapper;
+ @Autowired
+ private SystemDictDataBiz systemDictDataBiz;
@Autowired
private MultifileMapper multifileMapper;
@@ -54,6 +66,246 @@
@Autowired
private SettleClaimsLogJoinMapper settleClaimsLogJoinMapper;
+ /**
+ * 閫�鍥炵敵璇�
+ * @param param
+ * @return
+ */
+ @Override
+ public Integer back(SettleClaims param){
+ if(param.getId() == null
+ ||StringUtils.isBlank( param.getCheckInfo()) ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+
+ SettleClaims model = settleClaimsMapper.selectById(param.getId());
+ if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+
+ if((Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.RETURN_ACCEPTANCE.getKey())
+ ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.FINISH_ACCEPTANCE.getKey()))){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇峰綋鍓嶄笉鏀寔璇ユ搷浣渵");
+ }
+
+ LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ SettleClaims update = new SettleClaims();
+ 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.setStatus(Constants.SettleClaimsStatus.RETURN_ACCEPTANCE.getKey());
+ settleClaimsMapper.updateById(update);
+
+ Constants.SettleClaimsLogType applyLogType = Constants.SettleClaimsLogType.PLATFORM_RETURN;
+ String info =applyLogType.getInfo();
+ info = info.replace("${param}", update.getCheckInfo());
+ SettleClaimsLog log = new SettleClaimsLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update));
+ settleClaimsLogMapper.insert(log);
+ return 1;
+
+ }
+ /**
+ * 璧勬枡纭
+ * @param param
+ * @return
+ */
+ @Override
+ public Integer confirm(SettleClaims param){
+ if(param.getId() == null
+ ||StringUtils.isBlank( param.getCheckInfo()) ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+
+ SettleClaims model = settleClaimsMapper.selectById(param.getId());
+ if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+
+ if(!(Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.DEAL_ING.getKey()))){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇峰綋鍓嶄笉鏀寔璇ユ搷浣渵");
+ }
+
+ LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ SettleClaims update = new SettleClaims();
+ 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.setStatus(Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey());
+ settleClaimsMapper.updateById(update);
+
+ Constants.SettleClaimsLogType applyLogType = Constants.SettleClaimsLogType.PLATFORM_CONFIRM_INFORMATION;
+ String info =applyLogType.getInfo();
+ info = info.replace("${param}", update.getCheckInfo());
+ SettleClaimsLog log = new SettleClaimsLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update));
+ settleClaimsLogMapper.insert(log);
+ return 1;
+
+ }
+ /**
+ * 鐞嗚禂缁撴鎻愪氦
+ * @param param
+ * @return
+ */
+ @Override
+ public Integer remark(SettleClaims param){
+ if(param.getId() == null
+ ||StringUtils.isBlank( param.getCheckInfo()) ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+
+ SettleClaims model = settleClaimsMapper.selectById(param.getId());
+ if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ /*
+ if(!(Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.DEAL_ING.getKey())
+ ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey()))){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇峰綋鍓嶄笉鏀寔璇ユ搷浣渵");
+ }
+*/
+ LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ SettleClaims update = new SettleClaims();
+ update.setEditDate(new Date());
+ update.setEditor(user.getId());
+ update.setCheckDate(update.getEditDate());
+ update.setCheckInfo(param.getCheckInfo());
+ update.setCheckUserId(user.getId());
+ update.setId(model.getId());
+ settleClaimsMapper.updateById(update);
+
+ Constants.SettleClaimsLogType applyLogType = Constants.SettleClaimsLogType.PLATFORM_REMARK;
+ String info =applyLogType.getInfo();
+ info = info.replace("${param}", update.getCheckInfo());
+ SettleClaimsLog log = new SettleClaimsLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update));
+ settleClaimsLogMapper.insert(log);
+ return 1;
+
+ }
+ /**
+ * 鐞嗚禂缁撴鎻愪氦
+ * @param param
+ * @return
+ */
+ @Override
+ public Integer doneCommit(SettleClaims param){
+ if(param.getId() == null
+ ||StringUtils.isBlank( param.getCheckInfo()) ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+
+ SettleClaims model = settleClaimsMapper.selectById(param.getId());
+ if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ //鍙楃悊涓拰宸茬‘璁よ祫鏂欏彲浠ヨ繘琛岀悊璧斿鐞�
+ if(!(Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.DEAL_ING.getKey())
+ ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey()))){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇峰綋鍓嶄笉鏀寔璇ユ搷浣渵");
+ }
+
+ LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ SettleClaims update = new SettleClaims();
+ update.setEditDate(new Date());
+ update.setEditor(user.getId());
+ update.setCheckDate(update.getEditDate());
+ update.setCheckInfo(param.getCheckInfo());
+ update.setCheckUserId(user.getId());
+ update.setStatus(Constants.SettleClaimsStatus.FINISH_ACCEPTANCE.getKey());
+ update.setId(model.getId());
+ settleClaimsMapper.updateById(update);
+
+ Constants.SettleClaimsLogType applyLogType = Constants.SettleClaimsLogType.PLATFORM_FINISH;
+ String info =applyLogType.getInfo();
+ info = info.replace("${param}", update.getCheckInfo());
+ SettleClaimsLog log = new SettleClaimsLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update));
+ settleClaimsLogMapper.insert(log);
+ return 1;
+
+ }
+ /**
+ * 鐞嗚禂澶勭悊
+ * @param param
+ * @return
+ */
+ @Override
+ public Integer dealBiz(SettleClaims param){
+ if(param.getId() == null
+ ||StringUtils.isBlank( param.getCheckInfo()) ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+
+ SettleClaims model = settleClaimsMapper.selectById(param.getId());
+ if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ //鍙楃悊涓拰宸茬‘璁よ祫鏂欏彲浠ヨ繘琛岀悊璧斿鐞�
+ if(!(Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.DEAL_ING.getKey())
+ ||Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey()))){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇峰綋鍓嶄笉鏀寔璇ユ搷浣渵");
+ }
+
+ LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ SettleClaims update = new SettleClaims();
+ update.setEditDate(new Date());
+ update.setEditor(user.getId());
+ update.setCheckDate(update.getEditDate());
+ update.setCheckInfo(param.getCheckInfo());
+ update.setCheckUserId(user.getId());
+ update.setId(model.getId());
+ settleClaimsMapper.updateById(update);
+
+ Constants.SettleClaimsLogType applyLogType = Constants.SettleClaimsLogType.PLATFORM_LP_DEAL;
+ String info =applyLogType.getInfo();
+ info = info.replace("${param}", update.getCheckInfo());
+ SettleClaimsLog log = new SettleClaimsLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update));
+ settleClaimsLogMapper.insert(log);
+ return 1;
+
+ }
+ /**
+ * 娣诲姞澶囨鍙�
+ * @param param
+ * @return
+ */
+ @Override
+ public Integer addCode(SettleClaims param){
+ if(param.getId() == null
+ ||StringUtils.isBlank( param.getCode()) ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+
+ SettleClaims model = settleClaimsMapper.selectById(param.getId());
+ if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ if(!Constants.equalsInteger(model.getStatus(),Constants.SettleClaimsStatus.WAIT_ACCEPTANCE.getKey())){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇峰綋鍓嶄笉鏀寔璇ユ搷浣渵");
+ }
+
+ LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ SettleClaims update = new SettleClaims();
+ update.setEditDate(new Date());
+ update.setEditor(user.getId());
+ update.setCheckDate(update.getEditDate());
+ update.setCheckInfo("娣诲姞澶囨鍙�");
+ update.setCheckUserId(user.getId());
+ update.setId(model.getId());
+ update.setStatus(Constants.SettleClaimsStatus.DEAL_ING.getKey());
+ update.setCode(param.getCode());
+ settleClaimsMapper.updateById(update);
+
+ Constants.SettleClaimsLogType applyLogType = Constants.SettleClaimsLogType.PLATFORM_ADDCODE;
+ SettleClaimsLog log = new SettleClaimsLog(update,applyLogType.getName(), null,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update));
+ settleClaimsLogMapper.insert(log);
+ return 1;
+
+ }
@Override
public Integer create(SettleClaims settleClaims) {
LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
@@ -113,6 +365,76 @@
return settleClaims.getId();
}
+ @Override
+ public void exportFiles(Integer id, HttpServletResponse response) {
+ try {
+ SettleClaims model = settleClaimsMapper.selectById(id);
+ if(model == null){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+ SettleClaims update = new SettleClaims();
+ update.setEditDate(new Date());
+ update.setEditor(loginUserInfo.getId());
+ Constants.SettleClaimsLogType applyLogType = Constants.SettleClaimsLogType.PLATFORM_DOWNLOAD;
+ String info =applyLogType.getInfo();
+ SettleClaimsLog log = new SettleClaimsLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(), JSONObject.toJSONString(model), JSONObject.toJSONString(update));
+ settleClaimsLogMapper.insert(log);
+
+ List<File> fileList = new ArrayList<>();
+ List<Multifile> multifileList = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda()
+ .eq(Multifile::getObjId,id)
+ .isNotNull(Multifile::getFileurl)
+ .in(Multifile::getObjType, Arrays.asList(new Integer[]{
+ Constants.MultiFile.LP_YGGX_FILE.getKey(),
+ Constants.MultiFile.LP_MZCL_FILE.getKey(),
+ Constants.MultiFile.LP_ZYCL_FILE.getKey(),
+ Constants.MultiFile.LP_SCZL_FILE.getKey(),
+ Constants.MultiFile.LP_JACL_FILE.getKey(),
+ }))
+ );
+ if(multifileList== null || multifileList.size() == 0){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+systemDictDataBiz.queryByCode(Constants.OSS,Constants.SETTLE_FILE).getCode();
+ for(Multifile l : multifileList){
+ File f = Constants.getFileByNetFile(path + l.getFileurl(),StringUtils.defaultString(l.getName(),"鏈懡鍚�"));
+ if(f !=null && f.isFile()){
+ fileList.add(f);
+ }
+ }
+ if(fileList == null || fileList.size() == 0){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY);
+ }
+ String fileName = model.getInformantName() +"鐞嗚禂璧勬枡涓媉"+System.currentTimeMillis()+".zip" ;
+ String encodeFileName = URLEncoder.encode(fileName);
+ response.setHeader("Content-Disposition","attachment;filename=" + encodeFileName);
+ response.setContentType("application/octet-stream");
+ response.setHeader("eva-opera-type", "download");
+ response.setHeader("eva-download-filename", encodeFileName);
+ packFilesToZip(fileList,response.getOutputStream());
+ } catch (IOException e) {
+ throw new BusinessException(ResponseStatus.EXPORT_EXCEL_ERROR, e);
+ }
+ }
+
+
+ public static void packFilesToZip(List<File> files, ServletOutputStream os) throws IOException {
+ try (ZipArchiveOutputStream zipOutputStream = new ZipArchiveOutputStream(os)) {
+ for (File file : files) {
+ ZipArchiveEntry entry = new ZipArchiveEntry(file.getName());
+ zipOutputStream.putArchiveEntry(entry);
+ try (FileInputStream fileInputStream = new FileInputStream(file)) {
+ byte[] buffer = new byte[1024];
+ int length;
+ while ((length = fileInputStream.read(buffer)) > 0) {
+ zipOutputStream.write(buffer, 0, length);
+ }
+ }
+ zipOutputStream.closeArchiveEntry();
+ }
+ }
+ }
@Override
public SettleClaims getSettleClaimsDetail(Integer id){
--
Gitblit v1.9.3