商户流水

master
jevononlie 6 months ago
parent 2539e64ffc
commit a1181d99ae

@ -67,7 +67,7 @@ public class EnterpriseWallet {
@ApiModelProperty("金额")
@TableField("price_star")
private BigDecimal price_star;
private BigDecimal priceStar;
@ApiModelProperty("上传凭证图片")
@TableField("photo")
@ -85,7 +85,9 @@ public class EnterpriseWallet {
@TableField("organize_json_id")
private String organizeJsonId;
@ApiModelProperty("create user id")
@TableField("f_creator_user_id")
private String creatorUserId;
@ApiModelProperty("创建时间")
@TableField("f_creator_time")
@ -93,7 +95,7 @@ public class EnterpriseWallet {
@ApiModelProperty("修改时间")
@TableField("f_last_modify_time")
private Date fLastModifyTime;
private LocalDateTime fLastModifyTime;
}

@ -49,7 +49,7 @@ public class WalletVO {
private String rechargeStatus;
@ApiModelProperty("金额")
private BigDecimal price_star;
private BigDecimal priceStar;
@ApiModelProperty("上传凭证图片")
private String photo;

@ -15,12 +15,10 @@ import org.apache.ibatis.annotations.Param;
*/
@Mapper
public interface EnterpriseMapper extends BaseMapper<Enterprise> {
// /**
// * 站点id获取商户信息
// * @param stationId
// * @return Enterprise
// */
// Enterprise getEnterpriseByStationId(@Param("stationId") String stationId);
/**
* id
* @param companyId
* @return Enterprise
*/
String queryEnterpriseUserIdByCompanyId(String companyId);
}

@ -29,7 +29,4 @@ public interface IBillRuleService extends IService<BillRule> {
* @return BillRule
*/
BillRule getBillRuleByCode(String enCode);
boolean updateById(BillRule billRule);
}

@ -24,6 +24,12 @@ public interface IEnterpriseService extends IService<Enterprise> {
*/
Enterprise getEnterpriseByStationId(String stationId);
/**
* id
* @param companyId
* @return
*/
String getEnterpriseUserIdByCompanyId(String companyId);
/**
* id
* @param enterpriseId

@ -62,12 +62,4 @@ public class BillRuleServiceImpl extends ServiceImpl<BillRuleMapper, BillRule> i
return entity;
}
@Override
public boolean updateById(BillRule billRule) {
return this.updateById(billRule);
}
}

@ -44,11 +44,14 @@ public class EnterpriseServiceImpl extends ServiceImpl<EnterpriseMapper, Enterpr
@Resource
private IRecycleStationService recycleStationService;
@Resource
private EnterpriseMapper enterpriseMapper;
@Autowired
private EnterpriseAccountBillMapper accountBillMapper;
@Override
public Enterprise getEnterpriseByStationId(String stationId) {
RecycleStation station = recycleStationService.getStationById(stationId);
String enterpriseId = station.getEnterpriseId();
@ -57,6 +60,11 @@ public class EnterpriseServiceImpl extends ServiceImpl<EnterpriseMapper, Enterpr
}
return this.getEnterpriseById(enterpriseId, true);
}
@Override
public String getEnterpriseUserIdByCompanyId(String companyId) {
return enterpriseMapper.queryEnterpriseUserIdByCompanyId(companyId);
}
@Override
public Enterprise getEnterpriseById(String enterpriseId, Boolean isLock) {

@ -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();
}

@ -1,7 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cc.yunxi.mapper.EnterpriseMapper">
<select id="queryEnterpriseUserIdByCompanyId" resultType="String">
SELECT
f_id as id
FROM
base_user
WHERE
f_organize_id = #{companyId} LIMIT 1;
</select>
</mapper>

Loading…
Cancel
Save