修复支付等相关问题
This commit is contained in:
@@ -24,6 +24,7 @@ import com.gxwebsoft.shop.service.MerchantService;
|
|||||||
import com.gxwebsoft.shop.service.OrderService;
|
import com.gxwebsoft.shop.service.OrderService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -39,6 +40,7 @@ import static com.gxwebsoft.common.core.constants.OrderConstants.*;
|
|||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2022-11-30 02:11:16
|
* @since 2022-11-30 02:11:16
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Api(tags = "设备管理管理")
|
@Api(tags = "设备管理管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/apps/equipment")
|
@RequestMapping("/api/apps/equipment")
|
||||||
@@ -71,7 +73,7 @@ public class EquipmentController extends BaseController {
|
|||||||
@ApiOperation("查询全部设备管理")
|
@ApiOperation("查询全部设备管理")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public ApiResult<List<Equipment>> list(EquipmentParam param) {
|
public ApiResult<List<Equipment>> list(EquipmentParam param) {
|
||||||
PageParam<Equipment, EquipmentParam> page = new PageParam<>(param);
|
// PageParam<Equipment, EquipmentParam> page = new PageParam<>(param);
|
||||||
// page.setDefaultOrder("create_time desc");
|
// page.setDefaultOrder("create_time desc");
|
||||||
// return success(equipmentService.list(page.getOrderWrapper()));
|
// return success(equipmentService.list(page.getOrderWrapper()));
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
@@ -131,6 +133,7 @@ public class EquipmentController extends BaseController {
|
|||||||
@OperationLog
|
@OperationLog
|
||||||
@ApiOperation("绑定设备")
|
@ApiOperation("绑定设备")
|
||||||
@PutMapping("/bind")
|
@PutMapping("/bind")
|
||||||
|
@Deprecated
|
||||||
public ApiResult<?> bindEquipment(@RequestBody Equipment equipment) {
|
public ApiResult<?> bindEquipment(@RequestBody Equipment equipment) {
|
||||||
final Integer orderId = equipment.getOrderId();
|
final Integer orderId = equipment.getOrderId();
|
||||||
final Order order = orderService.getById(orderId);
|
final Order order = orderService.getById(orderId);
|
||||||
@@ -159,7 +162,7 @@ public class EquipmentController extends BaseController {
|
|||||||
record.setMerchantCode(one.getMerchantCode());
|
record.setMerchantCode(one.getMerchantCode());
|
||||||
equipmentRecordService.save(record);
|
equipmentRecordService.save(record);
|
||||||
// 订单发货
|
// 订单发货
|
||||||
order.setDeliveryStatus(DELIVERY_STATUS_YES);
|
order.setDeliveryStatus(DELIVERY_STATUS_ACCEPT);
|
||||||
order.setOrderStatus(ORDER_STATUS_COMPLETED);
|
order.setOrderStatus(ORDER_STATUS_COMPLETED);
|
||||||
if(order.getOrderSource() == 10) {
|
if(order.getOrderSource() == 10) {
|
||||||
order.setOrderStatus(ORDER_STATUS_OVER);
|
order.setOrderStatus(ORDER_STATUS_OVER);
|
||||||
@@ -225,7 +228,7 @@ public class EquipmentController extends BaseController {
|
|||||||
AlipayOpenAppQrcodeCreateRequest request = new AlipayOpenAppQrcodeCreateRequest();
|
AlipayOpenAppQrcodeCreateRequest request = new AlipayOpenAppQrcodeCreateRequest();
|
||||||
AlipayOpenAppQrcodeCreateModel model = new AlipayOpenAppQrcodeCreateModel();
|
AlipayOpenAppQrcodeCreateModel model = new AlipayOpenAppQrcodeCreateModel();
|
||||||
model.setUrlParam("pages/equipment/equipment?equipmentId=".concat(equipment.getEquipmentId().toString()));
|
model.setUrlParam("pages/equipment/equipment?equipmentId=".concat(equipment.getEquipmentId().toString()));
|
||||||
System.out.println("equipment = " + equipment);
|
log.info("equipment = " + equipment);
|
||||||
// __id__=2&merchantCode=M311539&merchantId=52
|
// __id__=2&merchantCode=M311539&merchantId=52
|
||||||
// pages/equipment/equipment
|
// pages/equipment/equipment
|
||||||
|
|
||||||
@@ -238,16 +241,15 @@ public class EquipmentController extends BaseController {
|
|||||||
model.setDescribe("扫码租赁电池");
|
model.setDescribe("扫码租赁电池");
|
||||||
request.setBizModel(model);
|
request.setBizModel(model);
|
||||||
AlipayOpenAppQrcodeCreateResponse response = alipayClient.certificateExecute(request);
|
AlipayOpenAppQrcodeCreateResponse response = alipayClient.certificateExecute(request);
|
||||||
System.out.println(response.getBody());
|
log.info("支付宝扫码返回:{}", response.getBody());
|
||||||
if (response.isSuccess()) {
|
if (response.isSuccess()) {
|
||||||
System.out.println("调用成功");
|
|
||||||
final JSONObject jsonObject = JSONObject.parseObject(response.getBody());
|
final JSONObject jsonObject = JSONObject.parseObject(response.getBody());
|
||||||
final String alipay_open_app_qrcode_create_response = jsonObject.getString("alipay_open_app_qrcode_create_response");
|
final String alipay_open_app_qrcode_create_response = jsonObject.getString("alipay_open_app_qrcode_create_response");
|
||||||
final JSONObject jsonObject1 = JSONObject.parseObject(alipay_open_app_qrcode_create_response);
|
final JSONObject jsonObject1 = JSONObject.parseObject(alipay_open_app_qrcode_create_response);
|
||||||
String qrCodeUrl = jsonObject1.getString("qr_code_url");
|
String qrCodeUrl = jsonObject1.getString("qr_code_url");
|
||||||
return qrCodeUrl;
|
return qrCodeUrl;
|
||||||
} else {
|
} else {
|
||||||
System.out.println("调用失败");
|
log.error("支付宝扫码调用失败");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -255,6 +257,7 @@ public class EquipmentController extends BaseController {
|
|||||||
@PreAuthorize("hasAuthority('apps:equipment:update')")
|
@PreAuthorize("hasAuthority('apps:equipment:update')")
|
||||||
@ApiOperation("确认收货")
|
@ApiOperation("确认收货")
|
||||||
@PostMapping("/receipt")
|
@PostMapping("/receipt")
|
||||||
|
@Deprecated
|
||||||
public ApiResult<?> receipt(@RequestBody Order order) {
|
public ApiResult<?> receipt(@RequestBody Order order) {
|
||||||
orderService.updateById(order);
|
orderService.updateById(order);
|
||||||
return success("确认收货");
|
return success("确认收货");
|
||||||
|
|||||||
@@ -105,6 +105,12 @@
|
|||||||
<if test="param.merchantCode != null">
|
<if test="param.merchantCode != null">
|
||||||
AND b.merchant_code = #{param.merchantCode}
|
AND b.merchant_code = #{param.merchantCode}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.isBind == 0">
|
||||||
|
AND a.user_id = 0
|
||||||
|
</if>
|
||||||
|
<if test="param.isBind == 1">
|
||||||
|
AND a.user_id > 0
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|||||||
@@ -124,4 +124,6 @@ public class EquipmentParam extends BaseParam {
|
|||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private String merchantName;
|
private String merchantName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否绑定")
|
||||||
|
private Byte isBind;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.gxwebsoft.apps.service;
|
package com.gxwebsoft.apps.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.apps.entity.Equipment;
|
import com.gxwebsoft.apps.entity.Equipment;
|
||||||
import com.gxwebsoft.apps.param.EquipmentParam;
|
import com.gxwebsoft.apps.param.EquipmentParam;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.gxwebsoft.apps.service.impl;
|
package com.gxwebsoft.apps.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gxwebsoft.apps.mapper.EquipmentMapper;
|
import com.gxwebsoft.apps.mapper.EquipmentMapper;
|
||||||
@@ -10,6 +12,7 @@ import com.gxwebsoft.common.core.web.PageParam;
|
|||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
import com.gxwebsoft.common.system.service.UserService;
|
import com.gxwebsoft.common.system.service.UserService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@@ -27,6 +30,7 @@ import java.util.stream.Collectors;
|
|||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2022-11-30 02:11:16
|
* @since 2022-11-30 02:11:16
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment> implements EquipmentService {
|
public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment> implements EquipmentService {
|
||||||
@Resource
|
@Resource
|
||||||
@@ -42,8 +46,15 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||||||
List<Equipment> list = baseMapper.selectPageRel(page, param);
|
List<Equipment> list = baseMapper.selectPageRel(page, param);
|
||||||
|
|
||||||
Set<Integer> touziUserIds = list.stream().map(Equipment::getTouziUserId).collect(Collectors.toSet());
|
Set<Integer> touziUserIds = list.stream().map(Equipment::getTouziUserId).collect(Collectors.toSet());
|
||||||
List<User> touziUserList = userService.lambdaQuery().in(User::getUserId, touziUserIds).list();
|
// List<User> touziUserList = userService.lambdaQuery().in(User::getUserId, touziUserIds).list();
|
||||||
Map<Integer, List<User>> touziUserCollect = touziUserList.stream().collect(Collectors.groupingBy(User::getUserId));
|
Map<Integer, User> touziUserCollect = null;
|
||||||
|
if(CollectionUtil.isNotEmpty(touziUserIds)){
|
||||||
|
List<User> touziUserList = userService.listByIds(touziUserIds);
|
||||||
|
if(CollectionUtil.isNotEmpty(touziUserList)){
|
||||||
|
touziUserCollect = touziUserList.stream().collect(Collectors.toMap(User::getUserId, e->e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 查询绑定电池的用户
|
// 查询绑定电池的用户
|
||||||
for (Equipment equipment : list) {
|
for (Equipment equipment : list) {
|
||||||
// 查询状态
|
// 查询状态
|
||||||
@@ -52,31 +63,36 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||||||
JSONObject body = entity.getBody();
|
JSONObject body = entity.getBody();
|
||||||
Integer code = body.getInteger("code");
|
Integer code = body.getInteger("code");
|
||||||
JSONObject data = body.getJSONObject("data");
|
JSONObject data = body.getJSONObject("data");
|
||||||
equipment.setBms(data.getString("bms_zt"));
|
if(null != data){
|
||||||
equipment.setBatteryPower(data.getString("sydl"));
|
equipment.setBms(data.getString("bms_zt"));
|
||||||
equipment.setTotalVoltage(data.getString("sbdy"));
|
equipment.setBatteryPower(data.getString("sydl"));
|
||||||
equipment.setGps(data.getString("gps_xh"));
|
equipment.setTotalVoltage(data.getString("sbdy"));
|
||||||
equipment.setGsm(data.getString("gsm_xh"));
|
equipment.setGps(data.getString("gps_xh"));
|
||||||
equipment.setWorkingStatus(data.getString("sbzt"));
|
equipment.setGsm(data.getString("gsm_xh"));
|
||||||
System.out.println(body);
|
equipment.setWorkingStatus(data.getString("sbzt"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
log.warn("获取电池信息返回失败!{}", JSON.toJSONString(body));
|
||||||
|
}
|
||||||
|
|
||||||
|
// System.out.println(body);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
if (!equipment.getUserId().equals(0)) {
|
if (!equipment.getUserId().equals(0)) {
|
||||||
equipment.setUser(userService.getById(equipment.getUserId()));
|
equipment.setUser(userService.getById(equipment.getUserId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(CollectionUtil.isNotEmpty(touziUserCollect) &&
|
||||||
if ( equipment.getTouziUserId()!= null && !equipment.getTouziUserId().equals(0)) {
|
equipment.getTouziUserId()!= null && !equipment.getTouziUserId().equals(0)) {
|
||||||
List<User> users = touziUserCollect.get(equipment.getTouziUserId());
|
User tUser = touziUserCollect.get(equipment.getTouziUserId());
|
||||||
if(!CollectionUtils.isEmpty(users)) {
|
if(null != tUser){
|
||||||
equipment.setTouziUser(users.get(0));
|
equipment.setTouziUser(tUser);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return new PageResult<>(list, page.getTotal());
|
return new PageResult<>(list, page.getTotal());
|
||||||
}
|
}
|
||||||
@@ -100,18 +116,20 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
|
|||||||
JSONObject body = entity.getBody();
|
JSONObject body = entity.getBody();
|
||||||
Integer code = body.getInteger("code");
|
Integer code = body.getInteger("code");
|
||||||
JSONObject data = body.getJSONObject("data");
|
JSONObject data = body.getJSONObject("data");
|
||||||
equipment.setBms(data.getString("bms_zt"));
|
if(null != data){
|
||||||
equipment.setBatteryPower(data.getString("sydl"));
|
equipment.setBms(data.getString("bms_zt"));
|
||||||
equipment.setTotalVoltage(data.getString("sbdy"));
|
equipment.setBatteryPower(data.getString("sydl"));
|
||||||
equipment.setGps(data.getString("gps_xh"));
|
equipment.setTotalVoltage(data.getString("sbdy"));
|
||||||
equipment.setGsm(data.getString("gsm_xh"));
|
equipment.setGps(data.getString("gps_xh"));
|
||||||
equipment.setWorkingStatus(data.getString("sbzt"));
|
equipment.setGsm(data.getString("gsm_xh"));
|
||||||
System.out.println(body);
|
equipment.setWorkingStatus(data.getString("sbzt"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
log.warn("获取电池信息返回失败!{}", JSON.toJSONString(body));
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return equipment;
|
return equipment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import cn.hutool.core.date.DateField;
|
|||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUnit;
|
import cn.hutool.core.date.DateUnit;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import com.alipay.api.AlipayApiException;
|
import com.alipay.api.AlipayApiException;
|
||||||
@@ -100,7 +101,8 @@ public class OrderTask {
|
|||||||
/**
|
/**
|
||||||
* 计算逾期
|
* 计算逾期
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0/3 * * * ? ")
|
// @Scheduled(cron = "1 0 0 * * ? ")
|
||||||
|
@Scheduled(cron="${cron.timeoutOrder:-}")
|
||||||
public void removeTimeoutOrder() {
|
public void removeTimeoutOrder() {
|
||||||
DateTime now = DateUtil.date();
|
DateTime now = DateUtil.date();
|
||||||
|
|
||||||
@@ -112,18 +114,33 @@ public class OrderTask {
|
|||||||
.eq(Order::getIsRenew, 0) // 主订单
|
.eq(Order::getIsRenew, 0) // 主订单
|
||||||
.lt(Order::getExpirationTime, now); //已逾期
|
.lt(Order::getExpirationTime, now); //已逾期
|
||||||
|
|
||||||
|
|
||||||
List<Order> list = orderService.list(wrapper);
|
List<Order> list = orderService.list(wrapper);
|
||||||
if (CollectionUtils.isEmpty(list)) {
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Set<Integer> ids = list.stream().map(Order::getOrderId).collect(Collectors.toSet());
|
||||||
|
|
||||||
|
LambdaQueryWrapper<OrderPay> renewWrapper = Wrappers.lambdaQuery();
|
||||||
|
renewWrapper.select(OrderPay::getRentOrderId)
|
||||||
|
.in(OrderPay::getRentOrderId, ids)
|
||||||
|
.eq(OrderPay::getPayStatus, PAY_STATUS_NO_PAY);
|
||||||
|
List<OrderPay> renewOrders = orderPayService.list(renewWrapper);
|
||||||
|
if(CollectionUtil.isNotEmpty(renewOrders)){
|
||||||
|
List<Integer> orderIdRenews = renewOrders.stream().map(OrderPay::getRentOrderId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
list = list.stream().filter(e->!orderIdRenews.contains(e.getOrderId())).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
Map<Integer, List<Order>> collect = list.stream().collect(Collectors.groupingBy(Order::getOrderId));
|
Map<Integer, List<Order>> collect = list.stream().collect(Collectors.groupingBy(Order::getOrderId));
|
||||||
Set<Integer> ids = collect.keySet();
|
|
||||||
|
|
||||||
// 是否已生成当期续费订单
|
// 是否已生成当期续费订单
|
||||||
LambdaQueryWrapper<OrderPay> renewWrapper = Wrappers.lambdaQuery(OrderPay.class).in(OrderPay::getRentOrderId, ids).groupBy(OrderPay::getRentOrderId).orderByDesc(OrderPay::getCreateTime);
|
// LambdaQueryWrapper<OrderPay> renewWrapper = Wrappers.lambdaQuery(OrderPay.class)
|
||||||
Page<OrderPay> page = new Page<OrderPay>(1, 1);
|
renewWrapper.clear();
|
||||||
|
renewWrapper
|
||||||
|
.in(OrderPay::getRentOrderId, ids)
|
||||||
|
.groupBy(OrderPay::getRentOrderId).orderByDesc(OrderPay::getCreateTime);
|
||||||
|
Page<OrderPay> page = new Page<>(1, 1);
|
||||||
List<OrderPay> renewOrderList = orderPayService.page(page, renewWrapper).getRecords();
|
List<OrderPay> renewOrderList = orderPayService.page(page, renewWrapper).getRecords();
|
||||||
|
|
||||||
//查找订单关联的商品
|
//查找订单关联的商品
|
||||||
@@ -135,7 +152,6 @@ public class OrderTask {
|
|||||||
// 计算逾期
|
// 计算逾期
|
||||||
EquipmentOrderGoods eg = orderGoodsMap.get(item.getRentOrderId()).get(0);
|
EquipmentOrderGoods eg = orderGoodsMap.get(item.getRentOrderId()).get(0);
|
||||||
|
|
||||||
|
|
||||||
// 是否需要新增续费订单
|
// 是否需要新增续费订单
|
||||||
if (item.getExpirationTime().before(now) && item.getCurrPeriods() < item.getPeriods()) {
|
if (item.getExpirationTime().before(now) && item.getCurrPeriods() < item.getPeriods()) {
|
||||||
OrderPay newRenewOrder = new OrderPay();
|
OrderPay newRenewOrder = new OrderPay();
|
||||||
@@ -174,7 +190,6 @@ public class OrderTask {
|
|||||||
newRenewOrder.setPayPrice(eg.getBatteryPrice());
|
newRenewOrder.setPayPrice(eg.getBatteryPrice());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
orderPayService.save(newRenewOrder);
|
orderPayService.save(newRenewOrder);
|
||||||
// 已生成订单未付款
|
// 已生成订单未付款
|
||||||
} else if (item.getPayStatus().equals(PAY_STATUS_NO_PAY) && now.isAfter(item.getStartTime())) {
|
} else if (item.getPayStatus().equals(PAY_STATUS_NO_PAY) && now.isAfter(item.getStartTime())) {
|
||||||
@@ -188,7 +203,6 @@ public class OrderTask {
|
|||||||
orderService.lambdaUpdate().eq(Order::getOrderId, item.getRentOrderId()).set(Order::getExpirationDay, between).update();
|
orderService.lambdaUpdate().eq(Order::getOrderId, item.getRentOrderId()).set(Order::getExpirationDay, between).update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// if(between > 1) {
|
// if(between > 1) {
|
||||||
// Order order = collect.get(item.getRentOrderId()).get(0);
|
// Order order = collect.get(item.getRentOrderId()).get(0);
|
||||||
// // 电池停电
|
// // 电池停电
|
||||||
@@ -206,10 +220,10 @@ public class OrderTask {
|
|||||||
/**
|
/**
|
||||||
* 计算分润
|
* 计算分润
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron="0 0/1 * * * ? ")
|
// @Scheduled(cron="0 0/2 * * * ? ")
|
||||||
|
@Scheduled(cron="${cron.profit:-}")
|
||||||
@Transactional
|
@Transactional
|
||||||
public void CalcProfit() {
|
public void CalcProfit() {
|
||||||
log.info("开始计算分润");
|
|
||||||
// 查询所有未结算订单
|
// 查询所有未结算订单
|
||||||
LambdaQueryWrapper<OrderPay> wrapper = Wrappers.lambdaQuery(OrderPay.class)
|
LambdaQueryWrapper<OrderPay> wrapper = Wrappers.lambdaQuery(OrderPay.class)
|
||||||
.eq(OrderPay::getIsSettled, ORDER_SETTLED_NO)
|
.eq(OrderPay::getIsSettled, ORDER_SETTLED_NO)
|
||||||
@@ -329,24 +343,28 @@ public class OrderTask {
|
|||||||
}
|
}
|
||||||
Equipment equipment = equipmentMap.get(order.getEquipmentId());
|
Equipment equipment = equipmentMap.get(order.getEquipmentId());
|
||||||
// 投资人收益
|
// 投资人收益
|
||||||
|
String orderNo = order.getOrderNo();
|
||||||
if (touziProfit.compareTo(BigDecimal.ZERO) > 0 && equipment!= null) {
|
if (touziProfit.compareTo(BigDecimal.ZERO) > 0 && equipment!= null) {
|
||||||
|
|
||||||
User touziUser = touziUserMap.get(equipment.getTouziUserId());
|
User touziUser = touziUserMap.get(equipment.getTouziUserId());
|
||||||
if (touziUser != null) {
|
if (touziUser != null) {
|
||||||
userService.updateBalanceByUserId(touziUser.getUserId(), touziProfit);
|
Integer userId = touziUser.getUserId();
|
||||||
|
userService.updateBalanceByUserId(userId, touziProfit);
|
||||||
ProfitLog profitLog = new ProfitLog();
|
ProfitLog profitLog = new ProfitLog();
|
||||||
profitLog.setUserId(touziUser.getUserId());
|
profitLog.setUserId(userId);
|
||||||
profitLog.setMoney(touziProfit);
|
profitLog.setMoney(touziProfit);
|
||||||
profitLog.setScene(1);
|
profitLog.setScene(1);
|
||||||
profitLog.setMerchantCode(merchant.getMerchantCode());
|
profitLog.setMerchantCode(merchant.getMerchantCode());
|
||||||
|
profitLog.setMerchantName(merchant.getMerchantName());
|
||||||
profitLog.setOrderId(order.getId());
|
profitLog.setOrderId(order.getId());
|
||||||
profitLog.setOrderNo(order.getOrderNo());
|
profitLog.setOrderNo(orderNo);
|
||||||
|
profitLog.setOrderUserName(orderUser.getNickname());
|
||||||
profitLog.setComments("投资设备:" + equipment.getEquipmentCode());
|
profitLog.setComments("投资设备:" + equipment.getEquipmentCode());
|
||||||
profitLog.setEquipmentCode(equipment.getEquipmentCode());
|
profitLog.setEquipmentCode(equipment.getEquipmentCode());
|
||||||
profitLog.setMerchantName(merchant.getMerchantName());
|
|
||||||
profitLog.setOrderSource(order.getOrderSource());
|
profitLog.setOrderSource(order.getOrderSource());
|
||||||
// profitLog.setIsRenew(order.getIsRenew());
|
// profitLog.setIsRenew(order.getIsRenew());
|
||||||
profitLogService.save(profitLog);
|
profitLogService.save(profitLog);
|
||||||
|
log.info("发放投资人{}分润,订单号{}!", userId, orderNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -354,20 +372,23 @@ public class OrderTask {
|
|||||||
if (tuijianProfit.compareTo(BigDecimal.ZERO) > 0) {
|
if (tuijianProfit.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
User tuijianUser = tuijianUserMap.get(order.getDealerPhone());
|
User tuijianUser = tuijianUserMap.get(order.getDealerPhone());
|
||||||
if (tuijianUser != null) {
|
if (tuijianUser != null) {
|
||||||
userService.updateBalanceByUserId(tuijianUser.getUserId(), tuijianProfit);
|
Integer tuijianUserUserId = tuijianUser.getUserId();
|
||||||
|
userService.updateBalanceByUserId(tuijianUserUserId, tuijianProfit);
|
||||||
ProfitLog profitLog = new ProfitLog();
|
ProfitLog profitLog = new ProfitLog();
|
||||||
profitLog.setUserId(tuijianUser.getUserId());
|
profitLog.setUserId(tuijianUserUserId);
|
||||||
profitLog.setMoney(tuijianProfit);
|
profitLog.setMoney(tuijianProfit);
|
||||||
profitLog.setScene(3);
|
profitLog.setScene(3);
|
||||||
profitLog.setMerchantCode(merchant.getMerchantCode());
|
profitLog.setMerchantCode(merchant.getMerchantCode());
|
||||||
|
profitLog.setMerchantName(merchant.getMerchantName());
|
||||||
profitLog.setOrderId(order.getId());
|
profitLog.setOrderId(order.getId());
|
||||||
profitLog.setOrderNo(order.getOrderNo());
|
profitLog.setOrderNo(orderNo);
|
||||||
|
profitLog.setOrderUserName(orderUser.getNickname());
|
||||||
profitLog.setComments("推广收益:" + order.getUserId());
|
profitLog.setComments("推广收益:" + order.getUserId());
|
||||||
profitLog.setEquipmentCode(equipment.getEquipmentCode());
|
profitLog.setEquipmentCode(equipment.getEquipmentCode());
|
||||||
profitLog.setMerchantName(merchant.getMerchantName());
|
|
||||||
profitLog.setOrderSource(order.getOrderSource());
|
profitLog.setOrderSource(order.getOrderSource());
|
||||||
// profitLog.setIsRenew(order.getIsRenew());
|
// profitLog.setIsRenew(order.getIsRenew());
|
||||||
profitLogService.save(profitLog);
|
profitLogService.save(profitLog);
|
||||||
|
log.info("发放推荐人{}分润,订单号{}!", tuijianUserUserId, orderNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,13 +404,15 @@ public class OrderTask {
|
|||||||
profitLog.setScene(4);
|
profitLog.setScene(4);
|
||||||
profitLog.setMerchantCode(merchant.getMerchantCode());
|
profitLog.setMerchantCode(merchant.getMerchantCode());
|
||||||
profitLog.setOrderId(order.getId());
|
profitLog.setOrderId(order.getId());
|
||||||
profitLog.setOrderNo(order.getOrderNo());
|
profitLog.setOrderNo(orderNo);
|
||||||
|
profitLog.setOrderUserName(orderUser.getNickname());
|
||||||
profitLog.setComments("门店收益:" + order.getMerchantCode());
|
profitLog.setComments("门店收益:" + order.getMerchantCode());
|
||||||
profitLog.setEquipmentCode(equipment.getEquipmentCode());
|
profitLog.setEquipmentCode(equipment.getEquipmentCode());
|
||||||
profitLog.setMerchantName(merchant.getMerchantName());
|
profitLog.setMerchantName(merchant.getMerchantName());
|
||||||
profitLog.setOrderSource(order.getOrderSource());
|
profitLog.setOrderSource(order.getOrderSource());
|
||||||
// profitLog.setIsRenew(order.getIsRenew());
|
// profitLog.setIsRenew(order.getIsRenew());
|
||||||
profitLogService.save(profitLog);
|
profitLogService.save(profitLog);
|
||||||
|
log.info("发放门店{}分润,订单号{}!", mendianUserId, orderNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 计算区域经理收益
|
// 计算区域经理收益
|
||||||
@@ -406,20 +429,23 @@ public class OrderTask {
|
|||||||
}).findFirst().orElse(null);
|
}).findFirst().orElse(null);
|
||||||
}
|
}
|
||||||
if (manager != null) {
|
if (manager != null) {
|
||||||
userService.updateBalanceByUserId(manager.getUserId(), jingliProfit);
|
Integer managerUserId = manager.getUserId();
|
||||||
|
userService.updateBalanceByUserId(managerUserId, jingliProfit);
|
||||||
ProfitLog profitLog = new ProfitLog();
|
ProfitLog profitLog = new ProfitLog();
|
||||||
profitLog.setUserId(manager.getUserId());
|
profitLog.setUserId(managerUserId);
|
||||||
profitLog.setMoney(jingliProfit);
|
profitLog.setMoney(jingliProfit);
|
||||||
profitLog.setMerchantCode(merchant.getMerchantCode());
|
profitLog.setMerchantCode(merchant.getMerchantCode());
|
||||||
profitLog.setScene(5);
|
profitLog.setScene(5);
|
||||||
profitLog.setOrderId(order.getId());
|
profitLog.setOrderId(order.getId());
|
||||||
profitLog.setOrderNo(order.getOrderNo());
|
profitLog.setOrderNo(orderNo);
|
||||||
|
profitLog.setOrderUserName(orderUser.getNickname());
|
||||||
profitLog.setComments("区域经理收益:" + order.getMerchantCode());
|
profitLog.setComments("区域经理收益:" + order.getMerchantCode());
|
||||||
profitLog.setEquipmentCode(equipment.getEquipmentCode());
|
profitLog.setEquipmentCode(equipment.getEquipmentCode());
|
||||||
profitLog.setMerchantName(merchant.getMerchantName());
|
profitLog.setMerchantName(merchant.getMerchantName());
|
||||||
profitLog.setOrderSource(order.getOrderSource());
|
profitLog.setOrderSource(order.getOrderSource());
|
||||||
// profitLog.setIsRenew(order.getIsRenew());
|
// profitLog.setIsRenew(order.getIsRenew());
|
||||||
profitLogService.save(profitLog);
|
profitLogService.save(profitLog);
|
||||||
|
log.info("发放区域经理{}分润,订单号{}!", managerUserId, orderNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -435,7 +461,8 @@ public class OrderTask {
|
|||||||
/**
|
/**
|
||||||
* 逾期预警
|
* 逾期预警
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 30 9 * * ? ")
|
// @Scheduled(cron = "0 30 9 * * ? ")
|
||||||
|
@Scheduled(cron = "${cron.alert:-}")
|
||||||
public void exceedAlert() {
|
public void exceedAlert() {
|
||||||
List<Order> alertList = orderService.findAlertList();
|
List<Order> alertList = orderService.findAlertList();
|
||||||
if(CollectionUtil.isNotEmpty(alertList)){
|
if(CollectionUtil.isNotEmpty(alertList)){
|
||||||
@@ -455,14 +482,14 @@ public class OrderTask {
|
|||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info("发送订单到期预警通知结束!总数{}条,成功{}条!", alertList.size(), succ);
|
log.info(">>>>>>>>>>>>>>>>>>发送订单到期预警通知结束!总数{}条,成功{}条!", alertList.size(), succ);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Order> overdueList = orderService.findAlertList();
|
List<Order> overdueList = orderService.findAlertList();
|
||||||
if(CollectionUtil.isNotEmpty(overdueList)) {
|
if(CollectionUtil.isNotEmpty(overdueList)) {
|
||||||
log.info("开始发送订单超期提醒通知!");
|
log.info("开始发送订单超期提醒通知!");
|
||||||
int succ = 0;
|
int succ = 0;
|
||||||
for(Order order : alertList){
|
for(Order order : overdueList){
|
||||||
SmsCaptchaParam aram = SmsCaptchaParam.builder()
|
SmsCaptchaParam aram = SmsCaptchaParam.builder()
|
||||||
.phone(order.getPhone())
|
.phone(order.getPhone())
|
||||||
.type(ESmsType.OVERDUE.name())
|
.type(ESmsType.OVERDUE.name())
|
||||||
@@ -476,7 +503,8 @@ public class OrderTask {
|
|||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info("发送逾期提醒通知结束!总数{}条,成功{}条!", alertList.size(), succ);
|
log.info("====================发送逾期提醒通知结束!总数{}条,成功{}条!", overdueList.size(), succ);
|
||||||
}
|
}
|
||||||
|
log.info("------------逾期预警处理结束!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import cn.hutool.extra.servlet.ServletUtil;
|
import cn.hutool.extra.servlet.ServletUtil;
|
||||||
import cn.hutool.http.useragent.UserAgent;
|
import cn.hutool.http.useragent.UserAgent;
|
||||||
import cn.hutool.http.useragent.UserAgentUtil;
|
import cn.hutool.http.useragent.UserAgentUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
import com.gxwebsoft.common.core.annotation.OperationModule;
|
import com.gxwebsoft.common.core.annotation.OperationModule;
|
||||||
@@ -179,7 +180,7 @@ public class OperationLogAspect {
|
|||||||
|| arg instanceof HttpServletResponse) {
|
|| arg instanceof HttpServletResponse) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
sb.append(JSONUtil.toJSONString(arg)).append(" ");
|
sb.append(JSON.toJSONString(arg)).append(" ");
|
||||||
}
|
}
|
||||||
params = sb.toString();
|
params = sb.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.gxwebsoft.common.core.config;
|
package com.gxwebsoft.common.core.config;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
|
|
||||||
@@ -11,5 +13,8 @@ public class HttpMessageConverter extends MappingJackson2HttpMessageConverter {
|
|||||||
List<MediaType> mediaTypes = new ArrayList<>();
|
List<MediaType> mediaTypes = new ArrayList<>();
|
||||||
mediaTypes.add(MediaType.APPLICATION_FORM_URLENCODED);
|
mediaTypes.add(MediaType.APPLICATION_FORM_URLENCODED);
|
||||||
setSupportedMediaTypes(mediaTypes);
|
setSupportedMediaTypes(mediaTypes);
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
|
this.setObjectMapper(objectMapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import org.springframework.http.client.ClientHttpRequestFactory;
|
|||||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class RestTemplateConfig {
|
public class RestTemplateConfig {
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.gxwebsoft.common.core.constants;
|
package com.gxwebsoft.common.core.constants;
|
||||||
|
|
||||||
public class BalanceConstants {
|
public interface BalanceConstants {
|
||||||
// 余额变动场景
|
// 余额变动场景
|
||||||
public static final Integer BALANCE_RECHARGE = 10; // 用户充值
|
public static final Integer BALANCE_RECHARGE = 10; // 用户充值
|
||||||
public static final Integer BALANCE_USE = 20; // 用户消费
|
public static final Integer BALANCE_USE = 20; // 用户消费
|
||||||
public static final Integer BALANCE_RE_LET = 21; // 续租
|
public static final Integer BALANCE_RE_LET = 21; // 续租
|
||||||
public static final Integer BALANCE_ADMIN = 30; // 管理员操作
|
public static final Integer BALANCE_ADMIN = 30; // 管理员操作
|
||||||
public static final Integer BALANCE_REFUND = 40; // 订单退款
|
public static final Integer BALANCE_REFUND = 40; // 订单退款
|
||||||
|
public static final Integer BALANCE_WITHDRAW = 50; // 提现
|
||||||
|
public static final Integer BALANCE_WITHDRAW_REJECT = 60; // 提现失败
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public class OrderConstants {
|
|||||||
public static final Integer DELIVERY_STATUS_NO = 10; // 未发货
|
public static final Integer DELIVERY_STATUS_NO = 10; // 未发货
|
||||||
public static final Integer DELIVERY_STATUS_YES = 20; // 已发货
|
public static final Integer DELIVERY_STATUS_YES = 20; // 已发货
|
||||||
public static final Integer DELIVERY_STATUS_30 = 30; // 部分发货
|
public static final Integer DELIVERY_STATUS_30 = 30; // 部分发货
|
||||||
|
public static final Integer DELIVERY_STATUS_ACCEPT = 40; // 已绑定
|
||||||
|
|
||||||
// 收货状态
|
// 收货状态
|
||||||
public static final Integer RECEIPT_STATUS_NO = 10; // 未收货
|
public static final Integer RECEIPT_STATUS_NO = 10; // 未收货
|
||||||
@@ -23,10 +24,10 @@ public class OrderConstants {
|
|||||||
public static final Integer RECEIPT_STATUS_RETURN = 30; // 已退货
|
public static final Integer RECEIPT_STATUS_RETURN = 30; // 已退货
|
||||||
|
|
||||||
// 订单状态
|
// 订单状态
|
||||||
public static final Integer ORDER_STATUS_DOING = 10; // 进行中
|
public static final Integer ORDER_STATUS_DOING = 10; // 待付款
|
||||||
public static final Integer ORDER_STATUS_CANCEL = 20; // 已取消
|
public static final Integer ORDER_STATUS_CANCEL = 20; // 已取消
|
||||||
public static final Integer ORDER_STATUS_TO_CANCEL = 21; // 待取消
|
public static final Integer ORDER_STATUS_TO_CANCEL = 21; // 待取消
|
||||||
public static final Integer ORDER_STATUS_COMPLETED = 30; // 已绑定
|
public static final Integer ORDER_STATUS_COMPLETED = 30; // 已付款
|
||||||
public static final Integer ORDER_STATUS_OVER = 40; // 已完成
|
public static final Integer ORDER_STATUS_OVER = 40; // 已完成
|
||||||
|
|
||||||
// 订单结算状态
|
// 订单结算状态
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.gxwebsoft.common.core.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Getter
|
||||||
|
public enum EProfitScene {
|
||||||
|
ASSET(1, "资产收益"),
|
||||||
|
SERVICE(2, "服务费收益"),
|
||||||
|
PROMOTION(3, "推广收益"),
|
||||||
|
MERCHANT(4, "门店收益"),
|
||||||
|
SHOP(5, "资产收益");
|
||||||
|
private Integer value;
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
public static String getNameByValue(int value) {
|
||||||
|
for (EProfitScene myEnum : values()) {
|
||||||
|
if (myEnum.value == value) {
|
||||||
|
return myEnum.desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.common.core.config.ConfigProperties;
|
|||||||
import com.gxwebsoft.common.core.exception.BusinessException;
|
import com.gxwebsoft.common.core.exception.BusinessException;
|
||||||
import com.gxwebsoft.common.system.entity.Setting;
|
import com.gxwebsoft.common.system.entity.Setting;
|
||||||
import com.gxwebsoft.common.system.service.SettingService;
|
import com.gxwebsoft.common.system.service.SettingService;
|
||||||
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -23,16 +24,17 @@ import javax.annotation.Resource;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
|
@Getter
|
||||||
public class AlipayConfigUtil {
|
public class AlipayConfigUtil {
|
||||||
private final StringRedisTemplate stringRedisTemplate;
|
private final StringRedisTemplate stringRedisTemplate;
|
||||||
public Integer tenantId;
|
private Integer tenantId;
|
||||||
public String gateway;
|
private String gateway;
|
||||||
public JSONObject config;
|
private JSONObject config;
|
||||||
public String appId;
|
private String appId;
|
||||||
public String privateKey;
|
private String privateKey;
|
||||||
public String appCertPublicKey;
|
private String appCertPublicKey;
|
||||||
public String alipayCertPublicKey;
|
private String alipayCertPublicKey;
|
||||||
public String alipayRootCert;
|
private String alipayRootCert;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ConfigProperties pathConfig;
|
private ConfigProperties pathConfig;
|
||||||
|
|||||||
@@ -5,12 +5,14 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
import com.gxwebsoft.common.system.result.RedisResult;
|
import com.gxwebsoft.common.system.result.RedisResult;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.data.geo.Point;
|
import org.springframework.data.geo.Point;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -22,7 +24,8 @@ import static com.gxwebsoft.common.core.constants.RedisConstants.CACHE_NULL_TTL;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CacheClient {
|
public class CacheClient {
|
||||||
private final StringRedisTemplate stringRedisTemplate;
|
@Resource
|
||||||
|
private StringRedisTemplate stringRedisTemplate;
|
||||||
public static Integer tenantId;
|
public static Integer tenantId;
|
||||||
|
|
||||||
public CacheClient(StringRedisTemplate stringRedisTemplate){
|
public CacheClient(StringRedisTemplate stringRedisTemplate){
|
||||||
|
|||||||
@@ -3,13 +3,10 @@ package com.gxwebsoft.common.core.utils;
|
|||||||
import cn.hutool.core.util.CharsetUtil;
|
import cn.hutool.core.util.CharsetUtil;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.gxwebsoft.common.core.config.ConfigProperties;
|
|
||||||
import com.gxwebsoft.common.core.exception.BusinessException;
|
import com.gxwebsoft.common.core.exception.BusinessException;
|
||||||
import com.gxwebsoft.common.system.service.SettingService;
|
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
|
||||||
@@ -30,14 +27,6 @@ public class WxOfficialUtil {
|
|||||||
public String expires_in;
|
public String expires_in;
|
||||||
public String nickname;
|
public String nickname;
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private SettingService settingService;
|
|
||||||
@Resource
|
|
||||||
private ConfigProperties pathConfig;
|
|
||||||
@Resource
|
|
||||||
private CacheClient cacheClient;
|
|
||||||
|
|
||||||
public WxOfficialUtil(StringRedisTemplate stringRedisTemplate){
|
public WxOfficialUtil(StringRedisTemplate stringRedisTemplate){
|
||||||
this.stringRedisTemplate = stringRedisTemplate;
|
this.stringRedisTemplate = stringRedisTemplate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,4 +92,16 @@ public class ApiResult<T> implements Serializable {
|
|||||||
public boolean isOk(){
|
public boolean isOk(){
|
||||||
return this.code == Constants.RESULT_OK_CODE;
|
return this.code == Constants.RESULT_OK_CODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> ApiResult<T> ok(T data){
|
||||||
|
return new ApiResult(Constants.RESULT_OK_CODE, "成功", data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ApiResult<T> ok(){
|
||||||
|
return new ApiResult(Constants.RESULT_OK_CODE, "成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ApiResult fail(String message){
|
||||||
|
return new ApiResult(Constants.RESULT_ERROR_CODE, message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ public class BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private MerchantClerkService merchantClerkService;
|
private MerchantClerkService merchantClerkService;
|
||||||
@Resource
|
@Resource
|
||||||
private CacheClient cacheClient;
|
|
||||||
@Resource
|
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.gxwebsoft.common.core.web;
|
package com.gxwebsoft.common.core.web;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -11,6 +13,7 @@ import java.util.List;
|
|||||||
* @author WebSoft
|
* @author WebSoft
|
||||||
* @since 2017-06-10 10:10:02
|
* @since 2017-06-10 10:10:02
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class PageResult<T> implements Serializable {
|
public class PageResult<T> implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -20,6 +23,9 @@ public class PageResult<T> implements Serializable {
|
|||||||
@ApiModelProperty(value = "总数量")
|
@ApiModelProperty(value = "总数量")
|
||||||
private Long count;
|
private Long count;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "其他数据")
|
||||||
|
private JSONObject otherData;
|
||||||
|
|
||||||
public PageResult() {
|
public PageResult() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,23 +34,7 @@ public class PageResult<T> implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PageResult(List<T> list, Long count) {
|
public PageResult(List<T> list, Long count) {
|
||||||
setList(list);
|
|
||||||
setCount(count);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<T> getList() {
|
|
||||||
return this.list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setList(List<T> list) {
|
|
||||||
this.list = list;
|
this.list = list;
|
||||||
}
|
|
||||||
|
|
||||||
public Long getCount() {
|
|
||||||
return this.count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCount(Long count) {
|
|
||||||
this.count = count;
|
this.count = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ public class MainController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private AliSmsService aliSmsService;
|
private AliSmsService aliSmsService;
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("用户登录")
|
@ApiOperation("用户登录")
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
public ApiResult<LoginResult> login(@RequestBody LoginParam param, HttpServletRequest request) {
|
public ApiResult<LoginResult> login(@RequestBody LoginParam param, HttpServletRequest request) {
|
||||||
@@ -222,8 +223,9 @@ public class MainController extends BaseController {
|
|||||||
if(ret.isOk()){
|
if(ret.isOk()){
|
||||||
ESmsType type = ESmsType.valueOf(param.getType());
|
ESmsType type = ESmsType.valueOf(param.getType());
|
||||||
cacheClient.set(type.name() + ":" + param.getPhone(), code,5L,TimeUnit.MINUTES);
|
cacheClient.set(type.name() + ":" + param.getPhone(), code,5L,TimeUnit.MINUTES);
|
||||||
|
log.info("发送验证码为{}", cacheClient.get(type.name() + ":" + param.getPhone()));
|
||||||
}
|
}
|
||||||
return success(ret);
|
return ret;
|
||||||
} catch (ClientException e) {
|
} catch (ClientException e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
return fail("发送出错!");
|
return fail("发送出错!");
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
AND a.username LIKE CONCAT('%', #{param.username}, '%')
|
AND a.username LIKE CONCAT('%', #{param.username}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="param.nickname != null">
|
<if test="param.nickname != null">
|
||||||
AND a.nickname LIKE CONCAT('%', #{param.nickname}, '%')
|
AND (a.nickname LIKE CONCAT('%', #{param.nickname}, '%') or a.phone like CONCAT(#{param.nickname}, '%'))
|
||||||
</if>
|
</if>
|
||||||
<if test="param.type != null">
|
<if test="param.type != null">
|
||||||
AND a.type = #{param.type}
|
AND a.type = #{param.type}
|
||||||
@@ -108,7 +108,7 @@
|
|||||||
<if test="param.roleId != null">
|
<if test="param.roleId != null">
|
||||||
AND a.user_id IN (SELECT user_id FROM sys_user_role WHERE role_id=#{param.roleId})
|
AND a.user_id IN (SELECT user_id FROM sys_user_role WHERE role_id=#{param.roleId})
|
||||||
</if>
|
</if>
|
||||||
<if test="param.userIds != null">
|
<if test="param.userIds != null and param.userIds.size > 0">
|
||||||
AND a.user_id IN
|
AND a.user_id IN
|
||||||
<foreach collection="param.userIds" item="item" separator="," open="(" close=")">
|
<foreach collection="param.userIds" item="item" separator="," open="(" close=")">
|
||||||
#{item}
|
#{item}
|
||||||
|
|||||||
@@ -61,12 +61,12 @@ public class AliSmsServiceImpl implements AliSmsService {
|
|||||||
|
|
||||||
CommonResponse response = client.getCommonResponse(request);
|
CommonResponse response = client.getCommonResponse(request);
|
||||||
String json = response.getData();
|
String json = response.getData();
|
||||||
Gson g = new Gson();
|
JSONObject result = JSON.parseObject(json);
|
||||||
HashMap result = g.fromJson(json, HashMap.class);
|
String message = result.getString("Message");
|
||||||
if("OK".equals(result.get("Message"))) {
|
if("OK".equals(message)) {
|
||||||
return new ApiResult("发送成功");
|
return new ApiResult("发送成功");
|
||||||
}
|
}
|
||||||
log.warn("阿里云短信发送失败!{}", json);
|
log.warn("阿里云短信发送失败!{}", json);
|
||||||
return new ApiResult(Constants.RESULT_ERROR_CODE, "发送失败");
|
return new ApiResult(Constants.RESULT_ERROR_CODE, "发送失败!" + message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<if test="param.userId != null">
|
<if test="param.userId != null">
|
||||||
AND a.user_id = #{param.userId}
|
AND a.user_id = #{param.userId}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.scene != null">
|
<if test="param.scene != null and param.scene != 0">
|
||||||
AND a.scene = #{param.scene}
|
AND a.scene = #{param.scene}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.sceneMultiple != null">
|
<if test="param.sceneMultiple != null">
|
||||||
@@ -46,12 +46,10 @@
|
|||||||
<if test="param.status != null">
|
<if test="param.status != null">
|
||||||
AND a.status = #{param.status}
|
AND a.status = #{param.status}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.deleted != null">
|
<choose>
|
||||||
AND a.deleted = #{param.deleted}
|
<when test="param.deleted != null">AND a.deleted = #{param.deleted}</when>
|
||||||
</if>
|
<otherwise>AND a.deleted = 0</otherwise>
|
||||||
<if test="param.deleted == null">
|
</choose>
|
||||||
AND a.deleted = 0
|
|
||||||
</if>
|
|
||||||
<if test="param.merchantCode != null">
|
<if test="param.merchantCode != null">
|
||||||
AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%')
|
AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import com.gxwebsoft.apps.param.EquipmentParam;
|
|||||||
import com.gxwebsoft.apps.service.EquipmentRecordService;
|
import com.gxwebsoft.apps.service.EquipmentRecordService;
|
||||||
import com.gxwebsoft.apps.service.EquipmentService;
|
import com.gxwebsoft.apps.service.EquipmentService;
|
||||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
|
import com.gxwebsoft.common.core.constants.OrderConstants;
|
||||||
import com.gxwebsoft.common.core.enums.ESmsType;
|
import com.gxwebsoft.common.core.enums.ESmsType;
|
||||||
import com.gxwebsoft.common.core.utils.AlipayConfigUtil;
|
import com.gxwebsoft.common.core.utils.AlipayConfigUtil;
|
||||||
import com.gxwebsoft.common.core.utils.CacheClient;
|
import com.gxwebsoft.common.core.utils.CacheClient;
|
||||||
@@ -36,6 +37,7 @@ import com.gxwebsoft.shop.service.OrderService;
|
|||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -45,6 +47,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -59,6 +62,7 @@ import static com.gxwebsoft.common.core.constants.OrderConstants.*;
|
|||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2022-11-30 02:11:16
|
* @since 2022-11-30 02:11:16
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Api(tags = "设备管理管理")
|
@Api(tags = "设备管理管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/open/equipment")
|
@RequestMapping("/api/open/equipment")
|
||||||
@@ -87,20 +91,16 @@ public class OpenEquipmentController extends BaseController {
|
|||||||
private CacheClient cacheClient;
|
private CacheClient cacheClient;
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('apps:equipment:list')")
|
@PreAuthorize("hasAuthority('apps:equipment:list')")
|
||||||
@OperationLog
|
|
||||||
@ApiOperation("分页查询设备管理")
|
@ApiOperation("分页查询设备管理")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<Equipment>> page(EquipmentParam param) {
|
public ApiResult<PageResult<Equipment>> page(EquipmentParam param) {
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
PageParam<Equipment, EquipmentParam> page = new PageParam<>(param);
|
|
||||||
page.setDefaultOrder("create_time desc");
|
|
||||||
if (getMerchantCode() != null) {
|
if (getMerchantCode() != null) {
|
||||||
param.setMerchantCode(getMerchantCode());
|
param.setMerchantCode(getMerchantCode());
|
||||||
}
|
}
|
||||||
return success(equipmentService.pageRel(param));
|
return success(equipmentService.pageRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperationLog
|
|
||||||
@ApiOperation("查询全部设备管理")
|
@ApiOperation("查询全部设备管理")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public ApiResult<List<Equipment>> list(EquipmentParam param) {
|
public ApiResult<List<Equipment>> list(EquipmentParam param) {
|
||||||
@@ -215,20 +215,19 @@ public class OpenEquipmentController extends BaseController {
|
|||||||
model.setDescribe("扫码租赁电池");
|
model.setDescribe("扫码租赁电池");
|
||||||
request.setBizModel(model);
|
request.setBizModel(model);
|
||||||
AlipayOpenAppQrcodeCreateResponse response = alipayClient.certificateExecute(request);
|
AlipayOpenAppQrcodeCreateResponse response = alipayClient.certificateExecute(request);
|
||||||
System.out.println(response.getBody());
|
log.info("支付宝扫码返回:{}", response.getBody());
|
||||||
if (response.isSuccess()) {
|
if (response.isSuccess()) {
|
||||||
System.out.println("调用成功");
|
|
||||||
final JSONObject jsonObject = JSONObject.parseObject(response.getBody());
|
final JSONObject jsonObject = JSONObject.parseObject(response.getBody());
|
||||||
final String alipay_open_app_qrcode_create_response = jsonObject.getString("alipay_open_app_qrcode_create_response");
|
final String alipay_open_app_qrcode_create_response = jsonObject.getString("alipay_open_app_qrcode_create_response");
|
||||||
final JSONObject jsonObject1 = JSONObject.parseObject(alipay_open_app_qrcode_create_response);
|
final JSONObject jsonObject1 = JSONObject.parseObject(alipay_open_app_qrcode_create_response);
|
||||||
return jsonObject1.getString("qr_code_url");
|
return jsonObject1.getString("qr_code_url");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("调用失败");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("绑定设备")
|
@ApiOperation("绑定设备")
|
||||||
|
@OperationLog
|
||||||
@PostMapping("/bind")
|
@PostMapping("/bind")
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public ApiResult<?> bindEquipment(@RequestBody Equipment equipment) {
|
public ApiResult<?> bindEquipment(@RequestBody Equipment equipment) {
|
||||||
@@ -262,7 +261,7 @@ public class OpenEquipmentController extends BaseController {
|
|||||||
record.setMerchantCode(one.getMerchantCode());
|
record.setMerchantCode(one.getMerchantCode());
|
||||||
equipmentRecordService.save(record);
|
equipmentRecordService.save(record);
|
||||||
// 订单发货
|
// 订单发货
|
||||||
order.setDeliveryStatus(DELIVERY_STATUS_YES);
|
order.setDeliveryStatus(DELIVERY_STATUS_ACCEPT);
|
||||||
order.setOrderStatus(ORDER_STATUS_COMPLETED);
|
order.setOrderStatus(ORDER_STATUS_COMPLETED);
|
||||||
order.setReceiptStatus(RECEIPT_STATUS_YES);
|
order.setReceiptStatus(RECEIPT_STATUS_YES);
|
||||||
order.setExpirationTime(DateUtil.nextMonth());
|
order.setExpirationTime(DateUtil.nextMonth());
|
||||||
@@ -270,13 +269,9 @@ public class OpenEquipmentController extends BaseController {
|
|||||||
|
|
||||||
if(order.getOrderSource() == 10) {
|
if(order.getOrderSource() == 10) {
|
||||||
order.setOrderStatus(ORDER_STATUS_OVER);
|
order.setOrderStatus(ORDER_STATUS_OVER);
|
||||||
|
|
||||||
}
|
}
|
||||||
orderService.updateById(order);
|
orderService.updateById(order);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
JSONObject param = new JSONObject();
|
JSONObject param = new JSONObject();
|
||||||
param.put("userId", loginUser.getUserId());
|
param.put("userId", loginUser.getUserId());
|
||||||
param.put("userName", loginUser.getNickname());
|
param.put("userName", loginUser.getNickname());
|
||||||
@@ -285,18 +280,18 @@ public class OpenEquipmentController extends BaseController {
|
|||||||
try {
|
try {
|
||||||
ResponseEntity<JSONObject> responseEntity = restTemplate.postForEntity("https://battery.zfdliot.com/api/battery/batteryBindUser", param, JSONObject.class);
|
ResponseEntity<JSONObject> responseEntity = restTemplate.postForEntity("https://battery.zfdliot.com/api/battery/batteryBindUser", param, JSONObject.class);
|
||||||
JSONObject body = responseEntity.getBody();
|
JSONObject body = responseEntity.getBody();
|
||||||
System.out.println(body);
|
log.info("电池绑定调用第三方返回:{}", body.toString());
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
orderPayService.lambdaUpdate().set(OrderPay::getEquipmentId, one.getEquipmentId()).update();
|
orderPayService.lambdaUpdate().set(OrderPay::getEquipmentId, one.getEquipmentId()).update();
|
||||||
return success("绑定成功");
|
return success("绑定成功");
|
||||||
}
|
}
|
||||||
return fail("绑定失败");
|
return fail("绑定失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiOperation("更换设备")
|
@ApiOperation("更换设备")
|
||||||
@PostMapping("/change")
|
@PostMapping("/change")
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
@@ -313,23 +308,29 @@ public class OpenEquipmentController extends BaseController {
|
|||||||
|
|
||||||
// 新电池
|
// 新电池
|
||||||
Equipment one = equipmentService.getByEquipmentCode(equipmentCode);
|
Equipment one = equipmentService.getByEquipmentCode(equipmentCode);
|
||||||
|
if (one == null) {
|
||||||
|
return fail("新设备不存在");
|
||||||
|
}
|
||||||
|
|
||||||
String newMerchantCode = one.getMerchantCode();
|
String newMerchantCode = one.getMerchantCode();
|
||||||
// 旧电池
|
// 旧电池
|
||||||
Equipment old = equipmentService.getById(oldEqId);
|
Equipment old = equipmentService.getById(oldEqId);
|
||||||
String oldMerchantCode = old.getMerchantCode();
|
String oldMerchantCode = order.getMerchantCode();
|
||||||
|
|
||||||
|
Integer userId = one.getUserId();
|
||||||
if (one == null) {
|
if (null != userId && !userId.equals(0)) {
|
||||||
return fail("设备不存在");
|
|
||||||
}
|
|
||||||
if (!one.getUserId().equals(0)) {
|
|
||||||
return fail("该设备已被绑定");
|
return fail("该设备已被绑定");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Integer orderUserId = order.getUserId();
|
||||||
|
if(null == orderUserId || 0 == orderUserId){
|
||||||
|
orderUserId = loginUserId;
|
||||||
|
}
|
||||||
|
|
||||||
// 绑定新电池
|
// 绑定新电池
|
||||||
Equipment saveData = new Equipment();
|
Equipment saveData = new Equipment();
|
||||||
saveData.setEquipmentId(one.getEquipmentId());
|
saveData.setEquipmentId(one.getEquipmentId());
|
||||||
saveData.setUserId(loginUserId);
|
saveData.setUserId(orderUserId);
|
||||||
saveData.setOrderId(orderId);
|
saveData.setOrderId(orderId);
|
||||||
saveData.setMerchantCode(oldMerchantCode);
|
saveData.setMerchantCode(oldMerchantCode);
|
||||||
boolean b = equipmentService.updateById(saveData);
|
boolean b = equipmentService.updateById(saveData);
|
||||||
@@ -337,9 +338,9 @@ public class OpenEquipmentController extends BaseController {
|
|||||||
EquipmentRecord record = new EquipmentRecord();
|
EquipmentRecord record = new EquipmentRecord();
|
||||||
record.setEquipmentCode(equipmentCode);
|
record.setEquipmentCode(equipmentCode);
|
||||||
record.setEventType(EVENT_TYPE_BIND);
|
record.setEventType(EVENT_TYPE_BIND);
|
||||||
record.setUserId(loginUserId);
|
record.setUserId(orderUserId);
|
||||||
record.setOrderId(orderId);
|
record.setOrderId(orderId);
|
||||||
record.setMerchantCode(one.getMerchantCode());
|
record.setMerchantCode(oldMerchantCode);
|
||||||
equipmentRecordService.save(record);
|
equipmentRecordService.save(record);
|
||||||
|
|
||||||
if (b) {
|
if (b) {
|
||||||
@@ -351,7 +352,7 @@ public class OpenEquipmentController extends BaseController {
|
|||||||
// 记录明细
|
// 记录明细
|
||||||
EquipmentRecord record2 = new EquipmentRecord();
|
EquipmentRecord record2 = new EquipmentRecord();
|
||||||
record2.setEquipmentCode(old.getEquipmentCode());
|
record2.setEquipmentCode(old.getEquipmentCode());
|
||||||
record2.setUserId(loginUserId);
|
record2.setUserId(orderUserId);
|
||||||
record2.setOrderId(orderId);
|
record2.setOrderId(orderId);
|
||||||
record2.setEventType(EVENT_TYPE_UNBIND);
|
record2.setEventType(EVENT_TYPE_UNBIND);
|
||||||
record2.setMerchantCode(one.getMerchantCode());
|
record2.setMerchantCode(one.getMerchantCode());
|
||||||
@@ -359,6 +360,7 @@ public class OpenEquipmentController extends BaseController {
|
|||||||
// 更新订单
|
// 更新订单
|
||||||
order.setEquipmentId(one.getEquipmentId());
|
order.setEquipmentId(one.getEquipmentId());
|
||||||
orderService.updateById(order);
|
orderService.updateById(order);
|
||||||
|
|
||||||
User loginUser = getLoginUser();
|
User loginUser = getLoginUser();
|
||||||
// 通知第三方
|
// 通知第三方
|
||||||
/**
|
/**
|
||||||
@@ -376,7 +378,7 @@ public class OpenEquipmentController extends BaseController {
|
|||||||
param.put("battery_sn", one.getEquipmentCode());
|
param.put("battery_sn", one.getEquipmentCode());
|
||||||
ResponseEntity<JSONObject> responseEntity = restTemplate.postForEntity("https://battery.zfdliot.com/api/battery/batteryBindUser", param, JSONObject.class);
|
ResponseEntity<JSONObject> responseEntity = restTemplate.postForEntity("https://battery.zfdliot.com/api/battery/batteryBindUser", param, JSONObject.class);
|
||||||
JSONObject body = responseEntity.getBody();
|
JSONObject body = responseEntity.getBody();
|
||||||
System.out.println(body);
|
log.info("电池更换调用第三方返回:{}", body);
|
||||||
return success("换电成功");
|
return success("换电成功");
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -385,7 +387,8 @@ public class OpenEquipmentController extends BaseController {
|
|||||||
|
|
||||||
@ApiOperation("确认收货")
|
@ApiOperation("确认收货")
|
||||||
@PostMapping("/receipt")
|
@PostMapping("/receipt")
|
||||||
public ApiResult<?> receipt(@RequestBody @Validated OrderReceiptParam receiptParam) {
|
@OperationLog
|
||||||
|
public ApiResult<?> receipt(@RequestBody @Valid OrderReceiptParam receiptParam) {
|
||||||
// 验证签名
|
// 验证签名
|
||||||
isCheckSign();
|
isCheckSign();
|
||||||
|
|
||||||
@@ -412,15 +415,19 @@ public class OpenEquipmentController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 短信验证码校验
|
// 短信验证码校验
|
||||||
String receiptPhone = receiptParam.getCaptcha();
|
String receiptPhone = receiptParam.getReceiptPhone();
|
||||||
String captcha = receiptParam.getCaptcha();
|
if(StrUtil.isNotBlank(receiptPhone)){
|
||||||
String code = cacheClient.get(ESmsType.RECEIPT.name() + ":" + receiptPhone, String.class);
|
String captcha = receiptParam.getCaptcha();
|
||||||
if (!StrUtil.equals(code, captcha)) {
|
String code = cacheClient.get(ESmsType.RECEIPT.name() + ":" + receiptPhone);
|
||||||
return fail("验证码不正确");
|
if (!StrUtil.equals(code, captcha)) {
|
||||||
|
return fail("验证码不正确");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BeanCopier.create(receiptParam, order, CopyOptions.create().ignoreNullValue()).copy();
|
BeanCopier.create(receiptParam, order, CopyOptions.create().ignoreNullValue()).copy();
|
||||||
order.setReceiptStatus(20);
|
order.setOrderStatus(ORDER_STATUS_COMPLETED);
|
||||||
|
order.setDeliveryStatus(DELIVERY_STATUS_YES);
|
||||||
|
order.setReceiptStatus(RECEIPT_STATUS_YES);
|
||||||
orderService.updateById(order);
|
orderService.updateById(order);
|
||||||
return success("确认收货成功");
|
return success("确认收货成功");
|
||||||
}
|
}
|
||||||
@@ -451,30 +458,34 @@ public class OpenEquipmentController extends BaseController {
|
|||||||
return success("确认收货成功");
|
return success("确认收货成功");
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
@ApiModelProperty("退租")
|
@ApiModelProperty("退租")
|
||||||
@PostMapping("/rentingOut")
|
@PostMapping("/rentingOut")
|
||||||
public ApiResult<?> rentingOut(@RequestBody Order order) {
|
public ApiResult<?> rentingOut(@RequestBody Order order) {
|
||||||
|
|
||||||
// 验证签名
|
// 验证签名
|
||||||
isCheckSign();
|
isCheckSign();
|
||||||
OrderRefund refund = orderRefundService.getOne(new LambdaQueryWrapper<OrderRefund>()
|
OrderRefund refund = orderRefundService.getOne(new LambdaQueryWrapper<OrderRefund>()
|
||||||
.eq(OrderRefund::getOrderId, order.getOrderId()));
|
.eq(OrderRefund::getOrderId, order.getOrderId()).last("limit 1"));
|
||||||
// 已有记录 取消退租
|
// 已有记录 取消退租
|
||||||
if (refund != null) {
|
if (refund != null) {
|
||||||
if(refund.getAuditStatus() == 10){
|
Integer auditStatus = refund.getAuditStatus();
|
||||||
|
if(auditStatus == 10){
|
||||||
orderRefundService.removeById(refund.getOrderRefundId());
|
orderRefundService.removeById(refund.getOrderRefundId());
|
||||||
Order updateOrder = new Order();
|
// Order updateOrder = new Order();
|
||||||
updateOrder.setReceiptStatus(RECEIPT_STATUS_YES);
|
// updateOrder.setReceiptStatus(RECEIPT_STATUS_YES);
|
||||||
updateOrder.setOrderId(order.getOrderId());
|
// updateOrder.setOrderId(order.getOrderId());
|
||||||
orderService.updateById(updateOrder);
|
// orderService.updateById(updateOrder);
|
||||||
return success("退租申请已取消");
|
order.setReceiptStatus(RECEIPT_STATUS_YES);
|
||||||
|
orderService.updateById(order);
|
||||||
|
return success("已申请退租");
|
||||||
}
|
}
|
||||||
if (refund.getAuditStatus() != 30) {
|
if (auditStatus != 30) {
|
||||||
return fail("申请成功,请等待客服人员审核");
|
return fail("申请成功,请等待客服人员审核");
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
refund = new OrderRefund();
|
refund = new OrderRefund();
|
||||||
refund.setOrderId(order.getOrderId());
|
refund.setOrderId(order.getOrderId());
|
||||||
|
refund.setOrderNo(order.getOrderNo());
|
||||||
refund.setOrderGoodsId(order.getGoodsId());
|
refund.setOrderGoodsId(order.getGoodsId());
|
||||||
refund.setUserId(getLoginUserId());
|
refund.setUserId(getLoginUserId());
|
||||||
refund.setType(10);
|
refund.setType(10);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.gxwebsoft.shop.param.OrderParam;
|
|||||||
import com.gxwebsoft.shop.service.*;
|
import com.gxwebsoft.shop.service.*;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -38,6 +39,7 @@ import static com.gxwebsoft.common.core.constants.OrderConstants.*;
|
|||||||
* @author WebSoft
|
* @author WebSoft
|
||||||
* @since 2022-11-16 11:25:58
|
* @since 2022-11-16 11:25:58
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Api(tags = "订单记录表管理")
|
@Api(tags = "订单记录表管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/open/order")
|
@RequestMapping("/api/open/order")
|
||||||
@@ -224,7 +226,6 @@ public class OpenOrderController extends BaseController {
|
|||||||
// 取消报餐截止时间
|
// 取消报餐截止时间
|
||||||
Date date = DateUtil.date();
|
Date date = DateUtil.date();
|
||||||
int hours = date.getHours();
|
int hours = date.getHours();
|
||||||
System.out.println("hours = " + hours);
|
|
||||||
if(hours > 19){
|
if(hours > 19){
|
||||||
return fail("每天晚上8点后截止取消报餐");
|
return fail("每天晚上8点后截止取消报餐");
|
||||||
}
|
}
|
||||||
@@ -233,7 +234,6 @@ public class OpenOrderController extends BaseController {
|
|||||||
final Order orderInfo = orderService.getById(order.getOrderId());
|
final Order orderInfo = orderService.getById(order.getOrderId());
|
||||||
// 退款
|
// 退款
|
||||||
User user = userService.getById(orderInfo.getUserId());
|
User user = userService.getById(orderInfo.getUserId());
|
||||||
System.out.println("user = " + user);
|
|
||||||
BigDecimal balance = user.getBalance().add(orderInfo.getPayPrice());
|
BigDecimal balance = user.getBalance().add(orderInfo.getPayPrice());
|
||||||
user.setBalance(balance);
|
user.setBalance(balance);
|
||||||
userService.updateById(user);
|
userService.updateById(user);
|
||||||
@@ -241,9 +241,10 @@ public class OpenOrderController extends BaseController {
|
|||||||
UserBalanceLog userBalanceLog = new UserBalanceLog();
|
UserBalanceLog userBalanceLog = new UserBalanceLog();
|
||||||
userBalanceLog.setUserId(orderInfo.getUserId());
|
userBalanceLog.setUserId(orderInfo.getUserId());
|
||||||
userBalanceLog.setScene(BALANCE_REFUND);
|
userBalanceLog.setScene(BALANCE_REFUND);
|
||||||
|
userBalanceLog.setSceneId(orderInfo.getOrderId());
|
||||||
userBalanceLog.setMoney(orderInfo.getPayPrice());
|
userBalanceLog.setMoney(orderInfo.getPayPrice());
|
||||||
userBalanceLog.setBalance(balance);
|
userBalanceLog.setBalance(balance);
|
||||||
userBalanceLog.setComments(orderInfo.getOrderNo().toString());
|
userBalanceLog.setComments("订单号:" + orderInfo.getOrderNo());
|
||||||
userBalanceLog.setMerchantCode(orderInfo.getMerchantCode());
|
userBalanceLog.setMerchantCode(orderInfo.getMerchantCode());
|
||||||
userBalanceLogService.save(userBalanceLog);
|
userBalanceLogService.save(userBalanceLog);
|
||||||
return success("订单取消成功",orderInfo);
|
return success("订单取消成功",orderInfo);
|
||||||
@@ -257,9 +258,9 @@ public class OpenOrderController extends BaseController {
|
|||||||
// 验证签名
|
// 验证签名
|
||||||
isCheckSign();
|
isCheckSign();
|
||||||
try {
|
try {
|
||||||
freezeOrderService.unfreeze(id);
|
freezeOrderService.unfreeze(id, BigDecimal.ZERO);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
// Order order = orderService.getById(id);
|
// Order order = orderService.getById(id);
|
||||||
if (orderService.removeById(id)) {
|
if (orderService.removeById(id)) {
|
||||||
|
|||||||
@@ -161,7 +161,8 @@ public class OpenOrderGoodsController extends BaseController {
|
|||||||
return fail("菜品不存在!");
|
return fail("菜品不存在!");
|
||||||
}
|
}
|
||||||
// System.out.println("orderGoods = " + orderGoods);
|
// System.out.println("orderGoods = " + orderGoods);
|
||||||
final Order byId = orderService.getById(orderGoods.getOrderId());
|
Integer orderId = orderGoods.getOrderId();
|
||||||
|
final Order byId = orderService.getById(orderId);
|
||||||
// 取消报餐截止时间
|
// 取消报餐截止时间
|
||||||
orderGoodsService.removeById(orderGoods);
|
orderGoodsService.removeById(orderGoods);
|
||||||
// System.out.println("orderGoods = " + orderGoods);
|
// System.out.println("orderGoods = " + orderGoods);
|
||||||
@@ -176,14 +177,15 @@ public class OpenOrderGoodsController extends BaseController {
|
|||||||
UserBalanceLog userBalanceLog = new UserBalanceLog();
|
UserBalanceLog userBalanceLog = new UserBalanceLog();
|
||||||
userBalanceLog.setUserId(byId.getUserId());
|
userBalanceLog.setUserId(byId.getUserId());
|
||||||
userBalanceLog.setScene(BALANCE_REFUND);
|
userBalanceLog.setScene(BALANCE_REFUND);
|
||||||
|
userBalanceLog.setSceneId(orderId);
|
||||||
userBalanceLog.setMoney(orderGoods.getGoodsPrice());
|
userBalanceLog.setMoney(orderGoods.getGoodsPrice());
|
||||||
userBalanceLog.setBalance(balance);
|
userBalanceLog.setBalance(balance);
|
||||||
userBalanceLog.setComments(orderGoods.getOrderId().toString());
|
userBalanceLog.setComments("取消订单:" + orderId);
|
||||||
userBalanceLogService.save(userBalanceLog);
|
userBalanceLogService.save(userBalanceLog);
|
||||||
final int count = orderGoodsService.count(new LambdaUpdateWrapper<OrderGoods>().eq(OrderGoods::getOrderId, orderGoods.getOrderId()).gt(OrderGoods::getTotalNum,0));
|
final int count = orderGoodsService.count(new LambdaUpdateWrapper<OrderGoods>().eq(OrderGoods::getOrderId, orderId).gt(OrderGoods::getTotalNum,0));
|
||||||
// System.out.println("count = " + count);
|
// System.out.println("count = " + count);
|
||||||
// 更新订单金额
|
// 更新订单金额
|
||||||
System.out.println("byId = " + byId);
|
// System.out.println("byId = " + byId);
|
||||||
if (!byId.getTotalPrice().equals(0)) {
|
if (!byId.getTotalPrice().equals(0)) {
|
||||||
byId.setTotalPrice(byId.getTotalPrice().subtract(orderGoods.getGoodsPrice()));
|
byId.setTotalPrice(byId.getTotalPrice().subtract(orderGoods.getGoodsPrice()));
|
||||||
orderService.updateById(byId);
|
orderService.updateById(byId);
|
||||||
@@ -192,9 +194,9 @@ public class OpenOrderGoodsController extends BaseController {
|
|||||||
// 无菜品就把订单删除
|
// 无菜品就把订单删除
|
||||||
if(count == 0){
|
if(count == 0){
|
||||||
final Order order = new Order();
|
final Order order = new Order();
|
||||||
order.setOrderId(orderGoods.getOrderId());
|
order.setOrderId(orderId);
|
||||||
order.setOrderStatus(ORDER_STATUS_CANCEL);
|
order.setOrderStatus(ORDER_STATUS_CANCEL);
|
||||||
orderService.removeById(orderGoods.getOrderId());
|
orderService.removeById(orderId);
|
||||||
}
|
}
|
||||||
return success("菜品取消成功");
|
return success("菜品取消成功");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,15 @@ import cn.hutool.core.date.DateField;
|
|||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alipay.api.AlipayApiException;
|
import com.alipay.api.AlipayApiException;
|
||||||
import com.alipay.api.AlipayConstants;
|
import com.alipay.api.AlipayConstants;
|
||||||
import com.alipay.api.internal.util.AlipaySignature;
|
import com.alipay.api.internal.util.AlipaySignature;
|
||||||
import com.alipay.api.response.AlipayFundAuthOperationDetailQueryResponse;
|
import com.alipay.api.response.AlipayFundAuthOperationDetailQueryResponse;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.gxwebsoft.apps.entity.EquipmentGoods;
|
import com.gxwebsoft.apps.entity.EquipmentGoods;
|
||||||
import com.gxwebsoft.apps.service.EquipmentGoodsService;
|
import com.gxwebsoft.apps.service.EquipmentGoodsService;
|
||||||
import com.gxwebsoft.common.core.config.ConfigProperties;
|
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||||
@@ -29,6 +33,7 @@ import com.gxwebsoft.shop.service.OrderPayService;
|
|||||||
import com.gxwebsoft.shop.service.OrderService;
|
import com.gxwebsoft.shop.service.OrderService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -50,6 +55,7 @@ import static com.gxwebsoft.common.core.constants.OrderConstants.PAY_STATUS_SUCC
|
|||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2023-10-08 10:15:22
|
* @since 2023-10-08 10:15:22
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Api(tags = "管理")
|
@Api(tags = "管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/shop/freeze-order")
|
@RequestMapping("/api/shop/freeze-order")
|
||||||
@@ -182,6 +188,7 @@ public class FreezeOrderController extends BaseController {
|
|||||||
@PostMapping("/notify")
|
@PostMapping("/notify")
|
||||||
@Transactional
|
@Transactional
|
||||||
public void freezeNotify(@RequestParam Map<String, String> params, HttpServletResponse response) throws AlipayApiException {
|
public void freezeNotify(@RequestParam Map<String, String> params, HttpServletResponse response) throws AlipayApiException {
|
||||||
|
log.info("收到冻结通知!{}", JSON.toJSONString(params));
|
||||||
PrintWriter writer = null;
|
PrintWriter writer = null;
|
||||||
|
|
||||||
DateTime now = DateUtil.date();
|
DateTime now = DateUtil.date();
|
||||||
@@ -218,12 +225,13 @@ public class FreezeOrderController extends BaseController {
|
|||||||
String trade_status = params.get("trade_status");
|
String trade_status = params.get("trade_status");
|
||||||
String payee_user_id = params.get("payee_user_id");
|
String payee_user_id = params.get("payee_user_id");
|
||||||
|
|
||||||
FreezeOrder one = freezeOrderService.lambdaQuery().eq(FreezeOrder::getNotifyId, notify_id).one();
|
FreezeOrder one = freezeOrderService.lambdaQuery().eq(FreezeOrder::getNotifyId, notify_id).last("limit 1").one();
|
||||||
if(one == null) {
|
if(one == null) {
|
||||||
FreezeOrder freezeOrder = freezeOrderService.lambdaQuery().eq(FreezeOrder::getOutRequestNo, out_request_no).one();
|
FreezeOrder freezeOrder = freezeOrderService.lambdaQuery().eq(FreezeOrder::getOutRequestNo, out_request_no).one();
|
||||||
if(freezeOrder == null) {
|
if(freezeOrder == null) {
|
||||||
freezeOrder = new FreezeOrder();
|
freezeOrder = new FreezeOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
freezeOrder.setOutOrderNo(out_order_no != null ?out_order_no: "");
|
freezeOrder.setOutOrderNo(out_order_no != null ?out_order_no: "");
|
||||||
freezeOrder.setOutRequestNo(out_request_no);
|
freezeOrder.setOutRequestNo(out_request_no);
|
||||||
freezeOrder.setOperationId(operation_id);
|
freezeOrder.setOperationId(operation_id);
|
||||||
@@ -240,6 +248,27 @@ public class FreezeOrderController extends BaseController {
|
|||||||
freezeOrder.setDetail(JSONObject.toJSONString(params));
|
freezeOrder.setDetail(JSONObject.toJSONString(params));
|
||||||
freezeOrderService.saveOrUpdate(freezeOrder);
|
freezeOrderService.saveOrUpdate(freezeOrder);
|
||||||
|
|
||||||
|
LambdaQueryWrapper<FreezeOrder> fWrapper = Wrappers.lambdaQuery();
|
||||||
|
fWrapper.eq(FreezeOrder::getRelOrderId, freezeOrder.getRelOrderId())
|
||||||
|
.eq(FreezeOrder::getStatus, "INIT")
|
||||||
|
.eq(FreezeOrder::getId, freezeOrder.getId());
|
||||||
|
boolean delRet = freezeOrderService.remove(fWrapper);
|
||||||
|
log.info("删除无效冻结订单{}条!冻结单号{}", delRet, out_order_no);
|
||||||
|
|
||||||
|
BigDecimal bAmount = freezeOrder.getAmount();
|
||||||
|
LambdaQueryWrapper<Order> orderWrapper = Wrappers.lambdaQuery();
|
||||||
|
orderWrapper.eq(Order::getFreezeOrderNo, out_order_no).last("limit 1");
|
||||||
|
Order order = orderService.getOne(orderWrapper);
|
||||||
|
order.setBatteryRent(bAmount);
|
||||||
|
orderService.updateById(order);
|
||||||
|
log.info("更新冻结金额!冻结单号{}", out_order_no);
|
||||||
|
|
||||||
|
LambdaUpdateWrapper<OrderPay> orderPayWrapper = Wrappers.lambdaUpdate();
|
||||||
|
orderPayWrapper.eq(OrderPay::getRentOrderId, order.getOrderId())
|
||||||
|
.set(OrderPay::getBatteryRent, bAmount);
|
||||||
|
boolean bOrderRet = orderPayService.update(null, orderPayWrapper);
|
||||||
|
log.info("更新冻结支付订单结果{}!冻结单号{}", bOrderRet, out_order_no);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
writer = response.getWriter();
|
writer = response.getWriter();
|
||||||
writer.write("success"); //一定要打印success
|
writer.write("success"); //一定要打印success
|
||||||
@@ -253,6 +282,9 @@ public class FreezeOrderController extends BaseController {
|
|||||||
}
|
}
|
||||||
// return "success";
|
// return "success";
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
log.warn("解冻消息{}已处理!", notify_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// return "fail";
|
// return "fail";
|
||||||
@@ -261,27 +293,36 @@ public class FreezeOrderController extends BaseController {
|
|||||||
|
|
||||||
@PostMapping("/checkFreeze/{orderId}")
|
@PostMapping("/checkFreeze/{orderId}")
|
||||||
public ApiResult<?> checkFreeze(@PathVariable Integer orderId) throws AlipayApiException {
|
public ApiResult<?> checkFreeze(@PathVariable Integer orderId) throws AlipayApiException {
|
||||||
|
|
||||||
DateTime now = DateUtil.date();
|
|
||||||
|
|
||||||
Order order = orderService.getById(orderId);
|
Order order = orderService.getById(orderId);
|
||||||
|
Integer iFreeze = order.getIsFreeze();
|
||||||
|
|
||||||
if (order.getOrderSource() == 30 || order.getOrderSource() == 40) {
|
if (iFreeze == 0 && (order.getOrderSource() == 30 || order.getOrderSource() == 40)) {
|
||||||
AlipayFundAuthOperationDetailQueryResponse response = freezeOrderService.query(order);
|
AlipayFundAuthOperationDetailQueryResponse response = freezeOrderService.query(order);
|
||||||
String status = response.getStatus();
|
String status = response.getStatus();
|
||||||
boolean isFreeze = response.isSuccess() && "SUCCESS".equals(status);
|
String orderStatus = response.getOrderStatus();
|
||||||
if( !isFreeze) {
|
boolean bFreeze = response.isSuccess() && "SUCCESS".equals(status) && "FINISH".equals(orderStatus);
|
||||||
return fail();
|
if(!bFreeze) {
|
||||||
|
log.info("请求支付宝冻结接口返回数据:{}", JSON.toJSONString(response));
|
||||||
|
return fail("未支付押金!");
|
||||||
}
|
}
|
||||||
|
log.info("订单{}已支付押金!", orderId);
|
||||||
|
order.setIsFreeze(1);
|
||||||
|
orderService.updateById(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
final EquipmentGoods eg = equipmentGoodsService.getById(order.getOrderSourceId());
|
LambdaQueryWrapper<OrderPay> wrapper = Wrappers.lambdaQuery();
|
||||||
|
wrapper.eq(OrderPay::getRentOrderId, orderId).eq(OrderPay::getCurrPeriods, 1).last("limit 1");
|
||||||
|
OrderPay renewOrder = orderPayService.getOne(wrapper);
|
||||||
|
if(null != renewOrder) {
|
||||||
|
// renewOrder.setOrderNo(IdUtil.getSnowflakeNextIdStr());
|
||||||
|
// orderPayService.updateById(renewOrder);
|
||||||
|
return success(renewOrder);
|
||||||
|
}
|
||||||
|
|
||||||
order.setIsFreeze(1);
|
|
||||||
orderService.updateById(order);
|
|
||||||
// 创建续费订单
|
// 创建续费订单
|
||||||
|
DateTime now = DateUtil.date();
|
||||||
OrderPay renewOrder = new OrderPay();
|
final EquipmentGoods eg = equipmentGoodsService.getById(order.getOrderSourceId());
|
||||||
|
renewOrder = new OrderPay();
|
||||||
renewOrder.setOrderNo(IdUtil.getSnowflakeNextIdStr());
|
renewOrder.setOrderNo(IdUtil.getSnowflakeNextIdStr());
|
||||||
renewOrder.setMerchantCode(order.getMerchantCode());
|
renewOrder.setMerchantCode(order.getMerchantCode());
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ public class MerchantController extends BaseController {
|
|||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<Merchant>> page(MerchantParam param) {
|
public ApiResult<PageResult<Merchant>> page(MerchantParam param) {
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
|
param.setStatus(0);
|
||||||
|
param.setLimit(20L);
|
||||||
return success(merchantService.pageRel(param));
|
return success(merchantService.pageRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,18 @@ package com.gxwebsoft.shop.controller;
|
|||||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
import com.gxwebsoft.shop.entity.MerchantWithdraw;
|
import com.gxwebsoft.shop.entity.MerchantWithdraw;
|
||||||
import com.gxwebsoft.shop.param.MerchantWithdrawParam;
|
import com.gxwebsoft.shop.param.MerchantWithdrawParam;
|
||||||
|
import com.gxwebsoft.shop.param.WithdrawApplyParam;
|
||||||
|
import com.gxwebsoft.shop.param.WithdrawAuditFailParam;
|
||||||
|
import com.gxwebsoft.shop.param.WithdrawAuditPassParam;
|
||||||
import com.gxwebsoft.shop.service.MerchantWithdrawService;
|
import com.gxwebsoft.shop.service.MerchantWithdrawService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -23,7 +26,7 @@ import java.util.List;
|
|||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2022-12-02 00:41:09
|
* @since 2022-12-02 00:41:09
|
||||||
*/
|
*/
|
||||||
@Api(tags = "商户提现记录管理")
|
@Api(tags = "商户提现管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/shop/merchant-withdraw")
|
@RequestMapping("/api/shop/merchant-withdraw")
|
||||||
public class MerchantWithdrawController extends BaseController {
|
public class MerchantWithdrawController extends BaseController {
|
||||||
@@ -31,7 +34,6 @@ public class MerchantWithdrawController extends BaseController {
|
|||||||
private MerchantWithdrawService merchantWithdrawService;
|
private MerchantWithdrawService merchantWithdrawService;
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:merchantWithdraw:list')")
|
@PreAuthorize("hasAuthority('shop:merchantWithdraw:list')")
|
||||||
@OperationLog
|
|
||||||
@ApiOperation("分页查询商户提现记录")
|
@ApiOperation("分页查询商户提现记录")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<MerchantWithdraw>> page(MerchantWithdrawParam param) {
|
public ApiResult<PageResult<MerchantWithdraw>> page(MerchantWithdrawParam param) {
|
||||||
@@ -40,7 +42,6 @@ public class MerchantWithdrawController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:merchantWithdraw:list')")
|
@PreAuthorize("hasAuthority('shop:merchantWithdraw:list')")
|
||||||
@OperationLog
|
|
||||||
@ApiOperation("查询全部商户提现记录")
|
@ApiOperation("查询全部商户提现记录")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public ApiResult<List<MerchantWithdraw>> list(MerchantWithdrawParam param) {
|
public ApiResult<List<MerchantWithdraw>> list(MerchantWithdrawParam param) {
|
||||||
@@ -48,7 +49,6 @@ public class MerchantWithdrawController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:merchantWithdraw:list')")
|
@PreAuthorize("hasAuthority('shop:merchantWithdraw:list')")
|
||||||
@OperationLog
|
|
||||||
@ApiOperation("根据id查询商户提现记录")
|
@ApiOperation("根据id查询商户提现记录")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ApiResult<MerchantWithdraw> get(@PathVariable("id") Integer id) {
|
public ApiResult<MerchantWithdraw> get(@PathVariable("id") Integer id) {
|
||||||
@@ -56,75 +56,112 @@ public class MerchantWithdrawController extends BaseController {
|
|||||||
return success(merchantWithdrawService.getByIdRel(id));
|
return success(merchantWithdrawService.getByIdRel(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:merchantWithdraw:save')")
|
|
||||||
@OperationLog
|
@OperationLog
|
||||||
@ApiOperation("添加商户提现记录")
|
@GetMapping("/page/app")
|
||||||
@PostMapping()
|
public ApiResult<PageResult<MerchantWithdraw>> appPage(MerchantWithdrawParam param) {
|
||||||
public ApiResult<?> save(@RequestBody MerchantWithdraw merchantWithdraw) {
|
User loginUser = getLoginUser();
|
||||||
|
param.setUserId(loginUser.getUserId());
|
||||||
|
return success(merchantWithdrawService.pageRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
// @PreAuthorize("hasAuthority('shop:merchantWithdraw:save')")
|
||||||
|
// @OperationLog
|
||||||
|
// @ApiOperation("添加商户提现记录")
|
||||||
|
// @PostMapping()
|
||||||
|
// public ApiResult<?> save(@RequestBody MerchantWithdraw merchantWithdraw) {
|
||||||
|
// // 记录当前登录用户id、租户id
|
||||||
|
// User loginUser = getLoginUser();
|
||||||
|
// if (loginUser != null) {
|
||||||
|
// merchantWithdraw.setUserId(loginUser.getUserId());
|
||||||
|
// }
|
||||||
|
// if (merchantWithdrawService.save(merchantWithdraw)) {
|
||||||
|
// return success("添加成功");
|
||||||
|
// }
|
||||||
|
// return fail("添加失败");
|
||||||
|
// }
|
||||||
|
|
||||||
|
@OperationLog
|
||||||
|
@ApiOperation("申请提现")
|
||||||
|
@PostMapping("apply")
|
||||||
|
public ApiResult apply(@RequestBody @Validated WithdrawApplyParam withdraw) {
|
||||||
// 记录当前登录用户id、租户id
|
// 记录当前登录用户id、租户id
|
||||||
User loginUser = getLoginUser();
|
User loginUser = getLoginUser();
|
||||||
if (loginUser != null) {
|
if (loginUser != null) {
|
||||||
merchantWithdraw.setUserId(loginUser.getUserId());
|
withdraw.setUserId(loginUser.getUserId());
|
||||||
|
return merchantWithdrawService.apply(withdraw);
|
||||||
}
|
}
|
||||||
if (merchantWithdrawService.save(merchantWithdraw)) {
|
return fail("申请提现失败");
|
||||||
return success("添加成功");
|
|
||||||
}
|
|
||||||
return fail("添加失败");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:merchantWithdraw:update')")
|
@PreAuthorize("hasAuthority('shop:merchantWithdraw:update')")
|
||||||
@OperationLog
|
@OperationLog
|
||||||
@ApiOperation("修改商户提现记录")
|
@ApiOperation("提现审核通过")
|
||||||
@PutMapping()
|
@PostMapping("audit/pass")
|
||||||
public ApiResult<?> update(@RequestBody MerchantWithdraw merchantWithdraw) {
|
public ApiResult auditSuccess(@RequestBody @Validated WithdrawAuditPassParam passParam) {
|
||||||
if (merchantWithdrawService.updateById(merchantWithdraw)) {
|
return merchantWithdrawService.auditSuccess(passParam);
|
||||||
return success("修改成功");
|
|
||||||
}
|
|
||||||
return fail("修改失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:merchantWithdraw:remove')")
|
|
||||||
@OperationLog
|
|
||||||
@ApiOperation("删除商户提现记录")
|
|
||||||
@DeleteMapping("/{id}")
|
|
||||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
|
||||||
if (merchantWithdrawService.removeById(id)) {
|
|
||||||
return success("删除成功");
|
|
||||||
}
|
|
||||||
return fail("删除失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:merchantWithdraw:save')")
|
|
||||||
@OperationLog
|
|
||||||
@ApiOperation("批量添加商户提现记录")
|
|
||||||
@PostMapping("/batch")
|
|
||||||
public ApiResult<?> saveBatch(@RequestBody List<MerchantWithdraw> list) {
|
|
||||||
if (merchantWithdrawService.saveBatch(list)) {
|
|
||||||
return success("添加成功");
|
|
||||||
}
|
|
||||||
return fail("添加失败");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:merchantWithdraw:update')")
|
@PreAuthorize("hasAuthority('shop:merchantWithdraw:update')")
|
||||||
@OperationLog
|
@OperationLog
|
||||||
@ApiOperation("批量修改商户提现记录")
|
@ApiOperation("提现审核拒绝")
|
||||||
@PutMapping("/batch")
|
@PostMapping("audit/reject")
|
||||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<MerchantWithdraw> batchParam) {
|
public ApiResult auditReject(@RequestBody @Validated WithdrawAuditFailParam rejectParam) {
|
||||||
if (batchParam.update(merchantWithdrawService, "id")) {
|
return merchantWithdrawService.auditFail(rejectParam);
|
||||||
return success("修改成功");
|
|
||||||
}
|
|
||||||
return fail("修改失败");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:merchantWithdraw:remove')")
|
// @PreAuthorize("hasAuthority('shop:merchantWithdraw:update')")
|
||||||
@OperationLog
|
// @OperationLog
|
||||||
@ApiOperation("批量删除商户提现记录")
|
// @ApiOperation("修改商户提现记录")
|
||||||
@DeleteMapping("/batch")
|
// @PutMapping()
|
||||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
// public ApiResult<?> update(@RequestBody MerchantWithdraw merchantWithdraw) {
|
||||||
if (merchantWithdrawService.removeByIds(ids)) {
|
// if (merchantWithdrawService.updateById(merchantWithdraw)) {
|
||||||
return success("删除成功");
|
// return success("修改成功");
|
||||||
}
|
// }
|
||||||
return fail("删除失败");
|
// return fail("修改失败");
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
// @PreAuthorize("hasAuthority('shop:merchantWithdraw:remove')")
|
||||||
|
// @OperationLog
|
||||||
|
// @ApiOperation("删除商户提现记录")
|
||||||
|
// @DeleteMapping("/{id}")
|
||||||
|
// public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
|
// if (merchantWithdrawService.removeById(id)) {
|
||||||
|
// return success("删除成功");
|
||||||
|
// }
|
||||||
|
// return fail("删除失败");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @PreAuthorize("hasAuthority('shop:merchantWithdraw:save')")
|
||||||
|
// @OperationLog
|
||||||
|
// @ApiOperation("批量添加商户提现记录")
|
||||||
|
// @PostMapping("/batch")
|
||||||
|
// public ApiResult<?> saveBatch(@RequestBody List<MerchantWithdraw> list) {
|
||||||
|
// if (merchantWithdrawService.saveBatch(list)) {
|
||||||
|
// return success("添加成功");
|
||||||
|
// }
|
||||||
|
// return fail("添加失败");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @PreAuthorize("hasAuthority('shop:merchantWithdraw:update')")
|
||||||
|
// @OperationLog
|
||||||
|
// @ApiOperation("批量修改商户提现记录")
|
||||||
|
// @PutMapping("/batch")
|
||||||
|
// public ApiResult<?> removeBatch(@RequestBody BatchParam<MerchantWithdraw> batchParam) {
|
||||||
|
// if (batchParam.update(merchantWithdrawService, "id")) {
|
||||||
|
// return success("修改成功");
|
||||||
|
// }
|
||||||
|
// return fail("修改失败");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @PreAuthorize("hasAuthority('shop:merchantWithdraw:remove')")
|
||||||
|
// @OperationLog
|
||||||
|
// @ApiOperation("批量删除商户提现记录")
|
||||||
|
// @DeleteMapping("/batch")
|
||||||
|
// public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
|
// if (merchantWithdrawService.removeByIds(ids)) {
|
||||||
|
// return success("删除成功");
|
||||||
|
// }
|
||||||
|
// return fail("删除失败");
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUnit;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||||
import cn.hutool.extra.qrcode.QrConfig;
|
import cn.hutool.extra.qrcode.QrConfig;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
@@ -30,6 +31,7 @@ import com.gxwebsoft.common.core.annotation.OperationLog;
|
|||||||
import com.gxwebsoft.common.core.config.ConfigProperties;
|
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||||
import com.gxwebsoft.common.core.utils.AlipayConfigUtil;
|
import com.gxwebsoft.common.core.utils.AlipayConfigUtil;
|
||||||
import com.gxwebsoft.common.core.web.*;
|
import com.gxwebsoft.common.core.web.*;
|
||||||
|
import com.gxwebsoft.common.system.entity.Role;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
import com.gxwebsoft.common.system.service.UserService;
|
import com.gxwebsoft.common.system.service.UserService;
|
||||||
import com.gxwebsoft.shop.entity.*;
|
import com.gxwebsoft.shop.entity.*;
|
||||||
@@ -78,27 +80,11 @@ public class OrderController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private OrderGoodsService orderGoodsService;
|
private OrderGoodsService orderGoodsService;
|
||||||
@Resource
|
@Resource
|
||||||
private OrderPayService orderPayService;
|
|
||||||
@Resource
|
|
||||||
private FreezeOrderService freezeOrderService;
|
private FreezeOrderService freezeOrderService;
|
||||||
@Resource
|
@Resource
|
||||||
private EquipmentOrderGoodsService equipmentOrderGoodsService;
|
private EquipmentOrderGoodsService equipmentOrderGoodsService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private AlipayConfigUtil alipayConfig;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private ConfigProperties pathConfig;
|
|
||||||
@Resource
|
|
||||||
private UserRefereeService userRefereeService;
|
|
||||||
@Resource
|
|
||||||
private UserService userService;
|
|
||||||
@Resource
|
|
||||||
private BcAgentService bcAgentService;
|
|
||||||
|
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:order:list')")
|
@PreAuthorize("hasAuthority('shop:order:list')")
|
||||||
@OperationLog
|
@OperationLog
|
||||||
@ApiOperation("分页查询订单记录表")
|
@ApiOperation("分页查询订单记录表")
|
||||||
@@ -108,12 +94,32 @@ public class OrderController extends BaseController {
|
|||||||
if ((param.getIsApp() == null || param.getIsApp() != true) && getMerchantCode() != null) {
|
if ((param.getIsApp() == null || param.getIsApp() != true) && getMerchantCode() != null) {
|
||||||
param.setMerchantCode(getMerchantCode());
|
param.setMerchantCode(getMerchantCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Integer expireDay = param.getExpireDay();
|
||||||
|
// if(null != expireDay){
|
||||||
|
// if(expireDay == -1){
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// TODO 暂不开放此条件
|
||||||
|
// Integer userId = param.getUserId();
|
||||||
|
// if(null != userId && userId > 0){
|
||||||
|
// // 取订单所属门店
|
||||||
|
// LambdaQueryWrapper<Merchant> mWrapper = Wrappers.lambdaQuery();
|
||||||
|
// mWrapper.eq(Merchant::getUserId, userId).last("limit 1");
|
||||||
|
// Merchant merchant = merchantService.getOne(mWrapper);
|
||||||
|
// if(null != merchant){
|
||||||
|
// param.setAppMerchantCode(merchant.getMerchantCode());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// 云芯威项目查询关联设备
|
// 云芯威项目查询关联设备
|
||||||
// 查询订单的关联商品
|
// 查询订单的关联商品
|
||||||
List<Order> list = orderService.listRel(param);
|
List<Order> list = orderService.listRel(param);
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(list)) {
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
return success(new PageResult<>(list, 0l));
|
return success(new PageResult<>(list, 0L));
|
||||||
}
|
}
|
||||||
Set<Integer> equipmentIds = new HashSet<>();
|
Set<Integer> equipmentIds = new HashSet<>();
|
||||||
Set<Integer> orderIds = new HashSet<>();
|
Set<Integer> orderIds = new HashSet<>();
|
||||||
@@ -123,7 +129,8 @@ public class OrderController extends BaseController {
|
|||||||
}
|
}
|
||||||
List<Equipment> equipmentList = equipmentService.list(Wrappers.lambdaQuery(Equipment.class).in(Equipment::getEquipmentId, equipmentIds));
|
List<Equipment> equipmentList = equipmentService.list(Wrappers.lambdaQuery(Equipment.class).in(Equipment::getEquipmentId, equipmentIds));
|
||||||
List<EquipmentOrderGoods> equipmentOrderGoodsList = equipmentOrderGoodsService.list(Wrappers.lambdaQuery(EquipmentOrderGoods.class).in(EquipmentOrderGoods::getOrderId, orderIds));
|
List<EquipmentOrderGoods> equipmentOrderGoodsList = equipmentOrderGoodsService.list(Wrappers.lambdaQuery(EquipmentOrderGoods.class).in(EquipmentOrderGoods::getOrderId, orderIds));
|
||||||
Map<Integer, List<Equipment>> equipmentCollect = equipmentList.stream().collect(Collectors.groupingBy(Equipment::getEquipmentId));
|
// Map<Integer, List<Equipment>> equipmentCollect = equipmentList.stream().collect(Collectors.groupingBy(Equipment::getEquipmentId));
|
||||||
|
Map<Integer, Equipment> equipmentCollect = equipmentList.stream().collect(Collectors.toMap(Equipment::getEquipmentId, e->e));
|
||||||
Map<Integer, List<EquipmentOrderGoods>> equipmentOrderGoodsCollect = equipmentOrderGoodsList.stream().collect(Collectors.groupingBy(EquipmentOrderGoods::getOrderId));
|
Map<Integer, List<EquipmentOrderGoods>> equipmentOrderGoodsCollect = equipmentOrderGoodsList.stream().collect(Collectors.groupingBy(EquipmentOrderGoods::getOrderId));
|
||||||
|
|
||||||
// 查询订单的设备
|
// 查询订单的设备
|
||||||
@@ -136,14 +143,19 @@ public class OrderController extends BaseController {
|
|||||||
}
|
}
|
||||||
EquipmentOrderGoods orderGoods = equipmentOrderGoods.get(0);
|
EquipmentOrderGoods orderGoods = equipmentOrderGoods.get(0);
|
||||||
order.setEquipmentGoods(orderGoods);
|
order.setEquipmentGoods(orderGoods);
|
||||||
List<Equipment> equipment = equipmentCollect.get(order.getEquipmentId());
|
// List<Equipment> equipment = equipmentCollect.get(order.getEquipmentId());
|
||||||
if (CollectionUtils.isNotEmpty(equipment)) {
|
// if (CollectionUtils.isNotEmpty(equipment)) {
|
||||||
order.setEquipment(equipment.get(0));
|
// order.setEquipment(equipment.get(0));
|
||||||
|
// }
|
||||||
|
Equipment equipment = equipmentCollect.get(order.getEquipmentId());
|
||||||
|
if(null != equipment){
|
||||||
|
order.setEquipment(equipment);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
PageParam<Order, OrderParam> page = new PageParam<>(param);
|
PageParam<Order, OrderParam> page = new PageParam<>(param);
|
||||||
return success(new PageResult<>(list, page.getTotal()));
|
PageResult ret = new PageResult<>(list, page.getTotal());
|
||||||
|
ret.setCount((long) list.size());
|
||||||
|
return success(ret);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -222,10 +234,15 @@ public class OrderController extends BaseController {
|
|||||||
public ApiResult<Order> get(@PathVariable("id") Integer id) {
|
public ApiResult<Order> get(@PathVariable("id") Integer id) {
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
Order order = orderService.getByIdRel(id);
|
Order order = orderService.getByIdRel(id);
|
||||||
|
if(null == order){
|
||||||
|
return fail("找不到订单", null);
|
||||||
|
}
|
||||||
// 云芯威关联设备查询
|
// 云芯威关联设备查询
|
||||||
if (!order.getGoodsId().equals(0) || !order.getEquipmentId().equals(0)) {
|
Integer goodsId = order.getGoodsId();
|
||||||
|
Integer equipmentId = order.getEquipmentId();
|
||||||
|
if ((null != goodsId && !goodsId.equals(0)) || (null != equipmentId && !equipmentId.equals(0))) {
|
||||||
order.setEquipmentGoods(equipmentOrderGoodsService.getOne(new LambdaQueryWrapper<EquipmentOrderGoods>().eq(EquipmentOrderGoods::getOrderId, order.getOrderId())));
|
order.setEquipmentGoods(equipmentOrderGoodsService.getOne(new LambdaQueryWrapper<EquipmentOrderGoods>().eq(EquipmentOrderGoods::getOrderId, order.getOrderId())));
|
||||||
order.setEquipment(equipmentService.getById(order.getEquipmentId()));
|
order.setEquipment(equipmentService.getById(equipmentId));
|
||||||
}
|
}
|
||||||
return success(order);
|
return success(order);
|
||||||
}
|
}
|
||||||
@@ -359,7 +376,6 @@ public class OrderController extends BaseController {
|
|||||||
order.setPeriods(9999);
|
order.setPeriods(9999);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
order.setFreezeOrderNo(IdUtil.getSnowflakeNextIdStr());
|
order.setFreezeOrderNo(IdUtil.getSnowflakeNextIdStr());
|
||||||
order.setOutRequestNo(IdUtil.getSnowflakeNextIdStr());
|
order.setOutRequestNo(IdUtil.getSnowflakeNextIdStr());
|
||||||
if (orderService.save(order)) {
|
if (orderService.save(order)) {
|
||||||
|
|||||||
@@ -1,13 +1,20 @@
|
|||||||
package com.gxwebsoft.shop.controller;
|
package com.gxwebsoft.shop.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DateField;
|
import cn.hutool.core.date.DateField;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alipay.api.AlipayApiException;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.gxwebsoft.apps.entity.EquipmentGoods;
|
import com.gxwebsoft.apps.entity.EquipmentGoods;
|
||||||
import com.gxwebsoft.apps.service.EquipmentGoodsService;
|
import com.gxwebsoft.apps.service.EquipmentGoodsService;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.gxwebsoft.shop.entity.FreezeOrder;
|
||||||
import com.gxwebsoft.shop.entity.Order;
|
import com.gxwebsoft.shop.entity.Order;
|
||||||
|
import com.gxwebsoft.shop.service.FreezeOrderService;
|
||||||
import com.gxwebsoft.shop.service.OrderPayService;
|
import com.gxwebsoft.shop.service.OrderPayService;
|
||||||
import com.gxwebsoft.shop.entity.OrderPay;
|
import com.gxwebsoft.shop.entity.OrderPay;
|
||||||
import com.gxwebsoft.shop.param.OrderPayParam;
|
import com.gxwebsoft.shop.param.OrderPayParam;
|
||||||
@@ -19,6 +26,7 @@ import com.gxwebsoft.common.core.annotation.OperationLog;
|
|||||||
import com.gxwebsoft.shop.service.OrderService;
|
import com.gxwebsoft.shop.service.OrderService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -35,12 +43,15 @@ import static com.gxwebsoft.common.core.constants.OrderConstants.PAY_STATUS_NO_P
|
|||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2023-10-13 16:58:03
|
* @since 2023-10-13 16:58:03
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Api(tags = "订单记录表管理")
|
@Api(tags = "订单记录表管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/shop/order-pay")
|
@RequestMapping("/api/shop/order-pay")
|
||||||
public class OrderPayController extends BaseController {
|
public class OrderPayController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private OrderPayService orderPayService;
|
private OrderPayService orderPayService;
|
||||||
|
@Resource
|
||||||
|
private FreezeOrderService freezeOrderService;
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@@ -84,14 +95,15 @@ public class OrderPayController extends BaseController {
|
|||||||
.orderByAsc(OrderPay::getCreateTime)
|
.orderByAsc(OrderPay::getCreateTime)
|
||||||
.last("limit 1").one();
|
.last("limit 1").one();
|
||||||
|
|
||||||
|
Order order = orderService.getById(orderId);
|
||||||
|
|
||||||
|
EquipmentGoods eg = equipmentGoodsService.getById(order.getOrderSourceId());
|
||||||
// 是否提前续租
|
// 是否提前续租
|
||||||
if(one == null) {
|
if(one == null) {
|
||||||
Order order = orderService.getById(orderId);
|
|
||||||
if(ORDER_STATUS_OVER.equals(order.getOrderStatus())) {
|
if(ORDER_STATUS_OVER.equals(order.getOrderStatus())) {
|
||||||
return fail(null);
|
return fail(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
EquipmentGoods eg = equipmentGoodsService.getById(order.getOrderSourceId());
|
|
||||||
one = new OrderPay();
|
one = new OrderPay();
|
||||||
one.setOrderNo(IdUtil.getSnowflakeNextIdStr());
|
one.setOrderNo(IdUtil.getSnowflakeNextIdStr());
|
||||||
one.setMerchantCode(order.getMerchantCode());
|
one.setMerchantCode(order.getMerchantCode());
|
||||||
@@ -131,13 +143,46 @@ public class OrderPayController extends BaseController {
|
|||||||
one.setTotalPrice(price);
|
one.setTotalPrice(price);
|
||||||
one.setOrderPrice(price);
|
one.setOrderPrice(price);
|
||||||
one.setPayPrice(price);
|
one.setPayPrice(price);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
orderPayService.save(one);
|
orderPayService.save(one);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
one.setIsFreeze(order.getIsFreeze());
|
||||||
|
Integer isRenew = order.getIsRenew();
|
||||||
|
one.setIsRenew(isRenew);
|
||||||
|
|
||||||
|
if(isRenew == 0){
|
||||||
|
String freezeOrderNo = order.getFreezeOrderNo();
|
||||||
|
if(StrUtil.isNotBlank(freezeOrderNo)){
|
||||||
|
LambdaQueryWrapper<FreezeOrder> fWrapper = Wrappers.lambdaQuery();
|
||||||
|
fWrapper.eq(FreezeOrder::getOutOrderNo, freezeOrderNo)
|
||||||
|
.eq(FreezeOrder::getOperationType, "FREEZE")
|
||||||
|
.eq(FreezeOrder::getStatus, "SUCCESS")
|
||||||
|
.last("limit 1");
|
||||||
|
int cnt = freezeOrderService.count(fWrapper);
|
||||||
|
if(cnt > 0) {
|
||||||
|
log.info("订单{}已支付支付押金!", orderId);
|
||||||
|
one.setHasFreeze(1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
log.info("订单{}未支付押金!", orderId);
|
||||||
|
// fWrapper.clear();
|
||||||
|
// fWrapper.eq(FreezeOrder::getOutOrderNo, freezeOrderNo)
|
||||||
|
// .eq(FreezeOrder::getStatus, "INIT");
|
||||||
|
// boolean delRet = freezeOrderService.remove(fWrapper);
|
||||||
|
try {
|
||||||
|
String orderStr = freezeOrderService.freeze(order, eg);
|
||||||
|
one.setOrderStr(orderStr);
|
||||||
|
log.info("订单{}支付请求参数:{}", orderId, orderStr);
|
||||||
|
} catch (AlipayApiException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
return fail("调用芝麻信用出错!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
one.setHasFreeze(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
one.setEquipmentCategory(eg.getEquipmentCategory());
|
||||||
return success(one);
|
return success(one);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.gxwebsoft.shop.controller;
|
package com.gxwebsoft.shop.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.copier.BeanCopier;
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alipay.api.AlipayApiException;
|
import com.alipay.api.AlipayApiException;
|
||||||
@@ -28,10 +30,12 @@ import com.gxwebsoft.shop.service.OrderService;
|
|||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.gxwebsoft.common.core.constants.OrderConstants.*;
|
import static com.gxwebsoft.common.core.constants.OrderConstants.*;
|
||||||
@@ -104,33 +108,44 @@ public class OrderRefundController extends BaseController {
|
|||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:orderRefund:update')")
|
@PreAuthorize("hasAuthority('shop:orderRefund:update')")
|
||||||
@OperationLog
|
@OperationLog
|
||||||
@ApiOperation("修改售后单记录表")
|
@ApiOperation(value = "修改售后单记录表", notes = "退租审核")
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
|
@Transactional
|
||||||
public ApiResult<?> update(@RequestBody OrderRefund orderRefund) throws AlipayApiException {
|
public ApiResult<?> update(@RequestBody OrderRefund orderRefund) throws AlipayApiException {
|
||||||
|
OrderRefund refund = orderRefundService.getById(orderRefund.getOrderRefundId());
|
||||||
|
BeanCopier.create(orderRefund, refund, CopyOptions.create().ignoreNullValue()).copy();
|
||||||
|
|
||||||
|
Integer auditStatus = orderRefund.getAuditStatus();
|
||||||
if (orderRefundService.updateById(orderRefund)) {
|
if(auditStatus.equals(20)){
|
||||||
if(orderRefund.getAuditStatus().equals(20)){
|
BigDecimal refundMoney = orderRefund.getRefundMoney();
|
||||||
final Integer orderId = orderRefund.getOrderId();
|
if(null == refundMoney){
|
||||||
final Order order = orderService.getById(orderId);
|
refundMoney = BigDecimal.ZERO;
|
||||||
System.out.println("order = " + order);
|
|
||||||
order.setReceiptStatus(RECEIPT_STATUS_RETURN);
|
|
||||||
order.setOrderStatus(ORDER_STATUS_OVER);
|
|
||||||
final Equipment equipment = equipmentService.getById(order.getEquipmentId());
|
|
||||||
equipment.setUserId(0);
|
|
||||||
equipmentService.updateById(equipment);
|
|
||||||
orderService.updateById(order);
|
|
||||||
freezeOrderService.unfreeze(order.getOrderId());
|
|
||||||
// freezeOrderService.deduction(order.getOrderId());
|
|
||||||
}else if(orderRefund.getAuditStatus().equals(30)) {
|
|
||||||
final Integer orderId = orderRefund.getOrderId();
|
|
||||||
final Order order = orderService.getById(orderId);
|
|
||||||
order.setReceiptStatus(RECEIPT_STATUS_YES);
|
|
||||||
orderService.updateById(order);
|
|
||||||
}
|
}
|
||||||
return success("操作成功");
|
|
||||||
|
final Integer orderId = orderRefund.getOrderId();
|
||||||
|
final Order order = orderService.getById(orderId);
|
||||||
|
// System.out.println("order = " + order);
|
||||||
|
|
||||||
|
Integer equipmentId = order.getEquipmentId();
|
||||||
|
if(null != equipmentId && equipmentId > 0){
|
||||||
|
Equipment equipment = equipmentService.getById(equipmentId);
|
||||||
|
equipment.setUserId(0);
|
||||||
|
equipmentService.updateById(equipment);
|
||||||
|
}
|
||||||
|
order.setReceiptStatus(RECEIPT_STATUS_RETURN);
|
||||||
|
order.setOrderStatus(ORDER_STATUS_OVER);
|
||||||
|
orderService.updateById(order);
|
||||||
|
freezeOrderService.unfreeze(order.getOrderId(), refundMoney);
|
||||||
|
// freezeOrderService.deduction(order.getOrderId());
|
||||||
}
|
}
|
||||||
return success("退租失败");
|
else if(auditStatus.equals(30)) {
|
||||||
|
final Integer orderId = orderRefund.getOrderId();
|
||||||
|
final Order order = orderService.getById(orderId);
|
||||||
|
order.setReceiptStatus(RECEIPT_STATUS_YES);
|
||||||
|
orderService.updateById(order);
|
||||||
|
}
|
||||||
|
orderRefundService.updateById(refund);
|
||||||
|
return success("操作成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -261,6 +261,11 @@ public class PaymentController extends BaseController {
|
|||||||
// 订单数据
|
// 订单数据
|
||||||
OrderPay order = orderPayService.getById(id);
|
OrderPay order = orderPayService.getById(id);
|
||||||
|
|
||||||
|
Order rentOrder = orderService.getById(order.getRentOrderId());
|
||||||
|
if(null != rentOrder && rentOrder.getIsRenew() == 0 && rentOrder.getIsFreeze() != 1){
|
||||||
|
return fail("押金订单未完成!");
|
||||||
|
}
|
||||||
|
|
||||||
Merchant merchant = merchantService.getMerchantByCode(order.getMerchantCode());
|
Merchant merchant = merchantService.getMerchantByCode(order.getMerchantCode());
|
||||||
|
|
||||||
// final EquipmentGoods eg = equipmentGoodsService.getById(order.getGoodsId());
|
// final EquipmentGoods eg = equipmentGoodsService.getById(order.getGoodsId());
|
||||||
@@ -297,7 +302,7 @@ public class PaymentController extends BaseController {
|
|||||||
response = alipayClient.certificateExecute(request);
|
response = alipayClient.certificateExecute(request);
|
||||||
if(response.isSuccess()){
|
if(response.isSuccess()){
|
||||||
String trade_no = response.getTradeNo();// 获取返回的tradeNO。
|
String trade_no = response.getTradeNo();// 获取返回的tradeNO。
|
||||||
return success("支付成功", trade_no);
|
return success("调用支付宝支付成功", trade_no);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,7 +311,7 @@ public class PaymentController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String trade_no = response.getTradeNo();// 获取返回的tradeNO。
|
String trade_no = response.getTradeNo();// 获取返回的tradeNO。
|
||||||
return success("支付成功", trade_no);
|
return success("调用支付宝支付成功", trade_no);
|
||||||
} catch (AlipayApiException e) {
|
} catch (AlipayApiException e) {
|
||||||
log.error(e.getErrMsg(), e);
|
log.error(e.getErrMsg(), e);
|
||||||
throw new RuntimeException();
|
throw new RuntimeException();
|
||||||
@@ -384,7 +389,7 @@ public class PaymentController extends BaseController {
|
|||||||
parentOrder.setOrderStatus(ORDER_STATUS_OVER);
|
parentOrder.setOrderStatus(ORDER_STATUS_OVER);
|
||||||
parentOrder.setExpirationTime(parse);
|
parentOrder.setExpirationTime(parse);
|
||||||
try {
|
try {
|
||||||
freezeOrderService.unfreeze(parentOrder.getOrderId());
|
freezeOrderService.unfreeze(parentOrder.getOrderId(), BigDecimal.ZERO);
|
||||||
} catch (AlipayApiException e) {
|
} catch (AlipayApiException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@@ -425,6 +430,12 @@ public class PaymentController extends BaseController {
|
|||||||
if (balance.compareTo(payPrice) < 0) {
|
if (balance.compareTo(payPrice) < 0) {
|
||||||
return fail("余额不足 = " + balance.compareTo(payPrice));
|
return fail("余额不足 = " + balance.compareTo(payPrice));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Order rentOrder = orderService.getById(order.getRentOrderId());
|
||||||
|
// if(null != rentOrder && rentOrder.getIsRenew() == 0 && rentOrder.getIsFreeze() != 1){
|
||||||
|
// return fail("押金订单未完成!");
|
||||||
|
// }
|
||||||
|
|
||||||
// 2. 扣除余额操作
|
// 2. 扣除余额操作
|
||||||
BigDecimal subtract = balance.subtract(payPrice);
|
BigDecimal subtract = balance.subtract(payPrice);
|
||||||
user.setBalance(subtract);
|
user.setBalance(subtract);
|
||||||
@@ -433,9 +444,10 @@ public class PaymentController extends BaseController {
|
|||||||
UserBalanceLog userBalanceLog = new UserBalanceLog();
|
UserBalanceLog userBalanceLog = new UserBalanceLog();
|
||||||
userBalanceLog.setUserId(userId);
|
userBalanceLog.setUserId(userId);
|
||||||
userBalanceLog.setScene(BALANCE_USE);
|
userBalanceLog.setScene(BALANCE_USE);
|
||||||
|
userBalanceLog.setSceneId(id);
|
||||||
userBalanceLog.setMoney(payPrice);
|
userBalanceLog.setMoney(payPrice);
|
||||||
userBalanceLog.setBalance(subtract);
|
userBalanceLog.setBalance(subtract);
|
||||||
userBalanceLog.setComments(order.getOrderNo().toString());
|
userBalanceLog.setComments("订单号:" + order.getOrderNo());
|
||||||
userBalanceLog.setMerchantCode(order.getMerchantCode());
|
userBalanceLog.setMerchantCode(order.getMerchantCode());
|
||||||
userBalanceLogService.save(userBalanceLog);
|
userBalanceLogService.save(userBalanceLog);
|
||||||
// 4. 修改支付状态
|
// 4. 修改支付状态
|
||||||
@@ -463,7 +475,7 @@ public class PaymentController extends BaseController {
|
|||||||
parentOrder.setOrderStatus(ORDER_STATUS_OVER);
|
parentOrder.setOrderStatus(ORDER_STATUS_OVER);
|
||||||
parentOrder.setExpirationTime(parse);
|
parentOrder.setExpirationTime(parse);
|
||||||
try {
|
try {
|
||||||
freezeOrderService.unfreeze(parentOrder.getOrderId());
|
freezeOrderService.unfreeze(parentOrder.getOrderId(), BigDecimal.ZERO);
|
||||||
} catch (AlipayApiException e) {
|
} catch (AlipayApiException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@@ -481,7 +493,8 @@ public class PaymentController extends BaseController {
|
|||||||
@ApiModelProperty("余额支付批量")
|
@ApiModelProperty("余额支付批量")
|
||||||
@PostMapping("/balanceBatch")
|
@PostMapping("/balanceBatch")
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public ApiResult<?> balanceBatch(@RequestBody List<Integer> orderIds) throws AlipayApiException {
|
@Deprecated
|
||||||
|
public ApiResult<?> balanceBatch(@RequestBody List<Integer> orderIds) {
|
||||||
// 1. 验证签名
|
// 1. 验证签名
|
||||||
isCheckSign();
|
isCheckSign();
|
||||||
// 订单数据
|
// 订单数据
|
||||||
@@ -512,9 +525,10 @@ public class PaymentController extends BaseController {
|
|||||||
UserBalanceLog userBalanceLog = new UserBalanceLog();
|
UserBalanceLog userBalanceLog = new UserBalanceLog();
|
||||||
userBalanceLog.setUserId(userId);
|
userBalanceLog.setUserId(userId);
|
||||||
userBalanceLog.setScene(BALANCE_USE);
|
userBalanceLog.setScene(BALANCE_USE);
|
||||||
|
userBalanceLog.setSceneId(d.getOrderId());
|
||||||
userBalanceLog.setMoney(payPrice);
|
userBalanceLog.setMoney(payPrice);
|
||||||
userBalanceLog.setBalance(subtract);
|
userBalanceLog.setBalance(subtract);
|
||||||
userBalanceLog.setComments(d.getOrderNo().toString());
|
userBalanceLog.setComments("订单号:" + d.getOrderNo());
|
||||||
userBalanceLog.setMerchantCode(d.getMerchantCode());
|
userBalanceLog.setMerchantCode(d.getMerchantCode());
|
||||||
userBalanceLogService.save(userBalanceLog);
|
userBalanceLogService.save(userBalanceLog);
|
||||||
// 4. 修改支付状态
|
// 4. 修改支付状态
|
||||||
@@ -534,7 +548,8 @@ public class PaymentController extends BaseController {
|
|||||||
parentOrder.setExpirationTime(nextMonthTime);
|
parentOrder.setExpirationTime(nextMonthTime);
|
||||||
orderService.updateById(parentOrder);
|
orderService.updateById(parentOrder);
|
||||||
// 保存续费订单状态
|
// 保存续费订单状态
|
||||||
d.setDeliveryStatus(DELIVERY_STATUS_YES);
|
// d.setDeliveryStatus(DELIVERY_STATUS_YES);
|
||||||
|
d.setDeliveryStatus(DELIVERY_STATUS_ACCEPT);
|
||||||
d.setReceiptStatus(RECEIPT_STATUS_YES);
|
d.setReceiptStatus(RECEIPT_STATUS_YES);
|
||||||
d.setOrderStatus(ORDER_STATUS_COMPLETED);
|
d.setOrderStatus(ORDER_STATUS_COMPLETED);
|
||||||
d.setStartTime(expirationTime);
|
d.setStartTime(expirationTime);
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package com.gxwebsoft.shop.controller;
|
package com.gxwebsoft.shop.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
import com.gxwebsoft.shop.service.ProfitLogService;
|
import com.gxwebsoft.shop.service.ProfitLogService;
|
||||||
@@ -16,6 +19,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,9 +40,26 @@ public class ProfitLogController extends BaseController {
|
|||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<ProfitLog>> page(ProfitLogParam param) {
|
public ApiResult<PageResult<ProfitLog>> page(ProfitLogParam param) {
|
||||||
PageParam<ProfitLog, ProfitLogParam> page = new PageParam<>(param);
|
PageParam<ProfitLog, ProfitLogParam> page = new PageParam<>(param);
|
||||||
page.setDefaultOrder("create_time desc");
|
QueryWrapper<ProfitLog> wrapper = page.getWrapper();
|
||||||
PageParam<ProfitLog, ProfitLogParam> result = profitLogService.page(page, page.getWrapper());
|
LocalDate beginDate = param.getBeginDate();
|
||||||
return success(result);
|
wrapper.ge(null != beginDate, "create_time", beginDate);
|
||||||
|
LocalDate endDate = param.getEndDate();
|
||||||
|
if(null != endDate){
|
||||||
|
wrapper.lt("create_time", endDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapper.orderByDesc("create_time");
|
||||||
|
Page<ProfitLog> result = profitLogService.page(new Page<>(param.getPage(), param.getLimit()), wrapper);
|
||||||
|
|
||||||
|
JSONObject total = new JSONObject();
|
||||||
|
wrapper.select("ifnull(sum(money), 0) money");
|
||||||
|
ProfitLog sum = profitLogService.getOne(wrapper);
|
||||||
|
if(null != sum){
|
||||||
|
total.put("total", sum.getMoney());
|
||||||
|
}
|
||||||
|
PageResult<ProfitLog> retPage = new PageResult<>(result.getRecords(), result.getTotal());
|
||||||
|
retPage.setOtherData(total);
|
||||||
|
return success(retPage);
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
// return success(profitLogService.pageRel(param));
|
// return success(profitLogService.pageRel(param));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ public class RechargeOrderController extends BaseController {
|
|||||||
UserBalanceLog userBalanceLog = new UserBalanceLog();
|
UserBalanceLog userBalanceLog = new UserBalanceLog();
|
||||||
userBalanceLog.setUserId(rechargeOrder.getUserId());
|
userBalanceLog.setUserId(rechargeOrder.getUserId());
|
||||||
userBalanceLog.setScene(BALANCE_ADMIN);
|
userBalanceLog.setScene(BALANCE_ADMIN);
|
||||||
|
userBalanceLog.setSceneId(rechargeOrder.getOrderId());
|
||||||
userBalanceLog.setMoney(rechargeOrder.getPayPrice());
|
userBalanceLog.setMoney(rechargeOrder.getPayPrice());
|
||||||
userBalanceLog.setBalance(balance);
|
userBalanceLog.setBalance(balance);
|
||||||
userBalanceLog.setComments("操作人:" + getLoginUser().getNickname());
|
userBalanceLog.setComments("操作人:" + getLoginUser().getNickname());
|
||||||
@@ -158,6 +159,7 @@ public class RechargeOrderController extends BaseController {
|
|||||||
UserBalanceLog userBalanceLog = new UserBalanceLog();
|
UserBalanceLog userBalanceLog = new UserBalanceLog();
|
||||||
userBalanceLog.setUserId(d.getUserId());
|
userBalanceLog.setUserId(d.getUserId());
|
||||||
userBalanceLog.setScene(BALANCE_ADMIN);
|
userBalanceLog.setScene(BALANCE_ADMIN);
|
||||||
|
userBalanceLog.setSceneId(d.getOrderId());
|
||||||
userBalanceLog.setMoney(d.getPayPrice());
|
userBalanceLog.setMoney(d.getPayPrice());
|
||||||
userBalanceLog.setBalance(balance);
|
userBalanceLog.setBalance(balance);
|
||||||
userBalanceLog.setComments("操作人:" + nickname);
|
userBalanceLog.setComments("操作人:" + nickname);
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ public class FreezeOrder implements Serializable {
|
|||||||
@ApiModelProperty(value = "冻结金额")
|
@ApiModelProperty(value = "冻结金额")
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "实际解冻金额")
|
||||||
|
private BigDecimal unfreezeAmount;
|
||||||
|
|
||||||
@ApiModelProperty(value = "手机号或邮箱")
|
@ApiModelProperty(value = "手机号或邮箱")
|
||||||
private String payeeLogonId;
|
private String payeeLogonId;
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,11 @@ import java.util.Date;
|
|||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商户提现记录
|
* 商户提现记录
|
||||||
@@ -23,6 +26,9 @@ import lombok.EqualsAndHashCode;
|
|||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@ApiModel(value = "MerchantWithdraw对象", description = "商户提现记录")
|
@ApiModel(value = "MerchantWithdraw对象", description = "商户提现记录")
|
||||||
@TableName("shop_merchant_withdraw")
|
@TableName("shop_merchant_withdraw")
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class MerchantWithdraw implements Serializable {
|
public class MerchantWithdraw implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -36,12 +42,18 @@ public class MerchantWithdraw implements Serializable {
|
|||||||
@ApiModelProperty(value = "用户ID")
|
@ApiModelProperty(value = "用户ID")
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户昵称")
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
@ApiModelProperty(value = "提现金额")
|
@ApiModelProperty(value = "提现金额")
|
||||||
private BigDecimal money;
|
private BigDecimal money;
|
||||||
|
|
||||||
@ApiModelProperty(value = "打款方式 (10微信 20支付宝 30银行卡)")
|
@ApiModelProperty(value = "收款方式 (10微信 20支付宝 30银行卡 40线下)")
|
||||||
private Integer payType;
|
private Integer payType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "收款方式 (10微信 20支付宝 30银行卡)")
|
||||||
|
private Integer cardType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "支付宝姓名")
|
@ApiModelProperty(value = "支付宝姓名")
|
||||||
private String alipayName;
|
private String alipayName;
|
||||||
|
|
||||||
@@ -57,7 +69,7 @@ public class MerchantWithdraw implements Serializable {
|
|||||||
@ApiModelProperty(value = "银行卡号")
|
@ApiModelProperty(value = "银行卡号")
|
||||||
private String bankCard;
|
private String bankCard;
|
||||||
|
|
||||||
@ApiModelProperty(value = "申请状态 (10待审核 20审核通过 30驳回 40已打款)")
|
@ApiModelProperty(value = "申请状态 (10待审核 20审核通过 30驳回)")
|
||||||
private Integer applyStatus;
|
private Integer applyStatus;
|
||||||
|
|
||||||
@ApiModelProperty(value = "驳回原因")
|
@ApiModelProperty(value = "驳回原因")
|
||||||
@@ -95,10 +107,6 @@ public class MerchantWithdraw implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String merchantName;
|
private String merchantName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "评论者昵称")
|
|
||||||
@TableField(exist = false)
|
|
||||||
private String nickname;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "评论者头像")
|
@ApiModelProperty(value = "评论者头像")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String avatar;
|
private String avatar;
|
||||||
@@ -107,4 +115,67 @@ public class MerchantWithdraw implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String realName;
|
private String realName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "卡类型描述")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String cardTypeDis;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "转账方式描述")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String payTypeDis;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态描述")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String applyStatusDis;
|
||||||
|
|
||||||
|
public String getCardTypeDis() {
|
||||||
|
if(null != cardType){
|
||||||
|
switch (cardType){
|
||||||
|
case 10:
|
||||||
|
cardTypeDis = "微信";
|
||||||
|
break;
|
||||||
|
case 20:
|
||||||
|
cardTypeDis = "支付宝";
|
||||||
|
break;
|
||||||
|
case 30:
|
||||||
|
cardTypeDis = "银行卡";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cardTypeDis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPayTypeDis() {
|
||||||
|
if(null != payType){
|
||||||
|
switch (payType){
|
||||||
|
case 10:
|
||||||
|
payTypeDis = "微信";
|
||||||
|
break;
|
||||||
|
case 20:
|
||||||
|
payTypeDis = "支付宝";
|
||||||
|
break;
|
||||||
|
case 30:
|
||||||
|
payTypeDis = "银行卡";
|
||||||
|
break;
|
||||||
|
case 40:
|
||||||
|
payTypeDis = "线下";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return payTypeDis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApplyStatusDis() {
|
||||||
|
if(null != applyStatus){
|
||||||
|
switch (applyStatus){
|
||||||
|
case 10:
|
||||||
|
applyStatusDis = "待审核";
|
||||||
|
break;
|
||||||
|
case 30:
|
||||||
|
applyStatusDis = "审核拒绝";
|
||||||
|
break;
|
||||||
|
case 20:
|
||||||
|
applyStatusDis = "审核通过";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return applyStatusDis;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.gxwebsoft.shop.entity;
|
package com.gxwebsoft.shop.entity;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUnit;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.gxwebsoft.apps.entity.Equipment;
|
import com.gxwebsoft.apps.entity.Equipment;
|
||||||
import com.gxwebsoft.apps.entity.EquipmentOrderGoods;
|
import com.gxwebsoft.apps.entity.EquipmentOrderGoods;
|
||||||
@@ -117,9 +119,10 @@ public class Order implements Serializable {
|
|||||||
@ApiModelProperty(value = "物流单号 (废弃)")
|
@ApiModelProperty(value = "物流单号 (废弃)")
|
||||||
private String expressNo;
|
private String expressNo;
|
||||||
|
|
||||||
@ApiModelProperty(value = "发货状态(10未发货 20已发货 30部分发货)")
|
@ApiModelProperty(value = "发货状态(10未发货 20已发货 30部分发货 40已绑定)")
|
||||||
private Integer deliveryStatus;
|
private Integer deliveryStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否交押金")
|
||||||
private Integer isFreeze;
|
private Integer isFreeze;
|
||||||
|
|
||||||
@ApiModelProperty(value = "发货时间")
|
@ApiModelProperty(value = "发货时间")
|
||||||
@@ -131,7 +134,7 @@ public class Order implements Serializable {
|
|||||||
@ApiModelProperty(value = "收货时间")
|
@ApiModelProperty(value = "收货时间")
|
||||||
private Date receiptTime;
|
private Date receiptTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "订单状态(10进行中 20取消 21待取消 30已完成)")
|
@ApiModelProperty(value = "订单状态(10待付款 20进行中 21待取消 30已绑定 40已完成)")
|
||||||
private Integer orderStatus;
|
private Integer orderStatus;
|
||||||
|
|
||||||
@ApiModelProperty(value = "赠送的积分数量")
|
@ApiModelProperty(value = "赠送的积分数量")
|
||||||
@@ -283,6 +286,10 @@ public class Order implements Serializable {
|
|||||||
@ApiModelProperty("逾期天数")
|
@ApiModelProperty("逾期天数")
|
||||||
private Integer expirationDay;
|
private Integer expirationDay;
|
||||||
|
|
||||||
|
@ApiModelProperty("剩余天数")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer restDay;
|
||||||
|
|
||||||
@ApiModelProperty("设备")
|
@ApiModelProperty("设备")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Equipment equipment;
|
private Equipment equipment;
|
||||||
@@ -306,4 +313,22 @@ public class Order implements Serializable {
|
|||||||
@ApiModelProperty("设备编码")
|
@ApiModelProperty("设备编码")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String equipmentCode;
|
private String equipmentCode;
|
||||||
|
|
||||||
|
public Integer getRestDay() {
|
||||||
|
if(null != orderStatus){
|
||||||
|
switch(orderStatus){
|
||||||
|
case 10:
|
||||||
|
case 40:
|
||||||
|
return 0;
|
||||||
|
case 20:
|
||||||
|
case 30:
|
||||||
|
default:
|
||||||
|
if(null == expirationTime){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return Math.toIntExact(DateUtil.between(new Date(), expirationTime, DateUnit.DAY, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return restDay;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.math.BigDecimal;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUnit;
|
import cn.hutool.core.date.DateUnit;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
@@ -175,6 +176,26 @@ public class OrderPay implements Serializable {
|
|||||||
@ApiModelProperty(value = "修改时间")
|
@ApiModelProperty(value = "修改时间")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否已交押金")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer isFreeze;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否续费单")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer isRenew;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "下单类型")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String equipmentCategory;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否存在成功的押金订单")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer hasFreeze;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "支付宝支付参数")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String orderStr;
|
||||||
|
|
||||||
public Long getExpirationDay() {
|
public Long getExpirationDay() {
|
||||||
switch(payStatus){
|
switch(payStatus){
|
||||||
case OrderConstants.PAY_STATUS_NO_PAY:
|
case OrderConstants.PAY_STATUS_NO_PAY:
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class OrderRefund implements Serializable {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "订单ID")
|
@ApiModelProperty(value = "订单ID")
|
||||||
private Integer orderId;
|
private Integer orderId;
|
||||||
@TableField(exist = false)
|
@ApiModelProperty(value = "订单编号")
|
||||||
private String orderNo;
|
private String orderNo;
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ public class OrderRefund implements Serializable {
|
|||||||
@ApiModelProperty(value = "用户申请原因(说明)")
|
@ApiModelProperty(value = "用户申请原因(说明)")
|
||||||
private String applyDesc;
|
private String applyDesc;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商家审核状态(0待审核 10已同意 20已拒绝)")
|
@ApiModelProperty(value = "商家审核状态(0待审核 10申请中 20已同意 30已拒绝)")
|
||||||
private Integer auditStatus;
|
private Integer auditStatus;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商家拒绝原因(说明)")
|
@ApiModelProperty(value = "商家拒绝原因(说明)")
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.gxwebsoft.common.core.enums.EProfitScene;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -49,6 +50,10 @@ public class ProfitLog implements Serializable {
|
|||||||
@ApiModelProperty(value = "收益类型(1资产收益,2服务费收益,3推广收益,4门店业绩提成,5站点业绩提成)")
|
@ApiModelProperty(value = "收益类型(1资产收益,2服务费收益,3推广收益,4门店业绩提成,5站点业绩提成)")
|
||||||
private Integer scene;
|
private Integer scene;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "收益类型描述")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String sceneDis;
|
||||||
|
|
||||||
@ApiModelProperty(value = "变动金额")
|
@ApiModelProperty(value = "变动金额")
|
||||||
private BigDecimal money;
|
private BigDecimal money;
|
||||||
|
|
||||||
@@ -74,16 +79,19 @@ public class ProfitLog implements Serializable {
|
|||||||
@ApiModelProperty(value = "商户编码")
|
@ApiModelProperty(value = "商户编码")
|
||||||
private String merchantCode;
|
private String merchantCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商户名称")
|
||||||
private String merchantName;
|
private String merchantName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "设备编码")
|
@ApiModelProperty(value = "设备编码")
|
||||||
private String equipmentCode;
|
private String equipmentCode;
|
||||||
|
|
||||||
@ApiModelProperty(value = "设备编码")
|
@ApiModelProperty(value = "设备编号")
|
||||||
private Integer equipmentId;
|
private Integer equipmentId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单用户名")
|
||||||
private String orderUserName;
|
private String orderUserName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单用户手机号")
|
||||||
private String orderUserPhone;
|
private String orderUserPhone;
|
||||||
|
|
||||||
@ApiModelProperty(value = "租户id")
|
@ApiModelProperty(value = "租户id")
|
||||||
@@ -95,4 +103,10 @@ public class ProfitLog implements Serializable {
|
|||||||
@ApiModelProperty(value = "修改时间")
|
@ApiModelProperty(value = "修改时间")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
public String getSceneDis() {
|
||||||
|
if(null != scene){
|
||||||
|
return EProfitScene.getNameByValue(scene);
|
||||||
|
}
|
||||||
|
return sceneDis;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,11 @@ import java.util.Date;
|
|||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户余额变动明细表
|
* 用户余额变动明细表
|
||||||
@@ -23,6 +26,9 @@ import lombok.EqualsAndHashCode;
|
|||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@ApiModel(value = "UserBalanceLog对象", description = "用户余额变动明细表")
|
@ApiModel(value = "UserBalanceLog对象", description = "用户余额变动明细表")
|
||||||
@TableName("shop_user_balance_log")
|
@TableName("shop_user_balance_log")
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class UserBalanceLog implements Serializable {
|
public class UserBalanceLog implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -33,9 +39,12 @@ public class UserBalanceLog implements Serializable {
|
|||||||
@ApiModelProperty(value = "用户ID")
|
@ApiModelProperty(value = "用户ID")
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "余额变动场景(10用户充值 20用户消费 30管理员操作 40订单退款)")
|
@ApiModelProperty(value = "余额变动场景(10用户充值 20用户消费 30管理员操作 40订单退款, 50用户提现,60提现失败)")
|
||||||
private Integer scene;
|
private Integer scene;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "场景来源单号")
|
||||||
|
private Integer sceneId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "变动金额")
|
@ApiModelProperty(value = "变动金额")
|
||||||
private BigDecimal money;
|
private BigDecimal money;
|
||||||
|
|
||||||
|
|||||||
@@ -62,10 +62,10 @@ public interface OrderMapper extends BaseMapper<Order> {
|
|||||||
* 查找到期预警订单
|
* 查找到期预警订单
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Select("select u.phone userPhone, DATEDIFF(o.expiration_time,CURDATE()) expirationDay " +
|
@Select("select u.phone, DATEDIFF(o.expiration_time,CURDATE()) expirationDay " +
|
||||||
"from shop_order o join sys_user u on o.user_id = u.user_id " +
|
"from shop_order o join sys_user u on o.user_id = u.user_id " +
|
||||||
"where DATEDIFF(o.expiration_time,CURDATE()) in (-1, 0) and u.phone is not null " +
|
"where DATEDIFF(o.expiration_time,CURDATE()) in (1, 0) and u.phone is not null " +
|
||||||
"and o.is_freeze = 1 and o.receipt_status != 10 and o.pay_status = 10 and o.is_renew = 1")
|
"and o.pay_status = 20 and o.order_status != 40")
|
||||||
@ResultType(Order.class)
|
@ResultType(Order.class)
|
||||||
List<Order> selectAlertList();
|
List<Order> selectAlertList();
|
||||||
|
|
||||||
@@ -73,10 +73,10 @@ public interface OrderMapper extends BaseMapper<Order> {
|
|||||||
* 查找超期1天订单
|
* 查找超期1天订单
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Select("select u.phone userPhone, DATEDIFF(o.expiration_time,CURDATE()) expirationDay " +
|
@Select("select u.phone, DATEDIFF(o.expiration_time,CURDATE()) expirationDay " +
|
||||||
"from shop_order o join sys_user u on o.user_id = u.user_id " +
|
"from shop_order o join sys_user u on o.user_id = u.user_id " +
|
||||||
"where DATEDIFF(o.expiration_time,CURDATE()) = 1 and u.phone is not null " +
|
"where DATEDIFF(o.expiration_time,CURDATE()) = -1 and u.phone is not null " +
|
||||||
"and o.is_freeze = 1 and o.receipt_status != 10 and o.pay_status = 10 and o.is_renew = 1")
|
"and o.pay_status = 20 and o.order_status != 40")
|
||||||
@ResultType(Order.class)
|
@ResultType(Order.class)
|
||||||
List<Order> selectOutOfOneDayList();
|
List<Order> selectOutOfOneDayList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,7 +139,14 @@
|
|||||||
AND a.is_temporary = #{param.isTemporary}
|
AND a.is_temporary = #{param.isTemporary}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.userId != null">
|
<if test="param.userId != null">
|
||||||
AND a.user_id = #{param.userId}
|
<choose>
|
||||||
|
<when test="param.appMerchantCode != null">
|
||||||
|
AND (a.user_id = #{param.userId} or a.merchant_code = #{param.appMerchantCode})
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
AND a.user_id = #{param.userId}
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
<if test="param.userIds != null">
|
<if test="param.userIds != null">
|
||||||
AND a.user_id IN
|
AND a.user_id IN
|
||||||
@@ -192,6 +199,12 @@
|
|||||||
OR d.merchant_name LIKE CONCAT('%', #{param.keywords}, '%')
|
OR d.merchant_name LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.isExpire == 1">
|
||||||
|
AND curdate() > a.expiration_time AND a.order_status = 30
|
||||||
|
</if>
|
||||||
|
<if test="param.expireDay > 0">
|
||||||
|
AND #{param.expireDay} >= datediff(a.expiration_time, curdate()) AND a.order_status = 30
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|||||||
@@ -79,6 +79,9 @@
|
|||||||
<if test="param.createTimeEnd != null">
|
<if test="param.createTimeEnd != null">
|
||||||
AND a.create_time <= #{param.createTimeEnd}
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.orderNo != null">
|
||||||
|
AND a.order_no = #{param.orderNo}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,7 +27,7 @@ import java.util.Date;
|
|||||||
public class MerchantWithdrawParam extends BaseParam {
|
public class MerchantWithdrawParam extends BaseParam {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ApiModelProperty(value = "主键ID")
|
@ApiModelProperty(value = "主键")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@@ -34,67 +35,24 @@ public class MerchantWithdrawParam extends BaseParam {
|
|||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private String withdrawCode;
|
private String withdrawCode;
|
||||||
|
|
||||||
@ApiModelProperty(value = "用户ID")
|
@ApiModelProperty(value = "用户昵称")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer userId;
|
private Integer nickname;
|
||||||
|
|
||||||
@ApiModelProperty(value = "提现金额")
|
|
||||||
@QueryField(type = QueryType.EQ)
|
|
||||||
private BigDecimal money;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "打款方式 (10微信 20支付宝 30银行卡)")
|
@ApiModelProperty(value = "打款方式 (10微信 20支付宝 30银行卡)")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer payType;
|
private Integer payType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "支付宝姓名")
|
|
||||||
private String alipayName;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "支付宝账号")
|
|
||||||
private String alipayAccount;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "开户行名称")
|
|
||||||
private String bankName;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "银行开户名")
|
|
||||||
private String bankAccount;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "银行卡号")
|
|
||||||
private String bankCard;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "申请状态 (10待审核 20审核通过 30驳回 40已打款)")
|
@ApiModelProperty(value = "申请状态 (10待审核 20审核通过 30驳回 40已打款)")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer applyStatus;
|
private Integer applyStatus;
|
||||||
|
|
||||||
@ApiModelProperty(value = "审核时间")
|
@ApiModelProperty(value = "开始日期")
|
||||||
@QueryField(type = QueryType.EQ)
|
private LocalDate beginDate;
|
||||||
private Integer auditTime;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "驳回原因")
|
@ApiModelProperty(value = "结束日期")
|
||||||
private String rejectReason;
|
private LocalDate endDate;
|
||||||
|
|
||||||
@ApiModelProperty(value = "来源客户端(APP、H5、小程序等)")
|
|
||||||
private String platform;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
|
||||||
@QueryField(type = QueryType.EQ)
|
|
||||||
private Integer sortNumber;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "备注")
|
|
||||||
private String comments;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
|
||||||
@QueryField(type = QueryType.EQ)
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
|
||||||
@QueryField(type = QueryType.EQ)
|
|
||||||
private Integer deleted;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "关联商户编号")
|
|
||||||
private String merchantCode;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商户名称")
|
|
||||||
@QueryField(type = QueryType.LIKE)
|
|
||||||
private String merchantName;
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户编号", hidden = true)
|
||||||
|
private Integer userId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ public class OrderParam extends BaseParam {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "支付方式(废弃)")
|
@ApiModelProperty(value = "支付方式(废弃)")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
|
@Deprecated
|
||||||
private Integer payType;
|
private Integer payType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "支付方式(余额/微信/支付宝)")
|
@ApiModelProperty(value = "支付方式(余额/微信/支付宝)")
|
||||||
@@ -198,6 +199,10 @@ public class OrderParam extends BaseParam {
|
|||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private String merchantCode;
|
private String merchantCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商户编号", notes="用于小程序端查询门店客户订单")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String appMerchantCode;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商户名称")
|
@ApiModelProperty(value = "商户名称")
|
||||||
@QueryField(type = QueryType.LIKE)
|
@QueryField(type = QueryType.LIKE)
|
||||||
private String merchantName;
|
private String merchantName;
|
||||||
@@ -218,7 +223,6 @@ public class OrderParam extends BaseParam {
|
|||||||
private Integer deleted;
|
private Integer deleted;
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否按代报餐查询")
|
@ApiModelProperty(value = "是否按代报餐查询")
|
||||||
@TableField(exist = false)
|
|
||||||
private Boolean agent;
|
private Boolean agent;
|
||||||
|
|
||||||
@ApiModelProperty(value = "租户ID")
|
@ApiModelProperty(value = "租户ID")
|
||||||
@@ -226,19 +230,15 @@ public class OrderParam extends BaseParam {
|
|||||||
private Integer tenantId;
|
private Integer tenantId;
|
||||||
|
|
||||||
@ApiModelProperty("搜索关键字")
|
@ApiModelProperty("搜索关键字")
|
||||||
@TableField(exist = false)
|
|
||||||
private String keywords;
|
private String keywords;
|
||||||
|
|
||||||
@ApiModelProperty(value = "签名")
|
@ApiModelProperty(value = "签名")
|
||||||
@TableField(exist = false)
|
|
||||||
private String sign;
|
private String sign;
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否查询订单商品")
|
@ApiModelProperty(value = "是否查询订单商品")
|
||||||
@TableField(exist = false)
|
|
||||||
private Boolean showGoodsList;
|
private Boolean showGoodsList;
|
||||||
|
|
||||||
@ApiModelProperty(value = "用户id集合")
|
@ApiModelProperty(value = "用户id集合")
|
||||||
@TableField(exist = false)
|
|
||||||
private Set<Integer> userIds;
|
private Set<Integer> userIds;
|
||||||
|
|
||||||
private Boolean isApp;
|
private Boolean isApp;
|
||||||
@@ -247,4 +247,9 @@ public class OrderParam extends BaseParam {
|
|||||||
|
|
||||||
private Integer isFreeze;
|
private Integer isFreeze;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "到期天数")
|
||||||
|
private Integer expireDay;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否逾期")
|
||||||
|
private Integer isExpire;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.gxwebsoft.shop.param;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
@@ -10,32 +11,33 @@ import java.io.Serializable;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ApiModel("确认收货请求参数")
|
@ApiModel("确认收货请求参数")
|
||||||
|
@Validated
|
||||||
public class OrderReceiptParam implements Serializable {
|
public class OrderReceiptParam implements Serializable {
|
||||||
@ApiModelProperty(value = "订单ID", required = true)
|
@ApiModelProperty(value = "订单ID", required = true)
|
||||||
@NotNull(message = "订单编号不能为空!")
|
@NotNull(message = "订单编号不能为空!")
|
||||||
private Integer orderId;
|
private Integer orderId;
|
||||||
|
|
||||||
// @ApiModelProperty(value = "来源记录的参数 (json格式)", required = true)
|
@ApiModelProperty(value = "来源记录的参数 (json格式)", required = true)
|
||||||
// @NotBlank(message = "身份信息数据不能为空!")
|
@NotBlank(message = "身份信息数据不能为空!")
|
||||||
private String orderSourceData;
|
private String orderSourceData;
|
||||||
|
|
||||||
@ApiModelProperty(value = "验证码", required = true)
|
// @ApiModelProperty(value = "验证码", required = true)
|
||||||
@NotBlank(message = "验证码不能为空!")
|
// @NotBlank(message = "验证码不能为空!")
|
||||||
private String captcha;
|
private String captcha;
|
||||||
|
|
||||||
@ApiModelProperty(value = "收货人手机号", required = true)
|
// @ApiModelProperty(value = "收货人手机号", required = true)
|
||||||
@NotBlank(message = "收货人手机号不能为空!")
|
// @NotBlank(message = "收货人手机号不能为空!")
|
||||||
private String receiptPhone;
|
private String receiptPhone;
|
||||||
|
|
||||||
@ApiModelProperty(value = "紧急联系人")
|
// @ApiModelProperty(value = "紧急联系人")
|
||||||
@NotBlank(message = "紧急联系人不能为空!")
|
// @NotBlank(message = "紧急联系人不能为空!")
|
||||||
private String emergentUser;
|
private String emergentUser;
|
||||||
|
|
||||||
@ApiModelProperty(value = "单位地址")
|
// @ApiModelProperty(value = "单位地址")
|
||||||
@NotBlank(message = "单位地址不能为空!")
|
// @NotBlank(message = "单位地址不能为空!")
|
||||||
private String officeAddress;
|
private String officeAddress;
|
||||||
|
|
||||||
@ApiModelProperty(value = "家庭地址")
|
// @ApiModelProperty(value = "家庭地址")
|
||||||
@NotBlank(message = "家庭地址不能为空!")
|
// @NotBlank(message = "家庭地址不能为空!")
|
||||||
private String homeAddress;
|
private String homeAddress;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ public class OrderRefundParam extends BaseParam {
|
|||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer orderId;
|
private Integer orderId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单编号")
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
@ApiModelProperty(value = "订单商品ID")
|
@ApiModelProperty(value = "订单商品ID")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer orderGoodsId;
|
private Integer orderGoodsId;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 门店收益明细表查询参数
|
* 门店收益明细表查询参数
|
||||||
@@ -28,49 +29,37 @@ public class ProfitLogParam extends BaseParam {
|
|||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer profitId;
|
private Integer profitId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "订单ID")
|
@ApiModelProperty(value = "用户编号")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer orderId;
|
private Integer userId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "订单号")
|
@ApiModelProperty(value = "订单号")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private String orderNo;
|
private String orderNo;
|
||||||
|
|
||||||
@ApiModelProperty(value = "用户ID")
|
@ApiModelProperty(value = "用户名")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer userId;
|
private String orderUserName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商户编码")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private String merchantCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商户名")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private String merchantName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "收益类型(1资产收益,2服务费收益,3推广收益,4门店业绩提成,5站点业绩提成)")
|
@ApiModelProperty(value = "收益类型(1资产收益,2服务费收益,3推广收益,4门店业绩提成,5站点业绩提成)")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer scene;
|
private Integer scene;
|
||||||
|
|
||||||
@ApiModelProperty(value = "变动金额")
|
|
||||||
@QueryField(type = QueryType.EQ)
|
|
||||||
private BigDecimal money;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "变动后余额")
|
|
||||||
@QueryField(type = QueryType.EQ)
|
|
||||||
private BigDecimal balance;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "管理员备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
|
||||||
@QueryField(type = QueryType.EQ)
|
|
||||||
private Integer sortNumber;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "备注")
|
|
||||||
private String comments;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
@ApiModelProperty(value = "开始日期")
|
||||||
@QueryField(type = QueryType.EQ)
|
private LocalDate beginDate;
|
||||||
private Integer deleted;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "商户编码")
|
|
||||||
private String merchantCode;
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "结束日期")
|
||||||
|
private LocalDate endDate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.gxwebsoft.shop.param;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||||
|
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseParam;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户管理查询参数
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2022-11-30 15:10:54
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModel(value = "申请提现对象", description = "申请提现请求参数")
|
||||||
|
public class WithdrawApplyParam implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "提现金额", required = true)
|
||||||
|
@NotNull(message = "提现金额不能为空")
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "收款账号类型 (10微信 20支付宝 30银行卡),不传默认20")
|
||||||
|
private Integer cardType = 20;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "支付宝姓名")
|
||||||
|
private String alipayName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "支付宝账号")
|
||||||
|
private String alipayAccount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "开户行名称")
|
||||||
|
private String bankName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "银行开户名")
|
||||||
|
private String bankAccount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "银行卡号")
|
||||||
|
private String bankCard;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String comments;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户ID", hidden = true)
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.gxwebsoft.shop.param;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModel(value = "提现审核拒绝对象", description = "提现审核拒绝参数")
|
||||||
|
public class WithdrawAuditFailParam implements Serializable {
|
||||||
|
@ApiModelProperty(value = "主键ID", required = true)
|
||||||
|
@NotNull(message = "申请单号不能为空!")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "理由", required = true)
|
||||||
|
@NotEmpty(message = "拒绝理由不能为空!")
|
||||||
|
private String rejectReason;
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.gxwebsoft.shop.param;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModel(value = "提现审核成功对象", description = "提现审核成功参数")
|
||||||
|
public class WithdrawAuditPassParam implements Serializable {
|
||||||
|
@ApiModelProperty(value = "主键ID", required = true)
|
||||||
|
@NotNull(message = "申请单号不能为空!")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "收款方式 (10微信 20支付宝 30银行卡 40线下),不传默认40")
|
||||||
|
private Integer payType = 40;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String comments;
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.shop.entity.FreezeOrder;
|
|||||||
import com.gxwebsoft.shop.entity.Order;
|
import com.gxwebsoft.shop.entity.Order;
|
||||||
import com.gxwebsoft.shop.param.FreezeOrderParam;
|
import com.gxwebsoft.shop.param.FreezeOrderParam;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,9 +47,10 @@ public interface FreezeOrderService extends IService<FreezeOrder> {
|
|||||||
/**
|
/**
|
||||||
* 解冻
|
* 解冻
|
||||||
* @param orderId
|
* @param orderId
|
||||||
|
* @param unFreezeAmount 解冻金额
|
||||||
* @throws AlipayApiException
|
* @throws AlipayApiException
|
||||||
*/
|
*/
|
||||||
void unfreeze(Integer orderId) throws AlipayApiException;
|
void unfreeze(Integer orderId, BigDecimal unFreezeAmount) throws AlipayApiException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 冻结
|
* 冻结
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
package com.gxwebsoft.shop.service;
|
package com.gxwebsoft.shop.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.shop.entity.MerchantWithdraw;
|
import com.gxwebsoft.shop.entity.MerchantWithdraw;
|
||||||
import com.gxwebsoft.shop.param.MerchantWithdrawParam;
|
import com.gxwebsoft.shop.param.MerchantWithdrawParam;
|
||||||
|
import com.gxwebsoft.shop.param.WithdrawApplyParam;
|
||||||
|
import com.gxwebsoft.shop.param.WithdrawAuditFailParam;
|
||||||
|
import com.gxwebsoft.shop.param.WithdrawAuditPassParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -39,4 +43,24 @@ public interface MerchantWithdrawService extends IService<MerchantWithdraw> {
|
|||||||
*/
|
*/
|
||||||
MerchantWithdraw getByIdRel(Integer id);
|
MerchantWithdraw getByIdRel(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申请提现
|
||||||
|
* @param withdraw
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ApiResult apply(WithdrawApplyParam withdraw);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核通过
|
||||||
|
* @param succ
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ApiResult auditSuccess(WithdrawAuditPassParam succ);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核拒绝
|
||||||
|
* @param failParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ApiResult auditFail(WithdrawAuditFailParam failParam);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.gxwebsoft.shop.service.impl;
|
|||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alipay.api.AlipayApiException;
|
import com.alipay.api.AlipayApiException;
|
||||||
import com.alipay.api.DefaultAlipayClient;
|
import com.alipay.api.DefaultAlipayClient;
|
||||||
@@ -21,6 +22,7 @@ import com.gxwebsoft.common.core.web.PageParam;
|
|||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.shop.service.OrderPayService;
|
import com.gxwebsoft.shop.service.OrderPayService;
|
||||||
import com.gxwebsoft.shop.service.OrderService;
|
import com.gxwebsoft.shop.service.OrderService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
@@ -34,6 +36,7 @@ import java.util.List;
|
|||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2023-10-08 10:15:22
|
* @since 2023-10-08 10:15:22
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class FreezeOrderServiceImpl extends ServiceImpl<FreezeOrderMapper, FreezeOrder> implements FreezeOrderService {
|
public class FreezeOrderServiceImpl extends ServiceImpl<FreezeOrderMapper, FreezeOrder> implements FreezeOrderService {
|
||||||
|
|
||||||
@@ -73,7 +76,7 @@ public class FreezeOrderServiceImpl extends ServiceImpl<FreezeOrderMapper, Freez
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unfreeze(Integer orderId) throws AlipayApiException {
|
public void unfreeze(Integer orderId, BigDecimal unFreezeAmount) throws AlipayApiException {
|
||||||
Order order = orderService.getById(orderId);
|
Order order = orderService.getById(orderId);
|
||||||
if (!StringUtils.hasText(order.getFreezeOrderNo()) || order.getOrderSource() == 10) {
|
if (!StringUtils.hasText(order.getFreezeOrderNo()) || order.getOrderSource() == 10) {
|
||||||
return;
|
return;
|
||||||
@@ -82,6 +85,11 @@ public class FreezeOrderServiceImpl extends ServiceImpl<FreezeOrderMapper, Freez
|
|||||||
FreezeOrder freezeOrder = this.lambdaQuery().eq(FreezeOrder::getOutOrderNo, order.getFreezeOrderNo())
|
FreezeOrder freezeOrder = this.lambdaQuery().eq(FreezeOrder::getOutOrderNo, order.getFreezeOrderNo())
|
||||||
.eq(FreezeOrder::getStatus, "SUCCESS").orderByDesc(FreezeOrder::getCreateTime).last("limit 1").one();
|
.eq(FreezeOrder::getStatus, "SUCCESS").orderByDesc(FreezeOrder::getCreateTime).last("limit 1").one();
|
||||||
|
|
||||||
|
if(null == unFreezeAmount || unFreezeAmount.compareTo(BigDecimal.ZERO) == 0){
|
||||||
|
unFreezeAmount = freezeOrder.getAmount();
|
||||||
|
}
|
||||||
|
freezeOrder.setUnfreezeAmount(unFreezeAmount);
|
||||||
|
|
||||||
DefaultAlipayClient alipayClient = alipayConfig.alipayClient(6);
|
DefaultAlipayClient alipayClient = alipayConfig.alipayClient(6);
|
||||||
AlipayFundAuthOrderUnfreezeRequest request = new AlipayFundAuthOrderUnfreezeRequest();
|
AlipayFundAuthOrderUnfreezeRequest request = new AlipayFundAuthOrderUnfreezeRequest();
|
||||||
request.setNotifyUrl("https://yxw.wsdns.cn/api/shop/freeze-order/notify");
|
request.setNotifyUrl("https://yxw.wsdns.cn/api/shop/freeze-order/notify");
|
||||||
@@ -101,12 +109,14 @@ public class FreezeOrderServiceImpl extends ServiceImpl<FreezeOrderMapper, Freez
|
|||||||
|
|
||||||
request.setBizContent(bizContent.toString());
|
request.setBizContent(bizContent.toString());
|
||||||
AlipayFundAuthOrderUnfreezeResponse response = alipayClient.certificateExecute(request);
|
AlipayFundAuthOrderUnfreezeResponse response = alipayClient.certificateExecute(request);
|
||||||
|
|
||||||
if (response.isSuccess()) {
|
if (response.isSuccess()) {
|
||||||
System.out.println("调用成功");
|
// System.out.println("调用成功");
|
||||||
System.out.println(response.getBody());
|
// log.info(response.getBody());
|
||||||
|
int updNum = baseMapper.updateById(freezeOrder);
|
||||||
|
log.info("解冻押金处理成功!订单号{},更新结果{}", orderId, updNum);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("调用失败");
|
log.warn("调用支付宝解冻接口失败!{}", response.getBody());
|
||||||
|
throw new AlipayApiException("调用押金解冻失败!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,18 +157,20 @@ public class FreezeOrderServiceImpl extends ServiceImpl<FreezeOrderMapper, Freez
|
|||||||
request.setBizContent(bizContent.toString());
|
request.setBizContent(bizContent.toString());
|
||||||
AlipayFundAuthOrderAppFreezeResponse response = alipayClient.sdkExecute(request);
|
AlipayFundAuthOrderAppFreezeResponse response = alipayClient.sdkExecute(request);
|
||||||
if (response.isSuccess()) {
|
if (response.isSuccess()) {
|
||||||
System.out.println("调用成功");
|
|
||||||
FreezeOrder freezeOrder = new FreezeOrder();
|
FreezeOrder freezeOrder = new FreezeOrder();
|
||||||
freezeOrder.setOutOrderNo(out_order_no);
|
freezeOrder.setOutOrderNo(out_order_no);
|
||||||
freezeOrder.setOutRequestNo(out_request_no);
|
freezeOrder.setOutRequestNo(out_request_no);
|
||||||
freezeOrder.setAmount(BigDecimal.valueOf(amount));
|
freezeOrder.setAmount(BigDecimal.valueOf(amount));
|
||||||
freezeOrder.setStatus("INIT");
|
freezeOrder.setStatus("INIT");
|
||||||
|
freezeOrder.setRelOrderId(order.getOrderId());
|
||||||
freezeOrder.setTenantId(6);
|
freezeOrder.setTenantId(6);
|
||||||
this.save(freezeOrder);
|
this.save(freezeOrder);
|
||||||
|
|
||||||
return response.getBody();
|
String responseBody = response.getBody();
|
||||||
|
log.info("调用芝麻信用成功!{}", responseBody);
|
||||||
|
return responseBody;
|
||||||
} else {
|
} else {
|
||||||
System.out.println("调用失败");
|
log.info("调用芝麻信用失败!{}", JSON.toJSONString(response));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ import static com.gxwebsoft.common.core.constants.RedisConstants.MERCHANT_GEO_KE
|
|||||||
public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> implements MerchantService {
|
public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> implements MerchantService {
|
||||||
@Resource
|
@Resource
|
||||||
private StringRedisTemplate stringRedisTemplate;
|
private StringRedisTemplate stringRedisTemplate;
|
||||||
@Resource
|
|
||||||
private CacheClient cacheClient;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<Merchant> pageRel(MerchantParam param) {
|
public PageResult<Merchant> pageRel(MerchantParam param) {
|
||||||
|
|||||||
@@ -1,14 +1,44 @@
|
|||||||
package com.gxwebsoft.shop.service.impl;
|
package com.gxwebsoft.shop.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alipay.api.AlipayApiException;
|
||||||
|
import com.alipay.api.AlipayClient;
|
||||||
|
import com.alipay.api.domain.AlipayFundTransUniTransferModel;
|
||||||
|
import com.alipay.api.domain.Participant;
|
||||||
|
import com.alipay.api.request.AlipayFundTransUniTransferRequest;
|
||||||
|
import com.alipay.api.response.AlipayFundTransUniTransferResponse;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gxwebsoft.common.core.constants.BalanceConstants;
|
||||||
|
import com.gxwebsoft.common.core.utils.AlipayConfigUtil;
|
||||||
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.gxwebsoft.common.system.service.UserService;
|
||||||
|
import com.gxwebsoft.shop.entity.Merchant;
|
||||||
|
import com.gxwebsoft.shop.entity.UserBalanceLog;
|
||||||
import com.gxwebsoft.shop.mapper.MerchantWithdrawMapper;
|
import com.gxwebsoft.shop.mapper.MerchantWithdrawMapper;
|
||||||
|
import com.gxwebsoft.shop.param.WithdrawApplyParam;
|
||||||
|
import com.gxwebsoft.shop.param.WithdrawAuditFailParam;
|
||||||
|
import com.gxwebsoft.shop.param.WithdrawAuditPassParam;
|
||||||
|
import com.gxwebsoft.shop.service.MerchantService;
|
||||||
import com.gxwebsoft.shop.service.MerchantWithdrawService;
|
import com.gxwebsoft.shop.service.MerchantWithdrawService;
|
||||||
import com.gxwebsoft.shop.entity.MerchantWithdraw;
|
import com.gxwebsoft.shop.entity.MerchantWithdraw;
|
||||||
import com.gxwebsoft.shop.param.MerchantWithdrawParam;
|
import com.gxwebsoft.shop.param.MerchantWithdrawParam;
|
||||||
import com.gxwebsoft.common.core.web.PageParam;
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.shop.service.UserBalanceLogService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,14 +48,28 @@ import java.util.List;
|
|||||||
* @since 2022-12-02 00:41:09
|
* @since 2022-12-02 00:41:09
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
public class MerchantWithdrawServiceImpl extends ServiceImpl<MerchantWithdrawMapper, MerchantWithdraw> implements MerchantWithdrawService {
|
public class MerchantWithdrawServiceImpl extends ServiceImpl<MerchantWithdrawMapper, MerchantWithdraw> implements MerchantWithdrawService {
|
||||||
|
private final UserService userService;
|
||||||
|
private final MerchantService merchantService;
|
||||||
|
private final UserBalanceLogService userBalanceLogService;
|
||||||
|
private final AlipayConfigUtil alipayConfig;
|
||||||
@Override
|
@Override
|
||||||
public PageResult<MerchantWithdraw> pageRel(MerchantWithdrawParam param) {
|
public PageResult<MerchantWithdraw> pageRel(MerchantWithdrawParam param) {
|
||||||
PageParam<MerchantWithdraw, MerchantWithdrawParam> page = new PageParam<>(param);
|
PageParam<MerchantWithdraw, MerchantWithdrawParam> page = new PageParam<>(param);
|
||||||
page.setDefaultOrder("create_time desc");
|
QueryWrapper wrapper = page.getWrapper();
|
||||||
List<MerchantWithdraw> list = baseMapper.selectPageRel(page, param);
|
LocalDate beginDate = param.getBeginDate();
|
||||||
return new PageResult<>(list, page.getTotal());
|
Integer userId = param.getUserId();
|
||||||
|
wrapper.eq(null != userId && userId > 0, "user_id", userId)
|
||||||
|
.ge(null != beginDate, "create_time", beginDate);
|
||||||
|
LocalDate endDate = param.getEndDate();
|
||||||
|
if(null != endDate){
|
||||||
|
wrapper.lt("create_time", endDate);
|
||||||
|
}
|
||||||
|
wrapper.orderByDesc("create_time");
|
||||||
|
Page<MerchantWithdraw> list = baseMapper.selectPage(page, wrapper);
|
||||||
|
return new PageResult<>(list.getRecords(), list.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -44,4 +88,223 @@ public class MerchantWithdrawServiceImpl extends ServiceImpl<MerchantWithdrawMap
|
|||||||
return param.getOne(baseMapper.selectListRel(param));
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public ApiResult apply(WithdrawApplyParam withdrawParam) {
|
||||||
|
// 判断用户可提现余额是否足够
|
||||||
|
Integer userId = withdrawParam.getUserId();
|
||||||
|
User user = userService.getById(userId);
|
||||||
|
BigDecimal amount = withdrawParam.getAmount();
|
||||||
|
BigDecimal balance = user.getBalance();
|
||||||
|
if(amount.compareTo(balance) > 0){
|
||||||
|
return ApiResult.fail("账户余额不足!");
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer tenantId = user.getTenantId();
|
||||||
|
Merchant merchant = merchantService.getOne(Wrappers.<Merchant>lambdaQuery()
|
||||||
|
.eq(Merchant::getMerchantOwner, userId)
|
||||||
|
.eq(Merchant::getTenantId, tenantId)
|
||||||
|
.last("limit 1"));
|
||||||
|
|
||||||
|
Integer cardType = withdrawParam.getCardType();
|
||||||
|
String alipayName = withdrawParam.getAlipayName();
|
||||||
|
String alipayAccount = withdrawParam.getAlipayAccount();
|
||||||
|
String bankName = withdrawParam.getBankName();
|
||||||
|
String bankAccount = withdrawParam.getBankAccount();
|
||||||
|
String bankCard = withdrawParam.getBankCard();
|
||||||
|
|
||||||
|
if(cardType == 20){
|
||||||
|
if(StrUtil.isBlank(alipayName) || StrUtil.isBlank(alipayAccount)){
|
||||||
|
return ApiResult.fail("支付宝账户不能为空!");
|
||||||
|
}
|
||||||
|
} else if(cardType == 30) {
|
||||||
|
if(StrUtil.isBlank(bankName) || StrUtil.isBlank(bankAccount) || StrUtil.isBlank(bankCard)){
|
||||||
|
return ApiResult.fail("银行账户不能为空!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return ApiResult.fail("提现方式不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
MerchantWithdraw withdraw = MerchantWithdraw.builder()
|
||||||
|
.withdrawCode(IdUtil.getSnowflakeNextIdStr())
|
||||||
|
.userId(userId)
|
||||||
|
.nickname(user.getNickname())
|
||||||
|
.tenantId(tenantId)
|
||||||
|
.money(amount)
|
||||||
|
.cardType(cardType)
|
||||||
|
.alipayName(alipayName)
|
||||||
|
.alipayAccount(alipayAccount)
|
||||||
|
.bankName(bankName)
|
||||||
|
.bankAccount(bankAccount)
|
||||||
|
.bankCard(bankCard)
|
||||||
|
.sortNumber(1)
|
||||||
|
.applyStatus(10)
|
||||||
|
.status(0)
|
||||||
|
.deleted(0)
|
||||||
|
.createTime(new Date())
|
||||||
|
.updateTime(new Date())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
if(null != merchant){
|
||||||
|
withdraw.setMerchantCode(merchant.getMerchantCode());
|
||||||
|
}
|
||||||
|
baseMapper.insert(withdraw);
|
||||||
|
|
||||||
|
BigDecimal bBal = balance.subtract(amount);
|
||||||
|
UserBalanceLog bal = UserBalanceLog.builder()
|
||||||
|
.userId(userId)
|
||||||
|
.scene(BalanceConstants.BALANCE_WITHDRAW)
|
||||||
|
.avatar(user.getAvatar())
|
||||||
|
.merchantCode(withdraw.getMerchantCode())
|
||||||
|
.money(amount)
|
||||||
|
.balance(bBal)
|
||||||
|
.tenantId(tenantId)
|
||||||
|
.sortNumber(1)
|
||||||
|
.status(0)
|
||||||
|
.deleted(0)
|
||||||
|
.createTime(new Date())
|
||||||
|
.updateTime(new Date())
|
||||||
|
.build();
|
||||||
|
userBalanceLogService.save(bal);
|
||||||
|
|
||||||
|
user.setBalance(bBal);
|
||||||
|
userService.updateById(user);
|
||||||
|
return ApiResult.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public ApiResult auditSuccess(WithdrawAuditPassParam withdrawApplyParam) {
|
||||||
|
Integer id = withdrawApplyParam.getId();
|
||||||
|
MerchantWithdraw withdraw = baseMapper.selectById(id);
|
||||||
|
if(null == withdraw){
|
||||||
|
return ApiResult.fail("提现申请单不存在!");
|
||||||
|
}
|
||||||
|
int applyStatus = withdraw.getApplyStatus();
|
||||||
|
switch (applyStatus){
|
||||||
|
case 20:
|
||||||
|
return ApiResult.fail("提现申请单已审核通过!");
|
||||||
|
case 30:
|
||||||
|
return ApiResult.fail("提现申请单已审核驳回!");
|
||||||
|
case 10:
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer payType = withdrawApplyParam.getPayType();
|
||||||
|
if(payType == 20){
|
||||||
|
Integer cardType = withdraw.getCardType();
|
||||||
|
if(cardType != 20){
|
||||||
|
return ApiResult.fail("用户申请提现账号非支付宝,不能通过支付宝打款!");
|
||||||
|
}
|
||||||
|
|
||||||
|
ApiResult ret = transferByAlipay(withdraw);
|
||||||
|
if(!ret.isOk()){
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String comments = withdrawApplyParam.getComments();
|
||||||
|
withdraw.setApplyStatus(20);
|
||||||
|
if(StrUtil.isNotBlank(comments) && StrUtil.isBlank(withdraw.getComments())){
|
||||||
|
withdraw.setComments(comments);
|
||||||
|
}
|
||||||
|
withdraw.setUpdateTime(new Date());
|
||||||
|
baseMapper.updateById(withdraw);
|
||||||
|
return ApiResult.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过支付宝提现
|
||||||
|
* @param withdraw
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private ApiResult transferByAlipay(MerchantWithdraw withdraw) {
|
||||||
|
Integer id = withdraw.getId();
|
||||||
|
log.info("走支付宝渠道提现,申请单号{}。", id);
|
||||||
|
String amount = String.valueOf(withdraw.getMoney());
|
||||||
|
|
||||||
|
try{
|
||||||
|
AlipayClient alipayClient = alipayConfig.alipayClient(withdraw.getTenantId());
|
||||||
|
|
||||||
|
AlipayFundTransUniTransferRequest request = new AlipayFundTransUniTransferRequest();
|
||||||
|
AlipayFundTransUniTransferModel aliModel = new AlipayFundTransUniTransferModel();
|
||||||
|
aliModel.setOutBizNo(withdraw.getWithdrawCode());
|
||||||
|
aliModel.setRemark("安博驰");
|
||||||
|
aliModel.setBizScene("DIRECT_TRANSFER");
|
||||||
|
Participant payeeInfo = new Participant();
|
||||||
|
payeeInfo.setIdentity(withdraw.getUserId() + "");
|
||||||
|
payeeInfo.setIdentityType("ALIPAY_LOGON_ID");
|
||||||
|
payeeInfo.setName(withdraw.getAlipayName());
|
||||||
|
aliModel.setPayeeInfo(payeeInfo);
|
||||||
|
aliModel.setTransAmount(amount);
|
||||||
|
aliModel.setProductCode("TRANS_ACCOUNT_NO_PWD");
|
||||||
|
aliModel.setOrderTitle("安博驰");
|
||||||
|
request.setBizModel(aliModel);
|
||||||
|
log.info("提现单号{}提交支付宝转账参数:{}", id, JSON.toJSONString(aliModel));
|
||||||
|
|
||||||
|
AlipayFundTransUniTransferResponse response = alipayClient.certificateExecute(request);
|
||||||
|
if(response.isSuccess()){
|
||||||
|
log.info("支付宝转账成功!申请单号:{}", id);
|
||||||
|
return ApiResult.ok();
|
||||||
|
} else {
|
||||||
|
log.warn("支付宝转账不成功!{}" , JSON.toJSONString(response));
|
||||||
|
return ApiResult.fail("支付宝转账失败!" + response.getSubMsg());
|
||||||
|
}
|
||||||
|
}catch( AlipayApiException e){
|
||||||
|
log.error("支付宝转账出错!" + e.getMessage(), e);
|
||||||
|
return ApiResult.fail("支付宝提现出错!" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public ApiResult auditFail(WithdrawAuditFailParam failParam) {
|
||||||
|
Integer id = failParam.getId();
|
||||||
|
MerchantWithdraw withdraw = baseMapper.selectById(id);
|
||||||
|
if(null == withdraw){
|
||||||
|
return ApiResult.fail("提现申请单不存在!");
|
||||||
|
}
|
||||||
|
int applyStatus = withdraw.getApplyStatus();
|
||||||
|
switch (applyStatus){
|
||||||
|
case 20:
|
||||||
|
return ApiResult.fail("提现申请单已审核通过!");
|
||||||
|
case 30:
|
||||||
|
return ApiResult.fail("提现申请单已审核驳回!");
|
||||||
|
case 10:
|
||||||
|
}
|
||||||
|
|
||||||
|
String reason = failParam.getRejectReason();
|
||||||
|
if(StrUtil.isBlank(reason)){
|
||||||
|
reason = "提现审核拒绝";
|
||||||
|
}
|
||||||
|
withdraw.setApplyStatus(30);
|
||||||
|
withdraw.setRejectReason(reason);
|
||||||
|
withdraw.setUpdateTime(new Date());
|
||||||
|
baseMapper.updateById(withdraw);
|
||||||
|
|
||||||
|
Integer userId = withdraw.getUserId();
|
||||||
|
User user = userService.getById(userId);
|
||||||
|
BigDecimal balance = user.getBalance();
|
||||||
|
BigDecimal amount = withdraw.getMoney();
|
||||||
|
|
||||||
|
BigDecimal bBal = balance.add(amount);
|
||||||
|
UserBalanceLog bal = UserBalanceLog.builder()
|
||||||
|
.userId(userId)
|
||||||
|
.scene(BalanceConstants.BALANCE_WITHDRAW_REJECT)
|
||||||
|
.avatar(user.getAvatar())
|
||||||
|
.merchantCode(withdraw.getMerchantCode())
|
||||||
|
.money(amount)
|
||||||
|
.balance(bBal)
|
||||||
|
.tenantId(withdraw.getTenantId())
|
||||||
|
.sortNumber(1)
|
||||||
|
.comments(reason)
|
||||||
|
.status(0)
|
||||||
|
.deleted(0)
|
||||||
|
.createTime(new Date())
|
||||||
|
.updateTime(new Date())
|
||||||
|
.build();
|
||||||
|
userBalanceLogService.save(bal);
|
||||||
|
user.setBalance(bBal);
|
||||||
|
userService.updateById(user);
|
||||||
|
return ApiResult.ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -253,7 +253,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|||||||
DateTime nextMonthTime = DateUtil.offsetMonth(expirationTime, 1);
|
DateTime nextMonthTime = DateUtil.offsetMonth(expirationTime, 1);
|
||||||
parentOrder.setExpirationTime(nextMonthTime);
|
parentOrder.setExpirationTime(nextMonthTime);
|
||||||
// 保存续费订单状态
|
// 保存续费订单状态
|
||||||
order.setDeliveryStatus(DELIVERY_STATUS_YES);
|
// order.setDeliveryStatus(DELIVERY_STATUS_YES);
|
||||||
|
order.setDeliveryStatus(DELIVERY_STATUS_ACCEPT);
|
||||||
order.setReceiptStatus(RECEIPT_STATUS_YES);
|
order.setReceiptStatus(RECEIPT_STATUS_YES);
|
||||||
order.setOrderStatus(ORDER_STATUS_COMPLETED);
|
order.setOrderStatus(ORDER_STATUS_COMPLETED);
|
||||||
order.setStartTime(expirationTime);
|
order.setStartTime(expirationTime);
|
||||||
@@ -270,7 +271,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|||||||
parentOrder.setOrderStatus(ORDER_STATUS_OVER);
|
parentOrder.setOrderStatus(ORDER_STATUS_OVER);
|
||||||
parentOrder.setExpirationTime(DateUtil.parseTime("2099-12-31 23:59:59"));
|
parentOrder.setExpirationTime(DateUtil.parseTime("2099-12-31 23:59:59"));
|
||||||
try {
|
try {
|
||||||
freezeOrderService.unfreeze(parentOrder.getOrderId());
|
freezeOrderService.unfreeze(parentOrder.getOrderId(), BigDecimal.ZERO);
|
||||||
} catch (AlipayApiException e) {
|
} catch (AlipayApiException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,5 +33,8 @@ logging:
|
|||||||
com.gxwebsoft: INFO
|
com.gxwebsoft: INFO
|
||||||
com.baomidou.mybatisplus: INFO
|
com.baomidou.mybatisplus: INFO
|
||||||
file:
|
file:
|
||||||
path: E:\data\yxw\logs
|
|
||||||
name: yxw.log
|
name: yxw.log
|
||||||
|
logback:
|
||||||
|
rollingpolicy:
|
||||||
|
# file-name-pattern:
|
||||||
|
max-history: 30
|
||||||
@@ -12,12 +12,16 @@ spring:
|
|||||||
# 日志配置
|
# 日志配置
|
||||||
logging:
|
logging:
|
||||||
file:
|
file:
|
||||||
name: websoft-api.log
|
name: logs/websoft-api.log
|
||||||
path: /www/wwwroot/api.yunxinwei.java/logs
|
|
||||||
level:
|
level:
|
||||||
root: INFO
|
root: INFO
|
||||||
com.gxwebsoft: INFO
|
com.gxwebsoft: INFO
|
||||||
com.baomidou.mybatisplus: ERROR
|
com.baomidou.mybatisplus: ERROR
|
||||||
|
com.alipay.api: INFO
|
||||||
|
logback:
|
||||||
|
rollingpolicy:
|
||||||
|
# file-name-pattern: ${LOG_FILE}.%d{yyyy-MM-dd}.%i.log
|
||||||
|
max-history: 30
|
||||||
|
|
||||||
socketio:
|
socketio:
|
||||||
host: 0.0.0.0 #IP地址
|
host: 0.0.0.0 #IP地址
|
||||||
@@ -37,3 +41,9 @@ config:
|
|||||||
bucketName: oss-yunxinwei
|
bucketName: oss-yunxinwei
|
||||||
bucketDomain: https://oss.wsdns.cn
|
bucketDomain: https://oss.wsdns.cn
|
||||||
aliyunDomain: https://oss-yunxinwei.oss-cn-shenzhen.aliyuncs.com
|
aliyunDomain: https://oss-yunxinwei.oss-cn-shenzhen.aliyuncs.com
|
||||||
|
|
||||||
|
#定时表达式
|
||||||
|
cron:
|
||||||
|
alert: 0 30 9 * * ?
|
||||||
|
profit: 0 0/2 * * * ?
|
||||||
|
timeoutOrder: 1 0 0 * * ?
|
||||||
@@ -8,7 +8,10 @@ socketio:
|
|||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
active: prod
|
active: prod
|
||||||
|
# json时间格式设置
|
||||||
|
jackson:
|
||||||
|
time-zone: GMT+8
|
||||||
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
application:
|
application:
|
||||||
name: server
|
name: server
|
||||||
|
|
||||||
@@ -37,11 +40,6 @@ spring:
|
|||||||
login-username: admin
|
login-username: admin
|
||||||
login-password: admin
|
login-password: admin
|
||||||
|
|
||||||
# json时间格式设置
|
|
||||||
jackson:
|
|
||||||
time-zone: GMT+8
|
|
||||||
date-format: yyyy-MM-dd HH:mm:ss
|
|
||||||
|
|
||||||
# 设置上传文件大小
|
# 设置上传文件大小
|
||||||
servlet:
|
servlet:
|
||||||
multipart:
|
multipart:
|
||||||
|
|||||||
Reference in New Issue
Block a user