Browse Source

Merge remote-tracking branch 'origin/feature/dept'

feature/dangjian
mkh 4 years ago
parent
commit
0f422b43a5
  1. 168
      doc/sql/用户初始化.sql
  2. 137
      doc/sql/部门组织初始化.sql
  3. 155
      esua-epdc/epdc-admin/epdc-admin-client/src/main/java/com/elink/esua/epdc/dto/CustomerAgencyDTO.java
  4. 101
      esua-epdc/epdc-admin/epdc-admin-client/src/main/java/com/elink/esua/epdc/dto/CustomerDepartmentDTO.java
  5. 126
      esua-epdc/epdc-admin/epdc-admin-client/src/main/java/com/elink/esua/epdc/dto/CustomerGridDTO.java
  6. 6
      esua-epdc/epdc-admin/epdc-admin-server/pom.xml
  7. 29
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/controller/SysDeptController.java
  8. 34
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/CustomerAgencyDao.java
  9. 34
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/CustomerDepartmentDao.java
  10. 34
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/CustomerGridDao.java
  11. 34
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/CustomerStaffAgencyDao.java
  12. 37
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/CustomerStaffDao.java
  13. 34
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/CustomerStaffDepartmentDao.java
  14. 34
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/CustomerStaffGridDao.java
  15. 37
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/StaffOrgRelationDao.java
  16. 13
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/SysDeptDao.java
  17. 1
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/SysDictDao.java
  18. 19
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/SysUserDao.java
  19. 33
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/UserDao.java
  20. 125
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/CustomerAgencyEntity.java
  21. 71
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/CustomerDepartmentEntity.java
  22. 96
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/CustomerGridEntity.java
  23. 56
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/CustomerStaffAgencyEntity.java
  24. 56
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/CustomerStaffDepartmentEntity.java
  25. 106
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/CustomerStaffEntity.java
  26. 56
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/CustomerStaffGridEntity.java
  27. 66
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/StaffOrgRelationEntity.java
  28. 56
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/UserEntity.java
  29. 215
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/SysDeptServiceImpl.java
  30. 352
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/SysUserServiceImpl.java
  31. 8
      esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/application-test.yml
  32. 36
      esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/CustomerAgencyDao.xml
  33. 26
      esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/CustomerDepartmentDao.xml
  34. 31
      esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/CustomerGridDao.xml
  35. 23
      esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml
  36. 36
      esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/CustomerStaffDao.xml
  37. 23
      esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml
  38. 23
      esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/CustomerStaffGridDao.xml
  39. 28
      esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/StaffOrgRelationDao.xml
  40. 23
      esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/SysDeptDao.xml
  41. 4
      esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/SysDictDao.xml
  42. 69
      esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/SysUserDao.xml
  43. 20
      esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/UserDao.xml
  44. 7
      esua-epdc/epdc-auth/pom.xml
  45. 6
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/pom.xml
  46. 6
      esua-epdc/epdc-module/epdc-api/epdc-api-server/pom.xml
  47. 7
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/jwt/JwtTokenUtils.java
  48. 6
      esua-epdc/epdc-module/epdc-content-security/epdc-content-security-server/pom.xml
  49. 6
      esua-epdc/epdc-module/epdc-custom/epdc-custom-server/pom.xml
  50. 6
      esua-epdc/epdc-module/epdc-group/epdc-group-server/pom.xml
  51. 6
      esua-epdc/epdc-module/epdc-heart/epdc-heart-server/pom.xml
  52. 6
      esua-epdc/epdc-module/epdc-job/epdc-job-server/pom.xml
  53. 6
      esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/pom.xml
  54. 6
      esua-epdc/epdc-module/epdc-message/epdc-message-server/pom.xml
  55. 6
      esua-epdc/epdc-module/epdc-news/epdc-news-server/pom.xml
  56. 6
      esua-epdc/epdc-module/epdc-oss/epdc-oss-server/pom.xml
  57. 6
      esua-epdc/epdc-module/epdc-points/epdc-points-server/pom.xml
  58. 18
      esua-epdc/epdc-module/epdc-user/epdc-user-server/pom.xml
  59. 6
      esua-epdc/epdc-module/epdc-webservice/pom.xml

168
doc/sql/用户初始化.sql

@ -0,0 +1,168 @@
/*
customer_staff_agency,customer_staff_department,customer_staff_grid
*/
INSERT INTO epmet_gov_org.customer_staff_grid ( ID, CUSTOMER_ID, USER_ID, GRID_ID, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) SELECT
t1.id,
'b09527201c4409e19d1dbc5e3c3429a1',
t1.id AS USER_ID,
t1.dept_id AS GRID_ID,
t1.del_flag,
t1.creator AS CREATED_BY,
t1.create_date AS CREATED_TIME,
t1.updater AS UPDATED_BY,
t1.update_date AS UPDATED_TIME
FROM
esua_epdc_admin.sys_user t1
LEFT JOIN esua_epdc_admin.sys_dept t2 ON t1.dept_id = t2.id
WHERE
t2.type_key = 'grid_party';
INSERT INTO epmet_gov_org.customer_staff_department (
ID,
CUSTOMER_ID,
USER_ID,
DEPARTMENT_ID,
DEL_FLAG,
CREATED_BY,
CREATED_TIME,
UPDATED_BY,
UPDATED_TIME
) SELECT
t1.id ,
'b09527201c4409e19d1dbc5e3c3429a1',
t1.id as USER_ID,
t1.dept_id as DEPARTMENT_ID,
t1.del_flag,
t1.creator as CREATED_BY,
t1.create_date as CREATED_TIME,
t1.updater as UPDATED_BY,
t1.update_date as UPDATED_TIME
from esua_epdc_admin.sys_user t1
left join esua_epdc_admin.sys_dept t2 on t1.dept_id = t2.id
WHERE
t2.type_key = 'district_dept'
OR t2.type_key = 'street_dept';
INSERT INTO epmet_gov_org.customer_staff_agency (
ID,
CUSTOMER_ID,
USER_ID,
AGENCY_ID,
DEL_FLAG,
CREATED_BY,
CREATED_TIME,
UPDATED_BY,
UPDATED_TIME
) SELECT
t1.id ,
'b09527201c4409e19d1dbc5e3c3429a1',
t1.id as USER_ID,
t1.dept_id as AGENCY_ID,
t1.del_flag,
t1.creator as CREATED_BY,
t1.create_date as CREATED_TIME,
t1.updater as UPDATED_BY,
t1.update_date as UPDATED_TIME
from esua_epdc_admin.sys_user t1
left join esua_epdc_admin.sys_dept t2 on t1.dept_id = t2.id
WHERE
t2.type_key = 'district_party'
OR t2.type_key = 'street_party'
OR t2.type_key = 'community_party';
INSERT INTO epmet_user.customer_staff ( ID, CUSTOMER_ID,USER_ID,REAL_NAME,GENDER,EMAIL,MOBILE,HEAD_PHOTO,PASSWORD,DEL_FLAG,REVISION,CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) SELECT
t1.id as ID,
'b09527201c4409e19d1dbc5e3c3429a1',
t1.id AS USER_ID,
t1.real_name as REAL_NAME,
t1.gender as GENDER,
t1.email as EMAIL,
t1.mobile as MOBILE,
t1.head_url as HEAD_PHOTO,
t1.password as PASSWORD,
t1.del_flag as DEL_FLAG,
'0' as REVISION,
t1.creator AS CREATED_BY,
t1.create_date AS CREATED_TIME,
t1.updater AS UPDATED_BY,
t1.update_date AS UPDATED_TIME
FROM
esua_epdc_admin.sys_user t1
where t1.user_tag_key ='offers';
INSERT INTO epmet_user.USER (ID, CUSTOMER_ID, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) SELECT
t1.id AS ID,
'b09527201c4409e19d1dbc5e3c3429a1' AS CUSTOMER_ID,
t1.del_flag AS DEL_FLAG,
'0' AS REVISION,
t1.creator AS CREATED_BY,
t1.create_date AS CREATED_TIME,
t1.updater AS UPDATED_BY,
t1.update_date AS UPDATED_TIME
FROM
esua_epdc_admin.sys_user t1
where t1.user_tag_key ='offers';
INSERT INTO epmet_gov_org.staff_org_relation ( ID, CUSTOMER_ID, PIDS, STAFF_ID, ORG_ID, ORG_TYPE, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) SELECT
t1.id AS ID,
'b09527201c4409e19d1dbc5e3c3429a1' AS CUSTOMER_ID,
CASE
t2.type_key
WHEN 'district_party' THEN
t2.pids
WHEN 'street_party' THEN
t2.pids
WHEN 'community_party' THEN
concat(
SUBSTRING_INDEX( t2.pids, ',', 1 ),
':',
SUBSTRING_INDEX( t2.pids, ',',- 1 ))
WHEN 'district_dept' THEN
t2.pids
WHEN 'street_dept' THEN
concat(
SUBSTRING_INDEX( t2.pids, ',', 1 ),
':',
SUBSTRING_INDEX( t2.pids, ',',- 1 ))
WHEN 'grid_party' THEN
concat(
SUBSTRING_INDEX( t2.pids, ',', 1 ),
':',
SUBSTRING_INDEX( SUBSTRING_INDEX( t2.pids, ',', 2 ), ',',- 1 ),
':',
SUBSTRING_INDEX( t2.pids, ',',- 1 ))
END AS PIDS,
t1.id AS STAFF_ID,
t2.id AS ORG_ID,
CASE
t2.type_key
WHEN 'district_party' THEN
'agency'
WHEN 'street_party' THEN
'agency'
WHEN 'community_party' THEN
'agency'
WHEN 'district_dept' THEN
'dept'
WHEN 'street_dept' THEN
'dept'
WHEN 'grid_party' THEN
'grid'
END AS ORG_TYPE,
t1.del_flag AS DEL_FLAG,
'0' AS REVISION,
t1.creator AS CREATED_BY,
t1.create_date AS CREATED_TIME,
t1.updater AS UPDATED_BY,
t1.update_date AS UPDATED_TIME
FROM
esua_epdc_admin.sys_user t1
LEFT JOIN esua_epdc_admin.sys_dept t2 ON t1.dept_id = t2.id
WHERE
t1.user_tag_key = 'offers';

137
doc/sql/部门组织初始化.sql

@ -0,0 +1,137 @@
/*
customer_agency,customer_department,customer_grid
*/
INSERT INTO epmet_gov_org.customer_grid ( ID, CUSTOMER_ID, GRID_NAME, SYNC_FLAG, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, MANAGE_DISTRICT, TOTAL_USER, PID, PIDS ) SELECT
t1.id,
'b09527201c4409e19d1dbc5e3c3429a1',
t1.NAME AS GRID_NAME,
'1',
t1.del_flag,
t1.creator AS CREATED_BY,
t1.create_date AS CREATED_TIME,
t1.updater AS UPDATED_BY,
t1.update_date AS UPDATED_TIME,
t1.NAME AS MANAGE_DISTRICT,
t2.total AS TOTAL_USER,
t1.pid,
concat(
SUBSTRING_INDEX( t1.pids, ',', 1 ),
':',
SUBSTRING_INDEX( SUBSTRING_INDEX( t1.pids, ',', 2 ), ',',- 1 ),
':',
SUBSTRING_INDEX( t1.pids, ',',- 1 )) pids
FROM
esua_epdc_admin.sys_dept t1
LEFT JOIN ( SELECT count( id ) total, dept_id FROM esua_epdc_admin.sys_user GROUP BY dept_id ) t2 ON t1.id = t2.dept_id
WHERE
t1.type_key = 'grid_party' ;
INSERT INTO epmet_gov_org.customer_agency (
ID,
CUSTOMER_ID,
PID,
PIDS,
ALL_PARENT_NAME,
ORGANIZATION_NAME,
LEVEL,
SYNC_FLAG,
DEL_FLAG,
CREATED_BY,
CREATED_TIME,
UPDATED_BY,
UPDATED_TIME,
TOTAL_USER
) SELECT
t1.id,
'b09527201c4409e19d1dbc5e3c3429a1',
t1.pid,
CASE
t1.type_key
WHEN 'street_party' THEN
t1.pids
WHEN 'community_party' THEN
concat(
SUBSTRING_INDEX( t1.pids, ',', 1 ),
':',
SUBSTRING_INDEX( t1.pids, ',',- 1 ))
END AS pids,
CASE
t1.type_key
WHEN 'street_party' THEN
'市北区委'
WHEN 'community_party' THEN
t5.ALL_PARENT_NAME
END AS ALL_PARENT_NAME,
t1.NAME AS ORGANIZATION_NAME,
CASE
t1.type_key
WHEN 'district_party' THEN
'district'
WHEN 'street_party' THEN
'street'
WHEN 'community_party' THEN
'community'
END AS LEVEL,
'1',
t1.del_flag,
t1.creator AS CREATED_BY,
t1.create_date AS CREATED_TIME,
t1.updater AS UPDATED_BY,
t1.update_date AS UPDATED_TIME,
t2.total AS TOTAL_USER
FROM
esua_epdc_admin.sys_dept t1
LEFT JOIN ( SELECT count( id ) total, dept_id FROM esua_epdc_admin.sys_user GROUP BY dept_id ) t2 ON t1.id = t2.dept_id
LEFT JOIN (
SELECT
concat( '市北区委-', t4.NAME ) AS ALL_PARENT_NAME,
t3.id
FROM
esua_epdc_admin.sys_dept t3
LEFT JOIN esua_epdc_admin.sys_dept t4 ON t3.pid = t4.id
WHERE
t3.type_key = 'community_party'
) t5 ON t1.id = t5.id
WHERE
t1.type_key = 'district_party'
OR t1.type_key = 'street_party'
OR t1.type_key = 'community_party' ;
INSERT INTO epmet_gov_org.customer_department (
ID,
CUSTOMER_ID,
AGENCY_ID,
DEPARTMENT_NAME,
TOTAL_USER,
DEL_FLAG,
CREATED_BY,
CREATED_TIME,
UPDATED_BY,
UPDATED_TIME
) SELECT
t1.id,
'b09527201c4409e19d1dbc5e3c3429a1',
t1.pid as AGENCY_ID,
t1.name as DEPARTMENT_NAME,
t2.total AS TOTAL_USER,
t1.del_flag,
t1.creator AS CREATED_BY,
t1.create_date AS CREATED_TIME,
t1.updater AS UPDATED_BY,
t1.update_date AS UPDATED_TIME
FROM
esua_epdc_admin.sys_dept t1
LEFT JOIN ( SELECT count( id ) total, dept_id FROM esua_epdc_admin.sys_user GROUP BY dept_id ) t2 ON t1.id = t2.dept_id
WHERE
t1.type_key = 'district_dept' or t1.type_key = 'street_dept' ;

155
esua-epdc/epdc-admin/epdc-admin-client/src/main/java/com/elink/esua/epdc/dto/CustomerAgencyDTO.java

@ -0,0 +1,155 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 机关单位信息表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2021-12-15
*/
@Data
public class CustomerAgencyDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 上级组织机构ID
*/
private String pid;
/**
* 所有上级组织机构ID(以英文:隔开)
*/
private String pids;
/**
* 所有上级名称,-连接
*/
private String allParentName;
/**
* 组织名称
*/
private String organizationName;
/**
* 机关级别社区级community
街道:street,
区县级: district,
市级: city
省级:province 机关级别社区级community街道:street,区县级: district,市级: city省级:province
*/
private String level;
/**
* 当前组织所属的行政地区编码
*/
private String areaCode;
/**
* 编码
*/
private String code;
/**
* 当前组织是否同步到统计库和指标库,1同步0不同步
*/
private String syncFlag;
/**
* 删除标识
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 总人数
*/
private Integer totalUser;
/**
* 区域编码字典中的省份名称
*/
private String province;
/**
* 区域编码字典中的城市名称
*/
private String city;
/**
* 区域编码字典中的区县名称
*/
private String district;
/**
* 区域编码字典中的街道名称0409
*/
private String street;
/**
* 区域编码字典中的社区名称0409
*/
private String community;
/**
* 当前组织的上级行政地区编码add0204;举例平阴县370124对应的是济南市3701
*/
private String parentAreaCode;
}

101
esua-epdc/epdc-admin/epdc-admin-client/src/main/java/com/elink/esua/epdc/dto/CustomerDepartmentDTO.java

@ -0,0 +1,101 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 客户部门表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2021-12-16
*/
@Data
public class CustomerDepartmentDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID 唯一标识
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 所属机关IDcustomer_agency.id
*/
private String agencyId;
/**
* 部门名称
*/
private String departmentName;
/**
* 部门职责
*/
private String departmentDuty;
/**
* 总人数
*/
private Integer totalUser;
/**
* 部门所属的行政地区编码:实际就是所属组织的地区编码
*/
private String areaCode;
/**
* 删除标识:0.未删除 1.已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

126
esua-epdc/epdc-admin/epdc-admin-client/src/main/java/com/elink/esua/epdc/dto/CustomerGridDTO.java

@ -0,0 +1,126 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 客户网格表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2021-12-15
*/
@Data
public class CustomerGridDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID 唯一标识
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 网格名称
*/
private String gridName;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置纬度
*/
private String latitude;
/**
* 所属地区码所属组织地区码
*/
private String areaCode;
/**
* 编码
*/
private String code;
/**
* 当前网格是否同步到统计库和指标库,1同步0不同步
*/
private String syncFlag;
/**
* 删除标识:0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 管辖区域
*/
private String manageDistrict;
/**
* 当前网格总人数
*/
private Integer totalUser;
/**
* 所属组织机构IDcustomer_agency.id
*/
private String pid;
/**
* 所有上级组织ID
*/
private String pids;
}

6
esua-epdc/epdc-admin/epdc-admin-server/pom.xml

@ -197,9 +197,9 @@
<!-- nacos -->
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
<nacos.ip>47.104.85.99</nacos.ip>
<nacos.namespace>a746dde3-7a13-4521-b986-7369b0b7c269</nacos.namespace>
<nacos.server-addr>115.29.142.202:8848</nacos.server-addr>
<nacos.ip>118.190.232.100</nacos.ip>
<nacos.namespace>305e0faa-d935-4fe1-b3a0-2634da67adb3</nacos.namespace>
<spring.zipkin.base-url>http://localhost:9411</spring.zipkin.base-url>
<!--亿联小程序配置-->

29
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/controller/SysDeptController.java

@ -9,6 +9,7 @@
package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.commons.tools.annotation.LogOperation;
import com.elink.esua.epdc.commons.tools.constant.OrganizationTypeConstant;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
@ -16,18 +17,24 @@ import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.dao.CustomerAgencyDao;
import com.elink.esua.epdc.dao.CustomerDepartmentDao;
import com.elink.esua.epdc.dao.CustomerGridDao;
import com.elink.esua.epdc.dao.SysDeptDao;
import com.elink.esua.epdc.dto.*;
import com.elink.esua.epdc.dto.epdc.form.ExportTemplateInfoFormDTO;
import com.elink.esua.epdc.dto.epdc.form.KpiGridIdsFormDTO;
import com.elink.esua.epdc.dto.epdc.form.UserSysDeptInfoFormDTO;
import com.elink.esua.epdc.dto.epdc.result.ExportKpiResultDTO;
import com.elink.esua.epdc.dto.epdc.result.UserSysDeptInfoResultDTO;
import com.elink.esua.epdc.entity.SysDeptEntity;
import com.elink.esua.epdc.service.SysDeptService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@ -46,6 +53,15 @@ public class SysDeptController {
@Autowired
private SysDeptService sysDeptService;
@Resource
private SysDeptDao sysDeptDao;
@Resource
private CustomerAgencyDao customerAgencyDao;
@Resource
private CustomerDepartmentDao customerDepartmentDao;
@Resource
private CustomerGridDao customerGridDao;
@GetMapping("list")
@ApiOperation("列表")
public Result<List<SysDeptDTO>> list() {
@ -112,6 +128,19 @@ public class SysDeptController {
//效验数据
AssertUtils.isNull(id, "id");
// sysDeptService.delete(id);
SysDeptEntity entity = sysDeptDao.select(id);
if (entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY)) {
//删除customer_grid
customerGridDao.deleteGridById(id.toString());
} else if (entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_DISTRICT_DEPT) || entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_STREET_DEPT)) {
//customer_department
customerDepartmentDao.deleteDepartmentById(id.toString());
} else {
//同步agency
customerAgencyDao.deleteAgencyById(id.toString());
}
sysDeptService.deleteBatchIds(Arrays.asList(new Long[]{id}));
return new Result();
}

34
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/CustomerAgencyDao.java

@ -0,0 +1,34 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.entity.CustomerAgencyEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 机关单位信息表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2021-12-15
*/
@Mapper
public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
void deleteAgencyById(String id);
}

34
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/CustomerDepartmentDao.java

@ -0,0 +1,34 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.entity.CustomerDepartmentEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 客户部门表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2021-12-16
*/
@Mapper
public interface CustomerDepartmentDao extends BaseDao<CustomerDepartmentEntity> {
void deleteDepartmentById(String id);
}

34
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/CustomerGridDao.java

@ -0,0 +1,34 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.entity.CustomerGridEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 客户网格表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2021-12-15
*/
@Mapper
public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
void deleteGridById(String id);
}

34
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/CustomerStaffAgencyDao.java

@ -0,0 +1,34 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.entity.CustomerStaffAgencyEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 人员-机关单位关系表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2021-12-21
*/
@Mapper
public interface CustomerStaffAgencyDao extends BaseDao<CustomerStaffAgencyEntity> {
void deleteStaffAgencyById(String id);
}

37
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/CustomerStaffDao.java

@ -0,0 +1,37 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.entity.CustomerStaffEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 政府工作人员表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2022-01-10
*/
@Mapper
public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
void deleteBatchUserIds(@Param("idLists") List<String> idLists);
}

34
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/CustomerStaffDepartmentDao.java

@ -0,0 +1,34 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.entity.CustomerStaffDepartmentEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 部门人员关系表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2021-12-21
*/
@Mapper
public interface CustomerStaffDepartmentDao extends BaseDao<CustomerStaffDepartmentEntity> {
void deleteStaffDepartmentById(String toString);
}

34
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/CustomerStaffGridDao.java

@ -0,0 +1,34 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.entity.CustomerStaffGridEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 网格人员关系表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2021-12-21
*/
@Mapper
public interface CustomerStaffGridDao extends BaseDao<CustomerStaffGridEntity> {
void deleteStaffGridById(String id);
}

37
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/StaffOrgRelationDao.java

@ -0,0 +1,37 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.entity.StaffOrgRelationEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 工作人员注册组织关系表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2022-01-19
*/
@Mapper
public interface StaffOrgRelationDao extends BaseDao<StaffOrgRelationEntity> {
void deleteBatchStaffIds(@Param("idLists")List<String> idLists);
}

13
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/SysDeptDao.java

@ -16,6 +16,9 @@ import com.elink.esua.epdc.dto.epdc.form.KpiGridIdsFormDTO;
import com.elink.esua.epdc.dto.epdc.form.UserSysDeptInfoFormDTO;
import com.elink.esua.epdc.dto.epdc.result.ExportKpiResultDTO;
import com.elink.esua.epdc.dto.epdc.result.UserSysDeptInfoResultDTO;
import com.elink.esua.epdc.entity.CustomerAgencyEntity;
import com.elink.esua.epdc.entity.CustomerDepartmentEntity;
import com.elink.esua.epdc.entity.CustomerGridEntity;
import com.elink.esua.epdc.entity.SysDeptEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -249,4 +252,14 @@ public interface SysDeptDao extends BaseDao<SysDeptEntity> {
* @return com.elink.esua.epdc.dto.DeptInfoCodeDTO
*/
DeptInfoCodeDTO selectDeptInfoCode(@Param("gridId") Long gridId);
List<String> getParents(@Param("pidList") List<String> pidList);
SysDeptEntity select(Long id);
void updateGridTotalUser(String id);
void updateDepartmentTotalUser(String id);
void updateAgencyTotalUser(String toString);
}

1
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/SysDictDao.java

@ -28,4 +28,5 @@ public interface SysDictDao extends BaseDao<SysDictEntity> {
List<SysDictEntity> getSubList(Map<String, Object> params);
SysDictEntity selectDcp();
}

19
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/SysUserDao.java

@ -12,6 +12,9 @@ import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.SysUserAnalysisOpenIdFormDTO;
import com.elink.esua.epdc.dto.SysUserDTO;
import com.elink.esua.epdc.dto.SysUserOpenIdFormDTO;
import com.elink.esua.epdc.entity.CustomerStaffAgencyEntity;
import com.elink.esua.epdc.entity.CustomerStaffDepartmentEntity;
import com.elink.esua.epdc.entity.CustomerStaffGridEntity;
import com.elink.esua.epdc.entity.SysUserEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -151,4 +154,20 @@ public interface SysUserDao extends BaseDao<SysUserEntity> {
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.SysUserDTO>>
*/
List<SysUserEntity> getGroupUserList(Map<String, Object> params);
void updateGridIdById(@Param("gridId") String deptId,@Param("id") String id);
void updateDepartmentIdById(@Param("departmentId") String deptId,@Param("id") String id);
void updateAgencyIdById(@Param("agencyId") String deptId,@Param("id") String id);
void deleteAgencyBatchIds(@Param("agencyIds") List<String> agencyIds);
void deleteDepartmentBatchIds(@Param("departmentIds") List<String> departmentIds);
void deleteGridBatchIds(@Param("gridIds") List<String> gridIds);
void updateTotalUserGridBatch(@Param("ids") List<String> customerGridIds);
void updateTotalUserDepartmentBatch(@Param("ids") List<String> customerDepartmentIds);
void updateTotalUserAgencyBatch(@Param("ids") List<String> customerAgencyIds);
}

33
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/UserDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.entity.UserEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 用户表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2022-01-10
*/
@Mapper
public interface UserDao extends BaseDao<UserEntity> {
}

125
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/CustomerAgencyEntity.java

@ -0,0 +1,125 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 机关单位信息表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2021-12-15
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epmet_gov_org.customer_agency")
public class CustomerAgencyEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 上级组织机构ID
*/
private String pid;
/**
* 所有上级组织机构ID(以英文:隔开)
*/
private String pids;
/**
* 所有上级名称,-连接
*/
private String allParentName;
/**
* 组织名称
*/
private String organizationName;
/**
* 机关级别社区级community
街道:street,
区县级: district,
市级: city
省级:province 机关级别社区级community街道:street,区县级: district,市级: city省级:province
*/
private String level;
/**
* 当前组织所属的行政地区编码
*/
private String areaCode;
/**
* 编码
*/
private String code;
/**
* 当前组织是否同步到统计库和指标库,1同步0不同步
*/
private String syncFlag;
/**
* 总人数
*/
private Integer totalUser;
/**
* 区域编码字典中的省份名称
*/
private String province;
/**
* 区域编码字典中的城市名称
*/
private String city;
/**
* 区域编码字典中的区县名称
*/
private String district;
/**
* 区域编码字典中的街道名称0409
*/
private String street;
/**
* 区域编码字典中的社区名称0409
*/
private String community;
/**
* 当前组织的上级行政地区编码add0204;举例平阴县370124对应的是济南市3701
*/
private String parentAreaCode;
}

71
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/CustomerDepartmentEntity.java

@ -0,0 +1,71 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 客户部门表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2021-12-16
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epmet_gov_org.customer_department")
public class CustomerDepartmentEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 所属机关IDcustomer_agency.id
*/
private String agencyId;
/**
* 部门名称
*/
private String departmentName;
/**
* 部门职责
*/
private String departmentDuty;
/**
* 总人数
*/
private Integer totalUser;
/**
* 部门所属的行政地区编码:实际就是所属组织的地区编码
*/
private String areaCode;
}

96
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/CustomerGridEntity.java

@ -0,0 +1,96 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 客户网格表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2021-12-15
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epmet_gov_org.customer_grid")
public class CustomerGridEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 网格名称
*/
private String gridName;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置纬度
*/
private String latitude;
/**
* 所属地区码所属组织地区码
*/
private String areaCode;
/**
* 编码
*/
private String code;
/**
* 当前网格是否同步到统计库和指标库,1同步0不同步
*/
private String syncFlag;
/**
* 管辖区域
*/
private String manageDistrict;
/**
* 当前网格总人数
*/
private Integer totalUser;
/**
* 所属组织机构IDcustomer_agency.id
*/
private String pid;
/**
* 所有上级组织ID
*/
private String pids;
}

56
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/CustomerStaffAgencyEntity.java

@ -0,0 +1,56 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 人员-机关单位关系表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2021-12-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epmet_gov_org.customer_staff_agency")
public class CustomerStaffAgencyEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 用户ID
*/
private String userId;
/**
* 组织机构ID customer_agency.id
*/
private String agencyId;
}

56
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/CustomerStaffDepartmentEntity.java

@ -0,0 +1,56 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 部门人员关系表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2021-12-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epmet_gov_org.customer_staff_department")
public class CustomerStaffDepartmentEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 用户ID
*/
private String userId;
/**
* 部门ID customer_department.id
*/
private String departmentId;
}

106
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/CustomerStaffEntity.java

@ -0,0 +1,106 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 政府工作人员表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2022-01-10
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epmet_user.customer_staff")
public class CustomerStaffEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id CUSTOMER.id
*/
private String customerId;
/**
* 关联User表的主键Id
*/
private String userId;
/**
* 真实姓名
*/
private String realName;
/**
* 性别0.未知1男2.
*/
private Integer gender;
/**
* 邮箱
*/
private String email;
/**
* 手机号-唯一键
*/
private String mobile;
/**
* 地址
*/
private String address;
/**
* fulltime专职parttime兼职
*/
private String workType;
/**
* 头像
*/
private String headPhoto;
/**
* inactive未激活active已激活
*/
private String activeFlag;
/**
* 激活时间
*/
private Date activeTime;
/**
* 未禁用enable,已禁用disabled
*/
private String enableFlag;
/**
* 登录密码
*/
private String password;
}

56
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/CustomerStaffGridEntity.java

@ -0,0 +1,56 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 网格人员关系表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2021-12-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epmet_gov_org.customer_staff_grid")
public class CustomerStaffGridEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 用户id, user.id
*/
private String userId;
/**
* 网格ID customer_grid.id
*/
private String gridId;
/**
* 客户ID
*/
private String customerId;
}

66
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/StaffOrgRelationEntity.java

@ -0,0 +1,66 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 工作人员注册组织关系表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2022-01-19
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epmet_gov_org.staff_org_relation")
public class StaffOrgRelationEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 所有上级组织机构ID(以英文:隔开)部门/网格得拼上所属组织Id
*/
private String pids;
/**
* 工作人员Id
*/
private String staffId;
/**
* 工作人员添加入口Id(agencyId;deptId;gridId)
*/
private String orgId;
/**
* 工作人员添加入口类型(组织:agency;部门:dept;网格:gridId)
*/
private String orgType;
}

56
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/entity/UserEntity.java

@ -0,0 +1,56 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 用户表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2022-01-10
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epmet_user.user")
public class UserEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private String customerId;
/**
*
*/
private String fromApp;
/**
*
*/
private String fromClient;
}

215
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/SysDeptServiceImpl.java

@ -29,7 +29,7 @@ import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.utils.TreeUtils;
import com.elink.esua.epdc.constant.RoleTypeKeyConstant;
import com.elink.esua.epdc.dao.SysDeptDao;
import com.elink.esua.epdc.dao.*;
import com.elink.esua.epdc.dto.*;
import com.elink.esua.epdc.dto.epdc.GridForLeaderRegisterDTO;
import com.elink.esua.epdc.dto.epdc.form.ExportTemplateInfoFormDTO;
@ -37,7 +37,7 @@ import com.elink.esua.epdc.dto.epdc.form.KpiGridIdsFormDTO;
import com.elink.esua.epdc.dto.epdc.form.UserSysDeptInfoFormDTO;
import com.elink.esua.epdc.dto.epdc.result.ExportKpiResultDTO;
import com.elink.esua.epdc.dto.epdc.result.UserSysDeptInfoResultDTO;
import com.elink.esua.epdc.entity.SysDeptEntity;
import com.elink.esua.epdc.entity.*;
import com.elink.esua.epdc.feign.GroupFeignClient;
import com.elink.esua.epdc.rocketmq.dto.OrganizationModifyDTO;
import com.elink.esua.epdc.rocketmq.producer.OrganizationModifyProducer;
@ -53,10 +53,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import java.util.*;
/**
* 部门管理
@ -82,6 +80,15 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
@Autowired
private OrganizationModifyProducer organizationModifyProducer;
@Resource
private CustomerAgencyDao customerAgencyDao;
@Resource
private CustomerDepartmentDao customerDepartmentDao;
@Resource
private CustomerGridDao customerGridDao;
@Resource
private SysDictDao sysDictDao;
private static final Logger logger = LoggerFactory.getLogger(SysDeptServiceImpl.class);
@Override
@ -124,7 +131,6 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(SysDeptDTO dto) {
String partyCode = dto.getPartyCode();
if (StringUtils.isNotBlank(partyCode)) {
@ -143,6 +149,60 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
Result<CompleteDeptDTO> completeDeptDtoResult = this.getCompleteDept(entity.getId().toString());
groupFeignClient.createPartyGroup(completeDeptDtoResult.getData());
}
//查询字典获取customer_id
SysDictEntity sysDictEntity = sysDictDao.selectDcp();
if (entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY)) {
//同步customer_grid
CustomerGridEntity customerGridEntity = new CustomerGridEntity();
customerGridEntity.setId(entity.getId().toString());
customerGridEntity.setCustomerId(sysDictEntity.getDictValue());
customerGridEntity.setPid(entity.getPid().toString());
customerGridEntity.setPids(StringUtils.join(StringUtils.split(entity.getPids(), ","), ":"));
customerGridEntity.setSyncFlag(NumConstant.ZERO_STR);
customerGridEntity.setGridName(entity.getName());
customerGridEntity.setManageDistrict(entity.getName());
customerGridEntity.setTotalUser(NumConstant.ZERO);
customerGridDao.insert(customerGridEntity);
//baseDao.insertCustomerGrid(customerGridEntity);
} else if (entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_DISTRICT_DEPT) || entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_STREET_DEPT)) {
//customer_department
CustomerDepartmentEntity customerDepartmentEntity = new CustomerDepartmentEntity();
customerDepartmentEntity.setId(entity.getId().toString());
customerDepartmentEntity.setAgencyId(entity.getPid().toString());
customerDepartmentEntity.setCustomerId(sysDictEntity.getDictValue());
customerDepartmentEntity.setDepartmentName(entity.getName());
customerDepartmentEntity.setDepartmentDuty(entity.getName());
customerDepartmentEntity.setTotalUser(NumConstant.ZERO);
customerDepartmentDao.insert(customerDepartmentEntity);
//baseDao.insertCustomerDepartment(customerDepartmentEntity);
} else {
//同步agency
CustomerAgencyEntity customerAgencyEntity = new CustomerAgencyEntity();
customerAgencyEntity.setId(entity.getId().toString());
customerAgencyEntity.setCustomerId(sysDictEntity.getDictValue());
customerAgencyEntity.setPid(entity.getPid().toString());
customerAgencyEntity.setPids(StringUtils.join(StringUtils.split(entity.getPids(), ","), ":"));
customerAgencyEntity.setSyncFlag(NumConstant.ZERO_STR);
customerAgencyEntity.setTotalUser(NumConstant.ZERO);
customerAgencyEntity.setOrganizationName(entity.getName());
customerAgencyEntity.setAllParentName(getAllParentName(entity.getPids()));
if (entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_DISTRICT_PARTY)) {
customerAgencyEntity.setLevel("district");
} else if (entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_STREET_PARTY)) {
customerAgencyEntity.setLevel("street");
} else if (entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_COMMUNITY_PARTY)) {
customerAgencyEntity.setLevel("community");
}
customerAgencyDao.insert(customerAgencyEntity);
//baseDao.insertCustomerAgency(customerAgencyEntity);
}
}
private String getAllParentName(String pids) {
List<String> pidList = Arrays.asList(StringUtils.split(pids, ","));
List<String> parentName = baseDao.getParents(pidList);
return StringUtils.join(parentName, "-");
}
@Override
@ -162,11 +222,125 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
}
entity.setPids(getPidList(entity.getPid()));
//更新前的数据
SysDeptEntity deptEntity = baseDao.select(dto.getId());
// 发送消息
updateById(entity);
this.baseDao.updateById(entity);
//查询字典获取customer_id
SysDictEntity sysDictEntity = sysDictDao.selectDcp();
if (deptEntity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY)) {
CustomerGridEntity customerGridEntity = customerGridDao.selectById(dto.getId().toString());
if (entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY)) {
customerGridEntity.setId(entity.getId().toString());
customerGridEntity.setPid(entity.getPid().toString());
customerGridEntity.setPids(StringUtils.join(StringUtils.split(entity.getPids(), ","), ":"));
customerGridEntity.setGridName(entity.getName());
//customerGridEntity.setManageDistrict(entity.getName());
customerGridDao.updateById(customerGridEntity);
} else if (entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_DISTRICT_DEPT) || entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_STREET_DEPT)) {
CustomerDepartmentEntity customerDepartmentEntity = new CustomerDepartmentEntity();
customerDepartmentEntity.setCustomerId(sysDictEntity.getDictValue());
packageDepartment(entity,customerDepartmentEntity);
customerDepartmentEntity.setTotalUser(customerGridEntity.getTotalUser());
customerDepartmentDao.insert(customerDepartmentEntity);
customerGridDao.deleteGridById(entity.getId().toString());
}else {
CustomerAgencyEntity customerAgencyEntity = new CustomerAgencyEntity();
customerAgencyEntity.setCustomerId(sysDictEntity.getDictValue());
packageAgency(entity,customerAgencyEntity);
customerAgencyEntity.setTotalUser(customerGridEntity.getTotalUser());
customerAgencyDao.insert(customerAgencyEntity);
customerGridDao.deleteGridById(entity.getId().toString());
}
}else if(deptEntity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_DISTRICT_DEPT) || deptEntity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_STREET_DEPT)){
CustomerDepartmentEntity customerDepartmentEntity = customerDepartmentDao.selectById(dto.getId().toString());
if (entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY)) {
CustomerGridEntity customerGridEntity = new CustomerGridEntity();
customerGridEntity.setCustomerId(sysDictEntity.getDictValue());
packageGrid(entity,customerGridEntity);
customerGridEntity.setTotalUser(customerDepartmentEntity.getTotalUser());
customerGridDao.insert(customerGridEntity);
customerDepartmentDao.deleteDepartmentById(entity.getId().toString());
} else if (entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_DISTRICT_DEPT) || entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_STREET_DEPT)) {
customerDepartmentEntity.setAgencyId(entity.getPid().toString());
customerDepartmentEntity.setDepartmentName(entity.getName());
customerDepartmentDao.updateById(customerDepartmentEntity);
}else {
CustomerAgencyEntity customerAgencyEntity = new CustomerAgencyEntity();
customerAgencyEntity.setCustomerId(sysDictEntity.getDictValue());
packageAgency(entity,customerAgencyEntity);
customerAgencyEntity.setTotalUser(customerDepartmentEntity.getTotalUser());
customerAgencyDao.insert(customerAgencyEntity);
customerDepartmentDao.deleteDepartmentById(entity.getId().toString());
}
}else {
CustomerAgencyEntity customerAgencyEntity = customerAgencyDao.selectById(dto.getId().toString());
if (entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY)) {
CustomerGridEntity customerGridEntity = new CustomerGridEntity();
customerGridEntity.setCustomerId(sysDictEntity.getDictValue());
packageGrid(entity,customerGridEntity);
customerGridEntity.setTotalUser(customerAgencyEntity.getTotalUser());
customerGridDao.insert(customerGridEntity);
customerAgencyDao.deleteAgencyById(entity.getId().toString());
} else if (entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_DISTRICT_DEPT) || entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_STREET_DEPT)) {
CustomerDepartmentEntity customerDepartmentEntity = new CustomerDepartmentEntity();
customerDepartmentEntity.setCustomerId(sysDictEntity.getDictValue());
packageDepartment(entity,customerDepartmentEntity);
customerDepartmentEntity.setTotalUser(customerAgencyEntity.getTotalUser());
customerDepartmentDao.insert(customerDepartmentEntity);
customerAgencyDao.deleteAgencyById(entity.getId().toString());
}else {
packageEntity(entity, customerAgencyEntity);
customerAgencyDao.updateById(customerAgencyEntity);
}
}
sendMqMessage(dto);
}
private void packageGrid(SysDeptEntity entity,CustomerGridEntity customerGridEntity){
customerGridEntity.setId(entity.getId().toString());
customerGridEntity.setPid(entity.getPid().toString());
customerGridEntity.setPids(StringUtils.join(StringUtils.split(entity.getPids(), ","), ":"));
customerGridEntity.setSyncFlag(NumConstant.ZERO_STR);
customerGridEntity.setGridName(entity.getName());
customerGridEntity.setManageDistrict(entity.getName());
}
private void packageAgency(SysDeptEntity entity,CustomerAgencyEntity customerAgencyEntity){
customerAgencyEntity.setId(entity.getId().toString());
customerAgencyEntity.setPid(entity.getPid().toString());
customerAgencyEntity.setPids(StringUtils.join(StringUtils.split(entity.getPids(), ","), ":"));
customerAgencyEntity.setSyncFlag(NumConstant.ZERO_STR);
customerAgencyEntity.setOrganizationName(entity.getName());
customerAgencyEntity.setAllParentName(getAllParentName(entity.getPids()));
if (entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_DISTRICT_PARTY)) {
customerAgencyEntity.setLevel("district");
} else if (entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_STREET_PARTY)) {
customerAgencyEntity.setLevel("street");
} else if (entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_COMMUNITY_PARTY)) {
customerAgencyEntity.setLevel("community");
}
}
private void packageDepartment(SysDeptEntity entity,CustomerDepartmentEntity customerDepartmentEntity){
customerDepartmentEntity.setId(entity.getId().toString());
customerDepartmentEntity.setAgencyId(entity.getPid().toString());
customerDepartmentEntity.setDepartmentName(entity.getName());
customerDepartmentEntity.setDepartmentDuty(entity.getName());
}
private void packageEntity(SysDeptEntity entity, CustomerAgencyEntity customerAgencyEntity) {
customerAgencyEntity.setPid(entity.getPid().toString());
customerAgencyEntity.setPids(entity.getPids());
customerAgencyEntity.setOrganizationName(entity.getName());
customerAgencyEntity.setAllParentName(getAllParentName(entity.getPids()));
if (entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_DISTRICT_PARTY)) {
customerAgencyEntity.setLevel("district");
} else if (entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_DISTRICT_DEPT) || entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_STREET_PARTY)) {
customerAgencyEntity.setLevel("street");
} else if (entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_STREET_DEPT) || entity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_COMMUNITY_PARTY)) {
customerAgencyEntity.setLevel("community");
}
}
@Override
@Transactional(rollbackFor = Exception.class)
@ -353,10 +527,12 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
public DeptOption getUserDeptOption() {
return getUserDeptOption(SecurityUser.getUserId());
}
@Override
public DeptOption getDeptAuthByUser() {
return getDeptAuthByUser(SecurityUser.getUserId());
}
@Override
public List<DeptGridDTO> getGridAuthByUser() {
// 用户拥有的所有部门权限
@ -388,6 +564,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
}
return (DeptOption) obj;
}
/**
* 根据userId从redis取出用户部门层级关系街道-社区-网格
*
@ -617,10 +794,11 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
}
}
/**
* 组装部门层级结构
*
* @param userId 用户id
* @param userId 用户id
* @return void
* @author work@yujt.net.cn
* @date 2020/1/28 10:49
@ -720,6 +898,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
result.put("pids", parentDeptIdList);
return result;
}
/**
* 组装下级结构节点
*
@ -769,9 +948,9 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
nodeParent.put("children", childrenNodeList);
}
}
if(allParentNode.size() == 0){
if (allParentNode.size() == 0) {
for (int index = 0; index < childDepts.size(); index++) {
JSONObject node = new JSONObject();
JSONObject node = new JSONObject();
node.put("label", childDepts.get(index).getName());
node.put("value", String.valueOf(childDepts.get(index).getId()));
allParentNode.add(node);
@ -793,6 +972,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
result.put("scope", dataScopeDeptList);
return result;
}
@Override
public void packgeAllDeptOption() {
List<DeptTreeDTO> deptList = baseDao.selectListDeptTree();
@ -1049,10 +1229,10 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
@Override
public List<UserSysDeptInfoResultDTO> listAllDeptInfo(UserSysDeptInfoFormDTO formDTO) {
Map<String, Object> map = new HashMap<>();
if (formDTO.getTypeKeyList() != null && formDTO.getTypeKeyList().size() >0) {
if (formDTO.getTypeKeyList() != null && formDTO.getTypeKeyList().size() > 0) {
map.put("typeKey", formDTO.getTypeKeyList().get(0));
}
if (formDTO.getDeptIdList() != null && formDTO.getDeptIdList().size() >0) {
if (formDTO.getDeptIdList() != null && formDTO.getDeptIdList().size() > 0) {
map.put("deptId", formDTO.getDeptIdList());
}
if (formDTO.getDeptName() != null && formDTO.getDeptName() != "") {
@ -1081,11 +1261,10 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
}
/**
*
* 组织机构名称修改发送MQ消息
*
* @params [dto]
* @return void
* @params [dto]
* @author liuchuang
* @since 2020/3/6 21:34
*/
@ -1101,13 +1280,13 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
body.setTypeKey(entity.getTypeKey());
body.setParentDeptIds(entity.getPids());
body.setAllDeptIds(entity.getPids() + "," + entity.getId());
String allDeptNames = (completeDept.getDistrictId() !=null ? completeDept.getDistrict() + "-":"") + (completeDept.getStreetId() !=null ? completeDept.getStreet() + "-":"") + (completeDept.getCommunityId() !=null ? completeDept.getCommunity() + "-":"") + (completeDept.getGridId() !=null ? completeDept.getGrid() :"");
String parentDeptNames = (completeDept.getDistrictId() !=null ? completeDept.getDistrict() + "-":"") + (completeDept.getStreetId() !=null ? completeDept.getStreet() + "-":"") + (completeDept.getCommunityId() !=null ? completeDept.getCommunity():"");
String allDeptNames = (completeDept.getDistrictId() != null ? completeDept.getDistrict() + "-" : "") + (completeDept.getStreetId() != null ? completeDept.getStreet() + "-" : "") + (completeDept.getCommunityId() != null ? completeDept.getCommunity() + "-" : "") + (completeDept.getGridId() != null ? completeDept.getGrid() : "");
String parentDeptNames = (completeDept.getDistrictId() != null ? completeDept.getDistrict() + "-" : "") + (completeDept.getStreetId() != null ? completeDept.getStreet() + "-" : "") + (completeDept.getCommunityId() != null ? completeDept.getCommunity() : "");
body.setAllDeptNames(allDeptNames);
body.setParentDeptNames(parentDeptNames);
organizationModifyProducer.sendMessage(RocketMqConstant.MQ_TOPIC_ORGANIZATION, RocketMqConstant.MQ_TAG_ORGANIZATION,
dto.getId().toString(), JSONObject.toJSONString(body));
System.out.println("部门更新"+body.toString());
System.out.println("部门更新" + body.toString());
}
}

352
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/SysUserServiceImpl.java

@ -10,12 +10,14 @@ package com.elink.esua.epdc.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.enums.DelFlagEnum;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.Constant;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
import com.elink.esua.epdc.commons.tools.constant.OrganizationTypeConstant;
import com.elink.esua.epdc.commons.tools.enums.SuperAdminEnum;
import com.elink.esua.epdc.commons.tools.exception.ErrorCode;
import com.elink.esua.epdc.commons.tools.exception.RenException;
@ -25,7 +27,7 @@ import com.elink.esua.epdc.commons.tools.security.user.SecurityUser;
import com.elink.esua.epdc.commons.tools.security.user.UserDetail;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dao.SysUserDao;
import com.elink.esua.epdc.dao.*;
import com.elink.esua.epdc.dto.ModifyPwdDTO;
import com.elink.esua.epdc.dto.SysUserAnalysisOpenIdFormDTO;
import com.elink.esua.epdc.dto.SysUserDTO;
@ -33,21 +35,21 @@ import com.elink.esua.epdc.dto.SysUserOpenIdFormDTO;
import com.elink.esua.epdc.dto.epdc.GridForLeaderRegisterDTO;
import com.elink.esua.epdc.dto.epdc.GridLeaderRegisterDTO;
import com.elink.esua.epdc.dto.epdc.result.UserWorkAndAnalyOpenIdDTO;
import com.elink.esua.epdc.entity.SysUserEntity;
import com.elink.esua.epdc.entity.*;
import com.elink.esua.epdc.feign.UserRelationFeignClient;
import com.elink.esua.epdc.service.SysDeptService;
import com.elink.esua.epdc.service.SysRoleUserService;
import com.elink.esua.epdc.service.SysUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
* 用户管理
@ -63,7 +65,29 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
@Autowired
private SysDeptService sysDeptService;
@Autowired
private UserRelationFeignClient userRelationFeignClient;
private UserRelationFeignClient userRelationFeignClient;
@Resource
private SysDeptDao sysDeptDao;
@Resource
private CustomerGridDao customerGridDao;
@Resource
private CustomerDepartmentDao customerDepartmentDao;
@Resource
private CustomerAgencyDao customerAgencyDao;
@Resource
private CustomerStaffAgencyDao customerStaffAgencyDao;
@Resource
private CustomerStaffDepartmentDao customerStaffDepartmentDao;
@Resource
private CustomerStaffGridDao customerStaffGridDao;
@Resource
private SysDictDao sysDictDao;
@Resource
private UserDao userDao;
@Resource
private CustomerStaffDao customerStaffDao;
@Resource
private StaffOrgRelationDao staffOrgRelationDao;
@Override
public PageData<SysUserDTO> page(Map<String, Object> params) {
@ -134,6 +158,70 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
entity.setSuperAdmin(SuperAdminEnum.NO.value());
insert(entity);
//查询字典获取customer_id
SysDictEntity sysDictEntity = sysDictDao.selectDcp();
//查询用户部门信息
SysDeptEntity deptEntity = sysDeptDao.select(dto.getDeptId());
//同步customer_staff,user
UserEntity userEntity = new UserEntity();
userEntity.setId(entity.getId().toString());
userEntity.setCustomerId(sysDictEntity.getDictValue());
userEntity.setFromApp("gov");
userEntity.setFromClient("web");
userDao.insert(userEntity);
if (entity.getUserTagKey().equals("offers")) {
//插入customer_staff
CustomerStaffEntity customerStaffEntity = ConvertUtils.sourceToTarget(entity, CustomerStaffEntity.class);
customerStaffEntity.setCustomerId(sysDictEntity.getDictValue());
customerStaffEntity.setUserId(userEntity.getId());
customerStaffEntity.setHeadPhoto(entity.getHeadUrl());
customerStaffEntity.setWorkType("fulltime");
customerStaffEntity.setActiveFlag("active");
customerStaffEntity.setActiveTime(new Date());
customerStaffEntity.setEnableFlag("enable");
customerStaffDao.insert(customerStaffEntity);
//插入staff_org_relation
String typeKey = deptEntity.getTypeKey();
StaffOrgRelationEntity staffOrgRelationEntity = new StaffOrgRelationEntity();
staffOrgRelationEntity.setId(entity.getId().toString());
staffOrgRelationEntity.setCustomerId(sysDictEntity.getDictValue());
staffOrgRelationEntity.setStaffId(entity.getId().toString());
staffOrgRelationEntity.setPids(StringUtils.join(StringUtils.split(deptEntity.getPids(), ","), ":"));
staffOrgRelationEntity.setOrgId(deptEntity.getId().toString());
if (OrganizationTypeConstant.ORG_TYPE_GRID_PARTY.equals(typeKey)) {
staffOrgRelationEntity.setOrgType("grid");
} else if (OrganizationTypeConstant.ORG_TYPE_DISTRICT_DEPT.equals(typeKey) || OrganizationTypeConstant.ORG_TYPE_STREET_DEPT.equals(typeKey)) {
staffOrgRelationEntity.setOrgType("dept");
} else {
staffOrgRelationEntity.setOrgType("agency");
}
staffOrgRelationDao.insert(staffOrgRelationEntity);
}
//更新组织totalUser,同步org 三张表
if (deptEntity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY)) {
sysDeptDao.updateGridTotalUser(dto.getDeptId().toString());
//同步插入customer_staff_grid
CustomerStaffGridEntity gridEntity = new CustomerStaffGridEntity();
gridEntity.setCustomerId(sysDictEntity.getDictValue());
packageGrid(entity, gridEntity);
customerStaffGridDao.insert(gridEntity);
} else if (deptEntity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_DISTRICT_DEPT) || deptEntity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_STREET_DEPT)) {
sysDeptDao.updateDepartmentTotalUser(dto.getDeptId().toString());
//同步插入customer_staff_department
CustomerStaffDepartmentEntity departmentEntity = new CustomerStaffDepartmentEntity();
departmentEntity.setCustomerId(sysDictEntity.getDictValue());
packageDepartment(entity, departmentEntity);
customerStaffDepartmentDao.insert(departmentEntity);
} else {
sysDeptDao.updateAgencyTotalUser(dto.getDeptId().toString());
//同步插入customer_staff_agency
CustomerStaffAgencyEntity agencyEntity = new CustomerStaffAgencyEntity();
agencyEntity.setCustomerId(sysDictEntity.getDictValue());
packageAgency(entity, agencyEntity);
customerStaffAgencyDao.insert(agencyEntity);
}
//保存角色用户关系
sysRoleUserService.saveOrUpdate(entity.getId(), dto.getRoleIdList());
}
@ -154,13 +242,181 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
entity.setPassword(password);
}
//更新前用户和机构信息
SysUserEntity sysUserEntity = baseDao.selectById(dto.getId());
SysDeptEntity sysDeptEntity = sysDeptDao.select(sysUserEntity.getDeptId());
//更新用户
updateById(entity);
//查询字典获取customer_id
SysDictEntity sysDictEntity = sysDictDao.selectDcp();
SysDeptEntity deptEntity = sysDeptDao.select(entity.getDeptId());
//更新customer_staff
if (dto.getUserTagKey().equals("offers")) {
QueryWrapper<CustomerStaffEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("USER_ID", dto.getId().toString());
CustomerStaffEntity customerStaffEntity = customerStaffDao.selectOne(queryWrapper);
customerStaffEntity.setRealName(dto.getRealName());
customerStaffEntity.setGender(dto.getGender());
customerStaffEntity.setEmail(dto.getEmail());
customerStaffEntity.setMobile(dto.getMobile());
if (StringUtils.isNotEmpty(dto.getPassword())) {
customerStaffEntity.setPassword(PasswordUtils.encode(dto.getPassword()));
}
customerStaffEntity.setHeadPhoto(dto.getHeadUrl());
customerStaffDao.updateById(customerStaffEntity);
//同步更新staff_org_relation
QueryWrapper<StaffOrgRelationEntity> wrapper = new QueryWrapper<>();
wrapper.eq("STAFF_ID",dto.getId().toString());
StaffOrgRelationEntity staffOrgRelationEntity = staffOrgRelationDao.selectOne(wrapper);
String typeKey = deptEntity.getTypeKey();
staffOrgRelationEntity.setPids(StringUtils.join(StringUtils.split(deptEntity.getPids(), ","), ":"));
staffOrgRelationEntity.setOrgId(deptEntity.getId().toString());
if (OrganizationTypeConstant.ORG_TYPE_GRID_PARTY.equals(typeKey)) {
staffOrgRelationEntity.setOrgType("grid");
} else if (OrganizationTypeConstant.ORG_TYPE_DISTRICT_DEPT.equals(typeKey) || OrganizationTypeConstant.ORG_TYPE_STREET_DEPT.equals(typeKey)) {
staffOrgRelationEntity.setOrgType("dept");
} else {
staffOrgRelationEntity.setOrgType("agency");
}
staffOrgRelationDao.updateById(staffOrgRelationEntity);
}
if (!sysUserEntity.getDeptId().equals(entity.getDeptId())) {
//更新后用户的机构信息
if (sysDeptEntity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY)) {
//原来的组织部门totol_user -1
updateGridTotalUserBefore(sysDeptEntity);
if (deptEntity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY)) {
baseDao.updateGridIdById(entity.getDeptId().toString(), entity.getId().toString());
//更新后的total_user +1
updateGridTotalUserAfter(deptEntity);
} else if (deptEntity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_DISTRICT_DEPT) || deptEntity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_STREET_DEPT)) {
CustomerStaffDepartmentEntity departmentEntity = new CustomerStaffDepartmentEntity();
departmentEntity.setCustomerId(sysDictEntity.getDictValue());
packageDepartment(entity, departmentEntity);
customerStaffDepartmentDao.insert(departmentEntity);
customerStaffGridDao.deleteStaffGridById(entity.getId().toString());
//更新后的total_user +1
updateDepartmentTotalUserAfter(deptEntity);
} else {
CustomerStaffAgencyEntity agencyEntity = new CustomerStaffAgencyEntity();
agencyEntity.setCustomerId(sysDictEntity.getDictValue());
packageAgency(entity, agencyEntity);
customerStaffAgencyDao.insert(agencyEntity);
customerStaffGridDao.deleteStaffGridById(entity.getId().toString());
//更新后的total_user +1
updateAgencyTotalUserAfter(deptEntity);
}
} else if (sysDeptEntity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_DISTRICT_DEPT) || sysDeptEntity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_STREET_DEPT)) {
//原来的组织部门totol_user -1
updateDepartmentTotalUserBefore(sysDeptEntity);
if (deptEntity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY)) {
CustomerStaffGridEntity gridEntity = new CustomerStaffGridEntity();
gridEntity.setCustomerId(sysDictEntity.getDictValue());
packageGrid(entity, gridEntity);
customerStaffGridDao.insert(gridEntity);
customerStaffDepartmentDao.deleteStaffDepartmentById(entity.getId().toString());
//更新后的total_user +1
updateGridTotalUserAfter(deptEntity);
} else if (deptEntity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_DISTRICT_DEPT) || deptEntity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_STREET_DEPT)) {
baseDao.updateDepartmentIdById(entity.getDeptId().toString(), entity.getId().toString());
//更新后的total_user +1
updateDepartmentTotalUserAfter(deptEntity);
} else {
CustomerStaffAgencyEntity agencyEntity = new CustomerStaffAgencyEntity();
agencyEntity.setCustomerId(sysDictEntity.getDictValue());
packageAgency(entity, agencyEntity);
customerStaffAgencyDao.insert(agencyEntity);
customerStaffDepartmentDao.deleteStaffDepartmentById(entity.getId().toString());
//更新后的total_user +1
updateAgencyTotalUserAfter(deptEntity);
}
} else {
//原来的组织部门totol_user -1
updateAgencyTotalUserBefore(sysDeptEntity);
if (deptEntity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY)) {
CustomerStaffGridEntity gridEntity = new CustomerStaffGridEntity();
gridEntity.setCustomerId(sysDictEntity.getDictValue());
packageGrid(entity, gridEntity);
customerStaffGridDao.insert(gridEntity);
customerStaffAgencyDao.deleteStaffAgencyById(entity.getId().toString());
//更新后的total_user +1
updateGridTotalUserAfter(deptEntity);
} else if (deptEntity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_DISTRICT_DEPT) || deptEntity.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_STREET_DEPT)) {
CustomerStaffDepartmentEntity departmentEntity = new CustomerStaffDepartmentEntity();
departmentEntity.setCustomerId(sysDictEntity.getDictValue());
packageDepartment(entity, departmentEntity);
customerStaffDepartmentDao.insert(departmentEntity);
customerStaffAgencyDao.deleteStaffAgencyById(entity.getId().toString());
//更新后的total_user +1
updateDepartmentTotalUserAfter(deptEntity);
} else {
baseDao.updateAgencyIdById(entity.getDeptId().toString(), entity.getId().toString());
//更新后的total_user +1
updateAgencyTotalUserAfter(deptEntity);
}
}
}
//更新角色用户关系
sysRoleUserService.saveOrUpdate(entity.getId(), dto.getRoleIdList());
}
private void updateAgencyTotalUserAfter(SysDeptEntity deptEntity) {
CustomerAgencyEntity customerAgencyEntity = customerAgencyDao.selectById(deptEntity.getId().toString());
customerAgencyEntity.setTotalUser(customerAgencyEntity.getTotalUser() + 1);
customerAgencyDao.updateById(customerAgencyEntity);
}
private void updateDepartmentTotalUserAfter(SysDeptEntity deptEntity) {
CustomerDepartmentEntity customerDepartmentEntity = customerDepartmentDao.selectById(deptEntity.getId().toString());
customerDepartmentEntity.setTotalUser(customerDepartmentEntity.getTotalUser() + 1);
customerDepartmentDao.updateById(customerDepartmentEntity);
}
private void updateAgencyTotalUserBefore(SysDeptEntity sysDeptEntity) {
CustomerAgencyEntity customerAgencyEntity = customerAgencyDao.selectById(sysDeptEntity.getId().toString());
customerAgencyEntity.setTotalUser(customerAgencyEntity.getTotalUser() - 1);
customerAgencyDao.updateById(customerAgencyEntity);
}
private void updateDepartmentTotalUserBefore(SysDeptEntity sysDeptEntity) {
CustomerDepartmentEntity customerDepartmentEntity = customerDepartmentDao.selectById(sysDeptEntity.getId().toString());
customerDepartmentEntity.setTotalUser(customerDepartmentEntity.getTotalUser() - 1);
customerDepartmentDao.updateById(customerDepartmentEntity);
}
private void updateGridTotalUserBefore(SysDeptEntity sysDeptEntity) {
CustomerGridEntity customerGridEntityBefore = customerGridDao.selectById(sysDeptEntity.getId().toString());
customerGridEntityBefore.setTotalUser(customerGridEntityBefore.getTotalUser() - 1);
customerGridDao.updateById(customerGridEntityBefore);
}
private void updateGridTotalUserAfter(SysDeptEntity deptEntity) {
CustomerGridEntity customerGridEntityAfter = customerGridDao.selectById(deptEntity.getId().toString());
customerGridEntityAfter.setTotalUser(customerGridEntityAfter.getTotalUser() + 1);
customerGridDao.updateById(customerGridEntityAfter);
}
private void packageGrid(SysUserEntity entity, CustomerStaffGridEntity gridEntity) {
gridEntity.setId(entity.getId().toString());
gridEntity.setUserId(entity.getId().toString());
gridEntity.setGridId(entity.getDeptId().toString());
}
private void packageDepartment(SysUserEntity entity, CustomerStaffDepartmentEntity departmentEntity) {
departmentEntity.setId(entity.getId().toString());
departmentEntity.setUserId(entity.getId().toString());
departmentEntity.setDepartmentId(entity.getDeptId().toString());
}
private void packageAgency(SysUserEntity entity, CustomerStaffAgencyEntity agencyEntity) {
agencyEntity.setId(entity.getId().toString());
agencyEntity.setUserId(entity.getId().toString());
agencyEntity.setAgencyId(entity.getDeptId().toString());
}
/**
* 用户名与手机号查重
*
@ -189,6 +445,59 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
logicDelete(ids, SysUserEntity.class);
//角色用户关系,需要保留,不然逻辑删除就变成物理删除了
//逻辑删除user,customer_staff,staff_org_relation
List<String> idLists = Arrays.asList(ids).stream().map(x -> x.toString()).collect(Collectors.toList());
userDao.deleteBatchIds(idLists);
customerStaffDao.deleteBatchUserIds(idLists);
staffOrgRelationDao.deleteBatchStaffIds(idLists);
//物理删除组织用户
List<SysUserEntity> sysUserEntities = baseDao.selectBatchIds(Arrays.asList(ids));
List<String> deptIds = sysUserEntities.stream().map(x -> x.getDeptId().toString()).collect(Collectors.toList());
List<SysDeptEntity> sysDeptEntities = sysDeptDao.selectBatchIds(deptIds);
List<String> agencyIds = new ArrayList<>();
List<String> departmentIds = new ArrayList<>();
List<String> gridIds = new ArrayList<>();
List<String> customerGridIds = new ArrayList<>();
List<String> customerDepartmentIds = new ArrayList<>();
List<String> customerAgencyIds = new ArrayList<>();
sysDeptEntities.forEach(x -> {
if (x.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_GRID_PARTY)) {
customerGridIds.add(x.getId().toString());
sysUserEntities.forEach(y -> {
if (y.getDeptId().equals(x.getId())) {
gridIds.add(y.getId().toString());
}
});
} else if (x.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_DISTRICT_DEPT) || x.getTypeKey().equals(OrganizationTypeConstant.ORG_TYPE_STREET_DEPT)) {
customerDepartmentIds.add(x.getId().toString());
sysUserEntities.forEach(y -> {
if (y.getDeptId().equals(x.getId())) {
departmentIds.add(y.getId().toString());
}
});
} else {
customerAgencyIds.add(x.getId().toString());
sysUserEntities.forEach(y -> {
if (y.getDeptId().equals(x.getId())) {
agencyIds.add(y.getId().toString());
}
});
}
});
//批量物理删除组织用户, 批量更新组织部门totalUser
if (CollectionUtils.isNotEmpty(agencyIds)) {
baseDao.deleteAgencyBatchIds(agencyIds);
baseDao.updateTotalUserAgencyBatch(customerAgencyIds);
}
if (CollectionUtils.isNotEmpty(departmentIds)) {
baseDao.deleteDepartmentBatchIds(departmentIds);
baseDao.updateTotalUserDepartmentBatch(customerDepartmentIds);
}
if (CollectionUtils.isNotEmpty(gridIds)) {
baseDao.deleteGridBatchIds(gridIds);
baseDao.updateTotalUserGridBatch(customerGridIds);
}
}
@Override
@ -272,7 +581,6 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
}
@Override
public SysUserDTO getSysUserInfoByOpenId(String openId) {
return baseDao.selectOneOfSysUserByOpenId(openId);
@ -296,8 +604,8 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
@Override
public Result<List<String>> getUserPhoneByListDeptId(List<Long> deptId) {
Map<String,Object> map = new HashMap<>();
map.put("deptId",deptId);
Map<String, Object> map = new HashMap<>();
map.put("deptId", deptId);
List<String> list = baseDao.getUserPhoneByListDeptId(map);
return new Result<List<String>>().ok(list);
}
@ -311,12 +619,12 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
public Result checkUpdateAvatar() {
String userId = SecurityUser.getUser().getId().toString();
SysUserEntity userInfo = baseDao.selectById(userId);
if(userInfo==null || userInfo.getDelFlag()==1 || userInfo.getStatus()==0){
if (userInfo == null || userInfo.getDelFlag() == 1 || userInfo.getStatus() == 0) {
throw new RenException("未查到次用户信息或此用户被停用!");
}
if(StringUtils.isNotBlank(userInfo.getHeadUrl())){
if (StringUtils.isNotBlank(userInfo.getHeadUrl())) {
return new Result().ok(false);
}else{
} else {
return new Result().ok(true);
}
}
@ -324,7 +632,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
@Transactional
@Override
public Result updateAvatar(String avatar) {
if(StringUtils.isBlank(avatar)){
if (StringUtils.isBlank(avatar)) {
throw new RenException("头像地址不可为空");
}
String userId = SecurityUser.getUser().getId().toString();
@ -348,7 +656,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
/**
* @Description: 根据userId查询 工作端和数据端userId
* @Param: []
* @return: com.elink.esua.epdc.commons.tools.utils.Result<java.util.Map<java.lang.String,java.util.List<java.lang.String>>>
* @return: com.elink.esua.epdc.commons.tools.utils.Result<java.util.Map < java.lang.String, java.util.List < java.lang.String>>>
* @Author: wk
* @Date: 2020/5/26
*/
@ -360,14 +668,14 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
return new Result().error("获取数据失败,请稍后再试");
}
//2.获得两项openId
log.info("获取数据"+userList.get(0));
List<String> workOpenIds = baseDao.selectListOpenIds(userList,"1");
log.info("获取数据" + userList.get(0));
List<String> workOpenIds = baseDao.selectListOpenIds(userList, "1");
openIdDto.setWorkOpenIds(workOpenIds);
log.info("获取数据工作端:"+workOpenIds.size());
List<String> AnalysisOpenIds = baseDao.selectListOpenIds(userList,"2");
log.info("获取数据数据端:"+AnalysisOpenIds.size());
log.info("获取数据工作端:" + workOpenIds.size());
List<String> AnalysisOpenIds = baseDao.selectListOpenIds(userList, "2");
log.info("获取数据数据端:" + AnalysisOpenIds.size());
openIdDto.setAnalyOpenIds(AnalysisOpenIds);
return new Result<UserWorkAndAnalyOpenIdDTO>().ok(openIdDto);
return new Result<UserWorkAndAnalyOpenIdDTO>().ok(openIdDto);
}
@Override
@ -375,7 +683,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
String userIds = params.get("userIds").toString();
String[] userIdsArr = userIds.split(",");
List<String> userIdList = Arrays.asList(userIdsArr);
params.put("userIdList",userIdList);
params.put("userIdList", userIdList);
//转换成like
paramsToLike(params, "username");
paramsToLike(params, "realname");

8
esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/application-test.yml

@ -8,9 +8,9 @@ spring:
datasource:
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://118.190.232.100:3308/esua_epdc_admin?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
username: epdc
password: elink833066
url: jdbc:mysql://rm-bp1l2b53j508j1176xo.mysql.rds.aliyuncs.com:3306/esua_epdc_admin?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: Abc@123456
initial-size: 10
max-active: 100
min-idle: 10
@ -33,4 +33,4 @@ spring:
stat:
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: false
merge-sql: false

36
esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.dao.CustomerAgencyDao">
<resultMap type="com.elink.esua.epdc.entity.CustomerAgencyEntity" id="customerAgencyMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="pid" column="PID"/>
<result property="pids" column="PIDS"/>
<result property="allParentName" column="ALL_PARENT_NAME"/>
<result property="organizationName" column="ORGANIZATION_NAME"/>
<result property="level" column="LEVEL"/>
<result property="areaCode" column="AREA_CODE"/>
<result property="code" column="CODE"/>
<result property="syncFlag" column="SYNC_FLAG"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
<result property="totalUser" column="TOTAL_USER"/>
<result property="province" column="PROVINCE"/>
<result property="city" column="CITY"/>
<result property="district" column="DISTRICT"/>
<result property="street" column="STREET"/>
<result property="community" column="COMMUNITY"/>
<result property="parentAreaCode" column="PARENT_AREA_CODE"/>
</resultMap>
<delete id="deleteAgencyById">
delete from epmet_gov_org.customer_agency where id =#{id}
</delete>
</mapper>

26
esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/CustomerDepartmentDao.xml

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.dao.CustomerDepartmentDao">
<resultMap type="com.elink.esua.epdc.entity.CustomerDepartmentEntity" id="customerDepartmentMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="departmentName" column="DEPARTMENT_NAME"/>
<result property="departmentDuty" column="DEPARTMENT_DUTY"/>
<result property="totalUser" column="TOTAL_USER"/>
<result property="areaCode" column="AREA_CODE"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<delete id="deleteDepartmentById">
delete from epmet_gov_org.customer_department where id =#{id}
</delete>
</mapper>

31
esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/CustomerGridDao.xml

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.dao.CustomerGridDao">
<resultMap type="com.elink.esua.epdc.entity.CustomerGridEntity" id="customerGridMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="gridName" column="GRID_NAME"/>
<result property="longitude" column="LONGITUDE"/>
<result property="latitude" column="LATITUDE"/>
<result property="areaCode" column="AREA_CODE"/>
<result property="code" column="CODE"/>
<result property="syncFlag" column="SYNC_FLAG"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
<result property="manageDistrict" column="MANAGE_DISTRICT"/>
<result property="totalUser" column="TOTAL_USER"/>
<result property="pid" column="PID"/>
<result property="pids" column="PIDS"/>
</resultMap>
<delete id="deleteGridById">
delete from epmet_gov_org.customer_grid where id =#{id}
</delete>
</mapper>

23
esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.dao.CustomerStaffAgencyDao">
<resultMap type="com.elink.esua.epdc.entity.CustomerStaffAgencyEntity" id="customerStaffAgencyMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="userId" column="USER_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<delete id="deleteStaffAgencyById">
delete from epmet_gov_org.customer_staff_agency where id =#{id}
</delete>
</mapper>

36
esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/CustomerStaffDao.xml

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.dao.CustomerStaffDao">
<resultMap type="com.elink.esua.epdc.entity.CustomerStaffEntity" id="customerStaffMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="userId" column="USER_ID"/>
<result property="realName" column="REAL_NAME"/>
<result property="gender" column="GENDER"/>
<result property="email" column="EMAIL"/>
<result property="mobile" column="MOBILE"/>
<result property="address" column="ADDRESS"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
<result property="workType" column="WORK_TYPE"/>
<result property="headPhoto" column="HEAD_PHOTO"/>
<result property="activeFlag" column="ACTIVE_FLAG"/>
<result property="activeTime" column="ACTIVE_TIME"/>
<result property="enableFlag" column="ENABLE_FLAG"/>
<result property="password" column="PASSWORD"/>
</resultMap>
<update id="deleteBatchUserIds">
update epmet_user.customer_staff set DEL_FLAG = '1' where USER_ID in
<foreach collection="idLists" item="userId" separator="," open="(" close=")">
#{userId}
</foreach>
</update>
</mapper>

23
esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.dao.CustomerStaffDepartmentDao">
<resultMap type="com.elink.esua.epdc.entity.CustomerStaffDepartmentEntity" id="customerStaffDepartmentMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="userId" column="USER_ID"/>
<result property="departmentId" column="DEPARTMENT_ID"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<delete id="deleteStaffDepartmentById">
delete from epmet_gov_org.customer_staff_department where id =#{id}
</delete>
</mapper>

23
esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/CustomerStaffGridDao.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.dao.CustomerStaffGridDao">
<resultMap type="com.elink.esua.epdc.entity.CustomerStaffGridEntity" id="customerStaffGridMap">
<result property="id" column="ID"/>
<result property="userId" column="USER_ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<delete id="deleteStaffGridById">
delete from epmet_gov_org.customer_staff_grid where id =#{id}
</delete>
</mapper>

28
esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/StaffOrgRelationDao.xml

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.dao.StaffOrgRelationDao">
<resultMap type="com.elink.esua.epdc.entity.StaffOrgRelationEntity" id="staffOrgRelationMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="pids" column="PIDS"/>
<result property="staffId" column="STAFF_ID"/>
<result property="orgId" column="ORG_ID"/>
<result property="orgType" column="ORG_TYPE"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<update id="deleteBatchStaffIds">
update epmet_gov_org.staff_org_relation set DEL_FLAG = '1' where STAFF_ID in
<foreach collection="idLists" item="staffId" separator="," open="(" close=")">
#{staffId}
</foreach>
</update>
</mapper>

23
esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/SysDeptDao.xml

@ -442,4 +442,27 @@
and s.del_flag=0
and g.id=#{gridId}
</select>
<select id="getParents" resultType="java.lang.String">
select t.name from sys_dept t where id in
<foreach collection="pidList" item="pid" separator="," open="(" close=")">
#{pid}
</foreach>
</select>
<select id="select" resultType="com.elink.esua.epdc.entity.SysDeptEntity">
select * from sys_dept where id =#{id}
</select>
<update id="updateGridTotalUser">
update epmet_gov_org.customer_grid set TOTAL_USER =TOTAL_USER+1 where id =#{id}
</update>
<update id="updateDepartmentTotalUser">
update epmet_gov_org.customer_department set TOTAL_USER =TOTAL_USER+1 where id =#{id}
</update>
<update id="updateAgencyTotalUser">
update epmet_gov_org.customer_agency set TOTAL_USER =TOTAL_USER+1 where id =#{id}
</update>
</mapper>

4
esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/SysDictDao.xml

@ -8,4 +8,8 @@
SELECT * FROM sys_dict WHERE pid = #{pid} and del_flag = '0'
</select>
<select id="selectDcp" resultType="com.elink.esua.epdc.entity.SysDictEntity">
SELECT * FROM sys_dict WHERE pid != '0' and del_flag = '0' and dict_type ='dcp'
</select>
</mapper>

69
esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/SysUserDao.xml

@ -234,4 +234,73 @@
ORDER BY t1.create_date desc
</select>
<update id="updateGridIdById">
update epmet_gov_org.customer_staff_grid
set GRID_ID=#{gridId}
where id =#{id}
</update>
<update id="updateDepartmentIdById">
update epmet_gov_org.customer_staff_department
set DEPARTMENT_ID=#{departmentId}
where id =#{id}
</update>
<update id="updateAgencyIdById">
update epmet_gov_org.customer_staff_agency
set AGENCY_ID=#{agencyId}
where id =#{id}
</update>
<delete id="deleteAgencyBatchIds">
delete from epmet_gov_org.customer_staff_agency
where id in
<foreach collection="agencyIds" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</delete>
<delete id="deleteDepartmentBatchIds">
delete from epmet_gov_org.customer_staff_department
where id in
<foreach collection="departmentIds" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</delete>
<delete id="deleteGridBatchIds">
delete from epmet_gov_org.customer_staff_grid
where id in
<foreach collection="gridIds" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</delete>
<update id="updateTotalUserGridBatch">
update epmet_gov_org.customer_grid
set TOTAL_USER = TOTAL_USER-1
where id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</update>
<update id="updateTotalUserDepartmentBatch">
update epmet_gov_org.customer_department
set TOTAL_USER = TOTAL_USER-1
where id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</update>
<update id="updateTotalUserAgencyBatch">
update epmet_gov_org.customer_Agency
set TOTAL_USER = TOTAL_USER-1
where id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</update>
</mapper>

20
esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/UserDao.xml

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.dao.UserDao">
<resultMap type="com.elink.esua.epdc.entity.UserEntity" id="userMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="fromApp" column="FROM_APP"/>
<result property="fromClient" column="FROM_CLIENT"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>

7
esua-epdc/epdc-auth/pom.xml

@ -138,9 +138,10 @@
<!-- nacos -->
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
<nacos.ip>47.104.85.99</nacos.ip>
<nacos.namespace>a746dde3-7a13-4521-b986-7369b0b7c269</nacos.namespace>
<nacos.server-addr>115.29.142.202:8848</nacos.server-addr>
<nacos.ip>118.190.232.100</nacos.ip>
<nacos.namespace>305e0faa-d935-4fe1-b3a0-2634da67adb3</nacos.namespace>
<spring.zipkin.base-url>http://localhost:9411</spring.zipkin.base-url>
</properties>

6
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/pom.xml

@ -156,10 +156,10 @@
<!-- nacos -->
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
<nacos.ip>47.104.85.99</nacos.ip>
<nacos.server-addr>115.29.142.202:8848</nacos.server-addr>
<nacos.ip>118.190.232.100</nacos.ip>
<nacos.namespace>305e0faa-d935-4fe1-b3a0-2634da67adb3</nacos.namespace>
<epmet.commonUrl>https://epmet-dev.elinkservice.cn/api</epmet.commonUrl>
<nacos.namespace>a746dde3-7a13-4521-b986-7369b0b7c269</nacos.namespace>
</properties>
</profile>

