|
@@ -15,6 +15,7 @@ import com.google.zxing.client.j2se.MatrixToImageWriter;
|
|
|
import com.google.zxing.common.BitMatrix;
|
|
|
import com.google.zxing.qrcode.QRCodeWriter;
|
|
|
import com.szwl.constant.HuifuConstant;
|
|
|
+import com.szwl.constant.JoinpayConstant;
|
|
|
import com.szwl.constant.ResponseCodesEnum;
|
|
|
import com.szwl.exception.BizException;
|
|
|
import com.szwl.feign.bean.OrderFeign;
|
|
@@ -80,7 +81,7 @@ public class TOrderController {
|
|
|
TShandeMchService shandeMchService;
|
|
|
|
|
|
@Autowired
|
|
|
- private THuifuMchService huifuMchService;
|
|
|
+ THuifuMchService huifuMchService;
|
|
|
|
|
|
@Autowired
|
|
|
TEquipmentService equipmentService;
|
|
@@ -277,6 +278,7 @@ public class TOrderController {
|
|
|
order.setType(admin.getType());
|
|
|
order.setProductNumber(productNumber);
|
|
|
order.setCompanyType(admin.getCompanyType());
|
|
|
+ order.setMachineType(equipment.getMachineType());
|
|
|
if(admin.getType()==0){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
|
order.setAgencyProportion(proportion.getAgencyProportion());
|
|
@@ -314,9 +316,10 @@ public class TOrderController {
|
|
|
orderDetails.setAmount(price);
|
|
|
orderDetails.setRefundStatus("0");
|
|
|
orderDetails.setCompanyType(admin.getCompanyType());
|
|
|
+ orderDetails.setMachineType(equipment.getMachineType());
|
|
|
|
|
|
-// String client6 = clientId.substring(clientId.length() - 6, clientId.length());
|
|
|
-// productName = productName + "-" + equipment.getName() + "-" + client6;
|
|
|
+ String client6 = clientId.substring(clientId.length() - 6);
|
|
|
+ String productName1 = productName + "-" + equipment.getName() + "-" + client6;
|
|
|
String result = null;
|
|
|
if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
|
|
|
// 汇付分账参数
|
|
@@ -340,7 +343,7 @@ public class TOrderController {
|
|
|
// 汇付支付
|
|
|
try {
|
|
|
result = huifuMchService.uniPay(
|
|
|
- orderNo, amount, productName, productDesc,
|
|
|
+ orderNo, amount, productName1, productDesc,
|
|
|
notifyUrl, frpCode, openId, appid, acctSplitBunch
|
|
|
);
|
|
|
} catch (Exception e) {
|
|
@@ -360,7 +363,7 @@ public class TOrderController {
|
|
|
}else{
|
|
|
try {
|
|
|
result = joinpayMchService.uniPay(
|
|
|
- orderNo, amount, productName, productDesc,
|
|
|
+ orderNo, amount, productName1, productDesc,
|
|
|
commonParameter, returnUrl, notifyUrl, frpCode,
|
|
|
isShowPic, openId, authCode, appid, transactionModel, tradeMerchantNo,
|
|
|
buyerId, isAlt, altType, altInfo, altUrl, marketingAmount
|
|
@@ -536,6 +539,7 @@ public class TOrderController {
|
|
|
order.setType(admin.getType());
|
|
|
order.setProductNumber(productNumber);
|
|
|
order.setCompanyType(admin.getCompanyType());
|
|
|
+ order.setMachineType(equipment.getMachineType());
|
|
|
if(admin.getType()==0){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
|
order.setAgencyProportion(proportion.getAgencyProportion());
|
|
@@ -576,15 +580,16 @@ public class TOrderController {
|
|
|
orderDetails.setAmount(price);
|
|
|
orderDetails.setRefundStatus("0");
|
|
|
orderDetails.setCompanyType(admin.getCompanyType());
|
|
|
+ orderDetails.setMachineType(equipment.getMachineType());
|
|
|
|
|
|
-// String client6 = clientId.substring(clientId.length() - 6, clientId.length());
|
|
|
-// productName = productName + "-" + equipment.getName() + "-" + client6;
|
|
|
+ String client6 = clientId.substring(clientId.length() - 6);
|
|
|
+ String productName1 = productName + "-" + equipment.getName() + "-" + client6;
|
|
|
String result = null;
|
|
|
if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
|
|
|
order.setAcctSplitBunch(acctSplitBunch.toString());
|
|
|
try {
|
|
|
result = huifuMchService.cardPay(
|
|
|
- orderNo, amount, productName, notifyUrl, authCode, acctSplitBunch
|
|
|
+ orderNo, amount, productName1, notifyUrl, authCode, acctSplitBunch
|
|
|
);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -602,7 +607,7 @@ public class TOrderController {
|
|
|
}else{
|
|
|
try {
|
|
|
result = joinpayMchService.uniPay(
|
|
|
- orderNo, amount, productName, productDesc,
|
|
|
+ orderNo, amount, productName1, productDesc,
|
|
|
commonParameter, returnUrl, notifyUrl, frpCode,
|
|
|
isShowPic, openId, authCode, appid, transactionModel, tradeMerchantNo,
|
|
|
buyerId, isAlt, altType, altInfo, altUrl, marketingAmount
|
|
@@ -612,7 +617,8 @@ public class TOrderController {
|
|
|
return JsonMessage.error("申请支付失败");
|
|
|
}
|
|
|
JSONObject resultJson = JSONObject.parseObject(result);
|
|
|
- if(resultJson.getString("ra_Code").equals("100")){
|
|
|
+ String raCode = resultJson.getString("ra_Code");
|
|
|
+ if(raCode.equals("100") || raCode.equals("102")){
|
|
|
orderService.save(order);
|
|
|
orderDetailsService.save(orderDetails);
|
|
|
JSONObject kindData = new JSONObject();
|
|
@@ -771,6 +777,7 @@ public class TOrderController {
|
|
|
order.setStatus(0);
|
|
|
order.setType(admin.getType());
|
|
|
order.setCompanyType(admin.getCompanyType());
|
|
|
+ order.setMachineType(equipment.getMachineType());
|
|
|
if(admin.getType()==0){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
|
order.setAgencyProportion(proportion.getAgencyProportion());
|
|
@@ -813,6 +820,7 @@ public class TOrderController {
|
|
|
order2.setStatus(0);
|
|
|
order2.setPayPlatform(payPlatform);
|
|
|
order2.setCompanyType(admin.getCompanyType());
|
|
|
+ order2.setMachineType(equipment.getMachineType());
|
|
|
if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
|
|
|
order2.setIsSettlement("0");
|
|
|
}
|
|
@@ -828,9 +836,10 @@ public class TOrderController {
|
|
|
orderDetails.setAmount(price);
|
|
|
orderDetails.setCompanyType(admin.getCompanyType());
|
|
|
orderDetails.setRefundStatus("0");
|
|
|
+ orderDetails.setMachineType(equipment.getMachineType());
|
|
|
|
|
|
-// String client6 = clientId.substring(clientId.length() - 6, clientId.length());
|
|
|
-// productName = productName + "-" + equipment.getName() + "-" + client6;
|
|
|
+ String client6 = clientId.substring(clientId.length() - 6);
|
|
|
+ String productName1 = productName + "-" + equipment.getName() + "-" + client6;
|
|
|
String result = null;
|
|
|
if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
|
|
|
// 汇付分账参数
|
|
@@ -847,7 +856,7 @@ public class TOrderController {
|
|
|
// 支付宝
|
|
|
try {
|
|
|
result = huifuMchService.uniPay(
|
|
|
- sn2, amount, productName, productDesc,
|
|
|
+ sn2, amount, productName1, productDesc,
|
|
|
notifyUrl, frpCode2, openId, appid, acctSplitBunch
|
|
|
);
|
|
|
} catch (Exception e) {
|
|
@@ -871,7 +880,7 @@ public class TOrderController {
|
|
|
}else{
|
|
|
try {
|
|
|
result = joinpayMchService.uniPay(
|
|
|
- orderNo1, amount, productName, productDesc,
|
|
|
+ orderNo1, amount, productName1, productDesc,
|
|
|
commonParameter, returnUrl, notifyUrl, frpCode1,
|
|
|
isShowPic, openId, authCode, appid, transactionModel, tradeMerchantNo,
|
|
|
buyerId, isAlt, altType, altInfo, altUrl, marketingAmount
|
|
@@ -885,7 +894,7 @@ public class TOrderController {
|
|
|
String result1 = null;
|
|
|
try {
|
|
|
result1 = joinpayMchService.uniPay(
|
|
|
- orderNo2, amount, productName, productDesc,
|
|
|
+ orderNo2, amount, productName1, productDesc,
|
|
|
commonParameter, returnUrl, notifyUrl, frpCode2,
|
|
|
isShowPic, openId, authCode, appid, transactionModel, tradeMerchantNo,
|
|
|
buyerId, isAlt, altType, altInfo, altUrl, marketingAmount
|
|
@@ -915,6 +924,7 @@ public class TOrderController {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
@ApiOperation(value = "购物车 请求在线支付 二码合一")
|
|
|
@PostMapping("/carsPay")
|
|
|
public Object carsPay(String clientId, @RequestBody Map<String,String> productNameMap) {
|
|
@@ -1161,6 +1171,7 @@ public class TOrderController {
|
|
|
order.setStatus(0);
|
|
|
order.setType(admin.getType());
|
|
|
order.setCompanyType(admin.getCompanyType());
|
|
|
+ order.setMachineType(equipment.getMachineType());
|
|
|
if(admin.getType()==0){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
|
order.setAgencyProportion(proportion.getAgencyProportion());
|
|
@@ -1203,6 +1214,7 @@ public class TOrderController {
|
|
|
order2.setProductNumber(productNumber);
|
|
|
order.setType(admin.getType());
|
|
|
order.setCompanyType(admin.getCompanyType());
|
|
|
+ order2.setMachineType(equipment.getMachineType());
|
|
|
if(admin.getType()==0){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
|
order.setAgencyProportion(proportion.getAgencyProportion());
|
|
@@ -1236,7 +1248,19 @@ public class TOrderController {
|
|
|
orderDetails.setCreateDate(new Date());
|
|
|
orderDetails.setCompanyType(admin.getCompanyType());
|
|
|
orderDetails.setRefundStatus("0");
|
|
|
+ orderDetails.setMachineType(equipment.getMachineType());
|
|
|
|
|
|
+ String client6 = clientId.substring(clientId.length() - 6);
|
|
|
+ String productName1 = "";
|
|
|
+ if(productNumber > 1) {
|
|
|
+ if(equipment.getMachineType() == null || equipment.getMachineType().equals("0")) {
|
|
|
+ productName1 = "棉花糖-" + equipment.getName() + "-" + client6;
|
|
|
+ } else {
|
|
|
+ productName1 = "爆米花-" + equipment.getName() + "-" + client6;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ productName1 = productName + "-" + equipment.getName() + "-" + client6;
|
|
|
+ }
|
|
|
String result = null;
|
|
|
if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
|
|
|
// 汇付分账参数
|
|
@@ -1253,7 +1277,7 @@ public class TOrderController {
|
|
|
// 支付宝
|
|
|
try {
|
|
|
result = huifuMchService.uniPay(
|
|
|
- sn2, amount, productName.toString(), productDesc,
|
|
|
+ sn2, amount, productName1, productDesc,
|
|
|
notifyUrl, frpCode2, openId, appid, acctSplitBunch
|
|
|
);
|
|
|
} catch (Exception e) {
|
|
@@ -1286,7 +1310,7 @@ public class TOrderController {
|
|
|
}else{
|
|
|
try {
|
|
|
result = joinpayMchService.uniPay(
|
|
|
- orderNo1, amount, productName.toString(), productDesc,
|
|
|
+ orderNo1, amount, productName1, productDesc,
|
|
|
commonParameter, returnUrl, notifyUrl, frpCode1,
|
|
|
isShowPic, openId, authCode, appid, transactionModel, tradeMerchantNo,
|
|
|
buyerId, isAlt, altType, altInfo, altUrl, marketingAmount
|
|
@@ -1300,7 +1324,7 @@ public class TOrderController {
|
|
|
String result1 = null;
|
|
|
try {
|
|
|
result1 = joinpayMchService.uniPay(
|
|
|
- orderNo2, amount, productName.toString(), productDesc,
|
|
|
+ orderNo2, amount, productName1, productDesc,
|
|
|
commonParameter, returnUrl, notifyUrl, frpCode2,
|
|
|
isShowPic, openId, authCode, appid, transactionModel, tradeMerchantNo,
|
|
|
buyerId, isAlt, altType, altInfo, altUrl, marketingAmount
|
|
@@ -1341,6 +1365,7 @@ public class TOrderController {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
@ApiOperation(value = "购物车 微信小程序支付")
|
|
|
@PostMapping("/carsPayXCX")
|
|
|
public Object carsPayXCX(String clientId,String id,String coupons, @RequestBody Map<String,String> productNameMap) {
|
|
@@ -1649,6 +1674,7 @@ public class TOrderController {
|
|
|
order.setMarketingAmount(marketingAmount);
|
|
|
order.setProductNumber(productNumber);
|
|
|
order.setCompanyType(admin.getCompanyType());
|
|
|
+ order.setMachineType(equipment.getMachineType());
|
|
|
if(couponList.size()>0){
|
|
|
order.setCoupons(couponList.toString());
|
|
|
}
|
|
@@ -1702,13 +1728,25 @@ public class TOrderController {
|
|
|
orderDetails.setCreateDate(new Date());
|
|
|
orderDetails.setCompanyType(admin.getCompanyType());
|
|
|
orderDetails.setRefundStatus("0");
|
|
|
+ orderDetails.setMachineType(equipment.getMachineType());
|
|
|
|
|
|
+ String client6 = clientId.substring(clientId.length() - 6);
|
|
|
+ String productName1 = "";
|
|
|
+ if(productNumber > 1) {
|
|
|
+ if(equipment.getMachineType() == null || equipment.getMachineType().equals("0")) {
|
|
|
+ productName1 = "棉花糖-" + equipment.getName() + "-" + client6;
|
|
|
+ } else {
|
|
|
+ productName1 = "爆米花-" + equipment.getName() + "-" + client6;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ productName1 = productName + "-" + equipment.getName() + "-" + client6;
|
|
|
+ }
|
|
|
String result = null;
|
|
|
if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
|
|
|
order.setAcctSplitBunch(acctSplitBunch.toString());
|
|
|
try {
|
|
|
result = huifuMchService.uniPay(
|
|
|
- orderNo1, amount, productName.toString(), productDesc,
|
|
|
+ orderNo1, amount, productName1, productDesc,
|
|
|
notifyUrl, frpCode1, openId, appid, acctSplitBunch
|
|
|
);
|
|
|
} catch (Exception e) {
|
|
@@ -1739,7 +1777,7 @@ public class TOrderController {
|
|
|
}else{
|
|
|
try {
|
|
|
result = joinpayMchService.uniPay(
|
|
|
- orderNo1, amount, productName.toString(), productDesc,
|
|
|
+ orderNo1, amount, productName1, productDesc,
|
|
|
commonParameter, returnUrl, notifyUrl, frpCode1,
|
|
|
isShowPic, openId, authCode, appid, transactionModel, tradeMerchantNo,
|
|
|
buyerId, isAlt, altType, altInfo, altUrl, marketingAmount
|
|
@@ -1873,7 +1911,47 @@ public class TOrderController {
|
|
|
kindData.put("productName", order.getProductName());
|
|
|
|
|
|
TEquipment equipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(order.getClientId()));
|
|
|
- equipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("pay_success", kindData.toString()).toString());
|
|
|
+ if(order.getFrpCode().equals("WEIXIN_XCX")){
|
|
|
+ JSONObject kindData1 = new JSONObject();
|
|
|
+ kindData1.put("sn", order.getSn());
|
|
|
+ kindData1.put("productDesc", order.getProductDesc());
|
|
|
+ String s = order.getId().toString();
|
|
|
+ if(s.length()>6){
|
|
|
+ s = s.substring(s.length()-6,s.length());
|
|
|
+ }
|
|
|
+ kindData1.put("mealCode", s);
|
|
|
+ order.setOrderStatus("-1");
|
|
|
+ equipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("cardPayXCX", kindData1.toString()).toString());
|
|
|
+ if(StringUtils.isNotEmpty(equipment.getApkVersion())){
|
|
|
+ //发送两次mq
|
|
|
+ if(equipment.getApkVersion().equals("1.0.131-jz11")||equipment.getApkVersion().equals("1.0.131-jz12")||equipment.getApkVersion().equals("1.0.131-jz13")||equipment.getApkVersion().equals("1.0.131-jz14")||equipment.getApkVersion().equals("1.0.131-jz15")){
|
|
|
+ sendMqTwo(equipment.getClientId(),kindData1.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ TSzsmWx szsmWx = szsmWxService.getById(order.getWxId());
|
|
|
+ BigDecimal integral = szsmWx.getIntegral();
|
|
|
+ if(integral!=null){
|
|
|
+ integral = order.getPrice().add(integral);
|
|
|
+ }else {
|
|
|
+ integral = order.getPrice();
|
|
|
+ }
|
|
|
+ szsmWx.setIntegral(integral);
|
|
|
+ szsmWxService.updateById(szsmWx);
|
|
|
+ if(StringUtils.isNotEmpty(order.getCoupons())){
|
|
|
+ String coupons = order.getCoupons();
|
|
|
+ coupons= coupons.substring(1,coupons.length()-1);
|
|
|
+ List<String> list1 = Arrays.asList(coupons);
|
|
|
+ if(list1.size()>0){
|
|
|
+ for(String code:list1){
|
|
|
+ szwlFeign.useYHJ(code, String.valueOf(order.getAdminId()),order.getClientId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ equipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("pay_success", kindData.toString()).toString());
|
|
|
+ }
|
|
|
+ orderService.updateById(order);
|
|
|
+// equipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("pay_success", kindData.toString()).toString());
|
|
|
try {
|
|
|
if(order.getProductNumber()==null||order.getProductNumber()==0){
|
|
|
order.setProductNumber(1);
|
|
@@ -1882,6 +1960,16 @@ public class TOrderController {
|
|
|
}catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
+ try {
|
|
|
+ TOrderTask orderTask = new TOrderTask();
|
|
|
+ BeanUtils.copyPropertiesIgnoreNull(order, orderTask, true);
|
|
|
+ orderTask.setAgencyId(order.getId());
|
|
|
+ orderTaskService.save(orderTask);
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ //传送数据
|
|
|
+ sentJingZhun(order);
|
|
|
return R.ok("支付成功");
|
|
|
} else {
|
|
|
TEquipment equipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(order.getClientId()));
|