Commit 068665af by huluobin

update

parent 6a1533ee
package com.bailuntec.cost.api.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......
......@@ -53,10 +53,10 @@ public class CostListAddController {
AxiosUtil.setCors(response, request);
Map<String, Object> result = new HashMap<>();
String costNo = CostUtils.getIdNum(costService);
String costNo = CostUtils.getIdNum();
CostDomain costDomainByNo = costDao.selectByCostNo(costNo);
while (null != costDomainByNo && null != costDomainByNo.getId()) {
costNo = CostUtils.getIdNum(costService);
costNo = CostUtils.getIdNum();
}
CostDomain costDomain = CostUtils.createCostDomain(request, costNo);
......@@ -96,10 +96,10 @@ public class CostListAddController {
AxiosUtil.setCors(response, request);
Map<String, Object> result = new HashMap<>();
String costNo = CostUtils.getIdNum(costService);
String costNo = CostUtils.getIdNum();
CostDomain costDomainByNo = costDao.selectByCostNo(costNo);
while (null != costDomainByNo && null != costDomainByNo.getId()) {
costNo = CostUtils.getIdNum(costService);
costNo = CostUtils.getIdNum();
}
CostDomain costDomain = CostUtils.createCostDomain(request, costNo);
// 保存表单中的银行卡信息
......
......@@ -4,7 +4,9 @@ import com.bailuntec.cost.api.dto.CostDto;
import com.blt.other.common.util.AxiosUtil;
import com.blt.other.module.cost.dto.CostApiDto;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.*;
import com.blt.other.module.cost.service.CostCashiercallbackService;
import com.blt.other.module.cost.service.CostLogService;
import com.blt.other.module.cost.service.CostService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
......@@ -20,7 +22,6 @@ 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 org.springframework.web.client.RestTemplate;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -40,14 +41,6 @@ public class CostCheckController {
@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;
......
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.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;
//
//
//
//
//}
......@@ -9,7 +9,6 @@ import com.blt.other.common.util.MyMapperUtil;
import com.blt.other.common.util.PathUtil;
import com.blt.other.module.cost.dao.CostDao;
import com.blt.other.module.cost.dto.CostApiDto;
import com.blt.other.module.cost.dto.CostPageResult;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostExportService;
import com.blt.other.module.cost.service.CostListSearchService;
......@@ -19,6 +18,7 @@ import com.blt.other.module.cost.service.impl.cost.CostServiceFactory;
import com.blt.other.module.cost.service.impl.costcheck.*;
import com.blt.other.module.cost.vo.*;
import com.blt.other.module.database.model.CostExpDomain;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
......@@ -64,29 +64,26 @@ public class CostController {
@ApiOperation("获取前端要打印的费用单列表")
@PostMapping("/list/print/list")
public CostApiDto.PrintListResp printList(@RequestBody CostListPrintVo costListPrintVo) {
public CostResult<List<CostListPrintDto>> printList(@RequestBody CostListPrintVo costListPrintVo) {
costService = CostServiceFactory.getCostService();
List<CostListPrintDto> listPrintDtos = costService.printList(costListPrintVo.getPrintNos());
CostApiDto.PrintListResp resp = new CostApiDto.PrintListResp();
resp.setSuccess(true);
resp.setPrintList(listPrintDtos);
return resp;
return CostResult.success(listPrintDtos);
}
@ApiOperation("搜索")
@PostMapping("/list/search/key")
public CostApiDto.GetByKeyResp getByKey(@RequestParam Integer pageNum,
@RequestParam Integer pageSize,
@RequestParam String key) {
public CostResult<PageInfo<CostDto>> getByKey(@RequestParam Integer pageNum,
@RequestParam Integer pageSize,
@RequestParam String key) {
costService = CostServiceFactory.getCostService();
return costListSearchService.searchByKey(key, pageNum, pageSize);
PageInfo<CostDto> pageInfo = costListSearchService.searchByKey(key, pageNum, pageSize);
return CostResult.success(pageInfo);
}
@ApiOperation("搜索?")
@PostMapping("/list/search/keys")
public CostApiDto.GetByKeyResp getByKeys(@RequestBody CostListSearchKeysVo searchKeysVo) {
public CostResult<PageInfo<CostDto>> getByKeys(@RequestBody CostListSearchKeysVo searchKeysVo) {
costService = CostServiceFactory.getCostService();
if (null != searchKeysVo.getParams().getKeys().getCostForm() && 3 == searchKeysVo.getParams().getKeys().getCostForm()) {
......@@ -96,8 +93,8 @@ public class CostController {
searchKeysVo.getParams().getKeys().setCostForm(3);
searchKeysVo.getParams().getKeys().setIsLend(2);
}
return costListSearchService.searchByKeys(searchKeysVo);
PageInfo<CostDto> pageInfo = costListSearchService.searchByKeys(searchKeysVo);
return CostResult.success(pageInfo);
}
@ApiOperation("获取借支单列表")
......@@ -109,16 +106,17 @@ public class CostController {
@ApiOperation("获取所有费用单")
@GetMapping("/list/getAllCost")
public CostPageResult getAllCost(@RequestParam Integer pageNum,
@RequestParam Integer pageSize,
@RequestParam Integer userId,
@RequestParam(defaultValue = "0", required = false) Integer authType,
@RequestParam(required = false) String projectTypes) {
public CostResult<PageInfo<CostDto>> getAllCost(@RequestParam Integer pageNum,
@RequestParam Integer pageSize,
@RequestParam Integer userId,
@RequestParam(defaultValue = "0", required = false) Integer authType,
@RequestParam(required = false) String projectTypes) {
if (authType != 0) {
userId = null;
}
costService = CostServiceFactory.getCostService();
return costService.getAllCost(pageNum, pageSize, userId, projectTypes);
PageInfo<CostDto> pageInfo = costService.getAllCost(pageNum, pageSize, userId, projectTypes);
return CostResult.success(pageInfo);
}
@ApiOperation("获取费用详情")
......
......@@ -14,16 +14,6 @@ public interface CostPlanDao extends BaseMapper<CostPlanDomain> {
/**
* <p>
* 根据计划单号更新计划单
* </p>
*
* @param costPlanDomain 计划单
* @return res
*/
Integer updateByNo(CostPlanDomain costPlanDomain);
/**
* <p>
* 根据计划单号删除计划单
* </p>
*
......
package com.blt.other.module.cost.service;
import com.bailuntec.cost.api.dto.CostDto;
import com.blt.other.module.cost.dto.CostApiDto;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.vo.CostListSearchKeysVo;
import com.github.pagehelper.PageInfo;
import java.util.List;
......@@ -14,7 +16,7 @@ public interface CostListSearchService {
* @param key key
* @return res
*/
CostApiDto.GetByKeyResp searchByKey(String key, int pageNum, int pageSize);
PageInfo<CostDto> searchByKey(String key, int pageNum, int pageSize);
/**
* 多条件筛选
......@@ -22,7 +24,7 @@ public interface CostListSearchService {
* @param searchKeysVo param
* @return res
*/
CostApiDto.GetByKeyResp searchByKeys(CostListSearchKeysVo searchKeysVo);
PageInfo<CostDto> searchByKeys(CostListSearchKeysVo searchKeysVo);
/**
* 获取借支单列表
......
package com.blt.other.module.cost.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.blt.other.module.cost.dto.CostPlanApiDto;
import com.blt.other.module.database.model.CostPlanDomain;
public interface CostPlanService {
public interface CostPlanService {
/**
* <p>
......
......@@ -2,12 +2,14 @@ package com.blt.other.module.cost.service;
import com.bailuntec.cost.api.dto.CostDto;
import com.bailuntec.cost.api.dto.CostListPrintDto;
import com.bailuntec.cost.api.response.CostResult;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.blt.other.module.cost.dto.CostApiDto;
import com.blt.other.module.cost.dto.CostPageResult;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.vo.ApplyCallbackUrlVo;
import com.blt.other.module.cost.vo.CashierCallbackUrlVo;
import com.github.pagehelper.PageInfo;
import java.util.List;
......@@ -27,7 +29,7 @@ public interface CostService {
*
* @return allCost
*/
CostPageResult getAllCost(Integer pageNum, Integer pageSize, Integer userId, String projectTypes);
PageInfo<CostDto> getAllCost(Integer pageNum, Integer pageSize, Integer userId, String projectTypes);
/**
* 根据 costNo 获取 cost
......
......@@ -62,7 +62,7 @@ public class CostApiServiceImpl implements CostApiService {
@Transactional
public String generateLogisticsCost(int costForm, LogisticsCostDto logisticsCostDto) throws Exception {
CostDomain costDomain = new CostDomain();
String costNo = CostUtils.getIdNum(costService);
String costNo = CostUtils.getIdNum();
costDomain.setCostNo(costNo);
costDomain.setCostForm(costForm); // 付款费用单 1付款 2收款 3借支/借还
costDomain.setCostStatus(0); // 0 待提交 1待审核 2待出纳付款 3被驳回 4已支付 5已作废
......@@ -266,7 +266,7 @@ public class CostApiServiceImpl implements CostApiService {
@Override
public String pushWageCost(WageCostDto wageCostDto) throws IOException {
CostDomain costDomain = new CostDomain();
String costNo = CostUtils.getIdNum(costService);
String costNo = CostUtils.getIdNum();
costDomain.setCostNo(costNo);
// 付款费用单 1付款 2收款 3借支/借还
costDomain.setCostForm(1);
......
......@@ -3,7 +3,6 @@ package com.blt.other.module.cost.service.impl;
import com.bailuntec.cost.api.dto.CostDto;
import com.blt.other.module.cost.dao.CostDao;
import com.blt.other.module.cost.dao.CostListSearchDao;
import com.blt.other.module.cost.dto.CostApiDto;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostListSearchService;
import com.blt.other.module.cost.service.CostService;
......@@ -14,7 +13,6 @@ import com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
......@@ -30,41 +28,27 @@ public class CostListSearchServiceImpl implements CostListSearchService {
CostDao costDao;
@Override
public CostApiDto.GetByKeyResp searchByKey(String key, int pageNum, int pageSize) {
CostApiDto.GetByKeyResp resp = new CostApiDto.GetByKeyResp();
PageHelper.startPage(pageNum, pageSize);
List<CostDomain> costDomains = costListSearchDao.selectByKey(Lists.newArrayList(key.split(",")).stream().filter(Objects::nonNull).collect(Collectors.toList()));
List<CostDto> dtos = costDomains.stream().map(CostDomain::castToDto).collect(Collectors.toList());
public PageInfo<CostDto> searchByKey(String key, int pageNum, int pageSize) {
PageInfo<CostDomain> pageInfo = new PageInfo<>(costDomains);
resp.setCosts(dtos);
resp.setPageInfo(pageInfo);
resp.setSuccess(true);
return resp;
PageHelper.startPage(pageNum, pageSize);
List<CostDto> costDtos = costListSearchDao.selectByKey(Lists.newArrayList(key.split(","))
.stream()
.filter(Objects::nonNull)
.collect(Collectors.toList()))
.stream()
.map(CostDomain::castToDto)
.collect(Collectors.toList());
return new PageInfo<>(costDtos);
}
@Override
public CostApiDto.GetByKeyResp searchByKeys(CostListSearchKeysVo searchKeysVo) {
CostApiDto.GetByKeyResp resp = new CostApiDto.GetByKeyResp();
public PageInfo<CostDto> searchByKeys(CostListSearchKeysVo searchKeysVo) {
PageHelper.startPage(searchKeysVo.getParams().getPageNum(), searchKeysVo.getParams().getPageSize());
List<CostDomain> domains = costListSearchDao.selectByKeys(searchKeysVo);
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());
list.add(supCost);
if (null != domains && domains.size() >= 1) {
list.addAll(domains);
}
resp.setCosts(list.stream().map(CostDomain::castToDto).collect(Collectors.toList()));
} else {
resp.setCosts(domains.stream().map(CostDomain::castToDto).collect(Collectors.toList()));
}
resp.setPageInfo(pageInfo);
resp.setSuccess(true);
return resp;
CostDomain supCost = costDao.selectByCostNo(searchKeysVo.getParams().getKeys().getLinkCost());
domains.add(supCost);
return new PageInfo<>(domains.stream().map(CostDomain::castToDto).collect(Collectors.toList()));
}
@Override
......
......@@ -17,7 +17,6 @@ import com.blt.other.module.cost.dao.CostDao;
import com.blt.other.module.cost.dao.CostDetailDao;
import com.blt.other.module.cost.dao.CostTypeKindDao;
import com.blt.other.module.cost.dto.CostApiDto;
import com.blt.other.module.cost.dto.CostPageResult;
import com.blt.other.module.cost.model.CostDetailDomain;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.*;
......@@ -94,21 +93,17 @@ public abstract class AbstractCostService implements CostService {
}
@Override
public CostPageResult getAllCost(Integer pageNum,
Integer pageSize,
Integer userId,
String projectTypes) {
public PageInfo<CostDto> getAllCost(Integer pageNum,
Integer pageSize,
Integer userId,
String projectTypes) {
PageHelper.startPage(pageNum, pageSize);
List<String> projectTypeList = new ArrayList<>();
if (!StringUtils.isEmpty(projectTypes)) {
projectTypeList = Lists.newArrayList(projectTypes.split(",")).stream().filter(str -> !StringUtils.isEmpty(str)).collect(Collectors.toList());
}
List<CostDomain> costDomains = costDao.selectAll(userId, projectTypeList);
CostPageResult result = new CostPageResult();
result.setCosts(costDomains.stream().map(CostDomain::castToDto).collect(Collectors.toList()));
result.setPageInfo(new PageInfo<>(costDomains));
return result;
return new PageInfo<>(costDomains.stream().map(CostDomain::castToDto).collect(Collectors.toList()));
}
@Override
......
......@@ -32,7 +32,7 @@ public class UnSubmitState extends CostState {
}
//更新费用单
costDomain.setCostStatus(1);
costDomain.setCostStatus(CostDomain.STATUS_DEPARTMENT_CHECK);
costDao.updateById(costDomain);
costLogService.save(costDomain.getCostNo(), costContext.currentUserId, "提交费用单");
......
package com.blt.other.module.cost.service.impl.costplan;
import com.bailuntec.common.ListUtil;
import com.bailuntec.cost.api.dto.CostPlanDto;
import com.blt.other.module.auth.dao.UserDao;
import com.blt.other.module.cost.dao.*;
......@@ -51,20 +52,17 @@ public abstract class AbstractCostPlanService implements CostPlanService {
@Autowired
CostTypeKindDao costTypeKindDao;
@Autowired
CostService costService;
@Autowired
CostPlanTempService costPlanTempService;
@Autowired
ICostTemplateService costTemplateService;
@Value("${url.api.getExchangeRateApi}")
String getExchangeRateApi;
@Autowired
CostLogService costLogService;
@Autowired
CostDetailDao costDetailDao;
/**
* <p>
* 保存填写的财务信息到历史记录
......@@ -88,19 +86,25 @@ public abstract class AbstractCostPlanService implements CostPlanService {
protected void completedCostPlan(CostPlanDomain costPlanDomain) {
CostCompanyDomain companyDomain = costCompanyDao.selectByNo(costPlanDomain.getCompanyNo());
costPlanDomain.setCompanyName(companyDomain.getCompanyName());
costPlanDomain.setCompanyValue(companyDomain.getValue());
UserDomain user = userDao.select(costPlanDomain.getCreateUsercode());
costPlanDomain.setCreateUserid(user.getUserid());
costPlanDomain.setCreateUsername(user.getUsername());
costPlanDomain.setCreateTime(new Date());
costPlanDomain.setPayCur(costPlanDomain.getCur());
if (companyDomain != null) {
costPlanDomain.setCompanyName(companyDomain.getCompanyName());
costPlanDomain.setCompanyValue(companyDomain.getValue());
}
costPlanDomain.getAttach().forEach(costAttach -> {
CostTemplateBaseCol costTemplateBaseCol = costTemplateBaseColMapper.selectById(costAttach.getCostTemplateBaseColId());
BeanUtils.copyProperties(costTemplateBaseCol, costAttach, "id");
});
UserDomain user = userDao.select(costPlanDomain.getCreateUsercode());
if (user != null) {
costPlanDomain.setCreateUserid(user.getUserid());
costPlanDomain.setCreateUsername(user.getUsername());
costPlanDomain.setCreateTime(new Date());
costPlanDomain.setPayCur(costPlanDomain.getCur());
}
if (ListUtil.isNotEmpty(costPlanDomain.getAttach())) {
costPlanDomain.getAttach().forEach(costAttach -> {
CostTemplateBaseCol costTemplateBaseCol = costTemplateBaseColMapper.selectById(costAttach.getCostTemplateBaseColId());
BeanUtils.copyProperties(costTemplateBaseCol, costAttach, "id");
});
}
}
......@@ -192,10 +196,10 @@ public abstract class AbstractCostPlanService implements CostPlanService {
* @return costNo
*/
protected String getCostNo() {
String costNo = CostUtils.getIdNum(costService);
String costNo = CostUtils.getIdNum();
CostDomain costByNo = costDao.selectByCostNo(costNo);
while (null != costByNo && null != costByNo.getId()) {
costNo = CostUtils.getIdNum(costService);
costNo = CostUtils.getIdNum();
}
return costNo;
}
......
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.module.cost.service.CostPlanService;
......@@ -56,7 +57,8 @@ public class CostPlanNewLend1ServiceImpl extends AbstractCostPlanService impleme
planDomain.setKindName(costTypeKindDomain.getKindName());
planDomain.setTypeNo(costTypeKindDomain.getTypeNo());
planDomain.setTypeName(costTypeKindDomain.getTypeName());
costPlanDao.updateByNo(planDomain);
costPlanDao.update(planDomain, new LambdaQueryWrapper<CostPlanDomain>()
.eq(CostPlanDomain::getCostPlanNo, planDomain.getCostPlanNo()));
}
@Override
......@@ -66,7 +68,8 @@ public class CostPlanNewLend1ServiceImpl extends AbstractCostPlanService impleme
throw new BizRuntimeException("只能更新待确认的计划单");
}
costPlanDomain.setCostPlanStatus(1);
costPlanDao.updateByNo(costPlanDomain);
costPlanDao.update(costPlanDomain, new LambdaQueryWrapper<CostPlanDomain>()
.eq(CostPlanDomain::getCostPlanNo, costPlanDomain.getCostPlanNo()));
CostDomain costDomain = planToCost(costPlanDomain.getCostPlanNo());
String costNo = getCostNo();
......
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.module.cost.model.CostDomain;
......@@ -56,7 +57,9 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme
planDomain.setTypeNo(costTypeKindDomain.getTypeNo());
planDomain.setTypeName(costTypeKindDomain.getTypeName());
costPlanDao.updateByNo(planDomain);
costPlanDao.update(planDomain, new LambdaQueryWrapper<CostPlanDomain>()
.eq(CostPlanDomain::getCostPlanNo, planDomain.getCostPlanNo()));
}
@Override
......@@ -68,7 +71,8 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme
}
//已确认
costPlanDomain.setCostPlanStatus(1);
costPlanDao.updateByNo(costPlanDomain);
costPlanDao.update(costPlanDomain, new LambdaQueryWrapper<CostPlanDomain>()
.eq(CostPlanDomain::getCostPlanNo, costPlanDomain.getCostPlanNo()));
// 借还单确认时,根据借支单金额、冲销金额、余额拆单
//关联的借支单
......
package com.blt.other.module.cost.service.impl.costplan;
import com.blt.other.module.cost.model.CostDetailDomain;
import com.blt.other.module.cost.model.CostDomain;
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.module.cost.model.CostDetailDomain;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostPlanService;
import com.blt.other.module.cost.utils.CostUtils;
import com.blt.other.module.database.model.*;
import com.blt.other.module.database.model.CostPlanDomain;
import com.blt.other.module.database.model.CostPlanTempDomain;
import com.blt.other.module.database.model.CostTypeDomain;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -48,7 +51,8 @@ public class CostPlanNewPayServiceImpl extends AbstractCostPlanService implement
List<CostPlanTempDomain> list = costPlanTempDao.selectListByPlanNo(planDomain.getCostPlanNo());
BigDecimal planAmount = list.stream().map(CostPlanTempDomain::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
planDomain.setPlanAmount(planAmount);
costPlanDao.updateByNo(planDomain);
costPlanDao.update(planDomain, new LambdaQueryWrapper<CostPlanDomain>()
.eq(CostPlanDomain::getCostPlanNo, planDomain.getCostPlanNo()));
}
@Override
......@@ -59,7 +63,8 @@ public class CostPlanNewPayServiceImpl extends AbstractCostPlanService implement
throw new BizRuntimeException("只能更新待确认的计划单");
}
costPlanDomain.setCostPlanStatus(1);
costPlanDao.updateByNo(costPlanDomain);
costPlanDao.update(costPlanDomain, new LambdaQueryWrapper<CostPlanDomain>()
.eq(CostPlanDomain::getCostPlanNo, costPlanDomain.getCostPlanNo()));
List<CostPlanTempDomain> costPlanTempDomains = costPlanTempDao.selectListByPlanNo(costPlanNo);
......@@ -84,14 +89,14 @@ public class CostPlanNewPayServiceImpl extends AbstractCostPlanService implement
detailMap.forEach((typeNo, costDetailDomains) -> {
// 生成付款费用单
CostDomain costDomain = this.planToCost(costPlanNo);
String costNo = CostUtils.getIdNum(costService);
String costNo = CostUtils.getIdNum();
// 差额单(冲销借支单自动生成的补差额的付款费用)的单号以 “S” 打头
if (costPlanNo.startsWith("S")) {
costNo = "S" + costNo;
}
CostDomain costByNo = costDao.selectByCostNo(costNo);
while (null != costByNo && null != costByNo.getId()) {
costNo = CostUtils.getIdNum(costService);
costNo = CostUtils.getIdNum();
if (costPlanNo.startsWith("S")) {
costNo = "S" + costNo;
}
......
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.module.cost.service.CostPlanService;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostPlanService;
import com.blt.other.module.database.model.CostPlanDomain;
import com.blt.other.module.database.model.CostTypeKindDomain;
import org.springframework.stereotype.Service;
......@@ -45,11 +46,14 @@ public class CostPlanNewReceiptServiceImpl extends AbstractCostPlanService imple
CostTypeKindDomain costTypeKindDomain = costTypeKindDao.selectByKindNo(planDomain.getKindNo());
planDomain.setKindName(costTypeKindDomain.getKindName());
planDomain.setTypeNo(costTypeKindDomain.getTypeNo());
planDomain.setTypeName(costTypeKindDomain.getTypeName());
if (costTypeKindDomain != null) {
planDomain.setKindName(costTypeKindDomain.getKindName());
planDomain.setTypeNo(costTypeKindDomain.getTypeNo());
planDomain.setTypeName(costTypeKindDomain.getTypeName());
}
costPlanDao.updateByNo(planDomain);
costPlanDao.update(planDomain, new LambdaQueryWrapper<CostPlanDomain>()
.eq(CostPlanDomain::getCostPlanNo, planDomain.getCostPlanNo()));
}
@Override
......@@ -59,7 +63,8 @@ public class CostPlanNewReceiptServiceImpl extends AbstractCostPlanService imple
throw new BizRuntimeException("只能更新待确认的计划单");
}
costPlanDomain.setCostPlanStatus(1);
costPlanDao.updateByNo(costPlanDomain);
costPlanDao.update(costPlanDomain, new LambdaQueryWrapper<CostPlanDomain>()
.eq(CostPlanDomain::getCostPlanNo, costPlanDomain.getCostPlanNo()));
CostDomain costDomain = planToCost(costPlanNo);
String costNo = getCostNo();
......
package com.blt.other.module.cost.service.impl.costplan;
import com.bailuntec.cost.api.dto.CostPlanTempDto;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.blt.other.common.util.CurUtils;
import com.blt.other.common.util.PathUtil;
import com.blt.other.module.cost.dao.CostPlanDao;
......@@ -88,7 +89,8 @@ public class CostPlanTempServiceImpl implements CostPlanTempService {
CostPlanDomain costPlanDomain = costPlanDao.selectByNo(costPlanTempDomain.getCostPlanNo());
if (costPlanDomain != null) {
costPlanDomain.setPlanAmount(costPlanDomain.getPlanAmount().add(costPlanTempDomain.getAmount()));
costPlanDao.updateByNo(costPlanDomain);
costPlanDao.update(costPlanDomain, new LambdaQueryWrapper<CostPlanDomain>()
.eq(CostPlanDomain::getCostPlanNo, costPlanDomain.getCostPlanNo()));
}
CostPlanTempApiDto.AddItemResp resp = new CostPlanTempApiDto.AddItemResp();
......@@ -132,7 +134,8 @@ public class CostPlanTempServiceImpl implements CostPlanTempService {
if (costPlanDomain != null) {
costPlanDomain.setPlanAmount(costPlanDomain.getPlanAmount().subtract(costPlanTempDomain.getAmount()));
costPlanDao.updateByNo(costPlanDomain);
costPlanDao.update(costPlanDomain, new LambdaQueryWrapper<CostPlanDomain>()
.eq(CostPlanDomain::getCostPlanNo, costPlanDomain.getCostPlanNo()));
return costPlanDomain.getPlanAmount();
}
return BigDecimal.ZERO;
......@@ -184,7 +187,8 @@ public class CostPlanTempServiceImpl implements CostPlanTempService {
if (1 == plan.getCostForm() && (null != plan.getIsLend() && 2 == plan.getIsLend())) {
plan.setPayPlanAmount(newAmount.divide(plan.getPayCur(), 4));
}
costPlanDao.updateByNo(plan);
costPlanDao.update(plan, new LambdaQueryWrapper<CostPlanDomain>()
.eq(CostPlanDomain::getCostPlanNo, plan.getCostPlanNo()));
}
return costPlanTempDomain;
}
......
......@@ -4,6 +4,7 @@ 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;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
......@@ -14,7 +15,8 @@ import java.text.NumberFormat;
*/
public class CostUtils {
public static String getIdNum(CostService costService) {
public static String getIdNum() {
NumberFormat nf = NumberFormat.getInstance();
nf.setGroupingUsed(false);
nf.setMaximumIntegerDigits(6);
......
......@@ -409,7 +409,7 @@ public class BuyServiceImpl implements BuyService {
CostDomain backCost = new CostDomain();
BeanUtils.copyProperties(linkLendCost, backCost);
backCost.setCostPlanNo(null);
backCost.setCostNo(CostUtils.getIdNum(costService));
backCost.setCostNo(CostUtils.getIdNum());
backCost.setCostReason("采购单【" + buyListDto.getBuyno() + "】冲销借支单【" + linkLendCost.getCostNo() + "】");
backCost.setCostRemark("采购单【" + buyListDto.getBuyno() + "】冲销借支单【" + linkLendCost.getCostNo() + "】,财务审核采购单通过后由系统自动生成本借还单");
backCost.setCreateTime(new Date());
......
......@@ -13,55 +13,6 @@
WHERE cost_plan_no = #{costPlanNo}
</select>
<update id="updateByNo" parameterType="com.blt.other.module.cost.model.CostDomain">
UPDATE
cost_plan
<set>
<if test=" companyNo!=null">company_no=#{companyNo},</if>
<if test=" companyName!=null">company_name=#{companyName},</if>
<if test=" typeNo!=null">type_no=#{typeNo},</if>
<if test=" typeName!=null">type_name=#{typeName},</if>
<if test=" kindNo!=null">kind_no=#{kindNo},</if>
<if test=" kindName!=null">kind_name=#{kindName},</if>
<if test=" createUserid!=null">create_userid=#{createUserid},</if>
<if test=" createUsercode!=null">create_usercode=#{createUsercode},</if>
<if test=" createUsername!=null">create_username=#{createUsername},</if>
<if test=" costRemark!=null">cost_remark=#{costRemark},</if>
<if test=" createTime!=null">create_time=#{createTime},</if>
<if test=" sonCostNo!=null">son_cost_no=#{sonCostNo},</if>
<if test=" supCostNo!=null">sup_cost_no=#{supCostNo},</if>
<if test=" costPlanStatus!=null">cost_plan_status=#{costPlanStatus},</if>
<if test=" filePath!=null">file_path=#{filePath},</if>
<if test=" morFilePath!=null">mor_file_path=#{morFilePath},</if>
<if test=" planAmount!=null">plan_amount=#{planAmount},</if>
<if test=" subLogisticsSupplierId!=null">sub_logistics_supplier_id=#{subLogisticsSupplierId},</if>
<if test=" logisticsSupplierId!=null">logistics_supplier_id=#{logisticsSupplierId},</if>
<if test=" bankName!=null">bank_name=#{bankName},</if>
<if test=" bankCard!=null">bank_card=#{bankCard},</if>
<if test=" bankCardUser!=null">bank_card_user=#{bankCardUser},</if>
<if test=" morRemark!=null">mor_remark=#{morRemark},</if>
<if test=" costForm!=null">cost_form=#{costForm},</if>
<if test=" costReason!=null">cost_reason=#{costReason},</if>
<if test=" isLend!=null">is_lend=#{isLend},</if>
<if test=" hadPay!=null">had_pay=#{hadPay},</if>
<if test=" lendStatus!=null">lend_status=#{lendStatus},</if>
<if test=" compensate!=null">compensate=#{compensate},</if>
<if test=" counteract!=null">counteract=#{counteract},</if>
<if test=" lendBalance!=null">lend_balance=#{lendBalance},</if>
<if test=" rejectReason!=null">reject_reason=#{rejectReason},</if>
<if test=" dic!=null">dic=#{dic},</if>
<if test=" payCounteract!=null">pay_counteract=#{payCounteract},</if>
<if test=" payLendBalance!=null">pay_lend_balance=#{payLendBalance},</if>
<if test=" payPlanAmount!=null">pay_plan_amount=#{payPlanAmount},</if>
<if test=" payDic!=null">pay_dic=#{payDic},</if>
<if test=" payCur!=null">pay_cur=#{payCur},</if>
<if test=" isTax!=null">is_tax=#{isTax},</if>
<if test=" bankCompany!=null">bank_company=#{bankCompany},</if>
<if test=" companyValue!=null">company_value=#{companyValue}</if>
</set>
WHERE
cost_plan_no = #{costPlanNo}
</update>
<delete id="deleteByNo">
DELETE
......
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