| | |
| | | import com.jilongda.manage.model.TCoupon; |
| | | import com.jilongda.manage.model.TCouponReceive; |
| | | import com.jilongda.manage.model.TOptometryDetail; |
| | | import com.jilongda.manage.model.TOrder; |
| | | import com.jilongda.manage.query.TOptometryQuery; |
| | | import com.jilongda.manage.service.*; |
| | | import com.jilongda.manage.utils.LoginInfoUtil; |
| | | import com.jilongda.manage.vo.TOptometryVO; |
| | | import com.jilongda.manage.vo.TOrderVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private TCouponReceiveService couponReceiveService; |
| | | @Autowired |
| | | private TCouponService couponService; |
| | | @Autowired |
| | | private TOrderService orderService; |
| | | @Autowired |
| | | private TOptometryDetailService optometryDetailService; |
| | | |
| | | @ApiOperation(value = "查询用户信息") |
| | | @GetMapping(value = "/getUserById") |
| | |
| | | @PostMapping(value = "/addOrder") |
| | | public ApiResult addOrder(@RequestBody TOrderDTO dto) { |
| | | |
| | | // 查询店员 |
| | | SecUser user = secUserService.getById(dto.getSysId()); |
| | | if(Objects.nonNull(user)){ |
| | | dto.setStoreId(user.getStoreId()); |
| | | } |
| | | orderService.save(dto); |
| | | |
| | | List<TOptometryDetail> optometryDetails = dto.getOptometryDetails(); |
| | | if (!CollectionUtils.isEmpty(optometryDetails)){ |
| | | for (TOptometryDetail optometryDetail : optometryDetails) { |
| | | optometryDetail.setOrderId(dto.getId()); |
| | | } |
| | | optometryDetailService.saveBatch(optometryDetails); |
| | | } |
| | | |
| | | // TODO 周哥 补库存 |
| | | |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "销售订单详情") |
| | | @GetMapping(value = "/getOrderDetailById") |
| | | public ApiResult getOrderDetailById(@RequestParam Integer orderId) { |
| | | |
| | | TOrderVO orderVO = orderService.getOrderDetailById(orderId); |
| | | |
| | | // TODO 周哥 商品信息集合 |
| | | |
| | | // TODO 周哥 验光处方 判断是关联或者手动 |
| | | |
| | | |
| | | return ApiResult.success(orderVO); |
| | | } |
| | | |
| | | } |
| | | |