Commit 0097d5ce by huluobin

转审核功能

parent 85ce41a5
...@@ -87,7 +87,7 @@ public class CostReviewerController { ...@@ -87,7 +87,7 @@ public class CostReviewerController {
public CostResult<Void> modifyDepartmentReviewer(@RequestParam Integer userId, public CostResult<Void> modifyDepartmentReviewer(@RequestParam Integer userId,
@RequestParam Integer oaDepartmentId, @RequestParam Integer oaDepartmentId,
@RequestParam String departmentReviewerUserIds) { @RequestParam String departmentReviewerUserIds) {
oaDepartmentService.modifyFinancialReviewer(userId, oaDepartmentId, Lists.newArrayList(departmentReviewerUserIds.split(",")) oaDepartmentService.modifyDepartmentReviewer(userId, oaDepartmentId, Lists.newArrayList(departmentReviewerUserIds.split(","))
.stream().map(Integer::valueOf).collect(Collectors.toList())); .stream().map(Integer::valueOf).collect(Collectors.toList()));
return CostResult.success(); return CostResult.success();
} }
......
...@@ -36,25 +36,4 @@ public interface IOaCompanyService extends IService<OaCompany> { ...@@ -36,25 +36,4 @@ public interface IOaCompanyService extends IService<OaCompany> {
*/ */
IPage<OaCompany> reviewerList(CompanyReviewerListReq req); IPage<OaCompany> reviewerList(CompanyReviewerListReq req);
/**
* <p>
* 修改最终审核人
* </p>
*
* @param userId 当前用户oa userid
* @param oaCompanyId oa公司主体id
* @param finalReviewerUserId 最终审核核人oa userid
*/
void modifyFinalReviewer(Integer userId, Integer oaCompanyId, Integer finalReviewerUserId);
/**
* <p>
* 修改财务审核人
* </p>
*
* @param userId 当前用户oa userid
* @param oaCompanyId oa公司主体id
* @param financialReviewerUserIds 财务审核核人oa userid
*/
void modifyFinancialReviewer(Integer userId, Integer oaCompanyId, List<Integer> financialReviewerUserIds);
} }
...@@ -49,7 +49,7 @@ public interface IOaDepartmentService extends IService<OaDepartment> { ...@@ -49,7 +49,7 @@ public interface IOaDepartmentService extends IService<OaDepartment> {
* @param oaDepartmentId oa部门id * @param oaDepartmentId oa部门id
* @param departmentReviewerUserIds 部门审核oa userid list * @param departmentReviewerUserIds 部门审核oa userid list
*/ */
void modifyFinancialReviewer(Integer userId, Integer oaDepartmentId, List<Integer> departmentReviewerUserIds); void modifyDepartmentReviewer(Integer userId, Integer oaDepartmentId, List<Integer> departmentReviewerUserIds);
/** /**
* 更新部门审核金额 * 更新部门审核金额
......
...@@ -34,8 +34,7 @@ public class OaCompanyServiceImpl extends ServiceImpl<OaCompanyMapper, OaCompany ...@@ -34,8 +34,7 @@ public class OaCompanyServiceImpl extends ServiceImpl<OaCompanyMapper, OaCompany
@Resource @Resource
CostReviewerMapper costReviewerMapper; CostReviewerMapper costReviewerMapper;
@Resource
OaUserMapper oaUserMapper;
@Override @Override
public List<OaCompany> oaCompanyList() { public List<OaCompany> oaCompanyList() {
...@@ -74,67 +73,4 @@ public class OaCompanyServiceImpl extends ServiceImpl<OaCompanyMapper, OaCompany ...@@ -74,67 +73,4 @@ public class OaCompanyServiceImpl extends ServiceImpl<OaCompanyMapper, OaCompany
return page; return page;
} }
@Override
public void modifyFinalReviewer(Integer userId, Integer oaCompanyId, Integer finalReviewerUserId) {
OaUser currentOaUser = oaUserMapper.selectByOaUserId(userId);
OaCompany oaCompany = baseMapper.selectByCompanyId(oaCompanyId);
//记录更新时间
oaCompany.setLastUpdateTime(LocalDateTime.now());
oaCompany.setUpdateUserId(userId);
oaCompany.setUpdateUserName(currentOaUser.getUserName());
baseMapper.updateById(oaCompany);
//删除旧审核人
costReviewerMapper.delete(new LambdaQueryWrapper<CostReviewer>()
.eq(CostReviewer::getType, CostReviewer.finalReviewer)
.eq(CostReviewer::getReferId, oaCompanyId));
//新增审核人
OaUser oaUser = oaUserMapper.selectByOaUserId(finalReviewerUserId);
CostReviewer costReviewer = CostReviewer.builder()
.reviewerUserId(finalReviewerUserId)
.reviewerUserName(oaUser.getUserName())
.referId(oaCompanyId)
.type(CostReviewer.finalReviewer)
.build();
costReviewerMapper.insert(costReviewer);
}
@Override
public void modifyFinancialReviewer(Integer userId, Integer oaCompanyId, List<Integer> financialReviewerUserIds) {
OaUser currentOaUser = oaUserMapper.selectByOaUserId(userId);
OaCompany oaCompany = baseMapper.selectByCompanyId(oaCompanyId);
//记录更新时间
oaCompany.setLastUpdateTime(LocalDateTime.now());
oaCompany.setUpdateUserId(userId);
oaCompany.setUpdateUserName(currentOaUser.getUserName());
baseMapper.updateById(oaCompany);
//删除旧审核人
costReviewerMapper.delete(new LambdaQueryWrapper<CostReviewer>()
.eq(CostReviewer::getType, CostReviewer.financialReviewer)
.eq(CostReviewer::getReferId, oaCompanyId));
financialReviewerUserIds.forEach(financialReviewerUserId -> {
//新增审核人
OaUser financialReviewerOaUser = oaUserMapper.selectByOaUserId(financialReviewerUserId);
CostReviewer costReviewer = CostReviewer.builder()
.reviewerUserId(financialReviewerUserId)
.reviewerUserName(financialReviewerOaUser.getUserName())
.referId(oaCompanyId)
.type(CostReviewer.finalReviewer)
.build();
costReviewerMapper.insert(costReviewer);
});
}
} }
...@@ -65,7 +65,7 @@ public class OaDepartmentServiceImpl extends ServiceImpl<OaDepartmentMapper, OaD ...@@ -65,7 +65,7 @@ public class OaDepartmentServiceImpl extends ServiceImpl<OaDepartmentMapper, OaD
} }
@Override @Override
public void modifyFinancialReviewer(Integer userId, Integer oaDepartmentId, List<Integer> departmentReviewerUserIds) { public void modifyDepartmentReviewer(Integer userId, Integer oaDepartmentId, List<Integer> departmentReviewerUserIds) {
OaUser currentOaUser = oaUserMapper.selectByOaUserId(userId); OaUser currentOaUser = oaUserMapper.selectByOaUserId(userId);
OaDepartment oaDepartment = baseMapper.selectByDepartmentId(oaDepartmentId); OaDepartment oaDepartment = baseMapper.selectByDepartmentId(oaDepartmentId);
......
...@@ -10,9 +10,6 @@ import com.blt.other.module.cost.service.CostLogService; ...@@ -10,9 +10,6 @@ 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 io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.InputStreamResource; import org.springframework.core.io.InputStreamResource;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
...@@ -23,6 +20,7 @@ import org.springframework.web.bind.annotation.PostMapping; ...@@ -23,6 +20,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
...@@ -30,25 +28,17 @@ import java.util.Date; ...@@ -30,25 +28,17 @@ import java.util.Date;
@Api(tags = "费用审核接口") @Api(tags = "费用审核接口")
@RestController @RestController
@RequestMapping("cost/check") @RequestMapping("/cost/check")
public class CostCheckController { public class CostCheckController {
@Resource
@Autowired
private CostService costService; private CostService costService;
@Autowired @Resource
private CostCashiercallbackService costCashiercallbackService; private CostCashiercallbackService costCashiercallbackService;
@Autowired @Resource
private CostLogService costLogService; private CostLogService costLogService;
/**
* 改变费用单状态
*
* @param costNo
* @param costStatus
* @return
*/
private UpdateCostResp changeStatus(String costNo, Integer costStatus) { private UpdateCostResp changeStatus(String costNo, Integer costStatus) {
CostDomain costDomain = costService.getCostByCostNo(costNo); CostDomain costDomain = costService.getCostByCostNo(costNo);
costDomain.setCostNo(costNo); costDomain.setCostNo(costNo);
...@@ -61,9 +51,7 @@ public class CostCheckController { ...@@ -61,9 +51,7 @@ public class CostCheckController {
costDomain.setLendStatus(1); costDomain.setLendStatus(1);
} }
} }
return costService.updateCost(costDomain); return costService.updateCost(costDomain);
} }
// ================================== 结束费用 ====================================================== // ================================== 结束费用 ======================================================
......
package com.blt.other.module.cost.controller; package com.blt.other.module.cost.controller;
import com.bailuntec.cost.api.response.CostResult;
import com.blt.other.module.cost.dto.request.TransferReviewReq;
import com.blt.other.module.cost.service.ICostCurrentReviewerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/** /**
* <p> * <p>
* 费用单当前审核人 前端控制器 * 费用单当前审核人 前端控制器
...@@ -13,8 +21,19 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -13,8 +21,19 @@ import org.springframework.web.bind.annotation.RestController;
* @author robbendev * @author robbendev
* @since 2020-12-16 * @since 2020-12-16
*/ */
@Api(tags = "费用单当前审核人接口")
@RestController @RestController
@RequestMapping("//cost-current-reviewer") @RequestMapping("/costCurrentReviewer")
public class CostCurrentReviewerController { public class CostCurrentReviewerController {
@Resource
ICostCurrentReviewerService costCurrentReviewerService;
@ApiOperation("转审核")
@PostMapping("/transferReview")
public CostResult<Void> transferReview(@RequestBody TransferReviewReq req) {
costCurrentReviewerService.transferReview(req);
return CostResult.success();
}
} }
package com.blt.other.module.cost.dto.request;
import lombok.Data;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/12/16 4:03 下午
*/
@Data
public class TransferReviewReq {
private String costNo;
private List<Integer> oaUserIdList;
private Integer currentUserId;
}
package com.blt.other.module.cost.service; package com.blt.other.module.cost.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.blt.other.module.auth.model.CostReviewer;
import com.blt.other.module.cost.dto.request.TransferReviewReq;
import com.blt.other.module.cost.model.CostCurrentReviewer; import com.blt.other.module.cost.model.CostCurrentReviewer;
import java.util.List;
/** /**
* <p> * <p>
* 费用单当前审核人 服务类 * 费用单当前审核人 服务类
...@@ -18,8 +22,34 @@ public interface ICostCurrentReviewerService extends IService<CostCurrentReviewe ...@@ -18,8 +22,34 @@ public interface ICostCurrentReviewerService extends IService<CostCurrentReviewe
* currentUserId 是否可以审核 costNo * currentUserId 是否可以审核 costNo
* *
* @param oaUserId 用户id * @param oaUserId 用户id
* @param costNo 费用单号 * @param costNo 费用单号
* @return canAudit * @return canAudit
*/ */
Boolean canAudit(Integer oaUserId, String costNo); Boolean canAudit(Integer oaUserId, String costNo);
/**
* 更新费用单当前审核人
*
* @param costNo costNo
* @param costReviewerList costReviewerList
*/
void updateByCostNoAndReviewer(String costNo, List<CostReviewer> costReviewerList);
/**
* 更新费用单当前审核人
*
* @param costNo costNo
* @param oaUserid oaUserid
*/
void updateByCostNoAndOaUserId(String costNo, List<Integer> oaUserid);
/**
* 转审核
*
* @param req req
*/
void transferReview(TransferReviewReq req);
} }
...@@ -3,12 +3,23 @@ package com.blt.other.module.cost.service.impl; ...@@ -3,12 +3,23 @@ package com.blt.other.module.cost.service.impl;
import com.bailuntec.common.ListUtil; 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.common.exception.BizRuntimeException;
import com.blt.other.module.auth.dao.OaUserMapper;
import com.blt.other.module.auth.model.CostReviewer;
import com.blt.other.module.auth.model.OaUser;
import com.blt.other.module.cost.dao.CostCurrentReviewerMapper; import com.blt.other.module.cost.dao.CostCurrentReviewerMapper;
import com.blt.other.module.cost.dao.CostDao;
import com.blt.other.module.cost.dto.request.TransferReviewReq;
import com.blt.other.module.cost.model.CostCurrentReviewer; import com.blt.other.module.cost.model.CostCurrentReviewer;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostLogService;
import com.blt.other.module.cost.service.ICostCurrentReviewerService; import com.blt.other.module.cost.service.ICostCurrentReviewerService;
import com.google.common.collect.Lists;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* <p> * <p>
...@@ -21,6 +32,14 @@ import java.util.List; ...@@ -21,6 +32,14 @@ import java.util.List;
@Service @Service
public class CostCurrentReviewerServiceImpl extends ServiceImpl<CostCurrentReviewerMapper, CostCurrentReviewer> implements ICostCurrentReviewerService { public class CostCurrentReviewerServiceImpl extends ServiceImpl<CostCurrentReviewerMapper, CostCurrentReviewer> implements ICostCurrentReviewerService {
@Resource
OaUserMapper oaUserMapper;
@Resource
CostLogService costLogService;
@Resource
CostDao costDao;
@Override @Override
public Boolean canAudit(Integer oaUserId, String costNo) { public Boolean canAudit(Integer oaUserId, String costNo) {
List<CostCurrentReviewer> costCurrentReviewerList = baseMapper.selectList(new LambdaQueryWrapper<CostCurrentReviewer>() List<CostCurrentReviewer> costCurrentReviewerList = baseMapper.selectList(new LambdaQueryWrapper<CostCurrentReviewer>()
...@@ -28,4 +47,64 @@ public class CostCurrentReviewerServiceImpl extends ServiceImpl<CostCurrentRevie ...@@ -28,4 +47,64 @@ public class CostCurrentReviewerServiceImpl extends ServiceImpl<CostCurrentRevie
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));
} }
@Override
public void updateByCostNoAndReviewer(String costNo, List<CostReviewer> costReviewerList) {
this.remove(new LambdaQueryWrapper<CostCurrentReviewer>()
.eq(CostCurrentReviewer::getCostNo, costNo));
List<CostCurrentReviewer> costCurrentReviewerList = costReviewerList.stream()
.map(costReviewer -> {
CostCurrentReviewer costCurrentReviewer = new CostCurrentReviewer();
costCurrentReviewer.setCostNo(costNo);
costCurrentReviewer.setOaUserId(costReviewer.getReviewerUserId());
costCurrentReviewer.setUsername(costReviewer.getReviewerUserName());
return costCurrentReviewer;
})
.collect(Collectors.toList());
this.saveBatch(costCurrentReviewerList);
}
@Override
public void updateByCostNoAndOaUserId(String costNo, List<Integer> oaUserid) {
this.remove(new LambdaQueryWrapper<CostCurrentReviewer>()
.eq(CostCurrentReviewer::getCostNo, costNo));
List<CostCurrentReviewer> costCurrentReviewerList =
oaUserMapper.selectList(new LambdaQueryWrapper<OaUser>()
.in(OaUser::getOaUserId, oaUserid)).stream()
.map(oaUser -> {
CostCurrentReviewer costCurrentReviewer = new CostCurrentReviewer();
costCurrentReviewer.setCostNo(costNo);
costCurrentReviewer.setOaUserId(oaUser.getOaUserId());
costCurrentReviewer.setUsername(oaUser.getUserName());
return costCurrentReviewer;
})
.collect(Collectors.toList());
this.saveBatch(costCurrentReviewerList);
}
@Override
public void transferReview(TransferReviewReq req) {
CostDomain costDomain = costDao.selectByCostNo(req.getCostNo());
if (!Lists.newArrayList(CostDomain.STATUS_HR_CHECK,
CostDomain.STATUS_DEPARTMENT_CHECK,
CostDomain.STATUS_FINANCIAL_CHECK,
CostDomain.STATUS_FINAL_CHECK)
.contains(costDomain.getCostStatus())) {
throw new BizRuntimeException("invalid cost status");
}
this.updateByCostNoAndOaUserId(req.getCostNo(), req.getOaUserIdList());
List<OaUser> oaUserList = oaUserMapper.selectList(new LambdaQueryWrapper<OaUser>()
.in(OaUser::getOaUserId, req.getOaUserIdList()));
costLogService.save(req.getCostNo(), req.getCurrentUserId(), "转审核,审核人:" + oaUserList.stream().map(OaUser::getUserName).collect(Collectors.joining(",")));
}
} }
...@@ -36,6 +36,7 @@ public class CostContext { ...@@ -36,6 +36,7 @@ public class CostContext {
public void handle() { public void handle() {
costState.updateCurrentReviewer();
costState.handle(); costState.handle();
} }
......
...@@ -2,6 +2,7 @@ package com.blt.other.module.cost.service.impl.costcheck; ...@@ -2,6 +2,7 @@ package com.blt.other.module.cost.service.impl.costcheck;
import com.blt.other.module.auth.dao.CostReviewerMapper; import com.blt.other.module.auth.dao.CostReviewerMapper;
import com.blt.other.module.auth.dao.OaUserMapper; import com.blt.other.module.auth.dao.OaUserMapper;
import com.blt.other.module.cost.dao.CostCompanyDao;
import com.blt.other.module.cost.dao.CostDao; 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;
...@@ -9,6 +10,7 @@ import com.blt.other.module.cost.service.CostLogService; ...@@ -9,6 +10,7 @@ import com.blt.other.module.cost.service.CostLogService;
import com.blt.other.module.cost.service.ICostCurrentReviewerService; 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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -23,7 +25,7 @@ import java.util.stream.Collectors; ...@@ -23,7 +25,7 @@ import java.util.stream.Collectors;
* @author robbendev * @author robbendev
* @since 2020/10/30 2:18 下午 * @since 2020/10/30 2:18 下午
*/ */
@Slf4j
public abstract class CostState { public abstract class CostState {
@Resource @Resource
...@@ -39,6 +41,8 @@ public abstract class CostState { ...@@ -39,6 +41,8 @@ public abstract class CostState {
@Autowired @Autowired
CostReviewerMapper costReviewerMapper; CostReviewerMapper costReviewerMapper;
@Autowired @Autowired
CostCompanyDao costCompanyDao;
@Autowired
CostSubscribe costSubscribe; CostSubscribe costSubscribe;
...@@ -84,4 +88,8 @@ public abstract class CostState { ...@@ -84,4 +88,8 @@ public abstract class CostState {
public abstract void handle(); public abstract void handle();
public abstract void refuse(String rejectReason); public abstract void refuse(String rejectReason);
public void updateCurrentReviewer() {
}
} }
package com.blt.other.module.cost.service.impl.costcheck; package com.blt.other.module.cost.service.impl.costcheck;
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.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;
...@@ -14,6 +16,8 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -14,6 +16,8 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* <p> * <p>
...@@ -33,7 +37,7 @@ public class DepartmentCheckState extends CostState { ...@@ -33,7 +37,7 @@ public class DepartmentCheckState extends CostState {
@Resource @Resource
OaUserMapper oaUserMapper; OaUserMapper oaUserMapper;
@Transactional(rollbackFor =Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public void handle() { public void handle() {
CostDomain costDomain = costContext.costDomain; CostDomain costDomain = costContext.costDomain;
...@@ -126,4 +130,18 @@ public class DepartmentCheckState extends CostState { ...@@ -126,4 +130,18 @@ public class DepartmentCheckState extends CostState {
costContext.costService.reject(costDomain.getCostNo()); costContext.costService.reject(costDomain.getCostNo());
} }
@Override
public void updateCurrentReviewer() {
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));
costCurrentReviewerService.updateByCostNoAndReviewer(costDomain.getCostNo(), costReviewerList);
costLogService.save(costDomain.getCostNo(), costContext.currentUserId, "部门审核人:" + costReviewerList.stream().map(CostReviewer::getReviewerUserName).collect(Collectors.joining(",")));
}
} }
package com.blt.other.module.cost.service.impl.costcheck; package com.blt.other.module.cost.service.impl.costcheck;
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.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;
...@@ -11,6 +14,8 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -11,6 +14,8 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* <p> * <p>
...@@ -125,4 +130,19 @@ public class FinalCheckState extends CostState { ...@@ -125,4 +130,19 @@ public class FinalCheckState extends CostState {
costLogService.save(costDomain.getCostNo(), currentUserId, "最终审核拒绝,理由:" + rejectReason, CostLogDomain.TYPE_UPDATE); costLogService.save(costDomain.getCostNo(), currentUserId, "最终审核拒绝,理由:" + rejectReason, CostLogDomain.TYPE_UPDATE);
} }
@Override
public void updateCurrentReviewer() {
CostDomain costDomain = costContext.costDomain;
CostCompanyDomain costCompanyDomain = costCompanyDao.selectByNo(costDomain.getCompanyNo());
List<CostReviewer> costReviewerList = costReviewerMapper.selectList(new LambdaQueryWrapper<CostReviewer>()
.eq(CostReviewer::getReferId, costCompanyDomain.getId())
.eq(CostReviewer::getType, CostReviewer.finalReviewer));
costCurrentReviewerService.updateByCostNoAndReviewer(costDomain.getCostNo(), costReviewerList);
costLogService.save(costDomain.getCostNo(), costContext.currentUserId, "最终审核人:" + costReviewerList.stream().map(CostReviewer::getReviewerUserName).collect(Collectors.joining(",")));
}
} }
package com.blt.other.module.cost.service.impl.costcheck; package com.blt.other.module.cost.service.impl.costcheck;
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.CostReviewer;
import com.blt.other.module.auth.service.IOaUserService; import com.blt.other.module.auth.service.IOaUserService;
...@@ -13,6 +14,8 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -13,6 +14,8 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* <p> * <p>
...@@ -33,6 +36,11 @@ public class FinancialCheckState extends CostState { ...@@ -33,6 +36,11 @@ public class FinancialCheckState extends CostState {
@Resource @Resource
IOaUserService oaUserService; IOaUserService oaUserService;
@Override
void nextState(CostState costState) {
super.nextState(costState);
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public void handle() { public void handle() {
...@@ -107,4 +115,20 @@ public class FinancialCheckState extends CostState { ...@@ -107,4 +115,20 @@ public class FinancialCheckState extends CostState {
costLogService.save(costDomain.getCostNo(), currentUserId, "财务审核拒绝,理由:" + rejectReason, CostLogDomain.TYPE_UPDATE); costLogService.save(costDomain.getCostNo(), currentUserId, "财务审核拒绝,理由:" + rejectReason, CostLogDomain.TYPE_UPDATE);
} }
@Override
public void updateCurrentReviewer() {
CostDomain costDomain = costContext.costDomain;
CostCompanyDomain costCompanyDomain = costCompanyDao.selectByNo(costDomain.getCompanyNo());
List<CostReviewer> costReviewerList = costReviewerMapper.selectList(new LambdaQueryWrapper<CostReviewer>()
.eq(CostReviewer::getReferId, costCompanyDomain.getId())
.eq(CostReviewer::getType, CostReviewer.financialReviewer));
costCurrentReviewerService.updateByCostNoAndReviewer(costDomain.getCostNo(), costReviewerList);
costLogService.save(costDomain.getCostNo(), costContext.currentUserId, "财务审核人:" + costReviewerList.stream().map(CostReviewer::getReviewerUserName).collect(Collectors.joining(",")));
}
} }
package com.blt.other.module.cost.service.impl.costcheck; package com.blt.other.module.cost.service.impl.costcheck;
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.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;
...@@ -15,6 +16,8 @@ import org.springframework.stereotype.Component; ...@@ -15,6 +16,8 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* <p> * <p>
...@@ -107,4 +110,25 @@ public class HrCheckState extends CostState { ...@@ -107,4 +110,25 @@ public class HrCheckState extends CostState {
costContext.costService.reject(costDomain.getCostNo()); costContext.costService.reject(costDomain.getCostNo());
} }
@Override
public void updateCurrentReviewer() {
CostDomain costDomain = costContext.costDomain;
CostTemplate costTemplate = costTemplateService.queryDetail(costDomain.getCostTemplateId());
CostCompanyDomain costCompanyDomain = costCompanyDao.selectByNo(costDomain.getCompanyNo());
//如果不需要审核 直接通过
if (costTemplate.shouldHrCheck(costDomain)) {
OaUser costUser = oaUserMapper.selectByOaUserId(costDomain.getCreateUserid());
List<CostReviewer> costReviewerList = costReviewerMapper.selectList(new LambdaQueryWrapper<CostReviewer>()
.eq(CostReviewer::getReferId, costCompanyDomain.getId())
.eq(CostReviewer::getType, CostReviewer.hrReviewer));
costCurrentReviewerService.updateByCostNoAndReviewer(costDomain.getCostNo(),costReviewerList);
costLogService.save(costDomain.getCostNo(), costContext.currentUserId, "行政审核人:" + costReviewerList.stream().map(CostReviewer::getReviewerUserName).collect(Collectors.joining(",")));
}
}
} }
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -5,6 +5,7 @@ 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.CostReviewer;
import com.blt.other.module.auth.model.OaUser; import com.blt.other.module.auth.model.OaUser;
import com.blt.other.module.cost.model.CostCurrentReviewer;
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;
...@@ -12,6 +13,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -12,6 +13,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* <p> * <p>
...@@ -27,19 +29,6 @@ public class UnSubmitState extends CostState { ...@@ -27,19 +29,6 @@ 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
......
...@@ -51,7 +51,7 @@ public class OaDepartmentServiceImplTest { ...@@ -51,7 +51,7 @@ public class OaDepartmentServiceImplTest {
try { try {
oaDepartmentService.modifyFinancialReviewer(0, oaDepartment.getDepartmentId(), Lists.newArrayList(oaUser.getOaUserId())); oaDepartmentService.modifyDepartmentReviewer(0, oaDepartment.getDepartmentId(), Lists.newArrayList(oaUser.getOaUserId()));
} catch (Exception ignore) { } catch (Exception ignore) {
} }
......
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