use of co.yixiang.modules.shop.domain.YxUser in project yshopmall by guchengwuyue.
the class YxStoreCouponUserServiceImpl method queryAll.
@Override
public // @Cacheable
Map<String, Object> queryAll(YxStoreCouponUserQueryCriteria criteria, Pageable pageable) {
getPage(pageable);
PageInfo<YxStoreCouponUser> page = new PageInfo<>(queryAll(criteria));
List<YxStoreCouponUserDto> storeOrderDTOS = generator.convert(page.getList(), YxStoreCouponUserDto.class);
for (YxStoreCouponUserDto couponUserDTO : storeOrderDTOS) {
YxUser yxUser = userService.getOne(new LambdaQueryWrapper<YxUser>().eq(YxUser::getUid, couponUserDTO.getUid()));
if (yxUser == null) {
couponUserDTO.setNickname("--");
continue;
}
couponUserDTO.setNickname(yxUser.getNickname());
}
Map<String, Object> map = new LinkedHashMap<>(2);
map.put("content", storeOrderDTOS);
map.put("totalElements", page.getTotal());
return map;
}
use of co.yixiang.modules.shop.domain.YxUser in project yshopmall by guchengwuyue.
the class YxUserExtractServiceImpl method doExtract.
@Override
public void doExtract(YxUserExtract resources) {
if (resources.getStatus() == null) {
throw new BadRequestException("请选择审核状态");
}
if (ShopCommonEnum.EXTRACT_0.getValue().equals(resources.getStatus())) {
throw new BadRequestException("请选择审核状态");
}
if (ShopCommonEnum.EXTRACT_MINUS_1.getValue().equals(resources.getStatus())) {
if (StrUtil.isEmpty(resources.getFailMsg())) {
throw new BadRequestException("请填写失败原因");
}
String mark = "提现失败,退回佣金" + resources.getExtractPrice() + "元";
YxUserDto userDTO = generator.convert(yxUserService.getOne(new LambdaQueryWrapper<YxUser>().eq(YxUser::getUid, resources.getUid())), YxUserDto.class);
// 增加流水
YxUserBill userBill = new YxUserBill();
userBill.setTitle("提现失败");
userBill.setUid(resources.getUid());
userBill.setCategory("now_money");
userBill.setType("extract");
userBill.setNumber(resources.getExtractPrice());
userBill.setLinkId(resources.getId().toString());
userBill.setBalance(NumberUtil.add(userDTO.getBrokeragePrice(), resources.getExtractPrice()));
userBill.setMark(mark);
userBill.setStatus(1);
userBill.setPm(1);
billService.save(userBill);
// 返回提现金额
yxUserService.incBrokeragePrice(resources.getExtractPrice().doubleValue(), resources.getUid());
resources.setFailTime(new Date());
}
// todo 此处为企业付款,没经过测试
boolean isTest = true;
if (!isTest) {
String openid = this.getUserOpenid(resources.getUid());
if (StrUtil.isNotBlank(openid)) {
try {
payService.entPay(openid, resources.getId().toString(), resources.getRealName(), resources.getExtractPrice().multiply(new BigDecimal(100)).intValue());
} catch (WxPayException e) {
throw new BadRequestException(e.getMessage());
}
} else {
throw new BadRequestException("不是微信用户无法退款");
}
}
this.saveOrUpdate(resources);
}
use of co.yixiang.modules.shop.domain.YxUser in project yshopmall by guchengwuyue.
the class YxUserServiceImpl method updateMoney.
@Override
@Transactional(rollbackFor = Exception.class)
public void updateMoney(UserMoneyDto param) {
YxUserDto userDTO = generator.convert(getById(param.getUid()), YxUserDto.class);
Double newMoney = 0d;
String mark = "";
String type = "system_add";
Integer pm = 1;
String title = "系统增加余额";
if (param.getPtype() == 1) {
mark = "系统增加了" + param.getMoney() + "余额";
newMoney = NumberUtil.add(userDTO.getNowMoney(), param.getMoney()).doubleValue();
} else {
title = "系统减少余额";
mark = "系统扣除了" + param.getMoney() + "余额";
type = "system_sub";
pm = 0;
newMoney = NumberUtil.sub(userDTO.getNowMoney(), param.getMoney()).doubleValue();
if (newMoney < 0) {
newMoney = 0d;
}
}
YxUser user = new YxUser();
user.setUid(userDTO.getUid());
user.setNowMoney(BigDecimal.valueOf(newMoney));
saveOrUpdate(user);
YxUserBill userBill = new YxUserBill();
userBill.setUid(userDTO.getUid());
userBill.setLinkId("0");
userBill.setPm(pm);
userBill.setTitle(title);
userBill.setCategory("now_money");
userBill.setType(type);
userBill.setNumber(BigDecimal.valueOf(param.getMoney()));
userBill.setBalance(BigDecimal.valueOf(newMoney));
userBill.setMark(mark);
userBill.setStatus(1);
yxUserBillService.save(userBill);
}
use of co.yixiang.modules.shop.domain.YxUser in project yshopmall by guchengwuyue.
the class StoreOrderController method getUserOpenid.
/**
* 获取openid
* @param uid uid
* @return String
*/
private String getUserOpenid(Long uid) {
YxUser yxUser = userService.getById(uid);
if (yxUser == null) {
return "";
}
WechatUserDto wechatUserDto = yxUser.getWxProfile();
if (wechatUserDto == null) {
return "";
}
if (StrUtil.isBlank(wechatUserDto.getOpenid())) {
return "";
}
return wechatUserDto.getOpenid();
}
use of co.yixiang.modules.shop.domain.YxUser in project yshopmall by guchengwuyue.
the class YxUserExtractServiceImpl method getUserOpenid.
/**
* 获取openid
* @param uid uid
* @return String
*/
private String getUserOpenid(Long uid) {
YxUser yxUser = yxUserService.getById(uid);
if (yxUser == null) {
return "";
}
WechatUserDto wechatUserDto = yxUser.getWxProfile();
if (wechatUserDto == null) {
return "";
}
if (StrUtil.isBlank(wechatUserDto.getOpenid())) {
return "";
}
return wechatUserDto.getOpenid();
}
Aggregations