Commit 8b549795 by huluobin

# 费用系统之屑

parent c6b39183
......@@ -24,6 +24,13 @@
<packaging>jar</packaging>
<dependencies>
<!--spring boot自动配置-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!--mp 增加Mybatis-->
<dependency>
<groupId>com.baomidou</groupId>
......
......@@ -14,37 +14,37 @@ import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
@FeignClient(name = "bailuntec-cost-api", url = "http://api.fee.bailuntec.com/purchase/other/cost/api")
@FeignClient(name = "bailuntec-cost-api", url = "http://api.fee.bailuntec.com/purchase/other")
public interface CostApi {
@ApiOperation("接受工资单,自动生成付款费用单到财务审核")
@PostMapping("/pushWageCost")
@PostMapping("/cost/api/pushWageCost")
CostResult<Void> pushWageCost(@RequestBody WageCostDto wageCostDto) throws IOException;
@ApiOperation("接收物流单,自动生成付款费用单到财务审核")
@PostMapping("/pushLogisticsCost")
@PostMapping("/cost/api/pushLogisticsCost")
CostResult<Void> pushLogisticsCost(@RequestBody LogisticsCostDto logisticsCostDto) throws Exception;
@ApiOperation("吴通接收物流单,自动生成收款费用单到财务审核")
@PostMapping("/pushLogisticsReceipt")
@PostMapping("/cost/api/pushLogisticsReceipt")
CostResult<Void> pushLogisticsReceipt(@RequestBody LogisticsCostDto logisticsCostDto) throws Exception;
@ApiOperation("获取所有费用单和采购单")
@PostMapping("/manageCostList")
@PostMapping("/cost/api/manageCostList")
CostResult<List<ManageCostDto>> manageCostList(@RequestBody ManageCostListReq req);
@GetMapping("/noPayCost")
@GetMapping("/cost/api/noPayCost")
@ApiOperation("查询原来传输到数据中心时为待支付状态 变成 已支付状态后的费用单")
CostResult<List<CostDto>> getNoPayCost(@RequestParam(name = "costNoList") List<String> costNoList);
@ApiOperation("吴通新增 根据费用单号获取费用单大类")
@GetMapping("/type/{costNo}")
@GetMapping("/cost/api/type/{costNo}")
CostResult<String> getTypeName(@PathVariable("costNo") String costNo);
@ApiOperation("获取费用系统列表")
@GetMapping({"/getCostList"})
@GetMapping({"/cost/api/getCostList"})
CostResult<List<CostDto>> getCostList(@RequestParam(name = "startDate") String stKartDate,
@RequestParam(name = "endDate") String endDate,
@RequestParam(name = "pageNum") Integer pageNum,
......
package com.bailuntec.cost.api;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2021/1/18 9:36 上午
*/
public class CostApiConfig {
}
......@@ -42,15 +42,15 @@ public class ManageCostDto {
private String feeSuperType;
// 费用小类
private String feeSubType;
@JSONField(name = "cashier_paymoney")
// 金额
private BigDecimal amount;
@JSONField(name = "cashier_unitcode")
// 币种
private String currency;
// 人民币金额
private BigDecimal amountRmb;
@JSONField(name = "cashier_paymoneyrmb")
private BigDecimal amountRmb; // 人民币金额
//费用单Id
private Integer costId;
//费用单详情Id
......
......@@ -15,11 +15,6 @@ public class ManageCostListReq {
private String startDateStr;
private String endDateStr;
private String feeSuperType;
private String feeSubType;
private Integer companyValue;
private String companyName;
private String departmentName;
private Integer createUserId;
private Integer payUserId;
}
cost.api: http://api.fee.bailuntec.com/purchase/other/
cost.api: http://api.fee.bailuntec.com/purchase/other/
......@@ -8,8 +8,8 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.blt.other.module.cost.model.CostTemplate;
import com.blt.other.database.mapper.StatusMapper;
import com.blt.other.module.cost.model.CostTemplate;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -41,11 +41,31 @@ public class CostPlanDomain implements Serializable {
@ApiModelProperty("主体名称")
private String companyName;
@ApiModelProperty("类型编号")
private Integer typeId;
@TableField(exist = false)
@ApiModelProperty("类型编号")
private String typeNo;
@TableField(exist = false)
@ApiModelProperty("类型标题")
private String typeName;
// @TableField(exist = false)
// private CostTypeDomain costType;
private Integer accountingSubjectId;
@TableField(exist = false)
@ApiModelProperty("会计一级科目")
private String accountingSubjectNo;
@TableField(exist = false)
@ApiModelProperty("会计一级科目")
private String accountingSubjectName;
// @TableField(exist = false)
// private AccountingSubject accountingSubject;
@ApiModelProperty("创建人id")
private Integer createUserid;
@ApiModelProperty("创建人编号")
......@@ -135,11 +155,6 @@ public class CostPlanDomain implements Serializable {
@ApiModelProperty("费用模版id")
private Integer costTemplateId;
@ApiModelProperty("会计一级科目")
private String accountingSubjectNo;
@ApiModelProperty("会计一级科目")
private String accountingSubjectName;
///-------
@TableField(exist = false)
......
......@@ -3,10 +3,12 @@ package com.blt.other.database.model;
import com.bailuntec.common.SpringContextUtil;
import com.bailuntec.cost.api.dto.CostPlanTempDto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.blt.other.common.util.PathUtil;
import com.blt.other.module.cost.dao.CostTypeDao;
import com.blt.other.module.cost.model.AccountingSubject;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;
......@@ -33,12 +35,24 @@ public class CostPlanTempDomain {
private String costReason;
// 币种
private String dic;
// 大类编号
@ApiModelProperty("类型编号")
private Integer typeId;
@TableField(exist = false)
@ApiModelProperty("类型编号")
private String typeNo;
// 会计一级科目
@TableField(exist = false)
@ApiModelProperty("类型标题")
private String typeName;
// @TableField(exist = false)
// private CostTypeDomain costType;
private Integer accountingSubjectId;
@TableField(exist = false)
@ApiModelProperty("会计一级科目")
private String accountingSubjectNo;
//会计一级科目
@TableField(exist = false)
@ApiModelProperty("会计一级科目")
private String accountingSubjectName;
......@@ -58,7 +72,7 @@ public class CostPlanTempDomain {
CostPlanTempDto dto = new CostPlanTempDto();
BeanUtils.copyProperties(this, dto);
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(typeNo);
CostTypeDomain costTypeDomain = costTypeDao.selectById(typeId);
if (costTypeDomain != null) {
dto.setTypeNameDto(costTypeDomain.getTypeName());
}
......
......@@ -32,7 +32,9 @@ public class CostTypeDomain {
@ApiModelProperty("费用类型标题")
private String typeName;
private String accountingSubjectNo;
// private String accountingSubjectNo;
private Integer accountingSubjectId;
private Boolean isManageCost;
......
......@@ -154,7 +154,7 @@ public class CostController {
costDomain.setFilePath(filePath);
UpdateCostResp resp = costService.updateCost(costDomain);
costLogService.save(costNo, costDao.selectByCostNo(costNo).getCreateUserid(), "修改发票信息");
costLogService.save(costNo, costService.getCostByCostNo(costNo).getCreateUserid(), "修改发票信息");
return resp;
}
......@@ -165,7 +165,7 @@ public class CostController {
costService = CostServiceFactory.getCostService(costDomain);
UpdateCostResp resp = costService.updateCost(costDomain);
costLogService.save(costDomain.getCostNo(), costDao.selectByCostNo(costDomain.getCostNo()).getCreateUserid(), "修改费用单信息");
costLogService.save(costDomain.getCostNo(), costService.getCostByCostNo(costDomain.getCostNo()).getCreateUserid(), "修改费用单信息");
return resp;
}
......@@ -184,7 +184,7 @@ public class CostController {
UpdateCostResp resp = new UpdateCostResp();
resp.setMsg("success");
resp.setResult(costDao.selectByCostNo(costDomain.getCostNo()));
resp.setResult(costService.getCostByCostNo(costDomain.getCostNo()));
resp.setUpdate(1);
return resp;
......@@ -323,7 +323,7 @@ public class CostController {
costService = CostServiceFactory.getCostService(costNo);
costService.setStatus(costNo, 5);
costLogService.save(costNo, costDao.selectByCostNo(costNo).getCreateUserid(), "作废费用单");
costLogService.save(costNo, costService.getCostByCostNo(costNo).getCreateUserid(), "作废费用单");
return CostResult.success();
}
......
......@@ -8,6 +8,7 @@ import com.blt.other.database.model.CostExpDomain;
import com.blt.other.module.cost.dao.CostDao;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostExportService;
import com.blt.other.module.cost.service.CostService;
import com.blt.other.module.cost.vo.CostExportVo;
import io.swagger.annotations.Api;
import org.springframework.core.io.FileSystemResource;
......@@ -42,6 +43,8 @@ public class CostReportController {
CostExportService costExportService;
@Resource
CostDao costDao;
@Resource
CostService costService;
@PostMapping("/cost/list/exportList")
public String exportList(HttpServletResponse response, HttpServletRequest request) {
......@@ -111,7 +114,7 @@ public class CostReportController {
String detailNo = request.getParameter("detailNo");
CostDomain cost = costDao.selectByCostNo(detailNo);
CostDomain cost = costService.getCostByCostNo(detailNo);
String filePath = null;
String fileName = null;
if (null != cost) {
......
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.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
......@@ -20,21 +21,24 @@ public class CostDetailDomain {
private String costNo;
@ApiModelProperty("类型id")
@ApiModelProperty("类型编号")
private Integer typeId;
@TableField(exist = false)
@ApiModelProperty("类型编号")
private String typeNo;
@TableField(exist = false)
@ApiModelProperty("类型标题")
private String typeName;
@ApiModelProperty("会计科目id")
private Integer accountingSubjectId;
@TableField(exist = false)
@ApiModelProperty("会计一级科目")
private String accountingSubjectNo;
@TableField(exist = false)
@ApiModelProperty("会计一级科目")
private String accountingSubjectName;
@ApiModelProperty("创建人id")
private Integer createUserid;
@ApiModelProperty("创建人名称")
......
......@@ -75,18 +75,25 @@ public class CostDomain implements Serializable {
@ApiModelProperty("主体名称")
private String companyName;
@ApiModelProperty("类型id")
@ApiModelProperty("类型编号")
private Integer typeId;
@TableField(exist = false)
@ApiModelProperty("类型编号")
private String typeNo;
@TableField(exist = false)
@ApiModelProperty("描述")
private String description;
@TableField(exist = false)
@ApiModelProperty("类型标题")
private String typeName;
@ApiModelProperty("会计科目id")
private Integer accountingSubjectId;
@TableField(exist = false)
@ApiModelProperty("会计一级科目")
private String accountingSubjectNo;
@TableField(exist = false)
@ApiModelProperty("会计一级科目")
private String accountingSubjectName;
......@@ -250,6 +257,9 @@ public class CostDomain implements Serializable {
@TableField(exist = false)
private String costCurrentReviewer;
@TableField(exist = false)
private List<CostDetailDomain> costDetailDomainList;
private static final String REGEX_CHINESE = "[\u4e00-\u9fa5]";// 中文正则
......@@ -384,11 +394,12 @@ public class CostDomain implements Serializable {
public CostDto castToDto() {
StatusMapper statusMapper = SpringContextUtil.getBean(StatusMapper.class);
CostDto costDto = new CostDto();
BeanUtils.copyProperties(this, costDto);
StatusMapper statusMapper = SpringContextUtil.getBean(StatusMapper.class);
/*字典翻译*/
costDto.setCostStatusDto(statusMapper.getStatusValue("cost_status", this.getCostStatus()));
if (null != this.getIsLend()) {
......@@ -400,21 +411,21 @@ public class CostDomain implements Serializable {
if (null != this.getLendStatus()) {
costDto.setLendStatusDto(statusMapper.getStatusValue("lend_status", this.getLendStatus()));
}
// 抵个税
if (1 == costDto.getCostForm()) {
costDto.setIsTaxStr(statusMapper.getStatusValue("is_tax", costDto.getIsTax()));
}
// 获取文件名
String filePath = this.getFilePath();
if (null != filePath && filePath.contains("&")) {
String fileName = filePath.substring(filePath.lastIndexOf("&") + 1);
costDto.setFileName(fileName);
}
// 抵个税
if (1 == costDto.getCostForm()) {
costDto.setIsTaxStr(statusMapper.getStatusValue("is_tax", costDto.getIsTax()));
}
// 币种
costDto.setDicDto(CurUtils.getCurDto(costDto.getDic()));
costDto.setPayDicDto(CurUtils.getCurDto(costDto.getPayDic()));
//
DecimalFormat df = new DecimalFormat("#0.00");
if (null != costDto.getAmount()) {
String format = df.format(costDto.getAmount());
......@@ -436,20 +447,6 @@ public class CostDomain implements Serializable {
return costDto;
}
public static void main(String[] args) {
String filePath = "2132131.jpg";
if (StringUtils.isNotEmpty(filePath)) {
int i = filePath.lastIndexOf('.');
String extension = "";
if (i > 0) {
extension = filePath.substring(i + 1);
}
System.out.println(extension);
System.out.println(picFilter.contains(extension));
}
}
public void setCostTemplateIdByFrom() {
if (costForm == 1) {
this.costTemplateId = 3;
......
......@@ -13,8 +13,6 @@ public interface CostDetailService extends IService<CostDetailDomain> {
CostDetailDomain getCostDetailByDetailNo(String detailNo);
void deleteFilePath(String detailNo);
Integer update(CostDetailDomain domain);
ResetResp reset(ResetReq req);
......
......@@ -10,7 +10,6 @@ import com.blt.other.module.cost.dto.response.GetLogisticsCodeResp;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
public interface CostTypeService extends IService<CostTypeDomain> {
......@@ -71,4 +70,5 @@ public interface CostTypeService extends IService<CostTypeDomain> {
//导出
void exportExcel(HttpServletResponse response, CostTypeExportExcelReq req) throws IOException;
}
......@@ -12,6 +12,7 @@ import com.blt.other.module.cost.dto.request.AppCostPassReq;
import com.blt.other.module.cost.dto.request.AppCostRejectReq;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.AppCostService;
import com.blt.other.module.cost.service.CostService;
import com.blt.other.module.cost.service.impl.costcheck.*;
import org.springframework.stereotype.Service;
......@@ -30,7 +31,8 @@ public class AppCostServiceImpl implements AppCostService {
@Resource
CostDao costDao;
@Resource
CostService costService;
@Override
public Page<CostDto> appCheckCostList(AppCheckCostListReq req) {
......@@ -57,7 +59,7 @@ public class AppCostServiceImpl implements AppCostService {
}
private CostContext getCostState(String costNo, Integer oaUserId) {
CostDomain costDomain = costDao.selectByCostNo(costNo);
CostDomain costDomain = costService.getCostByCostNo(costNo);
CostState costState;
CostContext costContext;
switch (costDomain.getCostStatus()) {
......
......@@ -15,10 +15,10 @@ import com.blt.other.database.model.CostTypeDomain;
import com.blt.other.database.model.UserDomain;
import com.blt.other.module.auth.dao.UserDao;
import com.blt.other.module.cost.dao.*;
import com.blt.other.module.cost.model.AccountingSubject;
import com.blt.other.module.cost.model.CostDetailDomain;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostApiService;
import com.blt.other.module.cost.service.CostService;
import com.blt.other.module.cost.service.UserCostFinansysService;
import com.blt.other.module.cost.service.impl.costcheck.CostContext;
import com.blt.other.module.cost.service.impl.costcheck.FinancialCheckState;
......@@ -53,6 +53,8 @@ public class CostApiServiceImpl implements CostApiService {
CostLogDao costLogDao;
@Resource
CostCompanyDao costCompanyDao;
@Resource
CostService costService;
@Override
@Transactional
......@@ -66,8 +68,9 @@ public class CostApiServiceImpl implements CostApiService {
costDomain.setCostStatus(0);
costDomain.setCostRemark(logisticsCostDto.getCostRemark() + "【WMS系统推送】");
costDomain.setCostReason(logisticsCostDto.getCostReason());
costDomain.setTypeNo("CTN1809180519188");
costDomain.setTypeName("销售费用/物流费");
costDomain.setTypeId(5028);
// costDomain.setTypeNo("CTN1809180519188");
// costDomain.setTypeName("销售费用/物流费");
costDomain.setCompanyName("香港百伦科技有限公司");
costDomain.setCompanyNo("COM1806191800013");
......@@ -157,7 +160,7 @@ public class CostApiServiceImpl implements CostApiService {
@Override
public CostDomain getCostDetails(String costNo) {
return costDao.selectByCostNo(costNo);
return costService.getCostByCostNo(costNo);
}
@Resource
......@@ -179,12 +182,8 @@ public class CostApiServiceImpl implements CostApiService {
//类型信息
CostTypeDomain costTypeDomain = costTypeDao.selectByNameAndType("工资", CostTypeDomain.feeType);
AccountingSubject accountingSubject = accountingSubjectMapper.selectByNo(costTypeDomain.getAccountingSubjectNo());
costDomain.setTypeNo(costTypeDomain.getTypeName());
costDomain.setTypeName(costTypeDomain.getTypeName());
costDomain.setAccountingSubjectNo(accountingSubject.getSubjectNo());
costDomain.setAccountingSubjectName(accountingSubject.getName());
costDomain.setTypeId(costTypeDomain.getId());
costDomain.setAccountingSubjectId(costTypeDomain.getAccountingSubjectId());
//公司
CostCompanyDomain costCompany = costCompanyDao.selectByName(wageCostDto.getCompanyName());
......
......@@ -5,15 +5,15 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.module.auth.dao.OaUserMapper;
import com.blt.other.module.sys.model.CostReviewer;
import com.blt.other.module.auth.model.OaUser;
import com.blt.other.module.cost.dao.CostCurrentReviewerMapper;
import com.blt.other.module.cost.dao.CostDao;
import com.blt.other.module.cost.dto.request.TransferReviewReq;
import com.blt.other.module.cost.model.CostCurrentReviewer;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostLogService;
import com.blt.other.module.cost.service.CostService;
import com.blt.other.module.cost.service.ICostCurrentReviewerService;
import com.blt.other.module.sys.model.CostReviewer;
import com.google.common.collect.Lists;
import org.springframework.stereotype.Service;
......@@ -37,7 +37,7 @@ public class CostCurrentReviewerServiceImpl extends ServiceImpl<CostCurrentRevie
@Resource
CostLogService costLogService;
@Resource
CostDao costDao;
CostService costService;
@Override
......@@ -91,7 +91,7 @@ public class CostCurrentReviewerServiceImpl extends ServiceImpl<CostCurrentRevie
@Override
public void transferReview(TransferReviewReq req) {
CostDomain costDomain = costDao.selectByCostNo(req.getCostNo());
CostDomain costDomain = costService.getCostByCostNo(req.getCostNo());
if (!Lists.newArrayList(CostDomain.STATUS_HR_CHECK,
CostDomain.STATUS_DEPARTMENT_CHECK,
......
package com.blt.other.module.cost.service.impl;
import com.bailuntec.common.BeanUtils;
import com.bailuntec.common.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blt.other.common.util.PathUtil;
import com.blt.other.database.model.CostTypeDomain;
import com.blt.other.module.cost.dao.AccountingSubjectMapper;
import com.blt.other.module.cost.dao.CostDetailDao;
import com.blt.other.module.cost.dao.CostTypeDao;
import com.blt.other.module.cost.dto.request.ResetReq;
import com.blt.other.module.cost.dto.response.ResetResp;
import com.blt.other.module.cost.model.AccountingSubject;
import com.blt.other.module.cost.model.CostDetailDomain;
import com.blt.other.module.cost.service.CostDetailService;
import com.blt.other.module.cost.service.CostService;
......@@ -39,11 +38,6 @@ public class CostDetailServiceImpl extends ServiceImpl<CostDetailDao, CostDetail
return costDetailDao.selectByDetailNo(detailNo);
}
@Override
public void deleteFilePath(String detailNo) {
costDetailDao.deletedFilePath(detailNo);
}
@Transactional
@Override
......@@ -55,8 +49,7 @@ public class CostDetailServiceImpl extends ServiceImpl<CostDetailDao, CostDetail
@Resource
CostTypeDao costTypeDao;
@Resource
AccountingSubjectMapper accountingSubjectMapper;
@Override
public ResetResp reset(ResetReq req) {
......@@ -70,16 +63,13 @@ public class CostDetailServiceImpl extends ServiceImpl<CostDetailDao, CostDetail
String path = CostFileUtil.upload(req.getFileSelect2(), filePath);
costDetailDomain.setFilePath(path);
}
if (req.getTypeNo() != null) {
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(req.getTypeNo());
costDetailDomain.setTypeName(costTypeDomain.getTypeName());
AccountingSubject accountingSubject = accountingSubjectMapper.selectByNo(costTypeDomain.getAccountingSubjectNo());
costDetailDomain.setAccountingSubjectName(accountingSubject.getName());
if (StringUtils.isNotEmpty(req.getTypeNo())) {
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(req.getTypeNo());
costDetailDomain.setTypeId(costTypeDomain.getId());
costDetailDomain.setAccountingSubjectId(costTypeDomain.getAccountingSubjectId());
}
baseMapper.updateById(costDetailDomain);
costService.resetCost(costDetailDomain.getCostNo());
......
......@@ -187,7 +187,7 @@ public class CostExportServiceImpl implements CostExportService {
if (null != exportNos && exportNos.size() >= 1) {
exportList = new ArrayList<>();
for (String costNo : exportNos) {
CostDto costDtoByNo = costDao.selectByCostNo(costNo).castToDto();
CostDto costDtoByNo = costService.getCostByCostNo(costNo).castToDto();
if (1 == costDtoByNo.getCostForm()) {
// 付款单,将子项目赋值到 CostDto 逐一打印
List<CostDetailDomain> costDetailDomains = costDetailDao.selectListByCostNo(costNo);
......
......@@ -54,7 +54,7 @@ public class CostListSearchServiceImpl implements CostListSearchService {
PageInfo<CostDomain> pageInfo = new PageInfo<>(domains);
if (null != searchKeysVo.getParams().getKeys().getLinkCost() && !searchKeysVo.getParams().getKeys().getLinkCost().isEmpty()) {
List<CostDomain> list = new ArrayList<>();
CostDomain supCost = costDao.selectByCostNo(searchKeysVo.getParams().getKeys().getLinkCost());
CostDomain supCost = costService.getCostByCostNo(searchKeysVo.getParams().getKeys().getLinkCost());
list.add(supCost);
if (null != domains && domains.size() >= 1) {
list.addAll(domains);
......
......@@ -12,7 +12,7 @@ import com.blt.other.module.cost.dao.CostDao;
import com.blt.other.module.cost.dao.CostLogDao;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostLogService;
import com.blt.other.module.sys.dao.DepartmentReviewerMapper;
import com.blt.other.module.cost.service.CostService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -68,7 +68,7 @@ public class CostLogServiceImpl implements CostLogService {
@Resource
CostCompanyDao costCompanyDao;
@Resource
DepartmentReviewerMapper departmentReviewerMapper;
CostService costService;
@Override
public void saveByManage(String costNo, String updateMainNote, Integer type) {
......@@ -76,51 +76,12 @@ public class CostLogServiceImpl implements CostLogService {
costLog.setCostNo(costNo);
costLog.setUpdateTime(new Date());
CostDomain costDomain = costDao.selectByCostNo(costNo);
CostDomain costDomain = costService.getCostByCostNo(costNo);
OaUser costUser = oaUserMapper.selectByOaUserId(costDomain.getCreateUserid());
CostCompanyDomain costCompany = costCompanyDao.selectByNo(costDomain.getCompanyNo());
OaUser reviewer = OaUser.DEFAULT;
// //部门自动审核日志
// if (type.equals(CostLogDomain.DEPARTMENT_AUTO_PASS)) {
//
// DepartmentReviewer departmentReviewer = departmentReviewerMapper.selectByPrimaryDepartmentId(costUser.getPrimaryDepartmentId());
//
// reviewer = costReviewerMapper.selectList(new LambdaQueryWrapper<CostReviewer>()
// .eq(CostReviewer::getType, CostReviewer.departmentReviewer)
// .eq(CostReviewer::getReferId, departmentReviewer.getId()))
// .stream()
// .limit(1)
// .findAny()
// .map(costReviewer -> oaUserMapper.selectByOaUserId(costReviewer.getReviewerUserId()))
// .orElse(OaUser.DEFAULT);
// }
// //财务自动审核日志
// else if (type.equals(CostLogDomain.FINANCIAL_AUTO_PASS)) {
// reviewer = costReviewerMapper.selectList(new LambdaQueryWrapper<CostReviewer>()
// .eq(CostReviewer::getType, CostReviewer.financialReviewer)
// .eq(CostReviewer::getReferId, costCompany.getId()))
// .stream()
// .limit(1)
// .findAny()
// .map(costReviewer -> oaUserMapper.selectByOaUserId(costReviewer.getReviewerUserId()))
// .orElse(OaUser.DEFAULT);
// }
// //最终审核自动审核日志
// else if (type.equals(CostLogDomain.FINAL_AUTO_PASS)) {
// reviewer = costReviewerMapper.selectList(new LambdaQueryWrapper<CostReviewer>()
// .eq(CostReviewer::getType, CostReviewer.finalReviewer)
// .eq(CostReviewer::getReferId, costCompany.getId()))
// .stream()
// .limit(1)
// .findAny()
// .map(costReviewer -> oaUserMapper.selectByOaUserId(costReviewer.getReviewerUserId()))
// .orElse(OaUser.DEFAULT);
// } else {
// throw new BizRuntimeException("invalid param");
// }
costLog.setUpdateUsercode(reviewer.getUserCode());
costLog.setUpdateUsername(reviewer.getUserName());
costLog.setUpdateUserid(reviewer.getOaUserId());
......
......@@ -77,13 +77,13 @@ public class CostTypeImportExcelItemListener extends AnalysisEventListener<CostT
CostTypeDomain costTypeDomain = costTypeDao.selectOne(new LambdaQueryWrapper<CostTypeDomain>()
.eq(CostTypeDomain::getTypeName, item.getTypeName())
.eq(CostTypeDomain::getAccountingSubjectNo, accountingSubject.getSubjectNo()));
.eq(CostTypeDomain::getAccountingSubjectId, accountingSubject.getId()));
if (costTypeDomain == null) {
costTypeDomain = new CostTypeDomain();
costTypeDomain.setTypeNo(IdWorker.getIdStr());
costTypeDomain.setTypeName(item.getTypeName());
costTypeDomain.setDescription(item.getTypeDesc());
costTypeDomain.setAccountingSubjectNo(accountingSubject.getSubjectNo());
costTypeDomain.setAccountingSubjectId(accountingSubject.getId());
costTypeDomain.setCostTemplateType(costTemplateType);
costTypeDomain.setUpdateUserId(sysUser.getOaUserId());
......
......@@ -18,6 +18,7 @@ import com.blt.other.module.cost.dto.response.CostTypeExportExcelItem;
import com.blt.other.module.cost.dto.response.CostTypeResult;
import com.blt.other.module.cost.dto.response.GetLogisticsBankResp;
import com.blt.other.module.cost.dto.response.GetLogisticsCodeResp;
import com.blt.other.module.cost.model.AccountingSubject;
import com.blt.other.module.cost.service.CostTypeKindService;
import com.blt.other.module.cost.service.CostTypeService;
import lombok.extern.slf4j.Slf4j;
......@@ -42,7 +43,9 @@ public class CostTypeServiceImpl extends ServiceImpl<CostTypeDao, CostTypeDomain
@Override
public void addCostType(CostTypeAddReq req) {
CostTypeDomain costTypeDomain = new CostTypeDomain();
costTypeDomain.setAccountingSubjectNo(req.getAccountingSubjectNo());
AccountingSubject accountingSubject = accountingSubjectMapper.selectByNo(req.getAccountingSubjectNo());
costTypeDomain.setAccountingSubjectId(accountingSubject.getId());
costTypeDomain.setTypeNo(IdWorker.getIdStr());
costTypeDomain.setTypeName(req.getTypeName());
costTypeDomain.setDescription(req.getDescription());
......@@ -56,7 +59,7 @@ public class CostTypeServiceImpl extends ServiceImpl<CostTypeDao, CostTypeDomain
if (req.getType().equals(1)) {
CostTypeDomain lendCostTypeDomain = new CostTypeDomain();
lendCostTypeDomain.setCostTemplateType(CostTypeDomain.borrow);
lendCostTypeDomain.setAccountingSubjectNo("1345912843756503041");
lendCostTypeDomain.setAccountingSubjectId(43);
lendCostTypeDomain.setTypeNo(IdWorker.getIdStr());
lendCostTypeDomain.setTypeName(req.getTypeName());
lendCostTypeDomain.setDescription(req.getDescription());
......@@ -86,7 +89,9 @@ public class CostTypeServiceImpl extends ServiceImpl<CostTypeDao, CostTypeDomain
costTypeDomain.setUpdateUserId(oaUser.getOaUserId());
costTypeDomain.setUpdateUser(oaUser.getUserName());
costTypeDomain.setLastUpdateTime(LocalDateTime.now());
costTypeDomain.setAccountingSubjectNo(req.getAccountingSubjectNo());
AccountingSubject accountingSubject = accountingSubjectMapper.selectByNo(req.getAccountingSubjectNo());
costTypeDomain.setAccountingSubjectId(accountingSubject.getId());
costTypeDomain.setIsManageCost(req.getIsManageCost());
......
......@@ -136,7 +136,6 @@ public abstract class AbstractCostService implements CostService {
}
});
}
}
@Resource
......@@ -155,6 +154,10 @@ public abstract class AbstractCostService implements CostService {
}
costDomain.setCanAudit(costCurrentReviewerService.canAudit(currentUserId, costNo));
List<CostDetailDomain> costDetailDomainList = costDetailDao.selectListByCostNo(costNo);
costDomain.setCostDetailDomainList(costDetailDomainList);
return costDomain;
}
......@@ -188,7 +191,7 @@ public abstract class AbstractCostService implements CostService {
resp.setMsg("success");
resp.setResult(costDao.selectByCostNo(costDomain.getCostNo()));
resp.setResult(this.getCostByCostNo(costDomain.getCostNo()));
resp.setUpdate(update);
return resp;
......@@ -218,18 +221,14 @@ public abstract class AbstractCostService implements CostService {
for (CostDetailDomain domain : costDetailDomains) {
amount = amount.add(domain.getAmount());
}
CostDomain costDomain = costDao.selectByCostNo(costNo);
CostDomain costDomain = this.getCostByCostNo(costNo);
costDomain.setAmount(amount);
BigDecimal toRmbRate = CurUtils.getCur(costDomain.getDic(), "CNY");
costDomain.setToRmbRate(toRmbRate);
costDomain.setAmountRmb(costDomain.getAmount().multiply(toRmbRate).setScale(2, BigDecimal.ROUND_HALF_UP));
costDomain.setTypeNo(costDetailDomains.get(0).getTypeNo());
costDomain.setTypeName(costDetailDomains.get(0).getTypeName());
costDomain.setTypeId(costDetailDomains.get(0).getTypeId());
costDomain.setLastModifyDate(LocalDateTime.now());
costDao.updateById(costDomain);
......@@ -244,7 +243,7 @@ public abstract class AbstractCostService implements CostService {
costDomain.setLastModifyDate(LocalDateTime.now());
if (costDomain.getCostStatus().equals(5)) {
//释放已申请的金额
CostDomain supCost = costDao.selectByCostNo(costDomain.getSupCostNo());
CostDomain supCost = this.getCostByCostNo(costDomain.getSupCostNo());
if (supCost != null) {
supCost.setRepaymentAppliedAmount(supCost.getRepaymentAppliedAmount().subtract(costDomain.getAmount()));
......@@ -264,7 +263,7 @@ public abstract class AbstractCostService implements CostService {
@Override
public void updateCashierAnnex(String costNo, String filePath, String downloadUrl) {
CostDomain costDomain = costDao.selectByCostNo(costNo);
CostDomain costDomain = this.getCostByCostNo(costNo);
costDomain.setCashierFilePath(filePath);
costDomain.setCashierDownloadPath(downloadUrl);
costDomain.setLastModifyDate(LocalDateTime.now());
......@@ -366,7 +365,7 @@ public abstract class AbstractCostService implements CostService {
costCashiercallbackDomain.setPayno(costCashiercallbackDomain.getPayno().toUpperCase());
CostDomain costDomain = costDao.selectByCostNo(costNo);
CostDomain costDomain = this.getCostByCostNo(costNo);
//
if (!costDomain.getCostStatus().equals(CostDomain.STATUS_UN_PAY)) {
return;
......@@ -387,16 +386,16 @@ public abstract class AbstractCostService implements CostService {
if (costNo.startsWith("S")) {
//费用计划
CostDomain costDomain = costDao.selectByCostNo(costNo);
CostDomain costDomain = this.getCostByCostNo(costNo);
//费用计划关联借支单
CostDomain supCost = costDao.selectByCostNo(costDomain.getSupCostNo());
CostDomain supCost = this.getCostByCostNo(costDomain.getSupCostNo());
supCost.setCompensate(supCost.getCompensate().subtract(costDomain.getAmount()));
costDomain.setLastModifyDate(LocalDateTime.now());
costDao.updateById(supCost);
}
CostDomain costDomain = costDao.selectByCostNo(costNo);
CostDomain costDomain = this.getCostByCostNo(costNo);
costDomain.setCostStatus(CostDomain.STATUS_REJECT);
costDomain.setLastModifyDate(LocalDateTime.now());
costDao.updateById(costDomain);
......
......@@ -115,8 +115,8 @@ public class Lend2PayCostServiceImpl extends AbstractCostService implements Cost
super.reject(costNo);
//释放已申请的金额
CostDomain costDomain = costDao.selectByCostNo(costNo);
CostDomain supCost = costDao.selectByCostNo(costDomain.getSupCostNo());
CostDomain costDomain = this.getCostByCostNo(costNo);
CostDomain supCost = this.getCostByCostNo(costDomain.getSupCostNo());
supCost.setRepaymentAppliedAmount(supCost.getRepaymentAppliedAmount().subtract(costDomain.getAmount()));
supCost.setLastModifyDate(LocalDateTime.now());
......
......@@ -4,7 +4,6 @@ import com.bailuntec.common.ListUtil;
import com.bailuntec.cost.api.dto.CostPlanDto;
import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.database.model.*;
import com.blt.other.module.auth.dao.OaUserMapper;
import com.blt.other.module.auth.dao.UserDao;
import com.blt.other.module.cost.dao.*;
import com.blt.other.module.cost.dto.request.GetAllCostPlanReq;
......@@ -62,6 +61,8 @@ public abstract class AbstractCostPlanService implements CostPlanService {
CostLogService costLogService;
@Autowired
CostDetailDao costDetailDao;
@Resource
CostService costService;
void check(CostPlanDomain planDomain) {
......@@ -115,6 +116,9 @@ public abstract class AbstractCostPlanService implements CostPlanService {
});
}
CostTypeDomain costTypeDomain = costTypeDao.selectById(costPlanDomain.getId());
costPlanDomain.setAccountingSubjectId(costTypeDomain.getAccountingSubjectId());
}
@Override
......@@ -137,7 +141,7 @@ public abstract class AbstractCostPlanService implements CostPlanService {
//费用计划
CostPlanDomain costPlanDomain = costPlanDao.selectByNo(costPlanNo);
//费用计划关联借支单
CostDomain costDomain = costDao.selectByCostNo(costPlanDomain.getSupCostNo());
CostDomain costDomain = costService.getCostByCostNo(costPlanDomain.getSupCostNo());
costDomain.setCompensate(costDomain.getCompensate().subtract(costPlanDomain.getPlanAmount()));
costDomain.setLastModifyDate(LocalDateTime.now());
costDao.updateById(costDomain);
......@@ -198,9 +202,6 @@ public abstract class AbstractCostPlanService implements CostPlanService {
BeanUtils.copyProperties(costPlanTempDomain, costDetailDomain);
costDetailDomain.setDetailNo(costPlanDomain.getCostPlanNo() + "-" + index);
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(costPlanTempDomain.getTypeNo());
costDetailDomain.setTypeNo(costTypeDomain.getTypeNo());
costDetailDomain.setTypeName(costTypeDomain.getTypeName());
return costDetailDomain;
}
......@@ -211,7 +212,7 @@ public abstract class AbstractCostPlanService implements CostPlanService {
*/
protected String getCostNo() {
String costNo = CostUtils.getIdNum();
CostDomain costByNo = costDao.selectByCostNo(costNo);
CostDomain costByNo = costService.getCostByCostNo(costNo);
while (null != costByNo && null != costByNo.getId()) {
costNo = CostUtils.getIdNum();
}
......
......@@ -40,8 +40,8 @@ public class CostPlanNewLend1ServiceImpl extends AbstractCostPlanService impleme
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(planDomain.getTypeNo());
planDomain.setTypeId(costTypeDomain.getId());
planDomain.setTypeNo(costTypeDomain.getTypeNo());
planDomain.setTypeName(costTypeDomain.getTypeName());
this.check(planDomain);
costPlanDao.insert(planDomain);
......@@ -53,8 +53,8 @@ public class CostPlanNewLend1ServiceImpl extends AbstractCostPlanService impleme
this.completedCostPlan(planDomain);
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(planDomain.getTypeNo());
planDomain.setTypeId(costTypeDomain.getId());
planDomain.setTypeNo(costTypeDomain.getTypeNo());
planDomain.setTypeName(costTypeDomain.getTypeName());
costPlanDao.update(planDomain, new LambdaQueryWrapper<CostPlanDomain>()
.eq(CostPlanDomain::getCostPlanNo, planDomain.getCostPlanNo()));
......
......@@ -5,7 +5,6 @@ import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.common.util.CurUtils;
import com.blt.other.database.model.CostPlanDomain;
import com.blt.other.database.model.CostPlanTempDomain;
import com.blt.other.database.model.CostTypeDomain;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostPlanService;
import lombok.extern.slf4j.Slf4j;
......@@ -38,10 +37,6 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme
this.check(planDomain);
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(planDomain.getTypeNo());
planDomain.setTypeNo(costTypeDomain.getTypeNo());
planDomain.setTypeName(costTypeDomain.getTypeName());
costPlanDao.insert(planDomain);
}
......@@ -51,11 +46,6 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme
this.doSaveFinanceRecord(planDomain);
this.completedCostPlan(planDomain);
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(planDomain.getTypeNo());
planDomain.setTypeNo(costTypeDomain.getTypeNo());
planDomain.setTypeName(costTypeDomain.getTypeName());
costPlanDao.update(planDomain, new LambdaQueryWrapper<CostPlanDomain>()
.eq(CostPlanDomain::getCostPlanNo, planDomain.getCostPlanNo()));
......@@ -83,7 +73,7 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme
costPlanDao.updateById(costPlanDomain);
//关联的借支单
CostDomain supCost = costDao.selectByCostNo(costPlanDomain.getSupCostNo());
CostDomain supCost = costService.getCostByCostNo(costPlanDomain.getSupCostNo());
//借支还需要还的金额 (借支单币种) = 借支单金额 - 借支单已还金额
BigDecimal subtract = supCost.getAmount().subtract(supCost.getRepaymentAppliedAmount());
if (subtract.compareTo(BigDecimal.ZERO) <= 0) {
......@@ -172,7 +162,6 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme
payPlan.setPayCounteract(BigDecimal.ZERO);
payPlan.setIsTax(0);
payPlan.setTypeNo(null);
payPlan.setTypeName(null);
payPlan.setCostReason("借支差额:" + payPlan.getSupCostNo());
costPlanDao.insert(payPlan);
......@@ -209,7 +198,7 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme
costPlanDao.updateById(costPlanDomain);
//关联的借支单
CostDomain supCost = costDao.selectByCostNo(costPlanDomain.getSupCostNo());
CostDomain supCost = costService.getCostByCostNo(costPlanDomain.getSupCostNo());
//借支还需要还的金额 = 借支单金额 - 借支单已还金额
BigDecimal subtract = supCost.getAmount().subtract(supCost.getHadPay());
......
......@@ -81,12 +81,12 @@ public class CostPlanNewPayServiceImpl extends AbstractCostPlanService implement
).collect(Collectors.toList());
// 根据大类分类
Map<String, List<CostDetailDomain>> detailMap = costDetailDomainList.stream().collect(
Collectors.groupingBy(CostDetailDomain::getTypeNo)
Map<Integer, List<CostDetailDomain>> detailMap = costDetailDomainList.stream().collect(
Collectors.groupingBy(CostDetailDomain::getTypeId)
);
// 按照不同的大类生成付款费用单、费用详情
detailMap.forEach((typeNo, costDetailDomains) -> {
detailMap.forEach((typeId, costDetailDomains) -> {
// 生成付款费用单
CostDomain costDomain = this.planToCost(costPlanNo);
String costNo = CostUtils.getIdNum();
......@@ -94,20 +94,17 @@ public class CostPlanNewPayServiceImpl extends AbstractCostPlanService implement
if (costPlanNo.startsWith("S")) {
costNo = "S" + costNo;
}
CostDomain costByNo = costDao.selectByCostNo(costNo);
CostDomain costByNo = costService.getCostByCostNo(costNo);
while (null != costByNo && null != costByNo.getId()) {
costNo = CostUtils.getIdNum();
if (costPlanNo.startsWith("S")) {
costNo = "S" + costNo;
}
costByNo = costDao.selectByCostNo(costNo);
costByNo = costService.getCostByCostNo(costNo);
}
costDomain.setCostNo(costNo);
costDomain.setTypeNo(typeNo);
costDomain.setTypeId(costDetailDomains.get(0).getTypeId());
costDomain.setTypeName(costDetailDomains.get(0).getTypeName());
costDomain.setAccountingSubjectNo(costDetailDomains.get(0).getAccountingSubjectNo());
costDomain.setAccountingSubjectName(costDetailDomains.get(0).getAccountingSubjectName());
costDomain.setTypeId(typeId);
costDomain.setAccountingSubjectId(costDetailDomains.get(0).getAccountingSubjectId());
if (null == costDomain.getAmount()) {
costDomain.setAmount(new BigDecimal(0));
......@@ -134,7 +131,6 @@ public class CostPlanNewPayServiceImpl extends AbstractCostPlanService implement
if (insert >= 1) {
// 记录日志
costLogService.save(costDomain.getCostNo(), costDomain.getCreateUserid(), "由费用计划:" + costDomain.getCostPlanNo() + " 生成付款单");
}
});
return detailMap.keySet().size();
......
......@@ -3,10 +3,10 @@ package com.blt.other.module.cost.service.impl.costplan;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.common.util.CurUtils;
import com.blt.other.database.model.CostPlanDomain;
import com.blt.other.database.model.CostTypeDomain;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostPlanService;
import com.blt.other.database.model.CostPlanDomain;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -32,8 +32,8 @@ public class CostPlanNewReceiptServiceImpl extends AbstractCostPlanService imple
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(planDomain.getTypeNo());
planDomain.setTypeNo(costTypeDomain.getTypeNo());
planDomain.setTypeName(costTypeDomain.getTypeName());
planDomain.setTypeId(costTypeDomain.getId());
this.check(planDomain);
costPlanDao.insert(planDomain);
}
......@@ -45,8 +45,7 @@ public class CostPlanNewReceiptServiceImpl extends AbstractCostPlanService imple
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(planDomain.getTypeNo());
planDomain.setTypeNo(costTypeDomain.getTypeNo());
planDomain.setTypeName(costTypeDomain.getTypeName());
planDomain.setTypeId(costTypeDomain.getId());
costPlanDao.update(planDomain, new LambdaQueryWrapper<CostPlanDomain>()
.eq(CostPlanDomain::getCostPlanNo, planDomain.getCostPlanNo()));
......
......@@ -14,7 +14,6 @@ import com.blt.other.module.cost.dto.request.AddItemReq;
import com.blt.other.module.cost.dto.request.AddItemResp;
import com.blt.other.module.cost.dto.request.ResetItemReq;
import com.blt.other.module.cost.dto.response.GetCostTempByPlanNoResp;
import com.blt.other.module.cost.model.AccountingSubject;
import com.blt.other.module.cost.service.CostPlanTempService;
import com.blt.other.module.cost.service.CostTypeKindService;
import org.springframework.beans.BeanUtils;
......@@ -80,16 +79,15 @@ public class CostPlanTempServiceImpl implements CostPlanTempService {
CostPlanTempDomain costPlanTempDomain = new CostPlanTempDomain();
BeanUtils.copyProperties(req, costPlanTempDomain);
costPlanTempDomain.setTempNo(this.createNo());
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(req.getTypeNo());
AccountingSubject accountingSubject = accountingSubjectMapper.selectByNo(costTypeDomain.getAccountingSubjectNo());
costPlanTempDomain.setTempNo(this.createNo());
costPlanTempDomain.setAccountingSubjectNo(accountingSubject.getSubjectNo());
costPlanTempDomain.setAccountingSubjectName(accountingSubject.getName());
this.checkDic(costPlanTempDomain);
costPlanTempDomain.setTypeId(costTypeDomain.getId());
costPlanTempDomain.setAccountingSubjectId(costTypeDomain.getAccountingSubjectId());
this.checkDic(costPlanTempDomain);
//新增付款子项目
costPlanTempDao.insert(costPlanTempDomain);
......@@ -170,15 +168,13 @@ public class CostPlanTempServiceImpl implements CostPlanTempService {
com.bailuntec.common.BeanUtils.copyProperties(req, costPlanTempDomain, "id");
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(req.getTypeNo());
AccountingSubject accountingSubject = accountingSubjectMapper.selectByNo(costTypeDomain.getAccountingSubjectNo());
costPlanTempDomain.setTempNo(this.createNo());
costPlanTempDomain.setAccountingSubjectNo(accountingSubject.getSubjectNo());
costPlanTempDomain.setAccountingSubjectName(accountingSubject.getName());
costPlanTempDomain.setTypeId(costTypeDomain.getId());
costPlanTempDomain.setAccountingSubjectId(costTypeDomain.getAccountingSubjectId());
costPlanTempDao.updateById(costPlanTempDomain);
this.chalkResetDec(costPlanTempDomain.getCostPlanNo());
// 同步更新费用计划金额
......@@ -191,8 +187,7 @@ public class CostPlanTempServiceImpl implements CostPlanTempService {
if (plan.getCostForm() == 1 && (null != plan.getIsLend() && 2 == plan.getIsLend())) {
plan.setPayPlanAmount(newAmount.divide(plan.getPayCur(), 4));
}
costPlanDao.update(plan, new LambdaQueryWrapper<CostPlanDomain>()
.eq(CostPlanDomain::getCostPlanNo, plan.getCostPlanNo()));
costPlanDao.update(plan, new LambdaQueryWrapper<CostPlanDomain>().eq(CostPlanDomain::getCostPlanNo, plan.getCostPlanNo()));
}
return costPlanTempDomain;
}
......
......@@ -225,7 +225,7 @@ public class PurchasingListDetailController {
buyDomain.setBuyno(buyno);
buyDomain.setNote(note);
if (linkLendCostNo != null && !"null".equals(linkLendCostNo)) {
CostDomain costDomain = costDao.selectByCostNo(linkLendCostNo);
CostDomain costDomain = costService.getCostByCostNo(linkLendCostNo);
BuyListDto buyByBuyno = buyService.getBuyByBuyno(buyno);
String judgeResult = buyService.judgeLinkLendCost(costDomain, buyByBuyno); // 采购单关联借支单判断
if (judgeResult != null) {
......@@ -276,7 +276,7 @@ public class PurchasingListDetailController {
String msg = buyByBuyno.getBuystatusDto();
if (buystatus <= 2) {
if (linkLendCostNo != null && !"".equals(linkLendCostNo)) {
CostDomain costDomain = costDao.selectByCostNo(linkLendCostNo);
CostDomain costDomain = costService.getCostByCostNo(linkLendCostNo);
// 借支单状态为已支付,借还状态为未还、部分还款
if (costDomain.getCostStatus() == 4 && (costDomain.getLendStatus() == 1 || costDomain.getLendStatus() == 2)) {
msg = buyService.buyLinkLendCost(costDomain, buyByBuyno, Integer.parseInt(userid)); // 采购单关联借支单
......
......@@ -346,8 +346,8 @@ public class BuyServiceImpl implements BuyService {
payPlan.setCounteract(new BigDecimal(0));
payPlan.setPayCounteract(new BigDecimal(0));
payPlan.setIsTax(0);
payPlan.setTypeId(4036);
payPlan.setTypeNo("CTN1809140510102");
payPlan.setTypeName("办公费");
//todo 办公
payPlan.setCostReason("借支差额:" + payPlan.getSupCostNo());
......
......@@ -11,10 +11,16 @@
<select id="selectAll" resultMap="cost">
SELECT
t1.*,
ct.type_no,
ct.type_name,
ast.subject_no accounting_subject_no,
ast.name accounting_subject_name,
group_concat(distinct t2.username) as cost_current_reviewer
FROM
cost t1
left join cost_current_reviewer t2 on t1.cost_no = t2.cost_no
left join cost_type ct on t1.type_id = ct.id
left join accounting_subject ast on ct.accounting_subject_id = ast.id
<if test="userId != null">
where t1.create_userid = #{userId}
</if>
......@@ -31,9 +37,16 @@
<select id="selectByCostNo" resultMap="cost">
SELECT t1.*,
ct.type_no,
ct.type_name,
ct.description,
ast.subject_no accounting_subject_no,
ast.name accounting_subject_name,
group_concat(distinct t2.username) as cost_current_reviewer
FROM cost t1
left join cost_current_reviewer t2 on t1.cost_no = t2.cost_no
left join cost_type ct on t1.type_id = ct.id
left join accounting_subject ast on ct.accounting_subject_id = ast.id
WHERE t1.cost_no = #{costNo}
group by t1.id
ORDER BY t1.id
......@@ -43,9 +56,15 @@
<select id="selectByKeys" resultType="com.blt.other.module.cost.model.CostDomain">
SELECT
t1.*,
ct.type_no,
ct.type_name,
ast.subject_no accounting_subject_no,
ast.name accounting_subject_name,
group_concat(distinct t2.username) as cost_current_reviewer
from cost t1
left join cost_current_reviewer t2 on t1.cost_no = t2.cost_no
left join cost_type ct on t1.type_id = ct.id
left join accounting_subject ast on ct.accounting_subject_id = ast.id
WHERE
t1.cost_status >= 1
<if test=" costForm!=null and costForm != ''">and t1.cost_form= #{costForm}</if>
......@@ -78,11 +97,7 @@
FROM cost
WHERE cost_status = 4
AND create_userid = #{createuserid}
AND (
lend_status = 1
OR
lend_status = 2
)
AND (lend_status = 1 OR lend_status = 2)
ORDER BY id DESC
</select>
......@@ -292,9 +307,15 @@
<select id="queryPage" resultType="com.blt.other.module.cost.model.CostDomain">
SELECT
t1.*,
ct.type_no,
ct.type_name,
ast.subject_no accounting_subject_no,
ast.name accounting_subject_name,
group_concat(distinct t2.username) as cost_current_reviewer
from cost t1
left join cost_current_reviewer t2 on t1.cost_no = t2.cost_no
left join cost_type ct on t1.type_id = ct.id
left join accounting_subject ast on ct.accounting_subject_id = ast.id
WHERE
true
<if test=" req.costForm!=null and req.costForm != ''">and t1.cost_form= #{req.costForm}</if>
......
......@@ -4,22 +4,33 @@
<mapper namespace="com.blt.other.module.cost.dao.CostDetailDao">
<select id="selectListByCostNo" resultType="com.blt.other.module.cost.model.CostDetailDomain">
SELECT *
FROM cost_detail
WHERE cost_no = #{costNo}
SELECT t1.*,
ct.type_no,
ct.type_name,
ast.subject_no accounting_subject_no,
ast.name accounting_subject_name
FROM cost_detail t1
left join cost_type ct on t1.type_id = ct.id
left join bailun_other.accounting_subject ast on ct.accounting_subject_id = ast.id
WHERE t1.cost_no = #{costNo}
</select>
<select id="selectByDetailNo" resultType="com.blt.other.module.cost.model.CostDetailDomain">
SELECT *
FROM cost_detail
WHERE detail_no = #{detailNo}
SELECT t1.*,
ct.type_no,
ct.type_name,
ast.subject_no accounting_subject_no,
ast.name accounting_subject_name
FROM cost_detail t1
left join cost_type ct on t1.type_id = ct.id
left join bailun_other.accounting_subject ast on ct.accounting_subject_id = ast.id
WHERE t1.detail_no = #{detailNo}
</select>
<update id="deletedFilePath" parameterType="com.blt.other.database.model.CostPlanTempDomain">
UPDATE
cost_detail
SET file_path = NULL
WHERE detail_no = #{detailNo}
update cost_detail
set file_path = null
where detail_no = #{detailNo}
</update>
</mapper>
......@@ -8,8 +8,14 @@
</resultMap>
<select id="selectByNo" resultMap="costPlan">
SELECT *
FROM cost_plan
SELECT t1.*,
ct.type_no,
ct.type_name,
ast.subject_no accounting_subject_no,
ast.name accounting_subject_name
FROM cost_plan t1
left join cost_type ct on t1.type_id = ct.id
left join accounting_subject ast on ct.accounting_subject_id = ast.id
WHERE cost_plan_no = #{costPlanNo}
</select>
......@@ -22,9 +28,15 @@
<select id="selectAll" resultMap="costPlan">
SELECT
*
t1.*,
ct.type_no,
ct.type_name,
ast.subject_no accounting_subject_no,
ast.name accounting_subject_name
FROM
cost_plan
cost_plan t1
left join cost_type ct on t1.type_id = ct.id
left join accounting_subject ast on ct.accounting_subject_id = ast.id
<if test="userId != null">
where create_userid = #{userId}
</if>
......
......@@ -3,18 +3,31 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.blt.other.module.cost.dao.CostPlanTempDao">
<select id="selectByNo" resultType="com.blt.other.database.model.CostPlanTempDomain">
SELECT *
FROM cost_plan_temp
SELECT t1.*,
ct.type_no,
ct.type_name,
ast.subject_no accounting_subject_no,
ast.name accounting_subject_name
FROM cost_plan_temp t1
left join cost_type ct on t1.type_id = ct.id
left join accounting_subject ast on ct.accounting_subject_id = ast.id
WHERE temp_no = #{tempNo}
</select>
<select id="selectListByPlanNo" resultType="com.blt.other.database.model.CostPlanTempDomain">
SELECT *
FROM cost_plan_temp
SELECT t1.*,
ct.type_no,
ct.type_name,
ast.subject_no accounting_subject_no,
ast.name accounting_subject_name
FROM cost_plan_temp t1
left join cost_type ct on t1.type_id = ct.id
left join bailun_other.accounting_subject ast on ct.accounting_subject_id = ast.id
WHERE cost_plan_no = #{costPlanNo}
ORDER BY id DESC
</select>
<!--parameterType="StudentEntity"-->
<delete id="deletedByPlanNoAndTempNo">
DELETE
......@@ -31,16 +44,28 @@
</update>
<select id="selectByPlanNoAndTypeNo" resultType="com.blt.other.database.model.CostPlanTempDomain">
SELECT *
FROM cost_plan_temp
SELECT t1.*,
ct.type_no,
ct.type_name,
ast.subject_no accounting_subject_no,
ast.name accounting_subject_name
FROM cost_plan_temp t1
left join cost_type ct on t1.type_id = ct.id
left join bailun_other.accounting_subject ast on ct.accounting_subject_id = ast.id
WHERE cost_plan_no = #{costPlanNo}
AND type_no = #{typeNo}
ORDER BY id DESC
</select>
<select id="selectByPlanNoAndTempNo" resultType="com.blt.other.database.model.CostPlanTempDomain">
SELECT *
FROM cost_plan_temp
SELECT t1.*,
ct.type_no,
ct.type_name,
ast.subject_no accounting_subject_no,
ast.name accounting_subject_name
FROM cost_plan_temp t1
left join cost_type ct on t1.type_id = ct.id
left join bailun_other.accounting_subject ast on ct.accounting_subject_id = ast.id
WHERE cost_plan_no = #{costPlanNo}
AND temp_no = #{tempNo}
ORDER BY id DESC
......
......@@ -250,7 +250,7 @@ public class OtherApplicationTests {
CostTypeDomain costTypeDomain = costTypeDao.selectOne(new LambdaQueryWrapper<CostTypeDomain>()
.eq(CostTypeDomain::getTypeName, item.getType())
.eq(CostTypeDomain::getCostTemplateType, map.get(item.getCostType()))
.eq(CostTypeDomain::getAccountingSubjectNo, accountingSubject.getSubjectNo()));
.eq(CostTypeDomain::getAccountingSubjectId, accountingSubject.getId()));
if (costTypeDomain == null) {
costTypeDomain = new CostTypeDomain();
......@@ -260,7 +260,7 @@ public class OtherApplicationTests {
costTypeDomain.setTypeName(item.getType());
costTypeDomain.setTypeNo(IdWorker.getIdStr());
costTypeDomain.setDescription(item.getDesc());
costTypeDomain.setAccountingSubjectNo(accountingSubject.getSubjectNo());
costTypeDomain.setAccountingSubjectId(accountingSubject.getId());
boolean b = costTypeDao.updateById(costTypeDomain) > 0 || costTypeDao.insert(costTypeDomain) > 0;
......@@ -371,7 +371,6 @@ public class OtherApplicationTests {
.forEach(costTypeDomain -> {
CostTypeDomain item = new CostTypeDomain();
item.setCostTemplateType(CostTypeDomain.borrow);
item.setAccountingSubjectNo("1345912843756503041");
item.setDescription(costTypeDomain.getDescription());
item.setTypeNo(IdWorker.getIdStr());
item.setTypeName(costTypeDomain.getTypeName());
......
......@@ -6,8 +6,8 @@ import com.bailuntec.common.JsonUtilByFsJson;
import com.blt.other.common.config.property.CostUrlProperties;
import com.blt.other.database.model.CostCompanyDomain;
import com.blt.other.module.cost.dao.CostCompanyDao;
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.vo.CashierCallbackUrlDataDataVo;
import com.blt.other.module.cost.vo.CashierCallbackUrlDataVo;
import com.blt.other.module.cost.vo.CashierCallbackUrlVo;
......@@ -45,7 +45,7 @@ class AbstractCostServiceTest {
@Resource
CostUrlProperties costUrlProperties;
@Resource
CostDao costDao;
CostService costService;
PostApplyReq buildPostApplyReq(CostDomain cost) {
......@@ -89,6 +89,7 @@ class AbstractCostServiceTest {
if (null == detailKey || !detailKey.contains("F")) {
detailKey = cost.getCostNo();
}
// 回调必要的key参数(DetailKey)不能为空;
req.setDetailKey(detailKey);
req.setTypeName(cost.getTypeName());
......@@ -99,7 +100,7 @@ class AbstractCostServiceTest {
@Rollback
@Test
void toFinancial() {
CostDomain costDomain = costDao.selectByCostNo("F030246");
CostDomain costDomain = costService.getCostByCostNo("F030246");
PostApplyReq req = this.buildPostApplyReq(costDomain);
// 审核回调地址(ApplyCallbackUrl)不可为空;
......
......@@ -5,6 +5,7 @@ import com.blt.other.database.model.CostCompanyDomain;
import com.blt.other.module.cost.dao.CostCompanyDao;
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.ICostCurrentReviewerService;
import com.blt.other.module.sys.dao.CostReviewerMapper;
import com.blt.other.module.sys.model.CostReviewer;
......@@ -35,7 +36,7 @@ import java.util.List;
class FinancialCheckStateTest {
@Resource
CostDao costDao;
CostService costService;
@Resource
CostCompanyDao costCompanyDao;
@Resource
......@@ -52,11 +53,8 @@ class FinancialCheckStateTest {
costs.forEach(this::reSet);
}
//F031366
//F031367
//F031370
private void reSet(String costNo) {
CostDomain costDomain = costDao.selectByCostNo(costNo);
CostDomain costDomain = costService.getCostByCostNo(costNo);
CostCompanyDomain costCompanyDomain = costCompanyDao.selectByNo(costDomain.getCompanyNo());
......@@ -71,7 +69,7 @@ class FinancialCheckStateTest {
@Test
void updateCurrentReviewer() {
CostDomain costDomain = costDao.selectByCostNo("F031533");
CostDomain costDomain = costService.getCostByCostNo("F031533");
CostContext costContext = new CostContext("F031533", costDomain.getCreateUserid());
costContext.setCostState(financialCheckState);
financialCheckState.updateCurrentReviewer();
......
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