31 changed files with 1180 additions and 71 deletions
@ -0,0 +1,156 @@ |
|||
/** |
|||
* 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.consult; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 网格力量信息 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-02 |
|||
*/ |
|||
@Data |
|||
public class GridForceInfoDTO implements Serializable { |
|||
|
|||
|
|||
private static final long serialVersionUID = -5547515827043486675L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 用户姓名 |
|||
*/ |
|||
private String realName; |
|||
|
|||
/** |
|||
* 性别 0女 1男 |
|||
*/ |
|||
private String sex; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 联系电话 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
/** |
|||
* 身份证号 |
|||
*/ |
|||
private String identityNo; |
|||
|
|||
/** |
|||
* 头像访问地址 |
|||
*/ |
|||
private String faceImg; |
|||
|
|||
/** |
|||
* 工作单位 |
|||
*/ |
|||
private String workUnit; |
|||
|
|||
/** |
|||
* 职责类别id |
|||
*/ |
|||
private String dutyCategoryId; |
|||
|
|||
/** |
|||
* 前端收费展示 0否 1是 |
|||
*/ |
|||
private String showFlag; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 居住网格id |
|||
*/ |
|||
private String deptId; |
|||
|
|||
/** |
|||
* 父所有部门 |
|||
*/ |
|||
private String parentDeptIds; |
|||
|
|||
/** |
|||
* 父所有部门 |
|||
*/ |
|||
private String parentDeptNames; |
|||
|
|||
/** |
|||
* 所有部门ID |
|||
*/ |
|||
private String allDeptIds; |
|||
|
|||
/** |
|||
* 所有部门名称 |
|||
*/ |
|||
private String allDeptNames; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 删除标识 0:否,1:是 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
///////////////////下面的字段,为pc页面上送数据的绑定字段/////////////////////////////////
|
|||
|
|||
/** |
|||
* 新增是,选择所属网格,多选 |
|||
*/ |
|||
private List<Long[]> selectedDeptIds; |
|||
|
|||
} |
@ -0,0 +1,48 @@ |
|||
package com.elink.esua.epdc.dto.consult.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author: qushutong |
|||
* @Date: 2020/3/3 9:42 |
|||
* @Description: 获取网格内网格员公示信息 入参 |
|||
*/ |
|||
@Data |
|||
public class GridForceListFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 6657811237503660654L; |
|||
|
|||
|
|||
/** |
|||
* pageIndex : 9380 |
|||
* pageSize : 77145 |
|||
* timestamp : bvthA2vDrf |
|||
*/ |
|||
|
|||
/** |
|||
* 页码,从1开始 |
|||
*/ |
|||
private Integer pageIndex; |
|||
|
|||
/** |
|||
* 页容量,默认10页 |
|||
*/ |
|||
private Integer pageSize = 10; |
|||
|
|||
/** |
|||
* 第一页查询发起时的时间 |
|||
*/ |
|||
private String timestamp; |
|||
|
|||
/** |
|||
* 网格id |
|||
*/ |
|||
private Long deptId; |
|||
|
|||
/** |
|||
* 父级部门ID |
|||
*/ |
|||
private String parentDeptIds; |
|||
|
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.elink.esua.epdc.dto.consult.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author: qushutong |
|||
* @Date: 2020/3/3 9:33 |
|||
* @Description: 获取网格内网格员公示信息 |
|||
*/ |
|||
@Data |
|||
public class GridForceListResultDTO implements Serializable { |
|||
|
|||
|
|||
private static final long serialVersionUID = 4048573836211284289L; |
|||
|
|||
private String realName; |
|||
private String sex; |
|||
private String mobile; |
|||
private String dutyCategoryName; |
|||
private String remark; |
|||
private String workUnit; |
|||
private String faceImg; |
|||
|
|||
} |
@ -0,0 +1,117 @@ |
|||
package com.elink.esua.epdc.modules.consult.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.annotation.DataFilter; |
|||
import com.elink.esua.epdc.commons.tools.annotation.MaskResponse; |
|||
import com.elink.esua.epdc.commons.tools.enums.YesOrNoEnum; |
|||
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.IdentityNoUtils; |
|||
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.DefaultGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
|||
import com.elink.esua.epdc.dto.consult.GridForceInfoDTO; |
|||
import com.elink.esua.epdc.dto.consult.form.GridForceListFormDTO; |
|||
import com.elink.esua.epdc.dto.consult.result.GridForceListResultDTO; |
|||
import com.elink.esua.epdc.modules.consult.excel.GridOperatorInfoExcel; |
|||
import com.elink.esua.epdc.modules.consult.service.GridForceInfoService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
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 yan Lu |
|||
* @description 网格力量 |
|||
* @create 2023/7/13 10:20 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("gridForceinfo") |
|||
public class GridForceController { |
|||
|
|||
@Autowired |
|||
private GridForceInfoService gridForceInfoService; |
|||
|
|||
@GetMapping("page") |
|||
@MaskResponse(fieldNames = {"mobile", "identityNo"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD}) |
|||
@DataFilter(tableAlias = "t", deptId = "DEPT_ID", prefix = "AND", isPendingCreator = false) |
|||
public Result<PageData<GridForceInfoDTO>> page(@RequestParam Map<String, Object> params) { |
|||
PageData<GridForceInfoDTO> page = gridForceInfoService.getEnterpriseInfoPageFromPc(params); |
|||
return new Result<PageData<GridForceInfoDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<GridForceInfoDTO> get(@PathVariable("id") String id) { |
|||
GridForceInfoDTO data = gridForceInfoService.get(id); |
|||
return new Result<GridForceInfoDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody GridForceInfoDTO dto) { |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
//校验身份证
|
|||
if (StringUtils.isNotBlank(dto.getIdentityNo())) { |
|||
String idenNoMsg = IdentityNoUtils.IdentityNoVerification(dto.getIdentityNo()); |
|||
if (idenNoMsg != null) { |
|||
return new Result().error(idenNoMsg); |
|||
} |
|||
} |
|||
dto.setShowFlag(YesOrNoEnum.NO.value()); |
|||
gridForceInfoService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody GridForceInfoDTO dto) { |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
//校验身份证
|
|||
if (StringUtils.isNotBlank(dto.getIdentityNo())) { |
|||
String idenNoMsg = IdentityNoUtils.IdentityNoVerification(dto.getIdentityNo()); |
|||
if (idenNoMsg != null) { |
|||
return new Result().error(idenNoMsg); |
|||
} |
|||
} |
|||
gridForceInfoService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids) { |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
gridForceInfoService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PostMapping("changeShowFlag") |
|||
public Result changeShowFlag(@RequestBody GridForceInfoDTO dto) { |
|||
gridForceInfoService.changeShowFlag(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<GridForceInfoDTO> list = gridForceInfoService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, GridOperatorInfoExcel.class); |
|||
} |
|||
|
|||
/*** |
|||
* 获取网格内网格员公示信息 |
|||
* @param formDto |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.consult.result.GridForceListResultDTO>> |
|||
* @author qushutong |
|||
* @date 2020/3/3 11:19 |
|||
*/ |
|||
@PostMapping("listGridForce") |
|||
public Result<List<GridForceListResultDTO>> listPageGridForce(@RequestBody GridForceListFormDTO formDto) { |
|||
return gridForceInfoService.listPageGridForce(formDto); |
|||
} |
|||
} |
@ -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.consult.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.dto.consult.GridForceInfoDTO; |
|||
import com.elink.esua.epdc.dto.consult.form.GridForceListFormDTO; |
|||
import com.elink.esua.epdc.dto.consult.result.GridForceListResultDTO; |
|||
import com.elink.esua.epdc.modules.consult.entity.GridForceInfoEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 网格员信息 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-02 |
|||
*/ |
|||
@Mapper |
|||
public interface GridForceInfoDao extends BaseDao<GridForceInfoEntity> { |
|||
|
|||
/** |
|||
* @return java.util.List<com.elink.esua.epdc.modules.consult.entity.GridForceInfoEntity> |
|||
* @Description pc查询网格员信息列表 |
|||
* @Author songyunpeng |
|||
* @Date 2020/3/3 |
|||
* @Param [params] |
|||
**/ |
|||
List<GridForceInfoDTO> selectGridForceInfoPageFromPc(Map<String, Object> params); |
|||
|
|||
|
|||
/*** |
|||
* 获取网格内网格员公示信息 |
|||
* @param |
|||
* @return java.util.List<com.elink.esua.epdc.dto.consult.result.GridOperatorListResultDTO> |
|||
* @author qushutong |
|||
* @date 2020/3/3 9:57 |
|||
*/ |
|||
List<GridForceListResultDTO> selectListGridForce(GridForceListFormDTO formDto); |
|||
|
|||
/** |
|||
* 查询需要修改的组织机构信息 |
|||
* |
|||
* @return java.util.List<com.elink.esua.epdc.dto.consult.GridForceInfoDTO> |
|||
* @params [deptId] |
|||
* @author liuchuang |
|||
* @since 2020/3/7 14:09 |
|||
*/ |
|||
List<GridForceInfoDTO> selectListOfOrganizationInfo(String deptId); |
|||
} |
@ -0,0 +1,114 @@ |
|||
/** |
|||
* 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.consult.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 网格力量信息 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-02 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("epdc_grid_force_info") |
|||
public class GridForceInfoEntity extends BaseEpdcEntity { |
|||
|
|||
|
|||
private static final long serialVersionUID = -8743963104454300507L; |
|||
|
|||
/** |
|||
* 用户姓名 |
|||
*/ |
|||
private String realName; |
|||
|
|||
/** |
|||
* 性别 0女 1男 |
|||
*/ |
|||
private String sex; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 联系电话 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
/** |
|||
* 身份证号 |
|||
*/ |
|||
private String identityNo; |
|||
|
|||
/** |
|||
* 头像访问地址 |
|||
*/ |
|||
private String faceImg; |
|||
|
|||
/** |
|||
* 工作单位 |
|||
*/ |
|||
private String workUnit; |
|||
|
|||
/** |
|||
* 职责类别id |
|||
*/ |
|||
private String dutyCategoryId; |
|||
|
|||
/** |
|||
* 前端是否展示 0否 1是 |
|||
*/ |
|||
private String showFlag; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 居住网格id |
|||
*/ |
|||
private Long deptId; |
|||
|
|||
/** |
|||
* 父所有部门 |
|||
*/ |
|||
private String parentDeptIds; |
|||
|
|||
/** |
|||
* 父所有部门 |
|||
*/ |
|||
private String parentDeptNames; |
|||
|
|||
/** |
|||
* 所有部门ID |
|||
*/ |
|||
private String allDeptIds; |
|||
|
|||
/** |
|||
* 所有部门名称 |
|||
*/ |
|||
private String allDeptNames; |
|||
|
|||
} |
@ -0,0 +1,145 @@ |
|||
/** |
|||
* 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.consult.service; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.consult.GridForceInfoDTO; |
|||
import com.elink.esua.epdc.dto.consult.form.GridForceListFormDTO; |
|||
import com.elink.esua.epdc.dto.consult.result.GridForceListResultDTO; |
|||
import com.elink.esua.epdc.modules.consult.entity.GridForceInfoEntity; |
|||
import com.elink.esua.epdc.rocketmq.dto.OrganizationModifyDTO; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 网格力量信息 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-02 |
|||
*/ |
|||
public interface GridForceInfoService extends BaseService<GridForceInfoEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<GridForceInfoDTO> |
|||
* @author generator |
|||
* @date 2020-03-02 |
|||
*/ |
|||
PageData<GridForceInfoDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<GridForceInfoDTO> |
|||
* @author generator |
|||
* @date 2020-03-02 |
|||
*/ |
|||
List<GridForceInfoDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return GridForceInfoDTO |
|||
* @author generator |
|||
* @date 2020-03-02 |
|||
*/ |
|||
GridForceInfoDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-02 |
|||
*/ |
|||
void save(GridForceInfoDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-02 |
|||
*/ |
|||
void update(GridForceInfoDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-02 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* @return void |
|||
* @Description 是否展示 |
|||
* @Author songyunpeng |
|||
* @Date 2020/3/2 |
|||
* @Param [dto] |
|||
**/ |
|||
void changeShowFlag(GridForceInfoDTO dto); |
|||
|
|||
/** |
|||
* @return com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.consult.GridForceInfoDTO> |
|||
* @Description pc网格员列表 |
|||
* @Author songyunpeng |
|||
* @Date 2020/3/3 |
|||
* @Param [params] |
|||
**/ |
|||
PageData<GridForceInfoDTO> getEnterpriseInfoPageFromPc(Map<String, Object> params); |
|||
|
|||
/*** |
|||
* 获取网格内网格员公示信息 |
|||
* @param |
|||
* @return java.util.List<com.elink.esua.epdc.dto.consult.result.GridForceListResultDTO> |
|||
* @author qushutong |
|||
* @date 2020/3/3 9:52 |
|||
*/ |
|||
Result<List<GridForceListResultDTO>> listPageGridForce(GridForceListFormDTO formDto); |
|||
|
|||
/*** |
|||
* 判断网格员职责类别下是够被关联 |
|||
* @param |
|||
* @return boolean |
|||
* @author qushutong |
|||
* @date 2020/3/4 12:43 |
|||
*/ |
|||
boolean isExistsByDutyId(String dutyCategoryId); |
|||
|
|||
/** |
|||
* 修改组织机构信息 |
|||
* |
|||
* @return void |
|||
* @params [dto] |
|||
* @author liuchuang |
|||
* @since 2020/3/7 1:23 |
|||
*/ |
|||
void modifyOrganizationInfo(OrganizationModifyDTO dto); |
|||
} |
@ -0,0 +1,230 @@ |
|||
/** |
|||
* 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.consult.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.constant.FieldConstant; |
|||
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|||
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.utils.Result; |
|||
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
|||
import com.elink.esua.epdc.dto.consult.GridForceInfoDTO; |
|||
import com.elink.esua.epdc.dto.consult.form.GridForceListFormDTO; |
|||
import com.elink.esua.epdc.dto.consult.result.GridForceListResultDTO; |
|||
import com.elink.esua.epdc.modules.consult.dao.GridForceInfoDao; |
|||
import com.elink.esua.epdc.modules.consult.entity.GridForceInfoEntity; |
|||
import com.elink.esua.epdc.modules.consult.service.GridForceInfoService; |
|||
import com.elink.esua.epdc.modules.feign.AdminFeignClient; |
|||
import com.elink.esua.epdc.rocketmq.dto.OrganizationModifyDTO; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.ArrayList; |
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 网格力量信息 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-02 |
|||
*/ |
|||
@Service |
|||
public class GridForceInfoServiceImpl extends BaseServiceImpl<GridForceInfoDao, GridForceInfoEntity> implements GridForceInfoService { |
|||
|
|||
@Resource |
|||
private AdminFeignClient adminFeignClient; |
|||
|
|||
@Override |
|||
public PageData<GridForceInfoDTO> page(Map<String, Object> params) { |
|||
IPage<GridForceInfoEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, GridForceInfoDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<GridForceInfoDTO> list(Map<String, Object> params) { |
|||
List<GridForceInfoEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, GridForceInfoDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<GridForceInfoEntity> getWrapper(Map<String, Object> params) { |
|||
String id = (String) params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<GridForceInfoEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public GridForceInfoDTO get(String id) { |
|||
GridForceInfoEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, GridForceInfoDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(GridForceInfoDTO dto) { |
|||
GridForceInfoEntity entity = ConvertUtils.sourceToTarget(dto, GridForceInfoEntity.class); |
|||
if (StringUtils.isNotEmpty(dto.getDeptId())) { |
|||
fillDeptInfoByGridId(entity, Long.valueOf(dto.getDeptId())); |
|||
}else { |
|||
throw new RenException("请选择所属部门"); |
|||
} |
|||
baseDao.insert(entity); |
|||
} |
|||
|
|||
/** |
|||
* 组装网格人员机构信息 |
|||
* |
|||
* @param gridOperator 网格员对象 |
|||
* @param gridId 网格id |
|||
* @return void |
|||
* @author work@yujt.net.cn |
|||
* @date 2020/3/12 13:37 |
|||
*/ |
|||
private void fillDeptInfoByGridId(GridForceInfoEntity gridOperator, Long gridId) { |
|||
Result<ParentAndAllDeptDTO> adminResult = adminFeignClient.getParentAndAllDept(String.valueOf(gridId)); |
|||
if (!adminResult.success() || null == adminResult.getData()) { |
|||
return; |
|||
} |
|||
ParentAndAllDeptDTO deptInfo = adminResult.getData(); |
|||
gridOperator.setAllDeptIds(deptInfo.getAllDeptIds()); |
|||
gridOperator.setAllDeptNames(deptInfo.getAllDeptNames()); |
|||
gridOperator.setParentDeptIds(deptInfo.getParentDeptIds()); |
|||
gridOperator.setParentDeptNames(deptInfo.getParentDeptNames()); |
|||
gridOperator.setDeptId(gridId); |
|||
} |
|||
|
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(GridForceInfoDTO dto) { |
|||
GridForceInfoEntity entity = ConvertUtils.sourceToTarget(dto, GridForceInfoEntity.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 changeShowFlag(GridForceInfoDTO dto) { |
|||
GridForceInfoEntity GridForceInfoEntity = new GridForceInfoEntity(); |
|||
GridForceInfoEntity.setId(dto.getId()); |
|||
GridForceInfoEntity.setShowFlag(dto.getShowFlag()); |
|||
updateById(GridForceInfoEntity); |
|||
} |
|||
|
|||
@Override |
|||
public PageData<GridForceInfoDTO> getEnterpriseInfoPageFromPc(Map<String, Object> params) { |
|||
IPage<GridForceInfoDTO> page = getPage(params); |
|||
List<GridForceInfoDTO> list = baseDao.selectGridForceInfoPageFromPc(params); |
|||
return new PageData<>(list, page.getTotal()); |
|||
} |
|||
|
|||
@Override |
|||
public Result<List<GridForceListResultDTO>> listPageGridForce(GridForceListFormDTO formDto) { |
|||
if (null != formDto.getDeptId()) { |
|||
Result<ParentAndAllDeptDTO> parentResult = adminFeignClient.getParentAndAllDept(String.valueOf(formDto.getDeptId())); |
|||
if (null != parentResult) { |
|||
formDto.setParentDeptIds(parentResult.getData().getParentDeptIds()); |
|||
formDto.setDeptId(null); |
|||
} |
|||
} |
|||
List<GridForceListResultDTO> list = baseDao.selectListGridForce(formDto); |
|||
return new Result<List<GridForceListResultDTO>>().ok(list); |
|||
} |
|||
|
|||
@Override |
|||
public boolean isExistsByDutyId(String dutyCategoryId) { |
|||
QueryWrapper queryWrapper = new QueryWrapper(); |
|||
queryWrapper.eq(StringUtils.isNotBlank(dutyCategoryId), "DUTY_CATEGORY_ID", dutyCategoryId); |
|||
Integer integer = baseDao.selectCount(queryWrapper); |
|||
if (integer > 0) { |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void modifyOrganizationInfo(OrganizationModifyDTO dto) { |
|||
// 查询需要修改的组织机构信息
|
|||
List<GridForceInfoDTO> gridList = baseDao.selectListOfOrganizationInfo(dto.getDeptId().toString()); |
|||
if (null != gridList && gridList.size() > 0) { |
|||
// 组织机构信息处理
|
|||
List<GridForceInfoEntity> entities = handleOrganizationInfo(dto, gridList); |
|||
// 更新事件组织机构信息
|
|||
updateBatchById(entities); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 组织机构信息处理 |
|||
* |
|||
* @return java.util.List<com.elink.esua.epdc.modules.consult.entity.GridForceInfoEntity> |
|||
* @params [dto, gridList] |
|||
* @author liuchuang |
|||
* @since 2020/3/7 14:12 |
|||
*/ |
|||
private List<GridForceInfoEntity> handleOrganizationInfo(OrganizationModifyDTO dto, List<GridForceInfoDTO> gridList) { |
|||
List<GridForceInfoEntity> entities = new ArrayList<>(); |
|||
for (GridForceInfoDTO grid : gridList) { |
|||
GridForceInfoEntity entity = new GridForceInfoEntity(); |
|||
if ("grid_party".equals(dto.getTypeKey())) { |
|||
entity.setId(grid.getId()); |
|||
entity.setAllDeptIds(dto.getAllDeptIds()); |
|||
entity.setAllDeptNames(dto.getAllDeptNames()); |
|||
entity.setParentDeptIds(dto.getParentDeptIds()); |
|||
entity.setParentDeptNames(dto.getParentDeptNames()); |
|||
} |
|||
if ("community_party".equals(dto.getTypeKey())) { |
|||
List<String> allDeptIds = Arrays.asList(grid.getAllDeptIds().split(",")); |
|||
List<String> allDeptNames = Arrays.asList(grid.getAllDeptNames().split("-")); |
|||
int index = allDeptIds.indexOf(dto.getDeptId().toString()); |
|||
String gridName = allDeptNames.get(index + 1); |
|||
String girdId = allDeptIds.get(index + 1); |
|||
entity.setId(grid.getId()); |
|||
entity.setAllDeptIds(dto.getAllDeptIds() + "," + girdId); |
|||
entity.setAllDeptNames(dto.getAllDeptNames() + "-" + gridName); |
|||
entity.setParentDeptIds(dto.getAllDeptIds()); |
|||
entity.setParentDeptNames(dto.getAllDeptNames()); |
|||
|
|||
} |
|||
entities.add(entity); |
|||
} |
|||
|
|||
return entities; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,87 @@ |
|||
<?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.consult.dao.GridForceInfoDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.modules.consult.entity.GridForceInfoEntity" id="gridForceInfoMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="realName" column="REAL_NAME"/> |
|||
<result property="sex" column="SEX"/> |
|||
<result property="sort" column="SORT"/> |
|||
<result property="mobile" column="MOBILE"/> |
|||
<result property="identityNo" column="IDENTITY_NO"/> |
|||
<result property="faceImg" column="FACE_IMG"/> |
|||
<result property="workUnit" column="WORK_UNIT"/> |
|||
<result property="dutyCategoryId" column="DUTY_CATEGORY_ID"/> |
|||
<result property="showFlag" column="SHOW_FLAG"/> |
|||
<result property="remark" column="REMARK"/> |
|||
<result property="deptId" column="DEPT_ID"/> |
|||
<result property="parentDeptIds" column="PARENT_DEPT_IDS"/> |
|||
<result property="parentDeptNames" column="PARENT_DEPT_NAMES"/> |
|||
<result property="allDeptIds" column="ALL_DEPT_IDS"/> |
|||
<result property="allDeptNames" column="ALL_DEPT_NAMES"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<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> |
|||
|
|||
<select id="selectGridForceInfoPageFromPc" resultType="com.elink.esua.epdc.dto.consult.GridForceInfoDTO"> |
|||
select * from epdc_grid_force_info t |
|||
where DEL_FLAG = '0' |
|||
<if test="streetId != null and streetId != ''"> |
|||
AND (find_in_set(#{streetId},PARENT_DEPT_IDS) |
|||
OR find_in_set(#{streetId},ALL_DEPT_IDS)) |
|||
</if> |
|||
<if test="communityId != null and communityId != ''"> |
|||
AND (find_in_set(#{communityId},PARENT_DEPT_IDS) |
|||
OR find_in_set(#{communityId},ALL_DEPT_IDS)) |
|||
</if> |
|||
<if test="gridId != null and gridId != ''"> |
|||
AND (find_in_set(#{gridId},PARENT_DEPT_IDS) |
|||
OR find_in_set(#{gridId},ALL_DEPT_IDS)) |
|||
</if> |
|||
ORDER BY |
|||
SORT ASC, |
|||
CREATED_TIME DESC |
|||
</select> |
|||
<select id="selectListGridForce" resultType="com.elink.esua.epdc.dto.consult.result.GridForceListResultDTO"> |
|||
SELECT |
|||
ei.REAL_NAME, |
|||
ei.SEX, |
|||
ei.MOBILE, |
|||
ei.REMARK, |
|||
ei.FACE_IMG, |
|||
SUBSTRING_INDEX(ei.ALL_DEPT_NAMES,'-',-1) AS workUnit, |
|||
ec.DUTY_CATEGORY_NAME |
|||
FROM |
|||
epdc_grid_force_info ei |
|||
LEFT JOIN epdc_grid_operator_duty_category ec ON ec.ID = ei.DUTY_CATEGORY_ID AND ec.DEL_FLAG = '0' |
|||
WHERE ei.DEL_FLAG = '0' |
|||
<if test="null != deptId"> |
|||
AND ei.DEPT_ID = #{deptId} |
|||
</if> |
|||
<if test="null != parentDeptIds and parentDeptIds != ''"> |
|||
AND ei.PARENT_DEPT_IDS LIKE concat('%', #{parentDeptIds}) |
|||
</if> |
|||
ORDER BY |
|||
ei.SORT ASC, |
|||
ei.CREATED_TIME DESC |
|||
</select> |
|||
|
|||
<select id="selectListOfOrganizationInfo" resultType="com.elink.esua.epdc.dto.consult.GridForceInfoDTO"> |
|||
SELECT |
|||
ID, |
|||
PARENT_DEPT_IDS, |
|||
PARENT_DEPT_NAMES, |
|||
ALL_DEPT_IDS as allDeptIdsStr, |
|||
ALL_DEPT_NAMES |
|||
FROM |
|||
epdc_grid_force_info |
|||
WHERE |
|||
FIND_IN_SET( #{deptId}, ALL_DEPT_IDS ) |
|||
</select> |
|||
|
|||
</mapper> |
Loading…
Reference in new issue