Commit 5d921f92 by huluobin

update

parent e0249ef0
...@@ -6,37 +6,22 @@ import com.bailuntec.cost.api.dto.CostListPrintDto; ...@@ -6,37 +6,22 @@ import com.bailuntec.cost.api.dto.CostListPrintDto;
import com.bailuntec.cost.api.response.CostResult; import com.bailuntec.cost.api.response.CostResult;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.blt.other.common.util.AxiosUtil;
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.dao.CostDao;
import com.blt.other.module.cost.dto.request.CheckCostListReq; import com.blt.other.module.cost.dto.request.CheckCostListReq;
import com.blt.other.module.cost.dto.response.*; import com.blt.other.module.cost.dto.response.*;
import com.blt.other.module.cost.model.CostDomain; import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostExportService;
import com.blt.other.module.cost.service.CostListSearchService; import com.blt.other.module.cost.service.CostListSearchService;
import com.blt.other.module.cost.service.CostLogService; import com.blt.other.module.cost.service.CostLogService;
import com.blt.other.module.cost.service.CostService; import com.blt.other.module.cost.service.CostService;
import com.blt.other.module.cost.service.impl.cost.CostServiceFactory; 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.service.impl.costcheck.*;
import com.blt.other.module.cost.vo.*; import com.blt.other.module.cost.vo.*;
import com.blt.other.module.database.model.CostExpDomain;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; 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 org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -54,33 +39,24 @@ import java.util.stream.Collectors; ...@@ -54,33 +39,24 @@ import java.util.stream.Collectors;
@RestController @RestController
@Api(tags = "费用单接口") @Api(tags = "费用单接口")
public class CostController { public class CostController {
private CostService costService; private CostService costService;
@Resource @Resource
CostListSearchService costListSearchService; CostListSearchService costListSearchService;
@Resource @Resource
CostExportService costExportService;
@Resource
CostLogService costLogService; CostLogService costLogService;
@Resource @Resource
CostDao costDao; CostDao costDao;
@Autowired @Resource
UnSubmitState unSubmitState; UnSubmitState unSubmitState;
@Autowired @Resource
DepartmentCheckState departmentCheckState; DepartmentCheckState departmentCheckState;
@Autowired @Resource
FinalCheckState finalCheckState; FinalCheckState finalCheckState;
@Autowired @Resource
FinancialCheckState financialCheckState; FinancialCheckState financialCheckState;
@Autowired
PayedState payedState; @Resource
@Autowired
RefuseState refuseState;
@Autowired
UnPayState unPayState;
@Autowired
HrCheckState hrCheckState; HrCheckState hrCheckState;
@ApiOperation("获取前端要打印的费用单列表") @ApiOperation("获取前端要打印的费用单列表")
...@@ -223,7 +199,7 @@ public class CostController { ...@@ -223,7 +199,7 @@ public class CostController {
} }
@ApiOperation("审核费用单列表") @ApiOperation("待我审核费用单列表")
@GetMapping("/checkCostList") @GetMapping("/checkCostList")
public CostResult<IPage<CostDto>> checkCostList(CheckCostListReq req) { public CostResult<IPage<CostDto>> checkCostList(CheckCostListReq req) {
costService = CostServiceFactory.getCostService(); costService = CostServiceFactory.getCostService();
...@@ -470,100 +446,4 @@ public class CostController { ...@@ -470,100 +446,4 @@ public class CostController {
return resp; return resp;
} }
@PostMapping("/list/exportList")
public String exportList(HttpServletResponse response, HttpServletRequest request) {
Enumeration<String> parameterNames = request.getParameterNames();
if (null != parameterNames && parameterNames.hasMoreElements()) {
String s = parameterNames.nextElement();
CostExportVo costExportVo = (CostExportVo) MyMapperUtil.getObject(s, CostExportVo.class);
String filePath = costExportService.exportFees(costExportVo.getParams().getExportNos());
// 保存下载记录
CostExpDomain exp = costExportService.saveRecord(costExportVo, filePath);
return exp.getExpNo();
}
return null;
}
@PostMapping("/list/exportListAll")
public String exportListAll(HttpServletResponse response, HttpServletRequest request) {
CostService costService = CostServiceFactory.getCostService();
AxiosUtil.setCors(response, request);
Enumeration<String> parameterNames = request.getParameterNames();
if (null != parameterNames && parameterNames.hasMoreElements()) {
String s = parameterNames.nextElement();
CostExportVo costExportVo = JsonUtilByFsJson.jsonToBean(s, CostExportVo.class);
List<String> exportNos;
if (null != costExportVo.getParams().getKeys().getCostForm() && 3 == costExportVo.getParams().getKeys().getCostForm()) {
costExportVo.getParams().getKeys().setIsLend(1);
}
if (null != costExportVo.getParams().getKeys().getCostForm() && 4 == costExportVo.getParams().getKeys().getCostForm()) {
costExportVo.getParams().getKeys().setCostForm(3);
costExportVo.getParams().getKeys().setIsLend(2);
}
exportNos = costDao.listCostNoAll(costExportVo);
String filePath = costExportService.exportFees(exportNos);
// 保存下载记录
CostExpDomain exp = costExportService.saveRecord(costExportVo, filePath);
return exp.getExpNo();
}
return null;
}
@GetMapping("list/download")
public ResponseEntity<InputStreamResource> download(HttpServletRequest request, HttpServletResponse response) throws IOException {
String pathNo = request.getParameter("pathNo");
CostExpDomain exp = costExportService.getByExpNo(pathNo);
String filePath = exp.getExpPath();
String fileName = PathUtil.getFileName(filePath);
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()));
}
@GetMapping("list/downloadCashierAnnex")
public ResponseEntity<InputStreamResource> downCashierAnnex(HttpServletRequest request, HttpServletResponse response) throws IOException {
String detailNo = request.getParameter("detailNo");
CostDomain cost = costDao.selectByCostNo(detailNo);
String filePath = null;
String fileName = null;
if (null != cost) {
filePath = cost.getCashierFilePath();
if (null != filePath) {
fileName = filePath.substring(filePath.lastIndexOf("/") + 1);
}
} else {
return null;
}
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()));
}
} }
package com.blt.other.module.cost.controller.finansys; package com.blt.other.module.cost.controller;
import com.bailuntec.cost.api.dto.CostDto; import com.bailuntec.cost.api.dto.CostDto;
import com.blt.other.module.auth.service.UserService; import com.blt.other.module.auth.service.UserService;
......
package com.blt.other.module.cost.controller;
import com.bailuntec.common.JsonUtilByFsJson;
import com.blt.other.common.util.AxiosUtil;
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.model.CostDomain;
import com.blt.other.module.cost.service.CostExportService;
import com.blt.other.module.cost.service.CostService;
import com.blt.other.module.cost.service.impl.cost.CostServiceFactory;
import com.blt.other.module.cost.vo.CostExportVo;
import com.blt.other.module.database.model.CostExpDomain;
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.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Enumeration;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/12/16 1:59 下午
*/
@RestController
public class CostReportController {
@Resource
CostExportService costExportService;
@Resource
CostDao costDao;
@PostMapping("/cost/list/exportList")
public String exportList(HttpServletResponse response, HttpServletRequest request) {
Enumeration<String> parameterNames = request.getParameterNames();
if (null != parameterNames && parameterNames.hasMoreElements()) {
String s = parameterNames.nextElement();
CostExportVo costExportVo = (CostExportVo) MyMapperUtil.getObject(s, CostExportVo.class);
String filePath = costExportService.exportFees(costExportVo.getParams().getExportNos());
// 保存下载记录
CostExpDomain exp = costExportService.saveRecord(costExportVo, filePath);
return exp.getExpNo();
}
return null;
}
@PostMapping("/cost/list/exportListAll")
public String exportListAll(HttpServletResponse response, HttpServletRequest request) {
CostService costService = CostServiceFactory.getCostService();
AxiosUtil.setCors(response, request);
Enumeration<String> parameterNames = request.getParameterNames();
if (null != parameterNames && parameterNames.hasMoreElements()) {
String s = parameterNames.nextElement();
CostExportVo costExportVo = JsonUtilByFsJson.jsonToBean(s, CostExportVo.class);
List<String> exportNos;
if (null != costExportVo.getParams().getKeys().getCostForm() && 3 == costExportVo.getParams().getKeys().getCostForm()) {
costExportVo.getParams().getKeys().setIsLend(1);
}
if (null != costExportVo.getParams().getKeys().getCostForm() && 4 == costExportVo.getParams().getKeys().getCostForm()) {
costExportVo.getParams().getKeys().setCostForm(3);
costExportVo.getParams().getKeys().setIsLend(2);
}
exportNos = costDao.listCostNoAll(costExportVo);
String filePath = costExportService.exportFees(exportNos);
// 保存下载记录
CostExpDomain exp = costExportService.saveRecord(costExportVo, filePath);
return exp.getExpNo();
}
return null;
}
@GetMapping("/cost/list/download")
public ResponseEntity<InputStreamResource> download(HttpServletRequest request, HttpServletResponse response) throws IOException {
String pathNo = request.getParameter("pathNo");
CostExpDomain exp = costExportService.getByExpNo(pathNo);
String filePath = exp.getExpPath();
String fileName = PathUtil.getFileName(filePath);
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()));
}
@GetMapping("/cost/list/downloadCashierAnnex")
public ResponseEntity<InputStreamResource> downCashierAnnex(HttpServletRequest request, HttpServletResponse response) throws IOException {
String detailNo = request.getParameter("detailNo");
CostDomain cost = costDao.selectByCostNo(detailNo);
String filePath = null;
String fileName = null;
if (null != cost) {
filePath = cost.getCashierFilePath();
if (null != filePath) {
fileName = filePath.substring(filePath.lastIndexOf("/") + 1);
}
} else {
return null;
}
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()));
}
}
package com.blt.other.module.cost.controller.finansys; package com.blt.other.module.cost.controller;
import com.bailuntec.cost.api.dto.LogisticsFinansysDto; import com.bailuntec.cost.api.dto.LogisticsFinansysDto;
import com.bailuntec.cost.api.dto.SubLogisticsFinansysDto; import com.bailuntec.cost.api.dto.SubLogisticsFinansysDto;
......
...@@ -62,9 +62,30 @@ public interface CostDao extends BaseMapper<CostDomain> { ...@@ -62,9 +62,30 @@ public interface CostDao extends BaseMapper<CostDomain> {
// //
List<String> listCostNoAll(CostExportVo costExportVo); List<String> listCostNoAll(CostExportVo costExportVo);
//管理后台审核列表查询
IPage<CostDomain> checkCostList(@Param("page") IPage<CostDomain> page, //管理后台 需要财务审核或者需要我最终审核费用列表查询
@Param("req") CheckCostListReq req); IPage<CostDomain> financialOrFinalCheckCostList(@Param("page") IPage<CostDomain> page,
@Param("req") CheckCostListReq req);
//管理后台 需要我部门审核费用列表查询
IPage<CostDomain> departmentCheckCostList(@Param("page") IPage<CostDomain> page,
@Param("req") CheckCostListReq req);
//管理后台 所有需要我部门审核 + 我已经部门审核通过 费用列表查询
IPage<CostDomain> departmentCheckAllCostList(@Param("page") IPage<CostDomain> page,
@Param("req") CheckCostListReq req);
//管理后台 已经部门手动审核费用列表查询
IPage<CostDomain> departmentManualCheckLllCostList(@Param("page") IPage<CostDomain> page,
@Param("req") CheckCostListReq req);
//管理后台 已经部门自动核费用列表查询
IPage<CostDomain> departmentAutoCheckLllCostList(@Param("page") IPage<CostDomain> page,
@Param("req") CheckCostListReq req);
//管理后台 需要我人事审核费用列表查询
IPage<CostDomain> hrCheckCostList(@Param("page") IPage<CostDomain> page,
@Param("req") CheckCostListReq req);
//小程序审核列表查询 //小程序审核列表查询
Page<CostDomain> appCheckCostList(@Param("page") IPage<CostDomain> page, Page<CostDomain> appCheckCostList(@Param("page") IPage<CostDomain> page,
......
...@@ -85,9 +85,6 @@ public class CostDomain implements Serializable { ...@@ -85,9 +85,6 @@ public class CostDomain implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime; private Date createTime;
// @ApiModelProperty("关联子单")puh
// @Deprecated
// private String sonCostNo;
@ApiModelProperty("关联父单") @ApiModelProperty("关联父单")
private String supCostNo; private String supCostNo;
...@@ -225,17 +222,12 @@ public class CostDomain implements Serializable { ...@@ -225,17 +222,12 @@ public class CostDomain implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private Integer primaryDepartmentId; private Integer primaryDepartmentId;
@TableField(exist = false) @TableField(exist = false)
private String primaryDepartmentName; private String primaryDepartmentName;
@ApiModelProperty("最终审核人") @TableField(exist = false)
private String finalReviewerUserName; private String costCurrentReviewer;
@ApiModelProperty("财务审核人")
private String financialFinalReviewerUserName;
@ApiModelProperty("部门审核人")
private String departmentReviewerUserName;
@ApiModelProperty("行政审核人")
private String hrReviewerUserName;
public CostDto castToDto() { public CostDto castToDto() {
......
...@@ -4,12 +4,10 @@ import com.bailuntec.common.ListUtil; ...@@ -4,12 +4,10 @@ import com.bailuntec.common.ListUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blt.other.module.cost.dao.CostCurrentReviewerMapper; import com.blt.other.module.cost.dao.CostCurrentReviewerMapper;
import com.blt.other.module.cost.dao.CostDao;
import com.blt.other.module.cost.model.CostCurrentReviewer; import com.blt.other.module.cost.model.CostCurrentReviewer;
import com.blt.other.module.cost.service.ICostCurrentReviewerService; import com.blt.other.module.cost.service.ICostCurrentReviewerService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -28,6 +26,6 @@ public class CostCurrentReviewerServiceImpl extends ServiceImpl<CostCurrentRevie ...@@ -28,6 +26,6 @@ public class CostCurrentReviewerServiceImpl extends ServiceImpl<CostCurrentRevie
List<CostCurrentReviewer> costCurrentReviewerList = baseMapper.selectList(new LambdaQueryWrapper<CostCurrentReviewer>() List<CostCurrentReviewer> costCurrentReviewerList = baseMapper.selectList(new LambdaQueryWrapper<CostCurrentReviewer>()
.eq(CostCurrentReviewer::getCostNo, costNo)); .eq(CostCurrentReviewer::getCostNo, costNo));
return ListUtil.isNotEmpty(costCurrentReviewerList) && costCurrentReviewerList.stream() return ListUtil.isNotEmpty(costCurrentReviewerList) && costCurrentReviewerList.stream()
.map(CostCurrentReviewer::getOaUserId).anyMatch(id -> id.equals(oaUserId)) .map(CostCurrentReviewer::getOaUserId).anyMatch(id -> id.equals(oaUserId));
} }
} }
...@@ -15,7 +15,6 @@ import com.blt.other.common.exception.BizRuntimeException; ...@@ -15,7 +15,6 @@ import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.common.util.CurUtils; import com.blt.other.common.util.CurUtils;
import com.blt.other.common.util.MoneyUtil; import com.blt.other.common.util.MoneyUtil;
import com.blt.other.common.util.SessionUtils; import com.blt.other.common.util.SessionUtils;
import com.blt.other.module.auth.dao.CostReviewerMapper;
import com.blt.other.module.auth.dao.OaDepartmentMapper; import com.blt.other.module.auth.dao.OaDepartmentMapper;
import com.blt.other.module.auth.dao.OaUserMapper; import com.blt.other.module.auth.dao.OaUserMapper;
import com.blt.other.module.auth.model.OaDepartment; import com.blt.other.module.auth.model.OaDepartment;
...@@ -137,8 +136,6 @@ public abstract class AbstractCostService implements CostService { ...@@ -137,8 +136,6 @@ public abstract class AbstractCostService implements CostService {
} }
@Resource @Resource
CostReviewerMapper costReviewerMapper;
@Resource
OaUserMapper oaUserMapper; OaUserMapper oaUserMapper;
@Resource @Resource
ICostCurrentReviewerService costCurrentReviewerService; ICostCurrentReviewerService costCurrentReviewerService;
...@@ -274,7 +271,27 @@ public abstract class AbstractCostService implements CostService { ...@@ -274,7 +271,27 @@ public abstract class AbstractCostService implements CostService {
@Override @Override
public IPage<CostDto> checkCostList(CheckCostListReq req) { public IPage<CostDto> checkCostList(CheckCostListReq req) {
IPage<CostDomain> page = new Page<>(req.getPageNum(), req.getPageSize()); IPage<CostDomain> page = new Page<>(req.getPageNum(), req.getPageSize());
return costDao.checkCostList(page, req).convert(CostDomain::castToDto); if (req.getType().equals(1)) {
return costDao.financialOrFinalCheckCostList(page, req).convert(CostDomain::castToDto);
}
if (req.getType().equals(2)) {
if (req.getStatus().equals(1)) {
return costDao.departmentCheckAllCostList(page, req).convert(CostDomain::castToDto);
}
if (req.getStatus().equals(2)) {
return costDao.departmentCheckCostList(page, req).convert(CostDomain::castToDto);
}
if (req.getStatus().equals(3)) {
return costDao.departmentManualCheckLllCostList(page, req).convert(CostDomain::castToDto);
}
if (req.getStatus().equals(4)) {
return costDao.departmentAutoCheckLllCostList(page, req).convert(CostDomain::castToDto);
}
}
if (req.getType().equals(3)) {
return costDao.hrCheckCostList(page, req).convert(CostDomain::castToDto);
}
throw new BizRuntimeException("invalid param");
} }
@Resource @Resource
......
...@@ -6,10 +6,12 @@ import com.blt.other.module.cost.dao.CostDao; ...@@ -6,10 +6,12 @@ import com.blt.other.module.cost.dao.CostDao;
import com.blt.other.module.cost.model.CostDomain; import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.model.CostTemplate; import com.blt.other.module.cost.model.CostTemplate;
import com.blt.other.module.cost.service.CostLogService; import com.blt.other.module.cost.service.CostLogService;
import com.blt.other.module.cost.service.ICostCurrentReviewerService;
import com.blt.other.module.cost.service.ICostTemplateService; import com.blt.other.module.cost.service.ICostTemplateService;
import com.blt.other.module.cost.service.impl.cost.CostSubscribe; import com.blt.other.module.cost.service.impl.cost.CostSubscribe;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -24,7 +26,8 @@ import java.util.stream.Collectors; ...@@ -24,7 +26,8 @@ import java.util.stream.Collectors;
public abstract class CostState { public abstract class CostState {
@Resource
ICostCurrentReviewerService costCurrentReviewerService;
@Autowired @Autowired
CostDao costDao; CostDao costDao;
@Autowired @Autowired
......
...@@ -3,7 +3,6 @@ package com.blt.other.module.cost.service.impl.costcheck; ...@@ -3,7 +3,6 @@ package com.blt.other.module.cost.service.impl.costcheck;
import com.blt.other.common.exception.BizRuntimeException; import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.module.auth.dao.OaDepartmentMapper; import com.blt.other.module.auth.dao.OaDepartmentMapper;
import com.blt.other.module.auth.dao.OaUserMapper; import com.blt.other.module.auth.dao.OaUserMapper;
import com.blt.other.module.auth.model.CostReviewer;
import com.blt.other.module.auth.model.OaDepartment; import com.blt.other.module.auth.model.OaDepartment;
import com.blt.other.module.auth.model.OaUser; import com.blt.other.module.auth.model.OaUser;
import com.blt.other.module.cost.model.CostDomain; import com.blt.other.module.cost.model.CostDomain;
...@@ -11,6 +10,7 @@ import com.blt.other.module.cost.model.CostTemplate; ...@@ -11,6 +10,7 @@ import com.blt.other.module.cost.model.CostTemplate;
import com.blt.other.module.database.model.CostLogDomain; import com.blt.other.module.database.model.CostLogDomain;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -33,6 +33,7 @@ public class DepartmentCheckState extends CostState { ...@@ -33,6 +33,7 @@ public class DepartmentCheckState extends CostState {
@Resource @Resource
OaUserMapper oaUserMapper; OaUserMapper oaUserMapper;
@Transactional(rollbackFor =Exception.class)
@Override @Override
public void handle() { public void handle() {
CostDomain costDomain = costContext.costDomain; CostDomain costDomain = costContext.costDomain;
...@@ -82,7 +83,7 @@ public class DepartmentCheckState extends CostState { ...@@ -82,7 +83,7 @@ public class DepartmentCheckState extends CostState {
OaUser costUser = oaUserMapper.selectByOaUserId(costDomain.getCreateUserid()); OaUser costUser = oaUserMapper.selectByOaUserId(costDomain.getCreateUserid());
if (costContext.currentUserId != null) { if (costContext.currentUserId != null) {
//人工审核通过 //人工审核通过
if (costReviewerMapper.queryOne(costUser.getPrimaryDepartmentId(), CostReviewer.departmentReviewer, currentUserId) != null) { if (!costCurrentReviewerService.canAudit(currentUserId, costDomain.getCostNo())) {
costDomain.setCostStatus(CostDomain.STATUS_HR_CHECK); costDomain.setCostStatus(CostDomain.STATUS_HR_CHECK);
costDomain.setLastModifyDate(LocalDateTime.now()); costDomain.setLastModifyDate(LocalDateTime.now());
costDao.updateById(costDomain); costDao.updateById(costDomain);
...@@ -114,7 +115,7 @@ public class DepartmentCheckState extends CostState { ...@@ -114,7 +115,7 @@ public class DepartmentCheckState extends CostState {
} }
//人工审核没权限 //人工审核没权限
if (costReviewerMapper.queryOne(costUser.getPrimaryDepartmentId(), CostReviewer.departmentReviewer, currentUserId) == null) { if (!costCurrentReviewerService.canAudit(currentUserId, costDomain.getCostNo())) {
throw new BizRuntimeException("current user no authority"); throw new BizRuntimeException("current user no authority");
} }
......
package com.blt.other.module.cost.service.impl.costcheck; package com.blt.other.module.cost.service.impl.costcheck;
import com.blt.other.common.exception.BizRuntimeException; import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.module.auth.model.CostReviewer;
import com.blt.other.module.cost.dao.CostCompanyDao;
import com.blt.other.module.cost.dao.CostLogDao; import com.blt.other.module.cost.dao.CostLogDao;
import com.blt.other.module.cost.model.CostDomain; import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.model.CostTemplate; import com.blt.other.module.cost.model.CostTemplate;
import com.blt.other.module.database.model.CostCompanyDomain;
import com.blt.other.module.database.model.CostLogDomain; import com.blt.other.module.database.model.CostLogDomain;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -30,8 +27,6 @@ public class FinalCheckState extends CostState { ...@@ -30,8 +27,6 @@ public class FinalCheckState extends CostState {
@Resource @Resource
UnPayState unPayState; UnPayState unPayState;
@Resource @Resource
CostCompanyDao costCompanyDao;
@Resource
CostLogDao costLogDao; CostLogDao costLogDao;
private void autoPass() { private void autoPass() {
...@@ -54,7 +49,6 @@ public class FinalCheckState extends CostState { ...@@ -54,7 +49,6 @@ public class FinalCheckState extends CostState {
CostDomain costDomain = costContext.costDomain; CostDomain costDomain = costContext.costDomain;
Integer currentUserId = costContext.currentUserId; Integer currentUserId = costContext.currentUserId;
CostTemplate costTemplate = costTemplateService.queryDetail(costDomain.getCostTemplateId()); CostTemplate costTemplate = costTemplateService.queryDetail(costDomain.getCostTemplateId());
CostCompanyDomain costCompany = costCompanyDao.selectByNo(costDomain.getCompanyNo());
//check status //check status
...@@ -89,7 +83,7 @@ public class FinalCheckState extends CostState { ...@@ -89,7 +83,7 @@ public class FinalCheckState extends CostState {
if (costContext.currentUserId != null) { if (costContext.currentUserId != null) {
//人工审核通过 //人工审核通过
if (costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.finalReviewer, currentUserId) != null) { if (!costCurrentReviewerService.canAudit(currentUserId, costDomain.getCostNo())) {
costDomain.setCostStatus(CostDomain.STATUS_UN_PAY); costDomain.setCostStatus(CostDomain.STATUS_UN_PAY);
costDomain.setLastModifyDate(LocalDateTime.now()); costDomain.setLastModifyDate(LocalDateTime.now());
costDao.updateById(costDomain); costDao.updateById(costDomain);
...@@ -115,15 +109,13 @@ public class FinalCheckState extends CostState { ...@@ -115,15 +109,13 @@ public class FinalCheckState extends CostState {
CostDomain costDomain = costContext.costDomain; CostDomain costDomain = costContext.costDomain;
Integer currentUserId = costContext.currentUserId; Integer currentUserId = costContext.currentUserId;
CostCompanyDomain costCompany = costCompanyDao.selectByNo(costDomain.getCompanyNo());
//check status //check status
if (!costDomain.getCostStatus().equals(CostDomain.STATUS_FINAL_CHECK)) { if (!costDomain.getCostStatus().equals(CostDomain.STATUS_FINAL_CHECK)) {
throw new BizRuntimeException("invalid status"); throw new BizRuntimeException("invalid status");
} }
//人工审核通过 //人工审核通过
if (costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.finalReviewer, currentUserId) == null) { if (!costCurrentReviewerService.canAudit(currentUserId, costDomain.getCostNo())) {
throw new BizRuntimeException("current user no authority"); throw new BizRuntimeException("current user no authority");
} }
......
...@@ -66,7 +66,7 @@ public class FinancialCheckState extends CostState { ...@@ -66,7 +66,7 @@ public class FinancialCheckState extends CostState {
CostCompanyDomain costCompany = costCompanyDao.selectByNo(costDomain.getCompanyNo()); CostCompanyDomain costCompany = costCompanyDao.selectByNo(costDomain.getCompanyNo());
if (costContext.currentUserId != null) { if (costContext.currentUserId != null) {
//人工审核通过 //人工审核通过
if (costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.financialReviewer, currentUserId) != null) { if (!costCurrentReviewerService.canAudit(currentUserId, costDomain.getCostNo())) {
costDomain.setCostStatus(CostDomain.STATUS_FINAL_CHECK); costDomain.setCostStatus(CostDomain.STATUS_FINAL_CHECK);
costDomain.setLastModifyDate(LocalDateTime.now()); costDomain.setLastModifyDate(LocalDateTime.now());
costDao.updateById(costDomain); costDao.updateById(costDomain);
...@@ -98,7 +98,7 @@ public class FinancialCheckState extends CostState { ...@@ -98,7 +98,7 @@ public class FinancialCheckState extends CostState {
} }
//人工审核通过 //人工审核通过
if (costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.financialReviewer, currentUserId) == null) { if (!costCurrentReviewerService.canAudit(currentUserId, costDomain.getCostNo())) {
throw new BizRuntimeException("current user no authority"); throw new BizRuntimeException("current user no authority");
} }
......
...@@ -63,10 +63,9 @@ public class HrCheckState extends CostState { ...@@ -63,10 +63,9 @@ public class HrCheckState extends CostState {
} }
//人工审核 //人工审核
CostCompanyDomain costCompany = costCompanyDao.selectByNo(costDomain.getCompanyNo());
if (costContext.currentUserId != null) { if (costContext.currentUserId != null) {
//人工审核通过 //人工审核通过
if (costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.hrReviewer, currentUserId) != null) { if (!costCurrentReviewerService.canAudit(currentUserId, costDomain.getCostNo())) {
costDomain.setCostStatus(CostDomain.STATUS_FINANCIAL_CHECK); costDomain.setCostStatus(CostDomain.STATUS_FINANCIAL_CHECK);
costDomain.setLastModifyDate(LocalDateTime.now()); costDomain.setLastModifyDate(LocalDateTime.now());
costDao.updateById(costDomain); costDao.updateById(costDomain);
...@@ -89,8 +88,6 @@ public class HrCheckState extends CostState { ...@@ -89,8 +88,6 @@ public class HrCheckState extends CostState {
CostDomain costDomain = costContext.costDomain; CostDomain costDomain = costContext.costDomain;
Integer currentUserId = costContext.currentUserId; Integer currentUserId = costContext.currentUserId;
OaUser costUser = oaUserMapper.selectByOaUserId(costDomain.getCreateUserid());
//check status //check status
if (!costDomain.getCostStatus().equals(CostDomain.STATUS_HR_CHECK)) { if (!costDomain.getCostStatus().equals(CostDomain.STATUS_HR_CHECK)) {
...@@ -99,7 +96,7 @@ public class HrCheckState extends CostState { ...@@ -99,7 +96,7 @@ public class HrCheckState extends CostState {
//人工审核没权限 //人工审核没权限
CostCompanyDomain costCompany = costCompanyDao.selectByNo(costDomain.getCompanyNo()); CostCompanyDomain costCompany = costCompanyDao.selectByNo(costDomain.getCompanyNo());
if (costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.hrReviewer, currentUserId) == null) { if (!costCurrentReviewerService.canAudit(currentUserId, costDomain.getCostNo())) {
throw new BizRuntimeException("current user no authority"); throw new BizRuntimeException("current user no authority");
} }
......
package com.blt.other.module.cost.service.impl.costcheck; package com.blt.other.module.cost.service.impl.costcheck;
import com.bailuntec.common.ListUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.blt.other.common.exception.BizRuntimeException; import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.module.auth.model.CostReviewer;
import com.blt.other.module.auth.model.OaUser;
import com.blt.other.module.cost.model.CostDomain; import com.blt.other.module.cost.model.CostDomain;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
/** /**
* <p> * <p>
...@@ -22,6 +27,20 @@ public class UnSubmitState extends CostState { ...@@ -22,6 +27,20 @@ public class UnSubmitState extends CostState {
@Autowired @Autowired
DepartmentCheckState departmentCheckState; DepartmentCheckState departmentCheckState;
@Override
void nextState(CostState costState) {
super.nextState(costState);
CostDomain costDomain = costContext.costDomain;
OaUser costUser = oaUserMapper.selectByOaUserId(costDomain.getCreateUserid());
List<CostReviewer> costReviewerList = costReviewerMapper.selectList(new LambdaQueryWrapper<CostReviewer>()
.eq(CostReviewer::getReferId, costUser.getPrimaryDepartmentId())
.eq(CostReviewer::getType, CostReviewer.departmentReviewer));
if (ListUtil.isNotEmpty(costReviewerList)) {
}
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public void handle() { public void handle() {
......
...@@ -11,46 +11,51 @@ ...@@ -11,46 +11,51 @@
<select id="selectAll" resultMap="cost"> <select id="selectAll" resultMap="cost">
SELECT SELECT
* t1.*,
group_concat(distinct t2.username) as cost_current_reviewer,
FROM FROM
cost cost t1
left join cost_current_reviewer t2 on t1.cost_no = t2.cost_no
<if test="userId != null"> <if test="userId != null">
where create_userid = #{userId} where t1.create_userid = #{userId}
</if> </if>
<if test="projectTypeList != null and projectTypeList.size() > 0"> <if test="projectTypeList != null and projectTypeList.size() > 0">
AND project_type in AND t1.project_type in
<foreach collection="projectTypeList" item="projectType" index="index" open="(" close=")" separator=","> <foreach collection="projectTypeList" item="projectType" index="index" open="(" close=")" separator=",">
#{projectType} #{projectType}
</foreach> </foreach>
</if> </if>
ORDER BY ORDER BY
id DESC t1.id DESC
</select> </select>
<select id="selectByCostNo" resultMap="cost"> <select id="selectByCostNo" resultMap="cost">
SELECT * SELECT t1.*,
FROM cost group_concat(distinct t2.username) as cost_current_reviewer,
WHERE cost_no = #{costNo} FROM cost t1
ORDER BY id left join cost_current_reviewer t2 on t1.cost_no = t2.cost_no
WHERE t1.cost_no = #{costNo}
ORDER BY t1.id
DESC DESC
</select> </select>
<select id="selectByKeys" resultType="com.blt.other.module.cost.model.CostDomain"> <select id="selectByKeys" resultType="com.blt.other.module.cost.model.CostDomain">
SELECT SELECT
* t1.*,
FROM group_concat(distinct t2.username) as cost_current_reviewer,
cost from cost t1
left join cost_current_reviewer t2 on t1.cost_no = t2.cost_no
WHERE WHERE
cost_status >= 1 t1.cost_status >= 1
<if test=" costForm!=null and costForm != ''">and cost_form= #{costForm}</if> <if test=" costForm!=null and costForm != ''">and t1.cost_form= #{costForm}</if>
<if test=" isLend!=null and isLend != ''">and is_lend=#{isLend}</if> <if test=" isLend!=null and isLend != ''">and t1.is_lend=#{isLend}</if>
<if test=" companyName!=null and companyName != ''">and company_name=#{companyName}</if> <if test=" companyName!=null and companyName != ''">and t1.company_name=#{companyName}</if>
<if test=" createUsername!=null and createUsername != ''">and create_username=#{createUsername}</if> <if test=" createUsername!=null and createUsername != ''">and t1.create_username=#{createUsername}</if>
<if test=" kindNo!=null and kindNo != ''">and kind_no=#{kindNo}</if> <if test=" kindNo!=null and kindNo != ''">and t1.kind_no=#{kindNo}</if>
<if test=" costStatus!=null and costStatus != ''">and cost_status=#{costStatus}</if> <if test=" costStatus!=null and costStatus != ''">and t1.cost_status=#{costStatus}</if>
<if test=" lendStatus!=null and lendStatus != ''">and lend_status=#{lendStatus}</if> <if test=" lendStatus!=null and lendStatus != ''">and t1.lend_status=#{lendStatus}</if>
ORDER BY ORDER BY
id DESC t1.id DESC
</select> </select>
<select id="selectByCostPlanNo" resultMap="cost"> <select id="selectByCostPlanNo" resultMap="cost">
...@@ -128,7 +133,6 @@ ...@@ -128,7 +133,6 @@
</select> </select>
<!--管理成本:查询付款单+收款单+借还单+采购单--> <!--管理成本:查询付款单+收款单+借还单+采购单-->
<select id="selectManageCost" resultType="com.bailuntec.cost.api.dto.ManageCostDto"> <select id="selectManageCost" resultType="com.bailuntec.cost.api.dto.ManageCostDto">
SELECT SELECT
...@@ -362,7 +366,6 @@ ...@@ -362,7 +366,6 @@
AND kind_name IN ('借款--其他应付款', '收款--其他应付款') AND kind_name IN ('借款--其他应付款', '收款--其他应付款')
</select> </select>
<select id="listCostNoAll" resultType="java.lang.String"> <select id="listCostNoAll" resultType="java.lang.String">
select cost_no from cost select cost_no from cost
WHERE WHERE
...@@ -410,72 +413,6 @@ ...@@ -410,72 +413,6 @@
</if> </if>
</select> </select>
<select id="checkCostList" resultMap="cost">
select t1.*,
group_concat(distinct t4.reviewer_user_name) as final_reviewer_user_name,
group_concat(distinct t5.reviewer_user_name) as financial_final_reviewer_user_name,
group_concat(distinct t7.reviewer_user_name) as department_reviewer_user_name,
group_concat(distinct t8.reviewer_user_name) as hr_reviewer_user_name
from cost t1
left join cost_log t2 on t1.cost_no = t2.cost_no
left join cost_company t3 on t1.company_no = t3.company_no
left join cost_reviewer t4 on t3.id = t4.refer_id and t4.type = 3
left join cost_reviewer t5 on t3.id = t5.refer_id and t5.type = 2
left join oa_user t6 on t1.create_userid = t6.oa_user_id
left join cost_reviewer t7 on t6.primary_department_id = t7.refer_id and t7.type = 1
left join cost_reviewer t8 on t3.id = t8.refer_id and t5.type = 4
where true
/*财务 或者 最终审核 只显示待审核的*/
<if test="req.type == 1">
and (t1.cost_status = 7 or t1.cost_status = 8)
and (t4.reviewer_user_id = #{req.userid} or t5.reviewer_user_id = #{req.userid})
</if>
/*行政审核*/
<if test="req.type == 3">
/* 全部 */
<if test=" req.status == 1 ">
and t1.company_name like concat('%','工会','%')
</if>
/*待行政审核*/
<if test=" req.status == 2 ">
and t1.cost_status = 9
</if>
/*行政已手动审核*/
<if test=" req.status == 3 ">
and t2.type = 8
</if>
</if>
/* 部门审核 */
<if test="req.type == 2">
/*0 待提交 1- 待财务审核 2待出纳付款 3被驳回 4已支付 5已作废 6-待部门审核 7-待财务审核 8-待最终审核人审核*/
/*全部 */
<if test=" req.status == 1 ">
and t1.cost_status not in (0,5,3)
</if>
/*待审核*/
<if test=" req.status == 2 ">
and t1.cost_status = 6
</if>
/*已手动审核 日志类型区分*/
<if test=" req.status == 3 ">
and t2.type = 5
</if>
/*已自动审核 日志类型区分*/
<if test=" req.status == 4 ">
and t2.type = 4
</if>
and (t7.reviewer_user_id = #{req.userid} )
</if>
<if test=" req.costNo!=null and req.costNo != ''">
and t1.cost_no like concat('%',#{req.costNo},'%')
</if>
group by
t1.id
order by t1.create_time desc
</select>
<select id="appCheckCostList" resultType="com.blt.other.module.cost.model.CostDomain"> <select id="appCheckCostList" resultType="com.blt.other.module.cost.model.CostDomain">
select t1.* select t1.*
from cost t1 from cost t1
...@@ -522,4 +459,67 @@ ...@@ -522,4 +459,67 @@
and create_time &lt;=#{req.endTime} and create_time &lt;=#{req.endTime}
</if> </if>
</select> </select>
<!--待部门审核-->
<select id="departmentCheckCostList" resultType="com.blt.other.module.cost.model.CostDomain">
select t1.*
from cost t1
left join cost_current_reviewer t3 on t1.cost_no = t3.cost_no and t3.oa_user_id = #{req.oaUserId}
where t1.cost_status = 6
and t3.id is not null
</select>
<!--待我部门审核 + 我已经部门手动审核 + 我已经部门自动审核-->
<select id="departmentCheckAllCostList" resultType="com.blt.other.module.cost.model.CostDomain">
select t1.*
from cost t1
left join cost_log t2 on t1.cost_no = t2.cost_no and t2.type in (2, 3) and t2.update_userid = #{req.oaUserId}
where t1.cost_status not in (0, 3, 5)
and t2.id is not null
union
select t1.*
from cost t1
left join cost_current_reviewer t3 on t1.cost_no = t3.cost_no and t3.oa_user_id = #{req.oaUserId}
where t1.cost_status = 6
and t3.id is not null
</select>
<!--我手动部门审核过的 -->
<select id="departmentManualCheckLllCostList" resultType="com.blt.other.module.cost.model.CostDomain">
select t1.*
from cost t1
left join cost_log t2 on t1.cost_no = t2.cost_no and t2.type = 3 and t2.update_userid = #{req.oaUserId}
left join cost_current_reviewer t3 on t1.cost_no = t3.cost_no and t3.oa_user_id = #{req.oaUserId}
where t1.cost_status not in (0, 3, 5)
and t2.id is not null
</select>
<!--我部门自动审核过的 -->
<select id="departmentAutoCheckLllCostList" resultType="com.blt.other.module.cost.model.CostDomain">
select t1.*
from cost t1
left join cost_log t2 on t1.cost_no = t2.cost_no and t2.type = 2 and t2.update_userid = #{req.oaUserId}
left join cost_current_reviewer t3 on t1.cost_no = t3.cost_no and t3.oa_user_id = #{req.oaUserId}
where t1.cost_status not in (0, 3, 5)
and t2.id is not null
</select>
<!--需要我财务审核的-->
<select id="financialOrFinalCheckCostList" resultType="com.blt.other.module.cost.model.CostDomain">
select t1.*
from cost t1
left join cost_current_reviewer t3 on t1.cost_no = t3.cost_no and t3.oa_user_id = #{req.oaUserId}
where t1.cost_status = 6
and t3.id is not null
</select>
<!--需要我人事审核的-->
<select id="hrCheckCostList" resultType="com.blt.other.module.cost.model.CostDomain">
select t1.*
from cost t1
left join cost_current_reviewer t3 on t1.cost_no = t3.cost_no and t3.oa_user_id = #{req.oaUserId}
where t1.cost_status = 9
and t3.id is not null
</select>
</mapper> </mapper>
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