Browse Source

微网格提交

master
lichao 2 years ago
parent
commit
f98cd52cda
  1. 7
      epmet-cloud-generator/src/main/resources/application.yml
  2. 129
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerMicroGridDTO.java
  3. 46
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerMicroGridPageFormDTO.java
  4. 55
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerMicroGridDetailResultDTO.java
  5. 47
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerMicroGridPageResultDTO.java
  6. 85
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerMicroGridController.java
  7. 25
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerMicroGridDao.java
  8. 99
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerMicroGridEntity.java
  9. 84
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/CustomerMicroGridExcel.java
  10. 30
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/CustomerMicroGridRedis.java
  11. 81
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerMicroGridService.java
  12. 105
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerMicroGridServiceImpl.java
  13. 62
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerMicroGridDao.xml

7
epmet-cloud-generator/src/main/resources/application.yml

@ -9,9 +9,12 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
#MySQL配置
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://118.190.150.119:43306/epmet_gov_org?useUnicode=true&characterEncoding=UTF-8&useSSL=false
url: jdbc:mysql://47.104.92.53:10059/epmet_gov_org?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
password: root
password: elink!123
# url: jdbc:mysql://118.190.150.119:43306/epmet_gov_org?useUnicode=true&characterEncoding=UTF-8&useSSL=false
# username: root
# password: root
#oracle配置
# driverClassName: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@192.168.10.10:1521:helowin

129
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerMicroGridDTO.java

@ -0,0 +1,129 @@
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 微网格表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-11-07
*/
@Data
public class CustomerMicroGridDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID 唯一标识
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 微网格名称
*/
private String microgridName;
/**
* 微网格长
*/
private String contacts;
/**
* 性别(女性-0男性-1)
*/
private String sex;
/**
* 联系电话
*/
private String mobile;
/**
* 地址
*/
private String address;
/**
* 网格id
*/
private Integer gridId;
/**
* 所属组织机构ID
*/
private String agencyId;
/**
* 所有上级组织ID
*/
private String agencyPids;
/**
* 当前网格总人数
*/
private Integer totalUser;
/**
* 网格排序
*/
private Integer sort;
/**
* 中心位置纬度
*/
private String latitude;
/**
* 中心点位地址
*/
private String centerAddress;
/**
* 坐标区域
*/
private String coordinates;
/**
* 编码
*/
private String code;
/**
* 删除标识:0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 更新人
*/
private String updatedBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新时间
*/
private Date updatedTime;
}

46
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerMicroGridPageFormDTO.java

@ -0,0 +1,46 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NonNull;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
/**
* 微网格表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-11-07
*/
@Data
public class CustomerMicroGridPageFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
public interface CustomerMicroGridPage{}
@NotBlank(message = "pageNo不能为空",groups = CustomerMicroGridPageFormDTO.CustomerMicroGridPage.class)
private Integer pageNo;
@NotBlank(message = "pageNo不能为空",groups = CustomerMicroGridPageFormDTO.CustomerMicroGridPage.class)
private Integer pageSize;
private String agencyId;
private String agencyPids;
/**
* 微网格名称
*/
private String microgridName;
/**
* 微网格长
*/
private String contacts;
}

55
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerMicroGridDetailResultDTO.java

@ -0,0 +1,55 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 微网格表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-11-07
*/
@Data
public class CustomerMicroGridDetailResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID 唯一标识
*/
private String id;
/**
* 客户ID
*/
private String customerId;
private String agencyId;
private String communityName;
private String gridId;
private String gridName;
/**
* 微网格名称
*/
private String microgridName;
/**
* 微网格长
*/
private String contacts;
private String sex;
private String mobile;
private String address;
}

47
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerMicroGridPageResultDTO.java

@ -0,0 +1,47 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 微网格表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-11-07
*/
@Data
public class CustomerMicroGridPageResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID 唯一标识
*/
private String id;
/**
* 客户ID
*/
private String customerId;
private String communityName;
private String gridName;
/**
* 微网格名称
*/
private String microgridName;
/**
* 微网格长
*/
private String contacts;
}

85
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerMicroGridController.java

@ -0,0 +1,85 @@
package com.epmet.controller;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.CustomerMicroGridDTO;
import com.epmet.dto.form.CustomerMicroGridPageFormDTO;
import com.epmet.dto.result.CustomerMicroGridDetailResultDTO;
import com.epmet.dto.result.CustomerMicroGridPageResultDTO;
import com.epmet.excel.CustomerMicroGridExcel;
import com.epmet.service.CustomerMicroGridService;
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 generator generator@elink-cn.com
* @since v1.0.0 2023-11-07
*/
@RestController
@RequestMapping("customerMicroGrid")
public class CustomerMicroGridController {
@Autowired
private CustomerMicroGridService customerMicroGridService;
@PostMapping("page")
public Result<PageData<CustomerMicroGridPageResultDTO>> page(@RequestBody CustomerMicroGridPageFormDTO dto){
PageData<CustomerMicroGridPageResultDTO> page = customerMicroGridService.page(dto);
return new Result<PageData<CustomerMicroGridPageResultDTO>>().ok(page);
}
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET})
public Result<CustomerMicroGridDetailResultDTO> get(@PathVariable("id") String id){
CustomerMicroGridDetailResultDTO data = customerMicroGridService.get(id);
return new Result<CustomerMicroGridDetailResultDTO>().ok(data);
}
@NoRepeatSubmit
@PostMapping("save")
public Result save(@RequestBody CustomerMicroGridDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
customerMicroGridService.save(dto);
return new Result();
}
@NoRepeatSubmit
@PostMapping("update")
public Result update(@RequestBody CustomerMicroGridDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
customerMicroGridService.update(dto);
return new Result();
}
@PostMapping("delete")
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
customerMicroGridService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<CustomerMicroGridDTO> list = customerMicroGridService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, CustomerMicroGridExcel.class);
}
}

25
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerMicroGridDao.java

@ -0,0 +1,25 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.CustomerMicroGridPageFormDTO;
import com.epmet.dto.result.CustomerMicroGridDetailResultDTO;
import com.epmet.dto.result.CustomerMicroGridPageResultDTO;
import com.epmet.entity.CustomerMicroGridEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 微网格表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-11-07
*/
@Mapper
public interface CustomerMicroGridDao extends BaseDao<CustomerMicroGridEntity> {
List<CustomerMicroGridPageResultDTO> selectPageList(CustomerMicroGridPageFormDTO dto);
CustomerMicroGridDetailResultDTO selectDetailById(@Param("id") String id);
}

99
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerMicroGridEntity.java

@ -0,0 +1,99 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 微网格表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-11-07
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("customer_micro_grid")
public class CustomerMicroGridEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 微网格名称
*/
private String microgridName;
/**
* 微网格长
*/
private String contacts;
/**
* 性别(女性-0男性-1)
*/
private String sex;
/**
* 联系电话
*/
private String mobile;
/**
* 地址
*/
private String address;
/**
* 网格id
*/
private Integer gridId;
/**
* 所属组织机构ID
*/
private String agencyId;
/**
* 所有上级组织ID
*/
private String agencyPids;
/**
* 当前网格总人数
*/
private Integer totalUser;
/**
* 网格排序
*/
private Integer sort;
/**
* 中心位置纬度
*/
private String latitude;
/**
* 中心点位地址
*/
private String centerAddress;
/**
* 坐标区域
*/
private String coordinates;
/**
* 编码
*/
private String code;
}

84
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/CustomerMicroGridExcel.java

@ -0,0 +1,84 @@
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 微网格表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-11-07
*/
@Data
public class CustomerMicroGridExcel {
@Excel(name = "ID 唯一标识")
private String id;
@Excel(name = "客户ID")
private String customerId;
@Excel(name = "微网格名称")
private String microgridName;
@Excel(name = "微网格长")
private String contacts;
@Excel(name = "性别(女性-0,男性-1)")
private String sex;
@Excel(name = "联系电话")
private String mobile;
@Excel(name = "地址")
private String address;
@Excel(name = "网格id")
private Integer gridId;
@Excel(name = "所属组织机构ID")
private String agencyId;
@Excel(name = "所有上级组织ID")
private String agencyPids;
@Excel(name = "当前网格总人数")
private Integer totalUser;
@Excel(name = "网格排序")
private Integer sort;
@Excel(name = "中心位置纬度")
private String latitude;
@Excel(name = "中心点位地址")
private String centerAddress;
@Excel(name = "坐标区域")
private String coordinates;
@Excel(name = "编码")
private String code;
@Excel(name = "删除标识:0.未删除 1.已删除")
private Integer delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新时间")
private Date updatedTime;
}

30
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/CustomerMicroGridRedis.java

@ -0,0 +1,30 @@
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 微网格表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-11-07
*/
@Component
public class CustomerMicroGridRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

81
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerMicroGridService.java

