common/src/main/java/com/jilongda/common/Ticket/TicketUtil.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
manage/src/main/java/com/jilongda/manage/controller/TLensSeriesController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
manage/src/main/java/com/jilongda/manage/controller/TOrderController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
manage/src/main/java/com/jilongda/manage/dto/TAddWarehousingLensDTO.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
manage/src/main/java/com/jilongda/manage/dto/TLensWarehousingDetailDTO.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
manage/src/main/java/com/jilongda/manage/dto/TWarehousingLensDTO.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
manage/src/main/java/com/jilongda/manage/service/impl/TLensGoodsServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
manage/src/main/resources/mapping/TLensGoods.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
common/src/main/java/com/jilongda/common/Ticket/TicketUtil.java
@@ -572,7 +572,7 @@ continue; } if (tOrderGoodsPrintVO.getModelId()!=null){ if (tOrderGoodsPrintVO.getLLens()!=null){ content.append("左眼镜片:").append(tOrderGoodsPrintVO.getBrandName()==null?" "+"-":tOrderGoodsPrintVO.getBrandName()+"-").append(tOrderGoodsPrintVO.getSeriesName()==null?" "+"-":tOrderGoodsPrintVO.getSeriesName()+"-").append(tOrderGoodsPrintVO.getRefractiveIndex()==null?" "+"-":tOrderGoodsPrintVO.getRefractiveIndex()).append("<BR>"); continue; } manage/src/main/java/com/jilongda/manage/controller/TLensSeriesController.java
@@ -6,11 +6,16 @@ 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; @@ -22,6 +27,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; /** * <p> @@ -37,6 +43,10 @@ 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) { @@ -47,8 +57,51 @@ @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") @@ -82,6 +135,18 @@ 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) { manage/src/main/java/com/jilongda/manage/controller/TOrderController.java
@@ -235,7 +235,13 @@ .one(); if (one!=null){ if (one.getTotal()-1<0 && lensSeries.getType()==1 ){ return ApiResult.failed("库存不足"); if (StringUtils.hasLength(orderGood.getRightLens())){ orderService.removeById(dto); return ApiResult.failed("镜片(R)库存不足,请重新选择"); }else{ orderService.removeById(dto); return ApiResult.failed("镜片(L)库存不足,请重新选择"); } } // 减少对应库存 one.setTotal(one.getTotal()-1); @@ -274,6 +280,7 @@ lensWarehousingDetailService.save(tLensWarehousingDetail); }else { orderService.removeById(dto); return ApiResult.failed("商品库存不足"); } }else{ @@ -286,7 +293,8 @@ .eq(TFrameGoods::getColor, orderGood.getColor()).one(); if (one!=null){ if (one.getTotal()-1<0){ return ApiResult.failed("库存不足"); orderService.removeById(dto); return ApiResult.failed("镜架库存不足,请重新选择"); } // 增加对应库存 one.setTotal(one.getTotal()-1); @@ -323,7 +331,8 @@ frameWarehousingDetailService.save(tFrameWarehousingDetail); }else{ return ApiResult.failed("商品库存不足"); orderService.removeById(dto); return ApiResult.failed("镜架库存不足,请重新选择"); } } } @@ -331,13 +340,17 @@ if (dto.getCouponId()!=null){ TCouponReceive couponReceive = couponReceiveService.getById(dto.getCouponId()); if (couponReceive==null){ orderService.removeById(dto); return ApiResult.failed("优惠券不存在"); } List<TCouponReceive> couponReceives = couponReceiveService.lambdaQuery() .eq(TCouponReceive::getUserId, dto.getUserId()) .eq(TCouponReceive::getCouponId, couponReceive.getCouponId()) .orderByDesc(TCouponReceive::getCreateTime).list(); if (couponReceives.isEmpty())return ApiResult.failed("优惠券不存在"); if (couponReceives.isEmpty()){ orderService.removeById(dto); return ApiResult.failed("优惠券不存在"); } TCouponReceive tCouponReceive = couponReceives.get(0); tCouponReceive.setStatus(2); tCouponReceive.setUseTime(LocalDateTime.now()); @@ -377,16 +390,16 @@ frameGoodsService.updateBatchById(tFrameGoods); TAddOptometryVO tAddOptometryVO = new TAddOptometryVO(); TTicket tTicket = tTicketService.lambdaQuery().eq(TTicket::getStoreId, dto.getStoreId()) .eq(TTicket::getType,1) .eq(TTicket::getType,2) .eq(TTicket::getStatus, 1).list().stream().findFirst().orElse(null); if (tTicket==null){ orderService.removeById(dto); return ApiResult.failed("当前门店未绑定小票机"); } tAddOptometryVO.setSn(tTicket.getCloudId()+""); tAddOptometryVO.setPhone(dto.getPhone()); List<TOrderGoods> orderGoods1 = dto.getOrderGoods(); ArrayList<TOrderGoodsPrintVO> tOrderGoodsPrintVOS = new ArrayList<>(); // 复制 for (TOrderGoods orderGood : orderGoods1) { TOrderGoodsPrintVO tOrderGoodsPrintVO = new TOrderGoodsPrintVO(); BeanUtils.copyProperties(orderGood,tOrderGoodsPrintVO); manage/src/main/java/com/jilongda/manage/dto/TAddWarehousingLensDTO.java
New file @@ -0,0 +1,22 @@ package com.jilongda.manage.dto; import com.baomidou.mybatisplus.annotation.TableField; import com.jilongda.manage.model.TLensWarehousingDetail; import com.jilongda.manage.model.TWarehousing; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; @Data @ApiModel(value = "镜片生成库存11DTO") public class TAddWarehousingLensDTO { @ApiModelProperty(value = "门店id") private Integer storeId; @ApiModelProperty(value = "备注") private String remark; @ApiModelProperty(value = "镜片明细列表") private List<TLensWarehousingDetailDTO> lensWarehousingDetails; } manage/src/main/java/com/jilongda/manage/dto/TLensWarehousingDetailDTO.java
New file @@ -0,0 +1,43 @@ package com.jilongda.manage.dto; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.jilongda.common.pojo.BaseModel; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; /** * <p> * 镜片出库入库明细表 * </p> * * @author 无关风月 * @since 2024-12-09 */ @Data @ApiModel(value="TLensWarehousingDetailDTO对象", description="镜片系列生成库存111DTO") public class TLensWarehousingDetailDTO { @ApiModelProperty(value = "品牌名称") private String brand; @ApiModelProperty(value = "供应商名称") private String supplier; @ApiModelProperty(value = "系列名称") private String series; @ApiModelProperty(value = "折射率") private String refractiveIndex; @ApiModelProperty(value = "1球面 2非球面 3双非") private Integer type; @ApiModelProperty(value = "系列id") private Integer seriesId; } manage/src/main/java/com/jilongda/manage/dto/TWarehousingLensDTO.java
@@ -1,5 +1,6 @@ package com.jilongda.manage.dto; import com.baomidou.mybatisplus.annotation.TableField; import com.jilongda.manage.model.TFrameWarehousingDetail; import com.jilongda.manage.model.TLensWarehousingDetail; import com.jilongda.manage.model.TWarehousing; manage/src/main/java/com/jilongda/manage/service/impl/TLensGoodsServiceImpl.java
@@ -19,7 +19,10 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * <p> @@ -35,6 +38,7 @@ @Resource private SecSettingMapper secSettingMapper; private Map<String, Map<String, JSONObject>> cachedSphereMaps = new ConcurrentHashMap<>(); @Override public PageInfo<TLensGoodsVO> lensReceiptList(TLensGoodsQuery query) { PageInfo<TLensGoodsVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); @@ -44,60 +48,43 @@ if (tFrameGoodsVO.getTotal() < secSetting.getLensThreshold()) { tFrameGoodsVO.setIsWarning(1); } switch (tFrameGoodsVO.getLensType()){ String sphere = null; switch (tFrameGoodsVO.getLensType()) { case 1: String sphere = tFrameGoodsVO.getSphere(); if (sphere.contains("cost")){ JSONArray objects = JSONObject.parseArray(sphere); // 遍历这个数组 for (Object object : objects) { JSONObject jsonObject = (JSONObject) object; String cost = jsonObject.getString("refractiveIndex"); if (tFrameGoodsVO.getRefractiveIndex().equals(cost)){ tFrameGoodsVO.setSale(jsonObject.getString("sales")); tFrameGoodsVO.setCost(jsonObject.getString("cost")); break; } } } sphere = tFrameGoodsVO.getSphere(); break; case 2: String sphere1 = tFrameGoodsVO.getAsphericSurface(); if (sphere1.contains("cost")){ JSONArray objects = JSONObject.parseArray(sphere1); // 遍历这个数组 for (Object object : objects) { JSONObject jsonObject = (JSONObject) object; String cost = jsonObject.getString("refractiveIndex"); if (tFrameGoodsVO.getRefractiveIndex().equals(cost)){ tFrameGoodsVO.setSale(jsonObject.getString("sales")); tFrameGoodsVO.setCost(jsonObject.getString("cost")); break; } } } sphere = tFrameGoodsVO.getAsphericSurface(); break; case 3: String sphere2 = tFrameGoodsVO.getDoubleNon(); if (sphere2.contains("cost")){ JSONArray objects = JSONObject.parseArray(sphere2); // 遍历这个数组 for (Object object : objects) { JSONObject jsonObject = (JSONObject) object; String cost = jsonObject.getString("refractiveIndex"); if (tFrameGoodsVO.getRefractiveIndex().equals(cost)){ tFrameGoodsVO.setSale(jsonObject.getString("sales")); tFrameGoodsVO.setCost(jsonObject.getString("cost")); break; } } } sphere = tFrameGoodsVO.getDoubleNon(); break; } if (sphere != null && sphere.contains("cost")) { updateSaleAndCost(tFrameGoodsVO, sphere); } } pageInfo.setRecords(list); return pageInfo; } private void updateSaleAndCost(TLensGoodsVO tFrameGoodsVO, String sphere) { Map<String, JSONObject> costMap = cachedSphereMaps.get(sphere); if (costMap == null) { costMap = new HashMap<>(); JSONArray objects = JSONObject.parseArray(sphere); for (Object object : objects) { JSONObject jsonObject = (JSONObject) object; costMap.put(jsonObject.getString("refractiveIndex"), jsonObject); } cachedSphereMaps.put(sphere, costMap); } JSONObject matchingObject = costMap.get(tFrameGoodsVO.getRefractiveIndex()); if (matchingObject != null) { tFrameGoodsVO.setSale(matchingObject.getString("sales")); tFrameGoodsVO.setCost(matchingObject.getString("cost")); } } } manage/src/main/resources/mapping/TLensGoods.xml
@@ -4,28 +4,28 @@ <select id="lensReceiptList" resultType="com.jilongda.manage.vo.TLensGoodsVO"> select t1.seriesId, t1.createTime, t1.updateTime, t1.createBy, t1.updateBy, t1.isDelete, select o.* from (select t1.seriesId, t1.id, t1.storeId, t1.ballMirror, t1.columnMirror, t1.refractiveIndex, t1.`status`, t1.lensType,t2.name as series,t4.name as storeName, t2.sphere as sphere,t2.asphericSurface as asphericSurface,t2.type as type ,t2.doubleNon as doubleNon ,t6.name as brand,t7.frameThreshold, sum(t1.total) as total t1.lensType, t2.name as series, t4.name as storeName, t2.sphere as sphere, t2.asphericSurface as asphericSurface, t2.type as type, t2.doubleNon as doubleNon, t6.name as brand,t7.frameThreshold, sum(t1.total) as total from t_lens_goods t1 left join t_lens_series t2 on t1.seriesId=t2.id left join t_store t4 on t1.storeId = t4.id left join t_brand t6 on t2.brandId=t6.id left join sec_setting t7 on 1=1 inner join t_lens_series t2 on t1.seriesId=t2.id inner join t_store t4 on t1.storeId = t4.id inner join t_brand t6 on t2.brandId=t6.id inner join sec_setting t7 on 1=1 <where> <if test="query.brandId != null "> and t2.brandId = #{query.brandId} @@ -45,18 +45,21 @@ <if test="query.type != null "> and t2.type = #{query.type} </if> <if test="query.isWarning !=null and query.isWarning==1"> and t1.total <= t7.lensThreshold </if> <if test="query.isWarning !=null and query.isWarning ==2"> and t1.total >= t7.lensThreshold </if> and t1.isDelete = 0 and t1.isDelete = 0 </where> group by seriesId, refractiveIndex, lensType order by t1.id order by t1.id) o where 1=1 <if test="query.isWarning !=null and query.isWarning==1"> and o.total <= t7.lensThreshold </if> <if test="query.isWarning !=null and query.isWarning ==2"> and o.total >= t7.lensThreshold </if> </select> </mapper>