提交 8826de2a 作者: 张小凤

rental(add)

上级 3797d10c
package com.mmc.oms.common;
/**
* @Author small
* @Date 2023/6/1 16:23
* @Version 1.0
*/
public enum RefundStatus {
INIT(100, "提交申请"), YSP(200, "已审批"), FINISH(300, "退款完成"), CLOSE(999, "已关闭");
RefundStatus(Integer code, String status) {
this.code = code;
this.status = status;
}
private Integer code;
private String status;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
......@@ -381,14 +381,14 @@ public enum ResultEnum implements BaseErrorInfoInterface {
SCORE_ERROR("40177", "您输入的积分数量有误,请重新输入!"),
PLEASE_FILL_IN_THE_CONTRACT_TEMPLATE_FIRST("40178", "请先填充合同模板!"),
SCORE_NOT_GIVE_MYSELF("40179","积分不能转赠给本人,请重新操作"),
SCORE_NOT_GIVE_MYSELF("40179", "积分不能转赠给本人,请重新操作"),
ALREADY_FINISH_ENT_AUTH_ERROR("2000", "助力已完成!"),
SYSTEM_ERROR ("2001","系统错误,请稍后重试") ,
RULE_ERROR ("2002","当前兑换比例已失效,请刷新后重试"),
SYSTEM_ERROR("2001", "系统错误,请稍后重试"),
RULE_ERROR("2002", "当前兑换比例已失效,请刷新后重试"),
COUNT_LIMIT_ERROR("2003", "参与次数已达上线"),
ALREADY_ENT_AUTH_ERROR("2004","助力失败,您已完成企业认证!"),
ALREADY_REAL_NAME_AUTH_ERROR("2005","助力失败,您已完成实名认证!"),
ALREADY_ENT_AUTH_ERROR("2004", "助力失败,您已完成企业认证!"),
ALREADY_REAL_NAME_AUTH_ERROR("2005", "助力失败,您已完成实名认证!"),
PARTICIPATE_BUT_NOT_AUTH_ERROR("2006", "待完成授权或认证"),
ALREADY_HELP_ERROR("2007", "已助力"),
ALREADY_STOP_ERROR("2008", "活动已下线"),
......@@ -396,8 +396,10 @@ public enum ResultEnum implements BaseErrorInfoInterface {
ALREADY_BINDING_ERROR("2010", "优惠券已被绑定"),
ALREADY_DIVIDE_ERROR("2011", "订单已分成"),
DIVIDE_OBJ_NOT_EXIST("2012", "先点击确认添加分成对象"),
THE_REQUEST_IS_NOT_AUTHENTICATED("2013","请求未经过鉴权"),
THE_TOKEN_IS_INVALID("2014","token失效") ;
THE_REQUEST_IS_NOT_AUTHENTICATED("2013", "请求未经过鉴权"),
THE_TOKEN_IS_INVALID("2014", "token失效"),
REFUND_FAILED("2015", "退款失败,请联系客服"),
NO_PERMISSION_TEMPORARILY("2016", "当前账号没有权限,只有后台账号拥有权限");
/**
* 错误码
......
package com.mmc.oms.controller;
import com.mmc.oms.common.ResultBody;
import com.mmc.oms.model.dto.OrderInfoDTO;
import com.mmc.oms.model.dto.OrderReceiptDTO;
import com.mmc.oms.model.dto.TranStatusDicDTO;
import com.mmc.oms.model.dto.*;
import com.mmc.oms.service.OrderLogisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -20,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
* @Date 2023/5/31 16:14
* @Version 1.0
*/
@Api(tags = { "订单-物流-接口" })
@Api(tags = {"订单-物流-接口"})
@RestController
@RequestMapping("/express/")
public class OrderLogisticsController extends BaseController {
......@@ -29,37 +27,37 @@ public class OrderLogisticsController extends BaseController {
private OrderLogisticsService orderLogisticsService;
@ApiOperation(value = "物流-状态码-字典")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = TranStatusDicDTO.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = TranStatusDicDTO.class)})
@GetMapping("listKdnDic")
public ResultBody listKdnDic() {
public ResultBody<KdnDicDTO> listKdnDic() {
return ResultBody.success(orderLogisticsService.listKdnDic());
}
@ApiOperation(value = "物流公司-字典")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = TranStatusDicDTO.class) })
@ApiOperation(value = "v1.0.1 物流公司列表-字典")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = TranStatusDicDTO.class)})
@GetMapping("listExpressInfo")
public ResultBody listExpressInfo() {
public ResultBody<ExpressInfoDTO> listExpressInfo() {
return ResultBody.success(orderLogisticsService.listExpressInfo());
}
@ApiOperation(value = "查询订单的发货、收货、退换货等信息")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = OrderReceiptDTO.class) })
@ApiOperation(value = "v1.0.1查询订单的发货、收货、退换货等信息——用户信息")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = OrderReceiptDTO.class)})
@GetMapping("getOrderExpress")
public ResultBody getOrderExpress(@RequestParam Integer orderInfoId) {
public ResultBody<OrderReceiptDTO> getOrderExpress(@RequestParam Integer orderInfoId) {
return ResultBody.success(orderLogisticsService.getOrderReceiptInfo(orderInfoId));
}
@ApiOperation(value = "查看发货物流信息-订单")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = OrderInfoDTO.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = OrderInfoDTO.class)})
@GetMapping("orderExpressInfo")
public ResultBody orderExpressInfo(@RequestParam Integer orderInfoId) {
public ResultBody<OrderInfoDTO> orderExpressInfo(@RequestParam Integer orderInfoId) {
return orderLogisticsService.orderExpressInfo(orderInfoId);
}
@ApiOperation(value = "查看退货物流信息-订单")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = OrderInfoDTO.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = OrderInfoDTO.class)})
@GetMapping("refundExpressInfo")
public ResultBody refundExpressInfo(@RequestParam Integer orderInfoId) {
public ResultBody<OrderInfoDTO> refundExpressInfo(@RequestParam Integer orderInfoId) {
return orderLogisticsService.refundExpressInfo(orderInfoId);
}
}
package com.mmc.oms.controller;
import com.mmc.oms.common.ResultBody;
import com.mmc.oms.model.vo.OrderRefundVO;
import com.mmc.oms.model.vo.RefundYesOrNoVO;
import com.mmc.oms.service.OrderRefundService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
/**
* @Author small
* @Date 2023/6/1 16:02
* @Version 1.0
*/
@Api(tags = {"订单-退款相关-接口"})
@RestController
@RequestMapping("/refund/")
public class OrderRefundController extends BaseController {
@Autowired
private OrderRefundService orderRefundService;
@ApiOperation(value = "web——发起退款申请")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("applyRetreat")
public ResultBody applyRetreat(HttpServletRequest request, @RequestBody OrderRefundVO param) {
return orderRefundService.applyRetreat(this.getCurrentAccount(request), param);
}
@ApiOperation(value = "后台管理——驳回/同意退款")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("refund")
public ResultBody refund(HttpServletRequest request, @RequestBody RefundYesOrNoVO param) {
return orderRefundService.refund(this.getCurrentAccount(request), param);
}
}
......@@ -2,11 +2,13 @@ package com.mmc.oms.controller;
import com.mmc.oms.common.ResultBody;
import com.mmc.oms.common.Send;
import com.mmc.oms.common.Take;
import com.mmc.oms.model.dto.OrderInfoDTO;
import com.mmc.oms.model.qo.OrderInfoQO;
import com.mmc.oms.model.vo.LeaseOrderVO;
import com.mmc.oms.model.vo.OrderStatusVO;
import com.mmc.oms.model.vo.OrderVcuVO;
import com.mmc.oms.model.vo.ReturnWareVO;
import com.mmc.oms.service.RentalOrdersService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -77,7 +79,7 @@ public class RentalOrdersController extends BaseController {
}
@ApiOperation(value = "后台管理——发货-订单")
@ApiOperation(value = "v1.0.1后台管理——发货-订单/ 卖家发货")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("sendOrderWare")
public ResultBody sendOrderWare(HttpServletRequest request,
......@@ -86,4 +88,28 @@ public class RentalOrdersController extends BaseController {
}
@ApiOperation(value = "web 确认收货-订单")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("renterTakeOrder")
public ResultBody renterTakeOrder(@Validated({Take.class}) @RequestBody OrderVcuVO param) {
return rentalOrdersService.renterTakeOrder(param);
}
@ApiOperation(value = "web 商品归还-订单")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("returnOrderWare")
public ResultBody returnOrderWare(@RequestBody ReturnWareVO param) {
return rentalOrdersService.returnOrderWare(param);
}
@ApiOperation(value = "后台管理——平台确认归还")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("pfConfirmOrderWare")
public ResultBody pfConfirmOrderWare(HttpServletRequest request, @RequestBody OrderVcuVO param) {
return rentalOrdersService.pfConfirmOrderWare(this.getCurrentAccount(request), param);
}
}
package com.mmc.oms.dao;
import com.mmc.oms.entity.OrderRefundDO;
import com.mmc.oms.entity.OrderVcuDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Author small
* @Date 2023/5/31 16:25
......@@ -13,4 +12,10 @@ import java.util.List;
@Mapper
public interface OrderRefundDao {
OrderRefundDO getNewOrderRefund(Integer orderInfoId);
int countValidRefund(Integer orderInfoId);
void insertOrderRefund(OrderRefundDO refund);
void insertOrderVcu(OrderVcuDO vcu);
}
......@@ -47,4 +47,9 @@ public interface RentalOrdersDao {
List<OrderStatusDO> listOfRentalOrders(OrderStatusVO orderStatusVO);
int rentalOrdersCount(OrderStatusVO orderStatusVO);
void updateOrder(String orderNo, Integer code);
OrderRefundDO getApplicationInformation(Integer id);
}
......@@ -16,31 +16,32 @@ import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
public class OrderRefundDO implements Serializable {
private static final long serialVersionUID = 4323688698785079576L;
private Integer id;
private Integer orderInfoId;
private String refundNo;
private Integer refundStatus;
private BigDecimal shouldRefund;
private BigDecimal actualRefund;
private String reason;
private String pfRemark;
private Date createTime;
private static final long serialVersionUID = 4323688698785079576L;
private Integer id;
private Integer orderInfoId;
private String refundNo;
private Integer refundStatus;
private BigDecimal shouldRefund;
private BigDecimal actualRefund;
private String reason;
private String pfRemark;
private Date createTime;
private OrderInfoDO orderInfo;
private OrderInfoDO orderInfo;
private Integer userAccountId;
public OrderRefundDTO buildOrderRefundDTO() {
return OrderRefundDTO.builder()
.id(this.id)
.orderInfoId(this.orderInfoId)
.refundStatus(this.refundStatus)
.shouldRefund(this.shouldRefund)
.actualRefund(this.actualRefund)
.reason(this.reason)
.refundNo(this.refundNo)
.orderInfo(this.orderInfo == null ? null : this.orderInfo.buildOrderInfoDTO())
.pfRemark(this.pfRemark)
.createTime(this.createTime)
.build();
}
public OrderRefundDTO buildOrderRefundDTO() {
return OrderRefundDTO.builder()
.id(this.id)
.orderInfoId(this.orderInfoId)
.refundStatus(this.refundStatus)
.shouldRefund(this.shouldRefund)
.actualRefund(this.actualRefund)
.reason(this.reason)
.refundNo(this.refundNo)
.orderInfo(this.orderInfo == null ? null : this.orderInfo.buildOrderInfoDTO())
.pfRemark(this.pfRemark)
.createTime(this.createTime)
.build();
}
}
......@@ -31,8 +31,8 @@ public class OrderStatusDO {
@ApiModelProperty(value = "商品图片")
private String wareImg;
@ApiModelProperty(value = "租金总金额")
private BigDecimal rentPrice;
@ApiModelProperty(value = "实际付款")
private BigDecimal actualPay;
@ApiModelProperty(value = "订单描述")
private String wareDescription;
......@@ -54,7 +54,7 @@ public class OrderStatusDO {
.id(this.id)
.orderNo(this.orderNo)
.wareImg(this.wareImg)
.rentPrice(this.rentPrice)
.actualPay(this.actualPay)
.wareDescription(this.wareDescription)
.tranStatus(this.tranStatus)
.waiting(this.waiting)
......
package com.mmc.oms.model.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -36,12 +35,8 @@ public class BaseAccountDTO implements Serializable {
private String userName;
@ApiModelProperty(value = "用户昵称")
private String nickName;
@ApiModelProperty(value = "0是后台管理 100客户端 小程序")
private Integer portType;
}
......@@ -19,6 +19,7 @@ import java.math.BigDecimal;
@Builder
public class OrderStatusDTO {
private static final long serialVersionUID = 6544149196885009444L;
@ApiModelProperty(value = "订单id")
private Integer id;
@ApiModelProperty(value = "订单编号")
......@@ -30,8 +31,8 @@ public class OrderStatusDTO {
@ApiModelProperty(value = "商品图片")
private String wareImg;
@ApiModelProperty(value = "租金总金额")
private BigDecimal rentPrice;
@ApiModelProperty(value = "实际付款")
private BigDecimal actualPay;
@ApiModelProperty(value = "订单描述")
private String wareDescription;
......
package com.mmc.oms.model.vo;
import com.mmc.oms.entity.OrderVcuDO;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.util.CollectionUtils;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @Author small
* @Date 2023/6/1 16:09
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
//@ApiModel(value = "com.mmc.csf.model.vo.OrderRefundVO", description = "发货/收货类")
public class OrderRefundVO implements Serializable {
private static final long serialVersionUID = 5392913587235842548L;
@ApiModelProperty(value = "订单ID")
@NotNull
private Integer orderInfoId;
@ApiModelProperty(value = "退款理由/原因")
private String reason;
@ApiModelProperty(value = "补充描述和凭证")
private String remark;
@ApiModelProperty(value = "图片集合")
private List<String> imgs;
@ApiModelProperty(value = "视频")
private String videoUrl;
public OrderVcuDO buildOrdeVcu() {
return OrderVcuDO.builder().remark(this.remark)
.imgs(CollectionUtils.isEmpty(this.imgs) ? null : String.join(",", this.imgs)).videoUrl(this.videoUrl)
.orderInfoId(this.orderInfoId).build();
}
}
package com.mmc.oms.model.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
/**
* @Author small
* @Date 2023/6/1 16:40
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class RefundYesOrNoVO {
private static final long serialVersionUID = 5392913587235842548L;
@ApiModelProperty(value = "订单ID")
@NotNull
private Integer orderInfoId;
@ApiModelProperty(value = "是否同意退款 true 同意 false驳回 ")
@NotNull
private Boolean refund;
}
package com.mmc.oms.model.vo;
import com.mmc.oms.entity.OrderVcuDO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -23,11 +22,11 @@ import java.util.List;
@NoArgsConstructor
//@ApiModel(value = "com.mmc.csf.model.vo.ReturnWareVO", description = "退换货类")
public class ReturnWareVO {
@ApiModelProperty(value = "订单ID")
@ApiModelProperty(value = "订单ID", required = true)
@NotNull
private Integer orderInfoId;
@ApiModelProperty(value = "退还货方式:0邮寄 1门店地址")
@ApiModelProperty(value = "退还货方式:0邮寄 1门店地址 默认0 暂无门店", example = "0")
@NotNull(message = "归还方式不能为空")
private Integer renMethod;
......
package com.mmc.oms.service.Impl;
import com.mmc.oms.common.*;
import com.mmc.oms.dao.OrderRefundDao;
import com.mmc.oms.dao.RentalOrdersDao;
import com.mmc.oms.entity.OrderInfoDO;
import com.mmc.oms.entity.OrderRefundDO;
import com.mmc.oms.entity.OrderVcuDO;
import com.mmc.oms.model.dto.BaseAccountDTO;
import com.mmc.oms.model.vo.OrderRefundVO;
import com.mmc.oms.model.vo.RefundYesOrNoVO;
import com.mmc.oms.service.OrderRefundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Author small
* @Date 2023/6/1 16:03
* @Version 1.0
*/
@Service
public class OrderRefundServiceImpl implements OrderRefundService {
@Autowired
private OrderRefundDao orderRefundDao;
@Autowired
private RentalOrdersDao rentalOrdersDao;
@Value("${payment.url}")
private String paymentUrl;
@Autowired
private RestTemplate restTemplate;
@Override
@Transactional
public ResultBody applyRetreat(BaseAccountDTO account, OrderRefundVO param) {
OrderInfoDO order = rentalOrdersDao.getOrderInfo(param.getOrderInfoId());
if (!TranStatusDic.YFK.getStatus().equals(order.getTranStatus())) {
return ResultBody.error(ResultEnum.ORDER_STATUS_ERROR);
}
int count = orderRefundDao.countValidRefund(param.getOrderInfoId());
if (count > 0) {
return ResultBody.error(ResultEnum.ORDER_REFUND_EXIT_ERROR);
}
Date cdate = new Date();
// 添加申请单
OrderRefundDO refund = new OrderRefundDO();
refund.setOrderInfoId(order.getId());
refund.setRefundNo(CodeUtil.createOrderRefund());
refund.setRefundStatus(RefundStatus.INIT.getCode());
refund.setShouldRefund(order.getActualPay());
refund.setActualRefund(BigDecimal.ZERO);
refund.setReason(param.getReason());
refund.setCreateTime(cdate);
refund.setUserAccountId(account.getUserAccountId());
orderRefundDao.insertOrderRefund(refund);
// 订单-视频、图片
OrderVcuDO vcu = param.buildOrdeVcu();
vcu.setOrderRefundId(refund.getId());
vcu.setVcuType(VcuType.RETREAT.getCode());
vcu.setCreateTime(cdate);
orderRefundDao.insertOrderVcu(vcu);
// 申请进度log
/* RefundLogDO rlog = new RefundLogDO();
rlog.setOrderRefundId(refund.getId());
rlog.setRefundCode(RefundShd.INIT.getStatus());
String msg = "发起退款申请,货物状态:未发货,原因:" + param.getReason() + ",金额:" + order.getActualPay() + "元";
rlog.setMsg(msg);
rlog.setOpAccount(account.getUid());
rlog.setOpName(account.getAccountName());
rlog.setCreateTime(cdate);
orderRefundDao.insertRefundLog(rlog);*/
// 修改订单状态
OrderInfoDO upOrder = new OrderInfoDO();
upOrder.setId(param.getOrderInfoId());
upOrder.setTranStatus(TranStatusDic.TKSQ.getStatus());
rentalOrdersDao.updateOrderInfo(upOrder);
return ResultBody.success();
}
@Override
public ResultBody refund(BaseAccountDTO currentAccount, RefundYesOrNoVO param) {
if (currentAccount.getPortType() != 0) {
ResultBody.error(ResultEnum.NO_PERMISSION_TEMPORARILY);
}
OrderInfoDO order = rentalOrdersDao.getOrderInfo(param.getOrderInfoId());
OrderRefundDO applicationInformation = rentalOrdersDao.getApplicationInformation(order.getId());
//同意退款就订单关闭
//驳回订单还处于当前状态
Boolean refund = param.getRefund();
//同意退款
if (refund.equals(true)) {
rentalOrdersDao.updateOrder(order.getOrderNo(), RefundStatus.CLOSE.getCode());
refundChanges(currentAccount.getToken(), order.getActualPay(), order.getOrderNo(), applicationInformation.getUserAccountId(), applicationInformation.getRefundNo());
return ResultBody.success(RefundStatus.FINISH.getStatus());
}
rentalOrdersDao.updateOrder(order.getOrderNo(), RefundStatus.INIT.getCode());
return ResultBody.error(ResultEnum.REFUND_FAILED);
}
/**
* 退款金额变更
*
* @param orderNo
* @return
*/
private void refundChanges(String token, BigDecimal actualPay, String orderNo, Integer userAccountId, String refundNo) {
HttpHeaders headers = new HttpHeaders();
headers.add("token", token);
HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<MultiValueMap<String, Object>>(headers);
ResponseEntity<String> exchange = restTemplate.exchange(paymentUrl + "/amountOfRefund?actualPay="
+ actualPay + "&orderNo="
+ orderNo + "&repoAccountId="
+ userAccountId + "&refundNo="
+ refundNo,
HttpMethod.GET, formEntity, String.class);
System.out.println(exchange);
}
}
......@@ -10,6 +10,7 @@ import com.mmc.oms.model.qo.OrderInfoQO;
import com.mmc.oms.model.vo.*;
import com.mmc.oms.service.RentalOrdersService;
import com.mmc.oms.wx.WxMsgTemplete;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
......@@ -378,6 +379,80 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
return PageResult.buildPage(pageNo, orderStatusVO.getPageSize(), count, collect);
}
@Override
public ResultBody renterTakeOrder(OrderVcuVO param) {
OrderInfoDO order = rentalOrdersDao.getOrderInfo(param.getOrderInfoId());
if (!TranStatusDic.YFH.getStatus().equals(order.getTranStatus())) {
return ResultBody.error(ResultEnum.ORDER_STATUS_ERROR);
}
// 订单-视频、图片
OrderVcuDO vcu = param.buildOrdeVcu();
vcu.setVcuType(VcuType.REC.getCode());
vcu.setCreateTime(new Date());
rentalOrdersDao.insertOrderVcu(vcu);
// 修改订单状态
OrderInfoDO upOrder = new OrderInfoDO();
upOrder.setId(param.getOrderInfoId());
upOrder.setTranStatus(TranStatusDic.ZLZ.getStatus());
rentalOrdersDao.updateOrderInfo(upOrder);
return ResultBody.success();
}
@Override
public ResultBody returnOrderWare(ReturnWareVO param) {
OrderInfoDO order = rentalOrdersDao.getOrderInfo(param.getOrderInfoId());
if (!TranStatusDic.ZLZ.getStatus().equals(order.getTranStatus())) {
return ResultBody.error(ResultEnum.ORDER_STATUS_ERROR);
}
if (param.getRenMethod() == RenMethod.EXPRESS.getCode()) {
if (StringUtils.isBlank(param.getRenExCode()) || StringUtils.isBlank(param.getRenExNo())) {
return ResultBody.error(ResultEnum.EXPRESS_RETURN_ERROR);
}
OrderReceiptDO receipt = new OrderReceiptDO();
receipt.setOrderInfoId(param.getOrderInfoId());
receipt.setRenMethod(RenMethod.EXPRESS.getCode());
receipt.setRenExCode(param.getRenExCode());
receipt.setRenExNo(param.getRenExNo());
rentalOrdersDao.updateOrderReceipt(receipt);
} else {
if (param.getRepoInfoId() == null) {
return ResultBody.error(ResultEnum.SHOP_RETURN_ERROR);
}
//门店信息
// RepoInfoDTO repoInfo = repoDeviceServletClient.feignGetRepoShop(param.getRepoInfoId());
/*if (repoInfo == null) {
return ResultBody.error(ResultEnum.FEIGN_DEVICE_SERVLET_ERROR);
}*/
OrderReceiptDO receipt = new OrderReceiptDO();
receipt.setOrderInfoId(param.getOrderInfoId());
receipt.setRenMethod(RenMethod.SHOP.getCode());
// receipt.setRenRepoName(repoInfo.getRepoName());
// receipt.setRenRepoAddr(repoInfo.getRepoAddress());
//UserAccountDTO repoUser = userServletClient.feignGetUserSimpleInfo(repoInfo.getUserAccountId());
/* if (repoUser == null) {
return ResultBody.error(ResultEnum.FEIGN_USER_SERVLET_ERROR);
}
receipt.setRenRepoPhone(repoUser.getPhoneNum());*/
rentalOrdersDao.updateOrderReceipt(receipt);
}
// 订单-视频、图片
OrderVcuDO vcu = param.buildOrdeVcu();
vcu.setVcuType(VcuType.RETURN.getCode());
vcu.setCreateTime(new Date());
rentalOrdersDao.insertOrderVcu(vcu);
// 修改订单状态
OrderInfoDO upOrder = new OrderInfoDO();
upOrder.setId(param.getOrderInfoId());
upOrder.setTranStatus(TranStatusDic.GHZ.getStatus());
rentalOrdersDao.updateOrderInfo(upOrder);
return ResultBody.success();
}
private void sendShipMsg(Integer orderInfoId) {
OrderInfoDO orderInfo = rentalOrdersDao.getOrderInfo(orderInfoId);
......@@ -443,4 +518,31 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
}
return null;
}
@Override
public ResultBody pfConfirmOrderWare(BaseAccountDTO cuser, OrderVcuVO param) {
// 密码认证
ResultBody body = passwordAuthentication(cuser, param.getAuthPwd());
if (body != null) {
return body;
}
OrderInfoDO order = rentalOrdersDao.getOrderInfo(param.getOrderInfoId());
if (!TranStatusDic.GHZ.getStatus().equals(order.getTranStatus())) {
return ResultBody.error(ResultEnum.ORDER_STATUS_ERROR);
}
// 订单-视频、图片
OrderVcuDO vcu = param.buildOrdeVcu();
vcu.setVcuType(VcuType.PFREC.getCode());
vcu.setCreateTime(new Date());
rentalOrdersDao.insertOrderVcu(vcu);
// 修改订单状态
OrderInfoDO upOrder = new OrderInfoDO();
upOrder.setId(param.getOrderInfoId());
upOrder.setTranStatus(TranStatusDic.JYWC.getStatus());
rentalOrdersDao.updateOrderInfo(upOrder);
// 以异步方式同步数据到分成明细表 云仓
// this.SynchronousDataToPushMoney(order.getOrderNo());
return ResultBody.success();
}
}
package com.mmc.oms.service;
import com.mmc.oms.common.ResultBody;
import com.mmc.oms.model.dto.BaseAccountDTO;
import com.mmc.oms.model.vo.OrderRefundVO;
import com.mmc.oms.model.vo.RefundYesOrNoVO;
/**
* @Author small
* @Date 2023/6/1 16:03
* @Version 1.0
*/
public interface OrderRefundService {
ResultBody applyRetreat(BaseAccountDTO currentAccount, OrderRefundVO param);
ResultBody refund(BaseAccountDTO currentAccount, RefundYesOrNoVO param);
}
......@@ -5,30 +5,31 @@ import com.mmc.oms.common.ResultBody;
import com.mmc.oms.model.dto.BaseAccountDTO;
import com.mmc.oms.model.dto.OrderInfoDTO;
import com.mmc.oms.model.qo.OrderInfoQO;
import com.mmc.oms.model.vo.LeaseOrderVO;
import com.mmc.oms.model.vo.OrderStatusVO;
import com.mmc.oms.model.vo.OrderVcuVO;
import com.mmc.oms.model.vo.RentalOrderVO;
import javax.servlet.http.HttpServletRequest;
import com.mmc.oms.model.vo.*;
/**
* @Author small @Date 2023/5/26 10:52 @Version 1.0
*/
public interface RentalOrdersService {
ResultBody addLease(BaseAccountDTO account, RentalOrderVO rentalOrderVO);
ResultBody addLease(BaseAccountDTO account, RentalOrderVO rentalOrderVO);
OrderInfoDTO getOrderDetail(String orderNo);
OrderInfoDTO feignAddLease(BaseAccountDTO user, LeaseOrderVO param);
PageResult listPcOrderInfo(OrderInfoQO param, BaseAccountDTO cuser);
OrderInfoDTO getOrderDetail(String orderNo);
PageResult listPageWechatOrder(BaseAccountDTO account, OrderInfoQO param);
OrderInfoDTO feignAddLease(BaseAccountDTO user, LeaseOrderVO param);
Object orderStatusChanges(String orderNo, Integer tranStatus);
PageResult listPcOrderInfo(OrderInfoQO param, BaseAccountDTO cuser);
ResultBody sendOrderWare(BaseAccountDTO currentAccount, OrderVcuVO param);
PageResult listPageWechatOrder(BaseAccountDTO account, OrderInfoQO param);
PageResult listOfRentalOrders(OrderStatusVO orderStatusVO, BaseAccountDTO currentAccount);
Object orderStatusChanges( String orderNo,Integer tranStatus);
ResultBody renterTakeOrder(OrderVcuVO param);
ResultBody sendOrderWare(BaseAccountDTO currentAccount, OrderVcuVO param);
ResultBody returnOrderWare(ReturnWareVO param);
PageResult listOfRentalOrders(OrderStatusVO orderStatusVO, BaseAccountDTO currentAccount);
ResultBody pfConfirmOrderWare(BaseAccountDTO currentAccount, OrderVcuVO param);
}
......@@ -53,5 +53,7 @@ workFlyerInfoKey: TEST_WORK_FLYER_INFO
userapp:
url: http://localhost:35150/userapp/
payment:
url: http://localhost:8088/payment/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mmc.oms.dao.OrderRefundDao">
<select id="countValidRefund" resultType="Integer">
select count(*)
from order_refund r
where r.order_info_id = #{orderInfoId}
and r.refund_status != '999'
</select>
<insert id="insertOrderRefund" useGeneratedKeys="true"
keyProperty="id"
parameterType="com.mmc.oms.entity.OrderRefundDO">
insert into order_refund
(order_info_id, refund_no, refund_status, should_refund, actual_refund, reason, create_time, user_account_id)
values (#{orderInfoId}, #{refundNo}, #{refundStatus}, #{shouldRefund}, #{actualRefund}, #{reason},
#{createTime}, #{userAccountId})
</insert>
<insert id="insertOrderVcu" useGeneratedKeys="true"
keyProperty="id" parameterType="com.mmc.oms.entity.OrderVcuDO">
insert into order_vcu
(order_info_id, order_refund_id, vcu_type, vcu_satus, imgs, video_url, remark, create_time)
values (#{orderInfoId}, #{orderRefundId}, #{vcuType}, #{vcuSatus}, #{imgs}, #{videoUrl}, #{remark},
#{createTime})
</insert>
</mapper>
......@@ -509,7 +509,7 @@
where id = #{id}
</update>
<select id="getOrderReceiptByOrder" resultMap="orderReceiptResultMap" parameterType="Integer">
<select id="getOrderReceiptByOrder" resultMap="orderReceiptResultMap" parameterType="java.lang.Integer">
select r.id,
r.order_info_id,
r.receipt_method,
......@@ -535,7 +535,7 @@
o.order_no AS orderNo,
o.ware_title AS wareTitle,
o.ware_img AS wareImg,
o.rent_price AS rentPrice,
o.actual_pay AS actualPay,
o.ware_description AS wareDescription,
o.tran_status AS tranStatus,
tsd.waiting,
......@@ -568,4 +568,19 @@
and o.tran_status = #{orderStatus}
</if>
</select>
<update id="updateOrder">
update order_info
set tran_status=#{code}
where order_no = #{orderNo}
</update>
<select id="getApplicationInformation" resultType="com.mmc.oms.entity.OrderRefundDO">
SELECT id,
order_info_id AS orderInfoId,
refund_no AS refundNo,
user_account_id AS userAccountId
FROM order_refund
where order_info_id = #{id}
</select>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论