From a1c6665c90fe7292ed2ccb3f6b3dc2a213034e3d Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期一, 23 十二月 2024 15:02:11 +0800
Subject: [PATCH] 代码

---
 manage/src/main/java/com/jilongda/manage/service/impl/TLensGoodsServiceImpl.java |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/manage/src/main/java/com/jilongda/manage/service/impl/TLensGoodsServiceImpl.java b/manage/src/main/java/com/jilongda/manage/service/impl/TLensGoodsServiceImpl.java
index a790454..305da36 100644
--- a/manage/src/main/java/com/jilongda/manage/service/impl/TLensGoodsServiceImpl.java
+++ b/manage/src/main/java/com/jilongda/manage/service/impl/TLensGoodsServiceImpl.java
@@ -1,5 +1,7 @@
 package com.jilongda.manage.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.jilongda.common.basic.PageInfo;
 import com.jilongda.manage.mapper.SecSettingMapper;
@@ -42,6 +44,58 @@
             if (tFrameGoodsVO.getTotal() < secSetting.getLensThreshold()) {
                 tFrameGoodsVO.setIsWarning(1);
             }
+            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("sale"));
+                                tFrameGoodsVO.setCost(jsonObject.getString("cost"));
+                                break;
+                            }
+                        }
+                    }
+                    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("sale"));
+                                tFrameGoodsVO.setCost(jsonObject.getString("cost"));
+                                break;
+                            }
+                        }
+                    }
+                    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("sale"));
+                                tFrameGoodsVO.setCost(jsonObject.getString("cost"));
+                                break;
+                            }
+                        }
+                    }
+                    break;
+            }
+
+
         }
         pageInfo.setRecords(list);
         return pageInfo;

--
Gitblit v1.7.1