Browse Source

九小场所下分队管理CRUD

master
sunyuchao 4 years ago
parent
commit
e41feb3669
  1. 124
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddPlacePatrolTeamFormDTO.java
  2. 107
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditPlacePatrolTeamFormDTO.java
  3. 54
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlacePatrolTeamFormDTO.java
  4. 26
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlaceOrgResultDTO.java
  5. 19
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolTeamResultDTO.java
  6. 38
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlacePatrolTeamDetailResultDTO.java
  7. 96
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PlacePatrolTeamController.java
  8. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/PlaceOrgDao.java
  9. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/PlacePatrolTeamDao.java
  10. 17
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/PlacePatrolTeamStaffDao.java
  11. 75
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PlacePatrolTeamService.java
  12. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PlacePatrolTeamStaffService.java
  13. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PlaceOrgServiceImpl.java
  14. 247
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PlacePatrolTeamServiceImpl.java
  15. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PlacePatrolTeamStaffServiceImpl.java
  16. 2
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/PlaceOrgDao.xml
  17. 39
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/PlacePatrolTeamDao.xml
  18. 17
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/PlacePatrolTeamStaffDao.xml

124
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddPlacePatrolTeamFormDTO.java

@ -0,0 +1,124 @@
/**
* 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.dto.form;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Author sun
* @Description 新增九小场所巡查分队人员管理
**/
@Data
public class AddPlacePatrolTeamFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 组织Id
*/
private String agencyId;
/**
* agency_id的所有上级
*/
private String pids;
/**
* 网格Id场所区域
*/
@NotBlank(message = "场所区域不能为空", groups = {Add.class})
private String gridId;
/**
* 场所类型admin库sys_dict_data表九小场所value值
*/
@NotBlank(message = "场所类型不能为空", groups = {Add.class})
private String ninePlaceVal;
/**
* 分队名称
*/
@NotBlank(message = "分队名称不能为空", groups = {Add.class})
@Length(max = 20, message = "分队名称不能超过20个字符", groups = {Add.class})
private String teamName;
/**
* 巡查计划
*/
@NotBlank(message = "巡查计划不能为空", groups = {Add.class})
@Length(max = 200, message = "巡查计划不能超过200个字符", groups = {Add.class})
private String plan;
/**
* 创建(建队)时间
*/
@NotBlank(message = "创建时间不能为空", groups = {Add.class})
private Date time;
/**
* 场所负责人
*/
@NotBlank(message = "负责人名称不能为空", groups = {Add.class})
@Length(max = 20, message = "负责人名称不能超过20个字符", groups = {Add.class})
private String personInCharge;
/**
* 负责人电话
*/
@NotBlank(message = "负责人电话不能为空", groups = {Add.class})
@Length(max = 11, message = "负责人电话不能超过11个字符", groups = {Add.class})
private String mobile;
/**
* 备注
*/
private String remarks;
/**
* 分队成员信息
*/
@Valid
@NotEmpty(message = "成员列表不能为空")
private List<Member> memberList;
//token中userId
private String staffId;
public interface Add { }
@Data
public class Member {
//姓名
private String name;
//联系电话
private String mobile;
}
}

107
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditPlacePatrolTeamFormDTO.java

@ -0,0 +1,107 @@
/**
* 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.dto.form;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Author sun
* @Description 修改删除九小场所巡查分队人员管理
**/
@Data
public class EditPlacePatrolTeamFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 分队Id
*/
@NotBlank(message = "分队Id不能为空", groups = {Edit.class, Del.class, Detail.class})
private String teamId;
/**
* 网格Id场所区域
*/
private String gridId;
/**
* 场所类型admin库sys_dict_data表九小场所value值
*/
private String ninePlaceVal;
/**
* 分队名称
*/
@Length(max = 20, message = "分队名称不能超过20个字符", groups = {AddPlacePatrolTeamFormDTO.Add.class})
private String teamName;
/**
* 巡查计划
*/
@Length(max = 200, message = "巡查计划不能超过200个字符", groups = {AddPlacePatrolTeamFormDTO.Add.class})
private String plan;
/**
* 创建(建队)时间
*/
private Date time;
/**
* 场所负责人
*/
@Length(max = 20, message = "负责人名称不能超过20个字符", groups = {AddPlacePatrolTeamFormDTO.Add.class})
private String personInCharge;
/**
* 负责人电话
*/
@Length(max = 11, message = "负责人电话不能超过11个字符", groups = {AddPlacePatrolTeamFormDTO.Add.class})
private String mobile;
/**
* 备注
*/
private String remarks;
/**
* 分队成员信息
*/
private List<Member> memberList;
public interface Edit {
}
public interface Del {
}
public interface Detail {
}
@Data
public class Member {
//姓名
private String name;
//联系电话
private String mobile;
}
}

