Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bailuntec-cost
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huluobin
bailuntec-cost
Commits
556d3d98
Commit
556d3d98
authored
Oct 30, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
38ea3157
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
729 additions
and
647 deletions
+729
-647
CostCheckController.java
...ther/module/cost/controller/cost/CostCheckController.java
+568
-568
CostController.java
...blt/other/module/cost/controller/cost/CostController.java
+1
-1
CostService.java
...n/java/com/blt/other/module/cost/service/CostService.java
+9
-1
AbstractCostService.java
...er/module/cost/service/impl/cost/AbstractCostService.java
+9
-63
CostSubscribe.java
...lt/other/module/cost/service/impl/cost/CostSubscribe.java
+1
-1
PayCostServiceImpl.java
...her/module/cost/service/impl/cost/PayCostServiceImpl.java
+6
-0
CostContext.java
...other/module/cost/service/impl/costcheck/CostContext.java
+3
-6
DepartmentCheckState.java
...ule/cost/service/impl/costcheck/DepartmentCheckState.java
+7
-3
FinalCheckState.java
...r/module/cost/service/impl/costcheck/FinalCheckState.java
+67
-1
FinancialCheckState.java
...dule/cost/service/impl/costcheck/FinancialCheckState.java
+57
-0
PayedState.java
.../other/module/cost/service/impl/costcheck/PayedState.java
+0
-2
UnSubmitState.java
...her/module/cost/service/impl/costcheck/UnSubmitState.java
+1
-1
No files found.
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/controller/cost/CostCheckController.java
View file @
556d3d98
//
package com.blt.other.module.cost.controller.cost;
//
//
import com.alibaba.fastjson.JSON;
//
import com.bailuntec.cost.api.dto.CostDto;
//
import com.blt.other.common.util.AxiosUtil;
//
import com.blt.other.common.util.CurUtils;
//
import com.blt.other.common.util.IpUtil;
//
import com.blt.other.module.cost.dto.CostCheckApiDto;
//
import com.blt.other.module.cost.model.CostDomain;
//
import com.blt.other.module.cost.service.*;
//
import com.blt.other.module.cost.vo.ApplyCallbackUrlVo;
//
import com.blt.other.module.cost.vo.ApplyCallbackVo;
//
import com.blt.other.module.cost.vo.ApplyMoneyDetail;
//
import com.blt.other.module.cost.vo.CashierCallbackUrlVo;
//
import com.blt.other.module.database.model.CostApplycallbackDomain;
//
import com.blt.other.module.database.model.CostCashiercallbackDomain;
//
import com.blt.other.module.database.model.CostCompanyDomain;
//
import com.blt.other.module.database.model.CostTofinanceDomain;
//
import com.fasterxml.jackson.databind.ObjectMapper;
//
import io.swagger.annotations.Api;
//
import io.swagger.annotations.ApiOperation;
//
import org.slf4j.Logger;
//
import org.slf4j.LoggerFactory;
//
import org.springframework.beans.BeanUtils;
//
import org.springframework.beans.factory.annotation.Autowired;
//
import org.springframework.beans.factory.annotation.Value;
//
import org.springframework.core.io.FileSystemResource;
//
import org.springframework.core.io.InputStreamResource;
//
import org.springframework.http.HttpEntity;
//
import org.springframework.http.HttpHeaders;
//
import org.springframework.http.MediaType;
//
import org.springframework.http.ResponseEntity;
//
import org.springframework.util.LinkedMultiValueMap;
//
import org.springframework.util.MultiValueMap;
//
import org.springframework.web.bind.annotation.*;
//
import org.springframework.web.client.RestTemplate;
//
//
import javax.servlet.http.HttpServletRequest;
//
import javax.servlet.http.HttpServletResponse;
//
import java.io.BufferedReader;
//
import java.io.IOException;
//
import java.io.InputStreamReader;
//
import java.math.BigDecimal;
//
import java.util.*;
//
//
@Api(tags = "费用审核接口")
//
@RestController
//
@RequestMapping("cost/check")
//
public class CostCheckController {
//
//
private static Logger logger = LoggerFactory.getLogger(CostCheckController.class);
//
//
@Autowired
//
private CostService costService;
//
@Autowired
//
private CostCompanyService costCompanyService;
//
@Autowired
//
private RestTemplate restTemplate;
//
@Autowired
//
private CostTofinanceService costTofinanceService;
//
@Autowired
//
private CostApplycallbackService costApplycallbackService;
//
@Autowired
//
private CostCashiercallbackService costCashiercallbackService;
//
@Autowired
//
private CostLogService costLogService;
//
//
@Value("${url.api.postApplyApi}")
//
private String postApplyApi;
//
//
@Value("${url.my.costApplyCallbackUrlPost}")
//
private String costApplyCallbackUrlPost;
//
//
@Value("${url.my.costCashierCallbackUrlPost}")
//
private String costCashierCallbackUrlPost;
//
//
@Value("${url.my.lendCostApplyCallBackUrlPost}")
//
private String lendCostApplyCallBackUrlPost;
//
//
@Value("${url.my.lendCostCashierCallbackUrlPost}")
//
private String lendCostCashierCallbackUrlPost;
//
//
@Value("${url.api.getExchangeRateApi}")
//
private String getExchangeRateApi;
//
//
//
@ApiOperation("获取财务审核系统费用单列表")
//
@GetMapping("getCostCheckList")
//
public CostCheckApiDto.GetCostCheckListResp getCostCheckList(@RequestParam Integer pageNum,
//
@RequestParam Integer pageSize,
//
@RequestParam Integer costStatus) {
//
return costService.getCostByStatus(pageNum, pageSize, costStatus);
//
}
//
//
//
@ApiOperation("审核通过")
//
@PostMapping("pass")
//
public Map<String, Object> pass(@RequestParam String costNo,
//
@RequestParam Integer updateuserid) {
//
//
Integer costStatus = costService.getCostStatusByNo(costNo);
//
/**
//
* 吴通新增
//
* 如果是支付状态, 就不准改
//
*/
//
if (null != costStatus && costStatus.equals(4)) {
//
map = new HashMap<>();
//
map.put("msg", "error");
//
map.put("result", 0);
//
map.put("finance", false);
//
costLogService.save(costNo, Integer.parseInt(updateuserid), "尝试修改已支付费用单,被拦截");
//
return map;
//
}
//
//
costLogService.save(costNo, Integer.parseInt(updateuserid), "费用系统财务审核通过");
//
//
// 审核通过,自动提交到出纳付款
//
boolean toFinance = tofinanceMethod(costNo);
//
if (toFinance) {
//
costLogService.save(costNo, Integer.parseInt(updateuserid), "出纳自动审核通过");
//
map = changeStatus(costNo, 2);
//
} else {
//
costLogService.save(costNo, Integer.parseInt(updateuserid), "出纳审核失败");
//
map = new HashMap<>();
//
}
//
map.put("finance", toFinance);
//
return map;
//
}
//
//
@ApiOperation("驳回审核")
//
@PostMapping("reject")
//
public Map<String, Object> reject(HttpServletRequest request, HttpServletResponse response) {
//
AxiosUtil.setCors(response, request);
//
//
String costNo = request.getParameter("costNo");
//
String rejectReason = request.getParameter("rejectReason");
//
String updateuserid = request.getParameter("updateuserid");
//
CostDomain costDomain = new CostDomain();
//
costDomain.setCostNo(costNo);
//
costDomain.setRejectReason(rejectReason);
//
costDomain.setRejectTime(new Date());
//
Map<String, Object> stringObjectMap = costService.updateCost(costDomain);
//
Map<String, Object> map = changeStatus(costNo, 3);
//
costLogService.save(costNo, Integer.parseInt(updateuserid), "费用系统财务审核驳回:" + rejectReason);
//
//
return map;
//
}
//
//
//
@ApiOperation("财务审核回调接口")
//
@PostMapping(value = "ApplyCallbackUrl", consumes = "application/json")
//
public String applyCallbackUrl(HttpServletRequest request) {
//
String result = null;
//
String line = null;
//
try {
//
BufferedReader br = new BufferedReader(new InputStreamReader(request.getInputStream()));
//
line = br.readLine();
//
} catch (IOException e) {
//
logger.error(IpUtil.getIpAddr(request) + " CostApplyCallbackUrl " + " 费用系统财务审核反馈信息获取失败");
//
result = "{result:false,msg:\"发生错误\"}";
//
return result;
//
}
//
line = line.replace("\\", "");
//
// 格式化为标准 json 格式
//
int data = line.lastIndexOf("Data");
//
int id = line.lastIndexOf("id");
//
String substring1 = line.substring(0, data + 6);
//
String substring2 = line.substring(data + 7, id - 4);
//
String substring3 = line.substring(id - 3);
//
line = substring1 + substring2 + substring3;
//
line = line.toLowerCase();
//
//
//保存为 bean,并且将反馈信息保存到数据库
//
ObjectMapper mapper = new ObjectMapper();
//
ApplyCallbackUrlVo applyCallbackUrlVo = null;
//
try {
//
applyCallbackUrlVo = mapper.readValue(line, ApplyCallbackUrlVo.class);
//
if (null == applyCallbackUrlVo) {
//
logger.error("保存财务审核信息发生错误:" + line);
//
result = "{result:false,msg:\"发生错误\"}";
//
return result;
//
}
//
// 执行保存反馈信息流程
//
CostApplycallbackDomain applycallbackDomain = new CostApplycallbackDomain();
//
BeanUtils.copyProperties(applyCallbackUrlVo.getData().getData(), applycallbackDomain);
//
String costNo = applyCallbackUrlVo.getId().toUpperCase();
//
if (costNo.contains("-")) {
//
costNo = costNo.split("-")[0];
//
}
//
applycallbackDomain.setCostNo(costNo);
//
applycallbackDomain.setMessage(applyCallbackUrlVo.getData().getMessage().toUpperCase());
//
applycallbackDomain.setApplyno(applycallbackDomain.getApplyno().toUpperCase());
//
Integer integer = costApplycallbackService.saveApplycallbackResponse(applycallbackDomain);
//
logger.warn("保存财务审核信息成功:" + integer + " " + line);
//
} catch (IOException e) {
//
logger.error("保存财务审核信息发生错误:" + line);
//
result = "{result:false,msg:\"发生错误\"}";
//
return result;
//
}
//
result = "{result:true,msg:\"\"}";
//
return result;
//
}
//
//
@ApiOperation("财务付款回调接口")
//
@PostMapping(value = "CashierCallbackUrl", consumes = "application/json")
//
public String cashierCallbackUrl(HttpServletRequest request) {
//
String result;
//
//
// 将状态改为审核通过、已付款
//
logger.warn("费用系统出纳回调" + IpUtil.getIpAddr(request) + " CashierCallbackUrl ");
//
//
String line;
//
try {
//
BufferedReader br = new BufferedReader(new InputStreamReader(request.getInputStream()));
//
line = br.readLine();
//
line = line.replace("\\", "");
//
//
// 格式化为标准 json 格式
//
int data = line.lastIndexOf("Data");
//
int id = line.lastIndexOf("id");
//
String substring1 = line.substring(0, data + 6);
//
String substring2 = line.substring(data + 7, id - 4);
//
String substring3 = line.substring(id - 3);
//
line = substring1 + substring2 + substring3;
//
line = line.toLowerCase();
//
line = line.replace("_", "");
//
logger.warn("费用系统支付反馈信息:" + line);
//
//
ObjectMapper mapper = new ObjectMapper();
//
CashierCallbackUrlVo cashierCallbackUrlVo = null;
//
CostCashiercallbackDomain costCashiercallbackDomain = new CostCashiercallbackDomain();check/lend/CashierCallbackUrl
//
BigDecimal toRmbRate = null; // 转人民币汇率
//
try {
//
cashierCallbackUrlVo = mapper.readValue(line, CashierCallbackUrlVo.class);
//
if (cashierCallbackUrlVo == null) {
//
logger.error("费用系统保存出纳付款信息发生错误:" + line);
//
result = "{result:false,msg:\"发生错误\"}";
//
return result;
//
}
//
BeanUtils.copyProperties(cashierCallbackUrlVo.getData(), costCashiercallbackDomain);
//
BeanUtils.copyProperties(cashierCallbackUrlVo.getData().getData(), costCashiercallbackDomain);
//
BeanUtils.copyProperties(cashierCallbackUrlVo.getData().getData().getPaydetail(), costCashiercallbackDomain);
//
String costNo = cashierCallbackUrlVo.getId().toUpperCase();
//
if (costNo.contains("-")) {
//
String[] split = costNo.split("-");
//
costNo = split[0];
//
}
//
costCashiercallbackDomain.setCostNo(costNo);
//
costCashiercallbackDomain.setMessage(costCashiercallbackDomain.getMessage().toUpperCase());
//
costCashiercallbackDomain.setPayno(costCashiercallbackDomain.getPayno().toUpperCase());
//
//
// 被出纳驳回
//
if (costCashiercallbackDomain.getMessage().contains("被驳回")) {
//
boolean b = finansysReject(costCashiercallbackDomain);
//
if (b) {
//
logger.info("出纳驳回,费用单状态更改成功" + costCashiercallbackDomain);
//
costLogService.save(costNo, costCashiercallbackDomain.getPayuserid(), "被出纳驳回:" + costCashiercallbackDomain.getPaynote());
//
} else {
//
logger.info("出纳驳回,费用单状态更改失败" + costCashiercallbackDomain);
//
}
//
result = "{result:true,msg:\"出纳驳回\"}";
//
return result;
//
} else {
//
// 获取xx货币-->CNY的汇率
//
toRmbRate = CurUtils.getCur(costCashiercallbackDomain.getCashierunitcode().toUpperCase(), "CNY", getExchangeRateApi);
//
costCashiercallbackDomain.setToRmbRate(toRmbRate);
//
}
//
//
// 保存出纳付款记录
//
Integer integer = costCashiercallbackService.saveCostCashiercallbackResponse(costCashiercallbackDomain);
//
logger.warn("保存出纳付款信息成功:" + integer + " " + costCashiercallbackDomain);
//
} catch (IOException e) {
//
logger.error("保存出纳付款信息发生错误:" + line);
//
result = "{result:false,msg:\"发生错误\"}";
//
return result;
//
}
//
// 付款成功,更改费用单信息,否则返回失败
//
CostDomain costDomain = costService.getCostDomainByNo(costCashiercallbackDomain.getCostNo());
//
costDomain.setCostStatus(4);
//
//
if (null != costDomain.getIsLend()) {
//
if (costDomain.getIsLend() == 1 && BigDecimal.ZERO.compareTo(costDomain.getHadPay()) >= 0) {
//
costDomain.setLendStatus(1);
//
}
//
}
//
//
costDomain.setPayUserId(costCashiercallbackDomain.getPayuserid());
//
costDomain.setPayTime(new Date());
//
costDomain.setAmountRmb(costCashiercallbackDomain.getCashierpaymoneyrmb());
//
costDomain.setToRmbRate(toRmbRate);
//
Map<String, Object> map = costService.updateCost(costDomain);
//
//
if (null != map) {
//
result = "{result:true,msg:\"保存成功\"}";
//
costLogService.save(costCashiercallbackDomain.getCostNo(), costCashiercallbackDomain.getPayuserid(), "出纳收/付款成功:" + costCashiercallbackDomain.getPaynote());
//
} else {
//
result = "{result:false,msg:\"发生错误\"}";
//
}
//
} catch (IOException e) {
//
logger.error(IpUtil.getIpAddr(request) + " CashierCallbackUrl " + " 出纳付款反馈信息获取失败");
//
result = "{result:false,msg:\"发生错误\"}";
//
return result;
//
}
//
return result;
//
}
//
//
/**
//
* 出纳驳回
//
*
//
* @param domain
//
* @return
//
*/
//
private boolean finansysReject(CostCashiercallbackDomain domain) {
//
// 保存驳回信息
//
Integer integer = costCashiercallbackService.saveCostCashiercallbackResponse(domain);
//
if (null != integer && integer >= 1) {
//
// 费用单状态改为审核驳回,添加驳回理由
//
// 修复驳回后提交出现费用单已存在的问题
//
// 将后缀添加到 detail_key 字段
//
CostDomain oldCost = costService.getByNo(domain.getCostNo());
//
String oldDetailKey = oldCost.getDetailKey();
//
CostDomain costDomain = new CostDomain();
//
costDomain.setId(oldCost.getId());
//
if (null != oldDetailKey && oldDetailKey.contains("-")) {
//
String[] split = oldDetailKey.split("-");
//
if (split.length > 1) {
//
int i = Integer.parseInt(split[1]) + 1;
//
costDomain.setDetailKey(split[0] + "-" + i);
//
}
//
} else {
//
costDomain.setDetailKey(oldCost.getCostNo() + "-" + 1);
//
}
//
costDomain.setRejectReason(domain.getPaynote());
//
costDomain.setCostStatus(3);
//
costDomain.setRejectType(2);
//
Integer result = costService.updateById(costDomain);
//
}
//
return true;
//
}
//
//
/**
//
* 改变费用单状态
//
*
//
* @param costNo
//
* @param costStatus
//
* @return
//
*/
//
private Map<String, Object> changeStatus(String costNo, Integer costStatus) {
//
CostDomain costDomain = costService.getCostDomainByNo(costNo);
//
costDomain.setCostNo(costNo);
//
costDomain.setCostStatus(costStatus);
//
if (costStatus == 2) {
//
costDomain.setAuditTime(new Date());
//
}
//
if (null != costDomain.getIsLend()) {
//
if (1 == costDomain.getIsLend() && 4 == costStatus) {
//
costDomain.setLendStatus(1);
//
}
//
}
//
Map<String, Object> map = costService.updateCost(costDomain);
//
//
return map;
//
//
}
//
//
/**
//
* 提交出纳系统
//
*
//
* @param costNo
//
* @return
//
*/
//
public boolean tofinanceMethod(String costNo) {
//
// 获取费用单信息
//
List<ApplyMoneyDetail> applyMoneyDetailList = new ArrayList<>();
//
ApplyMoneyDetail applyMoneyDetail = new ApplyMoneyDetail();
//
CostDomain cost = costService.getCostDomainByNo(costNo);
//
//
CostCompanyDomain companyByCompanyNo = costCompanyService.getCompanyByCompanyNo(cost.getCompanyNo());
//
//
// 提交财务
//
MultiValueMap<String, Object> requestEntity = new LinkedMultiValueMap<>();
//
//
requestEntity.add("CompanyMainName", cost.getCompanyName()); // 公司主体(CompanyMainName)不可为空;
//
// 借支单补差额的付款单,单独设置回调地址;
//
requestEntity.add("Title", cost.getCostNo());
//
if (costNo.startsWith("S")) {
//
logger.info("补差额的付款单:" + costNo);
//
applyMoneyDetail.setName("借支单补差额");
//
requestEntity.add("ApplyCallbackUrl", lendCostApplyCallBackUrlPost); // 审核回调地址(ApplyCallbackUrl)不可为空;
//
requestEntity.add("CashierCallbackUrl", lendCostCashierCallbackUrlPost); // 出纳回调地址(CashierCallbackUrl)不可为空;
//
//
} else {
//
requestEntity.add("ApplyCallbackUrl", costApplyCallbackUrlPost); // 审核回调地址(ApplyCallbackUrl)不可为空;
//
requestEntity.add("CashierCallbackUrl", costCashierCallbackUrlPost); // 出纳回调地址(CashierCallbackUrl)不可为空;
//
}
//
requestEntity.add("UnitCode", cost.getDic()); // 币种编号(UnitCode)不可为空;
//
requestEntity.add("UnitName", cost.getDic()); // 币种名称(UnitName)不可为空;
//
// 交易对象改为付款/收款单位
//
requestEntity.add("TradeObjectID", companyByCompanyNo.getValue() + "");
//
requestEntity.add("TradeObjectName", cost.getBankCompany() + ""); // 交易对象(TradeObjectID/TradeObjectName)不可为空;
//
requestEntity.add("BankNameto", "" + cost.getBankName());
//
requestEntity.add("BankCardto", "" + cost.getBankCard());
//
requestEntity.add("BankCardUserto", "" + cost.getBankCardUser()); // 交易对象账户(BankNameto/BankCardto/BankCardUserto)资料不完整;
//
requestEntity.add("SourceCode", "newCost");
//
requestEntity.add("SourceTypeCode", "newCostType"); // newOtherPurchase申请来源(SourceCode/SourceTypeCode)不可为空;
//
// 账期 0 PayDay
//
requestEntity.add("PayDay", 0);
//
// 预计付款时间 ExpectPayTime
//
requestEntity.add("ExpectPayTime", new Date());
//
//
applyMoneyDetail.setMoney(cost.getAmount());
//
applyMoneyDetail.setMoneyRmb(cost.getAmount());
//
//
if (1 == cost.getCostForm()) {
//
requestEntity.add("ApplyType", "" + 1); // 申请类型(ApplyType)不存在;申请类型:1#付款;2#收款;3#无需付款;
//
applyMoneyDetail.setName("费用单付款");
//
} else if (2 == cost.getCostForm()) {
//
requestEntity.add("ApplyType", "" + 2); // 申请类型(ApplyType)不存在;申请类型:1#付款;2#收款;3#无需付款;
//
applyMoneyDetail.setName("费用单收款");
//
} else if (3 == cost.getCostForm() && 1 == cost.getIsLend()) {
//
requestEntity.add("ApplyType", "" + 1); // 申请类型(ApplyType)不存在;申请类型:1#付款;2#收款;3#无需付款;
//
applyMoneyDetail.setName("借支单付款");
//
}
//
requestEntity.add("UserAcctID", "" + cost.getCreateUserid());
//
requestEntity.add("UserAcctName", "" + cost.getCreateUsername()); // 申请人(UserAcctID/UserAcctName)不存在;
//
//
applyMoneyDetail.setRemark("");
//
applyMoneyDetailList.add(applyMoneyDetail);
//
//
requestEntity.add("MoneyDetail", applyMoneyDetailList); // 出纳申请金额明细(MoneyDetail)不可为空;
//
//
// 设置 detailKey
//
String detailKey = cost.getDetailKey();
//
if (null == detailKey || !detailKey.contains("F")) {
//
detailKey = cost.getCostNo();
//
}
//
requestEntity.add("DetailKey", detailKey); // 回调必要的key参数(DetailKey)不能为空;
//
// 吴通 增加费用大类
//
requestEntity.add("TypeName", cost.getTypeName());
//
Map<String, Object> map = requestEntity.toSingleValueMap();
//
String s = JSON.toJSONString(map);
//
logger.info(cost.getCostNo() + " 费用单提交财务审核信息:" + s);
//
HttpHeaders headers = new HttpHeaders();
//
headers.setContentType(MediaType.APPLICATION_JSON);
//
//
HttpEntity<String> entity = new HttpEntity<>(s, headers);
//
ResponseEntity<String> response = restTemplate.postForEntity(postApplyApi, entity, String.class);
//
logger.info(cost.getCostNo() + " 费用单提交审核反馈信息:" + response);
//
//
String strBody = null;
//
if (response.getStatusCodeValue() == 200) {
//
strBody = response.getBody();
//
strBody = strBody.replace("\\", "");
//
strBody = strBody.toLowerCase();
//
if (strBody.contains("申请单已存在")) {
//
logger.info(cost.getCostNo() + " 申请单已存在:" + strBody);
//
return true;
//
} else if (strBody.contains("创建")) {
//
// 将 strBody 保存到数据库 costTofinance 表
//
ObjectMapper mapper = new ObjectMapper();
//
try {
//
// 将 strBody 转作为标准 JSONString 格式
//
int i = strBody.lastIndexOf("data\":");
//
String substring1 = strBody.substring(0, i + 6);
//
String substring2 = strBody.substring(i + 7, strBody.length() - 2);
//
strBody = substring1 + substring2 + "}";
//
logger.warn(strBody);
//
ApplyCallbackVo applyCallbackVo = mapper.readValue(strBody, ApplyCallbackVo.class);
//
//
// 将反馈信息保存到数据库
//
if (null != applyCallbackVo && applyCallbackVo.isSuccess()) {
//
CostTofinanceDomain costTofinanceDomain = new CostTofinanceDomain();
//
BeanUtils.copyProperties(applyCallbackVo.getData(), costTofinanceDomain);
//
costTofinanceDomain.setCostNo(cost.getCostNo().toUpperCase());
//
costTofinanceDomain.setCode(costTofinanceDomain.getCode().toUpperCase());
//
// 执行 insert 流程
//
Integer integer = costTofinanceService.saveCostTofinanceMsg(costTofinanceDomain);
//
return true;
//
}
//
} catch (IOException e) {
//
logger.error("财务审核申请单信息保存到数据库失败" + strBody);
//
return false;
//
}
//
//
}
//
}
//
return false;
//
}
//
//
// ================================== 结束费用 ======================================================
//
@PostMapping("finish")
//
public Map<String, Object> finish(HttpServletRequest request, HttpServletResponse response) {
//
AxiosUtil.setCors(response, request);
//
//
String costNo = request.getParameter("costNo");
//
Map<String, Object> map = changeStatus(costNo, 7);
//
//
return map;
//
}
//
//
// ================================== 文件下载 ======================================================
//
@GetMapping("download")
//
public ResponseEntity<InputStreamResource> download(HttpServletRequest request, HttpServletResponse response) throws IOException {
//
//
AxiosUtil.setCors(response,request);
//
String costNo = request.getParameter("costNo");
//
String fileType = request.getParameter("fileType");
//
CostDomain costByCostNo = costService.getCostByCostNo(costNo);
//
CostDto cost = costByCostNo.castToDto();
//
//
String filePath = null;
//
String fileName = null;
//
if ("file".equals(fileType)) {
//
filePath = cost.getFilePath();
//
fileName = cost.getFileName();
//
} else if ("morFile".equals(fileType)) {
//
filePath = cost.getMorFilePath();
//
fileName = cost.getMorFileName();
//
}
//
FileSystemResource file = new FileSystemResource(filePath);
//
HttpHeaders headers = new HttpHeaders();
//
headers.add("Cache-Control", "no-cache, no-store, must-revalidate");
//
// new String(fileName.getBytes("UTF-8"),"iso-8859-1") 解决文件下载的时候文件名乱码的问题
//
headers.add("Content-Disposition", String.format("attachment; filename=\"%s\"", new String(fileName.getBytes("UTF-8"), "iso-8859-1")));
//
headers.add("Pragma", "no-cache");
//
headers.add("Expires", "0");
//
//
return ResponseEntity
//
.ok()
//
.headers(headers)
//
.contentLength(file.contentLength())
//
.contentType(MediaType.parseMediaType("application/octet-stream"))
//
.body(new InputStreamResource(file.getInputStream()));
//
}
//
//
/**
//
* 借支单结清
//
*
//
* @param response
//
* @param request
//
* @return
//
*/
//
@ApiOperation("借支单结清")
//
@PostMapping("/finishLend")
//
public Map<String, Object> finishLend(HttpServletResponse response, HttpServletRequest request) {
//
AxiosUtil.setCors(response, request);
//
Map<String, Object> result = new HashMap<>();
//
String costNo = request.getParameter("costNo");
//
String updateuserid = request.getParameter("updateuserid");
//
CostDomain costDomain = new CostDomain();
//
costDomain.setCostNo(costNo);
//
costDomain.setLendStatus(4);
//
result = costService.updateCost(costDomain);
//
result.put("success", true);
//
result.put("msg", "已结清");
//
costLogService.save(costNo, Integer.parseInt(updateuserid), "操作结清");
//
return result;
//
}
//
//
@GetMapping("downCashierAnnex")
//
public Map<String, Object> downCashierAnnex(HttpServletRequest request, HttpServletResponse response) {
//
AxiosUtil.setCors(response, request);
//
Map<String, Object> result = new HashMap<>();
//
List<String> list = costCashiercallbackService.downCashierAnnex();
//
result.put("success", true);
//
result.put("msg", "出纳单附件下载完成");
//
return result;
//
}
//
}
package
com
.
blt
.
other
.
module
.
cost
.
controller
.
cost
;
import
com.alibaba.fastjson.JSON
;
import
com.bailuntec.cost.api.dto.CostDto
;
import
com.blt.other.common.util.AxiosUtil
;
import
com.blt.other.common.util.CurUtils
;
import
com.blt.other.common.util.IpUtil
;
import
com.blt.other.module.cost.dto.CostCheckApiDto
;
import
com.blt.other.module.cost.model.CostDomain
;
import
com.blt.other.module.cost.service.*
;
import
com.blt.other.module.cost.vo.ApplyCallbackUrlVo
;
import
com.blt.other.module.cost.vo.ApplyCallbackVo
;
import
com.blt.other.module.cost.vo.ApplyMoneyDetail
;
import
com.blt.other.module.cost.vo.CashierCallbackUrlVo
;
import
com.blt.other.module.database.model.CostApplycallbackDomain
;
import
com.blt.other.module.database.model.CostCashiercallbackDomain
;
import
com.blt.other.module.database.model.CostCompanyDomain
;
import
com.blt.other.module.database.model.CostTofinanceDomain
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.FileSystemResource
;
import
org.springframework.core.io.InputStreamResource
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.client.RestTemplate
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.math.BigDecimal
;
import
java.util.*
;
@Api
(
tags
=
"费用审核接口"
)
@RestController
@RequestMapping
(
"cost/check"
)
public
class
CostCheckController
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CostCheckController
.
class
);
@Autowired
private
CostService
costService
;
@Autowired
private
CostCompanyService
costCompanyService
;
@Autowired
private
RestTemplate
restTemplate
;
@Autowired
private
CostTofinanceService
costTofinanceService
;
@Autowired
private
CostApplycallbackService
costApplycallbackService
;
@Autowired
private
CostCashiercallbackService
costCashiercallbackService
;
@Autowired
private
CostLogService
costLogService
;
@Value
(
"${url.api.postApplyApi}"
)
private
String
postApplyApi
;
@Value
(
"${url.my.costApplyCallbackUrlPost}"
)
private
String
costApplyCallbackUrlPost
;
@Value
(
"${url.my.costCashierCallbackUrlPost}"
)
private
String
costCashierCallbackUrlPost
;
@Value
(
"${url.my.lendCostApplyCallBackUrlPost}"
)
private
String
lendCostApplyCallBackUrlPost
;
@Value
(
"${url.my.lendCostCashierCallbackUrlPost}"
)
private
String
lendCostCashierCallbackUrlPost
;
@Value
(
"${url.api.getExchangeRateApi}"
)
private
String
getExchangeRateApi
;
@ApiOperation
(
"获取财务审核系统费用单列表"
)
@GetMapping
(
"getCostCheckList"
)
public
CostCheckApiDto
.
GetCostCheckListResp
getCostCheckList
(
@RequestParam
Integer
pageNum
,
@RequestParam
Integer
pageSize
,
@RequestParam
Integer
costStatus
)
{
return
costService
.
getCostByStatus
(
pageNum
,
pageSize
,
costStatus
);
}
@ApiOperation
(
"审核通过"
)
@PostMapping
(
"pass"
)
public
Map
<
String
,
Object
>
pass
(
@RequestParam
String
costNo
,
@RequestParam
Integer
updateuserid
)
{
Integer
costStatus
=
costService
.
getCostStatusByNo
(
costNo
);
/**
* 吴通新增
* 如果是支付状态, 就不准改
*/
if
(
null
!=
costStatus
&&
costStatus
.
equals
(
4
))
{
map
=
new
HashMap
<>();
map
.
put
(
"msg"
,
"error"
);
map
.
put
(
"result"
,
0
);
map
.
put
(
"finance"
,
false
);
costLogService
.
save
(
costNo
,
Integer
.
parseInt
(
updateuserid
),
"尝试修改已支付费用单,被拦截"
);
return
map
;
}
costLogService
.
save
(
costNo
,
Integer
.
parseInt
(
updateuserid
),
"费用系统财务审核通过"
);
// 审核通过,自动提交到出纳付款
boolean
toFinance
=
tofinanceMethod
(
costNo
);
if
(
toFinance
)
{
costLogService
.
save
(
costNo
,
Integer
.
parseInt
(
updateuserid
),
"出纳自动审核通过"
);
map
=
changeStatus
(
costNo
,
2
);
}
else
{
costLogService
.
save
(
costNo
,
Integer
.
parseInt
(
updateuserid
),
"出纳审核失败"
);
map
=
new
HashMap
<>();
}
map
.
put
(
"finance"
,
toFinance
);
return
map
;
}
@ApiOperation
(
"驳回审核"
)
@PostMapping
(
"reject"
)
public
Map
<
String
,
Object
>
reject
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
AxiosUtil
.
setCors
(
response
,
request
);
String
costNo
=
request
.
getParameter
(
"costNo"
);
String
rejectReason
=
request
.
getParameter
(
"rejectReason"
);
String
updateuserid
=
request
.
getParameter
(
"updateuserid"
);
CostDomain
costDomain
=
new
CostDomain
();
costDomain
.
setCostNo
(
costNo
);
costDomain
.
setRejectReason
(
rejectReason
);
costDomain
.
setRejectTime
(
new
Date
());
Map
<
String
,
Object
>
stringObjectMap
=
costService
.
updateCost
(
costDomain
);
Map
<
String
,
Object
>
map
=
changeStatus
(
costNo
,
3
);
costLogService
.
save
(
costNo
,
Integer
.
parseInt
(
updateuserid
),
"费用系统财务审核驳回:"
+
rejectReason
);
return
map
;
}
@ApiOperation
(
"财务审核回调接口"
)
@PostMapping
(
value
=
"ApplyCallbackUrl"
,
consumes
=
"application/json"
)
public
String
applyCallbackUrl
(
HttpServletRequest
request
)
{
String
result
=
null
;
String
line
=
null
;
try
{
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
request
.
getInputStream
()));
line
=
br
.
readLine
();
}
catch
(
IOException
e
)
{
logger
.
error
(
IpUtil
.
getIpAddr
(
request
)
+
" CostApplyCallbackUrl "
+
" 费用系统财务审核反馈信息获取失败"
);
result
=
"{result:false,msg:\"发生错误\"}"
;
return
result
;
}
line
=
line
.
replace
(
"\\"
,
""
);
// 格式化为标准 json 格式
int
data
=
line
.
lastIndexOf
(
"Data"
);
int
id
=
line
.
lastIndexOf
(
"id"
);
String
substring1
=
line
.
substring
(
0
,
data
+
6
);
String
substring2
=
line
.
substring
(
data
+
7
,
id
-
4
);
String
substring3
=
line
.
substring
(
id
-
3
);
line
=
substring1
+
substring2
+
substring3
;
line
=
line
.
toLowerCase
();
//保存为 bean,并且将反馈信息保存到数据库
ObjectMapper
mapper
=
new
ObjectMapper
();
ApplyCallbackUrlVo
applyCallbackUrlVo
=
null
;
try
{
applyCallbackUrlVo
=
mapper
.
readValue
(
line
,
ApplyCallbackUrlVo
.
class
);
if
(
null
==
applyCallbackUrlVo
)
{
logger
.
error
(
"保存财务审核信息发生错误:"
+
line
);
result
=
"{result:false,msg:\"发生错误\"}"
;
return
result
;
}
// 执行保存反馈信息流程
CostApplycallbackDomain
applycallbackDomain
=
new
CostApplycallbackDomain
();
BeanUtils
.
copyProperties
(
applyCallbackUrlVo
.
getData
().
getData
(),
applycallbackDomain
);
String
costNo
=
applyCallbackUrlVo
.
getId
().
toUpperCase
();
if
(
costNo
.
contains
(
"-"
))
{
costNo
=
costNo
.
split
(
"-"
)[
0
];
}
applycallbackDomain
.
setCostNo
(
costNo
);
applycallbackDomain
.
setMessage
(
applyCallbackUrlVo
.
getData
().
getMessage
().
toUpperCase
());
applycallbackDomain
.
setApplyno
(
applycallbackDomain
.
getApplyno
().
toUpperCase
());
Integer
integer
=
costApplycallbackService
.
saveApplycallbackResponse
(
applycallbackDomain
);
logger
.
warn
(
"保存财务审核信息成功:"
+
integer
+
" "
+
line
);
}
catch
(
IOException
e
)
{
logger
.
error
(
"保存财务审核信息发生错误:"
+
line
);
result
=
"{result:false,msg:\"发生错误\"}"
;
return
result
;
}
result
=
"{result:true,msg:\"\"}"
;
return
result
;
}
@ApiOperation
(
"财务付款回调接口"
)
@PostMapping
(
value
=
"CashierCallbackUrl"
,
consumes
=
"application/json"
)
public
String
cashierCallbackUrl
(
HttpServletRequest
request
)
{
String
result
;
// 将状态改为审核通过、已付款
logger
.
warn
(
"费用系统出纳回调"
+
IpUtil
.
getIpAddr
(
request
)
+
" CashierCallbackUrl "
);
String
line
;
try
{
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
request
.
getInputStream
()));
line
=
br
.
readLine
();
line
=
line
.
replace
(
"\\"
,
""
);
// 格式化为标准 json 格式
int
data
=
line
.
lastIndexOf
(
"Data"
);
int
id
=
line
.
lastIndexOf
(
"id"
);
String
substring1
=
line
.
substring
(
0
,
data
+
6
);
String
substring2
=
line
.
substring
(
data
+
7
,
id
-
4
);
String
substring3
=
line
.
substring
(
id
-
3
);
line
=
substring1
+
substring2
+
substring3
;
line
=
line
.
toLowerCase
();
line
=
line
.
replace
(
"_"
,
""
);
logger
.
warn
(
"费用系统支付反馈信息:"
+
line
);
ObjectMapper
mapper
=
new
ObjectMapper
();
CashierCallbackUrlVo
cashierCallbackUrlVo
=
null
;
CostCashiercallbackDomain
costCashiercallbackDomain
=
new
CostCashiercallbackDomain
();
check
/
lend
/
CashierCallbackUrl
BigDecimal
toRmbRate
=
null
;
// 转人民币汇率
try
{
cashierCallbackUrlVo
=
mapper
.
readValue
(
line
,
CashierCallbackUrlVo
.
class
);
if
(
cashierCallbackUrlVo
==
null
)
{
logger
.
error
(
"费用系统保存出纳付款信息发生错误:"
+
line
);
result
=
"{result:false,msg:\"发生错误\"}"
;
return
result
;
}
BeanUtils
.
copyProperties
(
cashierCallbackUrlVo
.
getData
(),
costCashiercallbackDomain
);
BeanUtils
.
copyProperties
(
cashierCallbackUrlVo
.
getData
().
getData
(),
costCashiercallbackDomain
);
BeanUtils
.
copyProperties
(
cashierCallbackUrlVo
.
getData
().
getData
().
getPaydetail
(),
costCashiercallbackDomain
);
String
costNo
=
cashierCallbackUrlVo
.
getId
().
toUpperCase
();
if
(
costNo
.
contains
(
"-"
))
{
String
[]
split
=
costNo
.
split
(
"-"
);
costNo
=
split
[
0
];
}
costCashiercallbackDomain
.
setCostNo
(
costNo
);
costCashiercallbackDomain
.
setMessage
(
costCashiercallbackDomain
.
getMessage
().
toUpperCase
());
costCashiercallbackDomain
.
setPayno
(
costCashiercallbackDomain
.
getPayno
().
toUpperCase
());
// 被出纳驳回
if
(
costCashiercallbackDomain
.
getMessage
().
contains
(
"被驳回"
))
{
boolean
b
=
finansysReject
(
costCashiercallbackDomain
);
if
(
b
)
{
logger
.
info
(
"出纳驳回,费用单状态更改成功"
+
costCashiercallbackDomain
);
costLogService
.
save
(
costNo
,
costCashiercallbackDomain
.
getPayuserid
(),
"被出纳驳回:"
+
costCashiercallbackDomain
.
getPaynote
());
}
else
{
logger
.
info
(
"出纳驳回,费用单状态更改失败"
+
costCashiercallbackDomain
);
}
result
=
"{result:true,msg:\"出纳驳回\"}"
;
return
result
;
}
else
{
// 获取xx货币-->CNY的汇率
toRmbRate
=
CurUtils
.
getCur
(
costCashiercallbackDomain
.
getCashierunitcode
().
toUpperCase
(),
"CNY"
,
getExchangeRateApi
);
costCashiercallbackDomain
.
setToRmbRate
(
toRmbRate
);
}
// 保存出纳付款记录
Integer
integer
=
costCashiercallbackService
.
saveCostCashiercallbackResponse
(
costCashiercallbackDomain
);
logger
.
warn
(
"保存出纳付款信息成功:"
+
integer
+
" "
+
costCashiercallbackDomain
);
}
catch
(
IOException
e
)
{
logger
.
error
(
"保存出纳付款信息发生错误:"
+
line
);
result
=
"{result:false,msg:\"发生错误\"}"
;
return
result
;
}
// 付款成功,更改费用单信息,否则返回失败
CostDomain
costDomain
=
costService
.
getCostDomainByNo
(
costCashiercallbackDomain
.
getCostNo
());
costDomain
.
setCostStatus
(
4
);
if
(
null
!=
costDomain
.
getIsLend
())
{
if
(
costDomain
.
getIsLend
()
==
1
&&
BigDecimal
.
ZERO
.
compareTo
(
costDomain
.
getHadPay
())
>=
0
)
{
costDomain
.
setLendStatus
(
1
);
}
}
costDomain
.
setPayUserId
(
costCashiercallbackDomain
.
getPayuserid
());
costDomain
.
setPayTime
(
new
Date
());
costDomain
.
setAmountRmb
(
costCashiercallbackDomain
.
getCashierpaymoneyrmb
());
costDomain
.
setToRmbRate
(
toRmbRate
);
Map
<
String
,
Object
>
map
=
costService
.
updateCost
(
costDomain
);
if
(
null
!=
map
)
{
result
=
"{result:true,msg:\"保存成功\"}"
;
costLogService
.
save
(
costCashiercallbackDomain
.
getCostNo
(),
costCashiercallbackDomain
.
getPayuserid
(),
"出纳收/付款成功:"
+
costCashiercallbackDomain
.
getPaynote
());
}
else
{
result
=
"{result:false,msg:\"发生错误\"}"
;
}
}
catch
(
IOException
e
)
{
logger
.
error
(
IpUtil
.
getIpAddr
(
request
)
+
" CashierCallbackUrl "
+
" 出纳付款反馈信息获取失败"
);
result
=
"{result:false,msg:\"发生错误\"}"
;
return
result
;
}
return
result
;
}
/**
* 出纳驳回
*
* @param domain
* @return
*/
private
boolean
finansysReject
(
CostCashiercallbackDomain
domain
)
{
// 保存驳回信息
Integer
integer
=
costCashiercallbackService
.
saveCostCashiercallbackResponse
(
domain
);
if
(
null
!=
integer
&&
integer
>=
1
)
{
// 费用单状态改为审核驳回,添加驳回理由
// 修复驳回后提交出现费用单已存在的问题
// 将后缀添加到 detail_key 字段
CostDomain
oldCost
=
costService
.
getByNo
(
domain
.
getCostNo
());
String
oldDetailKey
=
oldCost
.
getDetailKey
();
CostDomain
costDomain
=
new
CostDomain
();
costDomain
.
setId
(
oldCost
.
getId
());
if
(
null
!=
oldDetailKey
&&
oldDetailKey
.
contains
(
"-"
))
{
String
[]
split
=
oldDetailKey
.
split
(
"-"
);
if
(
split
.
length
>
1
)
{
int
i
=
Integer
.
parseInt
(
split
[
1
])
+
1
;
costDomain
.
setDetailKey
(
split
[
0
]
+
"-"
+
i
);
}
}
else
{
costDomain
.
setDetailKey
(
oldCost
.
getCostNo
()
+
"-"
+
1
);
}
costDomain
.
setRejectReason
(
domain
.
getPaynote
());
costDomain
.
setCostStatus
(
3
);
costDomain
.
setRejectType
(
2
);
Integer
result
=
costService
.
updateById
(
costDomain
);
}
return
true
;
}
/**
* 改变费用单状态
*
* @param costNo
* @param costStatus
* @return
*/
private
Map
<
String
,
Object
>
changeStatus
(
String
costNo
,
Integer
costStatus
)
{
CostDomain
costDomain
=
costService
.
getCostDomainByNo
(
costNo
);
costDomain
.
setCostNo
(
costNo
);
costDomain
.
setCostStatus
(
costStatus
);
if
(
costStatus
==
2
)
{
costDomain
.
setAuditTime
(
new
Date
());
}
if
(
null
!=
costDomain
.
getIsLend
())
{
if
(
1
==
costDomain
.
getIsLend
()
&&
4
==
costStatus
)
{
costDomain
.
setLendStatus
(
1
);
}
}
Map
<
String
,
Object
>
map
=
costService
.
updateCost
(
costDomain
);
return
map
;
}
/**
* 提交出纳系统
*
* @param costNo
* @return
*/
public
boolean
tofinanceMethod
(
String
costNo
)
{
// 获取费用单信息
List
<
ApplyMoneyDetail
>
applyMoneyDetailList
=
new
ArrayList
<>();
ApplyMoneyDetail
applyMoneyDetail
=
new
ApplyMoneyDetail
();
CostDomain
cost
=
costService
.
getCostDomainByNo
(
costNo
);
CostCompanyDomain
companyByCompanyNo
=
costCompanyService
.
getCompanyByCompanyNo
(
cost
.
getCompanyNo
());
// 提交财务
MultiValueMap
<
String
,
Object
>
requestEntity
=
new
LinkedMultiValueMap
<>();
requestEntity
.
add
(
"CompanyMainName"
,
cost
.
getCompanyName
());
// 公司主体(CompanyMainName)不可为空;
// 借支单补差额的付款单,单独设置回调地址;
requestEntity
.
add
(
"Title"
,
cost
.
getCostNo
());
if
(
costNo
.
startsWith
(
"S"
))
{
logger
.
info
(
"补差额的付款单:"
+
costNo
);
applyMoneyDetail
.
setName
(
"借支单补差额"
);
requestEntity
.
add
(
"ApplyCallbackUrl"
,
lendCostApplyCallBackUrlPost
);
// 审核回调地址(ApplyCallbackUrl)不可为空;
requestEntity
.
add
(
"CashierCallbackUrl"
,
lendCostCashierCallbackUrlPost
);
// 出纳回调地址(CashierCallbackUrl)不可为空;
}
else
{
requestEntity
.
add
(
"ApplyCallbackUrl"
,
costApplyCallbackUrlPost
);
// 审核回调地址(ApplyCallbackUrl)不可为空;
requestEntity
.
add
(
"CashierCallbackUrl"
,
costCashierCallbackUrlPost
);
// 出纳回调地址(CashierCallbackUrl)不可为空;
}
requestEntity
.
add
(
"UnitCode"
,
cost
.
getDic
());
// 币种编号(UnitCode)不可为空;
requestEntity
.
add
(
"UnitName"
,
cost
.
getDic
());
// 币种名称(UnitName)不可为空;
// 交易对象改为付款/收款单位
requestEntity
.
add
(
"TradeObjectID"
,
companyByCompanyNo
.
getValue
()
+
""
);
requestEntity
.
add
(
"TradeObjectName"
,
cost
.
getBankCompany
()
+
""
);
// 交易对象(TradeObjectID/TradeObjectName)不可为空;
requestEntity
.
add
(
"BankNameto"
,
""
+
cost
.
getBankName
());
requestEntity
.
add
(
"BankCardto"
,
""
+
cost
.
getBankCard
());
requestEntity
.
add
(
"BankCardUserto"
,
""
+
cost
.
getBankCardUser
());
// 交易对象账户(BankNameto/BankCardto/BankCardUserto)资料不完整;
requestEntity
.
add
(
"SourceCode"
,
"newCost"
);
requestEntity
.
add
(
"SourceTypeCode"
,
"newCostType"
);
// newOtherPurchase申请来源(SourceCode/SourceTypeCode)不可为空;
// 账期 0 PayDay
requestEntity
.
add
(
"PayDay"
,
0
);
// 预计付款时间 ExpectPayTime
requestEntity
.
add
(
"ExpectPayTime"
,
new
Date
());
applyMoneyDetail
.
setMoney
(
cost
.
getAmount
());
applyMoneyDetail
.
setMoneyRmb
(
cost
.
getAmount
());
if
(
1
==
cost
.
getCostForm
())
{
requestEntity
.
add
(
"ApplyType"
,
""
+
1
);
// 申请类型(ApplyType)不存在;申请类型:1#付款;2#收款;3#无需付款;
applyMoneyDetail
.
setName
(
"费用单付款"
);
}
else
if
(
2
==
cost
.
getCostForm
())
{
requestEntity
.
add
(
"ApplyType"
,
""
+
2
);
// 申请类型(ApplyType)不存在;申请类型:1#付款;2#收款;3#无需付款;
applyMoneyDetail
.
setName
(
"费用单收款"
);
}
else
if
(
3
==
cost
.
getCostForm
()
&&
1
==
cost
.
getIsLend
())
{
requestEntity
.
add
(
"ApplyType"
,
""
+
1
);
// 申请类型(ApplyType)不存在;申请类型:1#付款;2#收款;3#无需付款;
applyMoneyDetail
.
setName
(
"借支单付款"
);
}
requestEntity
.
add
(
"UserAcctID"
,
""
+
cost
.
getCreateUserid
());
requestEntity
.
add
(
"UserAcctName"
,
""
+
cost
.
getCreateUsername
());
// 申请人(UserAcctID/UserAcctName)不存在;
applyMoneyDetail
.
setRemark
(
""
);
applyMoneyDetailList
.
add
(
applyMoneyDetail
);
requestEntity
.
add
(
"MoneyDetail"
,
applyMoneyDetailList
);
// 出纳申请金额明细(MoneyDetail)不可为空;
// 设置 detailKey
String
detailKey
=
cost
.
getDetailKey
();
if
(
null
==
detailKey
||
!
detailKey
.
contains
(
"F"
))
{
detailKey
=
cost
.
getCostNo
();
}
requestEntity
.
add
(
"DetailKey"
,
detailKey
);
// 回调必要的key参数(DetailKey)不能为空;
// 吴通 增加费用大类
requestEntity
.
add
(
"TypeName"
,
cost
.
getTypeName
());
Map
<
String
,
Object
>
map
=
requestEntity
.
toSingleValueMap
();
String
s
=
JSON
.
toJSONString
(
map
);
logger
.
info
(
cost
.
getCostNo
()
+
" 费用单提交财务审核信息:"
+
s
);
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
HttpEntity
<
String
>
entity
=
new
HttpEntity
<>(
s
,
headers
);
ResponseEntity
<
String
>
response
=
restTemplate
.
postForEntity
(
postApplyApi
,
entity
,
String
.
class
);
logger
.
info
(
cost
.
getCostNo
()
+
" 费用单提交审核反馈信息:"
+
response
);
String
strBody
=
null
;
if
(
response
.
getStatusCodeValue
()
==
200
)
{
strBody
=
response
.
getBody
();
strBody
=
strBody
.
replace
(
"\\"
,
""
);
strBody
=
strBody
.
toLowerCase
();
if
(
strBody
.
contains
(
"申请单已存在"
))
{
logger
.
info
(
cost
.
getCostNo
()
+
" 申请单已存在:"
+
strBody
);
return
true
;
}
else
if
(
strBody
.
contains
(
"创建"
))
{
// 将 strBody 保存到数据库 costTofinance 表
ObjectMapper
mapper
=
new
ObjectMapper
();
try
{
// 将 strBody 转作为标准 JSONString 格式
int
i
=
strBody
.
lastIndexOf
(
"data\":"
);
String
substring1
=
strBody
.
substring
(
0
,
i
+
6
);
String
substring2
=
strBody
.
substring
(
i
+
7
,
strBody
.
length
()
-
2
);
strBody
=
substring1
+
substring2
+
"}"
;
logger
.
warn
(
strBody
);
ApplyCallbackVo
applyCallbackVo
=
mapper
.
readValue
(
strBody
,
ApplyCallbackVo
.
class
);
// 将反馈信息保存到数据库
if
(
null
!=
applyCallbackVo
&&
applyCallbackVo
.
isSuccess
())
{
CostTofinanceDomain
costTofinanceDomain
=
new
CostTofinanceDomain
();
BeanUtils
.
copyProperties
(
applyCallbackVo
.
getData
(),
costTofinanceDomain
);
costTofinanceDomain
.
setCostNo
(
cost
.
getCostNo
().
toUpperCase
());
costTofinanceDomain
.
setCode
(
costTofinanceDomain
.
getCode
().
toUpperCase
());
// 执行 insert 流程
Integer
integer
=
costTofinanceService
.
saveCostTofinanceMsg
(
costTofinanceDomain
);
return
true
;
}
}
catch
(
IOException
e
)
{
logger
.
error
(
"财务审核申请单信息保存到数据库失败"
+
strBody
);
return
false
;
}
}
}
return
false
;
}
// ================================== 结束费用 ======================================================
@PostMapping
(
"finish"
)
public
Map
<
String
,
Object
>
finish
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
AxiosUtil
.
setCors
(
response
,
request
);
String
costNo
=
request
.
getParameter
(
"costNo"
);
Map
<
String
,
Object
>
map
=
changeStatus
(
costNo
,
7
);
return
map
;
}
// ================================== 文件下载 ======================================================
@GetMapping
(
"download"
)
public
ResponseEntity
<
InputStreamResource
>
download
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
{
// AxiosUtil.setCors(response,request);
String
costNo
=
request
.
getParameter
(
"costNo"
);
String
fileType
=
request
.
getParameter
(
"fileType"
);
CostDomain
costByCostNo
=
costService
.
getCostByCostNo
(
costNo
);
CostDto
cost
=
costByCostNo
.
castToDto
();
String
filePath
=
null
;
String
fileName
=
null
;
if
(
"file"
.
equals
(
fileType
))
{
filePath
=
cost
.
getFilePath
();
fileName
=
cost
.
getFileName
();
}
else
if
(
"morFile"
.
equals
(
fileType
))
{
filePath
=
cost
.
getMorFilePath
();
fileName
=
cost
.
getMorFileName
();
}
FileSystemResource
file
=
new
FileSystemResource
(
filePath
);
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
add
(
"Cache-Control"
,
"no-cache, no-store, must-revalidate"
);
// new String(fileName.getBytes("UTF-8"),"iso-8859-1") 解决文件下载的时候文件名乱码的问题
headers
.
add
(
"Content-Disposition"
,
String
.
format
(
"attachment; filename=\"%s\""
,
new
String
(
fileName
.
getBytes
(
"UTF-8"
),
"iso-8859-1"
)));
headers
.
add
(
"Pragma"
,
"no-cache"
);
headers
.
add
(
"Expires"
,
"0"
);
return
ResponseEntity
.
ok
()
.
headers
(
headers
)
.
contentLength
(
file
.
contentLength
())
.
contentType
(
MediaType
.
parseMediaType
(
"application/octet-stream"
))
.
body
(
new
InputStreamResource
(
file
.
getInputStream
()));
}
/**
* 借支单结清
*
* @param response
* @param request
* @return
*/
@ApiOperation
(
"借支单结清"
)
@PostMapping
(
"/finishLend"
)
public
Map
<
String
,
Object
>
finishLend
(
HttpServletResponse
response
,
HttpServletRequest
request
)
{
AxiosUtil
.
setCors
(
response
,
request
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
String
costNo
=
request
.
getParameter
(
"costNo"
);
String
updateuserid
=
request
.
getParameter
(
"updateuserid"
);
CostDomain
costDomain
=
new
CostDomain
();
costDomain
.
setCostNo
(
costNo
);
costDomain
.
setLendStatus
(
4
);
result
=
costService
.
updateCost
(
costDomain
);
result
.
put
(
"success"
,
true
);
result
.
put
(
"msg"
,
"已结清"
);
costLogService
.
save
(
costNo
,
Integer
.
parseInt
(
updateuserid
),
"操作结清"
);
return
result
;
}
@GetMapping
(
"downCashierAnnex"
)
public
Map
<
String
,
Object
>
downCashierAnnex
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
AxiosUtil
.
setCors
(
response
,
request
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
List
<
String
>
list
=
costCashiercallbackService
.
downCashierAnnex
();
result
.
put
(
"success"
,
true
);
result
.
put
(
"msg"
,
"出纳单附件下载完成"
);
return
result
;
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/controller/cost/CostController.java
View file @
556d3d98
...
...
@@ -176,7 +176,7 @@ public class CostController {
CostContext
costContext
=
new
CostContext
(
costNo
,
costDomain
.
getCreateUserid
());
costContext
.
setCostState
(
unSubmitState
);
costContext
.
nexStat
e
();
costContext
.
handl
e
();
CostApiDto
.
UpdateCostResp
resp
=
new
CostApiDto
.
UpdateCostResp
();
...
...
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/CostService.java
View file @
556d3d98
...
...
@@ -124,7 +124,6 @@ public interface CostService {
void
finalCheck
(
String
costNo
,
Integer
currentUserId
);
/**
* 审核费用单列表
*
...
...
@@ -135,4 +134,13 @@ public interface CostService {
* @return 费用单列表
*/
IPage
<
CostDto
>
checkCostList
(
Integer
userid
,
Integer
pageNum
,
Integer
pageSize
,
Integer
type
);
/**
* <p>
* 审核成功通知财务系统付款
* </p>
*
* @param costDomain cost
*/
void
toFinancial
(
CostDomain
costDomain
);
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/cost/AbstractCostService.java
View file @
556d3d98
...
...
@@ -10,7 +10,6 @@ import com.blt.other.common.util.MoneyUtil;
import
com.blt.other.module.auth.dao.CostReviewerMapper
;
import
com.blt.other.module.auth.dao.OaUserMapper
;
import
com.blt.other.module.auth.model.CostReviewer
;
import
com.blt.other.module.auth.model.OaUser
;
import
com.blt.other.module.auth.service.UserService
;
import
com.blt.other.module.cost.dao.CostCompanyDao
;
import
com.blt.other.module.cost.dao.CostDao
;
...
...
@@ -24,6 +23,8 @@ import com.blt.other.module.cost.model.CostTemplate;
import
com.blt.other.module.cost.service.CostLogService
;
import
com.blt.other.module.cost.service.CostService
;
import
com.blt.other.module.cost.service.ICostTemplateService
;
import
com.blt.other.module.cost.service.impl.costcheck.CostContext
;
import
com.blt.other.module.cost.service.impl.costcheck.DepartmentCheckState
;
import
com.blt.other.module.database.model.CostCompanyDomain
;
import
com.blt.other.module.database.model.CostLogDomain
;
import
com.blt.other.module.database.model.CostTypeKindDomain
;
...
...
@@ -184,37 +185,17 @@ public abstract class AbstractCostService implements CostService {
}
@Resource
DepartmentCheckState
departmentCheckState
;
@Transactional
@Override
public
void
departmentCheck
(
String
costNo
,
Integer
currentUserId
)
{
CostDomain
costDomain
=
costDao
.
selectByCostNo
(
costNo
);
CostTemplate
costTemplate
=
costTemplateService
.
queryDetail
(
costDomain
.
getCostTemplateId
());
//需要自动审核
if
(
costTemplate
.
shouldDepartmentAutoCheck
())
{
//自动审核通过
if
(
this
.
autoCheck
(
costDomain
))
{
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_FINANCIAL_CHECK
);
costDao
.
updateById
(
costDomain
);
//流转状态
costSubscribe
.
subscribe
(
costDomain
);
costLogService
.
save
(
costNo
,
currentUserId
,
"部门自动审核通过"
,
CostLogDomain
.
AUTO_CHECK
);
}
//自动审核失败
else
{
//人工审核
this
.
departmentManualCheck
(
costNo
,
currentUserId
);
}
}
//人工审核
else
{
//人工审核
this
.
departmentManualCheck
(
costNo
,
currentUserId
);
}
}
CostContext
costContext
=
new
CostContext
(
costNo
,
currentUserId
);
costContext
.
setCostState
(
departmentCheckState
);
costContext
.
handle
();
}
@Transactional
...
...
@@ -223,46 +204,11 @@ public abstract class AbstractCostService implements CostService {
CostDomain
costDomain
=
costDao
.
selectByCostNo
(
costNo
);
CostTemplate
costTemplate
=
costTemplateService
.
queryDetail
(
costDomain
.
getCostTemplateId
());
//需要自动审核
if
(
costTemplate
.
shouldFinalAutoCheck
())
{
//自动审核通过
if
(
this
.
autoCheck
(
costDomain
))
{
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_FINAL_CHECK
);
costDao
.
updateById
(
costDomain
);
//流转状态
costSubscribe
.
subscribe
(
costDomain
);
costLogService
.
save
(
costNo
,
currentUserId
,
"财务自动审核通过"
,
CostLogDomain
.
AUTO_CHECK
);
}
//自动审核失败
else
{
//人工审核
this
.
financialManualCheck
(
costNo
,
currentUserId
);
}
}
//人工审核
else
{
//人工审核
this
.
financialManualCheck
(
costNo
,
currentUserId
);
}
}
protected
void
financialManualCheck
(
String
costNo
,
Integer
currentUserId
)
{
CostDomain
costDomain
=
costDao
.
selectByCostNo
(
costNo
);
CostCompanyDomain
costCompany
=
costCompanyDao
.
selectByNo
(
costDomain
.
getCompanyNo
());
//人工审核通过
if
(
costReviewerMapper
.
queryOne
(
costCompany
.
getId
(),
CostReviewer
.
financialReviewer
,
currentUserId
)
!=
null
)
{
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_FINAL_CHECK
);
costDao
.
updateById
(
costDomain
);
//流转状态
costSubscribe
.
subscribe
(
costDomain
);
costLogService
.
save
(
costNo
,
currentUserId
,
"财务审核通过"
,
CostLogDomain
.
MANUAL_CHECK
);
}
//人工审核没权限
else
{
throw
new
BizRuntimeException
(
"current user no authority"
);
}
}
...
...
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/cost/CostSubscribe.java
View file @
556d3d98
...
...
@@ -23,6 +23,6 @@ public class CostSubscribe {
@Async
public
void
subscribe
(
CostContext
costContext
)
{
costContext
.
nexStat
e
();
costContext
.
handl
e
();
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/cost/PayCostServiceImpl.java
View file @
556d3d98
package
com
.
blt
.
other
.
module
.
cost
.
service
.
impl
.
cost
;
import
com.blt.other.module.cost.model.CostDomain
;
import
com.blt.other.module.cost.service.CostService
;
import
org.springframework.stereotype.Service
;
...
...
@@ -17,4 +18,9 @@ public class PayCostServiceImpl extends AbstractCostService implements CostServi
public
void
finalCheck
(
String
costNo
,
Integer
currentUserId
)
{
}
@Override
public
void
toFinancial
(
CostDomain
costDomain
)
{
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/CostContext.java
View file @
556d3d98
package
com
.
blt
.
other
.
module
.
cost
.
service
.
impl
.
costcheck
;
import
com.bailuntec.common.SpringContextUtil
;
import
com.blt.other.module.cost.dao.CostDao
;
import
com.blt.other.module.cost.model.CostDomain
;
import
com.blt.other.module.cost.service.CostService
;
import
com.blt.other.module.cost.service.impl.cost.CostServiceFactory
;
/**
* <p>
*
*
费用单上下文
* </p>
*
* @author robbendev
...
...
@@ -33,11 +31,11 @@ public class CostContext {
public
CostContext
(
String
costNo
,
Integer
currentUserId
)
{
this
.
costService
=
CostServiceFactory
.
getCostService
(
costNo
);
this
.
currentUserId
=
currentUserId
;
this
.
costDomain
=
SpringContextUtil
.
getBean
(
CostDao
.
class
).
selec
tByCostNo
(
costNo
);
this
.
costDomain
=
costService
.
getCos
tByCostNo
(
costNo
);
}
public
void
nexStat
e
()
{
public
void
handl
e
()
{
costState
.
handle
();
}
...
...
@@ -45,5 +43,4 @@ public class CostContext {
costState
.
refuse
();
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/DepartmentCheckState.java
View file @
556d3d98
...
...
@@ -27,8 +27,13 @@ public class DepartmentCheckState extends CostState {
public
void
handle
()
{
CostDomain
costDomain
=
costContext
.
costDomain
;
Integer
currentUserId
=
costContext
.
currentUserId
;
CostTemplate
costTemplate
=
costTemplateService
.
queryDetail
(
costDomain
.
getCostTemplateId
());
//check status
if
(!
costDomain
.
getCostStatus
().
equals
(
CostDomain
.
STATUS_DEPARTMENT_CHECK
))
{
throw
new
BizRuntimeException
(
"invalid status"
);
}
//需要自动审核
if
(
costTemplate
.
shouldDepartmentAutoCheck
())
{
//自动审核通过
...
...
@@ -54,8 +59,7 @@ public class DepartmentCheckState extends CostState {
costLogService
.
save
(
costDomain
.
getCostNo
(),
currentUserId
,
"部门审核通过"
,
CostLogDomain
.
MANUAL_CHECK
);
nextState
(
financialCheckState
);
//发布到总线尝试审核
//发布到总线尝试下个环节的自动审核
costSubscribe
.
subscribe
(
costContext
);
}
//人工审核没权限
...
...
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/FinalCheckState.java
View file @
556d3d98
package
com
.
blt
.
other
.
module
.
cost
.
service
.
impl
.
costcheck
;
import
org.springframework.stereotype.Component
;
import
com.blt.other.common.exception.BizRuntimeException
;
import
com.blt.other.module.auth.model.CostReviewer
;
import
com.blt.other.module.cost.dao.CostCompanyDao
;
import
com.blt.other.module.cost.model.CostDomain
;
import
com.blt.other.module.cost.model.CostTemplate
;
import
com.blt.other.module.database.model.CostCompanyDomain
;
import
com.blt.other.module.database.model.CostLogDomain
;
import
javax.annotation.Resource
;
/**
* <p>
...
...
@@ -12,9 +20,67 @@ import org.springframework.stereotype.Component;
*/
public
class
FinalCheckState
extends
CostState
{
@Resource
UnPayState
unPayState
;
@Resource
CostCompanyDao
costCompanyDao
;
@Override
public
void
handle
()
{
CostDomain
costDomain
=
costContext
.
costDomain
;
Integer
currentUserId
=
costContext
.
currentUserId
;
CostTemplate
costTemplate
=
costTemplateService
.
queryDetail
(
costDomain
.
getCostTemplateId
());
//check status
if
(!
costDomain
.
getCostStatus
().
equals
(
CostDomain
.
STATUS_FINAL_CHECK
))
{
throw
new
BizRuntimeException
(
"invalid status"
);
}
//如果不需要审核 直接通过
if
(!
costTemplate
.
shouldFinalCheck
(
costDomain
.
getAmount
()))
{
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_UN_PAY
);
costDao
.
updateById
(
costDomain
);
costLogService
.
save
(
costDomain
.
getCostNo
(),
currentUserId
,
"金额不够最终审核标准,无需最终审核"
,
null
);
//通知财务系统
costContext
.
costService
.
toFinancial
(
costDomain
);
}
//需要自动审核
if
(
costTemplate
.
shouldFinalAutoCheck
())
{
//自动审核通过
if
(
this
.
autoCheck
(
costDomain
))
{
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_UN_PAY
);
costDao
.
updateById
(
costDomain
);
costLogService
.
save
(
costDomain
.
getCostNo
(),
currentUserId
,
"最终审核自动通过"
,
CostLogDomain
.
AUTO_CHECK
);
//流转状态
nextState
(
unPayState
);
//通知财务系统
costContext
.
costService
.
toFinancial
(
costDomain
);
return
;
}
}
CostCompanyDomain
costCompany
=
costCompanyDao
.
selectByNo
(
costDomain
.
getCompanyNo
());
//人工审核通过
if
(
costReviewerMapper
.
queryOne
(
costCompany
.
getId
(),
CostReviewer
.
financialReviewer
,
currentUserId
)
!=
null
)
{
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_UN_PAY
);
costDao
.
updateById
(
costDomain
);
costLogService
.
save
(
costDomain
.
getCostNo
(),
currentUserId
,
"最终审核通过"
,
CostLogDomain
.
MANUAL_CHECK
);
//流转状态
nextState
(
unPayState
);
//通知财务系统
costContext
.
costService
.
toFinancial
(
costDomain
);
}
//人工审核没权限
else
{
throw
new
BizRuntimeException
(
"current user no authority"
);
}
}
@Override
...
...
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/FinancialCheckState.java
View file @
556d3d98
package
com
.
blt
.
other
.
module
.
cost
.
service
.
impl
.
costcheck
;
import
com.blt.other.common.exception.BizRuntimeException
;
import
com.blt.other.module.auth.model.CostReviewer
;
import
com.blt.other.module.cost.dao.CostCompanyDao
;
import
com.blt.other.module.cost.model.CostDomain
;
import
com.blt.other.module.cost.model.CostTemplate
;
import
com.blt.other.module.database.model.CostCompanyDomain
;
import
com.blt.other.module.database.model.CostLogDomain
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
/**
* <p>
*
...
...
@@ -13,9 +22,57 @@ import org.springframework.stereotype.Component;
@Component
public
class
FinancialCheckState
extends
CostState
{
@Resource
FinalCheckState
finalCheckState
;
@Resource
CostCompanyDao
costCompanyDao
;
@Override
public
void
handle
()
{
CostDomain
costDomain
=
costContext
.
costDomain
;
Integer
currentUserId
=
costContext
.
currentUserId
;
CostTemplate
costTemplate
=
costTemplateService
.
queryDetail
(
costDomain
.
getCostTemplateId
());
//check status
if
(!
costDomain
.
getCostStatus
().
equals
(
CostDomain
.
STATUS_FINANCIAL_CHECK
))
{
throw
new
BizRuntimeException
(
"invalid status"
);
}
//需要自动审核
if
(
costTemplate
.
shouldFinalAutoCheck
())
{
//自动审核通过
if
(
this
.
autoCheck
(
costDomain
))
{
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_FINAL_CHECK
);
costDao
.
updateById
(
costDomain
);
costLogService
.
save
(
costDomain
.
getCostNo
(),
currentUserId
,
"财务自动审核通过"
,
CostLogDomain
.
AUTO_CHECK
);
//流转状态
nextState
(
finalCheckState
);
//发布到总线尝试下个环节的自动审核
costSubscribe
.
subscribe
(
costContext
);
return
;
}
}
CostCompanyDomain
costCompany
=
costCompanyDao
.
selectByNo
(
costDomain
.
getCompanyNo
());
//人工审核通过
if
(
costReviewerMapper
.
queryOne
(
costCompany
.
getId
(),
CostReviewer
.
financialReviewer
,
currentUserId
)
!=
null
)
{
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_FINAL_CHECK
);
costDao
.
updateById
(
costDomain
);
costLogService
.
save
(
costDomain
.
getCostNo
(),
currentUserId
,
"财务审核通过"
,
CostLogDomain
.
MANUAL_CHECK
);
//流转状态
nextState
(
finalCheckState
);
//发布到总线尝试下个环节的自动审核
costSubscribe
.
subscribe
(
costContext
);
}
//人工审核没权限
else
{
throw
new
BizRuntimeException
(
"current user no authority"
);
}
}
@Override
...
...
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/PayedState.java
View file @
556d3d98
package
com
.
blt
.
other
.
module
.
cost
.
service
.
impl
.
costcheck
;
import
org.springframework.stereotype.Component
;
/**
* <p>
*
...
...
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/UnSubmitState.java
View file @
556d3d98
...
...
@@ -41,7 +41,7 @@ public class UnSubmitState extends CostState {
//并且流转到下一个状态
costContext
.
setCostState
(
departmentCheckState
);
//尝试审核(由于清空了审核人,这里只会走自动审核)
costContext
.
nexStat
e
();
costContext
.
handl
e
();
}
@Override
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment