Browse Source

201911101757

caolong 5 years ago
parent
commit
a2482c59bd

+ 1 - 1
src/main/java/com/yc/education/controller/AuthCouponController.java

@@ -76,7 +76,7 @@ public class AuthCouponController extends BaseController {
                     innerVo.setMoney(authCoupon.getMoney( ));
                     innerVo.setMoneyTips("满300元可用");
                     innerVo.setName("附近养车网专项优惠券");
-                    innerVo.setNameTips("仅限认证 开通商城使用");
+                    innerVo.setNameTips("仅限商家认证时使用");
                     SimpleDateFormat sdf = new SimpleDateFormat(DateUtils.FORMAT_YYYY_MM_DD);
                     innerVo.setValidity("有效期至 " + sdf.format(authCoupon.getPassDate( )));
                     innerVo.setIsUse(authCoupon.getIsUse( ));

+ 9 - 9
src/main/java/com/yc/education/controller/DealerSearchController.java

@@ -407,7 +407,7 @@ public class DealerSearchController extends BaseController {
             List< ConditionDTO > searchDealerList;
             searchDealerList = iSearchDealerService.listSearchDealer(province, city, district, null, null, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ));
             //计算距离
-            listInner(vo, searchDealerList, null, null, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ), null);
+            listInner(vo, searchDealerList, null, null, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ), null,null);
             //end
             //--
             //返回用户 认证信息
@@ -426,10 +426,10 @@ public class DealerSearchController extends BaseController {
     }
 
     //计算商家距离
-    private void listInner(Object obj, List< ConditionDTO > list, String sort, String dis, Integer offset, Integer pageSize, String longitude, String latitude, String searchName) {
+    private void listInner(Object obj, List< ConditionDTO > list, String sort, String dis, Integer offset, Integer pageSize, String longitude, String latitude, String searchName,String paramType) {
         //如果按当前市 没有查询到数据 ,就默认查全国范围 搜索最近的15条数据显示
         if (CollectionUtils.isEmpty(list)) {
-            list = iSearchDealerService.listSearchDealer(null, null, null, searchName, null, offset, pageSize, longitude, latitude);
+            list = iSearchDealerService.listSearchDealer(null, null, null, searchName, paramType, offset, pageSize, longitude, latitude);
         }
         if (obj instanceof DealerSearchShowVo) {
             DealerSearchShowVo vo = (DealerSearchShowVo) obj;
@@ -740,7 +740,7 @@ public class DealerSearchController extends BaseController {
 
 
             //计算距离
-            listInner(vo, searchDealerList, sort, dis, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ), searchName);
+            listInner(vo, searchDealerList, sort, dis, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ), searchName,paramType);
             //--end
 
             //返回用户 认证信息
@@ -828,7 +828,7 @@ public class DealerSearchController extends BaseController {
             //商家信息
             List< ConditionDTO > searchDealerList = iSearchDealerService.listSearchDealer(province, city, district, searchName, null, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ));
             //计算距离
-            listInner(vo, searchDealerList, null, null, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ), searchName);
+            listInner(vo, searchDealerList, null, null, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ), searchName,null);
             //--end
             //返回用户 认证信息
             UserStatus status = commonService.getUserStatus(userinfo.getId( ));
@@ -918,7 +918,7 @@ public class DealerSearchController extends BaseController {
 
                 List< ConditionDTO > searchDealerList = iSearchDealerService.listSearchDealer(province, city, district, name, paramType, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ));
                 //计算距离
-                listInner(vo, searchDealerList, null, null, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ), name);
+                listInner(vo, searchDealerList, null, null, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ), name,paramType);
                 //--end
 
                 //返回用户 认证信息
@@ -975,7 +975,7 @@ public class DealerSearchController extends BaseController {
                 //商家信息
                 List< ConditionDTO > searchDealerList = iSearchDealerService.listSearchDealer(province, city, district, name, paramType, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ));
                 //计算距离
-                listInner(vo, searchDealerList, null, null, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ), name);
+                listInner(vo, searchDealerList, null, null, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ), name,paramType);
                 //--end
 
                 //返回用户 认证信息
@@ -1051,7 +1051,7 @@ public class DealerSearchController extends BaseController {
             //商家信息
             List< ConditionDTO > searchDealerList = iSearchDealerService.listSearchDealer(province, city, district, searchName, paramType, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ));
             //计算距离
-            listInner(vo, searchDealerList, null, null, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ), searchName);
+            listInner(vo, searchDealerList, null, null, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ), searchName,paramType);
             //--end
             //返回用户 认证信息
             UserStatus status = commonService.getUserStatus(userinfo.getId( ));
@@ -1141,7 +1141,7 @@ public class DealerSearchController extends BaseController {
 
             List< ConditionDTO > searchDealerList = iSearchDealerService.listSearchDealer(province, city, district, searchName, paramType, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ));
             //计算距离
-            listInner(vo, searchDealerList, null, null, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ), searchName);
+            listInner(vo, searchDealerList, null, null, offset, pageSize, userinfo.getLongitude( ), userinfo.getLatitude( ), searchName,paramType);
             //--end
             //返回用户 认证信息
             UserStatus status = commonService.getUserStatus(userinfo.getId( ));

+ 1 - 0
src/main/java/com/yc/education/controller/ProviderSearchController.java

@@ -514,6 +514,7 @@ public class ProviderSearchController extends BaseController {
 
             //2 小车 ,商用车
             ArrayList< String > typeList = new ArrayList<>( );
+            typeList.add("全部");
             typeList.add("小型车");
             typeList.add("商用车");
             vo.setType(typeList.toArray( ));

+ 16 - 2
src/main/java/com/yc/education/controller/admin/ProviderAdminController.java

@@ -90,7 +90,7 @@ public class ProviderAdminController {
      */
     @RequestMapping("providerList.html")
     public ModelAndView listProviderInfo(
-            @RequestParam(defaultValue = "") String isImport,
+            @RequestParam(defaultValue = "0") String isImport,
             @RequestParam(defaultValue = "") String company,
             @RequestParam(defaultValue = "") Integer brandId,
             @RequestParam(defaultValue = "") String status,
@@ -98,7 +98,6 @@ public class ProviderAdminController {
             @RequestParam(defaultValue = "1") Integer pageNum,
             @RequestParam(defaultValue = "10") Integer pageSize
     ) {
-
         ModelAndView mav = new ModelAndView( );
 
         List< Provider > listAllProviderInfo = iProviderService.listAllProviderInfo(isImport, company, brandId, status, isUse, pageNum, pageSize);//查询服务商信息并分页
@@ -451,6 +450,21 @@ public class ProviderAdminController {
 
         int row = iProviderService.updateNotNull(provider);
 
+        String paramType = provider.getParamType( );
+
+        new Thread(( ) -> {
+            // 1 代表 小型汽车 ,2服务商用车专修
+            if ("1".equals(paramType) || "2".equals(paramType)) {
+                //iProviderService.providerSave(StoreId, pMainBusiness, mainBusiness, paramType);
+                iProviderService.providerSave(provider.getId( ), provider.getpMainBusiness( ), provider.getMianBusiness( ), paramType);
+            }
+            // 4s 店
+            if ("3".equals(paramType)) {
+                // iProviderService.fourS_save(StoreId, mainBusiness, pMainBusiness);
+                iProviderService.fourS_save(provider.getId( ), provider.getMianBusiness( ), provider.getpMainBusiness( ));
+            }
+        }).start( );
+
         return ViewUtil.returnview(row, "providerList.html?company=" + provider.getCompanyName( ), "服务商列表");
 
     }

+ 19 - 1
src/main/java/com/yc/education/controller/admin/SupplierAdminController.java

@@ -95,7 +95,7 @@ public class SupplierAdminController {
      */
     @RequestMapping("supplierList.html")
     public ModelAndView listAllSupplierInfo(
-            @RequestParam(defaultValue = "") String isImport,
+            @RequestParam(defaultValue = "0") String isImport,
             @RequestParam(defaultValue = "") String company,
             @RequestParam(defaultValue = "") Integer brandId,
             @RequestParam(defaultValue = "") String status,
@@ -342,6 +342,24 @@ public class SupplierAdminController {
 
         int row = iProviderService.updateNotNull(provider);
 
+        String paramType = provider.getParamType( );
+        //当是经销商的时候   添加经销商搜索
+        new Thread(( ) -> {
+            // 1,3,4,5 代表是 普通类型 1汽配(单项件),2汽配(全车件) ,3用品改装,4汽保设备与工具,5商用车(单项件) 6商用车(全车件)
+            if ("1".equals(paramType) || "3".equals(paramType) || "4".equals(paramType) || "5".equals(paramType)) {
+                iProviderService.saveSearchDealer(paramType, provider.getId(), provider.getpMainBusiness(), provider.getMianBusiness());
+            }
+            //  2 代表全车件
+            if ("2".equals(paramType)) {
+                iProviderService.saveAllCar(provider.getId(), provider.getMianBusiness());
+            }
+            // 6 代表商务车
+            if ("6".equals(paramType)) {
+                iProviderService.saveCommercial(provider.getId(), provider.getMianBusiness());
+            }
+        }).start( );
+
+
         return ViewUtil.returnview(row, "supplierList.html?company=" + provider.getCompanyName( ), "供应商列表");
 
     }

+ 18 - 0
src/main/java/com/yc/education/model/SearchDealer.java

@@ -1,6 +1,7 @@
 package com.yc.education.model;
 
 import javax.persistence.*;
+import java.util.Objects;
 
 @Table(name = "search_dealer")
 public class SearchDealer {
@@ -129,4 +130,21 @@ public class SearchDealer {
                 ", type='" + type + '\'' +
                 '}';
     }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass( ) != o.getClass( )) return false;
+        SearchDealer that = (SearchDealer) o;
+        return Objects.equals(storeId, that.storeId) &&
+                Objects.equals(pName, that.pName) &&
+                Objects.equals(name, that.name) &&
+                Objects.equals(level, that.level) &&
+                Objects.equals(type, that.type);
+    }
+
+    @Override
+    public int hashCode( ) {
+        return Objects.hash(storeId, pName, name, level, type);
+    }
 }

+ 19 - 0
src/main/java/com/yc/education/model/SearchProvider.java

@@ -1,6 +1,7 @@
 package com.yc.education.model;
 
 import javax.persistence.*;
+import java.util.Objects;
 
 @Table(name = "search_provider")
 public class SearchProvider {
@@ -145,4 +146,22 @@ public class SearchProvider {
     public void setType(String type) {
         this.type = type;
     }
+
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass( ) != o.getClass( )) return false;
+        SearchProvider that = (SearchProvider) o;
+        return Objects.equals(storeId, that.storeId) &&
+                Objects.equals(pName, that.pName) &&
+                Objects.equals(name, that.name) &&
+                Objects.equals(level, that.level) &&
+                Objects.equals(type, that.type);
+    }
+
+    @Override
+    public int hashCode( ) {
+        return Objects.hash(storeId, pName, name, level, type);
+    }
 }

+ 23 - 10
src/main/java/com/yc/education/service/impl/ProviderServiceImpl.java

@@ -210,7 +210,7 @@ public class ProviderServiceImpl extends BaseService< Provider > implements IPro
         searchProviderMapper.deleteByStoreId(storeId);
         String[] split = mainBusiness.split(",");
         String[] split1 = brand.split(",");
-        ArrayList< SearchProvider > spList = new ArrayList<>( );
+        Set< SearchProvider > spList = new HashSet<>();
 
         int i = 0;
         for (String factory : split) {
@@ -253,7 +253,10 @@ public class ProviderServiceImpl extends BaseService< Provider > implements IPro
             }
             i++;
         }
-        searchProviderMapper.insertList(spList);
+
+        List< SearchProvider > listSet = new ArrayList<>();
+        listSet.addAll(spList);
+        searchProviderMapper.insertList(listSet);
     }
 
     /**
@@ -269,7 +272,7 @@ public class ProviderServiceImpl extends BaseService< Provider > implements IPro
         if (StringUtils.isBlank(pMainBusiness) || StringUtils.isBlank(mainBusiness)) return;
         searchProviderMapper.deleteByStoreId(storeId);
         try {
-            ArrayList< SearchProvider > spList = new ArrayList<>( );
+            Set< SearchProvider > spList = new HashSet<>( );
             String[] pMains = pMainBusiness.split(",");
             String[] mains = mainBusiness.split(",");
             List< String > mainList = Arrays.asList(mains);
@@ -305,7 +308,9 @@ public class ProviderServiceImpl extends BaseService< Provider > implements IPro
                     spList.add(sp);
                 }
             }
-            searchProviderMapper.insertList(spList);
+            List< SearchProvider > listSet = new ArrayList<>( );
+            listSet.addAll(spList);
+            searchProviderMapper.insertList(listSet);
         } catch (Exception e) {
             e.printStackTrace( );
         }
@@ -329,7 +334,7 @@ public class ProviderServiceImpl extends BaseService< Provider > implements IPro
         searchDealerMapper.deleteByStoreId(storeId);
         String pName;
         //1汽配(单项件),2汽配(全车件) ,3用品改装,4汽保设备与工具,5商用车(单项件) 6商用车(全车件)
-        ArrayList< SearchDealer > list = new ArrayList<>( );
+        Set< SearchDealer > list = new HashSet<>( );
         String[] split = mainBusiness.split(";+");
         String[] split1 = pMainBusiness.split(",");
 
@@ -409,7 +414,9 @@ public class ProviderServiceImpl extends BaseService< Provider > implements IPro
             list.add(searchDealer);
         }
         try {
-            searchDealerMapper.insertList(list);
+            ArrayList< SearchDealer > listSet = new ArrayList<>( );
+            listSet.addAll(list);
+            searchDealerMapper.insertList(listSet);
         } catch (Exception e) {
             e.printStackTrace( );
         }
@@ -431,7 +438,7 @@ public class ProviderServiceImpl extends BaseService< Provider > implements IPro
             List< String > brand = carSedanMapper.listBrandGroupByBrand( );
             List< String > factorys = carSedanMapper.listFactoryGroupByFactory( );
             List< String > series = carSedanMapper.listSeriesGroupBySeries( );
-            List< SearchDealer > list = new ArrayList<>( );
+            Set< SearchDealer > list = new HashSet<>( );
             for (String name : split) {
                 if (brand != null && brand.contains(name)) {
                     List< CarSedan > carSedanList = carSedanMapper.listCarSedanFactoryByBrand(name);
@@ -578,7 +585,10 @@ public class ProviderServiceImpl extends BaseService< Provider > implements IPro
                     list.add(searchDealer3);
                 }
             }
-            searchDealerMapper.insertList(list);
+
+            List< SearchDealer > listSet = new ArrayList<>( );
+            listSet.addAll(list);
+            searchDealerMapper.insertList(listSet);
         } catch (Exception e) {
             e.printStackTrace( );
         }
@@ -595,7 +605,7 @@ public class ProviderServiceImpl extends BaseService< Provider > implements IPro
         try {
             if (null == storeId || StringUtils.isBlank(mainBusiness)) return;
             searchDealerMapper.deleteByStoreId(storeId);
-            List< SearchDealer > list = new ArrayList<>( );
+            Set< SearchDealer > list = new HashSet<>( );
 
             List< String > brandList = carCommercialMapper.listBrandGroupByBrand( );
 
@@ -756,7 +766,10 @@ public class ProviderServiceImpl extends BaseService< Provider > implements IPro
                     }
                 }
             }
-            searchDealerMapper.insertList(list);
+            //去重
+            List< SearchDealer > listSet = new ArrayList<>( );
+            listSet.addAll(list);
+            searchDealerMapper.insertList(listSet);
         } catch (Exception e) {
             e.printStackTrace( );
         }