| | |
| | | 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.common.utils.TimeUtils; |
| | | 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.BeanUtils; |
| | | 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.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @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 = "订单售后列表") |
| | | @PostMapping(value = "/pageList") |
| | | public ApiResult<PageInfo<TOrderAftersalesVO>> pageList(@RequestBody TOrderAftersalesQuery query) { |
| | | if (StringUtils.hasLength(query.getStartTime())){ |
| | | query.setStartTime(query.getStartTime()+" 00:00:00"); |
| | | query.setEndTime(query.getEndTime()+" 23:59:59"); |
| | | } |
| | | PageInfo<TOrderAftersalesVO> orderAftersalesVOPageInfo = orderAftersalesService.pageList(query); |
| | | return ApiResult.success(orderAftersalesVOPageInfo); |
| | | } |
| | |
| | | @ApiOperation(value = "订单售后添加") |
| | | @PostMapping(value = "/add") |
| | | public ApiResult<String> add(@RequestBody TOrderAftersales dto) { |
| | | List<TOrderAftersales> list = orderAftersalesService.lambdaQuery() |
| | | .eq(TOrderAftersales::getOrderId, dto.getOrderId()).list(); |
| | | if (!list.isEmpty()){ |
| | | return ApiResult.failed("该订单已售后,不可再次操作!"); |
| | | } |
| | | dto.setCode(WarehousingConstant.ASTER_SALES+ CodeGenerateUtils.generateVolumeSn()); |
| | | orderAftersalesService.save(dto); |
| | | return ApiResult.success(); |
| | | } |
| | | @ApiOperation(value = "订单售后详情") |
| | | @GetMapping(value = "/detail") |
| | | public ApiResult<TOrderAftersalesDetailVO> detail(Integer id) { |
| | | TOrderAftersales orderAftersales = orderAftersalesService.getById(id); |
| | | TOrder order = orderService.getById(orderAftersales.getOrderId()); |
| | | TStore store = tStoreService.getById(order.getStoreId()); |
| | | SecUser sysUser = secUserService.getById(orderAftersales.getSysId()); |
| | | TOptometrist optometrist = tOptometristService.getById(orderAftersales.getOptometristId()); |
| | | TOrderAftersalesDetailVO res = new TOrderAftersalesDetailVO(); |
| | | BeanUtils.copyProperties(orderAftersales,res); |
| | | res.setOrderId(order.getId()); |
| | | if (order.getUserId()!=null){ |
| | | TAppUser byId4 = appUserService.getById(order.getUserId()); |
| | | if (byId4!=null){ |
| | | res.setPhone(byId4.getPhone()); |
| | | res.setName(byId4.getName()); |
| | | res.setRealName(byId4.getRealName()); |
| | | } |
| | | }else{ |
| | | res.setPhone(order.getPhone()); |
| | | res.setRealName(order.getRealName()); |
| | | } |
| | | res.setStoreName(store.getName()); |
| | | if (optometrist!=null){ |
| | | res.setOptometristName(optometrist.getName()); |
| | | } |
| | | if (sysUser!=null){ |
| | | res.setSalesUser(sysUser.getNickName()); |
| | | } |
| | | res.setOrderTime(TimeUtils.localDateTimeToString(order.getCreateTime())); |
| | | res.setAfterSalesTime(TimeUtils.localDateTimeToString(orderAftersales.getCreateTime())); |
| | | List<TOrderGoods> list = goodsService.lambdaQuery().eq(TOrderGoods::getOrderId, order.getId()).list(); |
| | | res.setGoodsList(list); |
| | | res.setOrderMoney(order.getOrderMoney()); |
| | | res.setCouponMoney(order.getCouponMoney()); |
| | | res.setPayMoney(order.getPayMoney()); |
| | | return ApiResult.success(res); |
| | | } |
| | | |
| | | |
| | | } |