无关风月
2024-12-27 d0ea9b3c5897a99875de5ea18ab6cfbca6b4a5b2
manage/src/main/java/com/jilongda/manage/controller/TOrderAftersalesController.java
@@ -5,21 +5,22 @@
import com.jilongda.common.basic.PageInfo;
import com.jilongda.common.constants.WarehousingConstant;
import com.jilongda.common.utils.CodeGenerateUtils;
import com.jilongda.manage.model.TOptometrist;
import com.jilongda.manage.model.TOrderAftersales;
import com.jilongda.manage.authority.model.SecUser;
import com.jilongda.manage.authority.service.SecUserService;
import com.jilongda.manage.model.*;
import com.jilongda.manage.query.TOptometristQuery;
import com.jilongda.manage.query.TOrderAftersalesQuery;
import com.jilongda.manage.service.TOrderAftersalesService;
import com.jilongda.manage.service.*;
import com.jilongda.manage.vo.TOptometristVO;
import com.jilongda.manage.vo.TOrderAftersalesDetailVO;
import com.jilongda.manage.vo.TOrderAftersalesVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.*;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.List;
/**
 * <p>
@@ -37,6 +38,18 @@
    @Autowired
    private TOrderAftersalesService orderAftersalesService;
    @Autowired
    private TOrderService orderService;
    @Autowired
    private SecUserService secUserService;
    @Autowired
    private TStoreService tStoreService;
    @Autowired
    private TAppUserService appUserService;
    @Autowired
    private TOptometristService tOptometristService;
    @Autowired
    private TOrderGoodsService goodsService;
    @ApiOperation(value = "订单售后列表")
@@ -53,6 +66,36 @@
        orderAftersalesService.save(dto);
        return ApiResult.success();
    }
    @ApiOperation(value = "订单售后详情")
    @GetMapping(value = "/detail")
    public ApiResult<TOrderAftersalesDetailVO> detail(Integer id) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd");
        TOrderAftersales byId = orderAftersalesService.getById(id);
        TOrder byId1 = orderService.getById(byId.getOrderId());
        TStore byId2 = tStoreService.getById(byId1.getStoreId());
        SecUser byId3 = secUserService.getById(byId.getSysId());
        TOptometrist byId5 = tOptometristService.getById(byId.getOptometristId());
        TOrderAftersalesDetailVO res = new TOrderAftersalesDetailVO();
        res.setOrderId(byId1.getId());
        if (byId1.getUserId()!=null){
            TAppUser byId4 = appUserService.getById(byId1);
            if (byId4!=null){
                res.setPhone(byId4.getPhone());
            }
        }
        res.setStoreName(byId2.getName());
        res.setOptometristName(byId5.getName());
        res.setSalesUser(byId3.getNickName());
        res.setOrderTime(simpleDateFormat.format(byId1.getCreateTime()));
        res.setAfterSalesTime(simpleDateFormat1.format(byId.getCreateTime()));
        List<TOrderGoods> list = goodsService.lambdaQuery().eq(TOrderGoods::getOrderId, byId1.getId()).list();
        res.setGoodsList(list);
        res.setOrderMoney(byId1.getOrderMoney());
        res.setCouponMoney(byId1.getCouponMoney());
        res.setPayMoney(byId1.getPayMoney());
        return ApiResult.success(res);
    }
}