|
|
|
@ -4,11 +4,13 @@ import cc.yunxi.common.domain.LambdaQueryWrapperX;
|
|
|
|
|
import cc.yunxi.common.exception.BizIllegalException;
|
|
|
|
|
import cc.yunxi.common.utils.BeanUtils;
|
|
|
|
|
import cc.yunxi.common.utils.CommonUtil;
|
|
|
|
|
import cc.yunxi.domain.dto.UserDTO;
|
|
|
|
|
import cc.yunxi.domain.po.*;
|
|
|
|
|
import cc.yunxi.domain.query.WalletQuery;
|
|
|
|
|
import cc.yunxi.domain.vo.enterprise.WalletVO;
|
|
|
|
|
import cc.yunxi.enums.BusinessCodeEnum;
|
|
|
|
|
import cc.yunxi.enums.GlobalStatusEnum;
|
|
|
|
|
import cc.yunxi.mapper.BillRuleMapper;
|
|
|
|
|
import cc.yunxi.mapper.EnterpriseAccountBillMapper;
|
|
|
|
|
import cc.yunxi.mapper.EnterpriseMapper;
|
|
|
|
|
import cc.yunxi.mapper.WalletMapper;
|
|
|
|
@ -16,6 +18,7 @@ import cc.yunxi.service.IBillRuleService;
|
|
|
|
|
import cc.yunxi.service.IEnterpriseService;
|
|
|
|
|
import cc.yunxi.service.IEnterpriseWalletService;
|
|
|
|
|
import cc.yunxi.service.IRecycleStationService;
|
|
|
|
|
import cc.yunxi.utils.UserContext;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.hutool.db.PageResult;
|
|
|
|
@ -51,6 +54,12 @@ public class EnterpriseWalletServiceImpl extends ServiceImpl<WalletMapper, Enter
|
|
|
|
|
@Autowired
|
|
|
|
|
private IBillRuleService billRuleService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private BillRuleMapper billRuleMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IEnterpriseService enterpriseService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public String queryCompanyParentId(String companyId){
|
|
|
|
@ -62,15 +71,20 @@ public class EnterpriseWalletServiceImpl extends ServiceImpl<WalletMapper, Enter
|
|
|
|
|
public String addWallet(WalletVO walletVO) {
|
|
|
|
|
EnterpriseWallet enterpriseWallet = BeanUtils.copyBean(walletVO, EnterpriseWallet.class);
|
|
|
|
|
|
|
|
|
|
enterpriseWallet.setCode(this.getNumber());
|
|
|
|
|
enterpriseWallet.setCode(this.getNumber("LS"));
|
|
|
|
|
enterpriseWallet.setOrderCode(this.getNumber("CZ"));
|
|
|
|
|
enterpriseWallet.setPhoto(formatPhoto(enterpriseWallet.getPhoto()));
|
|
|
|
|
enterpriseWallet.setFile(formatFile(enterpriseWallet.getFile()));
|
|
|
|
|
String companyParentId = walletMapper.queryCompanyParentId(enterpriseWallet.getCompanyId());
|
|
|
|
|
enterpriseWallet.setOrganizeJsonId(String.format("[\"%s\",\"%s\"]",companyParentId,enterpriseWallet.getCompanyId()));
|
|
|
|
|
// 返回内容
|
|
|
|
|
|
|
|
|
|
walletMapper.insert(enterpriseWallet);
|
|
|
|
|
enterpriseWallet.setCreatorTime(LocalDateTime.now());
|
|
|
|
|
enterpriseWallet.setFLastModifyTime(LocalDateTime.now());
|
|
|
|
|
|
|
|
|
|
String companyUserId = enterpriseService.getEnterpriseUserIdByCompanyId(enterpriseWallet.getCompanyId());
|
|
|
|
|
enterpriseWallet.setCreatorUserId(companyUserId);
|
|
|
|
|
this.save(enterpriseWallet);
|
|
|
|
|
return enterpriseWallet.getId();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -85,8 +99,8 @@ public class EnterpriseWalletServiceImpl extends ServiceImpl<WalletMapper, Enter
|
|
|
|
|
return this.page(pageDO, wrapperX);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
private String getNumber() {
|
|
|
|
|
String enCode = "LS";
|
|
|
|
|
private String getNumber(String enCode) {
|
|
|
|
|
|
|
|
|
|
StringBuilder strNumber = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<BillRule> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
@ -120,7 +134,7 @@ public class EnterpriseWalletServiceImpl extends ServiceImpl<WalletMapper, Enter
|
|
|
|
|
strNumber.append(CommonUtil.padRight(String.valueOf((startNumber) + entity.getThisNumber()), entity.getDigit(), '0'));
|
|
|
|
|
//更新流水号
|
|
|
|
|
entity.setOutputNumber(strNumber.toString());
|
|
|
|
|
billRuleService.updateById(entity);
|
|
|
|
|
billRuleMapper.updateById(entity);
|
|
|
|
|
}
|
|
|
|
|
return strNumber.toString();
|
|
|
|
|
}
|
|
|
|
|