Commit a620078d by huluobin

# update

parent 7b02b68b
......@@ -14,8 +14,6 @@ pipeline {
stage('interfaces 编译打包部署') {
steps {
sh '''
git checkout 3.0
git pull
cd cost-interfaces
mvn clean package
mvn deploy'''
......@@ -24,8 +22,6 @@ pipeline {
stage('service 编译打包部署') {
steps {
sh '''
git checkout 3.0
git pull
cd cost-service
mvn clean package docker:build -DpushImage'''
}
......
package com.bailuntec.cost.api.response;
import lombok.Data;
/**
* <p>
* 财务系统返回对象封装
* </p>
*
* @author robbendev
* @since 2021/1/18 3:14 下午
*/
@Data
public class CostToCwResult<T> {
private Boolean success = true;
private String msg = "success";
private T result;
public static CostToCwResult<Boolean> success() {
CostToCwResult<Boolean> result = new CostToCwResult<>();
result.setResult(true);
return result;
}
}
......@@ -283,7 +283,7 @@
<version>1.0.0</version>
<configuration>
<skipDockerBuild>false</skipDockerBuild>
<imageName>ccr.ccs.tencentyun.com/blt.cost/dc-cost-system:${maven.build.timestamp}
<imageName>ccr.ccs.tencentyun.com/blt.cost/dc-cost-system-refactor:${maven.build.timestamp}
</imageName>
<dockerDirectory>src/main/docker</dockerDirectory>
<resources>
......
......@@ -29,7 +29,6 @@ public class CostApiController implements CostApi {
@Resource
private CostApiService costApiService;
private static Logger logger = LoggerFactory.getLogger(CostApiController.class);
......@@ -72,7 +71,6 @@ public class CostApiController implements CostApi {
public CostResult<List<ManageCostDto>> manageCostList(@RequestBody ManageCostListReq req) {
List<ManageCostDto> manageCostDtoList = costApiService.manageCostList(req);
return CostResult.success(manageCostDtoList);
}
......
package com.blt.other.module.cost.controller;
import com.bailuntec.cost.api.dto.CostDto;
import com.bailuntec.cost.api.response.CostResult;
import com.blt.other.common.util.AxiosUtil;
import com.blt.other.module.cost.dto.response.UpdateCostResp;
import com.blt.other.module.cost.model.CostDomain;
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.springframework.core.io.FileSystemResource;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
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.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;
@Api(tags = "审核费用单接口")
@RestController
@RequestMapping("/cost/check")
public class CostCheckController {
@Resource
private CostService costService;
@Resource
private CostCashiercallbackService costCashiercallbackService;
@Resource
private CostLogService costLogService;
private UpdateCostResp changeStatus(String costNo, Integer costStatus) {
CostDomain costDomain = costService.getCostByCostNo(costNo);
costDomain.setCostNo(costNo);
costDomain.setCostStatus(costStatus);
if (costStatus == 2) {
costDomain.setAuditTime(new Date());
}
if (null != costDomain.getIsLend()) {
if (1 == costDomain.getIsLend() && 4 == costStatus) {
costDomain.setLendStatus(1);
}
}
return costService.updateCost(costDomain);
}
// ================================== 结束费用 ======================================================
@PostMapping("finish")
public UpdateCostResp finish(HttpServletRequest request, HttpServletResponse response) {
AxiosUtil.setCors(response, request);
String costNo = request.getParameter("costNo");
return changeStatus(costNo, 7);
}
// ================================== 文件下载 ======================================================
@GetMapping("download")
public ResponseEntity<InputStreamResource> download(HttpServletRequest request, HttpServletResponse response) throws IOException {
// AxiosUtil.setCors(response,request);
String costNo = request.getParameter("costNo");
String fileType = request.getParameter("fileType");
CostDomain costByCostNo = costService.getCostByCostNo(costNo);
CostDto cost = costByCostNo.castToDto();
String filePath = null;
String fileName = null;
if ("file".equals(fileType)) {
filePath = cost.getFilePath();
fileName = cost.getFileName();
} else if ("morFile".equals(fileType)) {
filePath = cost.getMorFilePath();
fileName = cost.getMorFileName();
}
FileSystemResource file = new FileSystemResource(filePath);
HttpHeaders headers = new HttpHeaders();
headers.add("Cache-Control", "no-cache, no-store, must-revalidate");
// new String(fileName.getBytes("UTF-8"),"iso-8859-1") 解决文件下载的时候文件名乱码的问题
headers.add("Content-Disposition", String.format("attachment; filename=\"%s\"", new String(fileName.getBytes("UTF-8"), "iso-8859-1")));
headers.add("Pragma", "no-cache");
headers.add("Expires", "0");
return ResponseEntity
.ok()
.headers(headers)
.contentLength(file.contentLength())
.contentType(MediaType.parseMediaType("application/octet-stream"))
.body(new InputStreamResource(file.getInputStream()));
}
/**
* 借支单结清
*
* @param response
* @param request
* @return
*/
@ApiOperation("借支单结清")
@PostMapping("/finishLend")
public UpdateCostResp finishLend(HttpServletResponse response, HttpServletRequest request) {
AxiosUtil.setCors(response, request);
String costNo = request.getParameter("costNo");
String updateuserid = request.getParameter("updateuserid");
CostDomain costDomain = new CostDomain();
costDomain.setCostNo(costNo);
costDomain.setLendStatus(4);
UpdateCostResp resp = costService.updateCost(costDomain);
resp.setMsg("已结清");
costLogService.save(costNo, Integer.parseInt(updateuserid), "操作结清");
return resp;
}
@ApiOperation("出纳单附件下载")
@GetMapping("downCashierAnnex")
public CostResult<String> downCashierAnnex() {
costCashiercallbackService.downCashierAnnex();
return CostResult.success("出纳单附件下载完成", null);
}
}
package com.blt.other.module.cost.controller;
import com.bailuntec.cost.api.response.CostResult;
import com.blt.other.module.cost.service.CostCompanyService;
import com.blt.other.database.model.CostCompanyDomain;
import com.blt.other.module.cost.service.CostCompanyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -21,6 +22,7 @@ import java.util.List;
*/
@Api(tags = "财务主体接口")
@RestController
@Slf4j
public class CostCompanyController {
@Resource
......@@ -32,7 +34,7 @@ public class CostCompanyController {
return costCompanyService.getAllCompany();
}
@ApiOperation("获取所有财务付款主体权限")
@ApiOperation("获取所有财务付款主体权限")
@GetMapping("/cost/type/getAllCompanyAuthority")
public List<CostCompanyDomain> getAllCompanyAuthority() {
return costCompanyService.getAllCompanyAuthority();
......
......@@ -142,7 +142,6 @@ public class CostDetailController {
return costDetailService.reset(req);
}
@GetMapping("/getCostLogs")
public Map<String, Object> getCostLogs(HttpServletResponse response, HttpServletRequest request) {
AxiosUtil.setCors(response, request);
......
......@@ -14,8 +14,7 @@ import com.blt.other.module.cost.service.CostLogService;
import com.blt.other.module.cost.service.CostService;
import com.blt.other.module.sys.service.UserService;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -28,8 +27,8 @@ import java.math.BigDecimal;
@Api(tags = "财务信息接口")
@RestController
@RequestMapping("cost/finansys/")
@Slf4j
public class CostFinansysDetailController {
private Logger logger = LoggerFactory.getLogger(CostFinansysDetailController.class);
@Resource
private CostApplycallbackService costApplycallbackService;
......@@ -102,7 +101,7 @@ public class CostFinansysDetailController {
try {
data.setChineseAmount(CurUtils.digitUppercase(cost.getPayPlanAmountDto()));//中文金额
} catch (Exception e) {
logger.error("CostFinansysDetailController", e);
log.error("CostFinansysDetailController", e);
}
} else {
data.setUnitCode(cost.getDic());
......@@ -111,7 +110,7 @@ public class CostFinansysDetailController {
try {
data.setChineseAmount(CurUtils.digitUppercase(cost.getAmountDto()));//中文金额
} catch (Exception e) {
logger.error("CostFinansysDetailController", e);
log.error("CostFinansysDetailController", e);
}
}
data.setCWOperationer("");//财务
......
......@@ -12,20 +12,10 @@ import com.blt.other.module.cost.service.CostPlanService;
import com.blt.other.module.cost.service.CostPlanTempService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.util.List;
@Api(tags = "费用计划接口")
......@@ -52,12 +42,10 @@ public class CostPlanController {
return costPlanSearchService.searchByKey(searchKey);
}
@ApiOperation("根据费用计划单号查询费用计划单")
@PostMapping("getCostPlan")
public GetCostPlanResp getCostPlan(@RequestParam String costPlanNo) {
return costPlanService.getByPlanNo(costPlanNo);
}
@ApiOperation("获取费用单计划子项")
......@@ -76,30 +64,4 @@ public class CostPlanController {
return resp;
}
@GetMapping("download")
public ResponseEntity<InputStreamResource> download(HttpServletRequest request, HttpServletResponse response) throws IOException {
String costPlanNo = request.getParameter("costPlanNo");
GetCostPlanResp byPlanNo = costPlanService.getByPlanNo(costPlanNo);
String filePath = byPlanNo.getCostPlan().getFilePath();
String fileName = byPlanNo.getFileName();
FileSystemResource file = new FileSystemResource(filePath);
HttpHeaders headers = new HttpHeaders();
headers.add("Cache-Control", "no-cache, no-store, must-revalidate");
// new String(fileName.getBytes("UTF-8"),"iso-8859-1") 解决文件下载的时候文件名乱码的问题
headers.add("Content-Disposition", String.format("attachment; filename=\"%s\"", new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1)));
headers.add("Pragma", "no-cache");
headers.add("Expires", "0");
return ResponseEntity
.ok()
.headers(headers)
.contentLength(file.contentLength())
.contentType(MediaType.parseMediaType("application/octet-stream"))
.body(new InputStreamResource(file.getInputStream()));
}
}
package com.blt.other.module.cost.dto.response;
package com.blt.other.module.cost.dto.request;
import com.bailuntec.cost.api.dto.CostDto;
import lombok.Data;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/11/27 4:30 下午
* @since 2021/1/18 3:09 下午
*/
@Data
public class GetCostByCostPlanNoResp {
List<CostDto> costs;
public class InvoiceReq {
private String costNo;
private Integer hasInvoice;
private Integer updateUserid;
}
......@@ -6,8 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.blt.other.module.cost.dto.request.CheckCostListReq;
import com.blt.other.module.cost.dto.request.CostQueryPageReq;
import com.blt.other.module.cost.dto.response.CostPageResult;
import com.blt.other.module.cost.dto.response.UpdateCostResp;
import com.blt.other.module.cost.dto.request.InvoiceReq;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.vo.ApplyCallbackUrlVo;
import com.blt.other.module.cost.vo.CashierCallbackUrlVo;
......@@ -20,13 +19,6 @@ public interface CostService {
void setPrimaryDepartment(List<CostDomain> costDomains);
/**
* 获取所有费用单
*
* @return allCost
*/
CostPageResult getAllCost(Integer pageNum, Integer pageSize, Integer userId, String projectTypes);
/**
* 根据 costNo 获取 cost
*
* @param costNo costNo
......@@ -40,7 +32,7 @@ public interface CostService {
* @param costDomain costDomain
* @return res
*/
UpdateCostResp updateCost(CostDomain costDomain);
void updateCost(CostDomain costDomain);
/**
......@@ -97,7 +89,7 @@ public interface CostService {
/**
* 审核费用单列表
* 审核费用单列表
*
* @param req req
* @return 费用单列表
......@@ -143,4 +135,13 @@ public interface CostService {
* @return res
*/
Page<CostDomain> queryPage(CostQueryPageReq req);
//修改发票信息
void resetInvoice(String costNo, String filePath);
//提交审核
void submitAudit(String costNo);
//修改发票状态
void invoice(InvoiceReq req);
}
......@@ -26,31 +26,32 @@ import com.blt.other.module.cost.dao.CostDetailDao;
import com.blt.other.module.cost.dao.CostTemplateBaseColMapper;
import com.blt.other.module.cost.dto.request.CheckCostListReq;
import com.blt.other.module.cost.dto.request.CostQueryPageReq;
import com.blt.other.module.cost.dto.response.CostPageResult;
import com.blt.other.module.cost.dto.response.UpdateCostResp;
import com.blt.other.module.cost.dto.request.InvoiceReq;
import com.blt.other.module.cost.model.CostCurrentReviewer;
import com.blt.other.module.cost.model.CostDetailDomain;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.model.CostTemplateBaseCol;
import com.blt.other.module.cost.service.*;
import com.blt.other.module.cost.service.impl.costcheck.CostContext;
import com.blt.other.module.cost.service.impl.costcheck.UnSubmitState;
import com.blt.other.module.cost.vo.ApplyCallbackUrlDataDataVo;
import com.blt.other.module.cost.vo.ApplyCallbackUrlVo;
import com.blt.other.module.cost.vo.CashierCallbackUrlDataDataVo;
import com.blt.other.module.cost.vo.CashierCallbackUrlVo;
import com.blt.other.module.sys.service.UserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
......@@ -84,27 +85,13 @@ public abstract class AbstractCostService implements CostService {
CostUrlProperties costUrlProperties;
@Resource
OaDepartmentMapper oaDepartmentMapper;
@Resource
OaUserMapper oaUserMapper;
@Resource
ICostCurrentReviewerService costCurrentReviewerService;
@Resource
CostTemplateBaseColMapper costTemplateBaseColMapper;
@Override
public CostPageResult 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);
this.setPrimaryDepartment(costDomains);
CostPageResult result = new CostPageResult();
result.setCosts(costDomains.stream().map(CostDomain::castToDto).collect(Collectors.toList()));
result.setPageInfo(new PageInfo<>(costDomains));
return result;
}
@Override
public void setPrimaryDepartment(List<CostDomain> costDomains) {
......@@ -138,11 +125,6 @@ public abstract class AbstractCostService implements CostService {
}
}
@Resource
OaUserMapper oaUserMapper;
@Resource
ICostCurrentReviewerService costCurrentReviewerService;
@Override
public CostDomain getCostByCostNo(String costNo) {
CostDomain costDomain = costDao.selectByCostNo(costNo);
......@@ -161,14 +143,9 @@ public abstract class AbstractCostService implements CostService {
return costDomain;
}
@Resource
CostTemplateBaseColMapper costTemplateBaseColMapper;
@Transactional(rollbackFor = Exception.class)
@Override
public UpdateCostResp updateCost(CostDomain costDomain) {
UpdateCostResp resp = new UpdateCostResp();
public void updateCost(CostDomain costDomain) {
if (null != costDomain.getCompanyNo()) {
costDomain.setCompanyName(costCompanyDao.selectByNo(costDomain.getCompanyNo()).getCompanyName());
......@@ -186,18 +163,14 @@ public abstract class AbstractCostService implements CostService {
costDomain.setToRmbRate(toRmbRate);
costDomain.setAmountRmb(costDomain.getAmount().multiply(toRmbRate).setScale(2, BigDecimal.ROUND_HALF_UP));
Integer update = costDao.update(costDomain, new LambdaQueryWrapper<CostDomain>()
costDao.update(costDomain, new LambdaQueryWrapper<CostDomain>()
.eq(CostDomain::getCostNo, costDomain.getCostNo()));
costLogService.save(costDomain.getCostNo(), this.getCostByCostNo(costDomain.getCostNo()).getCreateUserid(), "修改费用单信息");
resp.setMsg("success");
resp.setResult(this.getCostByCostNo(costDomain.getCostNo()));
resp.setUpdate(update);
return resp;
}
@Override
public List<CostDto> getByCostPlanNo(String costPlanNo) {
return costDao.selectByCostPlanNo(costPlanNo)
......@@ -314,6 +287,12 @@ public abstract class AbstractCostService implements CostService {
@Override
public void applyCallback(ApplyCallbackUrlVo applyCallbackUrlVo) {
String costNo = applyCallbackUrlVo.getId().toUpperCase();
if (costNo.contains("-")) {
costNo = costNo.split("-")[0];
}
// 执行保存反馈信息流程
CostApplycallbackDomain applyCallbackDomain = new CostApplycallbackDomain();
......@@ -323,7 +302,6 @@ public abstract class AbstractCostService implements CostService {
);
BeanUtils.copyProperties(applyCallbackUrlDataDataVo, applyCallbackDomain);
String costNo = applyCallbackUrlVo.getId().toUpperCase();
if (costNo.contains("-")) {
costNo = costNo.split("-")[0];
}
......@@ -341,6 +319,14 @@ public abstract class AbstractCostService implements CostService {
@Override
public void cashierCallback(CashierCallbackUrlVo cashierCallbackUrlVo) {
String costNo = cashierCallbackUrlVo.getId().toUpperCase();
if (costNo.contains("-")) {
costNo = costNo.split("-")[0];
}
if (!(costNo.startsWith("F") || costNo.startsWith("SF"))) {
return;
}
CostCashiercallbackDomain costCashiercallbackDomain = new CostCashiercallbackDomain();
CashierCallbackUrlDataDataVo cashierCallbackUrlDataDataVo = JsonUtilByFsJson.jsonToBean(
......@@ -352,7 +338,6 @@ public abstract class AbstractCostService implements CostService {
BeanUtils.copyProperties(cashierCallbackUrlDataDataVo, costCashiercallbackDomain);
BeanUtils.copyProperties(cashierCallbackUrlDataDataVo.getPaydetail(), costCashiercallbackDomain);
String costNo = cashierCallbackUrlVo.getId().toUpperCase();
if (costNo.contains("-")) {
String[] split = costNo.split("-");
costNo = split[0];
......@@ -418,6 +403,42 @@ public abstract class AbstractCostService implements CostService {
return page;
}
@Override
public void resetInvoice(String costNo, String filePath) {
CostDomain costDomain = this.getCostByCostNo(costNo);
costDomain.setCostNo(costNo);
costDomain.setHasInvoice(1);
costDomain.setFilePath(filePath);
costLogService.save(costNo, this.getCostByCostNo(costNo).getCreateUserid(), "修改发票信息");
}
@Resource
UnSubmitState unSubmitState;
@Override
public void submitAudit(String costNo) {
CostDomain costDomain = this.getCostByCostNo(costNo);
CostContext costContext = new CostContext(costNo, costDomain.getCreateUserid());
costContext.setCostState(unSubmitState);
costContext.handle();
}
@Override
public void invoice(InvoiceReq req) {
CostDomain costDomain = this.getCostByCostNo(req.getCostNo());
costDomain.setHasInvoice(req.getHasInvoice());
if (req.getHasInvoice() == 0) {
costLogService.save(req.getCostNo(), req.getUpdateUserid(), "更改发票状态为:未给");
} else if (req.getHasInvoice() == 1) {
costLogService.save(req.getCostNo(), req.getUpdateUserid(), "更改发票状态为:已给");
}
this.updateById(costDomain);
}
@Resource
CostCashiercallbackService costCashiercallbackService;
......
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