update
This commit is contained in:
@ -2,8 +2,12 @@ package com.wisdo.mmining.api;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.wisdo.mmining.api.dto.AmountDto;
|
||||
import com.wisdo.mmining.api.dto.GoodsDto;
|
||||
import com.wisdo.mmining.controller.dto.PackageDto;
|
||||
import com.wisdo.mmining.entity.*;
|
||||
import com.wisdo.mmining.result.Result;
|
||||
import com.wisdo.mmining.result.ResultUtil;
|
||||
@ -186,7 +190,7 @@ public class OrderApi {
|
||||
|
||||
@ApiOperation(value = "申请退换货")
|
||||
@PostMapping("afterSales")
|
||||
public Result afterSales(Long orderId, String orderRefund, String orderRefundImg, Integer status) {
|
||||
public Result afterSales(Long orderId, String orderRefund, String orderRefundImg, Integer status, Long packageId) throws JsonProcessingException {
|
||||
WisdOeder wisdOeder = orderService.getById(orderId);
|
||||
Long orderNumber = (new Date()).getTime();
|
||||
wisdOeder.setOrderRefundNum("T" + orderNumber);
|
||||
@ -197,7 +201,8 @@ public class OrderApi {
|
||||
}
|
||||
}
|
||||
if (wisdOeder.getStatus() == 2) {
|
||||
wisdOeder.setStatus(62);
|
||||
// wisdOeder.setStatus(62);
|
||||
wisdOeder.setAfterSalesStatus(62);
|
||||
wisdOeder.setOrderRefundType(3);
|
||||
// if (wisdOeder.getOrderPayWay()==2){
|
||||
// WisdWxuser wisdWxuser=wxuserService.getById(wisdOeder.getUserId());
|
||||
@ -270,7 +275,19 @@ public class OrderApi {
|
||||
// return new Result(ResultUtil.ERROR, ResultUtil.ERROR_MSG);
|
||||
// }
|
||||
} else {
|
||||
wisdOeder.setStatus(status);
|
||||
// wisdOeder.setStatus(status);
|
||||
wisdOeder.setAfterSalesStatus(status);
|
||||
String logisticsJson = wisdOeder.getLogistics();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<PackageDto> packages = objectMapper.readValue(logisticsJson, new TypeReference<List<PackageDto>>() {
|
||||
});
|
||||
for (PackageDto pack : packages) {
|
||||
if (pack.getId().equals(packageId)) {
|
||||
pack.setAfterSalesStatus(status);
|
||||
}
|
||||
}
|
||||
String newLogisticsJson = objectMapper.writeValueAsString(packages);
|
||||
wisdOeder.setLogistics(newLogisticsJson);
|
||||
if (status == 61) {
|
||||
wisdOeder.setOrderRefundType(1);
|
||||
} else if (status == 62) {
|
||||
@ -292,7 +309,8 @@ public class OrderApi {
|
||||
@PostMapping("submitSales")
|
||||
public Result submitSales(Long orderId, String orderRefundNumber, String orderRefundImage, String orderRefundInstructions, String orderRefundName) {
|
||||
WisdOeder wisdOeder = orderService.getById(orderId);
|
||||
wisdOeder.setStatus(64);
|
||||
// wisdOeder.setStatus(64);
|
||||
wisdOeder.setAfterSalesStatus(64);
|
||||
wisdOeder.setOrderRefundImage(orderRefundImage);
|
||||
wisdOeder.setOrderRefundInstructions(orderRefundInstructions);
|
||||
wisdOeder.setOrderRefundNumber(orderRefundNumber);
|
||||
@ -345,10 +363,10 @@ public class OrderApi {
|
||||
queryWrapper.eq("is_deleted", 0);
|
||||
if (status != 0) {
|
||||
if (status == 6) {
|
||||
queryWrapper.and(wrapper -> wrapper.eq("status", status).or().eq("status", 61).or().eq("status", 62).or().eq("status", 63).or().eq("status", 64).or().eq("status", 65).or().eq("status", 66));
|
||||
queryWrapper.and(wrapper -> wrapper.eq("after_sales_status", status).or().eq("after_sales_status", 61).or().eq("after_sales_status", 62).or().eq("after_sales_status", 63).or().eq("after_sales_status", 64).or().eq("after_sales_status", 65).or().eq("after_sales_status", 66));
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
} else {
|
||||
queryWrapper.eq("status", status);
|
||||
queryWrapper.and(wrapper -> wrapper.eq("after_sales_status", 66).or().isNull("after_sales_status")).and(wrapper -> wrapper.eq("status", status));
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
}
|
||||
} else {
|
||||
|
@ -243,12 +243,14 @@ public class OrderController {
|
||||
if (order == null) {
|
||||
return new Result(ResultUtil.ERROR, ResultUtil.ERROR_MSG);
|
||||
}
|
||||
if (!order.getStatus().equals(64)) {
|
||||
if (!order.getAfterSalesStatus().equals(64)) {
|
||||
return new Result(ResultUtil.ERROR, "该状态无法发货");
|
||||
}
|
||||
order.setOrderRefundMerchantsName(logisticsName);
|
||||
order.setOrderRefundMerchantsNum(logisticsNum);
|
||||
order.setStatus(65);
|
||||
// TODO:
|
||||
// order.setStatus(65);
|
||||
order.setAfterSalesStatus(65);
|
||||
order.setOrderRefundMerchantsTime(new Date());
|
||||
Boolean flag = orderService.saveOrUpdate(order);
|
||||
if (flag) {
|
||||
@ -293,11 +295,13 @@ public class OrderController {
|
||||
if (orderId == null || type == null) {
|
||||
return new ModelAndView("sys/error");
|
||||
}
|
||||
WisdOeder order = orderService.getById(orderId);
|
||||
//type 1 一级弹出层 2二级弹出层
|
||||
ModelAndView modelAndView = new ModelAndView("pages/order/order_refund_remarke");
|
||||
modelAndView.addObject("orderId", orderId);
|
||||
modelAndView.addObject("type", type);
|
||||
modelAndView.addObject("agree", agree);
|
||||
modelAndView.addObject("packages", order.getLogistics() == null ? "[]" : order.getLogistics());
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@ -311,29 +315,33 @@ public class OrderController {
|
||||
if (order == null) {
|
||||
return new Result(ResultUtil.ERROR, ResultUtil.ERROR_MSG);
|
||||
}
|
||||
if (!order.getStatus().equals(61) && !order.getStatus().equals(62) && !order.getStatus().equals(64)) {
|
||||
if (!order.getAfterSalesStatus().equals(61) && !order.getAfterSalesStatus().equals(62) && !order.getAfterSalesStatus().equals(64)) {
|
||||
return new Result(ResultUtil.ERROR, "该状态无法完成");
|
||||
}
|
||||
order.setOrderRefundRemarke(orderRefundRemarke);
|
||||
order.setOrderRefundRemarkeTime(new Date());
|
||||
WisdIntegrlRoles wisdIntegrlRoles = integralRolesService.getById(1);
|
||||
if (agree == 1) {
|
||||
order.setStatus(63);
|
||||
// TODO:
|
||||
//order.setStatus(63);
|
||||
order.setAfterSalesStatus(63);
|
||||
Calendar calendar2 = Calendar.getInstance();
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
calendar2.add(Calendar.DATE, wisdIntegrlRoles.getOrderRefundTime());
|
||||
String three_days_after = sdf2.format(calendar2.getTime());
|
||||
order.setOrderRefundTimes(three_days_after);
|
||||
} else if (agree == 2) {
|
||||
order.setStatus(66);
|
||||
// TODO: 拒绝退换货后订单回到**状态
|
||||
order.setStatus(3);
|
||||
order.setAfterSalesStatus(66);
|
||||
order.setOrderRefundMerchantsTime(new Date());
|
||||
}
|
||||
Boolean flag = orderService.updateById(order);
|
||||
if (flag) {
|
||||
if (order.getStatus() == 63) {
|
||||
if (order.getAfterSalesStatus() == 63) {
|
||||
redisService.set("{'orderNumber':" + order.getOrderNumber() + ",'status':'63'}", "{'orderNumber':" + order.getOrderNumber() + ",'status':'63'}", wisdIntegrlRoles.getOrderRefundTime() * 24 * 60 * 60 * 1000);
|
||||
}
|
||||
//redisService.set ( "{'orderNumber':" + order.getOrderNumber() + ",'status':'65'}", "{'orderNumber':" + order.getOrderNumber() + ",'status':'65'}" , 900000 );
|
||||
// redisService.set ( "{'orderNumber':" + order.getOrderNumber() + ",'status':'65'}", "{'orderNumber':" + order.getOrderNumber() + ",'status':'65'}" , 900000 );
|
||||
return new Result(ResultUtil.SUCCESS, ResultUtil.SUCCESS_MSG);
|
||||
} else {
|
||||
return new Result(ResultUtil.ERROR, ResultUtil.ERROR_MSG);
|
||||
@ -344,7 +352,9 @@ public class OrderController {
|
||||
@ResponseBody
|
||||
public Result nodelivery(Long orderId) {
|
||||
WisdOeder order = orderService.getById(orderId);
|
||||
order.setStatus(66);
|
||||
// TODO: 拒绝退换货后订单回到**状态
|
||||
order.setStatus(3);
|
||||
order.setAfterSalesStatus(66);
|
||||
order.setOrderRefundMerchantsTime(new Date());
|
||||
Boolean flag = orderService.saveOrUpdate(order);
|
||||
if (flag) {
|
||||
@ -406,7 +416,9 @@ public class OrderController {
|
||||
Map<String, Object> map = WxPayUtil.tuikuan(wisdOeder.getOrderActualPay().doubleValue(), wisdOeder.getOrderNumber(), wisdOeder.getOrderRefundNum());
|
||||
if (map.get("code").equals(1)) {
|
||||
wisdOeder.setOrderRefundType(3);
|
||||
wisdOeder.setStatus(65);
|
||||
// TODO:
|
||||
//wisdOeder.setStatus(65);
|
||||
wisdOeder.setAfterSalesStatus(65);
|
||||
wisdOeder.setOrderRefundMerchantsTime(new Date());
|
||||
Boolean flag = orderService.saveOrUpdate(wisdOeder);
|
||||
if (flag) {
|
||||
@ -420,7 +432,9 @@ public class OrderController {
|
||||
return new Result(ResultUtil.ERROR, ResultUtil.ERROR_MSG);
|
||||
}
|
||||
}
|
||||
wisdOeder.setStatus(65);
|
||||
// TODO:
|
||||
//wisdOeder.setStatus(65);
|
||||
wisdOeder.setAfterSalesStatus(65);
|
||||
wisdOeder.setOrderRefundMerchantsTime(new Date());
|
||||
Boolean flag = orderService.saveOrUpdate(wisdOeder);
|
||||
if (flag) {
|
||||
@ -436,7 +450,8 @@ public class OrderController {
|
||||
public Result nodeliveryStatus(Long orderId) {
|
||||
WisdOeder wisdOeder = orderService.getById(orderId);
|
||||
// FIXME: 拒绝退货后修改状态
|
||||
wisdOeder.setStatus(2);
|
||||
wisdOeder.setStatus(3);
|
||||
wisdOeder.setAfterSalesStatus(66);
|
||||
Boolean flag = orderService.saveOrUpdate(wisdOeder);
|
||||
if (flag) {
|
||||
return new Result(ResultUtil.SUCCESS, ResultUtil.SUCCESS_MSG);
|
||||
@ -449,7 +464,9 @@ public class OrderController {
|
||||
@ResponseBody
|
||||
public Result deliveryMoney(Long orderId) {
|
||||
WisdOeder order = orderService.getById(orderId);
|
||||
order.setStatus(65);
|
||||
// TODO:
|
||||
//order.setStatus(65);
|
||||
order.setAfterSalesStatus(65);
|
||||
order.setOrderRefundMerchantsTime(new Date());
|
||||
if (order.getOrderRefundType() == 2) {
|
||||
if (order.getOrderPayWay() == 4) {
|
||||
@ -532,7 +549,9 @@ public class OrderController {
|
||||
@ResponseBody
|
||||
public Result refund(Long orderId) {
|
||||
WisdOeder order = orderService.getById(orderId);
|
||||
order.setStatus(66);
|
||||
// TODO: 拒绝退换货后订单回到**状态
|
||||
order.setStatus(3);
|
||||
order.setAfterSalesStatus(66);
|
||||
order.setOrderRefundMerchantsTime(new Date());
|
||||
Boolean flag = orderService.saveOrUpdate(order);
|
||||
if (flag) {
|
||||
@ -546,7 +565,9 @@ public class OrderController {
|
||||
@ResponseBody
|
||||
public Result refundno(Long orderId) {
|
||||
WisdOeder order = orderService.getById(orderId);
|
||||
order.setStatus(66);
|
||||
// TODO: 拒绝退换货后订单回到**状态
|
||||
order.setStatus(3);
|
||||
order.setAfterSalesStatus(66);
|
||||
order.setOrderRefundMerchantsTime(new Date());
|
||||
Boolean flag = orderService.saveOrUpdate(order);
|
||||
if (flag) {
|
||||
@ -840,17 +861,17 @@ public class OrderController {
|
||||
cell2.setCellValue("已完成");
|
||||
} else if (dataList.get(i).getStatus().equals(5)) {
|
||||
cell2.setCellValue("已取消");
|
||||
} else if (dataList.get(i).getStatus().equals(61)) {
|
||||
} else if (dataList.get(i).getAfterSalesStatus().equals(61)) {
|
||||
cell2.setCellValue("申请换货");
|
||||
} else if (dataList.get(i).getStatus().equals(62)) {
|
||||
} else if (dataList.get(i).getAfterSalesStatus().equals(62)) {
|
||||
cell2.setCellValue("申请退款");
|
||||
} else if (dataList.get(i).getStatus().equals(63)) {
|
||||
} else if (dataList.get(i).getAfterSalesStatus().equals(63)) {
|
||||
cell2.setCellValue("退换货确认");
|
||||
} else if (dataList.get(i).getStatus().equals(64)) {
|
||||
} else if (dataList.get(i).getAfterSalesStatus().equals(64)) {
|
||||
cell2.setCellValue("退换货物流信息提交");
|
||||
} else if (dataList.get(i).getStatus().equals(65)) {
|
||||
} else if (dataList.get(i).getAfterSalesStatus().equals(65)) {
|
||||
cell2.setCellValue("退换货完成");
|
||||
} else if (dataList.get(i).getStatus().equals(66)) {
|
||||
} else if (dataList.get(i).getAfterSalesStatus().equals(66)) {
|
||||
cell2.setCellValue("退换货失败");
|
||||
}
|
||||
|
||||
|
@ -8,5 +8,6 @@ import java.util.List;
|
||||
public class PackageDto {
|
||||
private Long id;
|
||||
private List<GoodsDeDto> goods;
|
||||
private Integer afterSalesStatus;
|
||||
private String logisticsNumber;
|
||||
}
|
||||
|
@ -119,6 +119,11 @@ public class WisdOeder implements Serializable {
|
||||
* 状态(1待支付 2代发货/待核销 3待收货 4已完成/已核销 5已取消 61申请换货 62 申请退款 63退换货确认 64退换货物流信息提交 65退换货完成 66 退换货失败 )
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 状态(61申请换货 62申请退款 63退换货确认 64退换货物流信息提交 65退换货完成 66退换货失败)
|
||||
*/
|
||||
private Integer afterSalesStatus;
|
||||
/**
|
||||
* 支付时间
|
||||
*/
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.wisdo.mmining.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -13,7 +12,6 @@ import com.wisdo.mmining.result.ResultUtil;
|
||||
import com.wisdo.mmining.service.*;
|
||||
import com.wisdo.mmining.util.excel.ExcelUntils;
|
||||
import com.wisdo.mmining.utils.QRCodeUtil;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -48,7 +46,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, WisdOeder> implem
|
||||
private UserCartService userCartService;
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
@Autowired @Lazy
|
||||
@Autowired
|
||||
@Lazy
|
||||
private ProfitsService profitsService;
|
||||
@Autowired
|
||||
private PackageService packageService;
|
||||
@ -65,130 +64,131 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, WisdOeder> implem
|
||||
|
||||
|
||||
@Override
|
||||
public IPage<WisdOeder> selectPage(String pickTimeStart,String pickTimeEnd,String createTimeStart,String createTimeEnd,Long companyId,Long addressId,Integer orderPick,String orderNumber,String userName,String userPhone,Integer status,Integer orderPayWay,int page, int num) {
|
||||
public IPage<WisdOeder> selectPage(String pickTimeStart, String pickTimeEnd, String createTimeStart, String createTimeEnd, Long companyId, Long addressId, Integer orderPick, String orderNumber, String userName, String userPhone, Integer status, Integer orderPayWay, int page, int num) {
|
||||
QueryWrapper<WisdOeder> queryWrapper = new QueryWrapper<>();
|
||||
if (orderNumber!=null&&!"".equals(orderNumber)){
|
||||
queryWrapper.like("order_number",orderNumber);
|
||||
queryWrapper.and(wrap -> wrap.eq("after_sales_status", 66).or().isNull("after_sales_status"));
|
||||
if (orderNumber != null && !"".equals(orderNumber)) {
|
||||
queryWrapper.like("order_number", orderNumber);
|
||||
}
|
||||
if (userName!=null&&!"".equals(userName)){
|
||||
queryWrapper.like("oeder_costomer",userName);
|
||||
if (userName != null && !"".equals(userName)) {
|
||||
queryWrapper.like("oeder_costomer", userName);
|
||||
}
|
||||
if (createTimeStart!=null&&!"".equals(createTimeStart)){
|
||||
queryWrapper.ge("create_time",createTimeStart);
|
||||
if (createTimeStart != null && !"".equals(createTimeStart)) {
|
||||
queryWrapper.ge("create_time", createTimeStart);
|
||||
}
|
||||
if (createTimeEnd!=null&&!"".equals(createTimeEnd)){
|
||||
queryWrapper.le("create_time",createTimeEnd);
|
||||
if (createTimeEnd != null && !"".equals(createTimeEnd)) {
|
||||
queryWrapper.le("create_time", createTimeEnd);
|
||||
}
|
||||
if (pickTimeStart!=null&&!"".equals(pickTimeStart)){
|
||||
queryWrapper.ge("order_pick_time",pickTimeStart);
|
||||
if (pickTimeStart != null && !"".equals(pickTimeStart)) {
|
||||
queryWrapper.ge("order_pick_time", pickTimeStart);
|
||||
}
|
||||
if (pickTimeEnd!=null&&!"".equals(pickTimeEnd)){
|
||||
queryWrapper.le("order_pick_time",pickTimeEnd);
|
||||
if (pickTimeEnd != null && !"".equals(pickTimeEnd)) {
|
||||
queryWrapper.le("order_pick_time", pickTimeEnd);
|
||||
}
|
||||
if (userPhone!=null&&!"".equals(userPhone)){
|
||||
queryWrapper.like("user_phone",userPhone);
|
||||
if (userPhone != null && !"".equals(userPhone)) {
|
||||
queryWrapper.like("user_phone", userPhone);
|
||||
}
|
||||
if (orderPayWay!=null&&orderPayWay!=0){
|
||||
queryWrapper.eq("order_pay_way",orderPayWay);
|
||||
if (orderPayWay != null && orderPayWay != 0) {
|
||||
queryWrapper.eq("order_pay_way", orderPayWay);
|
||||
}
|
||||
if (orderPick!=null&&orderPick!=0){
|
||||
queryWrapper.eq("order_pick",orderPick);
|
||||
if (orderPick != null && orderPick != 0) {
|
||||
queryWrapper.eq("order_pick", orderPick);
|
||||
}
|
||||
if (companyId!=null&&companyId!=0){
|
||||
queryWrapper.eq("company_id",companyId);
|
||||
if (companyId != null && companyId != 0) {
|
||||
queryWrapper.eq("company_id", companyId);
|
||||
}
|
||||
if (addressId!=null&&addressId!=0){
|
||||
queryWrapper.eq("address_id",addressId);
|
||||
queryWrapper.eq("order_pick",1);
|
||||
if (addressId != null && addressId != 0) {
|
||||
queryWrapper.eq("address_id", addressId);
|
||||
queryWrapper.eq("order_pick", 1);
|
||||
}
|
||||
if (status!=null&&status!=0){
|
||||
queryWrapper.eq("status",status);
|
||||
}else {
|
||||
if (status != null && status != 0) {
|
||||
queryWrapper.eq("status", status);
|
||||
} else {
|
||||
queryWrapper.and(wrapper -> wrapper.eq("status", 1).or().eq("status", 2).or().eq("status", 3).or().eq("status", 4).or().eq("status", 5));
|
||||
}
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
Page<WisdOeder> p = new Page<>(page,num);
|
||||
IPage<WisdOeder> wisdCompanyIPage = orderMapper.selectPage(p,queryWrapper);
|
||||
Page<WisdOeder> p = new Page<>(page, num);
|
||||
IPage<WisdOeder> wisdCompanyIPage = orderMapper.selectPage(p, queryWrapper);
|
||||
return wisdCompanyIPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<WisdOeder> selectefundPage(String createTimeStart,String createTimeEnd,Long companyId,Long addressId,Integer orderPick,String orderNumber, String userName, String userPhone, Integer status, Integer orderPayWay, int page, int num) {
|
||||
public IPage<WisdOeder> selectefundPage(String createTimeStart, String createTimeEnd, Long companyId, Long addressId, Integer orderPick, String orderNumber, String userName, String userPhone, Integer status, Integer orderPayWay, int page, int num) {
|
||||
QueryWrapper<WisdOeder> queryWrapper = new QueryWrapper<>();
|
||||
if (orderNumber!=null&&!"".equals(orderNumber)){
|
||||
queryWrapper.eq("order_number",orderNumber);
|
||||
if (orderNumber != null && !"".equals(orderNumber)) {
|
||||
queryWrapper.eq("order_number", orderNumber);
|
||||
}
|
||||
if (userName!=null&&!"".equals(userName)){
|
||||
queryWrapper.like("oeder_costomer",userName);
|
||||
if (userName != null && !"".equals(userName)) {
|
||||
queryWrapper.like("oeder_costomer", userName);
|
||||
}
|
||||
if (userPhone!=null&&!"".equals(userPhone)){
|
||||
queryWrapper.like("user_phone",userPhone);
|
||||
if (userPhone != null && !"".equals(userPhone)) {
|
||||
queryWrapper.like("user_phone", userPhone);
|
||||
}
|
||||
if (createTimeStart!=null&&!"".equals(createTimeStart)){
|
||||
queryWrapper.ge("create_time",createTimeStart);
|
||||
if (createTimeStart != null && !"".equals(createTimeStart)) {
|
||||
queryWrapper.ge("create_time", createTimeStart);
|
||||
}
|
||||
if (createTimeEnd!=null&&!"".equals(createTimeEnd)){
|
||||
queryWrapper.le("create_time",createTimeEnd);
|
||||
if (createTimeEnd != null && !"".equals(createTimeEnd)) {
|
||||
queryWrapper.le("create_time", createTimeEnd);
|
||||
}
|
||||
if (orderPayWay!=null&&orderPayWay!=0){
|
||||
queryWrapper.eq("order_pay_way",orderPayWay);
|
||||
if (orderPayWay != null && orderPayWay != 0) {
|
||||
queryWrapper.eq("order_pay_way", orderPayWay);
|
||||
}
|
||||
if (orderPick!=null&&orderPick!=0){
|
||||
queryWrapper.eq("order_pick",orderPick);
|
||||
if (orderPick != null && orderPick != 0) {
|
||||
queryWrapper.eq("order_pick", orderPick);
|
||||
}
|
||||
if (companyId!=null&&companyId!=0){
|
||||
queryWrapper.eq("company_id",companyId);
|
||||
if (companyId != null && companyId != 0) {
|
||||
queryWrapper.eq("company_id", companyId);
|
||||
}
|
||||
if (addressId!=null&&addressId!=0){
|
||||
queryWrapper.eq("address_id",addressId);
|
||||
queryWrapper.eq("order_pick",1);
|
||||
if (addressId != null && addressId != 0) {
|
||||
queryWrapper.eq("address_id", addressId);
|
||||
queryWrapper.eq("order_pick", 1);
|
||||
}
|
||||
if (status!=null&&status!=0){
|
||||
queryWrapper.eq("status",status);
|
||||
}else {
|
||||
queryWrapper.and(wrapper -> wrapper.eq("status", 61).or().eq("status", 62).or().eq("status", 63).or().eq("status", 64).or().eq("status", 65).or().eq("status", 66));
|
||||
if (status != null && status != 0) {
|
||||
queryWrapper.eq("after_sales_status", status);
|
||||
} else {
|
||||
queryWrapper.and(wrapper -> wrapper.eq("after_sales_status", 61).or().eq("after_sales_status", 62).or().eq("after_sales_status", 63).or().eq("after_sales_status", 64).or().eq("after_sales_status", 65).or().eq("after_sales_status", 66));
|
||||
}
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
queryWrapper.orderByAsc("status");
|
||||
Page<WisdOeder> p = new Page<>(page,num);
|
||||
IPage<WisdOeder> wisdCompanyIPage = orderMapper.selectPage(p,queryWrapper);
|
||||
queryWrapper.orderByAsc("after_sales_status");
|
||||
Page<WisdOeder> p = new Page<>(page, num);
|
||||
IPage<WisdOeder> wisdCompanyIPage = orderMapper.selectPage(p, queryWrapper);
|
||||
return wisdCompanyIPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<WisdOeder> listPage(int page, int num, QueryWrapper<WisdOeder> queryWrapper) {
|
||||
Page<WisdOeder> p = new Page<>(page,num);
|
||||
IPage<WisdOeder> wisdCompanyIPage = orderMapper.selectPage(p,queryWrapper);
|
||||
Page<WisdOeder> p = new Page<>(page, num);
|
||||
IPage<WisdOeder> wisdCompanyIPage = orderMapper.selectPage(p, queryWrapper);
|
||||
return wisdCompanyIPage;
|
||||
}
|
||||
|
||||
private String path="/home/wisdommining/upload/file/";
|
||||
private String path = "/home/wisdommining/upload/file/";
|
||||
|
||||
public Boolean promotionNum(Long userId,WisdGoods wisdGoods,Integer goodsNum){
|
||||
public Boolean promotionNum(Long userId, WisdGoods wisdGoods, Integer goodsNum) {
|
||||
QueryWrapper<WisdOeder> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("user_id",userId);
|
||||
queryWrapper.ne("status",5);
|
||||
queryWrapper.ne("status",1);
|
||||
queryWrapper.eq("is_promotion",1);
|
||||
List<WisdOeder> wisdOederList=list(queryWrapper);
|
||||
Integer count=0;
|
||||
if (wisdOederList.isEmpty()){
|
||||
if (goodsNum<=wisdGoods.getPromotionNum()){
|
||||
queryWrapper.eq("user_id", userId);
|
||||
queryWrapper.ne("status", 5);
|
||||
queryWrapper.ne("status", 1);
|
||||
queryWrapper.eq("is_promotion", 1);
|
||||
List<WisdOeder> wisdOederList = list(queryWrapper);
|
||||
Integer count = 0;
|
||||
if (wisdOederList.isEmpty()) {
|
||||
if (goodsNum <= wisdGoods.getPromotionNum()) {
|
||||
return true;
|
||||
}else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (WisdOeder wisdOeder:wisdOederList){
|
||||
for (WisdOeder wisdOeder : wisdOederList) {
|
||||
QueryWrapper<WisdOrderDetail> orderDetailQueryWrapper = new QueryWrapper<>();
|
||||
orderDetailQueryWrapper.eq("order_id",wisdOeder.getId());
|
||||
orderDetailQueryWrapper.eq("goods_id",wisdGoods.getId());
|
||||
WisdOrderDetail wisdOrderDetail=orderDetailService.getOne(orderDetailQueryWrapper);
|
||||
if (wisdOrderDetail!=null) {
|
||||
orderDetailQueryWrapper.eq("order_id", wisdOeder.getId());
|
||||
orderDetailQueryWrapper.eq("goods_id", wisdGoods.getId());
|
||||
WisdOrderDetail wisdOrderDetail = orderDetailService.getOne(orderDetailQueryWrapper);
|
||||
if (wisdOrderDetail != null) {
|
||||
count += wisdOrderDetail.getGoodsNum();
|
||||
}
|
||||
}
|
||||
if (count<=wisdGoods.getPromotionNum()){
|
||||
if (count <= wisdGoods.getPromotionNum()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -198,23 +198,23 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, WisdOeder> implem
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result addOrder(@RequestBody WisdOeder wisdOeder, HttpServletRequest request) {
|
||||
|
||||
WisdWxuser wisdWxusers=wxuserService.getById(wisdOeder.getUserId());
|
||||
if (wisdWxusers!=null) {
|
||||
WisdWxuser wisdWxusers = wxuserService.getById(wisdOeder.getUserId());
|
||||
if (wisdWxusers != null) {
|
||||
WisdUser wisdUser = wisdUserService.getByUserId(wisdWxusers.getCompanyUserId());
|
||||
if (wisdUser!=null) {
|
||||
if (wisdUser != null) {
|
||||
wisdOeder.setCompanyId(wisdUser.getCompanyId());
|
||||
}
|
||||
}
|
||||
if (wisdOeder.getOrderPayWay()==1 ) {
|
||||
WisdGoods wisdGoods=goodsService.getById(wisdOeder.getWisdOrderDetailList().get(0).getGoodsId());
|
||||
if (wisdGoods.getIsPromotion()==1) {
|
||||
if (wisdGoods.getPromotionNum()!=-1) {
|
||||
if (wisdOeder.getOrderPayWay() == 1) {
|
||||
WisdGoods wisdGoods = goodsService.getById(wisdOeder.getWisdOrderDetailList().get(0).getGoodsId());
|
||||
if (wisdGoods.getIsPromotion() == 1) {
|
||||
if (wisdGoods.getPromotionNum() != -1) {
|
||||
if (!promotionNum(wisdOeder.getUserId(), wisdGoods, wisdOeder.getWisdOrderDetailList().get(0).getGoodsNum())) {
|
||||
return new Result(ResultUtil.ERROR, "此商品限购数量为" + wisdGoods.getPromotionNum() + ",已超出购买次数");
|
||||
}
|
||||
wisdOeder.setIsPromotion(1);
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
wisdOeder.setIsPromotion(0);
|
||||
}
|
||||
}
|
||||
@ -222,41 +222,41 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, WisdOeder> implem
|
||||
List<WisdOrderDetail> orderDetailList = wisdOeder.getWisdOrderDetailList();
|
||||
for (WisdOrderDetail orderDetail : orderDetailList) {
|
||||
WisdGoodsSpec goodsSpec = goodsSpecService.getById(orderDetail.getSpecId());
|
||||
if (wisdOeder.getOrderPayWay()!=3) {
|
||||
if (wisdOeder.getOrderPayWay() != 3) {
|
||||
if (orderDetail.getGoodsNum() > goodsSpec.getSpecStock()) {
|
||||
WisdGoods wisdGoods=goodsService.getById(orderDetail.getGoodsId());
|
||||
return new Result(ResultUtil.ERROR, wisdGoods.getGoodsName()+"商品库存不足", null);
|
||||
WisdGoods wisdGoods = goodsService.getById(orderDetail.getGoodsId());
|
||||
return new Result(ResultUtil.ERROR, wisdGoods.getGoodsName() + "商品库存不足", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wisdOeder.getOrderPayWay()==3) {
|
||||
if (wisdOeder.getOrderPayWay() == 3) {
|
||||
WisdPackage wisdPackage = packageService.getById(wisdOeder.getPackageId());
|
||||
System.out.println(wisdOeder.getWisdOrderDetailList().get(0).getGoodsId().toString());
|
||||
if (!wisdPackage.getGoodsId().contains(wisdOeder.getWisdOrderDetailList().get(0).getGoodsId().toString())) {
|
||||
return new Result(ResultUtil.ERROR, "缺少购买此套餐的套餐券");
|
||||
}
|
||||
WisdWxuser wisdWxuser=wxuserService.getById(wisdOeder.getUserId());
|
||||
WisdUser wisdUser=wisdUserService.getByUserId(wisdWxuser.getCompanyUserId());
|
||||
WisdWxuser wisdWxuser = wxuserService.getById(wisdOeder.getUserId());
|
||||
WisdUser wisdUser = wisdUserService.getByUserId(wisdWxuser.getCompanyUserId());
|
||||
QueryWrapper<WisdUserPackage> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("user_id",wisdUser.getId());
|
||||
queryWrapper.eq("package_id",wisdOeder.getPackageId());
|
||||
WisdUserPackage wisdUserPackage=userPackageService.getOne(queryWrapper);
|
||||
if (wisdUserPackage.getIsUsed()==1){
|
||||
queryWrapper.eq("user_id", wisdUser.getId());
|
||||
queryWrapper.eq("package_id", wisdOeder.getPackageId());
|
||||
WisdUserPackage wisdUserPackage = userPackageService.getOne(queryWrapper);
|
||||
if (wisdUserPackage.getIsUsed() == 1) {
|
||||
return new Result(ResultUtil.ERROR, "套餐券已使用");
|
||||
}
|
||||
}
|
||||
|
||||
Long orderNumber=(new Date()).getTime();
|
||||
Long orderNumber = (new Date()).getTime();
|
||||
wisdOeder.setOrderNumber(orderNumber.toString());
|
||||
if (wisdOeder.getOrderPick()==2) {
|
||||
if (wisdOeder.getOrderPick() == 2) {
|
||||
WisdUserAddress wisdUserAddress = userAddressService.getById(wisdOeder.getAddressId());
|
||||
wisdOeder.setOrderAddress(wisdUserAddress.getAddressProvince() + wisdUserAddress.getAddressCity() + wisdUserAddress.getAddressArea() + wisdUserAddress.getAddressDetailed());
|
||||
wisdOeder.setOrderPhone(wisdUserAddress.getAddressPhone());
|
||||
wisdOeder.setOederCostomer(wisdUserAddress.getAddressName());
|
||||
wisdOeder.setUserPhone(wisdUserAddress.getAddressPhone());
|
||||
}else {
|
||||
WisdStores wisdStores=storesService.getById(wisdOeder.getAddressId());
|
||||
} else {
|
||||
WisdStores wisdStores = storesService.getById(wisdOeder.getAddressId());
|
||||
wisdOeder.setOrderAddress(wisdStores.getStoresProvince() + wisdStores.getStoresCity() + wisdStores.getStoresArea() + wisdStores.getStoresDetailed());
|
||||
wisdOeder.setOrderPhone(wisdStores.getStoresPhone());
|
||||
wisdOeder.setOederCostomer(wisdStores.getStoresName());
|
||||
@ -264,24 +264,24 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, WisdOeder> implem
|
||||
Calendar can = Calendar.getInstance();
|
||||
can.add(Calendar.MINUTE, 15);
|
||||
wisdOeder.setCancelTime(can.getTime());
|
||||
redisService.set ( "{'orderNumber':" + orderNumber + ",'status':'5'}", "{'orderNumber':" + orderNumber + ",'status':'5'}" , 900000 );
|
||||
QRCodeUtil.zxingCodeCreate("sjfhjsafsjab&*#$.!,"+orderNumber+","+wisdOeder.getUserId(),150,150,path+orderNumber+".jpg","jpg");
|
||||
wisdOeder.setVerificationCode(request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getServletContext().getContextPath()+"/wisdommining/"+orderNumber+".jpg");
|
||||
Integer flag=orderMapper.insert(wisdOeder);
|
||||
if (flag==1){
|
||||
for (WisdOrderDetail wisdOrderDetail:wisdOeder.getWisdOrderDetailList()){
|
||||
redisService.set("{'orderNumber':" + orderNumber + ",'status':'5'}", "{'orderNumber':" + orderNumber + ",'status':'5'}", 900000);
|
||||
QRCodeUtil.zxingCodeCreate("sjfhjsafsjab&*#$.!," + orderNumber + "," + wisdOeder.getUserId(), 150, 150, path + orderNumber + ".jpg", "jpg");
|
||||
wisdOeder.setVerificationCode(request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getServletContext().getContextPath() + "/wisdommining/" + orderNumber + ".jpg");
|
||||
Integer flag = orderMapper.insert(wisdOeder);
|
||||
if (flag == 1) {
|
||||
for (WisdOrderDetail wisdOrderDetail : wisdOeder.getWisdOrderDetailList()) {
|
||||
wisdOrderDetail.setOrderId(wisdOeder.getId());
|
||||
if (wisdOeder.getIsCar()==1){
|
||||
if (wisdOeder.getIsCar() == 1) {
|
||||
QueryWrapper<WisdUserCart> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("user_id",wisdOeder.getUserId());
|
||||
queryWrapper.eq("goods_id",wisdOrderDetail.getGoodsId());
|
||||
queryWrapper.eq("spec_id",wisdOrderDetail.getSpecId());
|
||||
queryWrapper.eq("user_id", wisdOeder.getUserId());
|
||||
queryWrapper.eq("goods_id", wisdOrderDetail.getGoodsId());
|
||||
queryWrapper.eq("spec_id", wisdOrderDetail.getSpecId());
|
||||
userCartService.remove(queryWrapper);
|
||||
}
|
||||
}
|
||||
orderDetailService.saveOrUpdateBatch(wisdOeder.getWisdOrderDetailList());
|
||||
return new Result(ResultUtil.SUCCESS, ResultUtil.SUCCESS_MSG, orderNumber);
|
||||
}else {
|
||||
} else {
|
||||
return new Result(ResultUtil.ERROR, "提交订单失败");
|
||||
}
|
||||
|
||||
@ -291,7 +291,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, WisdOeder> implem
|
||||
@Override
|
||||
public WisdOeder getOrderByNumber(String orderNumber) {
|
||||
QueryWrapper<WisdOeder> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("order_number",orderNumber);
|
||||
queryWrapper.eq("order_number", orderNumber);
|
||||
return orderMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
@ -299,9 +299,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, WisdOeder> implem
|
||||
public Integer cancelOrder(String orderNumber) {
|
||||
System.out.println("取消订单开始");
|
||||
QueryWrapper<WisdOeder> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("order_number",orderNumber);
|
||||
WisdOeder wisdOeder=orderMapper.selectOne(queryWrapper);
|
||||
if (wisdOeder.getStatus()==1) {
|
||||
queryWrapper.eq("order_number", orderNumber);
|
||||
WisdOeder wisdOeder = orderMapper.selectOne(queryWrapper);
|
||||
if (wisdOeder.getStatus() == 1) {
|
||||
wisdOeder.setStatus(5);
|
||||
}
|
||||
System.out.println("取消订单结束");
|
||||
@ -311,45 +311,45 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, WisdOeder> implem
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer completeOrder(String orderNumber) {
|
||||
Integer flag=0;
|
||||
Integer flag = 0;
|
||||
try {
|
||||
QueryWrapper<WisdOeder> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("order_number",orderNumber);
|
||||
WisdOeder wisdOeder=orderMapper.selectOne(queryWrapper);
|
||||
if (wisdOeder.getStatus()==3) {
|
||||
queryWrapper.eq("order_number", orderNumber);
|
||||
WisdOeder wisdOeder = orderMapper.selectOne(queryWrapper);
|
||||
if (wisdOeder.getStatus() == 3) {
|
||||
wisdOeder.setStatus(4);
|
||||
}
|
||||
if (wisdOeder.getOrderPick()==1){
|
||||
if (wisdOeder.getStatus()==2) {
|
||||
if (wisdOeder.getOrderPick() == 1) {
|
||||
if (wisdOeder.getStatus() == 2) {
|
||||
wisdOeder.setStatus(4);
|
||||
}
|
||||
}
|
||||
if (wisdOeder.getOrderPayWay()!=2&&wisdOeder.getOrderPayWay()!=3) {
|
||||
if (wisdOeder.getOrderPayWay() != 2 && wisdOeder.getOrderPayWay() != 3) {
|
||||
profitsService.profits(wisdOeder.getOrderNumber());
|
||||
wxuserService.completIntegral(wisdOeder.getUserId(), wisdOeder);
|
||||
}
|
||||
if (wisdOeder.getOrderPayWay()==3) {
|
||||
WisdWxuser wisdWxuser=wxuserService.getById(wisdOeder.getUserId());
|
||||
if (wisdOeder.getOrderPayWay() == 3) {
|
||||
WisdWxuser wisdWxuser = wxuserService.getById(wisdOeder.getUserId());
|
||||
QueryWrapper<WisdUserPackage> packageQueryWrapper = new QueryWrapper<>();
|
||||
packageQueryWrapper.eq("user_id",wisdWxuser.getCompanyUserId()).eq("package_id",wisdOeder.getPackageId());
|
||||
WisdUserPackage wisdUserPackage=userPackageService.getOne(packageQueryWrapper);
|
||||
packageQueryWrapper.eq("user_id", wisdWxuser.getCompanyUserId()).eq("package_id", wisdOeder.getPackageId());
|
||||
WisdUserPackage wisdUserPackage = userPackageService.getOne(packageQueryWrapper);
|
||||
wisdUserPackage.setIsUsed(1);
|
||||
userPackageService.updateById(wisdUserPackage);
|
||||
WisdPackage wisdPackage=packageService.getById(wisdOeder.getPackageId());
|
||||
wisdPackage.setPackageUseNum(wisdPackage.getPackageUseNum()+1);
|
||||
WisdPackage wisdPackage = packageService.getById(wisdOeder.getPackageId());
|
||||
wisdPackage.setPackageUseNum(wisdPackage.getPackageUseNum() + 1);
|
||||
packageService.updateById(wisdPackage);
|
||||
}
|
||||
QueryWrapper<WisdOrderDetail> orderDetailQueryWrapper = new QueryWrapper<>();
|
||||
orderDetailQueryWrapper.eq("order_id",wisdOeder.getId());
|
||||
List<WisdOrderDetail> orderDetailList=orderDetailService.list(orderDetailQueryWrapper);
|
||||
for (WisdOrderDetail orderDetail:orderDetailList){
|
||||
WisdGoods wisdGoods=goodsService.getById(orderDetail.getGoodsId());
|
||||
wisdGoods.setGoodsSales(wisdGoods.getGoodsSales()+orderDetail.getGoodsNum());
|
||||
orderDetailQueryWrapper.eq("order_id", wisdOeder.getId());
|
||||
List<WisdOrderDetail> orderDetailList = orderDetailService.list(orderDetailQueryWrapper);
|
||||
for (WisdOrderDetail orderDetail : orderDetailList) {
|
||||
WisdGoods wisdGoods = goodsService.getById(orderDetail.getGoodsId());
|
||||
wisdGoods.setGoodsSales(wisdGoods.getGoodsSales() + orderDetail.getGoodsNum());
|
||||
goodsService.updateById(wisdGoods);
|
||||
}
|
||||
wisdOeder.setOrderConfirmTime(new Date());
|
||||
flag=orderMapper.updateById(wisdOeder);
|
||||
}catch (Exception e){
|
||||
flag = orderMapper.updateById(wisdOeder);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
return flag;
|
||||
@ -358,10 +358,11 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, WisdOeder> implem
|
||||
@Override
|
||||
public void refundOrder(Long orderNumber) {
|
||||
QueryWrapper<WisdOeder> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("order_number",orderNumber);
|
||||
WisdOeder wisdOeder=orderMapper.selectOne(queryWrapper);
|
||||
if (wisdOeder.getStatus()==63){
|
||||
wisdOeder.setStatus(66);
|
||||
queryWrapper.eq("order_number", orderNumber);
|
||||
WisdOeder wisdOeder = orderMapper.selectOne(queryWrapper);
|
||||
if (wisdOeder.getStatus() == 63) {
|
||||
//wisdOeder.setStatus(66);
|
||||
wisdOeder.setAfterSalesStatus(66);
|
||||
orderMapper.updateById(wisdOeder);
|
||||
}
|
||||
}
|
||||
@ -378,7 +379,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, WisdOeder> implem
|
||||
List<List<Object>> list = ExcelUntils.importExcel(inputStream, file.getOriginalFilename());
|
||||
inputStream.close();
|
||||
System.out.println(list);
|
||||
List<WisdOeder> orderList=new ArrayList<>();
|
||||
List<WisdOeder> orderList = new ArrayList<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (list.get(i).get(2).toString() != null && !"".equals(list.get(i).get(2).toString())) {
|
||||
WisdOeder wisdOeder = getOrderByNumber(list.get(i).get(2).toString());
|
||||
@ -390,39 +391,39 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, WisdOeder> implem
|
||||
wisdOeder.setStatus(3);
|
||||
wisdOeder.setOrderDeliverTime(new Date());
|
||||
orderList.add(wisdOeder);
|
||||
}else {
|
||||
return new Result(ResultUtil.ERROR,wisdOeder.getOrderNumber()+"订单不能发货");
|
||||
} else {
|
||||
return new Result(ResultUtil.ERROR, wisdOeder.getOrderNumber() + "订单不能发货");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Boolean flags=updateBatchById(orderList);
|
||||
if (flags){
|
||||
return new Result(ResultUtil.SUCCESS,ResultUtil.SUCCESS_MSG);
|
||||
}else {
|
||||
return new Result(ResultUtil.ERROR,"添加失败");
|
||||
Boolean flags = updateBatchById(orderList);
|
||||
if (flags) {
|
||||
return new Result(ResultUtil.SUCCESS, ResultUtil.SUCCESS_MSG);
|
||||
} else {
|
||||
return new Result(ResultUtil.ERROR, "添加失败");
|
||||
}
|
||||
}catch (Exception e){
|
||||
return new Result(ResultUtil.ERROR,"添加失败");
|
||||
} catch (Exception e) {
|
||||
return new Result(ResultUtil.ERROR, "添加失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer refundOrderGoods(String orderNumber) {
|
||||
WisdOeder wisdOeder=getOrderByNumber(orderNumber);
|
||||
QueryWrapper<WisdOrderDetail> orderDetailQueryWrapper=new QueryWrapper<>();
|
||||
orderDetailQueryWrapper.eq("order_id",wisdOeder.getId());
|
||||
List<WisdOrderDetail> orderDetailList=orderDetailService.list(orderDetailQueryWrapper);
|
||||
for (WisdOrderDetail wisdOrderDetail:orderDetailList){
|
||||
if (wisdOeder.getOrderPayWay()!=3) {
|
||||
WisdOeder wisdOeder = getOrderByNumber(orderNumber);
|
||||
QueryWrapper<WisdOrderDetail> orderDetailQueryWrapper = new QueryWrapper<>();
|
||||
orderDetailQueryWrapper.eq("order_id", wisdOeder.getId());
|
||||
List<WisdOrderDetail> orderDetailList = orderDetailService.list(orderDetailQueryWrapper);
|
||||
for (WisdOrderDetail wisdOrderDetail : orderDetailList) {
|
||||
if (wisdOeder.getOrderPayWay() != 3) {
|
||||
WisdGoodsSpec wisdGoodsSpec = goodsSpecService.getById(wisdOrderDetail.getSpecId());
|
||||
wisdGoodsSpec.setSpecStock(wisdGoodsSpec.getSpecStock() + wisdOrderDetail.getGoodsNum());
|
||||
goodsSpecService.updateById(wisdGoodsSpec);
|
||||
}
|
||||
WisdGoods wisdGoods=goodsService.getById(wisdOrderDetail.getGoodsId());
|
||||
wisdGoods.setGoodsSales(wisdGoods.getGoodsSales()-wisdOrderDetail.getGoodsNum());
|
||||
WisdGoods wisdGoods = goodsService.getById(wisdOrderDetail.getGoodsId());
|
||||
wisdGoods.setGoodsSales(wisdGoods.getGoodsSales() - wisdOrderDetail.getGoodsNum());
|
||||
goodsService.updateById(wisdGoods);
|
||||
}
|
||||
return 1;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#开发环境
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://192.168.0.145:3306/wisdo?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://192.168.0.233:3306/wisdo?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8
|
||||
# url: jdbc:mysql://146.56.198.32:3306/wisdo?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8
|
||||
username: yshop
|
||||
# username: root
|
||||
|
@ -88,11 +88,13 @@
|
||||
</div>
|
||||
下单时间:
|
||||
<div class="layui-inline layui-show-xs-block">
|
||||
<input type="datetime" name="createTimeStart" id="createTimeStart" lay-verify="datetime" placeholder="yyyy-MM-dd HH:mm:ss" autocomplete="off" class="layui-input">
|
||||
<input type="datetime" name="createTimeStart" id="createTimeStart" lay-verify="datetime"
|
||||
placeholder="yyyy-MM-dd HH:mm:ss" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
-
|
||||
<div class="layui-inline layui-show-xs-block">
|
||||
<input type="datetime" name="createTimeEnd" id="createTimeEnd" lay-verify="datetime" placeholder="yyyy-MM-dd HH:mm:ss" autocomplete="off" class="layui-input">
|
||||
<input type="datetime" name="createTimeEnd" id="createTimeEnd" lay-verify="datetime"
|
||||
placeholder="yyyy-MM-dd HH:mm:ss" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-inline layui-show-xs-block">
|
||||
<a class="layui-btn" data-type="reload"><i class="layui-icon"></i></a>
|
||||
@ -130,7 +132,7 @@
|
||||
base: root + '/static/core/js/base/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'index' //主入口模块
|
||||
}).use(['table', 'layer', 'form','laydate'], function () {
|
||||
}).use(['table', 'layer', 'form', 'laydate'], function () {
|
||||
var form = layui.form,
|
||||
laydate = layui.laydate,
|
||||
table = layui.table;
|
||||
@ -138,13 +140,13 @@
|
||||
//执行一个laydate实例
|
||||
laydate.render({
|
||||
elem: '#createTimeStart' //指定元素
|
||||
,format: 'yyyy-MM-dd HH:mm:ss'
|
||||
,type: 'datetime'
|
||||
, format: 'yyyy-MM-dd HH:mm:ss'
|
||||
, type: 'datetime'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#createTimeEnd' //指定元素
|
||||
,format: 'yyyy-MM-dd HH:mm:ss'
|
||||
,type: 'datetime'
|
||||
, format: 'yyyy-MM-dd HH:mm:ss'
|
||||
, type: 'datetime'
|
||||
});
|
||||
|
||||
//方法级渲染
|
||||
@ -159,11 +161,11 @@
|
||||
userPhone: $("#userPhone").val(),
|
||||
status: $("#status").val(),
|
||||
orderPayWay: $("#orderPayWay").val(),
|
||||
orderPick:$("#orderPick").val(),
|
||||
addressId:$("#addressId").val(),
|
||||
companyId:$("#companyId").val(),
|
||||
createTimeStart:$("#createTimeStart").val(),
|
||||
createTimeEnd:$("#createTimeEnd").val(),
|
||||
orderPick: $("#orderPick").val(),
|
||||
addressId: $("#addressId").val(),
|
||||
companyId: $("#companyId").val(),
|
||||
createTimeStart: $("#createTimeStart").val(),
|
||||
createTimeEnd: $("#createTimeEnd").val(),
|
||||
},
|
||||
cols: [[
|
||||
{checkbox: true, fixed: true},
|
||||
@ -251,22 +253,22 @@
|
||||
title: '订单状态',
|
||||
width: 120,
|
||||
templet: function (item) {
|
||||
if (item.status == 61) {
|
||||
if (item.afterSalesStatus == 61) {
|
||||
return '<span class="layui-badge layui-bg-green" style="margin-top: 5px">申请换货</span>';
|
||||
}
|
||||
if (item.status == 62) {
|
||||
if (item.afterSalesStatus == 62) {
|
||||
return '<span class="layui-badge layui-bg-cyan" style="margin-top: 5px">申请退款</span>';
|
||||
}
|
||||
if (item.status == 63) {
|
||||
if (item.afterSalesStatus == 63) {
|
||||
return '<span class="layui-badge layui-bg-orange" style="margin-top: 5px">退换货确认</span>';
|
||||
}
|
||||
if (item.status == 64) {
|
||||
if (item.afterSalesStatus == 64) {
|
||||
return '<span class="layui-badge layui-bg-red" style="margin-top: 5px">退换货物流信息提交</span>';
|
||||
}
|
||||
if (item.status == 65) {
|
||||
if (item.afterSalesStatus == 65) {
|
||||
return '<span class="layui-badge layui-bg-black" style="margin-top: 5px">退换货完成</span>';
|
||||
}
|
||||
if (item.status == 66) {
|
||||
if (item.afterSalesStatus == 66) {
|
||||
return '<span class="layui-badge layui-bg-error" style="margin-top: 5px">退换货失败</span>';
|
||||
}
|
||||
}
|
||||
@ -278,14 +280,16 @@
|
||||
},
|
||||
{
|
||||
fixed: 'right', align: 'center', width: 250, title: '操作', templet: function (item) {
|
||||
if (item.status == 61 && (item.orderRefundType == 1 || item.orderRefundType == 2)) {
|
||||
if (item.afterSalesStatus == 61 && (item.orderRefundType == 1 || item.orderRefundType == 2)) {
|
||||
return '<button class="layui-btn layui-btn-sm" lay-event="edit">详情</button><button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="delivery">同意换货</button><button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="nodeliverys">拒绝换货</button>';
|
||||
} else if (item.status == 62 && (item.orderRefundType == 1 || item.orderRefundType == 2)) {
|
||||
} else if (item.afterSalesStatus == 62 && (item.orderRefundType == 1 || item.orderRefundType == 2)) {
|
||||
return '<button class="layui-btn layui-btn-sm" lay-event="edit">详情</button><button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="delivery">同意退款</button><button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="nodeliverys">拒绝退款</button>';
|
||||
} else if (item.status == 62 && item.orderRefundType == 3) {
|
||||
} else if (item.afterSalesStatus == 62 && item.orderRefundType == 3) {
|
||||
return '<button class="layui-btn layui-btn-sm" lay-event="edit">详情</button><button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="deliveryStatus">同意退款</button><button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="nodeliveryStatus">拒绝退款</button>';
|
||||
} else if (item.status == 64 && (item.orderRefundType == 1 || item.orderRefundType == 2)) {
|
||||
} else if (item.afterSalesStatus == 64 && (item.orderRefundType == 1 || item.orderRefundType == 2)) {
|
||||
return '<button class="layui-btn layui-btn-sm" lay-event="edit">详情</button><button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="deliveryMoney">完成退换货</button><button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="nodelivery">拒绝退换货</button>';
|
||||
} else if (item.afterSalesStatus == 63 && (item.orderRefundType == 1 || item.orderRefundType == 2)) {
|
||||
return '<button class="layui-btn layui-btn-sm" lay-event="edit">详情</button><button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="deliveryReplacedGoods">换货发货</button>';
|
||||
} else {
|
||||
return '<button class="layui-btn layui-btn-sm" lay-event="edit">详情</button><button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="del">删除</button>';
|
||||
}
|
||||
@ -367,12 +371,12 @@
|
||||
userPhone: $("#userPhone").val(),
|
||||
status: $("#status").val(),
|
||||
orderPayWay: $("#orderPayWay").val(),
|
||||
orderPick:$("#orderPick").val(),
|
||||
addressId:$("#addressId").val(),
|
||||
companyId:$("#companyId").val(),
|
||||
createTimeStart:$("#createTimeStart").val(),
|
||||
createTimeEnd:$("#createTimeEnd").val(),
|
||||
type:2
|
||||
orderPick: $("#orderPick").val(),
|
||||
addressId: $("#addressId").val(),
|
||||
companyId: $("#companyId").val(),
|
||||
createTimeStart: $("#createTimeStart").val(),
|
||||
createTimeEnd: $("#createTimeEnd").val(),
|
||||
type: 2
|
||||
},
|
||||
success: function (res) {
|
||||
window.location.href = res.value;
|
||||
@ -430,7 +434,7 @@
|
||||
} else if (layEvent === 'edit') { //编辑
|
||||
admin.openMax(root + '/order/find?id=' + data.id, '[ 详情 ]');
|
||||
} else if (layEvent === 'delivery') {
|
||||
if (data.status != 61 && data.status != 62) {
|
||||
if (data.afterSalesStatus != 61 && data.afterSalesStatus != 62) {
|
||||
$.message({
|
||||
message: "该状态无法确认",
|
||||
type: "error"
|
||||
@ -445,7 +449,7 @@
|
||||
, offset: '20%'
|
||||
});
|
||||
} else if (layEvent === 'nodeliverys') {
|
||||
if (data.status != 61 && data.status != 62 && data.status != 64) {
|
||||
if (data.afterSalesStatus != 61 && data.afterSalesStatus != 62 && data.afterSalesStatus != 64) {
|
||||
$.message({
|
||||
message: "该状态无法驳回",
|
||||
type: "error"
|
||||
@ -460,7 +464,7 @@
|
||||
, offset: '20%'
|
||||
});
|
||||
} else if (layEvent === 'nodelivery') {
|
||||
if (data.status != 64) {
|
||||
if (data.afterSalesStatus != 64) {
|
||||
$.message({
|
||||
message: "该状态无法拒绝退换货",
|
||||
type: "error"
|
||||
@ -490,7 +494,7 @@
|
||||
// ,offset: '20%'
|
||||
// });
|
||||
} else if (layEvent === 'deliveryMoney') {
|
||||
if (data.status != 64) {
|
||||
if (data.afterSalesStatus != 64) {
|
||||
$.message({
|
||||
message: "该状态无法完成退换货",
|
||||
type: "error"
|
||||
@ -523,7 +527,7 @@
|
||||
})
|
||||
}
|
||||
} else if (layEvent === 'deliveryStatus') {
|
||||
if (data.status != 62) {
|
||||
if (data.afterSalesStatus != 62) {
|
||||
$.message({
|
||||
message: "该状态无法完成退款",
|
||||
type: "error"
|
||||
@ -545,8 +549,8 @@
|
||||
close()
|
||||
}
|
||||
})
|
||||
}else if (layEvent === 'nodeliveryStatus') {
|
||||
if (data.status != 62) {
|
||||
} else if (layEvent === 'nodeliveryStatus') {
|
||||
if (data.afterSalesStatus != 62) {
|
||||
$.message({
|
||||
message: "该状态无法拒绝退款",
|
||||
type: "error"
|
||||
@ -569,6 +573,10 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
// 替换货发货
|
||||
else if (layEvent === 'deliveryReplacedGoods') {
|
||||
// TODO:
|
||||
}
|
||||
});
|
||||
|
||||
//拒绝退换货
|
||||
@ -740,11 +748,11 @@
|
||||
userPhone: $("#userPhone").val(),
|
||||
status: $("#status").val(),
|
||||
orderPayWay: $("#orderPayWay").val(),
|
||||
orderPick:$("#orderPick").val(),
|
||||
addressId:$("#addressId").val(),
|
||||
companyId:$("#companyId").val(),
|
||||
createTimeStart:$("#createTimeStart").val(),
|
||||
createTimeEnd:$("#createTimeEnd").val(),
|
||||
orderPick: $("#orderPick").val(),
|
||||
addressId: $("#addressId").val(),
|
||||
companyId: $("#companyId").val(),
|
||||
createTimeStart: $("#createTimeStart").val(),
|
||||
createTimeEnd: $("#createTimeEnd").val(),
|
||||
},
|
||||
page: {
|
||||
curr: 1 //重新从第 1 页开始
|
||||
|
@ -7,31 +7,51 @@
|
||||
<title>56集品后台管理系统</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="${root}/static/core/css/form.css" media="all">
|
||||
<script src="${root}/static/core/js/base/tailwindcss.js"></script>
|
||||
<script>
|
||||
const packages = ${packages};
|
||||
</script>
|
||||
</head>
|
||||
<body style="background: white">
|
||||
<div class="layui-fluid">
|
||||
<div id="root"></div>
|
||||
<script type="text/babel">
|
||||
const App = () => {
|
||||
return <div>
|
||||
{packages.map((_package, index) => _package).filter(el => el.after)}
|
||||
</div>
|
||||
}
|
||||
const container = document.getElementById("root")
|
||||
const rootApp = ReactDOM.createRoot(container);
|
||||
rootApp.render(<App/>);
|
||||
</script>
|
||||
<%--<div class="layui-fluid">
|
||||
<div class="layui-row">
|
||||
<form class="layui-form" id="formData" lay-filter="formData">
|
||||
<input type="hidden" id="type" value="${type}">
|
||||
<input type="hidden" id="orderId" name="orderId" value="${orderId}">
|
||||
<input type="hidden" id="agree" name="agree" value="${agree}">
|
||||
|
||||
<div class="layui-form-item formItem">
|
||||
<label for="orderRefundRemarke" class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea style="height: 250px" type="text" id="orderRefundRemarke" name="orderRefundRemarke" lay-verify="required" autocomplete="off" class="layui-input"></textarea>
|
||||
<textarea style="height: 250px" type="text" id="orderRefundRemarke" name="orderRefundRemarke"
|
||||
lay-verify="required" autocomplete="off" class="layui-input"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item formItem">
|
||||
<label class="layui-form-label"></label>
|
||||
<button class="layui-btn layui-btn-primary layui-btn-sm subBtn" style="width: 165px;margin-top: 23px;" lay-filter="add" lay-submit="">提交</button>
|
||||
<label class="layui-form-label"></label>
|
||||
<button class="layui-btn layui-btn-primary layui-btn-sm subBtn" style="width: 165px;margin-top: 23px;"
|
||||
lay-filter="add" lay-submit="">提交
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>--%>
|
||||
</body>
|
||||
<script>
|
||||
<%--<script>
|
||||
layui.use(['layer', 'form'], function () {
|
||||
var form = layui.form
|
||||
|
||||
@ -53,9 +73,9 @@
|
||||
$.message({message: e.msg, type: "success"});
|
||||
setTimeout(function () {
|
||||
admin.close();
|
||||
if($("#type").val() == 1){
|
||||
if ($("#type").val() == 1) {
|
||||
admin.fatherReload();
|
||||
}else{
|
||||
} else {
|
||||
admin.fatherReload();
|
||||
admin.fatherFatherReload();
|
||||
}
|
||||
@ -63,7 +83,7 @@
|
||||
} else {
|
||||
$.message({message: e.msg, type: "error"});
|
||||
}
|
||||
},"json")
|
||||
}, "json")
|
||||
close()
|
||||
},
|
||||
cancel: function (close) {
|
||||
@ -73,5 +93,5 @@
|
||||
return false;
|
||||
});
|
||||
})
|
||||
</script>
|
||||
</script>--%>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user