54
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlacePatrolTeamFormDTO.java

@ -0,0 +1,54 @@
/**
* 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.dto.form;
import lombok.Data;
import javax.validation.constraints.Min;
import java.io.Serializable;
/**
* @Author sun
* @Description 九小场所巡查分队人员管理列表查询
**/
@Data
public class GetListPlacePatrolTeamFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
//负责人
private String personInCharge;
//联系电话
private String mobile;
//场所区域【网格Id】
private String gridId;
//场所类型【九小场所Value值】
private String ninePlacsVal;
//是否分页(是:true 否:false) 有这个参数是给新增巡查记录时用的,默认是
private Boolean isPage = true;
//页码
@Min(1)
private Integer pageNo;
//每页多少条
private Integer pageSize = 20;
//token中客户Id
private String customerId;
//场所Id
private String teamId;
}

26
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlaceOrgResultDTO.java

@ -14,30 +14,6 @@ public class GetListPlaceOrgResultDTO implements Serializable {
//集合总条数
private Integer total;
//社会组织信息
private List<PlaceOrgList> list;
@Data
public class PlaceOrgList {
//场所Id
private String placeOrgId;
//场所名称
private String placeOrgName;
//场所区域Id
private String gridId;
//场所区域名称
private String gridName;
//场所地址
private String address;
//场所类型名称[九小场所Value值]
private String ninePlaceVal;
//场所类型名称[九小场所名称]
private String ninePlaceName;
//场所规模【 0:10人以下 1:10-20人 2:21-40人 3:41-100人 4:100人以上】
private String scale;
//负责人
private String personInCharge;
//联系电话
private String mobile;
}
private List<PlaceOrgDetailResultDTO> list;
}

19
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolTeamResultDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author sun
* @Description 九小场所巡查分队人员管理列表查询
**/
@Data
public class GetListPlacePatrolTeamResultDTO implements Serializable {
//集合总条数
private Integer total;
//社会组织信息
private List<PlacePatrolTeamDetailResultDTO> list;
}

38
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlacePatrolTeamDetailResultDTO.java

@ -0,0 +1,38 @@
package com.epmet.dto.result;
import com.epmet.dto.PlacePatrolTeamStaffDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author sun
* @Description 九小场所巡查分队人员管理详情
**/
@Data
public class PlacePatrolTeamDetailResultDTO implements Serializable {
//分队Id
private String teamId;
//场所名称
private String teamName;
//场所区域Id
private String gridIds;
//场所区域名称
private String gridNames;
//场所类型名称[九小场所Value值]
private String ninePlaceVals;
//场所类型名称[九小场所名称]
private String ninePlaceNames;
//负责人
private String personInCharge;
//联系电话
private String mobile;
//监查计划
private String plan;
//创建时间
private String time;
//分队成员信息
private List<PlacePatrolTeamStaffDTO> memberList;
}

96
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PlacePatrolTeamController.java

