Browse Source

组织信息

feature/test
曲树通 5 years ago
parent
commit
7ebcd564df
  1. 88
      epdc-cloud-admin/src/main/java/com/elink/esua/epdc/controller/AdminImgController.java
  2. 88
      epdc-cloud-admin/src/main/java/com/elink/esua/epdc/controller/SysDeptInfoController.java
  3. 33
      epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/AdminImgDao.java
  4. 33
      epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/SysDeptInfoDao.java
  5. 56
      epdc-cloud-admin/src/main/java/com/elink/esua/epdc/entity/AdminImgEntity.java
  6. 86
      epdc-cloud-admin/src/main/java/com/elink/esua/epdc/entity/SysDeptInfoEntity.java
  7. 107
      epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/AdminImgService.java
  8. 106
      epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/SysDeptInfoService.java
  9. 110
      epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/impl/AdminImgServiceImpl.java
  10. 109
      epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/impl/SysDeptInfoServiceImpl.java
  11. 104
      epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/impl/SysDeptServiceImpl.java
  12. 20
      epdc-cloud-admin/src/main/resources/mapper/AdminImgDao.xml
  13. 26
      epdc-cloud-admin/src/main/resources/mapper/SysDeptInfoDao.xml
  14. 2
      epdc-cloud-client-yushan
  15. 2
      epdc-cloud-commons-yushan

88
epdc-cloud-admin/src/main/java/com/elink/esua/epdc/controller/AdminImgController.java

@ -0,0 +1,88 @@
/**
* 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.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
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.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.dto.AdminImgDTO;
import com.elink.esua.epdc.service.AdminImgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 图片表 图片表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-08-10
*/
@RestController
@RequestMapping("adminimg")
public class AdminImgController {
@Autowired
private AdminImgService adminImgService;
@GetMapping("page")
public Result<PageData<AdminImgDTO>> page(@RequestParam Map<String, Object> params){
PageData<AdminImgDTO> page = adminImgService.page(params);
return new Result<PageData<AdminImgDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<AdminImgDTO> get(@PathVariable("id") String id){
AdminImgDTO data = adminImgService.get(id);
return new Result<AdminImgDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody AdminImgDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
adminImgService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody AdminImgDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
adminImgService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
adminImgService.delete(ids);
return new Result();
}
}

88
epdc-cloud-admin/src/main/java/com/elink/esua/epdc/controller/SysDeptInfoController.java

@ -0,0 +1,88 @@
/**
* 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.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
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.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.dto.SysDeptInfoDTO;
import com.elink.esua.epdc.service.SysDeptInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 部门信息表 组织信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-08-10
*/
@RestController
@RequestMapping("sysdeptinfo")
public class SysDeptInfoController {
@Autowired
private SysDeptInfoService sysDeptInfoService;
@GetMapping("page")
public Result<PageData<SysDeptInfoDTO>> page(@RequestParam Map<String, Object> params){
PageData<SysDeptInfoDTO> page = sysDeptInfoService.page(params);
return new Result<PageData<SysDeptInfoDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<SysDeptInfoDTO> get(@PathVariable("id") String id){
SysDeptInfoDTO data = sysDeptInfoService.get(id);
return new Result<SysDeptInfoDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody SysDeptInfoDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
sysDeptInfoService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody SysDeptInfoDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
sysDeptInfoService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
sysDeptInfoService.delete(ids);
return new Result();
}
}

33
epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/AdminImgDao.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.AdminImgEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 图片表 图片表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-08-10
*/
@Mapper
public interface AdminImgDao extends BaseDao<AdminImgEntity> {
}

33
epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/SysDeptInfoDao.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.SysDeptInfoEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 部门信息表 组织信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-08-10
*/
@Mapper
public interface SysDeptInfoDao extends BaseDao<SysDeptInfoEntity> {
}

56
epdc-cloud-admin/src/main/java/com/elink/esua/epdc/entity/AdminImgEntity.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 qu qu@elink-cn.com
* @since v1.0.0 2021-08-10
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_admin_img")
public class AdminImgEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 引用ID
*/
private String referenceId;
/**
* 图片地址
*/
private String imgUrl;
/**
* 图片类型lllll
*/
private String imgType;
}

86
epdc-cloud-admin/src/main/java/com/elink/esua/epdc/entity/SysDeptInfoEntity.java

@ -0,0 +1,86 @@
/**
* 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 qu qu@elink-cn.com
* @since v1.0.0 2021-08-10
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("sys_dept_info")
public class SysDeptInfoEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 部门ID
*/
private Long deptId;
/**
* 概况介绍
*/
private String introduction;
/**
* 社区数量
*/
private Integer communityNum;
/**
* 网格数量
*/
private Integer gridNum;
/**
* 网格员数量
*/
private Integer gridmanNum;
/**
* 党员数量
*/
private Integer partyMemberNum;
/**
* 经度
*/
private String longitude;
/**
* 纬度
*/
private String latitude;
/**
* 辖区面积
*/
private String acreage;
}

