提交 fbdd250f 作者: 张小凤

RepoCash

上级 65f985b9
...@@ -381,14 +381,14 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -381,14 +381,14 @@ public enum ResultEnum implements BaseErrorInfoInterface {
SCORE_ERROR("40177", "您输入的积分数量有误,请重新输入!"), SCORE_ERROR("40177", "您输入的积分数量有误,请重新输入!"),
PLEASE_FILL_IN_THE_CONTRACT_TEMPLATE_FIRST("40178", "请先填充合同模板!"), PLEASE_FILL_IN_THE_CONTRACT_TEMPLATE_FIRST("40178", "请先填充合同模板!"),
SCORE_NOT_GIVE_MYSELF("40179","积分不能转赠给本人,请重新操作"), SCORE_NOT_GIVE_MYSELF("40179", "积分不能转赠给本人,请重新操作"),
ALREADY_FINISH_ENT_AUTH_ERROR("2000", "助力已完成!"), ALREADY_FINISH_ENT_AUTH_ERROR("2000", "助力已完成!"),
SYSTEM_ERROR ("2001","系统错误,请稍后重试") , SYSTEM_ERROR("2001", "系统错误,请稍后重试"),
RULE_ERROR ("2002","当前兑换比例已失效,请刷新后重试"), RULE_ERROR("2002", "当前兑换比例已失效,请刷新后重试"),
COUNT_LIMIT_ERROR("2003", "参与次数已达上线"), COUNT_LIMIT_ERROR("2003", "参与次数已达上线"),
ALREADY_ENT_AUTH_ERROR("2004","助力失败,您已完成企业认证!"), ALREADY_ENT_AUTH_ERROR("2004", "助力失败,您已完成企业认证!"),
ALREADY_REAL_NAME_AUTH_ERROR("2005","助力失败,您已完成实名认证!"), ALREADY_REAL_NAME_AUTH_ERROR("2005", "助力失败,您已完成实名认证!"),
PARTICIPATE_BUT_NOT_AUTH_ERROR("2006", "待完成授权或认证"), PARTICIPATE_BUT_NOT_AUTH_ERROR("2006", "待完成授权或认证"),
ALREADY_HELP_ERROR("2007", "已助力"), ALREADY_HELP_ERROR("2007", "已助力"),
ALREADY_STOP_ERROR("2008", "活动已下线"), ALREADY_STOP_ERROR("2008", "活动已下线"),
...@@ -396,10 +396,11 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -396,10 +396,11 @@ public enum ResultEnum implements BaseErrorInfoInterface {
ALREADY_BINDING_ERROR("2010", "优惠券已被绑定"), ALREADY_BINDING_ERROR("2010", "优惠券已被绑定"),
ALREADY_DIVIDE_ERROR("2011", "订单已分成"), ALREADY_DIVIDE_ERROR("2011", "订单已分成"),
DIVIDE_OBJ_NOT_EXIST("2012", "先点击确认添加分成对象"), DIVIDE_OBJ_NOT_EXIST("2012", "先点击确认添加分成对象"),
THE_REQUEST_IS_NOT_AUTHENTICATED("2013","请求未经过鉴权"), THE_REQUEST_IS_NOT_AUTHENTICATED("2013", "请求未经过鉴权"),
THE_TOKEN_IS_INVALID("2014","token失效"), THE_TOKEN_IS_INVALID("2014", "token失效"),
FAILED_TO_CHARGE_MONEY("2015","只有后台账号才能给小程序客户端充值") , FAILED_TO_CHARGE_MONEY("2015", "只有后台账号才能给小程序客户端充值"),
NO_WALLET_FUNCTION("2016","后台账号无钱包功能") ; NO_WALLET_FUNCTION("2016", "后台账号无钱包功能"),
THE_ORDER_HAS_BEEN_PAID("2017", "订单已支付/订单编号错误");
/** /**
* 错误码 * 错误码
......
...@@ -80,11 +80,11 @@ public class RepoCashController extends BaseController { ...@@ -80,11 +80,11 @@ public class RepoCashController extends BaseController {
return repoCashService.walletUsers(this.getCurrentAccount(request), walletUsersVO); return repoCashService.walletUsers(this.getCurrentAccount(request), walletUsersVO);
} }
@ApiIgnore
@ApiOperation(value = "web-订单支付") @ApiOperation(value = "租赁——订单支付")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = PayCashResultDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("orderPayment") @PostMapping("orderPayment")
public PayCashResultDTO orderPayment(HttpServletRequest request, @RequestParam String orderNo) { public ResultBody orderPayment(HttpServletRequest request, @RequestParam String orderNo) {
return repoCashService.orderPayment(this.getCurrentAccount(request), orderNo); return repoCashService.orderPayment(this.getCurrentAccount(request), orderNo);
} }
...@@ -101,8 +101,6 @@ public class RepoCashController extends BaseController { ...@@ -101,8 +101,6 @@ public class RepoCashController extends BaseController {
@GetMapping("RemainingBalance") @GetMapping("RemainingBalance")
public BigDecimal RemainingBalance( public BigDecimal RemainingBalance(
@RequestParam(value = "repoAccountId", required = true) Integer repoAccountId) { @RequestParam(value = "repoAccountId", required = true) Integer repoAccountId) {
String s = stringRedisTemplate.opsForValue().get("R2023052814538712");
return repoCashService.RemainingBalance(repoAccountId); return repoCashService.RemainingBalance(repoAccountId);
} }
......
package com.mmc.payment.entity;
import com.mmc.payment.model.dto.OrderVcuDTO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
/**
* @Author small
* @Date 2023/6/1 15:55
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OrderVcuDO implements Serializable {
private static final long serialVersionUID = 5685858931224789256L;
private Integer id;
private Integer orderInfoId;
private Integer orderRefundId;
private Integer vcuType;
private Integer vcuSatus;
private String imgs;
private String videoUrl;
private String remark;
private Date createTime;
public OrderVcuDTO buildOrderVcuDTO() {
return OrderVcuDTO.builder().id(this.id).orderInfoId(this.orderInfoId).vcuType(this.vcuType)
.vcuSatus(this.vcuSatus)
.imgs(StringUtils.isBlank(this.imgs) ? null : Arrays.asList(this.imgs.split(",")))
.remark(this.remark)
.videoUrl(this.videoUrl).build();
}
}
...@@ -52,6 +52,8 @@ public class RepoCashDO implements Serializable { ...@@ -52,6 +52,8 @@ public class RepoCashDO implements Serializable {
private String type; private String type;
private BigDecimal cashFreeze; private BigDecimal cashFreeze;
private BigDecimal shouldPay;
private BigDecimal actualPay;
public RepoCashDTO buildRepoCashDTO() { public RepoCashDTO buildRepoCashDTO() {
return RepoCashDTO.builder().id(this.id).repoAccountId(this.repoAccountId).uid(this.uid) return RepoCashDTO.builder().id(this.id).repoAccountId(this.repoAccountId).uid(this.uid)
......
...@@ -22,9 +22,13 @@ import io.jsonwebtoken.lang.Collections; ...@@ -22,9 +22,13 @@ import io.jsonwebtoken.lang.Collections;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -59,6 +63,9 @@ public class RepoCashServiceImpl implements RepoCashService { ...@@ -59,6 +63,9 @@ public class RepoCashServiceImpl implements RepoCashService {
@Value("${userapp.url}") @Value("${userapp.url}")
private String userAppUrl; private String userAppUrl;
@Value("${oms.url}")
private String omsUrl;
@Override @Override
public PageResult listPageRepoCash(BaseAccountDTO cuser, RepoCashQO param) { public PageResult listPageRepoCash(BaseAccountDTO cuser, RepoCashQO param) {
int count = repoCashDao.countPagePFRepoCash(param); int count = repoCashDao.countPagePFRepoCash(param);
...@@ -263,16 +270,30 @@ public class RepoCashServiceImpl implements RepoCashService { ...@@ -263,16 +270,30 @@ public class RepoCashServiceImpl implements RepoCashService {
} }
@Override @Override
public PayCashResultDTO orderPayment(BaseAccountDTO currentAccount, String orderNo) { public ResultBody orderPayment(BaseAccountDTO currentAccount, String orderNo) {
String s = stringRedisTemplate.opsForValue().get(orderNo); String s = stringRedisTemplate.opsForValue().get(orderNo);
if (s == null) {
return ResultBody.error(ResultEnum.THE_ORDER_HAS_BEEN_PAID);
}
RepoCashDO repoCashDO = JSONObject.parseObject(s, RepoCashDO.class); RepoCashDO repoCashDO = JSONObject.parseObject(s, RepoCashDO.class);
repoCashDao.orderPayment(JSONObject.parseObject(s, RepoCashDO.class)); BigDecimal actualPay = repoCashDO.getActualPay();
BigDecimal negate = new BigDecimal(String.valueOf(actualPay)).negate();
RepoWalletDO wallet = repoCashDao.getRepoWalletInfo(currentAccount.getUserAccountId());
if (wallet == null) {
return ResultBody.error(ResultEnum.WALLET_NOT_FIND_ERROR);
}
BigDecimal newCashAmt =
(wallet.getCashAmt().add(negate)).setScale(2, BigDecimal.ROUND_DOWN);
repoCashDO.setAmtPaid(negate);
repoCashDO.setCashAmt(newCashAmt);
repoCashDao.orderPayment(repoCashDO);
repoCashDao.updateRepoWalletAmt(currentAccount.getUserAccountId(), negate);
if (!currentAccount.getUserAccountId().equals(currentAccount.getUserAccountId())) { if (!currentAccount.getUserAccountId().equals(currentAccount.getUserAccountId())) {
return PayCashResultDTO.error( return ResultBody.error(ResultEnum.WALLET_NOT_FIND_ERROR);
ResultEnum.WALLET_NOT_FIND_ERROR.getResultCode(),
ResultEnum.WALLET_NOT_FIND_ERROR.getResultMsg());
} }
return null; orderStatusChanges(currentAccount.getToken(), orderNo);
return ResultBody.success();
} }
@Override @Override
...@@ -373,13 +394,29 @@ public class RepoCashServiceImpl implements RepoCashService { ...@@ -373,13 +394,29 @@ public class RepoCashServiceImpl implements RepoCashService {
* @return * @return
*/ */
private List<RepoWalletDO> getRepoWalletDOS(WalletMessageQO walletMessageQO) { private List<RepoWalletDO> getRepoWalletDOS(WalletMessageQO walletMessageQO) {
ResponseEntity<String> responseEntity = restTemplate.postForEntity("http://localhost:35150/userapp/back-user/feignListBAccountPage" ResponseEntity<String> responseEntity = restTemplate.postForEntity(userAppUrl + "back-user/feignListBAccountPage"
, walletMessageQO, String.class); , walletMessageQO, String.class);
String body = responseEntity.getBody(); String body = responseEntity.getBody();
List<RepoWalletDO> repoWalletDOS1 = JSONArray.parseArray(body, RepoWalletDO.class); List<RepoWalletDO> repoWalletDOS1 = JSONArray.parseArray(body, RepoWalletDO.class);
return repoWalletDOS1; return repoWalletDOS1;
} }
/**
* 立即付款 修改订单编号
*
* @param orderNo
* @return
*/
private void orderStatusChanges(String token, String orderNo) {
HttpHeaders headers = new HttpHeaders();
headers.add("token", token);
HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<MultiValueMap<String, Object>>(headers);
ResponseEntity<String> exchange = restTemplate.exchange(omsUrl + "RentalOrders/orderStatusChanges?orderNo=" + orderNo + "&tranStatus=" + 200,
HttpMethod.GET, formEntity, String.class);
System.out.println(exchange);
}
@Override @Override
public ResultBody walletUsers(BaseAccountDTO cuser, WalletUsersVO walletUsersVO) { public ResultBody walletUsers(BaseAccountDTO cuser, WalletUsersVO walletUsersVO) {
......
...@@ -37,7 +37,7 @@ public interface RepoCashService { ...@@ -37,7 +37,7 @@ public interface RepoCashService {
BigDecimal RemainingBalance(Integer uid); BigDecimal RemainingBalance(Integer uid);
PayCashResultDTO orderPayment(BaseAccountDTO currentAccount, String orderNo); ResultBody orderPayment(BaseAccountDTO currentAccount, String orderNo);
PayCashResultDTO payCashOrder(RepoOrderPayVO orderPay); PayCashResultDTO payCashOrder(RepoOrderPayVO orderPay);
......
...@@ -37,4 +37,8 @@ mount: ...@@ -37,4 +37,8 @@ mount:
userapp: userapp:
url: http://localhost:35150/userapp/ url: http://localhost:35150/userapp/
oms:
url: http://localhost:8077/oms/
...@@ -192,11 +192,11 @@ ...@@ -192,11 +192,11 @@
insert into repo_cash insert into repo_cash
(repo_account_id, uid, account_name, order_info_id, order_no, sku_info_id, sku_title, (repo_account_id, uid, account_name, order_info_id, order_no, sku_info_id, sku_title,
ware_info_id, ware_no, ware_title, pay_no, pay_method, amt_paid, cash_amt, pay_time, remark, ware_info_id, ware_no, ware_title, pay_no, pay_method, amt_paid, cash_amt, pay_time, remark,
voucher, refund_no, update_time, update_user, create_time, create_user) voucher, refund_no, update_time, update_user, create_time, create_user, cash_type_id)
values (#{repoAccountId}, #{uid}, #{accountName}, #{orderInfoId}, #{orderNo}, #{skuInfoId}, #{skuTitle}, values (#{repoAccountId}, #{uid}, #{accountName}, #{orderInfoId}, #{orderNo}, #{skuInfoId}, #{skuTitle},
#{wareInfoId}, #{wareNo}, #{wareTitle}, #{payNo}, #{payMethod}, #{amtPaid}, #{cashAmt}, #{payTime}, #{wareInfoId}, #{wareNo}, #{wareTitle}, #{payNo}, #{payMethod}, #{amtPaid}, #{cashAmt}, now(),
#{remark}, #{remark},
#{voucher}, #{refundNo}, #{updateTime}, #{updateUser}, #{createTime}, #{createUser}) #{voucher}, #{refundNo}, #{updateTime}, #{updateUser}, now(), #{createUser}, 2)
</insert> </insert>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论