yshop1.7.1,修复后台表单等问题题
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
package co.yixiang.modules.activity.rest;
|
package co.yixiang.modules.activity.rest;
|
||||||
|
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import co.yixiang.aop.log.Log;
|
import co.yixiang.aop.log.Log;
|
||||||
import co.yixiang.exception.BadRequestException;
|
import co.yixiang.exception.BadRequestException;
|
||||||
@ -11,7 +12,13 @@ import co.yixiang.modules.shop.domain.YxUserBill;
|
|||||||
import co.yixiang.modules.shop.service.YxUserBillService;
|
import co.yixiang.modules.shop.service.YxUserBillService;
|
||||||
import co.yixiang.modules.shop.service.YxUserService;
|
import co.yixiang.modules.shop.service.YxUserService;
|
||||||
import co.yixiang.modules.shop.service.dto.YxUserDTO;
|
import co.yixiang.modules.shop.service.dto.YxUserDTO;
|
||||||
|
import co.yixiang.modules.wechat.service.YxWechatUserService;
|
||||||
|
import co.yixiang.modules.wechat.service.dto.YxWechatUserDTO;
|
||||||
import co.yixiang.utils.OrderUtil;
|
import co.yixiang.utils.OrderUtil;
|
||||||
|
import co.yixiang.utils.RedisUtil;
|
||||||
|
import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
|
||||||
|
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||||
|
import com.github.binarywang.wxpay.service.WxPayService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -22,6 +29,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hupeng
|
* @author hupeng
|
||||||
* @date 2019-11-14
|
* @date 2019-11-14
|
||||||
@ -40,6 +49,12 @@ public class YxUserExtractController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private YxUserBillService yxUserBillService;
|
private YxUserBillService yxUserBillService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WxPayService wxPayService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private YxWechatUserService wechatUserService;
|
||||||
|
|
||||||
@Log("查询")
|
@Log("查询")
|
||||||
@ApiOperation(value = "查询")
|
@ApiOperation(value = "查询")
|
||||||
@GetMapping(value = "/yxUserExtract")
|
@GetMapping(value = "/yxUserExtract")
|
||||||
@ -89,6 +104,40 @@ public class YxUserExtractController {
|
|||||||
|
|
||||||
resources.setFailTime(OrderUtil.getSecondTimestampTwo());
|
resources.setFailTime(OrderUtil.getSecondTimestampTwo());
|
||||||
|
|
||||||
|
}
|
||||||
|
//todo 此处为企业付款,没经过测试
|
||||||
|
boolean isTest = true;
|
||||||
|
if(!isTest){
|
||||||
|
YxWechatUserDTO wechatUser = wechatUserService.findById(resources.getUid());
|
||||||
|
if(ObjectUtil.isNotNull(wechatUser)){
|
||||||
|
String apiUrl = RedisUtil.get("api_url");
|
||||||
|
if(StrUtil.isBlank(apiUrl)) throw new BadRequestException("请配置api地址");
|
||||||
|
//读取redis配置
|
||||||
|
String appId = RedisUtil.get("wxpay_appId");
|
||||||
|
String mchId = RedisUtil.get("wxpay_mchId");
|
||||||
|
if(StrUtil.isBlank(appId) || StrUtil.isBlank(mchId)){
|
||||||
|
throw new BadRequestException("请配置微信支付");
|
||||||
|
}
|
||||||
|
EntPayRequest entPayRequest = new EntPayRequest();
|
||||||
|
try {
|
||||||
|
entPayRequest.setAppid(appId);
|
||||||
|
entPayRequest.setMchId(mchId);
|
||||||
|
entPayRequest.setOpenid(wechatUser.getOpenid());
|
||||||
|
entPayRequest.setPartnerTradeNo(resources.getId().toString());
|
||||||
|
entPayRequest.setCheckName("FORCE_CHECK");
|
||||||
|
entPayRequest.setReUserName(resources.getRealName());
|
||||||
|
entPayRequest.setAmount(resources.getExtractPrice()
|
||||||
|
.multiply(new BigDecimal(100)).intValue());
|
||||||
|
entPayRequest.setDescription("佣金提现");
|
||||||
|
entPayRequest.setSpbillCreateIp("127.0.0.1");
|
||||||
|
wxPayService.getEntPayService().entPay(entPayRequest);
|
||||||
|
} catch (WxPayException e) {
|
||||||
|
throw new BadRequestException(e.getMessage());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
throw new BadRequestException("不是微信用户无法退款");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
yxUserExtractService.update(resources);
|
yxUserExtractService.update(resources);
|
||||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||||
|
@ -4,6 +4,7 @@ import lombok.Data;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -105,4 +106,8 @@ public class YxStoreBargainDTO implements Serializable {
|
|||||||
|
|
||||||
// 砍价产品分享量
|
// 砍价产品分享量
|
||||||
private Integer share;
|
private Integer share;
|
||||||
|
|
||||||
|
private Date startTimeDate;
|
||||||
|
|
||||||
|
private Date endTimeDate;
|
||||||
}
|
}
|
@ -1,6 +1,8 @@
|
|||||||
package co.yixiang.modules.shop.rest;
|
package co.yixiang.modules.shop.rest;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import co.yixiang.aop.log.Log;
|
import co.yixiang.aop.log.Log;
|
||||||
|
import co.yixiang.exception.BadRequestException;
|
||||||
import co.yixiang.modules.shop.domain.YxExpress;
|
import co.yixiang.modules.shop.domain.YxExpress;
|
||||||
import co.yixiang.modules.shop.service.YxExpressService;
|
import co.yixiang.modules.shop.service.YxExpressService;
|
||||||
import co.yixiang.modules.shop.service.dto.YxExpressQueryCriteria;
|
import co.yixiang.modules.shop.service.dto.YxExpressQueryCriteria;
|
||||||
|
@ -219,4 +219,35 @@ public class YxStoreOrderController {
|
|||||||
yxStoreOrderService.delete(id);
|
yxStoreOrderService.delete(id);
|
||||||
return new ResponseEntity(HttpStatus.OK);
|
return new ResponseEntity(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Log("修改订单")
|
||||||
|
@ApiOperation(value = "修改订单")
|
||||||
|
@PostMapping(value = "/yxStoreOrder/edit")
|
||||||
|
@PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
||||||
|
public ResponseEntity editOrder(@RequestBody YxStoreOrder resources){
|
||||||
|
if(ObjectUtil.isNull(resources.getPayPrice())) throw new BadRequestException("请输入支付金额");
|
||||||
|
if(resources.getPayPrice().doubleValue() < 0) throw new BadRequestException("金额不能低于0");
|
||||||
|
yxStoreOrderService.update(resources);
|
||||||
|
|
||||||
|
YxStoreOrderStatus storeOrderStatus = new YxStoreOrderStatus();
|
||||||
|
storeOrderStatus.setOid(resources.getId());
|
||||||
|
storeOrderStatus.setChangeType("order_edit");
|
||||||
|
storeOrderStatus.setChangeMessage("修改订单价格为:"+resources.getPayPrice());
|
||||||
|
storeOrderStatus.setChangeTime(OrderUtil.getSecondTimestampTwo());
|
||||||
|
|
||||||
|
yxStoreOrderStatusService.create(storeOrderStatus);
|
||||||
|
return new ResponseEntity(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log("修改订单备注")
|
||||||
|
@ApiOperation(value = "修改订单备注")
|
||||||
|
@PostMapping(value = "/yxStoreOrder/remark")
|
||||||
|
@PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
||||||
|
public ResponseEntity editOrderRemark(@RequestBody YxStoreOrder resources){
|
||||||
|
if(StrUtil.isBlank(resources.getRemark())) throw new BadRequestException("请输入备注");
|
||||||
|
yxStoreOrderService.update(resources);
|
||||||
|
return new ResponseEntity(HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user