|
|
@@ -21,7 +21,9 @@ import com.fs.common.utils.ip.IpUtils;
|
|
|
import com.fs.core.config.WxMaConfiguration;
|
|
|
import com.fs.erp.service.IErpOrderService;
|
|
|
import com.fs.his.domain.FsStoreOrderScrmComment;
|
|
|
+import com.fs.his.domain.FsUser;
|
|
|
import com.fs.his.service.IFsStoreOrderScrmCommentService;
|
|
|
+import com.fs.his.service.IFsUserService;
|
|
|
import com.fs.his.utils.ConfigUtil;
|
|
|
import com.fs.hisStore.config.FsErpConfig;
|
|
|
import com.fs.hisStore.domain.*;
|
|
|
@@ -111,6 +113,8 @@ public class StoreOrderScrmController extends AppBaseController {
|
|
|
@Autowired
|
|
|
private IFsStoreAfterSalesScrmService afterSalesService;
|
|
|
@Autowired
|
|
|
+ private IFsUserService userService;
|
|
|
+ @Autowired
|
|
|
private IFsStoreProductPackageScrmService productPackageService;
|
|
|
@Autowired
|
|
|
private RedissonClient redissonClient;
|
|
|
@@ -390,7 +394,7 @@ public class StoreOrderScrmController extends AppBaseController {
|
|
|
if (order.getStatus() != OrderInfoEnum.STATUS_0.getValue()) {
|
|
|
return R.error("订单状态不正确");
|
|
|
}
|
|
|
- FsUserScrm user = userService.selectFsUserById(order.getUserId());
|
|
|
+ FsUser user = userService.selectFsUserById(order.getUserId());
|
|
|
if (user != null && StringUtils.isNotEmpty(user.getMaOpenId())) {
|
|
|
//已改价处理
|
|
|
if (order.getIsEditMoney() != null && order.getIsEditMoney() == 1) {
|
|
|
@@ -502,7 +506,7 @@ public class StoreOrderScrmController extends AppBaseController {
|
|
|
BigDecimal payPrice = BigDecimal.ZERO;
|
|
|
BigDecimal payMoneyTotal = BigDecimal.ZERO;
|
|
|
|
|
|
- FsUserScrm fsUser = new FsUserScrm();
|
|
|
+ FsUser fsUser = new FsUser();
|
|
|
|
|
|
String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
List<FsStoreOrderScrm> orders = orderService.getStoreOrderByCombinationId(param.getCombinationOrderId());
|
|
|
@@ -521,7 +525,7 @@ public class StoreOrderScrmController extends AppBaseController {
|
|
|
if (order.getStatus() != OrderInfoEnum.STATUS_0.getValue()) {
|
|
|
return R.error("订单状态不正确");
|
|
|
}
|
|
|
- FsUserScrm user = userService.selectFsUserById(order.getUserId());
|
|
|
+ FsUser user = userService.selectFsUserById(order.getUserId());
|
|
|
|
|
|
fsUser = user;
|
|
|
|
|
|
@@ -735,7 +739,7 @@ public class StoreOrderScrmController extends AppBaseController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- FsUserScrm user=userService.selectFsUserById(order.getUserId());
|
|
|
+ FsUser user=userService.selectFsUserById(order.getUserId());
|
|
|
if(user!=null&& StringUtils.isNotEmpty(user.getMaOpenId())){
|
|
|
//已改价处理
|
|
|
if(order.getIsEditMoney()!=null&&order.getIsEditMoney()==1){
|
|
|
@@ -804,7 +808,7 @@ public class StoreOrderScrmController extends AppBaseController {
|
|
|
if(!order.getIsPayRemain().equals(0)){
|
|
|
return R.error("此订单已支付");
|
|
|
}
|
|
|
- FsUserScrm user=userService.selectFsUserById(order.getUserId());
|
|
|
+ FsUser user=userService.selectFsUserById(order.getUserId());
|
|
|
if(user!=null&& StringUtils.isNotEmpty(user.getMaOpenId())){
|
|
|
String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
String json = configService.selectConfigByKey(STORE_PAY_CONF);
|
|
|
@@ -886,243 +890,243 @@ public class StoreOrderScrmController extends AppBaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @Login
|
|
|
- @ApiOperation("亲友支付")
|
|
|
- @PostMapping("/otherPayment")
|
|
|
- @Transactional
|
|
|
- public R otherPayment(@Validated @RequestBody FsStoreOrderOtherPayParam param, HttpServletRequest request){
|
|
|
- final WxMaService wxService = WxMaConfiguration.getMaService(properties.getConfigs().get(0).getAppid());
|
|
|
- try {
|
|
|
- String ip = IpUtil.getRequestIp();
|
|
|
- WxMaJscode2SessionResult session = wxService.getUserService().getSessionInfo(param.getCode());
|
|
|
- FsUserScrm user=userService.selectFsUserByMaOpenId(session.getOpenid());
|
|
|
- if(user==null){
|
|
|
- //创建
|
|
|
- user=new FsUserScrm();
|
|
|
- user.setUsername("");
|
|
|
- user.setNickname("微信用户");
|
|
|
- user.setStatus(1);
|
|
|
- user.setMaOpenId(session.getOpenid());
|
|
|
- user.setUnionId(session.getUnionid());
|
|
|
- user.setIsWeixinAuth(0);
|
|
|
- user.setLastIp(ip);
|
|
|
- user.setCreateTime(new Date());
|
|
|
- userService.insertFsUser(user);
|
|
|
- }
|
|
|
- FsStoreOrderScrm order=orderService.selectFsStoreOrderById(param.getOrderId());
|
|
|
- if(order==null){
|
|
|
- return R.error("订单不存在");
|
|
|
- }
|
|
|
- if(order.getStatus()!= OrderInfoEnum.STATUS_0.getValue()){
|
|
|
- return R.error("此订单不能支付");
|
|
|
- }
|
|
|
- if(order.getPayMoney().compareTo(new BigDecimal(0))<1){
|
|
|
- return R.error("此订单没有可支付的金额");
|
|
|
- }
|
|
|
-
|
|
|
- String orderId=redisCache.getCacheObject("isPaying:"+order.getId());
|
|
|
- if(StringUtils.isNotEmpty(orderId)&&orderId.equals(order.getId().toString())){
|
|
|
- return R.error("正在支付中...");
|
|
|
- }
|
|
|
-
|
|
|
- String json = configService.selectConfigByKey(STORE_PAY_CONF);
|
|
|
- FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
|
|
|
- String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
- //易宝支付
|
|
|
- FsStorePaymentScrm storePayment=new FsStorePaymentScrm();
|
|
|
- storePayment.setCompanyId(order.getCompanyId());
|
|
|
- storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
|
- storePayment.setStatus(0);
|
|
|
- storePayment.setPayCode(payCode);
|
|
|
- storePayment.setPayMode(fsPayConfig.getType());
|
|
|
- storePayment.setPayMoney(order.getPayMoney());
|
|
|
- storePayment.setCreateTime(new Date());
|
|
|
- storePayment.setPayTypeCode("weixin");
|
|
|
- storePayment.setBusinessType(2);
|
|
|
- storePayment.setRemark("商城订单支付");
|
|
|
- storePayment.setOpenId(session.getOpenid());
|
|
|
- storePayment.setUserId(user.getUserId());
|
|
|
- storePayment.setBusinessOrderId(order.getId().toString());
|
|
|
- storePayment.setOrderId(order.getId());
|
|
|
- fsStorePaymentMapper.insertFsStorePayment(storePayment);
|
|
|
-
|
|
|
- if (fsPayConfig.getType().equals("hf")){
|
|
|
- HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
|
- o.setTradeType("T_MINIAPP");
|
|
|
- o.setOpenid(user.getMaOpenId());
|
|
|
- o.setReqSeqId("store-"+storePayment.getPayCode());
|
|
|
- o.setTransAmt(storePayment.getPayMoney().toString());
|
|
|
- o.setGoodsDesc("商城订单支付");
|
|
|
- HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
|
- if(result.getResp_code()!=null&&(result.getResp_code().equals("00000000")||result.getResp_code().equals("00000100"))){
|
|
|
-
|
|
|
- FsStorePaymentScrm mt=new FsStorePaymentScrm();
|
|
|
- mt.setPaymentId(storePayment.getPaymentId());
|
|
|
- mt.setTradeNo(result.getHf_seq_id());
|
|
|
- fsStorePaymentMapper.updateFsStorePayment(mt);
|
|
|
- redisCache.setCacheObject("isPaying:"+order.getId(),order.getId().toString(),1, TimeUnit.MINUTES);
|
|
|
- Map<String, Object> resultMap = JSON.parseObject(result.getPay_info(), new TypeReference<Map<String, Object>>() {});
|
|
|
- String s = (String) resultMap.get("package");
|
|
|
- resultMap.put("packageValue",s);
|
|
|
- return R.ok().put("result",resultMap);
|
|
|
- }
|
|
|
- else{
|
|
|
- return R.error(result.getResp_desc());
|
|
|
- }
|
|
|
- }else if (fsPayConfig.getType().equals("wx")){
|
|
|
- //创建微信订单
|
|
|
- WxPayConfig payConfig = new WxPayConfig();
|
|
|
- payConfig.setAppId(fsPayConfig.getAppId());
|
|
|
- payConfig.setMchId(fsPayConfig.getWxMchId());
|
|
|
- payConfig.setMchKey(fsPayConfig.getWxMchKey());
|
|
|
- payConfig.setSubAppId(org.apache.commons.lang3.StringUtils.trimToNull(null));
|
|
|
- payConfig.setSubMchId(org.apache.commons.lang3.StringUtils.trimToNull(null));
|
|
|
- payConfig.setKeyPath(null);
|
|
|
- payConfig.setNotifyUrl(fsPayConfig.getNotifyUrlScrm());
|
|
|
- wxPayService.setConfig(payConfig);
|
|
|
- WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
|
|
|
- orderRequest.setOpenid(user.getMaOpenId());//公众号支付提供用户openid
|
|
|
- orderRequest.setBody("商城订单支付");
|
|
|
- orderRequest.setOutTradeNo("store-" + storePayment.getPayCode());
|
|
|
- orderRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(storePayment.getPayMoney().toString()));//测试
|
|
|
- //orderRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(money));//测试
|
|
|
- orderRequest.setTradeType("JSAPI");
|
|
|
- orderRequest.setSpbillCreateIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
|
|
- //调用统一下单接口,获取"预支付交易会话标识"
|
|
|
- try {
|
|
|
- WxPayMpOrderResult orderResult = wxPayService.createOrder(orderRequest);
|
|
|
- return R.ok().put("result", orderResult).put("type", "wx").put("isPay", 0);
|
|
|
- } catch (WxPayException e) {
|
|
|
- e.printStackTrace();
|
|
|
- throw new CustomException("支付失败" + e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (WxErrorException e) {
|
|
|
- e.printStackTrace();
|
|
|
- return R.error(e.getMessage());
|
|
|
- }
|
|
|
- return R.error("无支付类型");
|
|
|
- }
|
|
|
-
|
|
|
- @Login
|
|
|
- @ApiOperation("亲友支付")
|
|
|
- @PostMapping("/otherPaymentRemain")
|
|
|
- @Transactional
|
|
|
- public R otherPaymentRemain(@Validated @RequestBody FsStoreOrderOtherPayParam param, HttpServletRequest request){
|
|
|
- final WxMaService wxService = WxMaConfiguration.getMaService(properties.getConfigs().get(0).getAppid());
|
|
|
- try {
|
|
|
- String ip = IpUtil.getRequestIp();
|
|
|
- WxMaJscode2SessionResult session = wxService.getUserService().getSessionInfo(param.getCode());
|
|
|
- FsUserScrm user=userService.selectFsUserByMaOpenId(session.getOpenid());
|
|
|
- if(user==null){
|
|
|
- //创建
|
|
|
- user=new FsUserScrm();
|
|
|
- user.setUsername("");
|
|
|
- user.setNickname("微信用户");
|
|
|
- user.setStatus(1);
|
|
|
- user.setMaOpenId(session.getOpenid());
|
|
|
- user.setUnionId(session.getUnionid());
|
|
|
- user.setIsWeixinAuth(0);
|
|
|
- user.setLastIp(ip);
|
|
|
- user.setCreateTime(new Date());
|
|
|
- userService.insertFsUser(user);
|
|
|
- }
|
|
|
- FsStoreOrderScrm order=orderService.selectFsStoreOrderById(param.getOrderId());
|
|
|
- if(order==null){
|
|
|
- return R.error("订单不存在");
|
|
|
- }
|
|
|
- if(order.getStatus()!= OrderInfoEnum.STATUS_2.getValue()){
|
|
|
- return R.error("待收货订单可申请支付尾款");
|
|
|
- }
|
|
|
- if(order.getPayType().equals(1)){
|
|
|
- return R.error("此订单已支付");
|
|
|
- }
|
|
|
- //只有顺风才可以付尾
|
|
|
- if(!order.getDeliverySn().trim().equals("SF")){
|
|
|
- return R.error("只有顺丰物流支持尾款支付");
|
|
|
- }
|
|
|
-
|
|
|
- if(!order.getIsPayRemain().equals(0)){
|
|
|
- return R.error("此订单已支付");
|
|
|
- }
|
|
|
- String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
- String json = configService.selectConfigByKey(STORE_PAY_CONF);
|
|
|
- FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
|
|
|
- FsStorePaymentScrm storePayment=new FsStorePaymentScrm();
|
|
|
- storePayment.setCompanyId(order.getCompanyId());
|
|
|
- storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
|
- storePayment.setStatus(0);
|
|
|
- storePayment.setPayMode(fsPayConfig.getType());
|
|
|
- storePayment.setPayCode(payCode);
|
|
|
- storePayment.setPayMoney(order.getPayDelivery());
|
|
|
- storePayment.setCreateTime(new Date());
|
|
|
- storePayment.setPayTypeCode("weixin");
|
|
|
- storePayment.setBusinessType(2);
|
|
|
- storePayment.setRemark("商城订单尾款支付");
|
|
|
- storePayment.setOpenId(user.getRealName());
|
|
|
- storePayment.setUserId(user.getUserId());
|
|
|
- storePayment.setBusinessOrderId(order.getId().toString());
|
|
|
- storePayment.setOrderId(order.getId());
|
|
|
- storePayment.setIsPayRemain(1);
|
|
|
- fsStorePaymentMapper.insertFsStorePayment(storePayment);
|
|
|
-
|
|
|
- if (fsPayConfig.getType().equals("hf")){
|
|
|
- HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
|
- o.setTradeType("T_MINIAPP");
|
|
|
- o.setOpenid(user.getMaOpenId());
|
|
|
- o.setReqSeqId("store-"+storePayment.getPayCode());
|
|
|
- o.setTransAmt(storePayment.getPayMoney().toString());
|
|
|
- o.setGoodsDesc("商城订单支付");
|
|
|
- HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
|
- if(result.getResp_code()!=null&&(result.getResp_code().equals("00000000")||result.getResp_code().equals("00000100"))){
|
|
|
-
|
|
|
- FsStorePaymentScrm mt=new FsStorePaymentScrm();
|
|
|
- mt.setPaymentId(storePayment.getPaymentId());
|
|
|
- mt.setTradeNo(result.getHf_seq_id());
|
|
|
- fsStorePaymentMapper.updateFsStorePayment(mt);
|
|
|
- redisCache.setCacheObject("isPaying:"+order.getId(),order.getId().toString(),1, TimeUnit.MINUTES);
|
|
|
- Map<String, Object> resultMap = JSON.parseObject(result.getPay_info(), new TypeReference<Map<String, Object>>() {});
|
|
|
- String s = (String) resultMap.get("package");
|
|
|
- resultMap.put("packageValue",s);
|
|
|
- return R.ok().put("result",resultMap);
|
|
|
- }
|
|
|
- else{
|
|
|
- return R.error(result.getResp_desc());
|
|
|
- }
|
|
|
- }else if (fsPayConfig.getType().equals("wx")){
|
|
|
- //创建微信订单
|
|
|
- WxPayConfig payConfig = new WxPayConfig();
|
|
|
- payConfig.setAppId(fsPayConfig.getAppId());
|
|
|
- payConfig.setMchId(fsPayConfig.getWxMchId());
|
|
|
- payConfig.setMchKey(fsPayConfig.getWxMchKey());
|
|
|
- payConfig.setSubAppId(org.apache.commons.lang3.StringUtils.trimToNull(null));
|
|
|
- payConfig.setSubMchId(org.apache.commons.lang3.StringUtils.trimToNull(null));
|
|
|
- payConfig.setKeyPath(null);
|
|
|
- payConfig.setNotifyUrl(fsPayConfig.getNotifyUrlScrm());
|
|
|
- wxPayService.setConfig(payConfig);
|
|
|
- WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
|
|
|
- orderRequest.setOpenid(user.getMaOpenId());//公众号支付提供用户openid
|
|
|
- orderRequest.setBody("商城订单支付");
|
|
|
- orderRequest.setOutTradeNo("store-" + storePayment.getPayCode());
|
|
|
- orderRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(storePayment.getPayMoney().toString()));//测试
|
|
|
- //orderRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(money));//测试
|
|
|
- orderRequest.setTradeType("JSAPI");
|
|
|
- orderRequest.setSpbillCreateIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
|
|
- //调用统一下单接口,获取"预支付交易会话标识"
|
|
|
- try {
|
|
|
- WxPayMpOrderResult orderResult = wxPayService.createOrder(orderRequest);
|
|
|
- return R.ok().put("result", orderResult).put("type", "wx").put("isPay", 0);
|
|
|
- } catch (WxPayException e) {
|
|
|
- e.printStackTrace();
|
|
|
- throw new CustomException("支付失败" + e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (WxErrorException e) {
|
|
|
- e.printStackTrace();
|
|
|
- return R.error(e.getMessage());
|
|
|
- }
|
|
|
- return R.error("无支付类型");
|
|
|
- }
|
|
|
+// @Login
|
|
|
+// @ApiOperation("亲友支付")
|
|
|
+// @PostMapping("/otherPayment")
|
|
|
+// @Transactional
|
|
|
+// public R otherPayment(@Validated @RequestBody FsStoreOrderOtherPayParam param, HttpServletRequest request){
|
|
|
+// final WxMaService wxService = WxMaConfiguration.getMaService(properties.getConfigs().get(0).getAppid());
|
|
|
+// try {
|
|
|
+// String ip = IpUtil.getRequestIp();
|
|
|
+// WxMaJscode2SessionResult session = wxService.getUserService().getSessionInfo(param.getCode());
|
|
|
+// FsUserScrm user=userService.selectFsUserByMaOpenId(session.getOpenid());
|
|
|
+// if(user==null){
|
|
|
+// //创建
|
|
|
+// user=new FsUserScrm();
|
|
|
+// user.setUsername("");
|
|
|
+// user.setNickname("微信用户");
|
|
|
+// user.setStatus(1);
|
|
|
+// user.setMaOpenId(session.getOpenid());
|
|
|
+// user.setUnionId(session.getUnionid());
|
|
|
+// user.setIsWeixinAuth(0);
|
|
|
+// user.setLastIp(ip);
|
|
|
+// user.setCreateTime(new Date());
|
|
|
+// userService.insertFsUser(user);
|
|
|
+// }
|
|
|
+// FsStoreOrderScrm order=orderService.selectFsStoreOrderById(param.getOrderId());
|
|
|
+// if(order==null){
|
|
|
+// return R.error("订单不存在");
|
|
|
+// }
|
|
|
+// if(order.getStatus()!= OrderInfoEnum.STATUS_0.getValue()){
|
|
|
+// return R.error("此订单不能支付");
|
|
|
+// }
|
|
|
+// if(order.getPayMoney().compareTo(new BigDecimal(0))<1){
|
|
|
+// return R.error("此订单没有可支付的金额");
|
|
|
+// }
|
|
|
+//
|
|
|
+// String orderId=redisCache.getCacheObject("isPaying:"+order.getId());
|
|
|
+// if(StringUtils.isNotEmpty(orderId)&&orderId.equals(order.getId().toString())){
|
|
|
+// return R.error("正在支付中...");
|
|
|
+// }
|
|
|
+//
|
|
|
+// String json = configService.selectConfigByKey(STORE_PAY_CONF);
|
|
|
+// FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
|
|
|
+// String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
+// //易宝支付
|
|
|
+// FsStorePaymentScrm storePayment=new FsStorePaymentScrm();
|
|
|
+// storePayment.setCompanyId(order.getCompanyId());
|
|
|
+// storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
|
+// storePayment.setStatus(0);
|
|
|
+// storePayment.setPayCode(payCode);
|
|
|
+// storePayment.setPayMode(fsPayConfig.getType());
|
|
|
+// storePayment.setPayMoney(order.getPayMoney());
|
|
|
+// storePayment.setCreateTime(new Date());
|
|
|
+// storePayment.setPayTypeCode("weixin");
|
|
|
+// storePayment.setBusinessType(2);
|
|
|
+// storePayment.setRemark("商城订单支付");
|
|
|
+// storePayment.setOpenId(session.getOpenid());
|
|
|
+// storePayment.setUserId(user.getUserId());
|
|
|
+// storePayment.setBusinessOrderId(order.getId().toString());
|
|
|
+// storePayment.setOrderId(order.getId());
|
|
|
+// fsStorePaymentMapper.insertFsStorePayment(storePayment);
|
|
|
+//
|
|
|
+// if (fsPayConfig.getType().equals("hf")){
|
|
|
+// HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
|
+// o.setTradeType("T_MINIAPP");
|
|
|
+// o.setOpenid(user.getMaOpenId());
|
|
|
+// o.setReqSeqId("store-"+storePayment.getPayCode());
|
|
|
+// o.setTransAmt(storePayment.getPayMoney().toString());
|
|
|
+// o.setGoodsDesc("商城订单支付");
|
|
|
+// HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
|
+// if(result.getResp_code()!=null&&(result.getResp_code().equals("00000000")||result.getResp_code().equals("00000100"))){
|
|
|
+//
|
|
|
+// FsStorePaymentScrm mt=new FsStorePaymentScrm();
|
|
|
+// mt.setPaymentId(storePayment.getPaymentId());
|
|
|
+// mt.setTradeNo(result.getHf_seq_id());
|
|
|
+// fsStorePaymentMapper.updateFsStorePayment(mt);
|
|
|
+// redisCache.setCacheObject("isPaying:"+order.getId(),order.getId().toString(),1, TimeUnit.MINUTES);
|
|
|
+// Map<String, Object> resultMap = JSON.parseObject(result.getPay_info(), new TypeReference<Map<String, Object>>() {});
|
|
|
+// String s = (String) resultMap.get("package");
|
|
|
+// resultMap.put("packageValue",s);
|
|
|
+// return R.ok().put("result",resultMap);
|
|
|
+// }
|
|
|
+// else{
|
|
|
+// return R.error(result.getResp_desc());
|
|
|
+// }
|
|
|
+// }else if (fsPayConfig.getType().equals("wx")){
|
|
|
+// //创建微信订单
|
|
|
+// WxPayConfig payConfig = new WxPayConfig();
|
|
|
+// payConfig.setAppId(fsPayConfig.getAppId());
|
|
|
+// payConfig.setMchId(fsPayConfig.getWxMchId());
|
|
|
+// payConfig.setMchKey(fsPayConfig.getWxMchKey());
|
|
|
+// payConfig.setSubAppId(org.apache.commons.lang3.StringUtils.trimToNull(null));
|
|
|
+// payConfig.setSubMchId(org.apache.commons.lang3.StringUtils.trimToNull(null));
|
|
|
+// payConfig.setKeyPath(null);
|
|
|
+// payConfig.setNotifyUrl(fsPayConfig.getNotifyUrlScrm());
|
|
|
+// wxPayService.setConfig(payConfig);
|
|
|
+// WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
|
|
|
+// orderRequest.setOpenid(user.getMaOpenId());//公众号支付提供用户openid
|
|
|
+// orderRequest.setBody("商城订单支付");
|
|
|
+// orderRequest.setOutTradeNo("store-" + storePayment.getPayCode());
|
|
|
+// orderRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(storePayment.getPayMoney().toString()));//测试
|
|
|
+// //orderRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(money));//测试
|
|
|
+// orderRequest.setTradeType("JSAPI");
|
|
|
+// orderRequest.setSpbillCreateIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
|
|
+// //调用统一下单接口,获取"预支付交易会话标识"
|
|
|
+// try {
|
|
|
+// WxPayMpOrderResult orderResult = wxPayService.createOrder(orderRequest);
|
|
|
+// return R.ok().put("result", orderResult).put("type", "wx").put("isPay", 0);
|
|
|
+// } catch (WxPayException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// throw new CustomException("支付失败" + e.getMessage());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } catch (WxErrorException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// return R.error(e.getMessage());
|
|
|
+// }
|
|
|
+// return R.error("无支付类型");
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Login
|
|
|
+// @ApiOperation("亲友支付")
|
|
|
+// @PostMapping("/otherPaymentRemain")
|
|
|
+// @Transactional
|
|
|
+// public R otherPaymentRemain(@Validated @RequestBody FsStoreOrderOtherPayParam param, HttpServletRequest request){
|
|
|
+// final WxMaService wxService = WxMaConfiguration.getMaService(properties.getConfigs().get(0).getAppid());
|
|
|
+// try {
|
|
|
+// String ip = IpUtil.getRequestIp();
|
|
|
+// WxMaJscode2SessionResult session = wxService.getUserService().getSessionInfo(param.getCode());
|
|
|
+// FsUserScrm user=userService.selectFsUserByMaOpenId(session.getOpenid());
|
|
|
+// if(user==null){
|
|
|
+// //创建
|
|
|
+// user=new FsUserScrm();
|
|
|
+// user.setUsername("");
|
|
|
+// user.setNickname("微信用户");
|
|
|
+// user.setStatus(1);
|
|
|
+// user.setMaOpenId(session.getOpenid());
|
|
|
+// user.setUnionId(session.getUnionid());
|
|
|
+// user.setIsWeixinAuth(0);
|
|
|
+// user.setLastIp(ip);
|
|
|
+// user.setCreateTime(new Date());
|
|
|
+// userService.insertFsUser(user);
|
|
|
+// }
|
|
|
+// FsStoreOrderScrm order=orderService.selectFsStoreOrderById(param.getOrderId());
|
|
|
+// if(order==null){
|
|
|
+// return R.error("订单不存在");
|
|
|
+// }
|
|
|
+// if(order.getStatus()!= OrderInfoEnum.STATUS_2.getValue()){
|
|
|
+// return R.error("待收货订单可申请支付尾款");
|
|
|
+// }
|
|
|
+// if(order.getPayType().equals(1)){
|
|
|
+// return R.error("此订单已支付");
|
|
|
+// }
|
|
|
+// //只有顺风才可以付尾
|
|
|
+// if(!order.getDeliverySn().trim().equals("SF")){
|
|
|
+// return R.error("只有顺丰物流支持尾款支付");
|
|
|
+// }
|
|
|
+//
|
|
|
+// if(!order.getIsPayRemain().equals(0)){
|
|
|
+// return R.error("此订单已支付");
|
|
|
+// }
|
|
|
+// String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
+// String json = configService.selectConfigByKey(STORE_PAY_CONF);
|
|
|
+// FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
|
|
|
+// FsStorePaymentScrm storePayment=new FsStorePaymentScrm();
|
|
|
+// storePayment.setCompanyId(order.getCompanyId());
|
|
|
+// storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
|
+// storePayment.setStatus(0);
|
|
|
+// storePayment.setPayMode(fsPayConfig.getType());
|
|
|
+// storePayment.setPayCode(payCode);
|
|
|
+// storePayment.setPayMoney(order.getPayDelivery());
|
|
|
+// storePayment.setCreateTime(new Date());
|
|
|
+// storePayment.setPayTypeCode("weixin");
|
|
|
+// storePayment.setBusinessType(2);
|
|
|
+// storePayment.setRemark("商城订单尾款支付");
|
|
|
+// storePayment.setOpenId(user.getRealName());
|
|
|
+// storePayment.setUserId(user.getUserId());
|
|
|
+// storePayment.setBusinessOrderId(order.getId().toString());
|
|
|
+// storePayment.setOrderId(order.getId());
|
|
|
+// storePayment.setIsPayRemain(1);
|
|
|
+// fsStorePaymentMapper.insertFsStorePayment(storePayment);
|
|
|
+//
|
|
|
+// if (fsPayConfig.getType().equals("hf")){
|
|
|
+// HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
|
+// o.setTradeType("T_MINIAPP");
|
|
|
+// o.setOpenid(user.getMaOpenId());
|
|
|
+// o.setReqSeqId("store-"+storePayment.getPayCode());
|
|
|
+// o.setTransAmt(storePayment.getPayMoney().toString());
|
|
|
+// o.setGoodsDesc("商城订单支付");
|
|
|
+// HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
|
+// if(result.getResp_code()!=null&&(result.getResp_code().equals("00000000")||result.getResp_code().equals("00000100"))){
|
|
|
+//
|
|
|
+// FsStorePaymentScrm mt=new FsStorePaymentScrm();
|
|
|
+// mt.setPaymentId(storePayment.getPaymentId());
|
|
|
+// mt.setTradeNo(result.getHf_seq_id());
|
|
|
+// fsStorePaymentMapper.updateFsStorePayment(mt);
|
|
|
+// redisCache.setCacheObject("isPaying:"+order.getId(),order.getId().toString(),1, TimeUnit.MINUTES);
|
|
|
+// Map<String, Object> resultMap = JSON.parseObject(result.getPay_info(), new TypeReference<Map<String, Object>>() {});
|
|
|
+// String s = (String) resultMap.get("package");
|
|
|
+// resultMap.put("packageValue",s);
|
|
|
+// return R.ok().put("result",resultMap);
|
|
|
+// }
|
|
|
+// else{
|
|
|
+// return R.error(result.getResp_desc());
|
|
|
+// }
|
|
|
+// }else if (fsPayConfig.getType().equals("wx")){
|
|
|
+// //创建微信订单
|
|
|
+// WxPayConfig payConfig = new WxPayConfig();
|
|
|
+// payConfig.setAppId(fsPayConfig.getAppId());
|
|
|
+// payConfig.setMchId(fsPayConfig.getWxMchId());
|
|
|
+// payConfig.setMchKey(fsPayConfig.getWxMchKey());
|
|
|
+// payConfig.setSubAppId(org.apache.commons.lang3.StringUtils.trimToNull(null));
|
|
|
+// payConfig.setSubMchId(org.apache.commons.lang3.StringUtils.trimToNull(null));
|
|
|
+// payConfig.setKeyPath(null);
|
|
|
+// payConfig.setNotifyUrl(fsPayConfig.getNotifyUrlScrm());
|
|
|
+// wxPayService.setConfig(payConfig);
|
|
|
+// WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
|
|
|
+// orderRequest.setOpenid(user.getMaOpenId());//公众号支付提供用户openid
|
|
|
+// orderRequest.setBody("商城订单支付");
|
|
|
+// orderRequest.setOutTradeNo("store-" + storePayment.getPayCode());
|
|
|
+// orderRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(storePayment.getPayMoney().toString()));//测试
|
|
|
+// //orderRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(money));//测试
|
|
|
+// orderRequest.setTradeType("JSAPI");
|
|
|
+// orderRequest.setSpbillCreateIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
|
|
+// //调用统一下单接口,获取"预支付交易会话标识"
|
|
|
+// try {
|
|
|
+// WxPayMpOrderResult orderResult = wxPayService.createOrder(orderRequest);
|
|
|
+// return R.ok().put("result", orderResult).put("type", "wx").put("isPay", 0);
|
|
|
+// } catch (WxPayException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// throw new CustomException("支付失败" + e.getMessage());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } catch (WxErrorException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// return R.error(e.getMessage());
|
|
|
+// }
|
|
|
+// return R.error("无支付类型");
|
|
|
+// }
|
|
|
|
|
|
|
|
|
@Login
|
|
|
@@ -1305,7 +1309,7 @@ public class StoreOrderScrmController extends AppBaseController {
|
|
|
if (orders.get(i).getStatus() != OrderInfoEnum.STATUS_0.getValue()) {
|
|
|
return R.error("订单状态不正确");
|
|
|
}
|
|
|
- FsUserScrm user = userService.selectFsUserById(orders.get(i).getUserId());
|
|
|
+ FsUser user = userService.selectFsUserById(orders.get(i).getUserId());
|
|
|
if (user != null && StringUtils.isNotEmpty(user.getMaOpenId())) {
|
|
|
//已改价处理
|
|
|
if (orders.get(i).getIsEditMoney() != null && orders.get(i).getIsEditMoney() == 1) {
|
|
|
@@ -1360,148 +1364,148 @@ public class StoreOrderScrmController extends AppBaseController {
|
|
|
return R.ok().put("order", orderRes).put("prescribeOrder",prescribeOrder);
|
|
|
}
|
|
|
|
|
|
- @Login
|
|
|
- @ApiOperation("亲友支付")
|
|
|
- @PostMapping("/otherPaymentByCombinationId")
|
|
|
- @Transactional
|
|
|
- public R otherPaymentByCombinationId(@Validated @RequestBody FsStoreOrderOtherPayCombinationIdParam param, HttpServletRequest request) {
|
|
|
- final WxMaService wxService = WxMaConfiguration.getMaService(param.getAppId());
|
|
|
- try {
|
|
|
- //组合微信支付order
|
|
|
- FsStoreOrderScrm fsStoreOrder = new FsStoreOrderScrm();
|
|
|
- BigDecimal payPrice = BigDecimal.ZERO;
|
|
|
- BigDecimal payMoneyTotal = BigDecimal.ZERO;
|
|
|
-
|
|
|
- String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
- //新增的支付详情id
|
|
|
- ArrayList<Long> paymentIds = new ArrayList<>();
|
|
|
- String ip = IpUtil.getRequestIp();
|
|
|
- WxMaJscode2SessionResult session = wxService.getUserService().getSessionInfo(param.getCode());
|
|
|
- FsUserScrm user = userService.selectFsUserByMaOpenId(session.getOpenid());
|
|
|
- if (user == null) {
|
|
|
- //创建
|
|
|
- user = new FsUserScrm();
|
|
|
- user.setUsername("");
|
|
|
- user.setNickname("微信用户");
|
|
|
- user.setStatus(1);
|
|
|
- user.setMaOpenId(session.getOpenid());
|
|
|
- user.setUnionId(session.getUnionid());
|
|
|
- user.setIsWeixinAuth(0);
|
|
|
- user.setLastIp(ip);
|
|
|
- user.setCreateTime(new Date());
|
|
|
- userService.insertFsUser(user);
|
|
|
- }
|
|
|
-// FsStoreOrder order = orderService.selectFsStoreOrderById(param.getOrderId());
|
|
|
- List<FsStoreOrderScrm> orders = orderService.getStoreOrderByCombinationId(param.getCombinationOrderId());
|
|
|
- for (FsStoreOrderScrm order : orders) {
|
|
|
- if (order == null) {
|
|
|
- return R.error("订单不存在");
|
|
|
- }
|
|
|
- if (order.getStatus() != OrderInfoEnum.STATUS_0.getValue()) {
|
|
|
- return R.error("此订单不能支付");
|
|
|
- }
|
|
|
- if (order.getPayMoney().compareTo(new BigDecimal(0)) < 1) {
|
|
|
- return R.error("此订单没有可支付的金额");
|
|
|
- }
|
|
|
- payPrice = NumberUtil.add(payPrice, order.getPayPrice());
|
|
|
- payMoneyTotal = NumberUtil.add(payMoneyTotal, order.getPayMoney());
|
|
|
- String paySubCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
- //小雨点支付
|
|
|
- FsStorePaymentScrm storePayment = new FsStorePaymentScrm();
|
|
|
- storePayment.setCompanyId(order.getCompanyId());
|
|
|
- storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
|
- storePayment.setStatus(0);
|
|
|
- storePayment.setPayCode(payCode);
|
|
|
- storePayment.setPaySubCode(paySubCode);
|
|
|
- storePayment.setPayMoney(order.getPayMoney());
|
|
|
- storePayment.setCreateTime(new Date());
|
|
|
- storePayment.setPayTypeCode("weixin");
|
|
|
- storePayment.setBusinessType(2);
|
|
|
- storePayment.setRemark("商城订单支付");
|
|
|
- storePayment.setOpenId(session.getOpenid());
|
|
|
- storePayment.setUserId(user.getUserId());
|
|
|
- storePayment.setBusinessOrderId(order.getCombinationOrderId().toString());
|
|
|
- storePayment.setOrderId(order.getId());
|
|
|
- fsStorePaymentMapper.insertFsStorePayment(storePayment);
|
|
|
- paymentIds.add(storePayment.getPaymentId());
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- //创建订单
|
|
|
- fsStoreOrder.setPayType(orders.get(0).getPayType());
|
|
|
- fsStoreOrder.setCompanyId(orders.get(0).getCompanyId());
|
|
|
- fsStoreOrder.setCompanyUserId(orders.get(0).getCompanyUserId());
|
|
|
- fsStoreOrder.setPayMoney(payMoneyTotal);
|
|
|
-// fsStoreOrder.setPayMoney(BigDecimal.valueOf(0.01));
|
|
|
- fsStoreOrder.setRealName(orders.get(0).getRealName());
|
|
|
- fsStoreOrder.setCombinationOrderId(orders.get(0).getCombinationOrderId());
|
|
|
-
|
|
|
- FsStorePaymentScrm payment = new FsStorePaymentScrm();
|
|
|
- payment.setCompanyId(fsStoreOrder.getCompanyId());
|
|
|
- payment.setCompanyUserId(fsStoreOrder.getCompanyUserId());
|
|
|
- payment.setStatus(0);
|
|
|
- payment.setPayCode(payCode);
|
|
|
- payment.setPayMoney(fsStoreOrder.getPayMoney());
|
|
|
- payment.setCreateTime(new Date());
|
|
|
- payment.setPayTypeCode("weixin");
|
|
|
- payment.setBusinessType(2);
|
|
|
- payment.setRemark("商城订单支付");
|
|
|
- payment.setOpenId(session.getOpenid());
|
|
|
- payment.setUserId(user.getUserId());
|
|
|
-
|
|
|
- HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
|
- o.setTradeType("T_MINIAPP");
|
|
|
- o.setOpenid(user.getMaOpenId());
|
|
|
-// o.setReqSeqId("store-" + storePayment.getPayCode());
|
|
|
- o.setReqSeqId("store-" + payment.getPayCode());
|
|
|
- o.setTransAmt(payment.getPayMoney().toString());
|
|
|
- o.setGoodsDesc("商城订单支付");
|
|
|
- HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
|
- if (result.getBank_code() != null && result.getBank_code().equals("00000000")) {
|
|
|
- for (int i = 0; i < paymentIds.size(); i++) {
|
|
|
- FsStorePaymentScrm mt = new FsStorePaymentScrm();
|
|
|
- mt.setPaymentId(Long.parseLong(paymentIds.get(i).toString()));
|
|
|
- mt.setTradeNo(result.getHf_seq_id());
|
|
|
- fsStorePaymentMapper.updateFsStorePayment(mt);
|
|
|
- redisCache.setCacheObject("isPaying:" + orders.get(i).getId(), orders.get(i).getId().toString(), 1, TimeUnit.MINUTES);
|
|
|
- }
|
|
|
-
|
|
|
- String mes = result.getPay_info();
|
|
|
- JSONObject payInfo = JSONUtil.parseObj(mes);
|
|
|
- FsHuiFuPayInfo fsHuiFuPayInfo = new FsHuiFuPayInfo();
|
|
|
- if (payInfo.get("timeStamp") != null) {
|
|
|
- fsHuiFuPayInfo.setTimeStamp(payInfo.get("timeStamp").toString());
|
|
|
- }
|
|
|
- if (payInfo.get("package") != null) {
|
|
|
- fsHuiFuPayInfo.setPackageStr(payInfo.get("package").toString());
|
|
|
- }
|
|
|
- if (payInfo.get("paySign") != null) {
|
|
|
- fsHuiFuPayInfo.setPaySign(payInfo.get("paySign").toString());
|
|
|
-
|
|
|
- }
|
|
|
- if (payInfo.get("appId") != null) {
|
|
|
- fsHuiFuPayInfo.setAppId(payInfo.get("appId").toString());
|
|
|
-
|
|
|
- }
|
|
|
- if (payInfo.get("signType") != null) {
|
|
|
- fsHuiFuPayInfo.setSignType(payInfo.get("signType").toString());
|
|
|
-
|
|
|
- }
|
|
|
- if (payInfo.get("nonceStr") != null) {
|
|
|
- fsHuiFuPayInfo.setNonceStr(payInfo.get("nonceStr").toString());
|
|
|
- }
|
|
|
-
|
|
|
- return R.ok().put("result", fsHuiFuPayInfo);
|
|
|
- } else {
|
|
|
- return R.error(result.getResp_desc());
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- } catch (WxErrorException e) {
|
|
|
- e.printStackTrace();
|
|
|
- return R.error(e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
+// @Login
|
|
|
+// @ApiOperation("亲友支付")
|
|
|
+// @PostMapping("/otherPaymentByCombinationId")
|
|
|
+// @Transactional
|
|
|
+// public R otherPaymentByCombinationId(@Validated @RequestBody FsStoreOrderOtherPayCombinationIdParam param, HttpServletRequest request) {
|
|
|
+// final WxMaService wxService = WxMaConfiguration.getMaService(param.getAppId());
|
|
|
+// try {
|
|
|
+// //组合微信支付order
|
|
|
+// FsStoreOrderScrm fsStoreOrder = new FsStoreOrderScrm();
|
|
|
+// BigDecimal payPrice = BigDecimal.ZERO;
|
|
|
+// BigDecimal payMoneyTotal = BigDecimal.ZERO;
|
|
|
+//
|
|
|
+// String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
+// //新增的支付详情id
|
|
|
+// ArrayList<Long> paymentIds = new ArrayList<>();
|
|
|
+// String ip = IpUtil.getRequestIp();
|
|
|
+// WxMaJscode2SessionResult session = wxService.getUserService().getSessionInfo(param.getCode());
|
|
|
+// FsUserScrm user = userService.selectFsUserByMaOpenId(session.getOpenid());
|
|
|
+// if (user == null) {
|
|
|
+// //创建
|
|
|
+// user = new FsUserScrm();
|
|
|
+// user.setUsername("");
|
|
|
+// user.setNickname("微信用户");
|
|
|
+// user.setStatus(1);
|
|
|
+// user.setMaOpenId(session.getOpenid());
|
|
|
+// user.setUnionId(session.getUnionid());
|
|
|
+// user.setIsWeixinAuth(0);
|
|
|
+// user.setLastIp(ip);
|
|
|
+// user.setCreateTime(new Date());
|
|
|
+// userService.insertFsUser(user);
|
|
|
+// }
|
|
|
+//// FsStoreOrder order = orderService.selectFsStoreOrderById(param.getOrderId());
|
|
|
+// List<FsStoreOrderScrm> orders = orderService.getStoreOrderByCombinationId(param.getCombinationOrderId());
|
|
|
+// for (FsStoreOrderScrm order : orders) {
|
|
|
+// if (order == null) {
|
|
|
+// return R.error("订单不存在");
|
|
|
+// }
|
|
|
+// if (order.getStatus() != OrderInfoEnum.STATUS_0.getValue()) {
|
|
|
+// return R.error("此订单不能支付");
|
|
|
+// }
|
|
|
+// if (order.getPayMoney().compareTo(new BigDecimal(0)) < 1) {
|
|
|
+// return R.error("此订单没有可支付的金额");
|
|
|
+// }
|
|
|
+// payPrice = NumberUtil.add(payPrice, order.getPayPrice());
|
|
|
+// payMoneyTotal = NumberUtil.add(payMoneyTotal, order.getPayMoney());
|
|
|
+// String paySubCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
+// //小雨点支付
|
|
|
+// FsStorePaymentScrm storePayment = new FsStorePaymentScrm();
|
|
|
+// storePayment.setCompanyId(order.getCompanyId());
|
|
|
+// storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
|
+// storePayment.setStatus(0);
|
|
|
+// storePayment.setPayCode(payCode);
|
|
|
+// storePayment.setPaySubCode(paySubCode);
|
|
|
+// storePayment.setPayMoney(order.getPayMoney());
|
|
|
+// storePayment.setCreateTime(new Date());
|
|
|
+// storePayment.setPayTypeCode("weixin");
|
|
|
+// storePayment.setBusinessType(2);
|
|
|
+// storePayment.setRemark("商城订单支付");
|
|
|
+// storePayment.setOpenId(session.getOpenid());
|
|
|
+// storePayment.setUserId(user.getUserId());
|
|
|
+// storePayment.setBusinessOrderId(order.getCombinationOrderId().toString());
|
|
|
+// storePayment.setOrderId(order.getId());
|
|
|
+// fsStorePaymentMapper.insertFsStorePayment(storePayment);
|
|
|
+// paymentIds.add(storePayment.getPaymentId());
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+// //创建订单
|
|
|
+// fsStoreOrder.setPayType(orders.get(0).getPayType());
|
|
|
+// fsStoreOrder.setCompanyId(orders.get(0).getCompanyId());
|
|
|
+// fsStoreOrder.setCompanyUserId(orders.get(0).getCompanyUserId());
|
|
|
+// fsStoreOrder.setPayMoney(payMoneyTotal);
|
|
|
+//// fsStoreOrder.setPayMoney(BigDecimal.valueOf(0.01));
|
|
|
+// fsStoreOrder.setRealName(orders.get(0).getRealName());
|
|
|
+// fsStoreOrder.setCombinationOrderId(orders.get(0).getCombinationOrderId());
|
|
|
+//
|
|
|
+// FsStorePaymentScrm payment = new FsStorePaymentScrm();
|
|
|
+// payment.setCompanyId(fsStoreOrder.getCompanyId());
|
|
|
+// payment.setCompanyUserId(fsStoreOrder.getCompanyUserId());
|
|
|
+// payment.setStatus(0);
|
|
|
+// payment.setPayCode(payCode);
|
|
|
+// payment.setPayMoney(fsStoreOrder.getPayMoney());
|
|
|
+// payment.setCreateTime(new Date());
|
|
|
+// payment.setPayTypeCode("weixin");
|
|
|
+// payment.setBusinessType(2);
|
|
|
+// payment.setRemark("商城订单支付");
|
|
|
+// payment.setOpenId(session.getOpenid());
|
|
|
+// payment.setUserId(user.getUserId());
|
|
|
+//
|
|
|
+// HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
|
+// o.setTradeType("T_MINIAPP");
|
|
|
+// o.setOpenid(user.getMaOpenId());
|
|
|
+//// o.setReqSeqId("store-" + storePayment.getPayCode());
|
|
|
+// o.setReqSeqId("store-" + payment.getPayCode());
|
|
|
+// o.setTransAmt(payment.getPayMoney().toString());
|
|
|
+// o.setGoodsDesc("商城订单支付");
|
|
|
+// HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
|
+// if (result.getBank_code() != null && result.getBank_code().equals("00000000")) {
|
|
|
+// for (int i = 0; i < paymentIds.size(); i++) {
|
|
|
+// FsStorePaymentScrm mt = new FsStorePaymentScrm();
|
|
|
+// mt.setPaymentId(Long.parseLong(paymentIds.get(i).toString()));
|
|
|
+// mt.setTradeNo(result.getHf_seq_id());
|
|
|
+// fsStorePaymentMapper.updateFsStorePayment(mt);
|
|
|
+// redisCache.setCacheObject("isPaying:" + orders.get(i).getId(), orders.get(i).getId().toString(), 1, TimeUnit.MINUTES);
|
|
|
+// }
|
|
|
+//
|
|
|
+// String mes = result.getPay_info();
|
|
|
+// JSONObject payInfo = JSONUtil.parseObj(mes);
|
|
|
+// FsHuiFuPayInfo fsHuiFuPayInfo = new FsHuiFuPayInfo();
|
|
|
+// if (payInfo.get("timeStamp") != null) {
|
|
|
+// fsHuiFuPayInfo.setTimeStamp(payInfo.get("timeStamp").toString());
|
|
|
+// }
|
|
|
+// if (payInfo.get("package") != null) {
|
|
|
+// fsHuiFuPayInfo.setPackageStr(payInfo.get("package").toString());
|
|
|
+// }
|
|
|
+// if (payInfo.get("paySign") != null) {
|
|
|
+// fsHuiFuPayInfo.setPaySign(payInfo.get("paySign").toString());
|
|
|
+//
|
|
|
+// }
|
|
|
+// if (payInfo.get("appId") != null) {
|
|
|
+// fsHuiFuPayInfo.setAppId(payInfo.get("appId").toString());
|
|
|
+//
|
|
|
+// }
|
|
|
+// if (payInfo.get("signType") != null) {
|
|
|
+// fsHuiFuPayInfo.setSignType(payInfo.get("signType").toString());
|
|
|
+//
|
|
|
+// }
|
|
|
+// if (payInfo.get("nonceStr") != null) {
|
|
|
+// fsHuiFuPayInfo.setNonceStr(payInfo.get("nonceStr").toString());
|
|
|
+// }
|
|
|
+//
|
|
|
+// return R.ok().put("result", fsHuiFuPayInfo);
|
|
|
+// } else {
|
|
|
+// return R.error(result.getResp_desc());
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// } catch (WxErrorException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// return R.error(e.getMessage());
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
|
* 检查订单列表中是否存在含处方药但未开方的订单
|