|
@@ -4,8 +4,11 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import com.zhongzheng.common.core.domain.model.LoginUser;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
+import com.zhongzheng.common.utils.SecurityUtils;
|
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
import com.zhongzheng.modules.grade.domain.ClassGradeUser;
|
|
@@ -263,7 +266,7 @@ public class OrderGoodsRefundServiceImpl extends ServiceImpl<OrderGoodsRefundMap
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- public Boolean refundCall(String WxpayRefundId,Long refundId,Long orderGoodsId,Order order,Long goodsType,Long gradeId,Long userId,Long goodsId){
|
|
|
+ public Boolean refundCall(String WxpayRefundId,Long refundId,Long orderGoodsId,Order order,Integer goodsType,Long gradeId,Long userId,Long goodsId){
|
|
|
OrderGoodsRefund update = new OrderGoodsRefund();
|
|
|
update.setRefundId(refundId);
|
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
@@ -347,4 +350,105 @@ public class OrderGoodsRefundServiceImpl extends ServiceImpl<OrderGoodsRefundMap
|
|
|
public List<OrderGoodsRefundVo> selectList(OrderGoodsRefundQueryBo bo) {
|
|
|
return baseMapper.selectList(bo);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean confirmPeriod(List<OrderGoodsRefundEditBo> bos) {
|
|
|
+ for(OrderGoodsRefundEditBo bo : bos){
|
|
|
+ if(Validator.isEmpty(bo.getPeriodStatus())||Validator.isEmpty(bo.getRefundId())){
|
|
|
+ throw new CustomException("参数不全");
|
|
|
+ }
|
|
|
+ if(bo.getPeriodStatus()!=2&&bo.getPeriodStatus()!=-2){
|
|
|
+ throw new CustomException("参数错误");
|
|
|
+ }
|
|
|
+ OrderGoodsRefund orderGoodsRefund = getOne(new LambdaQueryWrapper<OrderGoodsRefund>()
|
|
|
+ .eq(OrderGoodsRefund::getRefundId, bo.getRefundId())
|
|
|
+ .last("limit 1"));
|
|
|
+ if(Validator.isEmpty(orderGoodsRefund)||orderGoodsRefund.getPeriodStatus()!=1){
|
|
|
+ throw new CustomException("状态错误,无法操作");
|
|
|
+ }
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ //查询此人学时审核是否有权限
|
|
|
+ if(!loginUser.getUser().isAdmin()){
|
|
|
+ if (baseMapper.selectCountConfirmPeriod(loginUser.getUser().getUserId(),bo.getRefundId()) < 1){
|
|
|
+ throw new CustomException("您没有确认审核权限");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ LambdaUpdateWrapper<OrderGoodsRefund> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
|
|
+ objectLambdaUpdateWrapper.eq(OrderGoodsRefund::getRefundId, bo.getRefundId());
|
|
|
+
|
|
|
+ objectLambdaUpdateWrapper.set(OrderGoodsRefund::getPeriodStatus, bo.getPeriodStatus());
|
|
|
+ objectLambdaUpdateWrapper.set(OrderGoodsRefund::getUpdateTime,DateUtils.getNowTime());
|
|
|
+ objectLambdaUpdateWrapper.set(OrderGoodsRefund::getPeriodReviewTime,DateUtils.getNowTime());
|
|
|
+ objectLambdaUpdateWrapper.set(OrderGoodsRefund::getPeriodReviewReason, bo.getPeriodReviewReason());
|
|
|
+ objectLambdaUpdateWrapper.set(OrderGoodsRefund::getPeriodReviewUsername, SecurityUtils.getUsername());
|
|
|
+
|
|
|
+ this.update(null, objectLambdaUpdateWrapper);
|
|
|
+
|
|
|
+ if(bo.getPeriodStatus()==2){
|
|
|
+ //修改订单商品退款状态
|
|
|
+ OrderGoods orderGoodsUpdate = new OrderGoods();
|
|
|
+ orderGoodsUpdate.setOrderGoodsId(orderGoodsRefund.getOrderGoodsId());
|
|
|
+ orderGoodsUpdate.setRefundStatus(2); //同意退款
|
|
|
+ orderGoodsUpdate.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iOrderGoodsService.updateById(orderGoodsUpdate);
|
|
|
+ }
|
|
|
+ if(bo.getPeriodStatus()==-2){
|
|
|
+ //修改订单商品退款状态
|
|
|
+ OrderGoods orderGoodsUpdate = new OrderGoods();
|
|
|
+ orderGoodsUpdate.setOrderGoodsId(orderGoodsRefund.getOrderGoodsId());
|
|
|
+ orderGoodsUpdate.setRefundStatus(3); //拒绝退款
|
|
|
+ orderGoodsUpdate.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iOrderGoodsService.updateById(orderGoodsUpdate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean firstPeriod(List<OrderGoodsRefundEditBo> bos) {
|
|
|
+ for(OrderGoodsRefundEditBo bo : bos){
|
|
|
+ if(Validator.isEmpty(bo.getPeriodStatus())||Validator.isEmpty(bo.getRefundId())){
|
|
|
+ throw new CustomException("参数不全");
|
|
|
+ }
|
|
|
+ if(bo.getPeriodStatus()!=1&&bo.getPeriodStatus()!=-1){
|
|
|
+ throw new CustomException("参数错误");
|
|
|
+ }
|
|
|
+ OrderGoodsRefund orderGoodsRefund = getOne(new LambdaQueryWrapper<OrderGoodsRefund>()
|
|
|
+ .eq(OrderGoodsRefund::getRefundId, bo.getRefundId())
|
|
|
+ .last("limit 1"));
|
|
|
+ if(Validator.isEmpty(orderGoodsRefund)||orderGoodsRefund.getPeriodStatus()!=0){
|
|
|
+ throw new CustomException("非待审核状态无法操作");
|
|
|
+ }
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ //查询此人学时审核是否有权限
|
|
|
+ if(!loginUser.getUser().isAdmin()){
|
|
|
+ if (baseMapper.selectCountFirstPeriod(loginUser.getUser().getUserId(),bo.getRefundId()) < 1){
|
|
|
+ throw new CustomException("您没有确认审核权限");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ LambdaUpdateWrapper<OrderGoodsRefund> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
|
|
+ objectLambdaUpdateWrapper.eq(OrderGoodsRefund::getRefundId, bo.getRefundId());
|
|
|
+
|
|
|
+ objectLambdaUpdateWrapper.set(OrderGoodsRefund::getPeriodStatus, bo.getPeriodStatus());
|
|
|
+ objectLambdaUpdateWrapper.set(OrderGoodsRefund::getUpdateTime,DateUtils.getNowTime());
|
|
|
+ objectLambdaUpdateWrapper.set(OrderGoodsRefund::getPeriodTime,DateUtils.getNowTime());
|
|
|
+ objectLambdaUpdateWrapper.set(OrderGoodsRefund::getPeriodReason, bo.getPeriodReason());
|
|
|
+ objectLambdaUpdateWrapper.set(OrderGoodsRefund::getPeriodUsername, SecurityUtils.getUsername());
|
|
|
+
|
|
|
+ this.update(null, objectLambdaUpdateWrapper);
|
|
|
+
|
|
|
+ if(bo.getPeriodStatus()==-1){
|
|
|
+ //修改订单商品退款状态
|
|
|
+ OrderGoods orderGoodsUpdate = new OrderGoods();
|
|
|
+ orderGoodsUpdate.setOrderGoodsId(orderGoodsRefund.getOrderGoodsId());
|
|
|
+ orderGoodsUpdate.setRefundStatus(3); //拒绝退款
|
|
|
+ orderGoodsUpdate.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iOrderGoodsService.updateById(orderGoodsUpdate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|