diff --git a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/BaseDisputeProcessDTO.java b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/BaseDisputeProcessDTO.java index 38ab49fc12..2f377e9ac9 100644 --- a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/BaseDisputeProcessDTO.java +++ b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/BaseDisputeProcessDTO.java @@ -44,6 +44,10 @@ public class BaseDisputeProcessDTO implements Serializable { */ private String customerId; + private Integer detpId; + + private String reporterId; + /** * 网格编码 */ diff --git a/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/ExDeptDTO.java b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/ExDeptDTO.java new file mode 100644 index 0000000000..cd092d52ba --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-client/src/main/java/com/epmet/opendata/dto/ExDeptDTO.java @@ -0,0 +1,81 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.opendata.dto; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 部门(网格)中间表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-19 + */ +@Data +public class ExDeptDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * (市平台)部门id + */ + private Integer deptId; + + /** + * (市平台)父部门id + */ + private Integer parentId; + + /** + * 祖级列表 + */ + private String ancestors; + + /** + * (市平台)部门/网格名称 + */ + private String fullName; + + /** + * (市平台)部门/网格简称 + */ + private String deptName; + + /** + * (市平台)部门/网格编码 + */ + private String deptCode; + + /** + * + */ + private String gridCode; + + /** + * (区县平台)部门id + */ + private String deptIdQx; + + /** + * (区县平台)部门/网格名称 + */ + private String deptNameQx; + +} \ No newline at end of file diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/ExDeptDao.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/ExDeptDao.java new file mode 100644 index 0000000000..23793ddf6d --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/dao/ExDeptDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.opendata.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.opendata.entity.ExDeptEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 部门(网格)中间表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-19 + */ +@Mapper +public interface ExDeptDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseDisputeProcessEntity.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseDisputeProcessEntity.java index c7266558ed..3f458a026a 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseDisputeProcessEntity.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/BaseDisputeProcessEntity.java @@ -44,6 +44,10 @@ public class BaseDisputeProcessEntity extends BaseEpmetEntity { */ private String customerId; + private Integer detpId; + + private String reporterId; + /** * 网格编码 */ diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/ExDeptEntity.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/ExDeptEntity.java new file mode 100644 index 0000000000..68bf992a26 --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/entity/ExDeptEntity.java @@ -0,0 +1,83 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.opendata.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 部门(网格)中间表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ex_dept") +public class ExDeptEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * (市平台)部门id + */ + private Integer deptId; + + /** + * (市平台)父部门id + */ + private Integer parentId; + + /** + * 祖级列表 + */ + private String ancestors; + + /** + * (市平台)部门/网格名称 + */ + private String fullName; + + /** + * (市平台)部门/网格简称 + */ + private String deptName; + + /** + * (市平台)部门/网格编码 + */ + private String deptCode; + + /** + * + */ + private String gridCode; + + /** + * (区县平台)部门id + */ + private String deptIdQx; + + /** + * (区县平台)部门/网格名称 + */ + private String deptNameQx; + +} diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/ExDeptService.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/ExDeptService.java new file mode 100644 index 0000000000..644c06c673 --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/ExDeptService.java @@ -0,0 +1,97 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.opendata.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.opendata.dto.ExDeptDTO; +import com.epmet.opendata.entity.ExDeptEntity; + +import java.util.List; +import java.util.Map; + +/** + * 部门(网格)中间表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-19 + */ +public interface ExDeptService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-10-19 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-10-19 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return ExDeptDTO + * @author generator + * @date 2021-10-19 + */ + ExDeptDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-10-19 + */ + void save(ExDeptDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-10-19 + */ + void update(ExDeptDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-10-19 + */ + void delete(String[] ids); + + Map getDeptMap(); +} \ No newline at end of file diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseDisputeProcessServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseDisputeProcessServiceImpl.java index d716762780..8068eda5cc 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseDisputeProcessServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseDisputeProcessServiceImpl.java @@ -29,11 +29,13 @@ import com.epmet.opendata.dao.BaseDisputeProcessDao; import com.epmet.opendata.dto.BaseDisputeProcessDTO; import com.epmet.opendata.entity.BaseDisputeProcessEntity; import com.epmet.opendata.service.BaseDisputeProcessService; +import com.epmet.opendata.service.ExDeptService; import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; +import java.util.Map; /** * 事件信息表 @@ -45,6 +47,8 @@ import java.util.List; public class BaseDisputeProcessServiceImpl extends BaseServiceImpl implements BaseDisputeProcessService { @Resource private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; + @Resource + private ExDeptService exDeptService; /** * 获取上报事件 @@ -61,9 +65,13 @@ public class BaseDisputeProcessServiceImpl extends BaseServiceImpl deptMap = exDeptService.getDeptMap(); List list = result.getData(); if (CollectionUtils.isNotEmpty(list)) { List entityList = ConvertUtils.sourceToTarget(list, BaseDisputeProcessEntity.class); + entityList.forEach(item -> { + item.setDetpId(deptMap.get(item.getOrgCode())); + }); if(SystemMessageType.PROJECT_ADD.equals(formDTO.getType())){ insertBatch(entityList); }else { @@ -77,6 +85,9 @@ public class BaseDisputeProcessServiceImpl extends BaseServiceImpl entityList = ConvertUtils.sourceToTarget(list, BaseDisputeProcessEntity.class); + entityList.forEach(item -> { + item.setDetpId(deptMap.get(item.getOrgCode())); + }); if("add".equals(formDTO.getType())){ insertBatch(entityList); }else { diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/ExDeptServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/ExDeptServiceImpl.java new file mode 100644 index 0000000000..a2bb40d070 --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/ExDeptServiceImpl.java @@ -0,0 +1,114 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.opendata.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.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.opendata.dao.ExDeptDao; +import com.epmet.opendata.dto.ExDeptDTO; +import com.epmet.opendata.entity.ExDeptEntity; +import com.epmet.opendata.service.ExDeptService; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 部门(网格)中间表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-19 + */ +@Service +public class ExDeptServiceImpl extends BaseServiceImpl implements ExDeptService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, ExDeptDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ExDeptDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public ExDeptDTO get(String id) { + ExDeptEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ExDeptDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ExDeptDTO dto) { + ExDeptEntity entity = ConvertUtils.sourceToTarget(dto, ExDeptEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ExDeptDTO dto) { + ExDeptEntity entity = ConvertUtils.sourceToTarget(dto, ExDeptEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public Map getDeptMap() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + List entityList = baseDao.selectList(wrapper); + if (CollectionUtils.isEmpty(entityList)) { + return Collections.emptyMap(); + } + return entityList.stream().collect(Collectors.toMap(ExDeptEntity::getGridCode, ExDeptEntity::getDeptId, (key1, key2) -> key2)); + } + +} \ No newline at end of file diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExDeptDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExDeptDao.xml new file mode 100644 index 0000000000..db24b07d11 --- /dev/null +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/ExDeptDao.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file