| | |
| | | import com.google.gson.JsonArray; |
| | | import com.jilongda.common.basic.ApiResult; |
| | | import com.jilongda.common.basic.PageInfo; |
| | | import com.jilongda.manage.model.TLensSeries; |
| | | import com.jilongda.manage.model.TOptometrist; |
| | | import com.jilongda.manage.dto.TAddWarehousingLensDTO; |
| | | import com.jilongda.manage.dto.TLensWarehousingDetailDTO; |
| | | import com.jilongda.manage.dto.TWarehousingLensDTO; |
| | | import com.jilongda.manage.model.*; |
| | | import com.jilongda.manage.query.TLensSeriesQuery; |
| | | import com.jilongda.manage.query.TOptometristQuery; |
| | | import com.jilongda.manage.service.TLensGoodsService; |
| | | import com.jilongda.manage.service.TLensSeriesService; |
| | | import com.jilongda.manage.service.TLensWarehousingDetailService; |
| | | import com.jilongda.manage.service.TWarehousingService; |
| | | import com.jilongda.manage.vo.TLensSeriesVO; |
| | | import com.jilongda.manage.vo.TOptometristVO; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public class TLensSeriesController { |
| | | @Autowired |
| | | private TLensSeriesService lensSeriesService; |
| | | @Autowired |
| | | private TWarehousingService warehousingService; |
| | | @Autowired |
| | | private TLensWarehousingDetailService lensWarehousingDetailService; |
| | | @ApiOperation(value = "镜片系列列表") |
| | | @PostMapping(value = "/pageList") |
| | | public ApiResult<PageInfo<TLensSeriesVO>> pageList(@RequestBody TLensSeriesQuery query) { |
| | |
| | | @PostMapping(value = "/add") |
| | | public ApiResult<String> add(@RequestBody TLensSeries dto) { |
| | | lensSeriesService.save(dto); |
| | | // 生成库存 |
| | | return ApiResult.success(); |
| | | } |
| | | @Autowired |
| | | private TLensGoodsService lensGoodsService; |
| | | @ApiOperation(value = "镜片系列生成库存") |
| | | @PostMapping(value = "/addGoods") |
| | | public ApiResult<String> addGoods(@RequestBody TAddWarehousingLensDTO dto) { |
| | | List<TLensGoods> list = lensGoodsService.lambdaQuery().list(); |
| | | List<TLensWarehousingDetailDTO> tLensWarehousingDetail = dto.getLensWarehousingDetails(); |
| | | List<TLensSeries> lensSeries = lensSeriesService.list(); |
| | | List<TLensGoods> tLensGoods = new ArrayList<>(); |
| | | for (TLensWarehousingDetailDTO frameWarehousingDetail : tLensWarehousingDetail) { |
| | | TLensSeries series = lensSeries.stream().filter(e -> e.getId().equals(frameWarehousingDetail.getSeriesId())).findFirst().orElse(null); |
| | | if (series!=null){ |
| | | double endBallCondition =0.00; |
| | | double endColumnCondition =0.00; |
| | | TLensGoods tLensGoods1 = list.stream().filter(e -> e.getSeriesId().equals(frameWarehousingDetail.getSeriesId()) && |
| | | e.getRefractiveIndex().equals(frameWarehousingDetail.getRefractiveIndex()) |
| | | && e.getLensType().equals(frameWarehousingDetail.getType()) |
| | | && e.getBallMirror().equals(endBallCondition+"") |
| | | && e.getColumnMirror().equals(endColumnCondition+"")).findFirst().orElse(null); |
| | | if (tLensGoods1==null){ |
| | | // 新增 |
| | | TLensGoods tFrameGoods = new TLensGoods(); |
| | | tFrameGoods.setStatus(1); |
| | | tFrameGoods.setLensType(frameWarehousingDetail.getType()); |
| | | tFrameGoods.setSeriesId(frameWarehousingDetail.getSeriesId()); |
| | | tFrameGoods.setBallMirror(String.format("%.2f",endBallCondition)); |
| | | tFrameGoods.setColumnMirror(String.format("%.2f",endColumnCondition)); |
| | | tFrameGoods.setRefractiveIndex(frameWarehousingDetail.getRefractiveIndex()); |
| | | tFrameGoods.setTotal(0); |
| | | tFrameGoods.setStoreId(dto.getStoreId()); |
| | | tLensGoods.add(tFrameGoods); |
| | | } |
| | | } |
| | | } |
| | | lensGoodsService.saveBatch(tLensGoods); |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | double temp = -0.25; |
| | | System.err.println(temp-0.25); |
| | | |
| | | System.err.println(String.format("%.2f",temp-0.25)); |
| | | } |
| | | @ApiOperation(value = "镜片系列编辑") |
| | | @PostMapping(value = "/update") |
| | |
| | | public ApiResult<List<TLensSeries>> seriesList(Integer brandId) { |
| | | return ApiResult.success(lensSeriesService.lambdaQuery().eq(TLensSeries::getBrandId,brandId).list()); |
| | | } |
| | | @ApiOperation(value = "通过品牌id查询镜片系列列表-添加销售订单用 过滤没有生成库存的系列") |
| | | @GetMapping(value = "/seriesListOrder") |
| | | public ApiResult<List<TLensSeries>> seriesListOrder(Integer brandId) { |
| | | List<TLensGoods> list = lensGoodsService.lambdaQuery().list(); |
| | | List<Integer> collect = list.stream().map(TLensGoods::getSeriesId).distinct().collect(Collectors.toList()); |
| | | if (list.isEmpty()){ |
| | | return ApiResult.success(new ArrayList<TLensSeries>()); |
| | | } |
| | | List<TLensSeries> lensSeries = lensSeriesService.lambdaQuery().eq(TLensSeries::getBrandId, brandId) |
| | | .in(TLensSeries::getId,collect).list(); |
| | | return ApiResult.success(lensSeries); |
| | | } |
| | | @ApiOperation(value = "通过系列id查询球/非球 返回参数1为球 2非球 3双飞") |
| | | @GetMapping(value = "/lensTypeList") |
| | | public ApiResult<List<Integer>> lensTypeList(Integer id) { |