40 changed files with 919 additions and 47 deletions
@ -0,0 +1,22 @@ |
|||
package com.epmet.commons.rocketmq.messages; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author zhaoqifeng |
|||
* @Date 2021/10/18 16:24 |
|||
*/ |
|||
@Data |
|||
@AllArgsConstructor |
|||
public class DisputeProcessMQMsg implements Serializable { |
|||
private String customerId; |
|||
private String projectId; |
|||
/** |
|||
* 操作类型【新增:add 修改删除:edit】 |
|||
*/ |
|||
private String type; |
|||
} |
@ -0,0 +1,81 @@ |
|||
/** |
|||
* 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.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; |
|||
|
|||
} |
@ -0,0 +1,55 @@ |
|||
/** |
|||
* 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.epmet.opendata.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.opendata.entity.BaseGridInfoEntity; |
|||
import com.epmet.opendata.entity.ExDeptEntity; |
|||
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 2021-10-15 |
|||
*/ |
|||
@Mapper |
|||
public interface ExDeptDao extends BaseDao<ExDeptEntity> { |
|||
|
|||
/** |
|||
* @Author sun |
|||
* @Description 网格基础信息批量更新部分字段 |
|||
**/ |
|||
int updateBatch(@Param("list") List<ExDeptEntity> entityList); |
|||
|
|||
/** |
|||
* @Author sun |
|||
* @Description 网格基础信息批量更新部分字段 |
|||
**/ |
|||
int insertBatch(@Param("list") List<ExDeptEntity> entityList); |
|||
|
|||
/** |
|||
* @Author sun |
|||
* @Description 网格基础信息批量更新部分字段 |
|||
**/ |
|||
int updateBatchGrid(@Param("list") List<ExDeptEntity> entityList); |
|||
|
|||
} |
@ -0,0 +1,82 @@ |
|||
/** |
|||
* 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.epmet.opendata.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
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 { |
|||
|
|||
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; |
|||
|
|||
} |
@ -0,0 +1,97 @@ |
|||
/** |
|||
* 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.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<ExDeptEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<ExDeptDTO> |
|||
* @author generator |
|||
* @date 2021-10-19 |
|||
*/ |
|||
PageData<ExDeptDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<ExDeptDTO> |
|||
* @author generator |
|||
* @date 2021-10-19 |
|||
*/ |
|||
List<ExDeptDTO> list(Map<String, Object> 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<String, Integer> getDeptMap(); |
|||
} |
@ -0,0 +1,115 @@ |
|||
/** |
|||
* 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.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<ExDeptDao, ExDeptEntity> implements ExDeptService { |
|||
|
|||
|
|||
@Override |
|||
public PageData<ExDeptDTO> page(Map<String, Object> params) { |
|||
IPage<ExDeptEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, ExDeptDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<ExDeptDTO> list(Map<String, Object> params) { |
|||
List<ExDeptEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, ExDeptDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<ExDeptEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<ExDeptEntity> 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<String, Integer> getDeptMap() { |
|||
LambdaQueryWrapper<ExDeptEntity> wrapper = new LambdaQueryWrapper<>(); |
|||
wrapper.ne(ExDeptEntity::getGridCode, null); |
|||
List<ExDeptEntity> entityList = baseDao.selectList(wrapper); |
|||
if (CollectionUtils.isEmpty(entityList)) { |
|||
return Collections.emptyMap(); |
|||
} |
|||
return entityList.stream().collect(Collectors.toMap(ExDeptEntity::getGridCode, ExDeptEntity::getDeptId, (key1, key2) -> key2)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,95 @@ |
|||
<?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.opendata.dao.ExDeptDao"> |
|||
|
|||
<resultMap type="com.epmet.opendata.entity.ExDeptEntity" id="exDeptMap"> |
|||
<result property="deptId" column="dept_id"/> |
|||
<result property="parentId" column="parent_id"/> |
|||
<result property="ancestors" column="ancestors"/> |
|||
<result property="fullName" column="full_name"/> |
|||
<result property="deptName" column="dept_name"/> |
|||
<result property="deptCode" column="dept_code"/> |
|||
<result property="gridCode" column="grid_code"/> |
|||
<result property="deptIdQx" column="dept_id_qx"/> |
|||
<result property="deptNameQx" column="dept_name_qx"/> |
|||
</resultMap> |
|||
<update id="updateBatch"> |
|||
UPDATE ex_dept |
|||
<trim prefix="set" suffixOverrides=","> |
|||
|
|||
<trim prefix="dept_id_qx =(case" suffix="end),"> |
|||
<foreach collection="list" item="item"> |
|||
<if test='null != item.deptIdQx'> |
|||
when grid_code = #{item.gridCode} then #{item.deptIdQx} |
|||
</if> |
|||
</foreach> |
|||
</trim> |
|||
|
|||
<trim prefix="dept_name_qx =(case" suffix="end),"> |
|||
<foreach collection="list" item="item"> |
|||
<if test='null != item.deptNameQx'> |
|||
when grid_code = #{item.gridCode} then #{item.deptNameQx} |
|||
</if> |
|||
</foreach> |
|||
</trim> |
|||
|
|||
</trim> |
|||
WHERE |
|||
1=1 |
|||
<foreach collection="list" item="item" open="AND( " separator=" OR " index="index" close=")"> |
|||
grid_code = #{item.gridCode} |
|||
</foreach> |
|||
</update> |
|||
|
|||
<insert id="insertBatch"> |
|||
INSERT INTO ex_dept |
|||
( |
|||
dept_id_qx, |
|||
dept_name_qx, |
|||
grid_code |
|||
) |
|||
VALUES |
|||
<foreach collection="list" item="i" separator=","> |
|||
( |
|||
#{i.deptIdQx}, |
|||
#{i.deptNameQx}, |
|||
#{i.gridCode} |
|||
) |
|||
</foreach> |
|||
ON DUPLICATE KEY |
|||
UPDATE |
|||
dept_id_qx = values(dept_id_qx), |
|||
dept_name_qx = values(dept_name_qx) |
|||
</insert> |
|||
|
|||
<update id="updateBatchGrid"> |
|||
UPDATE ex_dept |
|||
<trim prefix="set" suffixOverrides=","> |
|||
|
|||
<trim prefix="dept_id_qx =(case" suffix="end),"> |
|||
<foreach collection="list" item="item"> |
|||
<if test='null != item.deptIdQx'> |
|||
when dept_name LIKE CONCAT(left(#{item.deptNameQx},2),'%',right(#{item.deptNameQx},2),if(LOCATE('第二', #{item.deptNameQx})>0,'%2','%1')) then #{item.deptIdQx} |
|||
</if> |
|||
</foreach> |
|||
</trim> |
|||
|
|||
<trim prefix="dept_name_qx =(case" suffix="end),"> |
|||
<foreach collection="list" item="item"> |
|||
<if test='null != item.deptNameQx'> |
|||
when dept_name LIKE CONCAT(left(#{item.deptNameQx},2),'%',right(#{item.deptNameQx},2),if(LOCATE('第二', #{item.deptNameQx})>0,'%2','%1')) then #{item.deptNameQx} |
|||
</if> |
|||
</foreach> |
|||
</trim> |
|||
|
|||
</trim> |
|||
WHERE |
|||
1=1 |
|||
<foreach collection="list" item="item" open="AND( " separator=" OR " index="index" close=")"> |
|||
dept_name LIKE CONCAT(left(#{item.deptNameQx},2),'%',right(#{item.deptNameQx},2),if(LOCATE('第二', #{item.deptNameQx})>0,'%2','%1')) |
|||
</foreach> |
|||
</update> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue