10 changed files with 837 additions and 1 deletions
@ -0,0 +1,146 @@ |
|||
/** |
|||
* 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 java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 网格员信息 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-02 |
|||
*/ |
|||
@Data |
|||
public class GridOperatorInfoDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
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 Long 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; |
|||
|
|||
} |
@ -0,0 +1,101 @@ |
|||
/** |
|||
* 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.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.consult.GridOperatorInfoDTO; |
|||
import com.elink.esua.epdc.modules.consult.excel.GridOperatorInfoExcel; |
|||
import com.elink.esua.epdc.modules.consult.service.GridOperatorInfoService; |
|||
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 elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-02 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("gridoperatorinfo") |
|||
public class GridOperatorInfoController { |
|||
|
|||
@Autowired |
|||
private GridOperatorInfoService gridOperatorInfoService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<GridOperatorInfoDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<GridOperatorInfoDTO> page = gridOperatorInfoService.page(params); |
|||
return new Result<PageData<GridOperatorInfoDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<GridOperatorInfoDTO> get(@PathVariable("id") String id){ |
|||
GridOperatorInfoDTO data = gridOperatorInfoService.get(id); |
|||
return new Result<GridOperatorInfoDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody GridOperatorInfoDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
dto.setShowFlag("0"); |
|||
gridOperatorInfoService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody GridOperatorInfoDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
gridOperatorInfoService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
gridOperatorInfoService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
@PostMapping("changeShowFlag") |
|||
public Result changeShowFlag(@RequestBody GridOperatorInfoDTO dto){ |
|||
gridOperatorInfoService.changeShowFlag(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<GridOperatorInfoDTO> list = gridOperatorInfoService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, GridOperatorInfoExcel.class); |
|||
} |
|||
|
|||
} |
@ -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.modules.consult.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.modules.consult.entity.GridOperatorInfoEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 网格员信息 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-02 |
|||
*/ |
|||
@Mapper |
|||
public interface GridOperatorInfoDao extends BaseDao<GridOperatorInfoEntity> { |
|||
|
|||
} |
@ -0,0 +1,116 @@ |
|||
/** |
|||
* 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; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 网格员信息 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-02 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_grid_operator_info") |
|||
public class GridOperatorInfoEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 用户姓名 |
|||
*/ |
|||
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,101 @@ |
|||
/** |
|||
* 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.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 网格员信息 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-02 |
|||
*/ |
|||
@Data |
|||
public class GridOperatorInfoExcel { |
|||
|
|||
@Excel(name = "主键") |
|||
private String id; |
|||
|
|||
@Excel(name = "用户姓名") |
|||
private String realName; |
|||
|
|||
@Excel(name = "性别 0女 1男") |
|||
private String sex; |
|||
|
|||
@Excel(name = "排序") |
|||
private Integer sort; |
|||
|
|||
@Excel(name = "联系电话") |
|||
private String mobile; |
|||
|
|||
@Excel(name = "身份证号") |
|||
private String identityNo; |
|||
|
|||
@Excel(name = "头像访问地址") |
|||
private String faceImg; |
|||
|
|||
@Excel(name = "工作单位") |
|||
private String workUnit; |
|||
|
|||
@Excel(name = "职责类别id") |
|||
private String dutyCategoryId; |
|||
|
|||
@Excel(name = "前端收费展示 0否 1是") |
|||
private String showFlag; |
|||
|
|||
@Excel(name = "备注") |
|||
private String remark; |
|||
|
|||
@Excel(name = "居住网格id") |
|||
private Long deptId; |
|||
|
|||
@Excel(name = "父所有部门") |
|||
private String parentDeptIds; |
|||
|
|||
@Excel(name = "父所有部门") |
|||
private String parentDeptNames; |
|||
|
|||
@Excel(name = "所有部门ID") |
|||
private String allDeptIds; |
|||
|
|||
@Excel(name = "所有部门名称") |
|||
private String allDeptNames; |
|||
|
|||
@Excel(name = "乐观锁") |
|||
private Integer revision; |
|||
|
|||
@Excel(name = "删除标识 0:否,1:是") |
|||
private String delFlag; |
|||
|
|||
@Excel(name = "创建人") |
|||
private String createdBy; |
|||
|
|||
@Excel(name = "创建时间") |
|||
private Date createdTime; |
|||
|
|||
@Excel(name = "更新人") |
|||
private String updatedBy; |
|||
|
|||
@Excel(name = "更新时间") |
|||
private Date updatedTime; |
|||
|
|||
|
|||
} |
@ -0,0 +1,47 @@ |
|||
/** |
|||
* 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.redis; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 网格员信息 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-02 |
|||
*/ |
|||
@Component |
|||
public class GridOperatorInfoRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,103 @@ |
|||
/** |
|||
* 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.dto.consult.GridOperatorInfoDTO; |
|||
import com.elink.esua.epdc.modules.consult.entity.GridOperatorInfoEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 网格员信息 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-02 |
|||
*/ |
|||
public interface GridOperatorInfoService extends BaseService<GridOperatorInfoEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<GridOperatorInfoDTO> |
|||
* @author generator |
|||
* @date 2020-03-02 |
|||
*/ |
|||
PageData<GridOperatorInfoDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<GridOperatorInfoDTO> |
|||
* @author generator |
|||
* @date 2020-03-02 |
|||
*/ |
|||
List<GridOperatorInfoDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return GridOperatorInfoDTO |
|||
* @author generator |
|||
* @date 2020-03-02 |
|||
*/ |
|||
GridOperatorInfoDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-02 |
|||
*/ |
|||
void save(GridOperatorInfoDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-02 |
|||
*/ |
|||
void update(GridOperatorInfoDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-02 |
|||
*/ |
|||
void delete(String[] ids); |
|||
/** |
|||
* @Description 是否展示 |
|||
* @Author songyunpeng |
|||
* @Date 2020/3/2 |
|||
* @Param [dto] |
|||
* @return void |
|||
**/ |
|||
void changeShowFlag(GridOperatorInfoDTO dto); |
|||
} |
@ -0,0 +1,152 @@ |
|||
/** |
|||
* 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.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.constant.FieldConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
|||
import com.elink.esua.epdc.dto.consult.GridOperatorInfoDTO; |
|||
import com.elink.esua.epdc.modules.consult.dao.GridOperatorInfoDao; |
|||
import com.elink.esua.epdc.modules.consult.entity.GridOperatorInfoEntity; |
|||
import com.elink.esua.epdc.modules.consult.redis.GridOperatorInfoRedis; |
|||
import com.elink.esua.epdc.modules.consult.service.GridOperatorInfoService; |
|||
import com.elink.esua.epdc.modules.feign.AdminFeignClient; |
|||
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 elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-02 |
|||
*/ |
|||
@Service |
|||
public class GridOperatorInfoServiceImpl extends BaseServiceImpl<GridOperatorInfoDao, GridOperatorInfoEntity> implements GridOperatorInfoService { |
|||
|
|||
@Autowired |
|||
private GridOperatorInfoRedis gridOperatorInfoRedis; |
|||
|
|||
@Autowired |
|||
private AdminFeignClient adminFeignClient; |
|||
|
|||
@Override |
|||
public PageData<GridOperatorInfoDTO> page(Map<String, Object> params) { |
|||
IPage<GridOperatorInfoEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, GridOperatorInfoDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<GridOperatorInfoDTO> list(Map<String, Object> params) { |
|||
List<GridOperatorInfoEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, GridOperatorInfoDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<GridOperatorInfoEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<GridOperatorInfoEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public GridOperatorInfoDTO get(String id) { |
|||
GridOperatorInfoEntity entity = baseDao.selectById(id); |
|||
GridOperatorInfoDTO gridOperatorInfoDTO = ConvertUtils.sourceToTarget(entity, GridOperatorInfoDTO.class); |
|||
if(StringUtils.isNotBlank(entity.getAllDeptIds())){ |
|||
String depts[] = entity.getAllDeptIds().split(","); |
|||
gridOperatorInfoDTO.setAllDeptIds(depts); |
|||
} |
|||
return gridOperatorInfoDTO; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(GridOperatorInfoDTO dto) { |
|||
GridOperatorInfoEntity entity = ConvertUtils.sourceToTarget(dto, GridOperatorInfoEntity.class); |
|||
Result<ParentAndAllDeptDTO> parentResult = null; |
|||
if (dto.getAllDeptIds() != null && dto.getAllDeptIds().length > 1) { |
|||
parentResult = adminFeignClient.getParentAndAllDept(dto.getAllDeptIds()[dto.getAllDeptIds().length - 1]); |
|||
} |
|||
if (parentResult != null) { |
|||
if (!parentResult.success() || parentResult.getData() == null) { |
|||
throw new RenException("获取部门信息失败"); |
|||
} else { |
|||
ParentAndAllDeptDTO deptDTO = parentResult.getData(); |
|||
entity.setAllDeptIds(deptDTO.getAllDeptIds()); |
|||
entity.setAllDeptNames(deptDTO.getAllDeptNames()); |
|||
entity.setParentDeptIds(deptDTO.getParentDeptIds()); |
|||
entity.setParentDeptNames(deptDTO.getParentDeptNames()); |
|||
entity.setDeptId(Long.valueOf(dto.getAllDeptIds()[dto.getAllDeptIds().length - 1])); |
|||
} |
|||
} |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(GridOperatorInfoDTO dto) { |
|||
GridOperatorInfoEntity entity = ConvertUtils.sourceToTarget(dto, GridOperatorInfoEntity.class); |
|||
String[] allDeptIds = dto.getAllDeptIds(); |
|||
Result<ParentAndAllDeptDTO> parentResult = adminFeignClient.getParentAndAllDept(String.valueOf(allDeptIds[allDeptIds.length - 1])); |
|||
if (!parentResult.success() || parentResult.getData() == null) { |
|||
throw new RenException("获取部门信息失败"); |
|||
} else { |
|||
ParentAndAllDeptDTO deptDTO = parentResult.getData(); |
|||
entity.setAllDeptIds(deptDTO.getAllDeptIds()); |
|||
entity.setAllDeptNames(deptDTO.getAllDeptNames()); |
|||
entity.setParentDeptIds(deptDTO.getParentDeptIds()); |
|||
entity.setParentDeptNames(deptDTO.getParentDeptNames()); |
|||
} |
|||
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(GridOperatorInfoDTO dto) { |
|||
GridOperatorInfoEntity gridOperatorInfoEntity = new GridOperatorInfoEntity(); |
|||
gridOperatorInfoEntity.setId(dto.getId()); |
|||
gridOperatorInfoEntity.setShowFlag(dto.getShowFlag()); |
|||
updateById(gridOperatorInfoEntity); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,32 @@ |
|||
<?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.GridOperatorInfoDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.modules.consult.entity.GridOperatorInfoEntity" id="gridOperatorInfoMap"> |
|||
<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> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue