Commit 0fbc0caa by huluobin

update

parent 4ecf37c4
...@@ -358,7 +358,7 @@ public class CostController { ...@@ -358,7 +358,7 @@ public class CostController {
return resp; return resp;
} }
@PostMapping("/exportList") @PostMapping("/list/exportList")
public String exportList(HttpServletResponse response, HttpServletRequest request) { public String exportList(HttpServletResponse response, HttpServletRequest request) {
Enumeration<String> parameterNames = request.getParameterNames(); Enumeration<String> parameterNames = request.getParameterNames();
if (null != parameterNames && parameterNames.hasMoreElements()) { if (null != parameterNames && parameterNames.hasMoreElements()) {
...@@ -372,7 +372,7 @@ public class CostController { ...@@ -372,7 +372,7 @@ public class CostController {
return null; return null;
} }
@PostMapping("/exportListAll") @PostMapping("/list/exportListAll")
public String exportListAll(HttpServletResponse response, HttpServletRequest request) { public String exportListAll(HttpServletResponse response, HttpServletRequest request) {
CostService costService = CostServiceFactory.getCostService(); CostService costService = CostServiceFactory.getCostService();
...@@ -400,7 +400,7 @@ public class CostController { ...@@ -400,7 +400,7 @@ public class CostController {
return null; return null;
} }
@GetMapping("download") @GetMapping("list/download")
public ResponseEntity<InputStreamResource> download(HttpServletRequest request, HttpServletResponse response) throws IOException { public ResponseEntity<InputStreamResource> download(HttpServletRequest request, HttpServletResponse response) throws IOException {
String pathNo = request.getParameter("pathNo"); String pathNo = request.getParameter("pathNo");
CostExpDomain exp = costExportService.getByExpNo(pathNo); CostExpDomain exp = costExportService.getByExpNo(pathNo);
...@@ -422,7 +422,7 @@ public class CostController { ...@@ -422,7 +422,7 @@ public class CostController {
.body(new InputStreamResource(file.getInputStream())); .body(new InputStreamResource(file.getInputStream()));
} }
@GetMapping("downloadCashierAnnex") @GetMapping("list/downloadCashierAnnex")
public ResponseEntity<InputStreamResource> downCashierAnnex(HttpServletRequest request, HttpServletResponse response) throws IOException { public ResponseEntity<InputStreamResource> downCashierAnnex(HttpServletRequest request, HttpServletResponse response) throws IOException {
......
...@@ -3,6 +3,7 @@ package com.blt.other.module.cost.model; ...@@ -3,6 +3,7 @@ package com.blt.other.module.cost.model;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -65,9 +66,12 @@ public class CostTemplate implements Serializable { ...@@ -65,9 +66,12 @@ public class CostTemplate implements Serializable {
private Integer createUserId; private Integer createUserId;
private String createUserName; private String createUserName;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty(value = "更新时间") @ApiModelProperty(value = "更新时间")
private LocalDateTime lastUpdateTime; private LocalDateTime lastUpdateTime;
...@@ -79,23 +83,33 @@ public class CostTemplate implements Serializable { ...@@ -79,23 +83,33 @@ public class CostTemplate implements Serializable {
private List<CostTemplateCol> costTemplateColList; private List<CostTemplateCol> costTemplateColList;
public boolean shouldDepartmentAutoCheck() { public boolean shouldDepartmentAutoCheck(CostDomain cost) {
return enableAutoReview && enableDepartmentReview && !isDefault; return enableAutoReview && enableDepartmentReview && !isDefault &&
!cost.getCompanyName().contains("工会");
} }
public boolean shouldFinancialAutoCheck() { public boolean shouldFinancialAutoCheck(CostDomain cost) {
return enableAutoReview && enableFinancialAutoReview && !isDefault; return enableAutoReview && enableFinancialAutoReview && !isDefault &&
!cost.getCompanyName().contains("工会");
} }
public boolean shouldFinalAutoCheck() { public boolean shouldFinalAutoCheck(CostDomain cost) {
return enableAutoReview && enableFinalReview && !isDefault; return enableAutoReview && enableFinalReview && !isDefault &&
!cost.getCompanyName().contains("工会");
} }
public boolean shouldFinalCheck(BigDecimal amount) { public boolean shouldFinalCheck(CostDomain cost) {
return finalMinimumReviewAmount.compareTo(BigDecimal.ZERO) > 0 && amount.compareTo(finalMinimumReviewAmount) >= 0; BigDecimal amount = cost.getAmount();
return finalMinimumReviewAmount.compareTo(BigDecimal.ZERO) > 0 &&
amount.compareTo(finalMinimumReviewAmount) >= 0 &&
!cost.getCompanyName().contains("工会");
} }
public boolean shouldDepartmentCheck(BigDecimal amount, BigDecimal departmentMinimumReviewAmount) { public boolean shouldDepartmentCheck(CostDomain cost, BigDecimal departmentMinimumReviewAmount) {
return departmentMinimumReviewAmount.compareTo(BigDecimal.ZERO) > 0 && amount.compareTo(departmentMinimumReviewAmount) >= 0; BigDecimal amount = cost.getAmount();
return departmentMinimumReviewAmount.compareTo(BigDecimal.ZERO) > 0 &&
amount.compareTo(departmentMinimumReviewAmount) >= 0 &&
!cost.getCompanyName().contains("工会");
} }
} }
...@@ -6,9 +6,10 @@ import com.blt.other.module.database.model.CostExpDomain; ...@@ -6,9 +6,10 @@ import com.blt.other.module.database.model.CostExpDomain;
import java.util.List; import java.util.List;
public interface CostExportService { public interface CostExportService {
String exportFees(List<String> exportNos); String exportFees(List<String> exportNos);
CostExpDomain saveRecord(CostExportVo costExportVo,String filePath); CostExpDomain saveRecord(CostExportVo costExportVo, String filePath);
String createExpNo(); String createExpNo();
......
...@@ -2,10 +2,10 @@ package com.blt.other.module.cost.service.impl.costcheck; ...@@ -2,10 +2,10 @@ package com.blt.other.module.cost.service.impl.costcheck;
import com.blt.other.common.exception.BizRuntimeException; import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.module.auth.dao.OaDepartmentMapper; import com.blt.other.module.auth.dao.OaDepartmentMapper;
import com.blt.other.module.auth.dao.OaUserMapper;
import com.blt.other.module.auth.model.CostReviewer; import com.blt.other.module.auth.model.CostReviewer;
import com.blt.other.module.auth.model.OaDepartment; import com.blt.other.module.auth.model.OaDepartment;
import com.blt.other.module.auth.model.OaUser; import com.blt.other.module.auth.model.OaUser;
import com.blt.other.module.auth.service.IOaUserService;
import com.blt.other.module.cost.model.CostDomain; import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.model.CostTemplate; import com.blt.other.module.cost.model.CostTemplate;
import com.blt.other.module.database.model.CostLogDomain; import com.blt.other.module.database.model.CostLogDomain;
...@@ -31,7 +31,7 @@ public class DepartmentCheckState extends CostState { ...@@ -31,7 +31,7 @@ public class DepartmentCheckState extends CostState {
@Resource @Resource
OaDepartmentMapper oaDepartmentMapper; OaDepartmentMapper oaDepartmentMapper;
@Resource @Resource
IOaUserService oaUserService; OaUserMapper oaUserMapper;
@Override @Override
public void handle() { public void handle() {
...@@ -44,25 +44,11 @@ public class DepartmentCheckState extends CostState { ...@@ -44,25 +44,11 @@ public class DepartmentCheckState extends CostState {
throw new BizRuntimeException("invalid status"); throw new BizRuntimeException("invalid status");
} }
//如果是默认模版 不需要部门审核
if (costTemplate.getIsDefault()) {
costDomain.setCostStatus(CostDomain.STATUS_FINANCIAL_CHECK);
costDao.updateById(costDomain);
//流转状态
nextState(financialCheckState);
costSubscribe.subscribe(costContext);
costLogService.saveByManage(costDomain.getCostNo(), "部门审核自动通过", CostLogDomain.DEPARTMENT_AUTO_PASS);
return;
}
//如果不需要审核 直接通过 //如果不需要审核 直接通过
OaUser oaUser = oaUserService.getById(currentUserId); if (costContext.currentUserId != null) {
OaUser oaUser = oaUserMapper.selectByOaUserId(currentUserId);
OaDepartment oaDepartment = oaDepartmentMapper.selectByDepartmentId(oaUser.getPrimaryDepartmentId()); OaDepartment oaDepartment = oaDepartmentMapper.selectByDepartmentId(oaUser.getPrimaryDepartmentId());
if (costTemplate.shouldDepartmentCheck(costDomain.getAmount(),oaDepartment.getDepartmentMinimumReviewAmount())) { if (costTemplate.shouldDepartmentCheck(costDomain, oaDepartment.getDepartmentMinimumReviewAmount())) {
costDomain.setCostStatus(CostDomain.STATUS_FINANCIAL_CHECK); costDomain.setCostStatus(CostDomain.STATUS_FINANCIAL_CHECK);
costDao.updateById(costDomain); costDao.updateById(costDomain);
...@@ -75,10 +61,11 @@ public class DepartmentCheckState extends CostState { ...@@ -75,10 +61,11 @@ public class DepartmentCheckState extends CostState {
return; return;
} }
}
//需要自动审核 //需要自动审核
if (costTemplate.shouldDepartmentAutoCheck()) { if (costTemplate.shouldDepartmentAutoCheck(costDomain)) {
//自动审核通过 //自动审核通过
if (this.autoCheck(costDomain)) { if (this.autoCheck(costDomain)) {
costDomain.setCostStatus(CostDomain.STATUS_FINANCIAL_CHECK); costDomain.setCostStatus(CostDomain.STATUS_FINANCIAL_CHECK);
......
...@@ -43,22 +43,8 @@ public class FinalCheckState extends CostState { ...@@ -43,22 +43,8 @@ public class FinalCheckState extends CostState {
throw new BizRuntimeException("invalid status"); throw new BizRuntimeException("invalid status");
} }
//如果是默认模版 不需要最终审核 //如果不需要审核 并且主体不是工会 直接通过
if (costTemplate.getIsDefault()) { if (!costTemplate.shouldFinalCheck(costDomain)) {
costDomain.setCostStatus(CostDomain.STATUS_UN_PAY);
costDao.updateById(costDomain);
costLogService.saveByManage(costDomain.getCostNo(), "最终审核自动通过", CostLogDomain.DEPARTMENT_AUTO_PASS);
//流转状态
nextState(unPayState);
//通知财务系统
costContext.costService.toFinancial(costDomain);
return;
}
//如果不需要审核 直接通过
if (!costTemplate.shouldFinalCheck(costDomain.getAmount())) {
costDomain.setCostStatus(CostDomain.STATUS_UN_PAY); costDomain.setCostStatus(CostDomain.STATUS_UN_PAY);
costDao.updateById(costDomain); costDao.updateById(costDomain);
costLogService.saveByManage(costDomain.getCostNo(), "最终审核自动通过", null); costLogService.saveByManage(costDomain.getCostNo(), "最终审核自动通过", null);
...@@ -69,7 +55,7 @@ public class FinalCheckState extends CostState { ...@@ -69,7 +55,7 @@ public class FinalCheckState extends CostState {
} }
//需要自动审核 //需要自动审核
if (costTemplate.shouldFinalAutoCheck()) { if (costTemplate.shouldFinalAutoCheck(costDomain)) {
//自动审核通过 //自动审核通过
if (this.autoCheck(costDomain)) { if (this.autoCheck(costDomain)) {
costDomain.setCostStatus(CostDomain.STATUS_UN_PAY); costDomain.setCostStatus(CostDomain.STATUS_UN_PAY);
......
...@@ -45,7 +45,7 @@ public class FinancialCheckState extends CostState { ...@@ -45,7 +45,7 @@ public class FinancialCheckState extends CostState {
} }
//需要自动审核 //需要自动审核
if (costTemplate.shouldFinancialAutoCheck()) { if (costTemplate.shouldFinancialAutoCheck(costDomain)) {
//自动审核通过 //自动审核通过
if (this.autoCheck(costDomain)) { if (this.autoCheck(costDomain)) {
costDomain.setCostStatus(CostDomain.STATUS_FINAL_CHECK); costDomain.setCostStatus(CostDomain.STATUS_FINAL_CHECK);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment