Browse Source

dept表拉取

feature/dangjian
zhangyuan 3 years ago
parent
commit
8dcfad4e7e
  1. 5
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/controller/SysDeptController.java
  2. 2
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/SysDeptDao.java
  3. 10
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/SysDeptService.java
  4. 7
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/SysDeptServiceImpl.java
  5. 5
      esua-epdc/epdc-admin/epdc-admin-server/src/main/resources/mapper/SysDeptDao.xml
  6. 2
      esua-epdc/epdc-cloud-commons-shibei
  7. 136
      esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/MetaSysDeptDTO.java
  8. 3
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/feign/AdminFeignClient.java
  9. 6
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/feign/fallback/AdminFeignClientFallback.java
  10. 6
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/controller/ScreenItemController.java
  11. 35
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/dao/MetaSysDeptDao.java
  12. 142
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/entity/MetaSysDeptEntity.java
  13. 95
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/excel/MetaSysDeptExcel.java
  14. 47
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/redis/MetaSysDeptRedis.java
  15. 67
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/service/MetaSysDeptService.java
  16. 10
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/service/ScreenService.java
  17. 73
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/service/impl/MetaSysDeptServiceImpl.java
  18. 24
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/service/impl/ScreenServiceImpl.java
  19. 33
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/screen/MetaSysDeptDao.xml
  20. 3
      esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/feign/ItemFeignClient.java
  21. 6
      esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/feign/fallback/ItemFeignClientFallback.java
  22. 43
      esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/task/screen/EventDeptTask.java
  23. 2
      renren-cloud-generator/src/main/resources/application.yml

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

@ -521,4 +521,9 @@ public class SysDeptController {
return new Result<List<DeptDTO>>().ok(list); return new Result<List<DeptDTO>>().ok(list);
} }
@PostMapping("meta/all")
public Result<List<DeptDTO>> getAllDept() {
return new Result<List<DeptDTO>>().ok(sysDeptService.listAll(new HashMap<>()));
}
} }

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

@ -35,6 +35,8 @@ public interface SysDeptDao extends BaseDao<SysDeptEntity> {
List<SysDeptEntity> getList(Map<String, Object> params); List<SysDeptEntity> getList(Map<String, Object> params);
List<SysDeptEntity> listAll(Map<String, Object> params);
SysDeptEntity getById(Long id); SysDeptEntity getById(Long id);
/** /**

10
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/SysDeptService.java

@ -44,6 +44,16 @@ public interface SysDeptService extends BaseService<SysDeptEntity> {
*/ */
List<DeptDTO> listDefault(Map<String, Object> params); List<DeptDTO> listDefault(Map<String, Object> params);
/**
* 默认列表无数据权限
*
* @param params
* @return java.util.List<com.elink.esua.epdc.dto.DeptDTO>
* @author zhy
* @date 2022/10/11 14:46
*/
List<DeptDTO> listAll(Map<String, Object> params);
SysDeptDTO get(Long id); SysDeptDTO get(Long id);
void save(SysDeptDTO dto); void save(SysDeptDTO dto);

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

@ -136,6 +136,13 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
return ConvertUtils.sourceToTarget(entityList, DeptDTO.class); return ConvertUtils.sourceToTarget(entityList, DeptDTO.class);
} }
@Override
public List<DeptDTO> listAll(Map<String, Object> params) {
List<SysDeptEntity> entityList = baseDao.listAll(params);
return ConvertUtils.sourceToTarget(entityList, DeptDTO.class);
}
@Override @Override
public List<SysSimpleDeptDTO> subList(String pid) { public List<SysSimpleDeptDTO> subList(String pid) {
QueryWrapper<SysDeptEntity> wrapper = new QueryWrapper<>(); QueryWrapper<SysDeptEntity> wrapper = new QueryWrapper<>();

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

@ -21,6 +21,11 @@
order by t1.sort asc order by t1.sort asc
</select> </select>
<select id="listAll" resultType="com.elink.esua.epdc.entity.SysDeptEntity">
select t1.* from sys_dept t1
where t1.del_flag = 0
</select>
<select id="getById" resultType="com.elink.esua.epdc.entity.SysDeptEntity"> <select id="getById" resultType="com.elink.esua.epdc.entity.SysDeptEntity">
select t1.*,(select t2.name from sys_dept t2 where t2.id=t1.pid)parentName from sys_dept t1 select t1.*,(select t2.name from sys_dept t2 where t2.id=t1.pid)parentName from sys_dept t1
where t1.id = #{value} and t1.del_flag = 0 where t1.id = #{value} and t1.del_flag = 0

2
esua-epdc/epdc-cloud-commons-shibei

@ -1 +1 @@
Subproject commit 0684de84eb7aeec1f3d6b9cbd53b7fd104f27242 Subproject commit 89bb48135eb0db7b1682b1e7d51b0bd5c8d02a0f

136
esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/MetaSysDeptDTO.java

@ -0,0 +1,136 @@
/**
* 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 2022-10-17
*/
@Data
public class MetaSysDeptDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private Long id;
/**
* 第三方平台编码
*/
private String infoCode;
/**
* 上级ID
*/
private Long pid;
/**
* 所有上级ID用逗号分开
*/
private String pids;
/**
* 部门名称
*/
private String name;
/**
* 排序
*/
private Integer sort;
/**
* 删除标识 0未删除 1删除
*/
private Integer delFlag;
/**
* 创建者
*/
private Long creator;
/**
* 创建时间
*/
private Date createDate;
/**
* 更新者
*/
private Long updater;
/**
* 更新时间
*/
private Date updateDate;
/**
* 机构类型键值
*/
private String typeKey;
/**
* 党委编码
*/
private String partyCode;
/**
* 地址
*/
private String address;
/**
* 联系方式
*/
private String mobile;
/**
* 经度
*/
private String longitude;
/**
* 纬度
*/
private String latitude;
/**
*
*/
private String caBindId;
/**
* 所属地区码所属组织地区码
*/
private String areaCode;
/**
* 市中心区划编码
*/
private String disCenterZoningCode;
}

3
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/feign/AdminFeignClient.java

@ -135,4 +135,7 @@ public interface AdminFeignClient {
@PostMapping(value = "sys/dept/getDept", consumes = MediaType.APPLICATION_JSON_VALUE) @PostMapping(value = "sys/dept/getDept", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<SysDeptDTO> getDept(@RequestBody CityCenterFromDTO formDTO); Result<SysDeptDTO> getDept(@RequestBody CityCenterFromDTO formDTO);
@PostMapping(value = "sys/dept/meta/all", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<List<DeptDTO>> getAllDept();
} }

6
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/feign/fallback/AdminFeignClientFallback.java

@ -79,4 +79,10 @@ public class AdminFeignClientFallback implements AdminFeignClient {
public Result<SysDeptDTO> getDept(CityCenterFromDTO formDTO) { public Result<SysDeptDTO> getDept(CityCenterFromDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "getDept", formDTO); return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "getDept", formDTO);
} }
@Override
public Result<List<DeptDTO>> getAllDept() {
return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "getAllDept");
}
} }

6
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/controller/ScreenItemController.java

@ -115,4 +115,10 @@ public class ScreenItemController {
return new Result(); return new Result();
} }
@PostMapping("meta/dept")
public Result metaDept() {
screenService.metaDept();
return new Result();
}
} }

35
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/dao/MetaSysDeptDao.java

@ -0,0 +1,35 @@
/**
* 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.modules.screen.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.modules.screen.entity.MetaSysDeptEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 部门管理
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2022-10-17
*/
@Mapper
public interface MetaSysDeptDao extends BaseDao<MetaSysDeptEntity> {
void truncate();
}

142
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/entity/MetaSysDeptEntity.java

@ -0,0 +1,142 @@
/**
* 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.modules.screen.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEntity;
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-10-17
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("meta_sys_dept")
public class MetaSysDeptEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* id
*/
private Long id;
/**
* 第三方平台编码
*/
private String infoCode;
/**
* 上级ID
*/
private Long pid;
/**
* 所有上级ID用逗号分开
*/
private String pids;
/**
* 部门名称
*/
private String name;
/**
* 排序
*/
private Integer sort;
/**
* 删除标识 0未删除 1删除
*/
private Integer delFlag;
/**
* 创建者
*/
private Long creator;
/**
* 创建时间
*/
private Date createDate;
/**
* 更新者
*/
private Long updater;
/**
* 更新时间
*/
private Date updateDate;
/**
* 机构类型键值
*/
private String typeKey;
/**
* 党委编码
*/
private String partyCode;
/**
* 地址
*/
private String address;
/**
* 联系方式
*/
private String mobile;
/**
* 经度
*/
private String longitude;
/**
* 纬度
*/
private String latitude;
/**
*
*/
private String caBindId;
/**
* 所属地区码所属组织地区码
*/
private String areaCode;
/**
* 市中心区划编码
*/
private String disCenterZoningCode;
}

95
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/excel/MetaSysDeptExcel.java

@ -0,0 +1,95 @@
/**
* 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.modules.screen.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 部门管理
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2022-10-17
*/
@Data
public class MetaSysDeptExcel {
@Excel(name = "id")
private Long id;
@Excel(name = "第三方平台编码")
private String infoCode;
@Excel(name = "上级ID")
private Long pid;
@Excel(name = "所有上级ID,用逗号分开")
private String pids;
@Excel(name = "部门名称")
private String name;
@Excel(name = "排序")
private Integer sort;
@Excel(name = "删除标识 0:未删除 1:删除")
private Integer delFlag;
@Excel(name = "创建者")
private Long creator;
@Excel(name = "创建时间")
private Date createDate;
@Excel(name = "更新者")
private Long updater;
@Excel(name = "更新时间")
private Date updateDate;
@Excel(name = "机构类型键值")
private String typeKey;
@Excel(name = "党委编码")
private String partyCode;
@Excel(name = "地址")
private String address;
@Excel(name = "联系方式")
private String mobile;
@Excel(name = "经度")
private String longitude;
@Excel(name = "纬度")
private String latitude;
@Excel(name = "")
private String caBindId;
@Excel(name = "所属地区码(所属组织地区码)")
private String areaCode;
@Excel(name = "市中心区划编码")
private String disCenterZoningCode;
}

47
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/redis/MetaSysDeptRedis.java

@ -0,0 +1,47 @@
/**
* 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.modules.screen.redis;
import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 部门管理
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2022-10-17
*/
@Component
public class MetaSysDeptRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

67
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/service/MetaSysDeptService.java

@ -0,0 +1,67 @@
/**
* 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.modules.screen.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.dto.MetaSysDeptDTO;
import com.elink.esua.epdc.modules.screen.entity.MetaSysDeptEntity;
import java.util.List;
import java.util.Map;
/**
* 部门管理
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2022-10-17
*/
public interface MetaSysDeptService extends BaseService<MetaSysDeptEntity> {
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2022-10-17
*/
void save(MetaSysDeptDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2022-10-17
*/
void update(MetaSysDeptDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2022-10-17
*/
void delete(String[] ids);
void truncate();
}

10
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/service/ScreenService.java

@ -27,4 +27,14 @@ public interface ScreenService {
ItemDailyStatisResultDTO itemDailyStatis(ItemDailyStatisFormDTO formDTO); ItemDailyStatisResultDTO itemDailyStatis(ItemDailyStatisFormDTO formDTO);
/**
* 拉取部门信息
*
* @param
* @return void
* @author zhy
* @date 2022/10/17 15:37
*/
void metaDept();
} }

73
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/service/impl/MetaSysDeptServiceImpl.java

@ -0,0 +1,73 @@
/**
* 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.modules.screen.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.dto.MetaSysDeptDTO;
import com.elink.esua.epdc.modules.screen.dao.MetaSysDeptDao;
import com.elink.esua.epdc.modules.screen.entity.MetaSysDeptEntity;
import com.elink.esua.epdc.modules.screen.redis.MetaSysDeptRedis;
import com.elink.esua.epdc.modules.screen.service.MetaSysDeptService;
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.Map;
/**
* 部门管理
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2022-10-17
*/
@Service
public class MetaSysDeptServiceImpl extends BaseServiceImpl<MetaSysDeptDao, MetaSysDeptEntity> implements MetaSysDeptService {
@Override
@Transactional(rollbackFor = Exception.class)
public void save(MetaSysDeptDTO dto) {
MetaSysDeptEntity entity = ConvertUtils.sourceToTarget(dto, MetaSysDeptEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(MetaSysDeptDTO dto) {
MetaSysDeptEntity entity = ConvertUtils.sourceToTarget(dto, MetaSysDeptEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void truncate() {
baseDao.truncate();
}
}

24
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/screen/service/impl/ScreenServiceImpl.java

@ -17,9 +17,15 @@
package com.elink.esua.epdc.modules.screen.service.impl; package com.elink.esua.epdc.modules.screen.service.impl;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.DeptDTO;
import com.elink.esua.epdc.dto.events.form.ItemDailyStatisFormDTO; import com.elink.esua.epdc.dto.events.form.ItemDailyStatisFormDTO;
import com.elink.esua.epdc.dto.events.result.ItemDailyStatisResultDTO; import com.elink.esua.epdc.dto.events.result.ItemDailyStatisResultDTO;
import com.elink.esua.epdc.modules.feign.AdminFeignClient;
import com.elink.esua.epdc.modules.item.dao.ItemDao; import com.elink.esua.epdc.modules.item.dao.ItemDao;
import com.elink.esua.epdc.modules.screen.entity.MetaSysDeptEntity;
import com.elink.esua.epdc.modules.screen.service.MetaSysDeptService;
import com.elink.esua.epdc.modules.screen.service.ScreenService; import com.elink.esua.epdc.modules.screen.service.ScreenService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime; import org.joda.time.DateTime;
@ -28,6 +34,7 @@ import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 项目统计相关接口 * 项目统计相关接口
@ -37,6 +44,13 @@ public class ScreenServiceImpl implements ScreenService {
@Autowired @Autowired
private ItemDao itemDao; private ItemDao itemDao;
@Autowired
private MetaSysDeptService metaSysDeptService;
@Autowired
private AdminFeignClient adminFeignClient;
/** /**
* 数据统计-统计各诉求不同状态数据 * 数据统计-统计各诉求不同状态数据
@ -61,5 +75,15 @@ public class ScreenServiceImpl implements ScreenService {
return resultDTO; return resultDTO;
} }
@Override
public void metaDept() {
Result<List<DeptDTO>> result = adminFeignClient.getAllDept();
if (result.success()) {
metaSysDeptService.truncate();
List<DeptDTO> list = result.getData();
List<MetaSysDeptEntity> insertList = ConvertUtils.sourceToTarget(list, MetaSysDeptEntity.class);
metaSysDeptService.insertBatch(insertList);
}
}
} }

33
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/screen/MetaSysDeptDao.xml

@ -0,0 +1,33 @@
<?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.modules.screen.dao.MetaSysDeptDao">
<resultMap type="com.elink.esua.epdc.modules.screen.entity.MetaSysDeptEntity" id="metaSysDeptMap">
<result property="id" column="id"/>
<result property="infoCode" column="info_code"/>
<result property="pid" column="pid"/>
<result property="pids" column="pids"/>
<result property="name" column="name"/>
<result property="sort" column="sort"/>
<result property="delFlag" column="del_flag"/>
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
<result property="updater" column="updater"/>
<result property="updateDate" column="update_date"/>
<result property="typeKey" column="type_key"/>
<result property="partyCode" column="party_code"/>
<result property="address" column="address"/>
<result property="mobile" column="mobile"/>
<result property="longitude" column="longitude"/>
<result property="latitude" column="latitude"/>
<result property="caBindId" column="ca_bind_id"/>
<result property="areaCode" column="area_code"/>
<result property="disCenterZoningCode" column="dis_center_zoning_code"/>
</resultMap>
<delete id="truncate">
truncate table meta_sys_dept;
</delete>
</mapper>

3
esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/feign/ItemFeignClient.java

@ -60,4 +60,7 @@ public interface ItemFeignClient {
@PostMapping("events/itemstatis/deptEventEfficiency/dataStatistics") @PostMapping("events/itemstatis/deptEventEfficiency/dataStatistics")
Result eventEfficiencyStatistics(@RequestBody DataStatisticsFormDTO formDTO); Result eventEfficiencyStatistics(@RequestBody DataStatisticsFormDTO formDTO);
@PostMapping("events/itemstatis/meta/dept")
Result metaDept();
} }

6
esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/feign/fallback/ItemFeignClientFallback.java

@ -42,4 +42,10 @@ public class ItemFeignClientFallback implements ItemFeignClient {
public Result eventEfficiencyStatistics(DataStatisticsFormDTO formDTO) { public Result eventEfficiencyStatistics(DataStatisticsFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_EVENTS_SERVER, "eventEfficiencyStatistics", formDTO); return ModuleUtils.feignConError(ServiceConstant.EPDC_EVENTS_SERVER, "eventEfficiencyStatistics", formDTO);
} }
@Override
public Result metaDept() {
return ModuleUtils.feignConError(ServiceConstant.EPDC_EVENTS_SERVER, "metaDept");
}
} }

43
esua-epdc/epdc-module/epdc-job/epdc-job-server/src/main/java/com/elink/esua/epdc/task/screen/EventDeptTask.java

@ -0,0 +1,43 @@
package com.elink.esua.epdc.task.screen;
import com.alibaba.fastjson.JSON;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.screen.form.DataStatisticsFormDTO;
import com.elink.esua.epdc.feign.ItemFeignClient;
import com.elink.esua.epdc.task.ITask;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 同步组织部门信息
*
* @author zhy
* @date 2022/10/17 15:24
*/
@Component("eventDeptTask")
@Slf4j
public class EventDeptTask implements ITask {
@Resource
private ItemFeignClient itemFeignClient;
/**
* 执行定时任务接口
*
* @param params 参数多参数使用JSON数据
*/
@Override
public void run(String params) {
Result result = itemFeignClient.metaDept();
if (result.success()) {
log.info("{}定时任务执行成功,{}", getClass().getSimpleName(), params);
} else {
log.error("{}定时任务执行失败:{},param:{}", getClass().getSimpleName(), result.getMsg(), params);
}
}
}

2
renren-cloud-generator/src/main/resources/application.yml

@ -9,7 +9,7 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
#MySQL配置 #MySQL配置
driverClassName: com.mysql.jdbc.Driver driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://rm-m5eguiv2827bdye798o.mysql.rds.aliyuncs.com:10001/sb_esua_epdc_admin?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai url: jdbc:mysql://rm-m5eguiv2827bdye798o.mysql.rds.aliyuncs.com:10001/sb_esua_epdc_events?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
username: shibei_test username: shibei_test
password: Elink@833066 password: Elink@833066
#oracle配置 #oracle配置

Loading…
Cancel
Save