|
@@ -20,9 +20,7 @@ import com.szwl.model.bo.R;
|
|
|
import com.szwl.model.bo.ResponseModel;
|
|
|
import com.szwl.model.entity.*;
|
|
|
import com.szwl.model.query.TAdminParam;
|
|
|
-import com.szwl.model.utils.DateUtils;
|
|
|
-import com.szwl.model.utils.JoinpayConstant;
|
|
|
-import com.szwl.model.utils.PushUtils;
|
|
|
+import com.szwl.model.utils.*;
|
|
|
import com.szwl.service.*;
|
|
|
import com.szwl.service.es.EsTOrderService;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -886,11 +884,11 @@ public class TOrderController {
|
|
|
}
|
|
|
JSONObject resultJson = JSONObject.parseObject(result);
|
|
|
// 返回支付二维码图片
|
|
|
- String rd_Pic = resultJson.getString("qr_code");
|
|
|
- String qrcode = toQrcode(rd_Pic);
|
|
|
- if (resultJson == null || StringUtils.isBlank(rd_Pic)) {
|
|
|
- return JsonMessage.error("找不到支付图片");
|
|
|
- }
|
|
|
+// String rd_Pic = resultJson.getString("qr_code");
|
|
|
+// String qrcode = toQrcode(rd_Pic);
|
|
|
+// if (resultJson == null || StringUtils.isBlank(rd_Pic)) {
|
|
|
+// return JsonMessage.error("找不到支付图片");
|
|
|
+// }
|
|
|
JSONObject kindData = new JSONObject();
|
|
|
kindData.put("sn", sn);
|
|
|
return JsonMessage.success(kindData.toString());
|
|
@@ -908,13 +906,18 @@ public class TOrderController {
|
|
|
}
|
|
|
JSONObject resultJson = JSONObject.parseObject(result);
|
|
|
// 汇聚支付支付申请返回支付二维码图片
|
|
|
- String rd_Pic = resultJson.getString("rd_Pic");
|
|
|
- if (resultJson == null || StringUtils.isBlank(rd_Pic)) {
|
|
|
- return JsonMessage.error("找不到支付图片");
|
|
|
+// String rd_Pic = resultJson.getString("rd_Pic");
|
|
|
+// if (resultJson == null || StringUtils.isBlank(rd_Pic)) {
|
|
|
+// return JsonMessage.error("找不到支付图片");
|
|
|
+// }
|
|
|
+ if(resultJson.getString("ra_Code").equals("100")){
|
|
|
+ JSONObject kindData = new JSONObject();
|
|
|
+ kindData.put("sn", sn);
|
|
|
+ return JsonMessage.success(kindData.toString());
|
|
|
+ }else {
|
|
|
+ return JsonMessage.error("申请支付失败");
|
|
|
}
|
|
|
- JSONObject kindData = new JSONObject();
|
|
|
- kindData.put("sn", sn);
|
|
|
- return JsonMessage.success(kindData.toString());
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1931,6 +1934,11 @@ public class TOrderController {
|
|
|
List<TPromoCode> promoCodeAll = new ArrayList<>();
|
|
|
|
|
|
TEquipmentDesc equipmentDesc = R.getDataIfSuccess(szwlFeign.findEquipmentById(equipment.getId()));
|
|
|
+ if(StringUtils.isNotEmpty(equipmentDesc.getStatus())){
|
|
|
+ if(equipmentDesc.getStatus().equals("1")){
|
|
|
+ return JsonMessage.error("设备在做糖,请稍后再进行支付");
|
|
|
+ }
|
|
|
+ }
|
|
|
if(equipmentDesc==null||equipmentDesc.getEquipmentId()==null||equipmentDesc.getPayType()==null||equipmentDesc.getPayType().equals("0")){
|
|
|
//1,type=0,原始设定,没有第二件半价
|
|
|
for (String key : productNameMap.keySet()) {
|
|
@@ -2519,12 +2527,11 @@ public class TOrderController {
|
|
|
} catch (ParseException e) {
|
|
|
e.printStackTrace();
|
|
|
} catch (UnsupportedEncodingException e) {
|
|
|
-
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
-
|
|
|
orderService.updateById(order);
|
|
|
-
|
|
|
+ //传送数据
|
|
|
+ sentJingZhun(order);
|
|
|
JSONObject kindData = new JSONObject();
|
|
|
kindData.put("sn", order.getSn());
|
|
|
kindData.put("productName", order.getProductName());
|
|
@@ -2535,6 +2542,12 @@ public class TOrderController {
|
|
|
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("0");
|
|
|
equipmentService.sentMessage(byClientId.getClientId(), PushUtils.buildJson("cardPayXCX", kindData1.toString()).toString());
|
|
|
TSzsmWx szsmWx = szsmWxService.getById(order.getWxId());
|
|
|
BigDecimal integral = szsmWx.getIntegral();
|
|
@@ -2580,6 +2593,48 @@ public class TOrderController {
|
|
|
|
|
|
return "success";
|
|
|
}
|
|
|
+// @RequestMapping(value = "/sentJingZhun", method = RequestMethod.POST)
|
|
|
+// @ResponseBody
|
|
|
+ private void sentJingZhun( TOrder order) {
|
|
|
+ order = orderService.getById(order.getId());
|
|
|
+ int i = 0;
|
|
|
+ TAdmin admin = R.getDataIfSuccess(szwlFeign.getAdmin(String.valueOf(order.getAdminId())));
|
|
|
+ if(admin.getId().toString().equals("372")||admin.getRelationAdminId().equals("372")||admin.getId().toString().equals("639")||admin.getId().toString().equals("238")){
|
|
|
+ //发送数据到鲸准
|
|
|
+ String url = "http://47.106.13.109:3000/api/listen";
|
|
|
+ Map<String,String> map = new HashMap<>();
|
|
|
+ map.put("clientId",order.getClientId());
|
|
|
+ map.put("price", String.valueOf(order.getPrice()));
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ map.put("pay_date",sdf.format(order.getPayDate()));
|
|
|
+ if(order.getWxId()!=null){
|
|
|
+ //小程序下单
|
|
|
+ TSzsmWx szsmWx = szsmWxService.getById(order.getWxId());
|
|
|
+ map.put("sourceChannel","1");
|
|
|
+ map.put("phone",szsmWx.getPhone());
|
|
|
+ map.put("amount",order.getMarketingAmount().toString());
|
|
|
+ map.put("nickName","1");
|
|
|
+ map.put("uninoId",szsmWx.getOpenId());
|
|
|
+ }else {
|
|
|
+ //机器下单
|
|
|
+ map.put("sourceChannel","0");
|
|
|
+ map.put("phone","");
|
|
|
+ map.put("amount","0");
|
|
|
+ map.put("nickName","");
|
|
|
+ map.put("uninoId","");
|
|
|
+ }
|
|
|
+ TEquipment byClientId = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(order.getClientId()));
|
|
|
+ map.put("latitude", String.valueOf(byClientId.getLatitude()));
|
|
|
+ map.put("longitude", String.valueOf(byClientId.getLongitude()));
|
|
|
+ String data = JSON.toJSONString(map);
|
|
|
+ try {
|
|
|
+ String s = HttpClientSslUtils.doPost(url, data);
|
|
|
+ System.out.println("发送鲸准:"+s);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 支付成功回调 杉德
|
|
@@ -2905,12 +2960,12 @@ public class TOrderController {
|
|
|
String sn = request.getParameter("r2_OrderNo");
|
|
|
LambdaQueryWrapper<TOrder> query = Wrappers.lambdaQuery();
|
|
|
query.eq(TOrder::getSn,sn);
|
|
|
- List<TOrder> list = orderService.list();
|
|
|
- TOrder order = new TOrder();
|
|
|
+ List<TOrder> list = orderService.list(query);
|
|
|
+ TOrder order = list.get(0);
|
|
|
if (order == null) {
|
|
|
return "success";
|
|
|
}
|
|
|
- if (order.getStatus() != 3) {
|
|
|
+ if (order.getStatus() == 3) {
|
|
|
return "success";
|
|
|
}
|
|
|
|
|
@@ -2919,6 +2974,9 @@ public class TOrderController {
|
|
|
// 已退款
|
|
|
order.setStatus(3);
|
|
|
BigDecimal r4_refundAmount = new BigDecimal(request.getParameter("r4_RefundAmount_str"));
|
|
|
+ if(order.getRefundMarketingAmount()!=null){
|
|
|
+ r4_refundAmount =r4_refundAmount.add(order.getRefundMarketingAmount());
|
|
|
+ }
|
|
|
BigDecimal price = order.getPrice();
|
|
|
if(r4_refundAmount.compareTo(price)==-1){
|
|
|
BigDecimal refundAmount = order.getRefundAmount();
|
|
@@ -2926,7 +2984,7 @@ public class TOrderController {
|
|
|
order.setRefundAmount(refundAmount.add(r4_refundAmount));
|
|
|
}else {
|
|
|
// 退款金额
|
|
|
- order.setRefundAmount(new BigDecimal(request.getParameter("r4_RefundAmount_str")));
|
|
|
+ order.setRefundAmount(r4_refundAmount);
|
|
|
}
|
|
|
order.setStatus(1);
|
|
|
order.setPrice(price.subtract(r4_refundAmount));
|
|
@@ -2938,17 +2996,31 @@ public class TOrderController {
|
|
|
order.setPrice(order.getPrice().add(r4_refundAmount));
|
|
|
}else {
|
|
|
// 退款金额
|
|
|
- order.setRefundAmount(new BigDecimal(request.getParameter("r4_RefundAmount_str")));
|
|
|
+ order.setRefundAmount(r4_refundAmount);
|
|
|
}
|
|
|
}
|
|
|
// 退款金额
|
|
|
- order.setRefundAmount(new BigDecimal(request.getParameter("r4_RefundAmount_str")));
|
|
|
+// order.setRefundAmount(new BigDecimal(request.getParameter("r4_RefundAmount_str")));
|
|
|
// 支付平台产生的退款流水号
|
|
|
String r5_RefundTrxNo = request.getParameter("r5_RefundTrxNo");
|
|
|
order.setRefundTrxNo(r5_RefundTrxNo);
|
|
|
order.setRefundDate(new Date());
|
|
|
order.setModifyDate(new Date());
|
|
|
orderService.updateById(order);
|
|
|
+ String orderStatus = order.getOrderStatus();
|
|
|
+ if(StringUtils.isNotEmpty(orderStatus)&&orderStatus.equals("0")){
|
|
|
+ if(order.getStatus().toString().equals("3")){
|
|
|
+ TEquipment byClientId = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(order.getClientId()));
|
|
|
+ JSONObject kindData = new JSONObject();
|
|
|
+ String s = order.getId().toString();
|
|
|
+ if(s.length()>6){
|
|
|
+ s = s.substring(s.length()-6,s.length());
|
|
|
+ }
|
|
|
+ kindData.put("mealCode", s);
|
|
|
+ equipmentService.sentMessage(byClientId.getClientId(), PushUtils.buildJson("refuse_success", kindData.toString()).toString());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
try {
|
|
|
esTOrderService.updateDataById(order);
|
|
|
}catch (Exception e) {
|
|
@@ -3098,7 +3170,32 @@ public class TOrderController {
|
|
|
}
|
|
|
return JsonMessage.success(sta);
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 上传订单的做糖状态
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/sendOrderStatus", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public JsonMessage sendOrderStatus(String sn,String orderStatus) {
|
|
|
+ if(StringUtils.isEmpty(sn)||StringUtils.isEmpty(orderStatus)){
|
|
|
+ return JsonMessage.error("数据有空");
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<TOrder> query = Wrappers.lambdaQuery();
|
|
|
+ query.eq(TOrder::getSn,sn);
|
|
|
+ List<TOrder> list = orderService.list(query);
|
|
|
+ TOrder order = list.get(0);
|
|
|
+ order.setOrderStatus(orderStatus);
|
|
|
+ orderService.updateById(order);
|
|
|
+ if(orderStatus.equals("1")){
|
|
|
+ String s = order.getId().toString();
|
|
|
+ String clientId = order.getClientId();
|
|
|
+ szsmWxService.subscribeMessage(order.getWxId(),s.substring(s.length()-6,s.length()),clientId.substring(clientId.length()-6,clientId.length()));
|
|
|
+ }
|
|
|
+ return JsonMessage.success("success");
|
|
|
+ }
|
|
|
/**
|
|
|
* 删除订单
|
|
|
*
|