|
@@ -25,6 +25,7 @@ import com.github.zuihou.cfg.WxPayCfg;
|
|
|
import com.github.zuihou.context.BaseContextHandler;
|
|
|
import com.github.zuihou.database.mybatis.conditions.Wraps;
|
|
|
import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
|
|
|
+import com.github.zuihou.service.WxPayService;
|
|
|
import com.github.zuihou.utils.WxPayUtil;
|
|
|
import com.wechat.pay.contrib.apache.httpclient.auth.Verifier;
|
|
|
import com.wechat.pay.contrib.apache.httpclient.util.AesUtil;
|
|
@@ -83,6 +84,8 @@ public class AndroidApi {
|
|
|
private MiniAppService miniAppService;
|
|
|
@Autowired
|
|
|
private ProductionTenantResourceService productionTenantResourceService;
|
|
|
+ @Autowired
|
|
|
+ private WxPayService wxPayService;
|
|
|
|
|
|
|
|
|
// @ApiOperation("获取商品列表")
|
|
@@ -97,7 +100,7 @@ public class AndroidApi {
|
|
|
|
|
|
@ApiOperation("获取商品列表")
|
|
|
@GetMapping({"/goodsList"})
|
|
|
- public R<List<EquGoodsDto>> goodsList(@RequestParam(name = "equId",required = true) Long equId) {
|
|
|
+ public R<List<EquGoodsDto>> goodsList(@RequestParam(name = "equId", required = true) Long equId) {
|
|
|
BaseContextHandler.setTenant("0000");
|
|
|
List<EquGoodsDto> equGoods = productionTenantResourceService.getEquGoods(equId);
|
|
|
return R.success(equGoods);
|
|
@@ -160,7 +163,7 @@ public class AndroidApi {
|
|
|
|
|
|
@ApiOperation("订单状态查询接口")
|
|
|
@GetMapping({"/getOrder"})
|
|
|
- public R<Map<Object, Object>> getOrder(@RequestParam(name = "orderId" ,required = true) Long orderId) {
|
|
|
+ public R<Map<Object, Object>> getOrder(@RequestParam(name = "orderId", required = true) Long orderId) {
|
|
|
BaseContextHandler.setTenant("0000");
|
|
|
HashMap<Object, Object> resultMap = new HashMap<>();
|
|
|
Order order = orderService.getById(orderId);
|
|
@@ -179,7 +182,7 @@ public class AndroidApi {
|
|
|
|
|
|
@ApiOperation("料筒查询接口")
|
|
|
@PostMapping({"/getBarrelList"})
|
|
|
- public R<List<EquBarrel>> getBarrelList(@RequestParam(name="equId",required = true) Long equId) {
|
|
|
+ public R<List<EquBarrel>> getBarrelList(@RequestParam(name = "equId", required = true) Long equId) {
|
|
|
BaseContextHandler.setTenant("0000");
|
|
|
HashMap<String, Object> paramMap = new HashMap<>();
|
|
|
paramMap.put("equId", equId);
|
|
@@ -318,24 +321,56 @@ public class AndroidApi {
|
|
|
|
|
|
//修改订单状态接口
|
|
|
@PostMapping("/updateOrderSta")
|
|
|
- public R<Boolean> updateOrderSta(@RequestBody Map<String, String> req) {
|
|
|
+ public R<Boolean> updateOrderSta(@RequestBody Map<String, String> req) throws Exception {
|
|
|
BaseContextHandler.setTenant("0000");
|
|
|
String orderId = req.get("orderId");
|
|
|
String orderStatus = req.get("orderStatus");
|
|
|
String equId = req.get("equId");
|
|
|
String speId = req.get("speId");
|
|
|
|
|
|
- //只更新一个属性,把名字为rhb的用户年龄更新为18,其他属性不变
|
|
|
+// 安卓端超时后取消订单
|
|
|
+ if (orderStatus == "2") {
|
|
|
+ //调用微信支付api,关闭订单
|
|
|
+ int i = wxPayService.wxCloseOrder(orderId);
|
|
|
+ if (i == 204) {
|
|
|
+// 订单关闭成功,修改本地订单状态
|
|
|
+ UpdateWrapper<Order> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.eq("id", orderId).set("order_status", orderStatus);
|
|
|
+ boolean update = orderService.update(updateWrapper);
|
|
|
+ return R.success(update);
|
|
|
+ } else {
|
|
|
+ return R.fail("订单关闭失败,建议等待5秒,然后调用被扫订单结果查询API,查询当前订单的不同状态,决定下一步的操作");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 生产异常,发起退款
|
|
|
+ if (orderStatus == "4") {
|
|
|
+ //调用微信支付api,发起退款
|
|
|
+ int i = wxPayService.wxCloseOrder(orderId);
|
|
|
+ if (i == 204) {
|
|
|
+// 订单关闭成功,修改本地订单状态
|
|
|
+ UpdateWrapper<Order> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.eq("id", orderId).set("order_status", orderStatus);
|
|
|
+ boolean update = orderService.update(updateWrapper);
|
|
|
+ return R.success(update);
|
|
|
+ } else {
|
|
|
+ return R.fail("订单关闭失败,建议等待5秒,然后调用被扫订单结果查询API,查询当前订单的不同状态,决定下一步的操作");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- UpdateWrapper<Order> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.eq("id", orderId).set("order_status", orderStatus);
|
|
|
- boolean update = orderService.update(updateWrapper);
|
|
|
if (orderStatus == "5") {
|
|
|
+ UpdateWrapper<Order> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.eq("id", orderId).set("order_status", orderStatus);
|
|
|
+ boolean update = orderService.update(updateWrapper);
|
|
|
// 生产完成,扣减物料,更新料筒和商品状态
|
|
|
-
|
|
|
barrelService.updateBarrel(speId, equId);
|
|
|
+ return R.success(update);
|
|
|
}
|
|
|
+
|
|
|
+ UpdateWrapper<Order> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.eq("id", orderId).set("order_status", orderStatus);
|
|
|
+ boolean update = orderService.update(updateWrapper);
|
|
|
+
|
|
|
return R.success(update);
|
|
|
}
|
|
|
|