@ -17,23 +17,21 @@
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
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.PlacePatrolTeamDTO;
import com.epmet.excel.PlacePatrolTeamExcel;
import com.epmet.dto.form.AddPlacePatrolTeamFormDTO;
import com.epmet.dto.form.EditPlacePatrolTeamFormDTO;
import com.epmet.dto.form.GetListPlacePatrolTeamFormDTO;
import com.epmet.dto.result.GetListPlacePatrolTeamResultDTO;
import com.epmet.dto.result.PlacePatrolTeamDetailResultDTO;
import com.epmet.service.PlacePatrolTeamService;
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;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
@ -49,46 +47,60 @@ public class PlacePatrolTeamController {
@Autowired
private PlacePatrolTeamService placePatrolTeamService;
@GetMapping("page")
public Result<PageData<PlacePatrolTeamDTO>> page(@RequestParam Map<String, Object> params){
PageData<PlacePatrolTeamDTO> page = placePatrolTeamService.page(params);
return new Result<PageData<PlacePatrolTeamDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<PlacePatrolTeamDTO> get(@PathVariable("id") String id){
PlacePatrolTeamDTO data = placePatrolTeamService.get(id);
return new Result<PlacePatrolTeamDTO>().ok(data);
/**
* @Author sun
* @Description 新增九小场所巡查分队人员管理
**/
@PostMapping("add")
public Result add(@LoginUser TokenDto tokenDto, @RequestBody AddPlacePatrolTeamFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AddPlacePatrolTeamFormDTO.Add.class);
formDTO.setCustomerId(tokenDto.getToken());
formDTO.setStaffId(tokenDto.getUserId());
placePatrolTeamService.add(formDTO);
return new Result();
}
@PostMapping
public Result save(@RequestBody PlacePatrolTeamDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
placePatrolTeamService.save(dto);
/**
* @Author sun
* @Description 修改九小场所巡查分队人员管理
**/
@PostMapping("edit")
public Result edit(@LoginUser TokenDto tokenDto, @RequestBody EditPlacePatrolTeamFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, EditPlacePatrolTeamFormDTO.Edit.class);
placePatrolTeamService.edit(formDTO);
return new Result();
}
@PutMapping
public Result update(@RequestBody PlacePatrolTeamDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
placePatrolTeamService.update(dto);
/**
* @Author sun
* @Description 删除九小场所巡查分队人员管理
**/
@PostMapping("del")
public Result del(@LoginUser TokenDto tokenDto, @RequestBody EditPlacePatrolTeamFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, EditPlacePatrolTeamFormDTO.Del.class);
placePatrolTeamService.del(formDTO.getTeamId());
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
placePatrolTeamService.delete(ids);
return new Result();
/**
* @Author sun
* @Description 九小场所巡查分队人员管理详情
**/
@PostMapping("detail")
public Result<PlacePatrolTeamDetailResultDTO> detail(@LoginUser TokenDto tokenDto, @RequestBody EditPlacePatrolTeamFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, EditPlacePatrolTeamFormDTO.Detail.class);
return new Result<PlacePatrolTeamDetailResultDTO>().ok(placePatrolTeamService.detail(formDTO.getTeamId()));
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<PlacePatrolTeamDTO> list = placePatrolTeamService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, PlacePatrolTeamExcel.class);
/**
* @Author sun
* @Description 九小场所巡查分队人员管理列表查询
**/
@PostMapping("getlist")
public Result<GetListPlacePatrolTeamResultDTO> getList(@LoginUser TokenDto tokenDto, @RequestBody GetListPlacePatrolTeamFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<GetListPlacePatrolTeamResultDTO>().ok(placePatrolTeamService.getList(formDTO));
}
}

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/PlaceOrgDao.java

@ -20,6 +20,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.GetListPlaceOrgFormDTO;
import com.epmet.dto.result.GetListPlaceOrgResultDTO;
import com.epmet.dto.result.PlaceOrgDetailResultDTO;
import com.epmet.entity.PlaceOrgEntity;
import org.apache.ibatis.annotations.Mapper;
@ -38,6 +39,6 @@ public interface PlaceOrgDao extends BaseDao<PlaceOrgEntity> {
* @Author sun
* @Description 九小场所下组织列表查询
**/
List<GetListPlaceOrgResultDTO.PlaceOrgList> getList(GetListPlaceOrgFormDTO formDTO);
List<PlaceOrgDetailResultDTO> getList(GetListPlaceOrgFormDTO formDTO);
}

11
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/PlacePatrolTeamDao.java

@ -18,9 +18,13 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.GetListPlacePatrolTeamFormDTO;
import com.epmet.dto.result.PlacePatrolTeamDetailResultDTO;
import com.epmet.entity.PlacePatrolTeamEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 场所分队管理
*
@ -29,5 +33,10 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface PlacePatrolTeamDao extends BaseDao<PlacePatrolTeamEntity> {
/**
* @Author sun
* @Description 九小场所巡查分队人员管理列表查询
**/
List<PlacePatrolTeamDetailResultDTO> getList(GetListPlacePatrolTeamFormDTO formDTO);
}

17
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/PlacePatrolTeamStaffDao.java

@ -18,8 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.PlacePatrolTeamStaffDTO;
import com.epmet.entity.PlacePatrolTeamStaffEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 场所分队下人员管理
@ -29,5 +33,16 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface PlacePatrolTeamStaffDao extends BaseDao<PlacePatrolTeamStaffEntity> {
/**
* @Author sun
* @Description 删除分队下成员信息
**/
int delByTeamId(@Param("teamId") String teamId);
/**
* @Author sun
* @Description 删除分队下成员信息
**/
List<PlacePatrolTeamStaffDTO> getByTeamId(@Param("teamId") String teamId);
}

75
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PlacePatrolTeamService.java

@ -20,6 +20,11 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.PlacePatrolTeamDTO;
import com.epmet.dto.form.AddPlacePatrolTeamFormDTO;
import com.epmet.dto.form.EditPlacePatrolTeamFormDTO;
import com.epmet.dto.form.GetListPlacePatrolTeamFormDTO;
import com.epmet.dto.result.GetListPlacePatrolTeamResultDTO;
import com.epmet.dto.result.PlacePatrolTeamDetailResultDTO;
import com.epmet.entity.PlacePatrolTeamEntity;
import java.util.List;
@ -34,62 +39,32 @@ import java.util.Map;
public interface PlacePatrolTeamService extends BaseService<PlacePatrolTeamEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<PlacePatrolTeamDTO>
* @author generator
* @date 2021-11-18
*/
PageData<PlacePatrolTeamDTO> page(Map<String, Object> params);
* @Author sun
* @Description 新增九小场所巡查分队人员管理
**/
void add(AddPlacePatrolTeamFormDTO formDTO);
/**
* 默认查询
*
* @param params
* @return java.util.List<PlacePatrolTeamDTO>
* @author generator
* @date 2021-11-18
*/
List<PlacePatrolTeamDTO> list(Map<String, Object> params);
* @Author sun
* @Description 修改九小场所巡查分队人员管理
**/
void edit(EditPlacePatrolTeamFormDTO formDTO);
/**
* 单条查询
*
* @param id
* @return PlacePatrolTeamDTO
* @author generator
* @date 2021-11-18
*/
PlacePatrolTeamDTO get(String id);
* @Author sun
* @Description 删除九小场所巡查分队人员管理
**/
void del(String teamId);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-11-18
*/
void save(PlacePatrolTeamDTO dto);
* @Author sun
* @Description 九小场所巡查分队人员管理详情
**/
PlacePatrolTeamDetailResultDTO detail(String teamId);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-11-18
*/
void update(PlacePatrolTeamDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-11-18
*/
void delete(String[] ids);
* @Author sun
* @Description 九小场所巡查分队人员管理列表查询
**/
GetListPlacePatrolTeamResultDTO getList(GetListPlacePatrolTeamFormDTO formDTO);
}

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PlacePatrolTeamStaffService.java

@ -92,4 +92,10 @@ public interface PlacePatrolTeamStaffService extends BaseService<PlacePatrolTeam
* @date 2021-11-18
*/
void delete(String[] ids);
/**
* @Author sun
* @Description 删除分队下成员信息
**/
int delByTeamId(String teamId);
}

10
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PlaceOrgServiceImpl.java

@ -43,6 +43,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.List;
@ -65,6 +66,7 @@ public class PlaceOrgServiceImpl extends BaseServiceImpl<PlaceOrgDao, PlaceOrgEn
* @Description 新增九小场所下组织
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void add(AddPlaceOrgFormDTO formDTO) {
PlaceOrgEntity entity = ConvertUtils.sourceToTarget(formDTO, PlaceOrgEntity.class);
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
@ -78,6 +80,7 @@ public class PlaceOrgServiceImpl extends BaseServiceImpl<PlaceOrgDao, PlaceOrgEn
* @Description 修改九小场所下组织
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void edit(EditPlaceOrgFormDTO formDTO) {
PlaceOrgEntity entity = baseDao.selectById(formDTO.getPlaceOrgId());
if (null == entity) {
@ -92,6 +95,7 @@ public class PlaceOrgServiceImpl extends BaseServiceImpl<PlaceOrgDao, PlaceOrgEn
* @Description 删除九小场所下组织
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void del(String placeOrgId) {
if (baseDao.deleteById(placeOrgId) < NumConstant.ONE) {
throw new RenException(String.format("修改九小场所下组织信息删除失败,场所Id->%s", placeOrgId));
@ -108,11 +112,11 @@ public class PlaceOrgServiceImpl extends BaseServiceImpl<PlaceOrgDao, PlaceOrgEn
//1.查询场所基础信息
GetListPlaceOrgFormDTO dto = new GetListPlaceOrgFormDTO();
dto.setPlaceOrgId(placeOrgId);
List<GetListPlaceOrgResultDTO.PlaceOrgList> result = baseDao.getList(dto);
List<PlaceOrgDetailResultDTO> result = baseDao.getList(dto);
if (CollectionUtils.isEmpty(result)) {
return resultDTO;
}
resultDTO = ConvertUtils.sourceToTarget(result.get(0), PlaceOrgDetailResultDTO.class);
resultDTO = result.get(0);
//2.查询九小场所信息
Result<List<OptionResultDTO>> result1 = epmetAdminOpenFeignClient.getNineSmallPlacesOption();
if (!result1.success()) {
@ -134,7 +138,7 @@ public class PlaceOrgServiceImpl extends BaseServiceImpl<PlaceOrgDao, PlaceOrgEn
public GetListPlaceOrgResultDTO getList(GetListPlaceOrgFormDTO formDTO) {
GetListPlaceOrgResultDTO resultDTO = new GetListPlaceOrgResultDTO();
//1.根据查询条件分页查询场所数据
PageInfo<GetListPlaceOrgResultDTO.PlaceOrgList> result =
PageInfo<PlaceOrgDetailResultDTO> result =
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> baseDao.getList(formDTO));
if (CollectionUtils.isEmpty(result.getList())) {
return resultDTO;

247
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PlacePatrolTeamServiceImpl.java

@ -17,23 +17,45 @@
package com.epmet.service.impl;
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.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.CustomerGridDao;
import com.epmet.dao.PlacePatrolTeamDao;
import com.epmet.dto.PlacePatrolTeamDTO;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.PlacePatrolTeamStaffDTO;
import com.epmet.dto.form.AddPlacePatrolTeamFormDTO;
import com.epmet.dto.form.EditPlacePatrolTeamFormDTO;
import com.epmet.dto.form.GetListPlaceOrgFormDTO;
import com.epmet.dto.form.GetListPlacePatrolTeamFormDTO;
import com.epmet.dto.result.GetListPlaceOrgResultDTO;
import com.epmet.dto.result.GetListPlacePatrolTeamResultDTO;
import com.epmet.dto.result.PlaceOrgDetailResultDTO;
import com.epmet.dto.result.PlacePatrolTeamDetailResultDTO;
import com.epmet.entity.PlaceOrgEntity;
import com.epmet.entity.PlacePatrolTeamEntity;
import com.epmet.entity.PlacePatrolTeamStaffEntity;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.service.PlacePatrolTeamService;
import org.apache.commons.lang3.StringUtils;
import com.epmet.service.PlacePatrolTeamStaffService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 场所分队管理
@ -43,58 +65,195 @@ import java.util.Map;
*/
@Service
public class PlacePatrolTeamServiceImpl extends BaseServiceImpl<PlacePatrolTeamDao, PlacePatrolTeamEntity> implements PlacePatrolTeamService {
private static final Logger log = LoggerFactory.getLogger(PlacePatrolTeamServiceImpl.class);
@Autowired
private EpmetAdminOpenFeignClient epmetAdminOpenFeignClient;
@Autowired
private PlacePatrolTeamStaffService placePatrolTeamStaffService;
@Autowired
private CustomerGridDao customerGridDao;
@Override
public PageData<PlacePatrolTeamDTO> page(Map<String, Object> params) {
IPage<PlacePatrolTeamEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, PlacePatrolTeamDTO.class);
}
/**
* @Author sun
* @Description 新增九小场所巡查分队人员管理
**/
@Override
public List<PlacePatrolTeamDTO> list(Map<String, Object> params) {
List<PlacePatrolTeamEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, PlacePatrolTeamDTO.class);
}
private QueryWrapper<PlacePatrolTeamEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<PlacePatrolTeamEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
@Transactional(rollbackFor = Exception.class)
public void add(AddPlacePatrolTeamFormDTO formDTO) {
//1.分队主表新增数据
PlacePatrolTeamEntity entity = ConvertUtils.sourceToTarget(formDTO, PlacePatrolTeamEntity.class);
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
entity.setAgencyId(staffInfoCache.getAgencyId());
entity.setPids(staffInfoCache.getAgencyPIds());
insert(entity);
//2.分队成员表新增数据
List<PlacePatrolTeamStaffEntity> entityList = new ArrayList<>();
formDTO.getMemberList().forEach(m -> {
PlacePatrolTeamStaffEntity entity1 = new PlacePatrolTeamStaffEntity();
entity1.setCustomerId(formDTO.getCustomerId());
entity1.setPlacePatrolTeamId(entity.getId());
entity1.setName(m.getName());
entity1.setMobile(m.getMobile());
entityList.add(entity1);
});
placePatrolTeamStaffService.insertBatch(entityList);
return wrapper;
}
/**
* @Author sun
* @Description 修改九小场所巡查分队人员管理数据
**/
@Override
public PlacePatrolTeamDTO get(String id) {
PlacePatrolTeamEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, PlacePatrolTeamDTO.class);
@Transactional(rollbackFor = Exception.class)
public void edit(EditPlacePatrolTeamFormDTO formDTO) {
//1.修改分队主表信息
PlacePatrolTeamEntity entity = baseDao.selectById(formDTO.getTeamId());
if (null == entity) {
throw new RenException(String.format("修改九小场所下巡查分队人员信息失败,分队信息不存在,分队Id->%s", formDTO.getTeamId()));
}
entity = ConvertUtils.sourceToTarget(formDTO, PlacePatrolTeamEntity.class);
baseDao.updateById(entity);
//2.全删全增分队成员字表数据
List<PlacePatrolTeamStaffEntity> entityList = new ArrayList<>();
for (EditPlacePatrolTeamFormDTO.Member m : formDTO.getMemberList()) {
PlacePatrolTeamStaffEntity entity1 = new PlacePatrolTeamStaffEntity();
entity1.setCustomerId(entity.getCustomerId());
entity1.setPlacePatrolTeamId(entity.getId());
entity1.setName(m.getName());
entity1.setMobile(m.getMobile());
entityList.add(entity1);
}
placePatrolTeamStaffService.delByTeamId(formDTO.getTeamId());
placePatrolTeamStaffService.insertBatch(entityList);
}
/**
* @Author sun
* @Description 删除九小场所巡查分队人员管理数据
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void save(PlacePatrolTeamDTO dto) {
PlacePatrolTeamEntity entity = ConvertUtils.sourceToTarget(dto, PlacePatrolTeamEntity.class);
insert(entity);
public void del(String teamId) {
//1.删除分队主表数据
if (baseDao.deleteById(teamId) < NumConstant.ONE) {
throw new RenException(String.format("修改九小场所下组织信息删除失败,场所Id->%s", teamId));
}
//2.删除分队成员字表数据
placePatrolTeamStaffService.delByTeamId(teamId);
}
/**
* @Author sun
* @Description 九小场所巡查分队人员管理详情
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void update(PlacePatrolTeamDTO dto) {
PlacePatrolTeamEntity entity = ConvertUtils.sourceToTarget(dto, PlacePatrolTeamEntity.class);
updateById(entity);
public PlacePatrolTeamDetailResultDTO detail(String teamId) {
PlacePatrolTeamDetailResultDTO resultDTO = new PlacePatrolTeamDetailResultDTO();
//1.查询场所基础信息
GetListPlacePatrolTeamFormDTO dto = new GetListPlacePatrolTeamFormDTO();
dto.setTeamId(teamId);
List<PlacePatrolTeamDetailResultDTO> result = baseDao.getList(dto);
if (CollectionUtils.isEmpty(result)) {
return resultDTO;
}
resultDTO = result.get(0);
//2.查询网格信息
List<String> gridIds = new ArrayList<>();
for (String str : resultDTO.getGridIds().split(",")) {
gridIds.add(str);
}
gridIds = gridIds.stream().distinct().collect(Collectors.toList());
List<CustomerGridDTO> gridList = customerGridDao.selectGridListByIds(gridIds);
//3.查询九小场所信息
Result<List<OptionResultDTO>> nineList = epmetAdminOpenFeignClient.getNineSmallPlacesOption();
if (!nineList.success()) {
throw new RenException("获取九小场所基本信息失败......");
}
//4.分别封装网格。九小场所数据
//网格
StringBuffer gridNames = new StringBuffer("");
for (String str : resultDTO.getGridIds().split(",")) {
gridList.forEach(r -> {
if (str.equals(r.getGridName())) {
gridNames.append("".equals(gridNames) ? r.getGridName() : "," + r.getGridName());
}
});
}
resultDTO.setGridNames(gridNames.toString());
//九小场所
StringBuffer ninePlaceNames = new StringBuffer("");
for (String str : resultDTO.getNinePlaceVals().split(",")) {
nineList.getData().forEach(r -> {
if (str.equals(r.getValue())) {
ninePlaceNames.append("".equals(ninePlaceNames) ? r.getLabel() : "," + r.getLabel());
}
});
}
resultDTO.setNinePlaceNames(ninePlaceNames.toString());
return resultDTO;
}
/**
* @Author sun
* @Description 九小场所巡查分队人员管理列表查询
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
public GetListPlacePatrolTeamResultDTO getList(GetListPlacePatrolTeamFormDTO formDTO) {
GetListPlacePatrolTeamResultDTO resultDTO = new GetListPlacePatrolTeamResultDTO();
//1.根据条件查询分队及成员数据
PageInfo<PlacePatrolTeamDetailResultDTO> result =
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> baseDao.getList(formDTO));
if (CollectionUtils.isEmpty(result.getList())) {
return resultDTO;
}
resultDTO.setTotal((int) result.getTotal());
//2.查询网格信息
List<String> gridIds = new ArrayList<>();
for (PlacePatrolTeamDetailResultDTO dto : result.getList()) {
for (String str : dto.getGridIds().split(",")) {
gridIds.add(str);
}
}
gridIds = gridIds.stream().distinct().collect(Collectors.toList());
List<CustomerGridDTO> gridList = customerGridDao.selectGridListByIds(gridIds);
//3.查询九小场所信息
Result<List<OptionResultDTO>> nineList = epmetAdminOpenFeignClient.getNineSmallPlacesOption();
if (!nineList.success()) {
throw new RenException("获取九小场所基本信息失败......");
}
//4.封装网格、九小场所数据
for (PlacePatrolTeamDetailResultDTO dto : result.getList()) {
StringBuffer gridNames = new StringBuffer("");
for (String str : dto.getGridIds().split(",")) {
gridList.forEach(r -> {
if (str.equals(r.getGridName())) {
gridNames.append("".equals(gridNames) ? r.getGridName() : "," + r.getGridName());
}
});
}
dto.setGridNames(gridNames.toString());
StringBuffer ninePlaceNames = new StringBuffer("");
for (String str : dto.getNinePlaceVals().split(",")) {
nineList.getData().forEach(r -> {
if (str.equals(r.getValue())) {
ninePlaceNames.append("".equals(ninePlaceNames) ? r.getLabel() : "," + r.getLabel());
}
});
}
dto.setNinePlaceNames(ninePlaceNames.toString());
}
resultDTO.setList(result.getList());
return resultDTO;
}
}

9
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PlacePatrolTeamStaffServiceImpl.java

@ -97,4 +97,13 @@ public class PlacePatrolTeamStaffServiceImpl extends BaseServiceImpl<PlacePatrol
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @Author sun
* @Description 删除分队下成员信息
**/
@Override
public int delByTeamId(String teamId) {
return baseDao.delByTeamId(teamId);
}
}

2
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/PlaceOrgDao.xml

@ -3,7 +3,7 @@
<mapper namespace="com.epmet.dao.PlaceOrgDao">
<select id="getList" resultType="com.epmet.dto.result.GetListPlaceOrgResultDTO$PlaceOrgList">
<select id="getList" resultType="com.epmet.dto.result.PlaceOrgDetailResultDTO">
SELECT
a.id placeOrgId,
a.grid_id gridId,

39
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/PlacePatrolTeamDao.xml

@ -3,6 +3,43 @@
<mapper namespace="com.epmet.dao.PlacePatrolTeamDao">
<resultMap id="teamList" type="com.epmet.dto.result.PlacePatrolTeamDetailResultDTO">
<result property="teamId" column="id"/>
<result property="gridIds" column="grid_ids"/>
<result property="ninePlaceVals" column="nine_placs_vals"/>
<result property="teamName" column="team_name"/>
<result property="plan" column="plan"/>
<result property="time" column="time"/>
<result property="personInCharge" column="person_in_charge"/>
<result property="mobile" column="mobile"/>
<association property="memberList" column="id" select="com.epmet.dao.PlacePatrolTeamStaffDao.getByTeamId"/>
</resultMap>
<select id="getList" resultMap="teamList">
SELECT
*
FROM
ic_place_patrol_team
WHERE
del_flag = '0'
<if test="teamId != null and teamId.trim() != ''">
AND id = #{teamId}
</if>
<if test="customerId != null and customerId.trim() != ''">
AND customer_id = #{customerId}
</if>
<if test="gridId != null and gridId.trim() != ''">
AND grid_ids LIKE CONCAT('%', #{gridId}, '%')
</if>
<if test="ninePlacsVal != null and ninePlacsVal.trim() != ''">
AND nine_placs_vals LIKE CONCAT('%', #{ninePlacsVal}, '%')
</if>
<if test="personInCharge != null and personInCharge.trim() != ''">
AND person_in_charge LIKE CONCAT('%', #{personInCharge}, '%')
</if>
<if test="mobile != null and mobile.trim() != ''">
AND mobile = #{mobile}
</if>
ORDER BY created_time DESC
</select>
</mapper>

17
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/PlacePatrolTeamStaffDao.xml

@ -3,6 +3,23 @@
<mapper namespace="com.epmet.dao.PlacePatrolTeamStaffDao">
<delete id="delByTeamId">
DELETE
FROM
ic_place_patrol_team_staff
WHERE
place_patrol_team_id = #{teamId}
</delete>
<select id="getByTeamId" resultType="com.epmet.dto.PlacePatrolTeamStaffDTO">
SELECT
*
FROM
ic_place_patrol_team_staff
WHERE
del_flag = '0'
AND place_patrol_team_id = #{teamId}
ORDER BY created_time DESC
</select>
</mapper>
Loading…
Cancel
Save