Commit bee0a147 by huluobin

update

parent be146fc5
//package com.blt.other.module.cost.controller.cost;
//
//import com.blt.other.common.util.AxiosUtil;
//import com.blt.other.module.cost.model.CostDomain;
//import com.blt.other.module.cost.service.*;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import org.springframework.web.client.RestTemplate;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.math.BigDecimal;
//import java.util.Map;
//
//@RestController
//@RequestMapping("cost/check/lend")
//public class CostCheckLendController {
//
// private static Logger logger = LoggerFactory.getLogger(CostCheckLendController.class);
//
// @Autowired
// private CostService costService;
// @Autowired
// private CostLogService costLogService;
// @Autowired
// private CostCompanyService costCompanyService;
// @Autowired
// private RestTemplate restTemplate;
// @Autowired
// private CostTofinanceService costTofinanceService;
// @Autowired
// private CostApplycallbackService costApplycallbackService;
// @Autowired
// private CostCashiercallbackService costCashiercallbackService;
//
// ///http://api.fee.bailuntec.com/purchase/other/cost/check/lend/ApplyCallbackUrl
// @Value("${url.my.lendCostApplyCallBackUrlPost}")
// private String lendCostApplyCallBackUrlPost;
//
// ///purchase/other/cost/check/lend/CashierCallbackUrl
// @Value("${url.my.lendCostCashierCallbackUrlPost}")
// private String lendCostCashierCallbackUrlPost;
//
// //http://cw.bailuntec.com/API/API/Apply
// @Value("${url.api.postApplyApi}")
// private String postApplyApi;
//
// //http://oa.bailuntec.com/api/ExchangeRate/GetExchangeRate
// @Value("${url.api.getExchangeRateApi}")
// private String getExchangeRateApi;
//
//
//
//
//}
//package com.blt.other.module.cost.controller.cost;
//
//import com.blt.other.common.util.AxiosUtil;
//import com.blt.other.common.util.MyMapperUtil;
//import com.blt.other.module.cost.service.CostCheckSearchService;
//import com.blt.other.module.cost.vo.CostCheckSearchKeysVo;
//import com.blt.other.module.cost.model.CostDomain;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.util.Enumeration;
//import java.util.List;
//import java.util.Map;
//
//@RestController
//@RequestMapping("cost/check/search")
//public class CostCheckSearchController {
// private Logger logger = LoggerFactory.getLogger(CostCheckSearchController.class);
//
// @Autowired
// private CostCheckSearchService costCheckSearchService;
//
// /**
// * 获取费用系统 财务审核列表
// * @param request
// * @param response
// * @return
// */
// @GetMapping("getCostCheckList")
// public Map<String,Object> getCostCheckList(HttpServletRequest request, HttpServletResponse response){
// AxiosUtil.setCors(response,request);
//
// String pageNumStr = request.getParameter("pageNum");
// Integer pageNum = null;
// if (null != pageNumStr && !pageNumStr.isEmpty()){
// pageNum = Integer.parseInt(pageNumStr);
// }
// String pageSizeStr = request.getParameter("pageSize");
// Integer pageSize = null;
// if (null != pageSizeStr && !pageSizeStr.isEmpty()){
// pageSize = Integer.parseInt(pageSizeStr);
// }
//
// Integer userId = Integer.valueOf(request.getParameter("userId"));
// String authority = costCheckSearchService.findAuthorityByUserid(userId);
// Map<String, Object> all = costCheckSearchService.getAll(pageNum, pageSize, authority);
// return all;
// }
//
// /**
// * 根据关键字模糊查询
// * @param response
// * @param request
// * @return
// */
// @PostMapping("/key")
// public Map<String,Object> getListByKey(HttpServletResponse response,HttpServletRequest request){
// AxiosUtil.setCors(response,request);
// String key = request.getParameter("key");
// String pageSizeStr = request.getParameter("pageSize");
// String pageNumStr = request.getParameter("pageNum");
// Integer userId = Integer.valueOf(request.getParameter("userId"));
// String authority = costCheckSearchService.findAuthorityByUserid(userId);
// Map<String, Object> map = costCheckSearchService.seachByKey(key,Integer.parseInt(pageNumStr),Integer.parseInt(pageSizeStr), authority);
// map.put("success",true);
// return map;
// }
//
// @PostMapping("/keys")
// public Map<String,Object> getListByKeys(HttpServletResponse response,HttpServletRequest request){
// AxiosUtil.setCors(response,request);
// Enumeration<String> parameterNames = request.getParameterNames();
// if (null != parameterNames && parameterNames.hasMoreElements()){
// String s = parameterNames.nextElement();
// CostCheckSearchKeysVo searchKeysVo = (CostCheckSearchKeysVo)MyMapperUtil.getObject(s, CostCheckSearchKeysVo.class);
// if (null != searchKeysVo.getParams().getKeys().getCostForm() && 3 ==searchKeysVo.getParams().getKeys().getCostForm()){
// searchKeysVo.getParams().getKeys().setIsLend(1);
// } else if (null != searchKeysVo.getParams().getKeys().getCostForm() && 4 ==searchKeysVo.getParams().getKeys().getCostForm()){
// searchKeysVo.getParams().getKeys().setCostForm(3);
// searchKeysVo.getParams().getKeys().setIsLend(2);
// }
// String authority = costCheckSearchService.findAuthorityByUserid(searchKeysVo.getParams().getKeys().getUserId());
// searchKeysVo.getParams().getKeys().setAuthority(authority);
// Map<String, Object> map = costCheckSearchService.searchByKeys(searchKeysVo);
// map.put("success",true);
// return map;
// }
// return null;
// }
//
// @GetMapping("/getLinkCost")
// public List<CostDomain> getLinkCost(HttpServletResponse response, HttpServletRequest request){
// AxiosUtil.setCors(response,request);
// List<CostDomain> list = costCheckSearchService.getLinkCost();
// return list;
// }
//}
...@@ -40,7 +40,37 @@ public class Lend2PayCostServiceImpl extends AbstractCostService implements Cost ...@@ -40,7 +40,37 @@ public class Lend2PayCostServiceImpl extends AbstractCostService implements Cost
@Override @Override
public void toFinancial(CostDomain cost) { public void toFinancial(CostDomain cost) {
if (cost.getLendBalance().compareTo(BigDecimal.ZERO) <= 0) { if (cost.getLendBalance().compareTo(BigDecimal.ZERO) <= 0) {
throw new BizRuntimeException("invalid amount"); // 付款成功,更改借还单信息,否则返回失败
String sonNo = cost.getCostNo().toUpperCase();
cost.setCostStatus(CostDomain.STATUS_PAYED);
cost.setPayTime(new Date());
BigDecimal toRmbRate = CurUtils.getCur(cost.getDic(), "CNY");
cost.setToRmbRate(toRmbRate);
cost.setAmountRmb(cost.getAmount().multiply(toRmbRate).setScale(2, BigDecimal.ROUND_HALF_UP));
cost.setAuditTime(new Date());
costDao.updateById(cost);
//借还单
if (!sonNo.contains("S")) {
//关联借支单
CostDomain supCostDomain = this.getCostByCostNo(cost.getSupCostNo());
// 借还单在出纳完成收付款后,不用直接获取返回的金额(使用费用系统中记录的提交金额,出纳系统结算的实时汇率和费用系统不一定一致)
supCostDomain.setHadPay(supCostDomain.getHadPay().add(cost.getAmount()));
if (supCostDomain.getHadPay().compareTo(supCostDomain.getAmount()) == 0) {
//结清
supCostDomain.setLendStatus(4);
} else if (supCostDomain.getHadPay().compareTo(supCostDomain.getAmount()) < 0) {
//部分结清
supCostDomain.setLendStatus(2);
} else if (supCostDomain.getHadPay().compareTo(supCostDomain.getAmount()) > 0) {
//todo 邮件通知
log.error("金额异常 联系管理员,costNo:{}", supCostDomain.getCostNo());
}
costDao.updateById(supCostDomain);
}
return;
} }
PostApplyReq req = super.buildPostApplyReq(cost); PostApplyReq req = super.buildPostApplyReq(cost);
......
...@@ -74,11 +74,11 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme ...@@ -74,11 +74,11 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme
return 1; return 1;
} }
//确认冲销金额
private void affirmCounteract(String costPlanNo) { private void affirmCounteract(String costPlanNo) {
CostPlanDomain costPlanDomain = costPlanDao.selectByNo(costPlanNo); CostPlanDomain costPlanDomain = costPlanDao.selectByNo(costPlanNo);
//已确认 //已确认
costPlanDomain.setCostPlanStatus(1); costPlanDomain.setCostPlanStatus(1);
costPlanDao.updateById(costPlanDomain); costPlanDao.updateById(costPlanDomain);
...@@ -93,12 +93,13 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme ...@@ -93,12 +93,13 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme
//借还单冲销金额 (借支单币种) //借还单冲销金额 (借支单币种)
BigDecimal counteract = costPlanDomain.getCounteract(); BigDecimal counteract = costPlanDomain.getCounteract();
if (counteract.compareTo(BigDecimal.ZERO) < 0) { if (counteract.compareTo(BigDecimal.ZERO) <= 0) {
return; return;
} }
// 2.1、冲销刚好抵消差额 / 冲销小于差额 ===== 生成一张无需推送财务系统的借还单 // 2.1、冲销刚好抵消差额 / 冲销小于差额 ===== 生成一张无需推送财务系统的借还单
if (counteract.compareTo(subtract) <= 0) { if (counteract.compareTo(subtract) <= 0) {
costPlanDomain.setLendBalance(BigDecimal.ZERO);
CostDomain costDomain = planToCost(costPlanDomain.getCostPlanNo()); CostDomain costDomain = planToCost(costPlanDomain.getCostPlanNo());
costDomain.setCostNo(getCostNo()); costDomain.setCostNo(getCostNo());
//待提交 //待提交
...@@ -122,6 +123,7 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme ...@@ -122,6 +123,7 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme
// 冲销大于差额 ===== 生成一张无需收款的借还单 + 一张付款单(出纳回调接口和财务审核接口改为借还出纳回调接口,费用单号以 “S” 打头) // 冲销大于差额 ===== 生成一张无需收款的借还单 + 一张付款单(出纳回调接口和财务审核接口改为借还出纳回调接口,费用单号以 “S” 打头)
else { else {
log.info("冲销大于差额 ===== 准备生成一张无需收款的借还单 + 一张付款单(出纳回调接口和财务审核接口改为借还出纳回调接口,费用单号以 “S” 打头)"); log.info("冲销大于差额 ===== 准备生成一张无需收款的借还单 + 一张付款单(出纳回调接口和财务审核接口改为借还出纳回调接口,费用单号以 “S” 打头)");
costPlanDomain.setLendBalance(BigDecimal.ZERO);
CostDomain costDomain = planToCost(costPlanDomain.getCostPlanNo()); CostDomain costDomain = planToCost(costPlanDomain.getCostPlanNo());
costDomain.setCostNo(getCostNo()); costDomain.setCostNo(getCostNo());
costDomain.setCostStatus(0); costDomain.setCostStatus(0);
...@@ -215,7 +217,7 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme ...@@ -215,7 +217,7 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme
BigDecimal subtract = supCost.getAmount().subtract(supCost.getHadPay()); BigDecimal subtract = supCost.getAmount().subtract(supCost.getHadPay());
//借还单余额 //借还单余额
BigDecimal lendBalance = costPlanDomain.getLendBalance(); BigDecimal lendBalance = costPlanDomain.getLendBalance();
if (lendBalance.compareTo(BigDecimal.ZERO) < 0) { if (lendBalance.compareTo(BigDecimal.ZERO) <= 0) {
return; return;
} }
...@@ -223,6 +225,7 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme ...@@ -223,6 +225,7 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme
throw new BizRuntimeException("冲销后归还金额 > 借支单待归还金额"); throw new BizRuntimeException("冲销后归还金额 > 借支单待归还金额");
} }
costPlanDomain.setCounteract(BigDecimal.ZERO);
CostDomain costDomain = planToCost(costPlanDomain.getCostPlanNo()); CostDomain costDomain = planToCost(costPlanDomain.getCostPlanNo());
costDomain.setCostNo(getCostNo()); costDomain.setCostNo(getCostNo());
costDomain.setCostStatus(0); costDomain.setCostStatus(0);
......
...@@ -79,7 +79,6 @@ public class OtherApplicationTests { ...@@ -79,7 +79,6 @@ public class OtherApplicationTests {
oaUserService.saveBatch(oaUserList); oaUserService.saveBatch(oaUserList);
// oaDepartmentService.saveBatch(oaDepartmentList); // oaDepartmentService.saveBatch(oaDepartmentList);
} }
private OaDepartment getPrimaryDepartment(Map<Integer, OaDepartment> departmentMap, OaDepartment oaDepartment) { private OaDepartment getPrimaryDepartment(Map<Integer, OaDepartment> departmentMap, OaDepartment oaDepartment) {
......
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