107
epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/AdminImgService.java

@ -0,0 +1,107 @@
/**
* 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.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.AdminImgDTO;
import com.elink.esua.epdc.entity.AdminImgEntity;
import java.util.List;
import java.util.Map;
/**
* 图片表 图片表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-08-10
*/
public interface AdminImgService extends BaseService<AdminImgEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<AdminImgDTO>
* @author generator
* @date 2021-08-10
*/
PageData<AdminImgDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<AdminImgDTO>
* @author generator
* @date 2021-08-10
*/
List<AdminImgDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return AdminImgDTO
* @author generator
* @date 2021-08-10
*/
AdminImgDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-08-10
*/
void save(AdminImgDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-08-10
*/
void update(AdminImgDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-08-10
*/
void delete(String[] ids);
/***
* 根据类型 +引用ID
* @param imgType
* @param referenceId
* @return com.elink.esua.epdc.dto.AdminImgDTO
* @author qushutong
* @date 2021/8/10 17:20
*/
AdminImgDTO getDtoByReference(String imgType,String referenceId);
}

106
epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/SysDeptInfoService.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.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.SysDeptInfoDTO;
import com.elink.esua.epdc.entity.SysDeptInfoEntity;
import java.util.List;
import java.util.Map;
/**
* 部门信息表 组织信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-08-10
*/
public interface SysDeptInfoService extends BaseService<SysDeptInfoEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<SysDeptInfoDTO>
* @author generator
* @date 2021-08-10
*/
PageData<SysDeptInfoDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<SysDeptInfoDTO>
* @author generator
* @date 2021-08-10
*/
List<SysDeptInfoDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return SysDeptInfoDTO
* @author generator
* @date 2021-08-10
*/
SysDeptInfoDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-08-10
*/
void save(SysDeptInfoDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-08-10
*/
void update(SysDeptInfoDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-08-10
*/
void delete(String[] ids);
/**
* 根据关联deptID 查询
*
* @param deptId
* @return SysDeptInfoDTO
* @author generator
* @date 2021-08-10
*/
SysDeptInfoDTO getDeptInfoByDeptID(String deptId);
}

110
epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/impl/AdminImgServiceImpl.java

@ -0,0 +1,110 @@
/**
* 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.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.dao.AdminImgDao;
import com.elink.esua.epdc.dto.AdminImgDTO;
import com.elink.esua.epdc.entity.AdminImgEntity;
import com.elink.esua.epdc.entity.SysDeptInfoEntity;
import com.elink.esua.epdc.service.AdminImgService;
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.List;
import java.util.Map;
/**
* 图片表 图片表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-08-10
*/
@Service
public class AdminImgServiceImpl extends BaseServiceImpl<AdminImgDao, AdminImgEntity> implements AdminImgService {
@Override
public PageData<AdminImgDTO> page(Map<String, Object> params) {
IPage<AdminImgEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, AdminImgDTO.class);
}
@Override
public List<AdminImgDTO> list(Map<String, Object> params) {
List<AdminImgEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, AdminImgDTO.class);
}
private QueryWrapper<AdminImgEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<AdminImgEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public AdminImgDTO get(String id) {
AdminImgEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, AdminImgDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(AdminImgDTO dto) {
AdminImgEntity entity = ConvertUtils.sourceToTarget(dto, AdminImgEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(AdminImgDTO dto) {
AdminImgEntity entity = ConvertUtils.sourceToTarget(dto, AdminImgEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public AdminImgDTO getDtoByReference(String imgType, String referenceId) {
QueryWrapper<AdminImgEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(referenceId), FieldConstant.REFERENCE_ID, referenceId);
wrapper.eq(StringUtils.isNotBlank(imgType), FieldConstant.IMG_TYPE, imgType);
return ConvertUtils.sourceToTarget(baseDao.selectOne(wrapper),AdminImgDTO.class);
}
}

109
epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/impl/SysDeptInfoServiceImpl.java

@ -0,0 +1,109 @@
/**
* 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.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.dao.SysDeptInfoDao;
import com.elink.esua.epdc.dto.SysDeptInfoDTO;
import com.elink.esua.epdc.entity.SysDeptInfoEntity;
import com.elink.esua.epdc.service.SysDeptInfoService;
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.List;
import java.util.Map;
/**
* 部门信息表 组织信息表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-08-10
*/
@Service
public class SysDeptInfoServiceImpl extends BaseServiceImpl<SysDeptInfoDao, SysDeptInfoEntity> implements SysDeptInfoService {
@Override
public PageData<SysDeptInfoDTO> page(Map<String, Object> params) {
IPage<SysDeptInfoEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, SysDeptInfoDTO.class);
}
@Override
public List<SysDeptInfoDTO> list(Map<String, Object> params) {
List<SysDeptInfoEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, SysDeptInfoDTO.class);
}
private QueryWrapper<SysDeptInfoEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<SysDeptInfoEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public SysDeptInfoDTO get(String id) {
SysDeptInfoEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, SysDeptInfoDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(SysDeptInfoDTO dto) {
SysDeptInfoEntity entity = ConvertUtils.sourceToTarget(dto, SysDeptInfoEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(SysDeptInfoDTO dto) {
SysDeptInfoEntity entity = ConvertUtils.sourceToTarget(dto, SysDeptInfoEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public SysDeptInfoDTO getDeptInfoByDeptID(String deptId) {
QueryWrapper<SysDeptInfoEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(deptId), FieldConstant.DEPT_ID, deptId);
SysDeptInfoEntity sysDeptInfoEntity = baseDao.selectOne(wrapper);
return ConvertUtils.sourceToTarget(sysDeptInfoEntity,SysDeptInfoDTO.class);
}
}

104
epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/impl/SysDeptServiceImpl.java

@ -28,6 +28,7 @@ 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.commons.tools.utils.TreeUtils;
import com.elink.esua.epdc.constant.ImgConstant;
import com.elink.esua.epdc.constant.RoleTypeKeyConstant;
import com.elink.esua.epdc.dao.SysDeptDao;
import com.elink.esua.epdc.dto.*;
@ -42,11 +43,15 @@ import com.elink.esua.epdc.dto.epdc.result.AreaCodeChildResultDTO;
import com.elink.esua.epdc.dto.epdc.result.AreaCodeParentResultDTO;
import com.elink.esua.epdc.dto.epdc.result.UserSysDeptAreaCodeResultDTO;
import com.elink.esua.epdc.dto.epdc.result.UserSysDeptInfoResultDTO;
import com.elink.esua.epdc.entity.AdminImgEntity;
import com.elink.esua.epdc.entity.SysDeptEntity;
import com.elink.esua.epdc.entity.SysDeptInfoEntity;
import com.elink.esua.epdc.feign.AnalysisFeignClient;
import com.elink.esua.epdc.feign.GroupFeignClient;
import com.elink.esua.epdc.rocketmq.dto.OrganizationModifyDTO;
import com.elink.esua.epdc.rocketmq.producer.OrganizationModifyProducer;
import com.elink.esua.epdc.service.AdminImgService;
import com.elink.esua.epdc.service.SysDeptInfoService;
import com.elink.esua.epdc.service.SysDeptService;
import com.elink.esua.epdc.service.SysUserService;
import com.elink.esua.epdc.utils.EpmetUtils;
@ -93,6 +98,12 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
@Autowired
private AnalysisFeignClient analysisFeignClient;
@Autowired
private SysDeptInfoService sysDeptInfoService;
@Autowired
private AdminImgService adminImgService;
@Override
public List<SysDeptDTO> list(Map<String, Object> params) {
//普通管理员,只能查询所属部门及子部门的数据
@ -126,10 +137,35 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
if (id == null) {
return null;
}
// 组装信息
SysDeptDTO sysDeptDTO = getDeptEntity(id);
SysDeptEntity entity = baseDao.getById(id);
return sysDeptDTO;
}
return ConvertUtils.sourceToTarget(entity, SysDeptDTO.class);
private SysDeptDTO getDeptEntity(Long id) {
SysDeptEntity entity = baseDao.getById(id);
SysDeptDTO sysDeptDTO = ConvertUtils.sourceToTarget(entity, SysDeptDTO.class);
AdminImgDTO businessDto = adminImgService.getDtoByReference(ImgConstant.DEPT_BUSINESS_CIRCULATION, id.toString());
AdminImgDTO partyDto = adminImgService.getDtoByReference(ImgConstant.DEPT_PARTY_ORGANIZATION_STRUCTURE, id.toString());
SysDeptInfoDTO deptInfoByDeptID = sysDeptInfoService.getDeptInfoByDeptID(id.toString());
if(deptInfoByDeptID!=null){
sysDeptDTO.setIntroduction(deptInfoByDeptID.getIntroduction());
sysDeptDTO.setCommunityNum(deptInfoByDeptID.getCommunityNum());
sysDeptDTO.setGridNum(deptInfoByDeptID.getGridNum());
sysDeptDTO.setGridmanNum(deptInfoByDeptID.getGridmanNum());
sysDeptDTO.setPartyMemberNum(deptInfoByDeptID.getPartyMemberNum());
sysDeptDTO.setLongitude(deptInfoByDeptID.getLongitude());
sysDeptDTO.setLatitude(deptInfoByDeptID.getLatitude());
sysDeptDTO.setAcreage(deptInfoByDeptID.getAcreage());
if(businessDto!=null){
sysDeptDTO.setDeptBusinessUrl(businessDto.getImgUrl());
}
if(partyDto!=null){
sysDeptDTO.setDeptPartyUrl(partyDto.getImgUrl());
}
}
return sysDeptDTO;
}
@Override
@ -150,6 +186,8 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
}
entity.setPids(getPidList(entity.getPid()));
insert(entity);
// 插入信息表
insertInfo(dto, entity);
// 新建网格党支部时创建网格党员群
if (OrganizationTypeConstant.ORG_TYPE_GRID_PARTY.equals(dto.getTypeKey())) {
@ -159,6 +197,24 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
}
}
private void insertInfo(SysDeptDTO dto, SysDeptEntity entity) {
SysDeptInfoEntity sysDeptInfoEntity = ConvertUtils.sourceToTarget(dto, SysDeptInfoEntity.class);
sysDeptInfoEntity.setDeptId(dto.getId());
sysDeptInfoService.insert(sysDeptInfoEntity);
// 插入图片表
AdminImgEntity businessImgEntity = new AdminImgEntity();
businessImgEntity.setImgType(ImgConstant.DEPT_BUSINESS_CIRCULATION);
businessImgEntity.setImgUrl(dto.getDeptBusinessUrl());
businessImgEntity.setReferenceId(entity.getId().toString());
adminImgService.insert(businessImgEntity);
AdminImgEntity partyImgEntity = new AdminImgEntity();
partyImgEntity.setImgType(ImgConstant.DEPT_PARTY_ORGANIZATION_STRUCTURE);
partyImgEntity.setImgUrl(dto.getDeptPartyUrl());
partyImgEntity.setReferenceId(entity.getId().toString());
adminImgService.insert(partyImgEntity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(SysDeptDTO dto) {
@ -185,6 +241,48 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
// 发送消息
sendMqMessage(dto);
updateById(entity);
// 修改基本信息
updatainfo(dto, entity);
}
private void updatainfo(SysDeptDTO dto, SysDeptEntity entity) {
SysDeptInfoDTO sysDeptInfoDTO = sysDeptInfoService.getDeptInfoByDeptID(dto.getId().toString());
AdminImgEntity businessImgEntity = new AdminImgEntity();
businessImgEntity.setImgType(ImgConstant.DEPT_BUSINESS_CIRCULATION);
businessImgEntity.setImgUrl(dto.getDeptBusinessUrl());
businessImgEntity.setReferenceId(entity.getId().toString());
AdminImgEntity partyImgEntity = new AdminImgEntity();
partyImgEntity.setImgType(ImgConstant.DEPT_PARTY_ORGANIZATION_STRUCTURE);
partyImgEntity.setImgUrl(dto.getDeptPartyUrl());
partyImgEntity.setReferenceId(entity.getId().toString());
// 表里没有直接插入
if (sysDeptInfoDTO == null) {
// 插入信息表
SysDeptInfoEntity sysDeptInfoEntity = ConvertUtils.sourceToTarget(dto, SysDeptInfoEntity.class);
sysDeptInfoEntity.setDeptId(entity.getId());
sysDeptInfoService.insert(sysDeptInfoEntity);
// 插入图片表
adminImgService.insert(businessImgEntity);
adminImgService.insert(partyImgEntity);
} else {
// 更新信息表
SysDeptInfoDTO deptInfoDTO = ConvertUtils.sourceToTarget(dto, SysDeptInfoDTO.class);
deptInfoDTO.setDeptId(sysDeptInfoDTO.getDeptId());
deptInfoDTO.setId(sysDeptInfoDTO.getId());
sysDeptInfoService.update(deptInfoDTO);
// 查询图片表图片id
AdminImgDTO businessDto = adminImgService.getDtoByReference(ImgConstant.DEPT_BUSINESS_CIRCULATION, entity.getId().toString());
AdminImgDTO partyDto = adminImgService.getDtoByReference(ImgConstant.DEPT_PARTY_ORGANIZATION_STRUCTURE, entity.getId().toString());
AdminImgDTO newBusinessDto = ConvertUtils.sourceToTarget(businessImgEntity, AdminImgDTO.class);
newBusinessDto.setId(businessDto.getId());
adminImgService.update(newBusinessDto);
AdminImgDTO newPartyDto = ConvertUtils.sourceToTarget(partyImgEntity, AdminImgDTO.class);
newPartyDto.setId(partyDto.getId());
adminImgService.update(newPartyDto);
}
}
@Override
@ -506,7 +604,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
* @param allParentNode 所有的上级机构节点
* @param dataScopeDeptList 拥有数据权限的部门
* @param parentDeptIdList 上级部门id
* @return java.util.Map<java.lang.String, java.lang.Object>
* @return java.util.Map<java.lang.String , java.lang.Object>
* @author work@yujt.net.cn
* @date 2019/11/29 10:27
*/

20
epdc-cloud-admin/src/main/resources/mapper/AdminImgDao.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.AdminImgDao">
<resultMap type="com.elink.esua.epdc.entity.AdminImgEntity" id="adminImgMap">
<result property="id" column="ID"/>
<result property="referenceId" column="REFERENCE_ID"/>
<result property="imgUrl" column="IMG_URL"/>
<result property="imgType" column="IMG_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>
</mapper>

26
epdc-cloud-admin/src/main/resources/mapper/SysDeptInfoDao.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.SysDeptInfoDao">
<resultMap type="com.elink.esua.epdc.entity.SysDeptInfoEntity" id="sysDeptInfoMap">
<result property="id" column="ID"/>
<result property="deptId" column="DEPT_ID"/>
<result property="introduction" column="INTRODUCTION"/>
<result property="communityNum" column="COMMUNITY_NUM"/>
<result property="gridNum" column="GRID_NUM"/>
<result property="gridmanNum" column="GRIDMAN_NUM"/>
<result property="partyMemberNum" column="PARTY_MEMBER_NUM"/>
<result property="longitude" column="LONGITUDE"/>
<result property="latitude" column="LATITUDE"/>
<result property="acreage" column="ACREAGE"/>
<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>

2
epdc-cloud-client-yushan

@ -1 +1 @@
Subproject commit 5f3795652ce1dddd3bfced7410ffb36036ed5bbf
Subproject commit 57330e4f0947080d545ed8c2c1003636cd9be806

2
epdc-cloud-commons-yushan

@ -1 +1 @@
Subproject commit ffc7323ae85c274afed21d90e2cd744c2801a1a8
Subproject commit b2a4ab3cff9f848c77e7ec6b428321639270f734
Loading…
Cancel
Save