商户流水

master
jevononlie 6 months ago
parent 2539e64ffc
commit a1181d99ae

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

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

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

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

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

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

@ -44,11 +44,14 @@ public class EnterpriseServiceImpl extends ServiceImpl<EnterpriseMapper, Enterpr
@Resource @Resource
private IRecycleStationService recycleStationService; private IRecycleStationService recycleStationService;
@Resource
private EnterpriseMapper enterpriseMapper;
@Autowired @Autowired
private EnterpriseAccountBillMapper accountBillMapper; private EnterpriseAccountBillMapper accountBillMapper;
@Override
public Enterprise getEnterpriseByStationId(String stationId) { public Enterprise getEnterpriseByStationId(String stationId) {
RecycleStation station = recycleStationService.getStationById(stationId); RecycleStation station = recycleStationService.getStationById(stationId);
String enterpriseId = station.getEnterpriseId(); String enterpriseId = station.getEnterpriseId();
@ -57,6 +60,11 @@ public class EnterpriseServiceImpl extends ServiceImpl<EnterpriseMapper, Enterpr
} }
return this.getEnterpriseById(enterpriseId, true); return this.getEnterpriseById(enterpriseId, true);
} }
@Override
public String getEnterpriseUserIdByCompanyId(String companyId) {
return enterpriseMapper.queryEnterpriseUserIdByCompanyId(companyId);
}
@Override @Override
public Enterprise getEnterpriseById(String enterpriseId, Boolean isLock) { 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.exception.BizIllegalException;
import cc.yunxi.common.utils.BeanUtils; import cc.yunxi.common.utils.BeanUtils;
import cc.yunxi.common.utils.CommonUtil; import cc.yunxi.common.utils.CommonUtil;
import cc.yunxi.domain.dto.UserDTO;
import cc.yunxi.domain.po.*; import cc.yunxi.domain.po.*;
import cc.yunxi.domain.query.WalletQuery; import cc.yunxi.domain.query.WalletQuery;
import cc.yunxi.domain.vo.enterprise.WalletVO; import cc.yunxi.domain.vo.enterprise.WalletVO;
import cc.yunxi.enums.BusinessCodeEnum; import cc.yunxi.enums.BusinessCodeEnum;
import cc.yunxi.enums.GlobalStatusEnum; import cc.yunxi.enums.GlobalStatusEnum;
import cc.yunxi.mapper.BillRuleMapper;
import cc.yunxi.mapper.EnterpriseAccountBillMapper; import cc.yunxi.mapper.EnterpriseAccountBillMapper;
import cc.yunxi.mapper.EnterpriseMapper; import cc.yunxi.mapper.EnterpriseMapper;
import cc.yunxi.mapper.WalletMapper; import cc.yunxi.mapper.WalletMapper;
@ -16,6 +18,7 @@ import cc.yunxi.service.IBillRuleService;
import cc.yunxi.service.IEnterpriseService; import cc.yunxi.service.IEnterpriseService;
import cc.yunxi.service.IEnterpriseWalletService; import cc.yunxi.service.IEnterpriseWalletService;
import cc.yunxi.service.IRecycleStationService; import cc.yunxi.service.IRecycleStationService;
import cc.yunxi.utils.UserContext;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.db.PageResult; import cn.hutool.db.PageResult;
@ -51,6 +54,12 @@ public class EnterpriseWalletServiceImpl extends ServiceImpl<WalletMapper, Enter
@Autowired @Autowired
private IBillRuleService billRuleService; private IBillRuleService billRuleService;
@Autowired
private BillRuleMapper billRuleMapper;
@Autowired
private IEnterpriseService enterpriseService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String queryCompanyParentId(String companyId){ public String queryCompanyParentId(String companyId){
@ -62,15 +71,20 @@ public class EnterpriseWalletServiceImpl extends ServiceImpl<WalletMapper, Enter
public String addWallet(WalletVO walletVO) { public String addWallet(WalletVO walletVO) {
EnterpriseWallet enterpriseWallet = BeanUtils.copyBean(walletVO, EnterpriseWallet.class); 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.setPhoto(formatPhoto(enterpriseWallet.getPhoto()));
enterpriseWallet.setFile(formatFile(enterpriseWallet.getFile())); enterpriseWallet.setFile(formatFile(enterpriseWallet.getFile()));
String companyParentId = walletMapper.queryCompanyParentId(enterpriseWallet.getCompanyId()); String companyParentId = walletMapper.queryCompanyParentId(enterpriseWallet.getCompanyId());
enterpriseWallet.setOrganizeJsonId(String.format("[\"%s\",\"%s\"]",companyParentId,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(); return enterpriseWallet.getId();
} }
@ -85,8 +99,8 @@ public class EnterpriseWalletServiceImpl extends ServiceImpl<WalletMapper, Enter
return this.page(pageDO, wrapperX); return this.page(pageDO, wrapperX);
} }
private String getNumber() { private String getNumber(String enCode) {
String enCode = "LS";
StringBuilder strNumber = new StringBuilder(); StringBuilder strNumber = new StringBuilder();
LambdaQueryWrapper<BillRule> wrapper = new LambdaQueryWrapper<>(); 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')); strNumber.append(CommonUtil.padRight(String.valueOf((startNumber) + entity.getThisNumber()), entity.getDigit(), '0'));
//更新流水号 //更新流水号
entity.setOutputNumber(strNumber.toString()); entity.setOutputNumber(strNumber.toString());
billRuleService.updateById(entity); billRuleMapper.updateById(entity);
} }
return strNumber.toString(); return strNumber.toString();
} }

@ -1,7 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cc.yunxi.mapper.EnterpriseMapper"> <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> </mapper>

Loading…
Cancel
Save