@ -0,0 +1,81 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.CustomerMicroGridDTO;
import com.epmet.dto.form.CustomerMicroGridPageFormDTO;
import com.epmet.dto.result.CustomerMicroGridDetailResultDTO;
import com.epmet.dto.result.CustomerMicroGridPageResultDTO;
import com.epmet.entity.CustomerMicroGridEntity;
import java.util.List;
import java.util.Map;
/**
* 微网格表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-11-07
*/
public interface CustomerMicroGridService extends BaseService<CustomerMicroGridEntity> {
/**
* 默认分页
*
* @param dto
* @return PageData<CustomerMicroGridDTO>
* @author generator
* @date 2023-11-07
*/
PageData<CustomerMicroGridPageResultDTO> page(CustomerMicroGridPageFormDTO dto);
/**
* 默认查询
*
* @param params
* @return java.util.List<CustomerMicroGridDTO>
* @author generator
* @date 2023-11-07
*/
List<CustomerMicroGridDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return CustomerMicroGridDTO
* @author generator
* @date 2023-11-07
*/
CustomerMicroGridDetailResultDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2023-11-07
*/
void save(CustomerMicroGridDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2023-11-07
*/
void update(CustomerMicroGridDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2023-11-07
*/
void delete(String[] ids);
}

105
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerMicroGridServiceImpl.java

@ -0,0 +1,105 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.CustomerAgencyDao;
import com.epmet.dao.CustomerMicroGridDao;
import com.epmet.dto.CustomerMicroGridDTO;
import com.epmet.dto.IcBirthRecordDTO;
import com.epmet.dto.form.CustomerMicroGridPageFormDTO;
import com.epmet.dto.result.CustomerMicroGridDetailResultDTO;
import com.epmet.dto.result.CustomerMicroGridPageResultDTO;
import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.entity.CustomerMicroGridEntity;
import com.epmet.redis.CustomerMicroGridRedis;
import com.epmet.service.CustomerMicroGridService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
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 generator generator@elink-cn.com
* @since v1.0.0 2023-11-07
*/
@Service
public class CustomerMicroGridServiceImpl extends BaseServiceImpl<CustomerMicroGridDao, CustomerMicroGridEntity> implements CustomerMicroGridService {
@Autowired
private CustomerMicroGridRedis customerMicroGridRedis;
@Autowired
private CustomerAgencyDao customerAgencyDao;
@Override
public PageData<CustomerMicroGridPageResultDTO> page(CustomerMicroGridPageFormDTO dto) {
// 获取所有的pids
if (StringUtils.isNotBlank(dto.getAgencyId())){
CustomerAgencyEntity customerAgencyEntity = customerAgencyDao.selectById(dto.getAgencyId());
dto.setAgencyPids(customerAgencyEntity.getPids().concat(":").concat(dto.getAgencyId()));
}
PageHelper.startPage(dto.getPageNo(), dto.getPageSize());
List<CustomerMicroGridPageResultDTO> entityList = baseDao.selectPageList(dto);
PageInfo<CustomerMicroGridPageResultDTO> pageInfo = new PageInfo<>(entityList);
return new PageData<>(pageInfo.getList(), pageInfo.getTotal());
}
@Override
public List<CustomerMicroGridDTO> list(Map<String, Object> params) {
List<CustomerMicroGridEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, CustomerMicroGridDTO.class);
}
private QueryWrapper<CustomerMicroGridEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<CustomerMicroGridEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public CustomerMicroGridDetailResultDTO get(String id) {
CustomerMicroGridDetailResultDTO resultDTO = baseDao.selectDetailById(id);
return resultDTO;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(CustomerMicroGridDTO dto) {
CustomerMicroGridEntity entity = ConvertUtils.sourceToTarget(dto, CustomerMicroGridEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(CustomerMicroGridDTO dto) {
CustomerMicroGridEntity entity = ConvertUtils.sourceToTarget(dto, CustomerMicroGridEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

62
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerMicroGridDao.xml

@ -0,0 +1,62 @@
<?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.epmet.dao.CustomerMicroGridDao">
<resultMap type="com.epmet.entity.CustomerMicroGridEntity" id="customerMicroGridMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="microgridName" column="MICROGRID_NAME"/>
<result property="contacts" column="CONTACTS"/>
<result property="sex" column="SEX"/>
<result property="mobile" column="MOBILE"/>
<result property="address" column="ADDRESS"/>
<result property="gridId" column="GRID_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="agencyPids" column="AGENCY_PIDS"/>
<result property="totalUser" column="TOTAL_USER"/>
<result property="sort" column="SORT"/>
<result property="latitude" column="LATITUDE"/>
<result property="centerAddress" column="CENTER_ADDRESS"/>
<result property="coordinates" column="COORDINATES"/>
<result property="code" column="CODE"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="selectPageList" resultType="com.epmet.dto.result.CustomerMicroGridPageResultDTO">
select micgrid.ID as id, agency.ORGANIZATION_NAME as communityName,grid.GRID_NAME as gridName,
micgrid.CONTACTS as contacts
from customer_micro_grid micgrid
left join customer_agency agency on agency.ID = micgrid.AGENCY_ID
left join customer_grid grid on grid.ID = micgrid.GRID_ID
where micgrid.DEL_FLAG = 0
<if test="agencyPids != null and agencyPids !=''">
and micgrid.AGENCY_PIDS like concat(#{agencyPids},'%')
</if>
<if test="contacts != null and contacts !=''">
and micgrid.CONTACTS like concat('%',#{contacts},'%')
</if>
</select>
<select id="selectDetailById" resultType="com.epmet.dto.result.CustomerMicroGridDetailResultDTO">
select micgrid.ID as id,
micgrid.AGENCY_ID as agencyId,
agency.ORGANIZATION_NAME as communityName,
micgrid.GRID_ID as gridId,
grid.GRID_NAME as gridName,
micgrid.CONTACTS as contacts,
micgrid.SEX as sex,
micgrid.MOBILE as mobile,
micgrid.ADDRESS as address
from customer_micro_grid micgrid
left join customer_agency agency on agency.ID = micgrid.AGENCY_ID
left join customer_grid grid on grid.ID = micgrid.GRID_ID
where micgrid.DEL_FLAG = 0
and micgrid.ID = #{id}
</select>
</mapper>
Loading…
Cancel
Save