| | |
| | | import com.jilongda.manage.authority.model.SecUser; |
| | | import com.jilongda.manage.authority.service.SecUserService; |
| | | import com.jilongda.manage.dto.TOrderDTO; |
| | | 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.model.*; |
| | | import com.jilongda.manage.query.TOptometryQuery; |
| | | import com.jilongda.manage.service.*; |
| | | import com.jilongda.manage.utils.LoginInfoUtil; |
| | |
| | | private TOrderService orderService; |
| | | @Autowired |
| | | private TOptometryDetailService optometryDetailService; |
| | | |
| | | @Autowired |
| | | private TOrderGoodsService orderGoodsService; |
| | | @Autowired |
| | | private TFrameGoodsService frameGoodsService; |
| | | @Autowired |
| | | private TLensGoodsService lensGoodsService; |
| | | @ApiOperation(value = "查询用户信息") |
| | | @GetMapping(value = "/getUserById") |
| | | public ApiResult getUserById(@RequestParam Integer userId) { |
| | |
| | | |
| | | @ApiOperation(value = "查询优惠券") |
| | | @GetMapping(value = "/getCouponListByUserId") |
| | | public ApiResult<List<TCoupon>> getCouponListByUserId(@RequestParam Integer userId, @RequestParam Integer storeId) { |
| | | public ApiResult<List<TCouponReceive>> getCouponListByUserId(@RequestParam Integer userId, @RequestParam Integer storeId) { |
| | | List<TCouponReceive> list = couponReceiveService.list(Wrappers.lambdaQuery(TCouponReceive.class) |
| | | .eq(TCouponReceive::getUserId, userId) |
| | | .eq(TCouponReceive::getStatus, 1)); |
| | | List<TCouponReceive> tCouponReceives = new ArrayList<>(); |
| | | for (TCouponReceive tCouponReceive : list) { |
| | | TCoupon byId = couponService.getById(tCouponReceive.getCouponId()); |
| | | tCouponReceive.setCouponName(byId.getName()); |
| | | if (StringUtils.hasLength(tCouponReceive.getStoreId())){ |
| | | if (Arrays.asList(tCouponReceive.getStoreId().split(",")).contains(storeId+"")){ |
| | | tCouponReceives.add(tCouponReceive); |
| | |
| | | tCouponReceives.add(tCouponReceive); |
| | | } |
| | | } |
| | | List<Integer> collect = list.stream().map(TCouponReceive::getCouponId).collect(Collectors.toList()); |
| | | if (collect.isEmpty()){ |
| | | collect.add(-1); |
| | | } |
| | | List<TCoupon> list1 = couponService.lambdaQuery().in(TCoupon::getId, collect).list(); |
| | | return ApiResult.success(list1); |
| | | |
| | | return ApiResult.success(tCouponReceives); |
| | | } |
| | | |
| | | @ApiOperation(value = "添加订单") |
| | |
| | | dto.setStoreId(user.getStoreId()); |
| | | } |
| | | orderService.save(dto); |
| | | |
| | | List<TOptometryDetail> optometryDetails = dto.getOptometryDetails(); |
| | | if (!CollectionUtils.isEmpty(optometryDetails)){ |
| | | for (TOptometryDetail optometryDetail : optometryDetails) { |
| | |
| | | } |
| | | optometryDetailService.saveBatch(optometryDetails); |
| | | } |
| | | |
| | | List<TOrderGoods> orderGoods = dto.getOrderGoods(); |
| | | for (TOrderGoods orderGood : orderGoods) { |
| | | orderGood.setOrderId(dto.getId()); |
| | | } |
| | | // TODO 周哥 补库存 |
| | | |
| | | return ApiResult.success(); |