后付费用户的负金额

This commit is contained in:
TS-QD1 2024-06-18 18:55:43 +08:00
parent af68a3956d
commit b37be9472f
11 changed files with 96 additions and 12 deletions

View File

@ -185,6 +185,7 @@ public class AccountItemResourceController extends DefaultBaseController {
accountItemVO.setDescription(accountItemOrderVO.getDescription());
accountItemVO.setOrderId(accountItemOrderVO.getOrderId());
accountItemVO.setOrderType(type);
accountItemVO.setIsPostpaid(accountItemOrderVO.getIsPostpaid());
accountItemService.saveReturnId(accountItemVO);
return new SuccessResult();
}

View File

@ -21,6 +21,7 @@ public class UserExpandDTO extends UserDTO {
private Long priceMaterialAgentUrgent;
private String availableProjType;
private String postpaid;
private Integer postpaidCount;
private Integer freeProjCount;
private Integer correctionCount;
@ -88,6 +89,14 @@ public class UserExpandDTO extends UserDTO {
this.postpaid = postpaid;
}
public Integer getPostpaidCount() {
return postpaidCount == null ? 0 : postpaidCount;
}
public void setPostpaidCount(Integer postpaidCount) {
this.postpaidCount = postpaidCount;
}
public Integer getFreeProjCount() {
return freeProjCount == null ? 3 : freeProjCount;
}

View File

@ -17,6 +17,7 @@ public class UserExpandPO {
private Long priceMaterialAgentUrgent;
private String availableProjType;
private String postpaid;
private Integer postpaidCount;
private Integer freeProjCount;
private Integer correctionCount;
@ -84,6 +85,14 @@ public class UserExpandPO {
this.postpaid = postpaid;
}
public Integer getPostpaidCount() {
return postpaidCount == null ? 0 : postpaidCount;
}
public void setPostpaidCount(Integer postpaidCount) {
this.postpaidCount = postpaidCount;
}
public Integer getFreeProjCount() {
return freeProjCount == null ? 3 : freeProjCount;
}

View File

@ -27,6 +27,9 @@ public class AccountItemOrderVO {
@ApiModelProperty(name = "code", value = "编码")
@CheckEmptyAnnotation(name = "编码")
private String code;
@ApiModelProperty(name = "isPostpaid", value = "是否后付费")
@CheckEmptyAnnotation(name = "是否后付费")
private Integer isPostpaid;
public String getCode() {
return code == null ? "" : code.trim();
@ -75,4 +78,12 @@ public class AccountItemOrderVO {
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public Integer getIsPostpaid() {
return isPostpaid == null ? 0 : isPostpaid;
}
public void setIsPostpaid(Integer isPostpaid) {
this.isPostpaid = isPostpaid;
}
}

View File

@ -41,6 +41,7 @@ public class AccountItemVO {
private String orderType;
@ApiModelProperty(name = "checkStatus", value = "核对状态0:待核对,1:已核对")
private String checkStatus;
private Integer isPostpaid;
public String getOrderType() {
return orderType == null ? "" : orderType.trim();
@ -122,5 +123,11 @@ public class AccountItemVO {
this.checkStatus = checkStatus;
}
public Integer getIsPostpaid() {
return isPostpaid == null ? 0 : isPostpaid;
}
public void setIsPostpaid(Integer isPostpaid) {
this.isPostpaid = isPostpaid;
}
}

View File

@ -27,6 +27,7 @@ public class UserExpandVO {
@CheckEmptyAnnotation(name = "可用项目类型")
private String availableProjType;
private String postpaid;
private Integer postpaidCount;
@CheckNumberAnnotation(name = "免费项目个数", min = 0, max = 10)
private Integer freeProjCount;
@CheckNumberAnnotation(name = "资料补正次数", min = 0, max = 10)
@ -96,6 +97,14 @@ public class UserExpandVO {
this.postpaid = postpaid;
}
public Integer getPostpaidCount() {
return postpaidCount == null ? 0 : postpaidCount;
}
public void setPostpaidCount(Integer postpaidCount) {
this.postpaidCount = postpaidCount;
}
public Integer getFreeProjCount() {
return freeProjCount == null ? 3 : freeProjCount;
}

View File

@ -267,9 +267,9 @@ public class AccountServiceImpl extends DefaultBaseService implements IAccountSe
Map<String, Object> params = super.getHashMap(2);
params.put("accountId", accountId);
params.put("accountMoney", money);
if (money < 0) {
throw new SaveException("余额不足");
}
// if (money < 0) {
// throw new SaveException("余额不足");
// }
accountDao.updateMoney(params);
}

View File

@ -1,6 +1,7 @@
package cn.com.tenlion.operator.service.accountitem.impl;
import cn.com.tenlion.operator.pojo.dtos.account.AccountDTO;
import cn.com.tenlion.operator.pojo.pos.user.expand.UserExpandPO;
import cn.com.tenlion.operator.pojo.vos.accountitem.AccountItemOrderVO;
import cn.com.tenlion.operator.service.account.IAccountService;
import cn.com.tenlion.operator.util.EncryptUtil;
@ -98,9 +99,9 @@ public class AccountItemServiceImpl extends DefaultBaseService implements IAccou
Integer new1 = null;
if (accountItemVO.getMode().equals(1)) {
new1 = old1 + accountItemVO.getAccountMoney();
}else{
} else {
new1 = old1 - accountItemVO.getAccountMoney();
if(new1 == null || new1 < 0) {
if (accountItemVO.getIsPostpaid() == 0 && new1 < 0) {
throw new SaveException("余额不足抵扣");
}
}
@ -112,13 +113,13 @@ public class AccountItemServiceImpl extends DefaultBaseService implements IAccou
iAccountService.updateMoney(accountDTO.getAccountId(), new1);
Map<String, Object> params = HashMapUtil.beanToMap(accountItemVO);
params.put("accountItemId", accountItemId);
try{
try {
if (StringUtils.isBlank(token)) {
setSaveInfo(params);
} else {
setAppSaveInfo(token, params);
}
}catch(Exception e) {
} catch (Exception e) {
params.put("creator", accountDTO.getUserId());
params.put("gmtCreate", DateUtil.getTime());
params.put("isDelete", 0);
@ -217,7 +218,7 @@ public class AccountItemServiceImpl extends DefaultBaseService implements IAccou
@Override
public List<AccountItemDTO> list(Map<String, Object> params) {
List<AccountItemDTO> list = accountItemDao.list(params);
for(AccountItemDTO dto : list) {
for (AccountItemDTO dto : list) {
dto.setAccountMoneyDouble(PayUtil.buiderMoney(dto.getAccountMoney()));
dto.setAccountAfterMoneyDouble(PayUtil.buiderMoney(dto.getAccountAfterMoney()));
}
@ -227,7 +228,7 @@ public class AccountItemServiceImpl extends DefaultBaseService implements IAccou
@Override
public List<AccountItemBO> listBO(Map<String, Object> params) {
List<AccountItemBO> list = accountItemDao.listBO(params);
for(AccountItemBO dto : list) {
for (AccountItemBO dto : list) {
dto.setAccountMoneyDouble(PayUtil.buiderMoney(dto.getAccountMoney()));
dto.setAccountAfterMoneyDouble(PayUtil.buiderMoney(dto.getAccountAfterMoney()));
}
@ -284,8 +285,8 @@ public class AccountItemServiceImpl extends DefaultBaseService implements IAccou
Map<String, Object> params = super.getHashMap(2);
params.put("orderId", accountItemVO.getOrderId());
List<AccountItemDTO> list = list(params);
for(AccountItemDTO dto : list) {
if(dto.getType().equals("2")) {
for (AccountItemDTO dto : list) {
if (dto.getType().equals("2")) {
if (accountItemVO.getAccountMoney() >= dto.getAccountMoney()) {
throw new SaveException("金额错误");
}

View File

@ -0,0 +1,20 @@
package cn.com.tenlion.operator.service.user;
import cn.com.tenlion.operator.service.account.IAccountService;
import ink.wgink.exceptions.base.SystemException;
import ink.wgink.interfaces.user.IUserSaveAfterHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class UserSaveAfterHandlerImpl implements IUserSaveAfterHandler {
@Autowired
private IAccountService iAccountService;
@Override
public void handle(String userId, String username, String userName) throws SystemException {
iAccountService.saveCreate("普通用户", userId);
}
}

View File

@ -11,6 +11,7 @@
<result column="price_material_agent_urgent" property="priceMaterialAgentUrgent"/>
<result column="available_proj_type" property="availableProjType"/>
<result column="postpaid" property="postpaid"/>
<result column="postpaid_count" property="postpaidCount"/>
<result column="free_proj_count" property="freeProjCount"/>
<result column="correction_count" property="correctionCount"/>
</resultMap>
@ -24,6 +25,7 @@
<result column="price_material_agent_urgent" property="priceMaterialAgentUrgent"/>
<result column="available_proj_type" property="availableProjType"/>
<result column="postpaid" property="postpaid"/>
<result column="postpaid_count" property="postpaidCount"/>
<result column="free_proj_count" property="freeProjCount"/>
<result column="correction_count" property="correctionCount"/>
</resultMap>
@ -39,6 +41,7 @@
price_material_agent_urgent,
available_proj_type,
postpaid,
postpaid_count,
free_proj_count,
correction_count
) VALUES (
@ -51,6 +54,7 @@
#{priceMaterialAgentUrgent},
#{availableProjType},
#{postpaid},
#{postpaidCount},
#{freeProjCount},
#{correctionCount}
)
@ -68,6 +72,7 @@
price_material_agent_urgent = #{priceMaterialAgentUrgent},
available_proj_type = #{availableProjType},
postpaid = #{postpaid},
postpaid_count = #{postpaidCount},
free_proj_count = #{freeProjCount},
correction_count = #{correctionCount}
WHERE
@ -84,6 +89,7 @@
price_material_agent_urgent,
available_proj_type,
postpaid,
postpaid_count,
free_proj_count,
correction_count
FROM
@ -104,6 +110,7 @@
price_material_agent_urgent,
available_proj_type,
postpaid,
postpaid_count,
free_proj_count,
correction_count
FROM

View File

@ -90,6 +90,8 @@
</div>
</div>
</div>
</div>
<div class=" layui-row layui-col-space15">
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label layui-form-label-new">后付费用户</label>
@ -98,6 +100,14 @@
</div>
</div>
</div>
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label layui-form-label-new">后付费数量</label>
<div class="layui-input-block layui-input-block-new">
<input type="number" id="postpaidCount" name="postpaidCount" class="layui-input" value="" placeholder="后付费数量后付费激活有效0不限制" maxlength="50">
</div>
</div>
</div>
</div>
<div class=" layui-row layui-col-space15">
<div class="layui-col-xs6">
@ -211,7 +221,7 @@
if(key.indexOf('availableProjType') === 0) {
availableProjTypeArray.push(key.split('[')[1].split(']')[0]);
}
if(key.indexOf('postpaid') === 0) {
if(key.indexOf('postpaid[') === 0) {
postpaidArray.push(key.split('[')[1].split(']')[0]);
}
}