|
@@ -1,51 +1,38 @@
|
|
|
package com.yijia.station.controller;
|
|
|
|
|
|
-import java.io.File;
|
|
|
-import java.io.FileOutputStream;
|
|
|
-import java.io.IOException;
|
|
|
-import java.io.OutputStream;
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.text.DateFormat;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.*;
|
|
|
-
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.alibaba.fastjson.parser.Feature;
|
|
|
+import com.yijia.common.annotation.Log;
|
|
|
import com.yijia.common.config.YiJiaConfig;
|
|
|
+import com.yijia.common.core.controller.BaseController;
|
|
|
+import com.yijia.common.core.domain.AjaxResult;
|
|
|
import com.yijia.common.core.domain.entity.SysDept;
|
|
|
import com.yijia.common.core.domain.model.LoginUser;
|
|
|
+import com.yijia.common.core.page.TableDataInfo;
|
|
|
+import com.yijia.common.enums.BusinessType;
|
|
|
import com.yijia.common.exception.CustomException;
|
|
|
import com.yijia.common.utils.SecurityUtils;
|
|
|
+import com.yijia.common.utils.poi.ExcelUtil;
|
|
|
+import com.yijia.station.domain.PayOrder;
|
|
|
import com.yijia.station.domain.StationBalanceChange;
|
|
|
+import com.yijia.station.service.IPayOrderService;
|
|
|
import com.yijia.station.service.IStationBalanceChangeService;
|
|
|
import com.yijia.station.service.IStationDeviceManageService;
|
|
|
import com.yijia.station.utils.FeiEPrinterUtil;
|
|
|
-import com.yijia.system.domain.SysRespon;
|
|
|
import com.yijia.system.service.ISysDeptService;
|
|
|
-import com.yijia.system.service.ISysUserService;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
-
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.PutMapping;
|
|
|
-import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-import com.yijia.common.annotation.Log;
|
|
|
-import com.yijia.common.core.controller.BaseController;
|
|
|
-import com.yijia.common.core.domain.AjaxResult;
|
|
|
-import com.yijia.common.enums.BusinessType;
|
|
|
-import com.yijia.station.domain.PayOrder;
|
|
|
-import com.yijia.station.service.IPayOrderService;
|
|
|
-import com.yijia.common.utils.poi.ExcelUtil;
|
|
|
-import com.yijia.common.core.page.TableDataInfo;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileOutputStream;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.OutputStream;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.text.DateFormat;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 订单支付Controller
|
|
@@ -69,6 +56,20 @@ public class PayOrderController extends BaseController
|
|
|
@Autowired
|
|
|
private IStationBalanceChangeService stationBalanceChangeService;
|
|
|
|
|
|
+
|
|
|
+ public static final String PAY_VER = "110";//版本号
|
|
|
+ public static final String KEY = "";//机构秘钥
|
|
|
+ public static final String ACCESS_TOKEN = "23570b46a955484d92038f6a18d2b9d6";//支付秘钥
|
|
|
+ public static final String INST_NO = "";//机构号
|
|
|
+ public static final String MERCHANT_NO = "";//商户号
|
|
|
+ public static final String TERMINAL_ID = "";//终端号
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 查询订单支付列表
|
|
|
*/
|
|
@@ -81,10 +82,27 @@ public class PayOrderController extends BaseController
|
|
|
payOrder.setStationId(null);
|
|
|
}
|
|
|
startPage();
|
|
|
- payOrder.setStatus("1");
|
|
|
+ //payOrder.setStatus("1");
|
|
|
List<PayOrder> payOrderList = payOrderService.selectPayOrderList(payOrder);
|
|
|
return getDataTable(payOrderList);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询订单支付列表
|
|
|
+ */
|
|
|
+ @GetMapping("/allList")
|
|
|
+ public TableDataInfo allList(PayOrder payOrder)
|
|
|
+ {
|
|
|
+ List<String> list = deptService.levelDeptList(payOrder.getLevelId());
|
|
|
+ if(list!=null && list.size()>0){
|
|
|
+ payOrder.setStationIdList(list);
|
|
|
+ payOrder.setStationId(null);
|
|
|
+ }
|
|
|
+ startPage();
|
|
|
+ List<PayOrder> payOrderList = payOrderService.selectALlPayOrderList(payOrder);
|
|
|
+ return getDataTable(payOrderList);
|
|
|
+ }
|
|
|
/**
|
|
|
* 关联用户查询订单支付列表
|
|
|
*/
|
|
@@ -97,7 +115,7 @@ public class PayOrderController extends BaseController
|
|
|
payOrder.setStationId(null);
|
|
|
}
|
|
|
startPage();
|
|
|
- payOrder.setStatus("1");
|
|
|
+ //payOrder.setStatus("1");
|
|
|
List<PayOrder> payOrderList = payOrderService.selectUserPayOrderList(payOrder);
|
|
|
return getDataTable(payOrderList);
|
|
|
}
|
|
@@ -112,7 +130,7 @@ public class PayOrderController extends BaseController
|
|
|
payOrder.setStationId(null);
|
|
|
}
|
|
|
startPage();
|
|
|
- payOrder.setStatus("1");
|
|
|
+ //payOrder.setStatus("1");
|
|
|
List<PayOrder> payOrderList = payOrderService.selectPayOrderList(payOrder);
|
|
|
return getDataTable(payOrderList);
|
|
|
}
|
|
@@ -128,7 +146,7 @@ public class PayOrderController extends BaseController
|
|
|
payOrder.setStationId(null);
|
|
|
}
|
|
|
payOrder.setOrderType("1");
|
|
|
- payOrder.setStatus("1");
|
|
|
+ //payOrder.setStatus("1");
|
|
|
List<PayOrder> payOrderList = payOrderService.selectPayOrderList(payOrder);
|
|
|
return getTable(payOrderList);
|
|
|
}
|
|
@@ -146,7 +164,7 @@ public class PayOrderController extends BaseController
|
|
|
payOrder.setStationIdList(list);
|
|
|
payOrder.setStationId(null);
|
|
|
}
|
|
|
- payOrder.setStatus("1");
|
|
|
+ //payOrder.setStatus("1");
|
|
|
payOrder.setOrderType("1");
|
|
|
PayOrder order = payOrderService.selectDaySources(payOrder);
|
|
|
return AjaxResult.success(order);
|
|
@@ -166,7 +184,7 @@ public class PayOrderController extends BaseController
|
|
|
payOrder.setStationIdList(list);
|
|
|
payOrder.setStationId(null);
|
|
|
}
|
|
|
- payOrder.setStatus("1");
|
|
|
+ //payOrder.setStatus("1");
|
|
|
payOrder.setOrderType("1");
|
|
|
PayOrder order = payOrderService.selectDaySources(payOrder);
|
|
|
return AjaxResult.success(order);
|
|
@@ -184,7 +202,7 @@ public class PayOrderController extends BaseController
|
|
|
payOrder.setStationIdList(list);
|
|
|
payOrder.setStationId(null);
|
|
|
}
|
|
|
- payOrder.setStatus("1");
|
|
|
+ //payOrder.setStatus("1");
|
|
|
payOrder.setOrderType("1");
|
|
|
PayOrder order = payOrderService.selectAllDaySources(payOrder);
|
|
|
return AjaxResult.success(order);
|
|
@@ -202,7 +220,7 @@ public class PayOrderController extends BaseController
|
|
|
payOrder.setStationIdList(list);
|
|
|
payOrder.setStationId(null);
|
|
|
}
|
|
|
- payOrder.setStatus("1");
|
|
|
+ //payOrder.setStatus("1");
|
|
|
payOrder.setOrderType("1");
|
|
|
PayOrder order = payOrderService.selectDaySources(payOrder);
|
|
|
return AjaxResult.success(order);
|
|
@@ -334,7 +352,7 @@ public class PayOrderController extends BaseController
|
|
|
}
|
|
|
//默认当前登陆人的ID 5冯总油站
|
|
|
startPage();
|
|
|
- payOrder.setStatus("1");
|
|
|
+ //payOrder.setStatus("1");
|
|
|
payOrder.setOrderType("1");
|
|
|
List<PayOrder> orderList = payOrderService.selectDayReport(payOrder);
|
|
|
return getDataTable(orderList);
|
|
@@ -353,7 +371,7 @@ public class PayOrderController extends BaseController
|
|
|
}
|
|
|
//默认当前登陆人的ID 5冯总油站
|
|
|
startPage();
|
|
|
- payOrder.setStatus("1");
|
|
|
+ //payOrder.setStatus("1");
|
|
|
payOrder.setOrderType("1");
|
|
|
List<PayOrder> orderList = payOrderService.selectAllDayReport(payOrder);
|
|
|
return getDataTable(orderList);
|
|
@@ -372,7 +390,7 @@ public class PayOrderController extends BaseController
|
|
|
payOrder.setStationIdList(list);
|
|
|
payOrder.setStationId(null);
|
|
|
}
|
|
|
- payOrder.setStatus("1");
|
|
|
+ //payOrder.setStatus("1");
|
|
|
payOrder.setOrderType("1");
|
|
|
List<PayOrder> orderList = payOrderService.selectDayReport(payOrder);
|
|
|
return getTable(orderList);
|
|
@@ -390,7 +408,7 @@ public class PayOrderController extends BaseController
|
|
|
payOrder.setStationIdList(list);
|
|
|
payOrder.setStationId(null);
|
|
|
}
|
|
|
- payOrder.setStatus("1");
|
|
|
+ //payOrder.setStatus("1");
|
|
|
payOrder.setOrderType("1");
|
|
|
List<PayOrder> payOrderList = payOrderService.selectPayOrderExport(payOrder);
|
|
|
ExcelUtil<PayOrder> util = new ExcelUtil<PayOrder>(PayOrder.class);
|
|
@@ -416,13 +434,16 @@ public class PayOrderController extends BaseController
|
|
|
int i=0;
|
|
|
PayOrder payOrder=new PayOrder();
|
|
|
PayOrder payOrder1=payOrderService.selectPayOrderById(orderId);
|
|
|
+ if(payOrder1.getStatus().equals("3")){
|
|
|
+ return AjaxResult.error("已经被线上退款,不能重复退款");
|
|
|
+ }
|
|
|
if(payOrder1.getStatus().equals("2")){
|
|
|
return AjaxResult.error("已经被退款,不能重复退款");
|
|
|
}
|
|
|
LoginUser currentUser = SecurityUtils.getLoginUser();
|
|
|
|
|
|
StationBalanceChange stationBalanceChange=new StationBalanceChange();
|
|
|
- stationBalanceChange.setAmt(payOrder1.getAmt());
|
|
|
+ stationBalanceChange.setAmt(payOrder1.getSellAmt());
|
|
|
stationBalanceChange.setStationId(payOrder1.getStationId());
|
|
|
stationBalanceChange.setType("+");
|
|
|
stationBalanceChange.setCreateBy(currentUser.getUser().getUserId()+"");
|
|
@@ -431,7 +452,7 @@ public class PayOrderController extends BaseController
|
|
|
SysDept dept1=deptService.selectDeptById(deptId);
|
|
|
SysDept dept=new SysDept();
|
|
|
Float Balance1= Float.parseFloat(dept1.getBalance().toString());
|
|
|
- Float value=Float.parseFloat(payOrder1.getAmt().toString());
|
|
|
+ Float value=Float.parseFloat(payOrder1.getSellAmt().toString());
|
|
|
stationBalanceChange.setNowAmt(dept1.getBalance());
|
|
|
dept.setDeptId(deptId);
|
|
|
dept.setBalance(BigDecimal.valueOf(Balance1+value));
|
|
@@ -439,11 +460,12 @@ public class PayOrderController extends BaseController
|
|
|
if(i!=0) {
|
|
|
payOrder.setOrderId(orderId);
|
|
|
payOrder.setStatus("2");//设置为已退款
|
|
|
+ payOrder.setRefundDate(new Date());
|
|
|
+ payOrder.setRefundUser(currentUser.getUser().getUserId());
|
|
|
stationBalanceChangeService.insertStationBalanceChange(stationBalanceChange);
|
|
|
i = payOrderService.updatePayOrder(payOrder);
|
|
|
|
|
|
}
|
|
|
-
|
|
|
if(i==0){
|
|
|
return AjaxResult.error();
|
|
|
}
|
|
@@ -452,96 +474,228 @@ public class PayOrderController extends BaseController
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 订单退款
|
|
|
+ * 线上订单退款
|
|
|
*/
|
|
|
+
|
|
|
@PostMapping(value = "/sxfRefund")
|
|
|
public AjaxResult sxfRefund(@RequestBody PayOrder payOrder)
|
|
|
{
|
|
|
-
|
|
|
+ if(!"1".equals(payOrder.getStatus())){
|
|
|
+ return AjaxResult.error("当前订单不能进行退款");
|
|
|
+ }
|
|
|
try {
|
|
|
- sendSxfRefund(payOrder);
|
|
|
+ payOrderService.sxfRefund(payOrder);
|
|
|
} catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ return AjaxResult.error(e.getMessage());
|
|
|
}
|
|
|
return AjaxResult.success(1);
|
|
|
}
|
|
|
|
|
|
- public SysRespon sendSxfRefund(PayOrder payOrder) throws Exception {
|
|
|
-
|
|
|
- SysRespon respon=new SysRespon();
|
|
|
- SysDept dept=deptService.selectDeptById(payOrder.getStationId());
|
|
|
- Random random=new Random();
|
|
|
- String result1 = "";
|
|
|
- for (int i = 0; i < 6; i++) {
|
|
|
- result1 += random.nextInt(10);
|
|
|
- }
|
|
|
- String ordNo = System.nanoTime() + result1;
|
|
|
- JSONObject reqData = new JSONObject();
|
|
|
- reqData.put("mno",dept.getMno() );
|
|
|
- reqData.put("ordNo",ordNo );
|
|
|
- reqData.put("origOrderNo",payOrder.getOrderNo() );
|
|
|
- reqData.put("amt",payOrder.getAmt() );
|
|
|
- reqData.put("origUuid","");
|
|
|
- reqData.put("origSxfUuid","" );
|
|
|
- String req= SXFPaySign.getSXFPay(reqData);
|
|
|
- ///logger.debug("参数信息:"+req);
|
|
|
- System.out.println("req:" + req);
|
|
|
- //此处不要改变reqData里面值的顺序用LinkedHashMap
|
|
|
- HashMap reqMap = JSON.parseObject(req, LinkedHashMap.class, Feature.OrderedField);
|
|
|
- //组装加密串
|
|
|
- String signContent = RSASignature.getOrderContent(reqMap);
|
|
|
- System.out.println("拼接后的参数:" + signContent);
|
|
|
- //logger.debug("拼接后的参数:"+signContent);
|
|
|
- //sign
|
|
|
- String sign = RSASignature.encryptBASE64(RSASignature.sign(signContent, SXFPaySign.privateKey));
|
|
|
- System.out.println("============签名:" + sign);
|
|
|
- reqMap.put("sign", sign);
|
|
|
- String reqStr = JSON.toJSONString(reqMap);
|
|
|
- System.out.println("请求参数:" + reqMap);
|
|
|
- System.out.println("请求参数:" + reqStr);
|
|
|
- //调用第三方接口地址
|
|
|
- String url = "https://openapi.suixingpay.com/merchant/order/refund";//生产地址
|
|
|
- String resultJson = HttpUtils.connectPostUrl(url, reqStr);
|
|
|
- System.out.println("返回信息:" + resultJson);
|
|
|
- //不要对reqData排序 所以用LinkedHashMap
|
|
|
- HashMap<String, Object> result = JSON.parseObject(resultJson, LinkedHashMap.class, Feature.OrderedField);
|
|
|
- if ("0000".equals(result.get("code"))) {
|
|
|
- //验签
|
|
|
- String signResult = result.get("sign").toString();
|
|
|
- result.remove("sign");
|
|
|
- String resultStr = RSASignature.getOrderContent(result);
|
|
|
- System.out.println("resultStr: " + resultStr);
|
|
|
- //sign
|
|
|
- String resultSign = RSASignature.encryptBASE64(RSASignature.sign(signContent, SXFPaySign.privateKey));
|
|
|
- System.out.println("resultSign: " + resultSign);
|
|
|
- //组装加密串
|
|
|
- if (RSASignature.doCheck(resultStr, signResult, SXFPaySign.sxfPublic)) {
|
|
|
- System.out.println("===================验签成功==============");
|
|
|
- //
|
|
|
- if(result.containsKey("respData")){
|
|
|
- HashMap<String, Object> result2 = JSON.parseObject(result.get("respData")+"", LinkedHashMap.class, Feature.OrderedField);
|
|
|
- if("0000".equals(result2.get("bizCode"))){
|
|
|
- respon.setResponCode("0000");
|
|
|
- System.out.println(result2.get("retUrl"));
|
|
|
- String url1=result2.get("retUrl")+"";
|
|
|
- respon.setResponMessage(result2.get("retUrl")+"");
|
|
|
- return respon;
|
|
|
- }else {
|
|
|
- respon.setResponCode(result2.get("bizCode") + "");
|
|
|
- respon.setResponMessage(result2.get("bizMsg") + "");
|
|
|
- }
|
|
|
- //判断 bizCode bizCode =="0000" 则业务成功
|
|
|
- }else {
|
|
|
- respon.setResponCode("0004");
|
|
|
- respon.setResponMessage(result.get("msg") + "");
|
|
|
+ /**
|
|
|
+ * 不需要审核直接进行退款
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/directRefund")
|
|
|
+ public AjaxResult directRefund(@RequestBody PayOrder payOrder)
|
|
|
+ {
|
|
|
+ if(!"1".equals(payOrder.getStatus())){
|
|
|
+ return AjaxResult.error("当前订单不能进行退款");
|
|
|
+ }
|
|
|
+ int i=0;
|
|
|
+ LoginUser currentUser = SecurityUtils.getLoginUser();
|
|
|
+ payOrder.setExaminUser(currentUser.getUser().getUserId());
|
|
|
+ payOrder.setExaminDate( new Date());
|
|
|
+ payOrder.setExaminStatus("2");
|
|
|
+ payOrder.setRefundUser(currentUser.getUser().getUserId());
|
|
|
+ payOrder.setRefundDate( new Date());
|
|
|
+ try {
|
|
|
+ payOrderService.sxfRefund(payOrder);
|
|
|
+ i=payOrderService.updatePayOrder(payOrder);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error(e.getMessage());
|
|
|
+ }
|
|
|
+ return AjaxResult.success(i);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据上级集团的信息判断当前的用户是否进行审核
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/applyExaminRefund")
|
|
|
+ public AjaxResult applyExaminRefund(@RequestBody PayOrder payOrder)
|
|
|
+ {
|
|
|
+ LoginUser currentUser = SecurityUtils.getLoginUser();
|
|
|
+ SysDept dept= currentUser.getUser().getDept();
|
|
|
+ if(!"1".equals(payOrder.getStatus())){
|
|
|
+ return AjaxResult.error("当前订单不能进行退款");
|
|
|
+ }
|
|
|
+ if("dzk".equals(payOrder.getPayType())){
|
|
|
+ return AjaxResult.error("电子卡的订单不能进行退款");
|
|
|
+ }
|
|
|
+ if(dept.getParentId()==100||dept.getParentId()==0||dept.getParentId()==3){
|
|
|
+ //集团的账号没有申请退款的权利
|
|
|
+ return AjaxResult.error("集团账号没有申请退款的权限");
|
|
|
+ }else{
|
|
|
+ SysDept dept1=deptService.selectDeptById(dept.getParentId());
|
|
|
+ //当前不需要进行审批时
|
|
|
+ if("0".equals(dept1.getRefundExaminStatus())){
|
|
|
+
|
|
|
+ if(!"1".equals(payOrder.getStatus())){
|
|
|
+ return AjaxResult.error("当前订单不能进行退款");
|
|
|
}
|
|
|
- }else {
|
|
|
- respon.setResponCode("0002");
|
|
|
- respon.setResponMessage("RSA验证失败");
|
|
|
+ int i=0;
|
|
|
+ //payOrder.setExaminUser(currentUser.getUser().getUserId());
|
|
|
+ //payOrder.setExaminDate( new Date());
|
|
|
+ payOrder.setExaminStatus("1");
|
|
|
+ payOrder.setRefundUser(currentUser.getUser().getUserId());
|
|
|
+ payOrder.setRefundDate( new Date());
|
|
|
+ try {
|
|
|
+ //payOrderService.sxfRefund(payOrder);
|
|
|
+ i=payOrderService.updatePayOrder(payOrder);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error(e.getMessage());
|
|
|
+ }
|
|
|
+ return AjaxResult.success(i);
|
|
|
+
|
|
|
}
|
|
|
+ //当前进行需要进行审批时,进行申请
|
|
|
+ else {
|
|
|
+ if(!"1".equals(payOrder.getStatus())){
|
|
|
+ return AjaxResult.error("当前订单不能进行退款");
|
|
|
+ }
|
|
|
+ int i=0;
|
|
|
+ payOrder.setRefundUser(currentUser.getUser().getUserId());
|
|
|
+ payOrder.setRefundDate( new Date());
|
|
|
+ payOrder.setExaminStatus("1");
|
|
|
+ i=payOrderService.updatePayOrder(payOrder);
|
|
|
+ return AjaxResult.success(i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 订单申请退款,重新申请退款
|
|
|
+ */
|
|
|
+ /*@PostMapping(value = "/applyRefund")
|
|
|
+ public AjaxResult applyRefund(@RequestBody PayOrder payOrder)
|
|
|
+ {
|
|
|
+ if(!"1".equals(payOrder.getStatus())){
|
|
|
+ return AjaxResult.error("当前订单不能进行退款");
|
|
|
+ }
|
|
|
+ if(!("0".equals(payOrder.getExaminStatus())||payOrder.getExaminStatus()==null||"3".equals(payOrder.getExaminStatus()))){
|
|
|
+ return AjaxResult.error("当前订单不能进行退款");
|
|
|
+ }
|
|
|
+ int i=0;
|
|
|
+ LoginUser currentUser = SecurityUtils.getLoginUser();
|
|
|
+ payOrder.setRefundUser(currentUser.getUser().getUserId());
|
|
|
+ payOrder.setRefundDate( new Date());
|
|
|
+ payOrder.setExaminStatus("1");
|
|
|
+ i=payOrderService.updatePayOrder(payOrder);
|
|
|
+ return AjaxResult.success(i);
|
|
|
+ }*/
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 重新申请退款
|
|
|
+ */
|
|
|
+ /*@PostMapping(value = "/reapplyRefund")
|
|
|
+ public AjaxResult reapplyRefund(@RequestBody PayOrder payOrder)
|
|
|
+ {
|
|
|
+ if(!"1".equals(payOrder.getStatus())){
|
|
|
+ return AjaxResult.error("当前订单不能进行退款");
|
|
|
+ }
|
|
|
+ if(!("3".equals(payOrder.getExaminStatus()))){
|
|
|
+ return AjaxResult.error("当前订单不能进行退款");
|
|
|
+ }
|
|
|
+ int i=0;
|
|
|
+ LoginUser currentUser = SecurityUtils.getLoginUser();
|
|
|
+ payOrder.setRefundUser(currentUser.getUser().getUserId());
|
|
|
+ payOrder.setRefundDate( new Date());
|
|
|
+ payOrder.setExaminStatus("1");
|
|
|
+ i=payOrderService.updatePayOrder(payOrder);
|
|
|
+ return AjaxResult.success(i);
|
|
|
+ }*/
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 撤回申请
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/recallApplyRefund")
|
|
|
+ public AjaxResult recallApplyRefund(@RequestBody PayOrder payOrder)
|
|
|
+ {
|
|
|
+ if(!"1".equals(payOrder.getStatus())){
|
|
|
+ return AjaxResult.error("当前订单不能撤回申请");
|
|
|
+ }
|
|
|
+ int i=0;
|
|
|
+ LoginUser currentUser = SecurityUtils.getLoginUser();
|
|
|
+ payOrder.setRefundUser(currentUser.getUser().getUserId());
|
|
|
+ payOrder.setRefundDate( new Date());
|
|
|
+ payOrder.setExaminStatus("0");
|
|
|
+ i=payOrderService.updatePayOrder(payOrder);
|
|
|
+ return AjaxResult.success(i);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 审核通过
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/examinRefundSuccess")
|
|
|
+ public AjaxResult examinRefundSuccess(@RequestBody PayOrder payOrder)
|
|
|
+ {
|
|
|
+
|
|
|
+ if(!"1".equals(payOrder.getStatus())){
|
|
|
+ return AjaxResult.error("当前订单不能进行退款");
|
|
|
+ }
|
|
|
+ if(!("1".equals(payOrder.getExaminStatus())||"4".equals(payOrder.getExaminStatus()))){
|
|
|
+ return AjaxResult.error("当前订单不能进行退款");
|
|
|
+ }
|
|
|
+ int i=0;
|
|
|
+ LoginUser currentUser = SecurityUtils.getLoginUser();
|
|
|
+ /* if("0".equals(currentUser.getUser().getDept().getRefundExaminStatus())){
|
|
|
+ return AjaxResult.error("当前集团未设置审核权限");
|
|
|
+ }*/
|
|
|
+ payOrder.setExaminUser(currentUser.getUser().getUserId());
|
|
|
+ payOrder.setExaminDate( new Date());
|
|
|
+ payOrder.setExaminStatus("2");
|
|
|
+
|
|
|
+ try {
|
|
|
+ payOrderService.sxfRefund(payOrder);
|
|
|
+ payOrder.setRefundSuccessDate(new Date());
|
|
|
+ payOrder.setStatus(null);
|
|
|
+ i=payOrderService.updatePayOrder(payOrder);
|
|
|
+ } catch (Exception e) {
|
|
|
+ //设置为退款失败的状态
|
|
|
+ payOrder.setExaminStatus("4");
|
|
|
+ payOrderService.updatePayOrder(payOrder);
|
|
|
+ return AjaxResult.error(e.getMessage());
|
|
|
}
|
|
|
- return respon;
|
|
|
+ return AjaxResult.success(i);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 审核驳回
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/examinRefundBack")
|
|
|
+ public AjaxResult examinRefundBack(@RequestBody PayOrder payOrder)
|
|
|
+ {
|
|
|
+ if(!"1".equals(payOrder.getStatus())){
|
|
|
+ return AjaxResult.error("当前订单不能进行退款");
|
|
|
+ }
|
|
|
+ if(!"1".equals(payOrder.getExaminStatus())){
|
|
|
+ return AjaxResult.error("当前订单不能进行退款");
|
|
|
+ }
|
|
|
+ int i=0;
|
|
|
+ LoginUser currentUser = SecurityUtils.getLoginUser();
|
|
|
+ if("0".equals(currentUser.getUser().getDept().getRefundExaminStatus())){
|
|
|
+ return AjaxResult.error("当前集团未设置审核权限");
|
|
|
+ }
|
|
|
+ payOrder.setExaminUser(currentUser.getUser().getUserId());
|
|
|
+ payOrder.setExaminDate( new Date());
|
|
|
+ payOrder.setExaminStatus("3");
|
|
|
+ try {
|
|
|
+ i=payOrderService.updatePayOrder(payOrder);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error(e.getMessage());
|
|
|
+ }
|
|
|
+ return AjaxResult.success(i);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 恢复正常付款状态
|
|
|
*/
|
|
@@ -551,12 +705,15 @@ public class PayOrderController extends BaseController
|
|
|
int i=0;
|
|
|
PayOrder payOrder=new PayOrder();
|
|
|
PayOrder payOrder1=payOrderService.selectPayOrderById(orderId);
|
|
|
+ if(payOrder1.getStatus().equals("3")){
|
|
|
+ return AjaxResult.error("已经被线上退款,不能回退");
|
|
|
+ }
|
|
|
if(payOrder1.getStatus().equals("1")){
|
|
|
return AjaxResult.error("已经支付成功,不能重新回退");
|
|
|
}
|
|
|
StationBalanceChange stationBalanceChange=new StationBalanceChange();
|
|
|
LoginUser currentUser = SecurityUtils.getLoginUser();
|
|
|
- stationBalanceChange.setAmt(payOrder1.getAmt());
|
|
|
+ stationBalanceChange.setAmt(payOrder1.getSellAmt());
|
|
|
stationBalanceChange.setStationId(payOrder1.getStationId());
|
|
|
stationBalanceChange.setType("-");
|
|
|
stationBalanceChange.setCreateBy(currentUser.getUser().getUserId()+"");
|
|
@@ -564,7 +721,7 @@ public class PayOrderController extends BaseController
|
|
|
SysDept dept1=deptService.selectDeptById(deptId);
|
|
|
SysDept dept=new SysDept();
|
|
|
Float Balance1= Float.parseFloat(dept1.getBalance().toString());
|
|
|
- Float value=Float.parseFloat(payOrder1.getAmt().toString());
|
|
|
+ Float value=Float.parseFloat(payOrder1.getSellAmt().toString());
|
|
|
stationBalanceChange.setNowAmt(dept1.getBalance());
|
|
|
dept.setDeptId(deptId);
|
|
|
dept.setBalance(BigDecimal.valueOf(Balance1-value));
|
|
@@ -769,7 +926,7 @@ public class PayOrderController extends BaseController
|
|
|
payOrder.setStationId(null);
|
|
|
}
|
|
|
startPage();
|
|
|
- payOrder.setStatus("1");
|
|
|
+ //payOrder.setStatus("1");
|
|
|
List<PayOrder> payOrderList = payOrderService.LNGDeptList(payOrder);
|
|
|
return getDataTable(payOrderList);
|
|
|
}
|
|
@@ -785,7 +942,7 @@ public class PayOrderController extends BaseController
|
|
|
payOrder.setStationId(null);
|
|
|
}
|
|
|
startPage();
|
|
|
- payOrder.setStatus("1");
|
|
|
+ //payOrder.setStatus("1");
|
|
|
List<PayOrder> payOrderList = payOrderService.selectLNGPayOrderExport(payOrder);
|
|
|
return getDataTable(payOrderList);
|
|
|
}
|
|
@@ -799,7 +956,7 @@ public class PayOrderController extends BaseController
|
|
|
payOrder.setStationIdList(list);
|
|
|
payOrder.setStationId(null);
|
|
|
}
|
|
|
- payOrder.setStatus("1");
|
|
|
+ //payOrder.setStatus("1");
|
|
|
List<PayOrder> payOrderList = payOrderService.selectLNGPayOrderExport(payOrder);
|
|
|
AjaxResult ss = exportExcel(payOrderList, "导出订单信息");
|
|
|
return ss;
|
|
@@ -982,7 +1139,7 @@ public class PayOrderController extends BaseController
|
|
|
payOrder.setStationIdList(list);
|
|
|
payOrder.setStationId(null);
|
|
|
}
|
|
|
- payOrder.setStatus("1");
|
|
|
+ //payOrder.setStatus("1");
|
|
|
List<PayOrder> payOrderList = payOrderService.LNGDeptList(payOrder);
|
|
|
AjaxResult ss = exportDeptExcel(payOrderList, "导出订单信息");
|
|
|
return ss;
|
|
@@ -1037,6 +1194,9 @@ public class PayOrderController extends BaseController
|
|
|
cell = row.createCell(10);
|
|
|
cell.setCellValue("手机号");
|
|
|
cell.setCellStyle(style);
|
|
|
+ cell = row.createCell(11);
|
|
|
+ cell.setCellValue("付款状态(1付款成功,2线下退款,3线上退款)");
|
|
|
+ cell.setCellStyle(style);
|
|
|
}else {
|
|
|
row = sheet.createRow(i);
|
|
|
int j =i-1;
|
|
@@ -1089,6 +1249,17 @@ public class PayOrderController extends BaseController
|
|
|
cell = row.createCell(10);
|
|
|
cell.setCellValue(payOrderList.get(j).getMobilePhone());
|
|
|
cell.setCellStyle(style);
|
|
|
+ cell = row.createCell(11);
|
|
|
+ if(payOrderList.get(j).getStatus().equals("1")) {
|
|
|
+ cell.setCellValue("支付成功");
|
|
|
+ }else if(payOrderList.get(j).getStatus().equals("2")){
|
|
|
+ cell.setCellValue("线下退款");
|
|
|
+ }else if(payOrderList.get(j).getStatus().equals("3")){
|
|
|
+ cell.setCellValue("线上退款");
|
|
|
+ }else{
|
|
|
+ cell.setCellValue("支付失败");
|
|
|
+ }
|
|
|
+ cell.setCellStyle(style);
|
|
|
}
|
|
|
}
|
|
|
String filename = encodingFilename(sheetName);
|
|
@@ -1228,4 +1399,7 @@ public class PayOrderController extends BaseController
|
|
|
}
|
|
|
return toAjaxee(i);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|