6
esua-epdc/epdc-module/epdc-api/epdc-api-server/pom.xml

@ -233,9 +233,9 @@
<spring.datasource.druid.password>elink833066</spring.datasource.druid.password>
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
<nacos.ip>47.104.85.99</nacos.ip>
<nacos.namespace>a746dde3-7a13-4521-b986-7369b0b7c269</nacos.namespace>
<nacos.server-addr>115.29.142.202:8848</nacos.server-addr>
<nacos.ip>118.190.232.100</nacos.ip>
<nacos.namespace>305e0faa-d935-4fe1-b3a0-2634da67adb3</nacos.namespace>
<!--公众号配置-->
<wx.mp.configs.appId>wx3ef8f2cd12a19fcb</wx.mp.configs.appId>

7
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/jwt/JwtTokenUtils.java

@ -18,6 +18,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* Jwt工具类
@ -36,6 +38,11 @@ public class JwtTokenUtils {
* 生成jwt token
*/
public String generateToken(String userId) {
Map<String, Object> map = new HashMap<>();
map.put("userId",userId);
map.put("app","resi");
map.put("client","wxmp");
map.put("customerId","b09527201c4409e19d1dbc5e3c3429a1");
return Jwts.builder()
.setHeaderParam("typ", "JWT")
.setSubject(userId)

6
esua-epdc/epdc-module/epdc-content-security/epdc-content-security-server/pom.xml

@ -196,9 +196,9 @@
<spring.datasource.druid.password>elink833066</spring.datasource.druid.password>
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
<nacos.ip>47.104.85.99</nacos.ip>
<nacos.namespace>a746dde3-7a13-4521-b986-7369b0b7c269</nacos.namespace>
<nacos.server-addr>115.29.142.202:8848</nacos.server-addr>
<nacos.ip>118.190.232.100</nacos.ip>
<nacos.namespace>305e0faa-d935-4fe1-b3a0-2634da67adb3</nacos.namespace>
<!--亿联小程序配置-->
<!-- <wx.ma.appId>wxdd8530c5f4926766</wx.ma.appId>-->

6
esua-epdc/epdc-module/epdc-custom/epdc-custom-server/pom.xml

@ -219,9 +219,9 @@
<analysis.wx.ma.secret>394f47d4e08fc0fd629231d3f68a34dc</analysis.wx.ma.secret>
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
<nacos.ip>47.104.85.99</nacos.ip>
<nacos.namespace>a746dde3-7a13-4521-b986-7369b0b7c269</nacos.namespace>
<nacos.server-addr>115.29.142.202:8848</nacos.server-addr>
<nacos.ip>118.190.232.100</nacos.ip>
<nacos.namespace>305e0faa-d935-4fe1-b3a0-2634da67adb3</nacos.namespace>
<!--RocketMQ-->
<rocketmq.name.server>47.104.85.99:9876;114.215.125.123:9876</rocketmq.name.server>
<rocketmq.consumer.group>organizationGroup</rocketmq.consumer.group>

6
esua-epdc/epdc-module/epdc-group/epdc-group-server/pom.xml

@ -185,9 +185,9 @@
<spring.datasource.druid.password>elink833066</spring.datasource.druid.password>
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
<nacos.ip>47.104.85.99</nacos.ip>
<nacos.namespace>a746dde3-7a13-4521-b986-7369b0b7c269</nacos.namespace>
<nacos.server-addr>115.29.142.202:8848</nacos.server-addr>
<nacos.ip>118.190.232.100</nacos.ip>
<nacos.namespace>305e0faa-d935-4fe1-b3a0-2634da67adb3</nacos.namespace>
<!--RocketMQ-->
<rocketmq.name.server>47.104.85.99:9876;114.215.125.123:9876</rocketmq.name.server>
<rocketmq.consumer.group>organizationGroup</rocketmq.consumer.group>

6
esua-epdc/epdc-module/epdc-heart/epdc-heart-server/pom.xml

@ -207,9 +207,9 @@
<spring.datasource.druid.password>elink833066</spring.datasource.druid.password>
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
<nacos.ip>47.104.85.99</nacos.ip>
<nacos.namespace>a746dde3-7a13-4521-b986-7369b0b7c269</nacos.namespace>
<nacos.server-addr>115.29.142.202:8848</nacos.server-addr>
<nacos.ip>118.190.232.100</nacos.ip>
<nacos.namespace>305e0faa-d935-4fe1-b3a0-2634da67adb3</nacos.namespace>
<spring.zipkin.base-url>http://localhost:9411</spring.zipkin.base-url>

6
esua-epdc/epdc-module/epdc-job/epdc-job-server/pom.xml

@ -185,9 +185,9 @@
<spring.datasource.druid.password>elink833066</spring.datasource.druid.password>
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
<nacos.ip>47.104.85.99</nacos.ip>
<nacos.namespace>a746dde3-7a13-4521-b986-7369b0b7c269</nacos.namespace>
<nacos.server-addr>115.29.142.202:8848</nacos.server-addr>
<nacos.ip>118.190.232.100</nacos.ip>
<nacos.namespace>305e0faa-d935-4fe1-b3a0-2634da67adb3</nacos.namespace>
</properties>
</profile>

6
esua-epdc/epdc-module/epdc-kpi/epdc-kpi-server/pom.xml

@ -170,9 +170,9 @@
<spring.datasource.druid.password>elink833066</spring.datasource.druid.password>
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
<nacos.ip>47.104.85.99</nacos.ip>
<nacos.namespace>a746dde3-7a13-4521-b986-7369b0b7c269</nacos.namespace>
<nacos.server-addr>115.29.142.202:8848</nacos.server-addr>
<nacos.ip>118.190.232.100</nacos.ip>
<nacos.namespace>305e0faa-d935-4fe1-b3a0-2634da67adb3</nacos.namespace>
<!--RocketMQ-->
<rocketmq.name.server>47.104.85.99:9876;114.215.125.123:9876</rocketmq.name.server>

6
esua-epdc/epdc-module/epdc-message/epdc-message-server/pom.xml

@ -185,9 +185,9 @@
<spring.datasource.druid.password>elink833066</spring.datasource.druid.password>
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
<nacos.ip>47.104.85.99</nacos.ip>
<nacos.namespace>a746dde3-7a13-4521-b986-7369b0b7c269</nacos.namespace>
<nacos.server-addr>115.29.142.202:8848</nacos.server-addr>
<nacos.ip>118.190.232.100</nacos.ip>
<nacos.namespace>305e0faa-d935-4fe1-b3a0-2634da67adb3</nacos.namespace>
</properties>
</profile>

6
esua-epdc/epdc-module/epdc-news/epdc-news-server/pom.xml

@ -170,9 +170,9 @@
<spring.datasource.druid.password>elink833066</spring.datasource.druid.password>
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
<nacos.ip>47.104.85.99</nacos.ip>
<nacos.namespace>a746dde3-7a13-4521-b986-7369b0b7c269</nacos.namespace>
<nacos.server-addr>115.29.142.202:8848</nacos.server-addr>
<nacos.ip>118.190.232.100</nacos.ip>
<nacos.namespace>305e0faa-d935-4fe1-b3a0-2634da67adb3</nacos.namespace>
<!--RocketMQ-->
<rocketmq.name.server>47.104.85.99:9876;114.215.125.123:9876</rocketmq.name.server>

6
esua-epdc/epdc-module/epdc-oss/epdc-oss-server/pom.xml

@ -210,9 +210,9 @@
<spring.datasource.druid.password>elink833066</spring.datasource.druid.password>
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
<nacos.ip>47.104.85.99</nacos.ip>
<nacos.namespace>a746dde3-7a13-4521-b986-7369b0b7c269</nacos.namespace>
<nacos.server-addr>115.29.142.202:8848</nacos.server-addr>
<nacos.ip>118.190.232.100</nacos.ip>
<nacos.namespace>305e0faa-d935-4fe1-b3a0-2634da67adb3</nacos.namespace>
<!-- fastDFS 文件服务器 -->
<fastdfs.server-addr></fastdfs.server-addr>

6
esua-epdc/epdc-module/epdc-points/epdc-points-server/pom.xml

@ -168,9 +168,9 @@
<spring.datasource.druid.password>elink833066</spring.datasource.druid.password>
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
<nacos.ip>47.104.85.99</nacos.ip>
<nacos.namespace>a746dde3-7a13-4521-b986-7369b0b7c269</nacos.namespace>
<nacos.server-addr>115.29.142.202:8848</nacos.server-addr>
<nacos.ip>118.190.232.100</nacos.ip>
<nacos.namespace>305e0faa-d935-4fe1-b3a0-2634da67adb3</nacos.namespace>
<spring.zipkin.base-url>http://localhost:9411</spring.zipkin.base-url>
</properties>

18
esua-epdc/epdc-module/epdc-user/epdc-user-server/pom.xml

@ -179,21 +179,21 @@
<spring.redis.password>epdc!redis@master1405</spring.redis.password>
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://118.190.232.100:3308/esua_epdc_user?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
<![CDATA[jdbc:mysql://rm-bp1l2b53j508j1176xo.mysql.rds.aliyuncs.com:3306/esua_epdc_user?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url>
<spring.datasource.druid.username>epdc</spring.datasource.druid.username>
<spring.datasource.druid.password>elink833066</spring.datasource.druid.password>
<spring.datasource.druid.username>root</spring.datasource.druid.username>
<spring.datasource.druid.password>Abc@123456</spring.datasource.druid.password>
<dynamic.datasource.first.url>
<![CDATA[jdbc:mysql://118.190.232.100:3308/esua_epdc_user?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
<![CDATA[jdbc:mysql://rm-bp1l2b53j508j1176xo.mysql.rds.aliyuncs.com:3306/esua_epdc_user?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</dynamic.datasource.first.url>
<dynamic.datasource.first.username>epdc</dynamic.datasource.first.username>
<dynamic.datasource.first.password>elink833066</dynamic.datasource.first.password>
<dynamic.datasource.first.username>root</dynamic.datasource.first.username>
<dynamic.datasource.first.password>Abc@123456</dynamic.datasource.first.password>
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
<nacos.ip>47.104.85.99</nacos.ip>
<nacos.namespace>a746dde3-7a13-4521-b986-7369b0b7c269</nacos.namespace>
<nacos.server-addr>115.29.142.202:8848</nacos.server-addr>
<nacos.ip>118.190.232.100</nacos.ip>
<nacos.namespace>305e0faa-d935-4fe1-b3a0-2634da67adb3</nacos.namespace>
<!--RocketMQ-->
<rocketmq.name.server>47.104.85.99:9876;114.215.125.123:9876</rocketmq.name.server>

6
esua-epdc/epdc-module/epdc-webservice/pom.xml

@ -162,9 +162,9 @@
<spring.datasource.druid.password>elink833066</spring.datasource.druid.password>
<nacos.register-enabled>false</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
<nacos.ip>47.104.85.99</nacos.ip>
<nacos.namespace>a746dde3-7a13-4521-b986-7369b0b7c269</nacos.namespace>
<nacos.server-addr>115.29.142.202:8848</nacos.server-addr>
<nacos.ip>118.190.232.100</nacos.ip>
<nacos.namespace>305e0faa-d935-4fe1-b3a0-2634da67adb3</nacos.namespace>
</properties>
</profile>
<profile>

Loading…
Cancel
Save