数据导入
This commit is contained in:
parent
c894047ff9
commit
26dcc1ae71
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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<VillageGroupExcel> 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<VillageOrganExcel> 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<VillagePerson> 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<String> 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<String> unExistEnterpriseIds = new ArrayList<>();
|
||||
List<String> moreEnterpriseIds = new ArrayList<>();
|
||||
List<String> 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<String> existUsers = new ArrayList<>();
|
||||
EasyExcel.read(userFile, UserExcel.class, new UserExcelListener() {
|
||||
@Override
|
||||
@ -350,6 +350,10 @@ public class DataServiceImpl extends BaseService implements IDataService {
|
||||
Map<String, Object> 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);
|
||||
|
@ -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 @@
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="getArea" parameterType="map" resultMap="dataDictionaryDTO">
|
||||
<select id="getArea" parameterType="map" resultMap="dictionaryDTO">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
|
Loading…
Reference in New Issue
Block a user