Commit dcac74d8 by huluobin

update

parent bac604e6
...@@ -27,4 +27,12 @@ public interface IOaUserService extends IService<OaUser> { ...@@ -27,4 +27,12 @@ public interface IOaUserService extends IService<OaUser> {
*/ */
List<OaUser> queryList(@Nullable Integer primaryDepartmentId, List<OaUser> queryList(@Nullable Integer primaryDepartmentId,
@Nullable Integer oaCompanyId); @Nullable Integer oaCompanyId);
/**
* 一级部门审核人
*
* @param oaUserId 用户id
* @return 用户的一级部门审核人
*/
OaUser selectManage(Integer oaUserId);
} }
...@@ -48,4 +48,14 @@ public class OaUserServiceImpl extends ServiceImpl<OaUserMapper, OaUser> impleme ...@@ -48,4 +48,14 @@ public class OaUserServiceImpl extends ServiceImpl<OaUserMapper, OaUser> impleme
oaUserList.addAll(mangeUserList); oaUserList.addAll(mangeUserList);
return oaUserList; return oaUserList;
} }
@Override
public OaUser selectManage(Integer oaUserId) {
OaUser costUser = baseMapper.selectByOaUserId(oaUserId);
OaDepartment oaDepartment = oaDepartmentMapper.selectByDepartmentId(costUser.getPrimaryDepartmentId());
String manageUserName = oaDepartment.getManageUser1();
return baseMapper.selectByUserName(manageUserName);
}
} }
...@@ -218,16 +218,28 @@ public class CostController { ...@@ -218,16 +218,28 @@ public class CostController {
@ApiOperation("审核费用单列表") @ApiOperation("审核费用单列表")
@GetMapping("/checkCostList") @GetMapping("/checkCostList")
public CostResult<IPage<CostDto>> financialCheckCostList(@RequestParam Integer userid, public CostResult<IPage<CostDto>> checkCostList(@RequestParam Integer userid,
@RequestParam Integer pageNum, @RequestParam Integer pageNum,
@RequestParam Integer pageSize, @RequestParam Integer pageSize,
@RequestParam @ApiParam("1-财务+最终审核 2-部门审核") Integer type, @RequestParam @ApiParam("1-财务+最终审核 2-部门审核") Integer type,
@RequestParam @ApiParam("1- 全部 2-待审核 3-已手动审核 4-已自动审核") Integer status) { @RequestParam @ApiParam("1- 全部 2-待审核 3-已手动审核 4-已自动审核") Integer status) {
costService = CostServiceFactory.getCostService(); costService = CostServiceFactory.getCostService();
IPage<CostDto> page = costService.checkCostList(userid, pageNum, pageSize, type, status); IPage<CostDto> page = costService.checkCostList(userid, pageNum, pageSize, type, status);
return CostResult.success(page); return CostResult.success(page);
} }
@ApiOperation("审核费用单列表")
@GetMapping("/checkCostCount")
public CostResult<Long> checkCostCount(@RequestParam Integer userid,
@RequestParam Integer pageNum,
@RequestParam Integer pageSize,
@RequestParam @ApiParam("1-财务+最终审核 2-部门审核") Integer type,
@RequestParam @ApiParam("1- 全部 2-待审核 3-已手动审核 4-已自动审核") Integer status) {
costService = CostServiceFactory.getCostService();
Long count = costService.checkCostList(userid, pageNum, pageSize, type, status).getTotal();
return CostResult.success(count);
}
@ApiOperation("部门审核通过") @ApiOperation("部门审核通过")
@GetMapping("/check/departmentCheck") @GetMapping("/check/departmentCheck")
public CostResult<Void> departmentCheck(@RequestParam String costNo, public CostResult<Void> departmentCheck(@RequestParam String costNo,
......
package com.blt.other.module.cost.service; package com.blt.other.module.cost.service;
import com.blt.other.module.auth.model.OaUser;
import com.blt.other.module.database.model.CostLogDomain; import com.blt.other.module.database.model.CostLogDomain;
import java.util.List; import java.util.List;
...@@ -10,6 +11,8 @@ public interface CostLogService { ...@@ -10,6 +11,8 @@ public interface CostLogService {
Integer save(String costNo, Integer updateUserid, String updateMainNote,Integer type); Integer save(String costNo, Integer updateUserid, String updateMainNote,Integer type);
Integer save(String costNo, OaUser oaUser, String updateMainNote, Integer type);
List<CostLogDomain> getListByCostNo(String costNo); List<CostLogDomain> getListByCostNo(String costNo);
List<String> getListLogs(List<CostLogDomain> logs); List<String> getListLogs(List<CostLogDomain> logs);
......
...@@ -40,12 +40,6 @@ public class CostLogServiceImpl implements CostLogService { ...@@ -40,12 +40,6 @@ public class CostLogServiceImpl implements CostLogService {
UserDomain user = userDao.selectByuserid(updateUserid); UserDomain user = userDao.selectByuserid(updateUserid);
if (user == null) {
user = new UserDomain();
OaUser oaUser = oaUserMapper.selectByOaUserId(updateUserid);
user.setUsercode(oaUser.getUserCode());
user.setUsername(oaUser.getUserName());
}
costLog.setUpdateUsercode(user.getUsercode()); costLog.setUpdateUsercode(user.getUsercode());
costLog.setUpdateUsername(user.getUsername()); costLog.setUpdateUsername(user.getUsername());
...@@ -58,6 +52,25 @@ public class CostLogServiceImpl implements CostLogService { ...@@ -58,6 +52,25 @@ public class CostLogServiceImpl implements CostLogService {
} }
@Override @Override
public Integer save(String costNo, OaUser oaUser, String updateMainNote, Integer type) {
CostLogDomain costLog = new CostLogDomain();
costLog.setCostNo(costNo);
costLog.setUpdateTime(new Date());
UserDomain user = userDao.selectByuserid(oaUser.getOaUserId());
costLog.setUpdateUsercode(user.getUsercode());
costLog.setUpdateUsername(user.getUsername());
costLog.setUpdateUserid(oaUser.getOaUserId());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
costLog.setUpdateNote(sdf.format(costLog.getUpdateTime()) + " " + updateMainNote + " 更新人:" + user.getUsername());
costLog.setType(type);
return costLogDao.insert(costLog);
}
@Override
public List<CostLogDomain> getListByCostNo(String costNo) { public List<CostLogDomain> getListByCostNo(String costNo) {
return costLogDao.selectByCostNo(costNo); return costLogDao.selectByCostNo(costNo);
} }
......
...@@ -443,25 +443,10 @@ public abstract class AbstractCostService implements CostService { ...@@ -443,25 +443,10 @@ public abstract class AbstractCostService implements CostService {
req.setCompanyMainName(cost.getCompanyName()); req.setCompanyMainName(cost.getCompanyName());
req.setTitle(cost.getCostNo()); req.setTitle(cost.getCostNo());
// if (cost.getCostNo().startsWith("S")) {
// log.info("补差额的付款单:" + cost.getCostNo());
// applyMoneyDetail.setName("借支单补差额");
// // 审核回调地址(ApplyCallbackUrl)不可为空;
// req.setApplyCallbackUrl(lendCostApplyCallBackUrlPost);
// // 出纳回调地址(CashierCallbackUrl)不可为空;
// req.setCashierCallbackUrl(lendCostCashierCallbackUrlPost);
//
// } else {
// // 审核回调地址(ApplyCallbackUrl)不可为空;
// req.setApplyCallbackUrl(costApplyCallbackUrlPost);
// // 出纳回调地址(CashierCallbackUrl)不可为空;
// req.setApplyCallbackUrl(costCashierCallbackUrlPost);
// }
// 币种编号(UnitCode)不可为空; // 币种编号(UnitCode)不可为空;
req.setUnitCode(cost.getDic()); req.setUnitCode(cost.getDic());
// 币种名称(UnitName)不可为空; // 币种名称(UnitName)不可为空;
req.setUnitName(cost.getDic()); req.setUnitName(cost.getDic());
// 交易对象改为付款/收款单位
// 交易对象(TradeObjectID/TradeObjectName)不可为空; // 交易对象(TradeObjectID/TradeObjectName)不可为空;
req.setTradeObjectID(companyByCompanyNo.getValue() + ""); req.setTradeObjectID(companyByCompanyNo.getValue() + "");
...@@ -469,6 +454,7 @@ public abstract class AbstractCostService implements CostService { ...@@ -469,6 +454,7 @@ public abstract class AbstractCostService implements CostService {
req.setBankCardto(cost.getBankCard()); req.setBankCardto(cost.getBankCard());
// 交易对象账户(BankNameto/BankCardto/BankCardUserto)资料不完整; // 交易对象账户(BankNameto/BankCardto/BankCardUserto)资料不完整;
req.setBankCardUserto(cost.getBankCardUser()); req.setBankCardUserto(cost.getBankCardUser());
// req.setBankNameto(cost.getBankName());
// newOtherPurchase申请来源(SourceCode/SourceTypeCode)不可为空; // newOtherPurchase申请来源(SourceCode/SourceTypeCode)不可为空;
req.setSourceCode("newCost"); req.setSourceCode("newCost");
req.setSourceTypeCode("newCostType"); req.setSourceTypeCode("newCostType");
...@@ -477,18 +463,6 @@ public abstract class AbstractCostService implements CostService { ...@@ -477,18 +463,6 @@ public abstract class AbstractCostService implements CostService {
// 预计付款时间 ExpectPayTime // 预计付款时间 ExpectPayTime
req.setExpectPayTime(new Date()); req.setExpectPayTime(new Date());
// // 申请类型(ApplyType)不存在;申请类型:1#付款;2#收款;3#无需付款;
// if (1 == cost.getCostForm()) {
// req.setApplyType("" + 1);
// applyMoneyDetail.setName("费用单付款");
// } else if (2 == cost.getCostForm()) {
// req.setApplyType("" + 2);
// applyMoneyDetail.setName("费用单收款");
// } else if (3 == cost.getCostForm() && 1 == cost.getIsLend()) {
// req.setApplyType("" + 1);
// applyMoneyDetail.setName("借支单付款");
// }
// 申请人(UserAcctID/UserAcctName)不存在; // 申请人(UserAcctID/UserAcctName)不存在;
req.setUserAcctID("" + cost.getCreateUserid()); req.setUserAcctID("" + cost.getCreateUserid());
req.setUserAcctName("" + cost.getCreateUsername()); req.setUserAcctName("" + cost.getCreateUsername());
......
...@@ -21,7 +21,6 @@ import org.springframework.stereotype.Component; ...@@ -21,7 +21,6 @@ import org.springframework.stereotype.Component;
public class CostSubscribe { public class CostSubscribe {
@Async
public void subscribe(CostContext costContext) { public void subscribe(CostContext costContext) {
costContext.handle(); costContext.handle();
} }
......
...@@ -42,6 +42,7 @@ public class Lend1CostServiceImpl extends AbstractCostService implements CostSer ...@@ -42,6 +42,7 @@ public class Lend1CostServiceImpl extends AbstractCostService implements CostSer
ApplyMoneyDetail applyMoneyDetail = new ApplyMoneyDetail(); ApplyMoneyDetail applyMoneyDetail = new ApplyMoneyDetail();
applyMoneyDetail.setName("借支单付款"); applyMoneyDetail.setName("借支单付款");
applyMoneyDetail.setMoney(cost.getAmount()); applyMoneyDetail.setMoney(cost.getAmount());
//todo //todo
applyMoneyDetail.setMoneyRmb(cost.getAmount()); applyMoneyDetail.setMoneyRmb(cost.getAmount());
applyMoneyDetail.setRemark(""); applyMoneyDetail.setRemark("");
...@@ -50,7 +51,6 @@ public class Lend1CostServiceImpl extends AbstractCostService implements CostSer ...@@ -50,7 +51,6 @@ public class Lend1CostServiceImpl extends AbstractCostService implements CostSer
// 出纳申请金额明细(MoneyDetail)不可为空; // 出纳申请金额明细(MoneyDetail)不可为空;
req.setMoneyDetail(applyMoneyDetailList); req.setMoneyDetail(applyMoneyDetailList);
CwResult<String> cwResult = cwApi.postApply(req); CwResult<String> cwResult = cwApi.postApply(req);
TofinanceVo tofinanceVo = JsonUtilByJackson.readValue(cwResult.getData().replaceAll("/^['|\"](.*)['|\"]$/", ""), TofinanceVo.class); TofinanceVo tofinanceVo = JsonUtilByJackson.readValue(cwResult.getData().replaceAll("/^['|\"](.*)['|\"]$/", ""), TofinanceVo.class);
......
...@@ -5,6 +5,7 @@ import com.bailuntec.api.bailuntec.cw.request.PostApplyReq; ...@@ -5,6 +5,7 @@ import com.bailuntec.api.bailuntec.cw.request.PostApplyReq;
import com.bailuntec.api.bailuntec.cw.response.CwResult; import com.bailuntec.api.bailuntec.cw.response.CwResult;
import com.bailuntec.common.BeanUtils; import com.bailuntec.common.BeanUtils;
import com.bailuntec.common.JsonUtilByJackson; import com.bailuntec.common.JsonUtilByJackson;
import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.module.cost.model.CostDomain; import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostService; import com.blt.other.module.cost.service.CostService;
import com.blt.other.module.cost.vo.TofinanceVo; import com.blt.other.module.cost.vo.TofinanceVo;
...@@ -34,7 +35,6 @@ public class PayCostServiceImpl extends AbstractCostService implements CostServi ...@@ -34,7 +35,6 @@ public class PayCostServiceImpl extends AbstractCostService implements CostServi
// 审核回调地址(ApplyCallbackUrl)不可为空; // 审核回调地址(ApplyCallbackUrl)不可为空;
if (cost.getCostNo().startsWith("S")) { if (cost.getCostNo().startsWith("S")) {
log.info("补差额的付款单:" + cost.getCostNo()); log.info("补差额的付款单:" + cost.getCostNo());
// applyMoneyDetail.setName("借支单补差额");
// 审核回调地址(ApplyCallbackUrl)不可为空; // 审核回调地址(ApplyCallbackUrl)不可为空;
req.setApplyCallbackUrl(lendCostApplyCallBackUrlPost); req.setApplyCallbackUrl(lendCostApplyCallBackUrlPost);
// 出纳回调地址(CashierCallbackUrl)不可为空; // 出纳回调地址(CashierCallbackUrl)不可为空;
...@@ -44,7 +44,7 @@ public class PayCostServiceImpl extends AbstractCostService implements CostServi ...@@ -44,7 +44,7 @@ public class PayCostServiceImpl extends AbstractCostService implements CostServi
// 审核回调地址(ApplyCallbackUrl)不可为空; // 审核回调地址(ApplyCallbackUrl)不可为空;
req.setApplyCallbackUrl(costApplyCallbackUrlPost); req.setApplyCallbackUrl(costApplyCallbackUrlPost);
// 出纳回调地址(CashierCallbackUrl)不可为空; // 出纳回调地址(CashierCallbackUrl)不可为空;
req.setApplyCallbackUrl(costCashierCallbackUrlPost); req.setCashierCallbackUrl(costCashierCallbackUrlPost);
} }
req.setApplyType("" + 1); req.setApplyType("" + 1);
...@@ -58,14 +58,18 @@ public class PayCostServiceImpl extends AbstractCostService implements CostServi ...@@ -58,14 +58,18 @@ public class PayCostServiceImpl extends AbstractCostService implements CostServi
applyMoneyDetail.setRemark(""); applyMoneyDetail.setRemark("");
applyMoneyDetailList.add(applyMoneyDetail); applyMoneyDetailList.add(applyMoneyDetail);
// 出纳申请金额明细(MoneyDetail)不可为空; // 出纳申请金额明细(MoneyDetail)不可为空;
req.setMoneyDetail(applyMoneyDetailList); req.setMoneyDetail(applyMoneyDetailList);
CwResult<String> cwResult = cwApi.postApply(req); CwResult<String> cwResult = cwApi.postApply(req);
TofinanceVo tofinanceVo = JsonUtilByJackson.readValue(cwResult.getData().replaceAll("/^['|\"](.*)['|\"]$/", ""), TofinanceVo.class); if (!cwResult.getSuccess()) {
throw new BizRuntimeException(cwResult.getMessage());
}
TofinanceVo tofinanceVo = JsonUtilByJackson.readValue(cwResult.getData().replaceAll("/^['|\"](.*)['|\"]$/", ""), TofinanceVo.class);
//保存财务系统调用信息 //保存财务系统调用信息
CostTofinanceDomain costTofinanceDomain = new CostTofinanceDomain(); CostTofinanceDomain costTofinanceDomain = new CostTofinanceDomain();
BeanUtils.copyProperties(costTofinanceDomain, tofinanceVo); BeanUtils.copyProperties(costTofinanceDomain, tofinanceVo);
......
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.dao.OaDepartmentMapper;
import com.blt.other.module.auth.model.CostReviewer; import com.blt.other.module.auth.model.CostReviewer;
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.auth.service.IOaUserService;
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.CostLogDomain; import com.blt.other.module.database.model.CostLogDomain;
...@@ -29,7 +28,7 @@ public class DepartmentCheckState extends CostState { ...@@ -29,7 +28,7 @@ public class DepartmentCheckState extends CostState {
@Resource @Resource
OaDepartmentMapper oaDepartmentMapper; IOaUserService oaUserService;
@Override @Override
public void handle() { public void handle() {
...@@ -48,16 +47,11 @@ public class DepartmentCheckState extends CostState { ...@@ -48,16 +47,11 @@ public class DepartmentCheckState extends CostState {
costDomain.setCostStatus(CostDomain.STATUS_FINANCIAL_CHECK); costDomain.setCostStatus(CostDomain.STATUS_FINANCIAL_CHECK);
costDao.updateById(costDomain); costDao.updateById(costDomain);
OaUser costUser = oaUserMapper.selectByOaUserId(costDomain.getCreateUserid());
OaDepartment oaDepartment = oaDepartmentMapper.selectById(costUser.getPrimaryDepartmentId());
String manageUserName = oaDepartment.getManageUser1();
OaUser oaUser = oaUserMapper.selectByUserName(manageUserName);
//流转状态 //流转状态
nextState(financialCheckState); nextState(financialCheckState);
costSubscribe.subscribe(costContext); costSubscribe.subscribe(costContext);
costLogService.save(costDomain.getCostNo(), oaUser.getOaUserId(), "基础模版无需部门审核", CostLogDomain.DEPARTMENT_AUTO_PASS); costLogService.save(costDomain.getCostNo(), oaUserService.selectManage(costDomain.getCreateUserid()), "部门审核自动通过", CostLogDomain.DEPARTMENT_AUTO_PASS);
return; return;
} }
...@@ -68,7 +62,7 @@ public class DepartmentCheckState extends CostState { ...@@ -68,7 +62,7 @@ public class DepartmentCheckState extends CostState {
if (autoCheck(costDomain)) { if (autoCheck(costDomain)) {
costDomain.setCostStatus(CostDomain.STATUS_FINANCIAL_CHECK); costDomain.setCostStatus(CostDomain.STATUS_FINANCIAL_CHECK);
costDao.updateById(costDomain); costDao.updateById(costDomain);
costLogService.save(costDomain.getCostNo(), currentUserId, "部门自动审核通过", CostLogDomain.DEPARTMENT_AUTO_PASS); costLogService.save(costDomain.getCostNo(), oaUserService.selectManage(costDomain.getCreateUserid()), "部门自动审核通过", CostLogDomain.DEPARTMENT_AUTO_PASS);
//流转状态 //流转状态
nextState(financialCheckState); nextState(financialCheckState);
...@@ -79,20 +73,21 @@ public class DepartmentCheckState extends CostState { ...@@ -79,20 +73,21 @@ public class DepartmentCheckState extends CostState {
//人工审核 //人工审核
OaUser costUser = oaUserMapper.selectByOaUserId(costDomain.getCreateUserid()); OaUser costUser = oaUserMapper.selectByOaUserId(costDomain.getCreateUserid());
if (costContext.currentUserId != null) {
//人工审核通过
if (costReviewerMapper.queryOne(costUser.getPrimaryDepartmentId(), CostReviewer.departmentReviewer, currentUserId) != null) {
costDomain.setCostStatus(CostDomain.STATUS_FINANCIAL_CHECK);
costDao.updateById(costDomain);
costLogService.save(costDomain.getCostNo(), currentUserId, "部门审核通过", CostLogDomain.DEPARTMENT_AUTO_PASS);
//人工审核通过 nextState(financialCheckState);
if (costReviewerMapper.queryOne(costUser.getPrimaryDepartmentId(), CostReviewer.departmentReviewer, currentUserId) != null) { //发布到总线尝试下个环节的自动审核
costDomain.setCostStatus(CostDomain.STATUS_FINANCIAL_CHECK); costSubscribe.subscribe(costContext);
costDao.updateById(costDomain); }
costLogService.save(costDomain.getCostNo(), currentUserId, "部门审核通过", CostLogDomain.DEPARTMENT_AUTO_PASS); //人工审核没权限
else {
nextState(financialCheckState); throw new BizRuntimeException("current user no authority");
//发布到总线尝试下个环节的自动审核 }
costSubscribe.subscribe(costContext);
}
//人工审核没权限
else {
throw new BizRuntimeException("current user no authority");
} }
} }
......
...@@ -2,12 +2,14 @@ package com.blt.other.module.cost.service.impl.costcheck; ...@@ -2,12 +2,14 @@ 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.auth.model.CostReviewer;
import com.blt.other.module.auth.service.IOaUserService;
import com.blt.other.module.cost.dao.CostCompanyDao; import com.blt.other.module.cost.dao.CostCompanyDao;
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.CostCompanyDomain;
import com.blt.other.module.database.model.CostLogDomain; import com.blt.other.module.database.model.CostLogDomain;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -26,7 +28,10 @@ public class FinalCheckState extends CostState { ...@@ -26,7 +28,10 @@ public class FinalCheckState extends CostState {
UnPayState unPayState; UnPayState unPayState;
@Resource @Resource
CostCompanyDao costCompanyDao; CostCompanyDao costCompanyDao;
@Resource
IOaUserService oaUserService;
@Transactional(rollbackFor = Exception.class)
@Override @Override
public void handle() { public void handle() {
CostDomain costDomain = costContext.costDomain; CostDomain costDomain = costContext.costDomain;
...@@ -40,6 +45,10 @@ public class FinalCheckState extends CostState { ...@@ -40,6 +45,10 @@ public class FinalCheckState extends CostState {
//如果是默认模版 不需要最终审核 //如果是默认模版 不需要最终审核
if (costTemplate.getIsDefault()) { if (costTemplate.getIsDefault()) {
costDomain.setCostStatus(CostDomain.STATUS_UN_PAY);
costDao.updateById(costDomain);
costLogService.save(costDomain.getCostNo(), oaUserService.selectManage(costDomain.getCreateUserid()), "部门审核自动通过", CostLogDomain.DEPARTMENT_AUTO_PASS);
//流转状态 //流转状态
nextState(unPayState); nextState(unPayState);
//通知财务系统 //通知财务系统
...@@ -63,7 +72,7 @@ public class FinalCheckState extends CostState { ...@@ -63,7 +72,7 @@ public class FinalCheckState extends CostState {
if (this.autoCheck(costDomain)) { if (this.autoCheck(costDomain)) {
costDomain.setCostStatus(CostDomain.STATUS_UN_PAY); costDomain.setCostStatus(CostDomain.STATUS_UN_PAY);
costDao.updateById(costDomain); costDao.updateById(costDomain);
costLogService.save(costDomain.getCostNo(), currentUserId, "最终审核自动通过", CostLogDomain.FINAL_AUTO_PASS); costLogService.save(costDomain.getCostNo(), oaUserService.selectManage(costDomain.getCreateUserid()), "最终审核自动通过", CostLogDomain.FINAL_AUTO_PASS);
//流转状态 //流转状态
nextState(unPayState); nextState(unPayState);
...@@ -74,23 +83,24 @@ public class FinalCheckState extends CostState { ...@@ -74,23 +83,24 @@ public class FinalCheckState extends CostState {
} }
CostCompanyDomain costCompany = costCompanyDao.selectByNo(costDomain.getCompanyNo()); CostCompanyDomain costCompany = costCompanyDao.selectByNo(costDomain.getCompanyNo());
if (costContext.currentUserId != null) {
//人工审核通过
if (costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.finalReviewer, currentUserId) != null) {
costDomain.setCostStatus(CostDomain.STATUS_UN_PAY);
costDao.updateById(costDomain);
//人工审核通过 costLogService.save(costDomain.getCostNo(), currentUserId, "最终审核通过", CostLogDomain.FINAL_MANUAL_PASS);
if (costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.finalReviewer, currentUserId) != null) {
costDomain.setCostStatus(CostDomain.STATUS_UN_PAY);
costDao.updateById(costDomain);
costLogService.save(costDomain.getCostNo(), currentUserId, "最终审核通过", CostLogDomain.FINAL_MANUAL_PASS);
//流转状态 //流转状态
nextState(unPayState); nextState(unPayState);
//通知财务系统 //通知财务系统
costContext.costService.toFinancial(costDomain); costContext.costService.toFinancial(costDomain);
}
} //人工审核没权限
//人工审核没权限 else {
else { throw new BizRuntimeException("current user no authority");
throw new BizRuntimeException("current user no authority"); }
} }
} }
......
...@@ -2,12 +2,14 @@ package com.blt.other.module.cost.service.impl.costcheck; ...@@ -2,12 +2,14 @@ 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.auth.model.CostReviewer;
import com.blt.other.module.auth.service.IOaUserService;
import com.blt.other.module.cost.dao.CostCompanyDao; import com.blt.other.module.cost.dao.CostCompanyDao;
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.CostCompanyDomain;
import com.blt.other.module.database.model.CostLogDomain; import com.blt.other.module.database.model.CostLogDomain;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -27,7 +29,10 @@ public class FinancialCheckState extends CostState { ...@@ -27,7 +29,10 @@ public class FinancialCheckState extends CostState {
FinalCheckState finalCheckState; FinalCheckState finalCheckState;
@Resource @Resource
CostCompanyDao costCompanyDao; CostCompanyDao costCompanyDao;
@Resource
IOaUserService oaUserService;
@Transactional(rollbackFor = Exception.class)
@Override @Override
public void handle() { public void handle() {
CostDomain costDomain = costContext.costDomain; CostDomain costDomain = costContext.costDomain;
...@@ -45,7 +50,7 @@ public class FinancialCheckState extends CostState { ...@@ -45,7 +50,7 @@ public class FinancialCheckState extends CostState {
if (this.autoCheck(costDomain)) { if (this.autoCheck(costDomain)) {
costDomain.setCostStatus(CostDomain.STATUS_FINAL_CHECK); costDomain.setCostStatus(CostDomain.STATUS_FINAL_CHECK);
costDao.updateById(costDomain); costDao.updateById(costDomain);
costLogService.save(costDomain.getCostNo(), currentUserId, "财务自动审核通过", CostLogDomain.FINANCIAL_AUTO_PASS); costLogService.save(costDomain.getCostNo(), oaUserService.selectManage(costDomain.getCreateUserid()), "财务自动审核通过", CostLogDomain.FINANCIAL_AUTO_PASS);
//流转状态 //流转状态
nextState(finalCheckState); nextState(finalCheckState);
...@@ -57,22 +62,23 @@ public class FinancialCheckState extends CostState { ...@@ -57,22 +62,23 @@ public class FinancialCheckState extends CostState {
} }
CostCompanyDomain costCompany = costCompanyDao.selectByNo(costDomain.getCompanyNo()); CostCompanyDomain costCompany = costCompanyDao.selectByNo(costDomain.getCompanyNo());
if (costContext.currentUserId != null) {
//人工审核通过
if (costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.financialReviewer, currentUserId) != null) {
costDomain.setCostStatus(CostDomain.STATUS_FINAL_CHECK);
costDao.updateById(costDomain);
//人工审核通过 costLogService.save(costDomain.getCostNo(), currentUserId, "财务审核通过", CostLogDomain.FINANCIAL_MANUAL_PASS);
if (costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.financialReviewer, currentUserId) != null) {
costDomain.setCostStatus(CostDomain.STATUS_FINAL_CHECK);
costDao.updateById(costDomain);
costLogService.save(costDomain.getCostNo(), currentUserId, "财务审核通过", CostLogDomain.FINANCIAL_MANUAL_PASS);
//流转状态 //流转状态
nextState(finalCheckState); nextState(finalCheckState);
//发布到总线尝试下个环节的自动审核 //发布到总线尝试下个环节的自动审核
costSubscribe.subscribe(costContext); costSubscribe.subscribe(costContext);
} }
//人工审核没权限 //人工审核没权限
else { else {
throw new BizRuntimeException("current user no authority"); throw new BizRuntimeException("current user no authority");
}
} }
} }
......
package com.blt.other.module.cost.utils; package com.blt.other.module.cost.utils;
import com.bailuntec.common.SpringContextUtil; import com.bailuntec.common.SpringContextUtil;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
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.service.CostService;
import com.blt.other.module.cost.service.impl.cost.CostServiceFactory;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -17,6 +16,10 @@ public class CostUtils { ...@@ -17,6 +16,10 @@ public class CostUtils {
public static String getIdNum() { public static String getIdNum() {
String activeProfile = SpringContextUtil.getString("spring.profiles.active");
if (activeProfile.equals("test")) {
return IdWorker.getIdStr();
}
NumberFormat nf = NumberFormat.getInstance(); NumberFormat nf = NumberFormat.getInstance();
nf.setGroupingUsed(false); nf.setGroupingUsed(false);
nf.setMaximumIntegerDigits(6); nf.setMaximumIntegerDigits(6);
...@@ -47,16 +50,6 @@ public class CostUtils { ...@@ -47,16 +50,6 @@ public class CostUtils {
return "F" + result; return "F" + result;
} }
/**
* 生成费用单号
* @return
*/
// public static String getCostNo() {
// SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
// Random random = new Random();
// String costNo = "CO"+sdf.format(new Date())+random.nextInt(9);
// return costNo;
// }
/** /**
* 生成 CostDomain 实例 * 生成 CostDomain 实例
...@@ -64,6 +57,7 @@ public class CostUtils { ...@@ -64,6 +57,7 @@ public class CostUtils {
* @param request * @param request
* @return * @return
*/ */
@Deprecated
public static CostDomain createCostDomain(HttpServletRequest request, String costNo) { public static CostDomain createCostDomain(HttpServletRequest request, String costNo) {
String companyNo = request.getParameter("companyNo"); String companyNo = request.getParameter("companyNo");
String kindNo = request.getParameter("kindNo"); String kindNo = request.getParameter("kindNo");
...@@ -99,7 +93,7 @@ public class CostUtils { ...@@ -99,7 +93,7 @@ public class CostUtils {
} }
String costFormStr = request.getParameter("costForm"); String costFormStr = request.getParameter("costForm");
Integer costForm = null; Integer costForm = null;
Integer isTax = 0; int isTax = 0;
if (null != costFormStr && !"null".equals(costFormStr)) { if (null != costFormStr && !"null".equals(costFormStr)) {
costForm = Integer.parseInt(costFormStr); costForm = Integer.parseInt(costFormStr);
if (1 == costForm) { if (1 == costForm) {
...@@ -197,10 +191,6 @@ public class CostUtils { ...@@ -197,10 +191,6 @@ public class CostUtils {
} }
} }
} }
// if (null != isLend && 1 == isLend){
// costDomain.setTypeNo(null);
// costDomain.setKindNo(null);
// }
return costDomain; return costDomain;
} }
} }
...@@ -5,7 +5,11 @@ spring: ...@@ -5,7 +5,11 @@ spring:
url: jdbc:mysql://cdb-aanqm573.gz.tencentcdb.com:10120/bailun_other?useUnicode=true&characterEncoding=utf-8&useSSL=false&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true url: jdbc:mysql://cdb-aanqm573.gz.tencentcdb.com:10120/bailun_other?useUnicode=true&characterEncoding=utf-8&useSSL=false&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true
username: root username: root
password: 'Aarob2020#' password: 'Aarob2020#'
hikari:
minimum-idle: 3
maximum-pool-size: 10
max-lifetime: 30000
connection-test-query: 'select 1'
thymeleaf: thymeleaf:
prefix: classpath:/templates/ prefix: classpath:/templates/
suffix: .html suffix: .html
...@@ -15,6 +19,8 @@ spring: ...@@ -15,6 +19,8 @@ spring:
jackson: jackson:
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8 time-zone: GMT+8
profiles:
active: test
#mybatis plus 配置 #mybatis plus 配置
mybatis-plus: mybatis-plus:
......
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