diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddPlacePatrolTeamFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddPlacePatrolTeamFormDTO.java
new file mode 100644
index 0000000000..672fee597f
--- /dev/null
+++ b/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
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.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 memberList;
+
+ //token中userId
+ private String staffId;
+
+ public interface Add { }
+
+ @Data
+ public class Member {
+ //姓名
+ private String name;
+ //联系电话
+ private String mobile;
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditPlacePatrolTeamFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditPlacePatrolTeamFormDTO.java
new file mode 100644
index 0000000000..90d154008b
--- /dev/null
+++ b/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
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.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 memberList;
+
+ public interface Edit {
+ }
+
+ public interface Del {
+ }
+
+ public interface Detail {
+ }
+
+ @Data
+ public class Member {
+ //姓名
+ private String name;
+ //联系电话
+ private String mobile;
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlacePatrolTeamFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlacePatrolTeamFormDTO.java
new file mode 100644
index 0000000000..8660cf90e3
--- /dev/null
+++ b/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
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.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;
+
+}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlaceOrgResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlaceOrgResultDTO.java
index 963a972543..2111d8ef30 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlaceOrgResultDTO.java
+++ b/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 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 list;
}
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolTeamResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolTeamResultDTO.java
new file mode 100644
index 0000000000..b2ce9018f6
--- /dev/null
+++ b/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 list;
+
+}
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlacePatrolTeamDetailResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlacePatrolTeamDetailResultDTO.java
new file mode 100644
index 0000000000..acbbbbda57
--- /dev/null
+++ b/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 memberList;
+
+}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PlacePatrolTeamController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PlacePatrolTeamController.java
index 29df2c1deb..5333ab234f 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PlacePatrolTeamController.java
+++ b/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> page(@RequestParam Map params){
- PageData page = placePatrolTeamService.page(params);
- return new Result>().ok(page);
- }
- @GetMapping("{id}")
- public Result get(@PathVariable("id") String id){
- PlacePatrolTeamDTO data = placePatrolTeamService.get(id);
- return new Result().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 detail(@LoginUser TokenDto tokenDto, @RequestBody EditPlacePatrolTeamFormDTO formDTO) {
+ ValidatorUtils.validateEntity(formDTO, EditPlacePatrolTeamFormDTO.Detail.class);
+ return new Result().ok(placePatrolTeamService.detail(formDTO.getTeamId()));
}
- @GetMapping("export")
- public void export(@RequestParam Map params, HttpServletResponse response) throws Exception {
- List list = placePatrolTeamService.list(params);
- ExcelUtils.exportExcelToTarget(response, null, list, PlacePatrolTeamExcel.class);
+ /**
+ * @Author sun
+ * @Description 九小场所巡查分队人员管理列表查询
+ **/
+ @PostMapping("getlist")
+ public Result getList(@LoginUser TokenDto tokenDto, @RequestBody GetListPlacePatrolTeamFormDTO formDTO) {
+ formDTO.setCustomerId(tokenDto.getCustomerId());
+ return new Result().ok(placePatrolTeamService.getList(formDTO));
}
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/PlaceOrgDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/PlaceOrgDao.java
index c379dde695..0f396158c1 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/PlaceOrgDao.java
+++ b/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 {
* @Author sun
* @Description 九小场所下组织列表查询
**/
- List getList(GetListPlaceOrgFormDTO formDTO);
+ List getList(GetListPlaceOrgFormDTO formDTO);
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/PlacePatrolTeamDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/PlacePatrolTeamDao.java
index 7e19b451c1..6af5ca74fb 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/PlacePatrolTeamDao.java
+++ b/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 {
-
+
+ /**
+ * @Author sun
+ * @Description 九小场所巡查分队人员管理列表查询
+ **/
+ List getList(GetListPlacePatrolTeamFormDTO formDTO);
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/PlacePatrolTeamStaffDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/PlacePatrolTeamStaffDao.java
index a8c180fee7..2009cff9ca 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/PlacePatrolTeamStaffDao.java
+++ b/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 {
-
+
+ /**
+ * @Author sun
+ * @Description 删除分队下成员信息
+ **/
+ int delByTeamId(@Param("teamId") String teamId);
+
+ /**
+ * @Author sun
+ * @Description 删除分队下成员信息
+ **/
+ List getByTeamId(@Param("teamId") String teamId);
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PlacePatrolTeamService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PlacePatrolTeamService.java
index 55b983e348..4e2884ecb9 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PlacePatrolTeamService.java
+++ b/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 {
/**
- * 默认分页
- *
- * @param params
- * @return PageData
- * @author generator
- * @date 2021-11-18
- */
- PageData page(Map params);
+ * @Author sun
+ * @Description 新增九小场所巡查分队人员管理
+ **/
+ void add(AddPlacePatrolTeamFormDTO formDTO);
/**
- * 默认查询
- *
- * @param params
- * @return java.util.List
- * @author generator
- * @date 2021-11-18
- */
- List list(Map 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);
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PlacePatrolTeamStaffService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PlacePatrolTeamStaffService.java
index e970167e66..e124aadd1b 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PlacePatrolTeamStaffService.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PlacePatrolTeamStaffService.java
@@ -92,4 +92,10 @@ public interface PlacePatrolTeamStaffService extends BaseService%s", placeOrgId));
@@ -108,11 +112,11 @@ public class PlaceOrgServiceImpl extends BaseServiceImpl result = baseDao.getList(dto);
+ List result = baseDao.getList(dto);
if (CollectionUtils.isEmpty(result)) {
return resultDTO;
}
- resultDTO = ConvertUtils.sourceToTarget(result.get(0), PlaceOrgDetailResultDTO.class);
+ resultDTO = result.get(0);
//2.查询九小场所信息
Result> result1 = epmetAdminOpenFeignClient.getNineSmallPlacesOption();
if (!result1.success()) {
@@ -134,7 +138,7 @@ public class PlaceOrgServiceImpl extends BaseServiceImpl result =
+ PageInfo result =
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> baseDao.getList(formDTO));
if (CollectionUtils.isEmpty(result.getList())) {
return resultDTO;
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PlacePatrolTeamServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PlacePatrolTeamServiceImpl.java
index e7696ba4f9..1b331bdefb 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PlacePatrolTeamServiceImpl.java
+++ b/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 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 page(Map params) {
- IPage page = baseDao.selectPage(
- getPage(params, FieldConstant.CREATED_TIME, false),
- getWrapper(params)
- );
- return getPageData(page, PlacePatrolTeamDTO.class);
- }
-
+ /**
+ * @Author sun
+ * @Description 新增九小场所巡查分队人员管理
+ **/
@Override
- public List list(Map params) {
- List entityList = baseDao.selectList(getWrapper(params));
-
- return ConvertUtils.sourceToTarget(entityList, PlacePatrolTeamDTO.class);
- }
-
- private QueryWrapper getWrapper(Map params){
- String id = (String)params.get(FieldConstant.ID_HUMP);
-
- QueryWrapper wrapper = new QueryWrapper<>();
- wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
+ @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 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 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 result = baseDao.getList(dto);
+ if (CollectionUtils.isEmpty(result)) {
+ return resultDTO;
+ }
+ resultDTO = result.get(0);
+
+ //2.查询网格信息
+ List gridIds = new ArrayList<>();
+ for (String str : resultDTO.getGridIds().split(",")) {
+ gridIds.add(str);
+ }
+ gridIds = gridIds.stream().distinct().collect(Collectors.toList());
+ List gridList = customerGridDao.selectGridListByIds(gridIds);
+
+ //3.查询九小场所信息
+ Result> 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 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 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 gridList = customerGridDao.selectGridListByIds(gridIds);
+
+ //3.查询九小场所信息
+ Result> 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;
}
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PlacePatrolTeamStaffServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PlacePatrolTeamStaffServiceImpl.java
index c44ec42a76..e707539673 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PlacePatrolTeamStaffServiceImpl.java
+++ b/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
-
+
SELECT
a.id placeOrgId,
a.grid_id gridId,
diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/PlacePatrolTeamDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/PlacePatrolTeamDao.xml
index 2e889eb2dd..f74ff293e1 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/PlacePatrolTeamDao.xml
+++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/PlacePatrolTeamDao.xml
@@ -3,6 +3,43 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+ SELECT
+ *
+ FROM
+ ic_place_patrol_team
+ WHERE
+ del_flag = '0'
+
+ AND id = #{teamId}
+
+
+ AND customer_id = #{customerId}
+
+
+ AND grid_ids LIKE CONCAT('%', #{gridId}, '%')
+
+
+ AND nine_placs_vals LIKE CONCAT('%', #{ninePlacsVal}, '%')
+
+
+ AND person_in_charge LIKE CONCAT('%', #{personInCharge}, '%')
+
+
+ AND mobile = #{mobile}
+
+ ORDER BY created_time DESC
+
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/PlacePatrolTeamStaffDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/PlacePatrolTeamStaffDao.xml
index 26bebdb857..1c8abde218 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/PlacePatrolTeamStaffDao.xml
+++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/PlacePatrolTeamStaffDao.xml
@@ -3,6 +3,23 @@
+
+ DELETE
+ FROM
+ ic_place_patrol_team_staff
+ WHERE
+ place_patrol_team_id = #{teamId}
+
+
+ SELECT
+ *
+ FROM
+ ic_place_patrol_team_staff
+ WHERE
+ del_flag = '0'
+ AND place_patrol_team_id = #{teamId}
+ ORDER BY created_time DESC
+
\ No newline at end of file