| | |
| | | import com.jilongda.manage.query.TOrderQuery; |
| | | import com.jilongda.manage.service.*; |
| | | import com.jilongda.manage.utils.LoginInfoUtil; |
| | | import com.jilongda.manage.utils.OssUploadUtil; |
| | | import com.jilongda.manage.vo.TModelVO; |
| | | import com.jilongda.manage.vo.TOptometryVO; |
| | | import com.jilongda.manage.vo.TOrderListVO; |
| | |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | |
| | | private TBrandService brandService; |
| | | @Autowired |
| | | private TOptometryService optometryService; |
| | | @PostMapping("/obs-upload") |
| | | @ApiOperation(value = "文件上传",tags = "管理后台-文件上传") |
| | | public ApiResult<String> uploadOSS(@RequestPart("file") MultipartFile file) { |
| | | try { |
| | | // 上传并返回访问地址 |
| | | String fileName = file.getOriginalFilename(); |
| | | String prefix = fileName.substring(fileName.lastIndexOf(".")); |
| | | long fileSize = file.getSize(); |
| | | String url = OssUploadUtil.ossUpload("eyes/",file); |
| | | return ApiResult.success(url); |
| | | } catch (Exception e) { |
| | | System.err.println("上传文件失败"+e); |
| | | return ApiResult.failed(e.getMessage()); |
| | | } |
| | | } |
| | | @ApiOperation(value = "销售订单分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public ApiResult<PageInfo<TOrderListVO>> pageList(@RequestBody TOrderQuery query) { |
| | |
| | | if(Objects.nonNull(user)){ |
| | | dto.setStoreId(user.getStoreId()); |
| | | } |
| | | |
| | | if (dto.getUserId()!=null){ |
| | | TAppUser byId = tAppUserService.getById(dto.getUserId()); |
| | | dto.setName(byId.getName()); |
| | | dto.setPhone(byId.getPhone()); |
| | | } |
| | | orderService.save(dto); |
| | | |
| | | List<TOptometryDetail> optometryDetails = dto.getOptometryDetails(); |
| | |
| | | orderGood.setOrderId(dto.getId()); |
| | | if (StringUtils.hasLength(orderGood.getSeriesName())){ |
| | | // 镜片 |
| | | orderGood.setRLens(orderGood.getRightLens()); |
| | | orderGood.setLLens(orderGood.getLeftLens()); |
| | | String rLens = orderGood.getRLens(); |
| | | String[] split = rLens.split(","); |
| | | String[] split = null; |
| | | if(StringUtils.hasLength(rLens)){ |
| | | split = rLens.split(","); |
| | | }else { |
| | | split = orderGood.getLLens().split(","); |
| | | } |
| | | TBrand one1 = brandService.lambdaQuery().eq(TBrand::getName, orderGood.getBrandName()) |
| | | .eq(TBrand::getType, 2).one(); |
| | | TLensSeries one2 = lensSeriesService.lambdaQuery().eq(TLensSeries::getName, orderGood.getSeriesName()) |
| | |
| | | orderGoodsService.saveBatch(orderGoods); |
| | | lensGoodsService.updateBatchById(tLensGoods); |
| | | frameGoodsService.updateBatchById(tFrameGoods); |
| | | return ApiResult.success(); |
| | | return ApiResult.success(dto.getId()); |
| | | } |
| | | |
| | | @ApiOperation(value = "销售订单详情") |