Browse Source

修改智能选址

zhao 6 months ago
parent
commit
9de059861a

+ 10 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/controller/SellBuildController.java

@@ -8,6 +8,7 @@ import com.example.nngkxxdp.util.BaseResult;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.HashMap;
 import java.util.List;
 
 @RestController
@@ -60,4 +61,13 @@ public class SellBuildController {
         return sellBuildService.queryPageByAddr(query);
     }
 
+    //智能选址下一步  最新一版
+    @PostMapping("/newQueryOne")
+    public BaseResult newQueryOne(@RequestBody SellBuildQuery query){
+        HashMap<Object, Object> map = sellBuildService.newQueryOne(query);
+        return BaseResult.ok(map);
+    }
+
+
+
 }

+ 3 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/dao/SellBuildDao.java

@@ -33,6 +33,9 @@ public interface SellBuildDao {
     Integer queryCountByAddr(SellBuildQuery query);
 
     List<SellBuild> queryDataByAddr(SellBuildQuery query);
+
+    List<SellBuild> findByProductModule(SellBuildQuery query);
+
 }
 
 

+ 4 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/service/SellBuildService.java

@@ -4,6 +4,7 @@ import com.example.nngkxxdp.entity.SellBuild;
 import com.example.nngkxxdp.query.SellBuildQuery;
 import com.example.nngkxxdp.query.pageResult;
 
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -30,4 +31,7 @@ public interface SellBuildService {
     pageResult<SellBuild>queryPage(SellBuildQuery query);
 
     pageResult<SellBuild> queryPageByAddr(SellBuildQuery query);
+
+    HashMap<Object,Object> newQueryOne(SellBuildQuery query);
+
 }

+ 2 - 2
nngkxxdp/src/main/java/com/example/nngkxxdp/service/impl/ProxyDemandServiceImpl.java

@@ -43,7 +43,7 @@ public class ProxyDemandServiceImpl implements ProxyDemandService {
     public BaseResult insert(ProxyVerifyDTO proxyVerifyDTO) {
         int handleTotal = this.findTotalByTime(new Date());
         if(handleTotal>=10){
-            throw new BusinessException("预约已满,请下周再提交!");
+            throw new BusinessException("申请失败,预约已满!");
         }
         Object o = redisTemplate.opsForValue().get(proxyVerifyDTO.getImgKey());
         if(o==null){
@@ -87,7 +87,7 @@ public class ProxyDemandServiceImpl implements ProxyDemandService {
         if(i<=9){
             return null;
         }else {
-            throw new BusinessException("预约已满,请下周再提交");
+            throw new BusinessException("申请失败,预约已满!");
         }
 
     }

+ 47 - 4
nngkxxdp/src/main/java/com/example/nngkxxdp/service/impl/SellBuildServiceImpl.java

@@ -9,10 +9,7 @@ import com.example.nngkxxdp.service.SellBuildService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -119,6 +116,52 @@ public class SellBuildServiceImpl implements SellBuildService{
         List<SellBuild> list = sellBuildDao.queryDataByAddr(query);
         return new pageResult<>(totals,list);
     }
+
+    @Override
+    public HashMap<Object, Object> newQueryOne(SellBuildQuery query) {
+        HashMap<Object, Object> map = new HashMap<>();
+        HashSet<Object> applicationlist = new HashSet<>();
+        HashSet<Object> parkNames = new HashSet<>();
+        //分割application
+        String applicationsStr  = query.getApplication();
+        if (applicationsStr != null && !applicationsStr.isEmpty()) {
+            String[] applications = applicationsStr.split(",");
+            List<String> applicationList = new ArrayList<>(Arrays.asList(applications));
+            query.setApplications(applicationList);
+        }
+        //分割多个园区
+        String parkIdsStr = query.getBelong();
+        if (parkIdsStr != null && !parkIdsStr.isEmpty()) {
+            String[] belongs = parkIdsStr.split(",");
+            List<String> belongList = new ArrayList<>(Arrays.asList(belongs));
+            query.setBelongs(belongList.stream().map(Long::valueOf).collect(Collectors.toList()));
+        }
+        //分割productModule}
+        String productModuleStr = query.getProductModule();
+        if (productModuleStr != null && !productModuleStr.isEmpty()) {
+            String[] productModules = productModuleStr.split(",");
+            List<String> productModuleList = new ArrayList<>(Arrays.asList(productModules));
+            query.setProductModules(productModuleList);
+        }
+        List<SellBuild> ProductModules=sellBuildDao.findByProductModule(query);
+        //遍历
+        for (SellBuild productModule : ProductModules) {
+            String application = productModule.getApplication();
+            if (application != null && !application.isEmpty()) {
+                String[] applicationsArray = application.split("、");
+                for (String app : applicationsArray) {
+                    applicationlist.add(app.trim()); // 去除前后空格
+                }
+            }
+            Long parkId = productModule.getBelong();
+            parkNames.add(parkId);
+        }
+        map.put("sellBuild", ProductModules);
+        map.put("applications", applicationlist);
+        map.put("parkId", parkNames);
+        return map;
+    }
+
 }
 
 

+ 29 - 0
nngkxxdp/src/main/resources/mapper/SellBuildDao.xml

@@ -179,4 +179,33 @@
         </where>
         limit #{begin}, #{pageSize}
     </select>
+    <select id="findByProductModule" resultType="com.example.nngkxxdp.entity.SellBuild">
+        select sb.*, sb.addr as landAddr, pd.title, pd.industry, pd.addr as parkAddr
+        from t_sell_build sb
+        left join t_park_data pd on pd.id = sb.belong
+        <where>
+        <if test="productModules != null and !productModules.isEmpty()">
+            and (
+            <foreach collection="productModules" item="pro" separator=" or ">
+                sb.product_module like concat('%', #{pro}, '%')
+            </foreach>
+            )
+        </if>
+        <if test="applications != null and !applications.isEmpty()">
+            and (
+            <foreach collection="applications" item="app" separator=" or ">
+                sb.application like concat('%', #{app}, '%')
+            </foreach>
+            )
+        </if>
+        <if test="belongs != null and !belongs.isEmpty()">
+            and (
+            <foreach collection="belongs" item="belong" separator=" or ">
+                sb.belong = #{belong}
+            </foreach>
+            )
+        </if>
+        </where>
+    </select>
+
 </mapper>