|
@@ -17,17 +17,16 @@ import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
import com.zhongzheng.modules.goods.vo.GoodsVo;
|
|
|
import com.zhongzheng.modules.grade.domain.ClassGradeUser;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeUserService;
|
|
|
-import com.zhongzheng.modules.order.bo.OrderGoodsQueryBo;
|
|
|
-import com.zhongzheng.modules.order.bo.OrderGoodsRefundAddBo;
|
|
|
-import com.zhongzheng.modules.order.bo.OrderGoodsRefundEditBo;
|
|
|
-import com.zhongzheng.modules.order.bo.OrderGoodsRefundQueryBo;
|
|
|
+import com.zhongzheng.modules.order.bo.*;
|
|
|
import com.zhongzheng.modules.order.domain.Order;
|
|
|
import com.zhongzheng.modules.order.domain.OrderGoods;
|
|
|
import com.zhongzheng.modules.order.domain.OrderGoodsRefund;
|
|
|
+import com.zhongzheng.modules.order.domain.OrderShareMoney;
|
|
|
import com.zhongzheng.modules.order.mapper.OrderGoodsRefundMapper;
|
|
|
import com.zhongzheng.modules.order.service.IOrderGoodsRefundService;
|
|
|
import com.zhongzheng.modules.order.service.IOrderGoodsService;
|
|
|
import com.zhongzheng.modules.order.service.IOrderService;
|
|
|
+import com.zhongzheng.modules.order.service.IOrderShareMoneyService;
|
|
|
import com.zhongzheng.modules.order.vo.OrderGoodsRefundVo;
|
|
|
import com.zhongzheng.modules.order.vo.OrderGoodsVo;
|
|
|
import com.zhongzheng.modules.order.vo.OrderShareGoodsVo;
|
|
@@ -84,6 +83,8 @@ public class OrderGoodsRefundServiceImpl extends ServiceImpl<OrderGoodsRefundMap
|
|
|
private IUserExamGoodsService iUserExamGoodsService;
|
|
|
@Autowired
|
|
|
private IUserService iUserService;
|
|
|
+ @Autowired
|
|
|
+ private IOrderShareMoneyService iOrderShareMoneyService;
|
|
|
@Value("${oldStudySys.shareCanclePath}")
|
|
|
private String SHARE_CANCLE_PATH;
|
|
|
|
|
@@ -361,30 +362,42 @@ public class OrderGoodsRefundServiceImpl extends ServiceImpl<OrderGoodsRefundMap
|
|
|
*/
|
|
|
public boolean shareClientCancelOldSys(Order order, OrderGoods orderGoods, BigDecimal refund_fee) {
|
|
|
if (Validator.isNotEmpty(order)) {
|
|
|
- UserVo user = iUserService.queryById(order.getUserId());
|
|
|
- if(Validator.isNotEmpty(user.getShareCode())){
|
|
|
- OrderShareToOldVo vo = new OrderShareToOldVo();
|
|
|
- vo.setOrderId(order.getOrderId());
|
|
|
- vo.setCanceamount(refund_fee);
|
|
|
- List<OrderShareGoodsVo> shareGoodsVoList = new ArrayList<>();
|
|
|
- OrderShareGoodsVo shareGoodsVo = new OrderShareGoodsVo();
|
|
|
- shareGoodsVo.setGoodsId(orderGoods.getGoodsId());
|
|
|
- shareGoodsVoList.add(shareGoodsVo);
|
|
|
- vo.setGoodsList(shareGoodsVoList);
|
|
|
- //分销下单
|
|
|
- Map<String, String> params = new HashMap<>();
|
|
|
- Long nowTime = DateUtils.getNowTime();
|
|
|
- String sign = ToolsUtils.EncoderByMd5(nowTime.toString()+"pubilc2022");
|
|
|
- params.put("stamp", nowTime.toString());
|
|
|
- params.put("sign", sign);
|
|
|
- params.put("jsonstr", JSONObject.toJSONString(vo));
|
|
|
- String respone = "";
|
|
|
- try {
|
|
|
- respone = HttpUtils.postFormBody(SHARE_CANCLE_PATH, params);
|
|
|
- } catch (IOException e) {
|
|
|
- throw new CustomException("同步请求错误"+e.getMessage());
|
|
|
+ OrderShareMoney shareMoney = iOrderShareMoneyService.getOne(new LambdaQueryWrapper<OrderShareMoney>()
|
|
|
+ .eq(OrderShareMoney::getStatus, 1)
|
|
|
+ .eq(OrderShareMoney::getOrderId, order.getOrderId())
|
|
|
+ .last("limit 1"));
|
|
|
+ if(Validator.isNotEmpty(shareMoney)){
|
|
|
+ UserVo user = iUserService.queryById(order.getUserId());
|
|
|
+ if(Validator.isNotEmpty(user.getShareCode())){
|
|
|
+ OrderShareToOldVo vo = new OrderShareToOldVo();
|
|
|
+ vo.setOrderId(order.getOrderId());
|
|
|
+ vo.setCanceamount(refund_fee);
|
|
|
+ List<OrderShareGoodsVo> shareGoodsVoList = new ArrayList<>();
|
|
|
+ OrderShareGoodsVo shareGoodsVo = new OrderShareGoodsVo();
|
|
|
+ shareGoodsVo.setGoodsId(orderGoods.getGoodsId());
|
|
|
+ shareGoodsVoList.add(shareGoodsVo);
|
|
|
+ vo.setGoodsList(shareGoodsVoList);
|
|
|
+ //分销下单
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ Long nowTime = DateUtils.getNowTime();
|
|
|
+ String sign = ToolsUtils.EncoderByMd5(nowTime.toString()+"pubilc2022");
|
|
|
+ params.put("stamp", nowTime.toString());
|
|
|
+ params.put("sign", sign);
|
|
|
+ params.put("jsonstr", JSONObject.toJSONString(vo));
|
|
|
+ String respone = "";
|
|
|
+ try {
|
|
|
+ respone = HttpUtils.postFormBody(SHARE_CANCLE_PATH, params);
|
|
|
+ OrderShareMoneyAddBo addBo = new OrderShareMoneyAddBo();
|
|
|
+ addBo.setOrderId(order.getOrderId());
|
|
|
+ addBo.setUserId(order.getUserId());
|
|
|
+ addBo.setStatus(0);
|
|
|
+ addBo.setPrice(refund_fee);
|
|
|
+ iOrderShareMoneyService.insertByAddBo(addBo);
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new CustomException("同步请求错误"+e.getMessage());
|
|
|
+ }
|
|
|
+ return true;
|
|
|
}
|
|
|
- return true;
|
|
|
}
|
|
|
}
|
|
|
return false;
|