diff --git a/src/main/java/com/cm/inspection/listener/excel/data/EnterprisePersonExcel.java b/src/main/java/com/cm/inspection/listener/excel/data/EnterprisePersonExcel.java index c65d76b..b713be5 100644 --- a/src/main/java/com/cm/inspection/listener/excel/data/EnterprisePersonExcel.java +++ b/src/main/java/com/cm/inspection/listener/excel/data/EnterprisePersonExcel.java @@ -14,11 +14,11 @@ import com.alibaba.excel.annotation.ExcelProperty; **/ public class EnterprisePersonExcel { - @ExcelProperty(index = 2) + @ExcelProperty(index = 1) private Integer companyId; - @ExcelProperty(index = 4) + @ExcelProperty(index = 3) private Integer userId; - @ExcelProperty(index = 5) + @ExcelProperty(index = 4) private Integer isDeleted; public Integer getCompanyId() { diff --git a/src/main/java/com/cm/inspection/listener/excel/data/UserExcel.java b/src/main/java/com/cm/inspection/listener/excel/data/UserExcel.java index bbf9d73..280c7a7 100644 --- a/src/main/java/com/cm/inspection/listener/excel/data/UserExcel.java +++ b/src/main/java/com/cm/inspection/listener/excel/data/UserExcel.java @@ -14,19 +14,19 @@ import com.alibaba.excel.annotation.ExcelProperty; **/ public class UserExcel { - @ExcelProperty(index = 2) + @ExcelProperty(index = 1) private String area1; - @ExcelProperty(index = 3) + @ExcelProperty(index = 2) private String area2; - @ExcelProperty(index = 4) + @ExcelProperty(index = 3) private String area3; - @ExcelProperty(index = 5) + @ExcelProperty(index = 4) private String area4; - @ExcelProperty(index = 15) + @ExcelProperty(index = 14) private String area5; - @ExcelProperty(index = 6) + @ExcelProperty(index = 5) private String name; - @ExcelProperty(index = 11) + @ExcelProperty(index = 10) private String phone; public String getArea1() { diff --git a/src/main/java/com/cm/inspection/listener/excel/data/VillageGroupExcel.java b/src/main/java/com/cm/inspection/listener/excel/data/VillageGroupExcel.java index 812a1c9..c761ffd 100644 --- a/src/main/java/com/cm/inspection/listener/excel/data/VillageGroupExcel.java +++ b/src/main/java/com/cm/inspection/listener/excel/data/VillageGroupExcel.java @@ -14,11 +14,11 @@ import com.alibaba.excel.annotation.ExcelProperty; **/ public class VillageGroupExcel { - @ExcelProperty(index = 1) + @ExcelProperty(index = 0) private String id; - @ExcelProperty(index = 2) + @ExcelProperty(index = 1) private String name; - @ExcelProperty(index = 9) + @ExcelProperty(index = 8) private Integer isDelete; public String getId() { diff --git a/src/main/java/com/cm/inspection/listener/excel/data/VillageOrganExcel.java b/src/main/java/com/cm/inspection/listener/excel/data/VillageOrganExcel.java index 7454301..cd76cf4 100644 --- a/src/main/java/com/cm/inspection/listener/excel/data/VillageOrganExcel.java +++ b/src/main/java/com/cm/inspection/listener/excel/data/VillageOrganExcel.java @@ -14,15 +14,15 @@ import com.alibaba.excel.annotation.ExcelProperty; **/ public class VillageOrganExcel { - @ExcelProperty(index = 1) + @ExcelProperty(index = 0) private String id; - @ExcelProperty(index = 2) + @ExcelProperty(index = 1) private String name; - @ExcelProperty(index = 3) + @ExcelProperty(index = 2) private String groupId; - @ExcelProperty(index = 9) + @ExcelProperty(index = 8) private Integer deleted; - @ExcelProperty(index = 10) + @ExcelProperty(index = 9) private String areaCode; public String getId() { diff --git a/src/main/java/com/cm/inspection/listener/excel/data/VillageOrganPersonExcel.java b/src/main/java/com/cm/inspection/listener/excel/data/VillageOrganPersonExcel.java index 72cf6e5..c4f3ec0 100644 --- a/src/main/java/com/cm/inspection/listener/excel/data/VillageOrganPersonExcel.java +++ b/src/main/java/com/cm/inspection/listener/excel/data/VillageOrganPersonExcel.java @@ -14,9 +14,9 @@ import com.alibaba.excel.annotation.ExcelProperty; **/ public class VillageOrganPersonExcel { - @ExcelProperty(index = 1) + @ExcelProperty(index = 0) private Integer organId; - @ExcelProperty(index = 2) + @ExcelProperty(index = 1) private Integer userId; public Integer getOrganId() { diff --git a/src/main/java/com/cm/inspection/listener/excel/data/VillagePerson.java b/src/main/java/com/cm/inspection/listener/excel/data/VillagePerson.java index 22d30a4..6900aa2 100644 --- a/src/main/java/com/cm/inspection/listener/excel/data/VillagePerson.java +++ b/src/main/java/com/cm/inspection/listener/excel/data/VillagePerson.java @@ -14,35 +14,35 @@ import com.alibaba.excel.annotation.ExcelProperty; **/ public class VillagePerson { - @ExcelProperty(index = 1) + @ExcelProperty(index = 0) private Integer id; - @ExcelProperty(index = 2) + @ExcelProperty(index = 1) private String name; - @ExcelProperty(index = 3) + @ExcelProperty(index = 2) private String duty; - @ExcelProperty(index = 4) + @ExcelProperty(index = 3) private String phone; - @ExcelProperty(index = 6) + @ExcelProperty(index = 5) private String handset; - @ExcelProperty(index = 10) + @ExcelProperty(index = 9) private String title; - @ExcelProperty(index = 16) + @ExcelProperty(index = 15) private String villageCaption; - @ExcelProperty(index = 22) + @ExcelProperty(index = 21) private Integer deleted; - @ExcelProperty(index = 24) + @ExcelProperty(index = 23) private String areaCode; - @ExcelProperty(index = 26) + @ExcelProperty(index = 25) private String villageId; - @ExcelProperty(index = 28) + @ExcelProperty(index = 27) private String stafftyCheckId; - @ExcelProperty(index = 29) + @ExcelProperty(index = 28) private Integer hasCheckId; - @ExcelProperty(index = 30) + @ExcelProperty(index = 29) private String account; - @ExcelProperty(index = 31) + @ExcelProperty(index = 30) private String belongAreaCode; - @ExcelProperty(index = 32) + @ExcelProperty(index = 31) private String belongAreaName; public Integer getId() { diff --git a/src/main/java/com/cm/inspection/service/data/impl/DataServiceImpl.java b/src/main/java/com/cm/inspection/service/data/impl/DataServiceImpl.java index 7a3497a..800b4b0 100644 --- a/src/main/java/com/cm/inspection/service/data/impl/DataServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/data/impl/DataServiceImpl.java @@ -135,7 +135,7 @@ public class DataServiceImpl extends BaseService implements IDataService { @Override public SuccessResult saveVillageGroup() throws Exception { - File villageGroupFile = new File("C:\\Users\\Administrator\\Desktop\\jd_village_group.xlsx"); + File villageGroupFile = new File("/Users/wenc/Desktop/data/jd_village_group.xlsx"); EasyExcel.read(villageGroupFile, VillageGroupExcel.class, new VillageGroupExcelListener() { @Override public void listVillageGroupExcel(List villageGroupExcels) throws Exception { @@ -171,7 +171,7 @@ public class DataServiceImpl extends BaseService implements IDataService { @Override public SuccessResult saveVillageGroupOrgan() throws Exception { - File villageOrganFile = new File("C:\\Users\\Administrator\\Desktop\\jd_village_organ.xlsx"); + File villageOrganFile = new File("/Users/wenc/Desktop/data/jd_village_organ.xlsx"); EasyExcel.read(villageOrganFile, VillageOrganExcel.class, new VillageOrganExcelListener() { @Override public void listVillageOrganExcel(List villageOrganExcels) throws Exception { @@ -214,7 +214,7 @@ public class DataServiceImpl extends BaseService implements IDataService { @Override public SuccessResult saveVillageGroupPerson() throws Exception { - File villagePersonFile = new File("/Users/wenc/Desktop/包头应急局数据data/jd_village_person.xls"); + File villagePersonFile = new File("/Users/wenc/Desktop/data/jd_village_person.xlsx"); EasyExcel.read(villagePersonFile, VillagePerson.class, new VillagePersonListener() { @Override public void listVillagePerson(List villagePersons) throws Exception { @@ -250,7 +250,7 @@ public class DataServiceImpl extends BaseService implements IDataService { @Override public SuccessResult saveVillageOrganPerson() throws Exception { - File villageOrganPersonFile = new File("/Users/wenc/Desktop/包头应急局数据data/jd_village_organ_person_rel.xls"); + File villageOrganPersonFile = new File("/Users/wenc/Desktop/data/jd_village_organ_person_rel.xlsx"); final int[] unExistUserCount = {0}; final int[] unExistDepartmentCount = {0}; final List unExistUserIds = new ArrayList<>(); @@ -292,7 +292,7 @@ public class DataServiceImpl extends BaseService implements IDataService { @Override public SuccessResult saveCompanyPerson() throws Exception { - File companyPersonFile = new File("/Users/wenc/Desktop/包头应急局数据data/jd_com_village_rel.xlsx"); + File companyPersonFile = new File("/Users/wenc/Desktop/data/jd_com_village_rel.xlsx"); List unExistEnterpriseIds = new ArrayList<>(); List moreEnterpriseIds = new ArrayList<>(); List unExistPersonIds = new ArrayList<>(); @@ -342,7 +342,7 @@ public class DataServiceImpl extends BaseService implements IDataService { @Override public SuccessResult saveUser() throws Exception { - File userFile = new File("/Users/wenc/Desktop/包头应急局数据data/jd_com_village_rel.xlsx"); + File userFile = new File("/Users/wenc/Desktop/data/t_person.xlsx"); List existUsers = new ArrayList<>(); EasyExcel.read(userFile, UserExcel.class, new UserExcelListener() { @Override @@ -350,6 +350,10 @@ public class DataServiceImpl extends BaseService implements IDataService { Map params = getHashMap(1); String currentDate = DateUtil.getTime(); for (UserExcel userExcel : userExcels) { + if(StringUtils.isBlank(userExcel.getPhone())) { + existUsers.add(String.format("%s|%s", userExcel.getPhone(), userExcel.getName())); + continue; + } params.put("userUsername", userExcel.getPhone()); UserDTO userDTO = dataDao.getUser(params); if (userDTO != null) { @@ -419,21 +423,21 @@ public class DataServiceImpl extends BaseService implements IDataService { String gridUserId = String.format("%s|%s|%s|【%s】%s", userDTO.getUserId(), userDTO.getDepartmentId(), userDTO.getUserName(), userDTO.getDepartmentName(), userDTO.getUserName()); GridPersonnelVO gridPersonnelVO = new GridPersonnelVO(); - gridPersonnelVO.setLevel(dataDictionaryDTOs.size()); + gridPersonnelVO.setLevel(dataDictionaryDTOs.size() - 1); gridPersonnelVO.setIsGridOperator(1); gridPersonnelVO.setUserId(gridUserId); for (int i = dataDictionaryDTOs.size(); i > 0; i--) { String dictionaryId = dataDictionaryDTOs.get(i - 1).getDictionaryId(); if (i == 5) { - gridPersonnelVO.setArea5(dictionaryId); + gridPersonnelVO.setArea1(dictionaryId); } else if (i == 4) { - gridPersonnelVO.setArea4(dictionaryId); + gridPersonnelVO.setArea2(dictionaryId); } else if (i == 3) { - gridPersonnelVO.setArea4(dictionaryId); + gridPersonnelVO.setArea3(dictionaryId); } else if (i == 2) { gridPersonnelVO.setArea4(dictionaryId); } else if (i == 1) { - gridPersonnelVO.setArea4(dictionaryId); + gridPersonnelVO.setArea5(dictionaryId); } } gridPersonnelService.saveGridPersonnel(gridPersonnelVO); diff --git a/src/main/resources/mybatis/mapper/data/data-mapper.xml b/src/main/resources/mybatis/mapper/data/data-mapper.xml index bf646d9..97424f9 100644 --- a/src/main/resources/mybatis/mapper/data/data-mapper.xml +++ b/src/main/resources/mybatis/mapper/data/data-mapper.xml @@ -112,7 +112,7 @@ t2.department_name, t3.* FROM - db_cloud_v2.sys_department t1 + db_cloud_v2.sys_department_user t1 INNER JOIN db_cloud_v2.sys_department t2 ON @@ -151,7 +151,7 @@ ) - SELECT * FROM