Commit 0fbc0caa by huluobin

update

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