|
@@ -10,6 +10,7 @@ import com.yc.education.model.ServicerImport;
|
|
import com.yc.education.service.IProviderService;
|
|
import com.yc.education.service.IProviderService;
|
|
import com.yc.education.service.IServicerImportService;
|
|
import com.yc.education.service.IServicerImportService;
|
|
import com.yc.education.util.AjaxMessage;
|
|
import com.yc.education.util.AjaxMessage;
|
|
|
|
+import com.yc.education.util.MapUtils;
|
|
import com.yc.education.util.ViewUtil;
|
|
import com.yc.education.util.ViewUtil;
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
@@ -267,6 +268,7 @@ public class ServicerImportController {
|
|
provider.setCity(getValue(hssfRow.getCell(15)));
|
|
provider.setCity(getValue(hssfRow.getCell(15)));
|
|
provider.setDistrict(getValue(hssfRow.getCell(16)));
|
|
provider.setDistrict(getValue(hssfRow.getCell(16)));
|
|
provider.setStree(getValue(hssfRow.getCell(17)));
|
|
provider.setStree(getValue(hssfRow.getCell(17)));
|
|
|
|
+ provider.setAuthPhone(getValue(hssfRow.getCell(24)));
|
|
|
|
|
|
provider.setIsUse("1");
|
|
provider.setIsUse("1");
|
|
provider.setEnterDate(new Date());
|
|
provider.setEnterDate(new Date());
|
|
@@ -297,7 +299,7 @@ public class ServicerImportController {
|
|
//获得数据的总行数
|
|
//获得数据的总行数
|
|
int totalRowNum = sheet.getLastRowNum();
|
|
int totalRowNum = sheet.getLastRowNum();
|
|
//获得所有数据
|
|
//获得所有数据
|
|
- for(int i = 1 ; i < totalRowNum ; i++)
|
|
|
|
|
|
+ for(int i = 1 ; i <=totalRowNum ; i++)
|
|
{
|
|
{
|
|
//获得第i行对象
|
|
//获得第i行对象
|
|
Row row = sheet.getRow(i);
|
|
Row row = sheet.getRow(i);
|
|
@@ -348,6 +350,7 @@ public class ServicerImportController {
|
|
provider.setCity(getValue(row.getCell(15)));
|
|
provider.setCity(getValue(row.getCell(15)));
|
|
provider.setDistrict(getValue(row.getCell(16)));
|
|
provider.setDistrict(getValue(row.getCell(16)));
|
|
provider.setStree(getValue(row.getCell(17)));
|
|
provider.setStree(getValue(row.getCell(17)));
|
|
|
|
+ provider.setAuthPhone(getValue(row.getCell(24)));
|
|
|
|
|
|
provider.setIsUse("1");
|
|
provider.setIsUse("1");
|
|
provider.setEnterDate(new Date());
|
|
provider.setEnterDate(new Date());
|
|
@@ -360,10 +363,14 @@ public class ServicerImportController {
|
|
provider.setModifiedDate(new Date());
|
|
provider.setModifiedDate(new Date());
|
|
provider.setRoleType("1");
|
|
provider.setRoleType("1");
|
|
provider.setIsUse("0");
|
|
provider.setIsUse("0");
|
|
- provider.setLatitude("0");
|
|
|
|
- provider.setLongitude("0");
|
|
|
|
provider.setIsLine("0");
|
|
provider.setIsLine("0");
|
|
provider.setAddress(provider.getProvince()+provider.getCity()+provider.getDistrict()+provider.getStree());
|
|
provider.setAddress(provider.getProvince()+provider.getCity()+provider.getDistrict()+provider.getStree());
|
|
|
|
+
|
|
|
|
+ String str = MapUtils.getLongitudeLatitude(provider.getAddress());//根据地址获取经纬度字符串
|
|
|
|
+ String[] arr = str.split(",");//用逗号将字符串分开
|
|
|
|
+ provider.setLongitude(arr[0]);//赋值给经度
|
|
|
|
+ provider.setLatitude(arr[1]);//赋值给纬度
|
|
|
|
+
|
|
list1.add(provider);
|
|
list1.add(provider);
|
|
|
|
|
|
|
|
|
|
@@ -380,8 +387,12 @@ public class ServicerImportController {
|
|
List<Provider> serviceList1 = list1.subList(i * 400, end);
|
|
List<Provider> serviceList1 = list1.subList(i * 400, end);
|
|
|
|
|
|
if(serviceList != null && serviceList.size() > 0){
|
|
if(serviceList != null && serviceList.size() > 0){
|
|
- iServicerImportService.addByList(serviceList);
|
|
|
|
- iProviderService.addProvider(serviceList1);
|
|
|
|
|
|
+
|
|
|
|
+ int row = iServicerImportService.addByList(serviceList);
|
|
|
|
+ if (row > 0 ){ //如果服务商管理没有导入成功,则不能往商家信息中导入相关数据
|
|
|
|
+ iProviderService.addProvider(serviceList1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|