Browse Source

九小场所下组织CRUD

dev_shibei_match
sunyuchao 4 years ago
parent
commit
5985611183
  1. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/GetListSocietyOrgFormDTO.java
  2. 1
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/SocietyOrgController.java
  3. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/SocietyOrgServiceImpl.java
  4. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/SocietyOrgDao.xml
  5. 95
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddPlaceOrgFormDTO.java
  6. 84
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditPlaceOrgFormDTO.java
  7. 56
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlaceOrgFormDTO.java
  8. 43
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlaceOrgResultDTO.java
  9. 35
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlaceOrgDetailResultDTO.java
  10. 6
      epmet-module/gov-org/gov-org-server/pom.xml
  11. 98
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PlaceOrgController.java
  12. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/PlaceOrgDao.java
  13. 80
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PlaceOrgService.java
  14. 143
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/PlaceOrgServiceImpl.java
  15. 40
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/PlaceOrgDao.xml

2
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/GetListSocietyOrgFormDTO.java

@ -47,5 +47,7 @@ public class GetListSocietyOrgFormDTO implements Serializable {
private Integer pageNo;
//每页多少条
private Integer pageSize = 20;
//token中客户Id
private String customerId;
}

1
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/SocietyOrgController.java

@ -87,6 +87,7 @@ public class SocietyOrgController {
**/
@PostMapping("getlist")
public Result<GetListSocietyOrgResultDTO> getList(@LoginUser TokenDto tokenDto, @RequestBody GetListSocietyOrgFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<GetListSocietyOrgResultDTO>().ok(societyOrgService.getList(formDTO));
}

4
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/SocietyOrgServiceImpl.java

@ -25,14 +25,12 @@ 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.SocietyOrgDao;
import com.epmet.dto.ProjectStaffDTO;
import com.epmet.dto.form.AddSocietyOrgFormDTO;
import com.epmet.dto.form.EditSocietyOrgFormDTO;
import com.epmet.dto.form.GetListSocietyOrgFormDTO;
import com.epmet.dto.form.UserIdsFormDTO;
import com.epmet.dto.result.GetListSocietyOrgResultDTO;
import com.epmet.dto.result.StaffSinGridResultDTO;
import com.epmet.entity.ActInfoEntity;
import com.epmet.entity.SocietyOrgEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.service.SocietyOrgService;
@ -45,7 +43,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@ -71,6 +68,7 @@ public class SocietyOrgServiceImpl extends BaseServiceImpl<SocietyOrgDao, Societ
public void add(AddSocietyOrgFormDTO dto) {
SocietyOrgEntity entity = ConvertUtils.sourceToTarget(dto, SocietyOrgEntity.class);
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(dto.getCustomerId(), dto.getStaffId());
entity.setAgencyId(staffInfoCache.getAgencyId());
entity.setPids(staffInfoCache.getAgencyPIds());
insert(entity);
}

8
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/SocietyOrgDao.xml

@ -21,11 +21,14 @@
society_org
WHERE
del_flag = '0'
<if test="customerId != null and customerId.trim() != ''">
AND a.customer_id = #{customerId}
</if>
<if test="societyName != null and societyName.trim() != ''">
AND society_name LIKE #{societyName}
AND society_name LIKE CONCAT('%', #{societyName}, '%')
</if>
<if test="personInCharge != null and personInCharge.trim() != ''">
AND person_in_charge LIKE #{personInCharge}
AND person_in_charge LIKE CONCAT('%', #{personInCharge}, '%')
</if>
<if test="mobile != null and mobile.trim() != ''">
AND mobile = #{mobile}
@ -36,6 +39,7 @@
<if test="serviceEndTime != null and serviceEndTime != ''">
AND date_id <![CDATA[<=]]> #{serviceEndTime}
</if>
ORDER BY created_time DESC
</select>
</mapper>

95
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddPlaceOrgFormDTO.java

@ -0,0 +1,95 @@
/**
* 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;
/**
* @Author sun
* @Description 新增九小场所下组织
**/
@Data
public class AddPlaceOrgFormDTO 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 placeOrgName;
/**
* 场所地址
*/
@NotBlank(message = "场所地址不能为空", groups = {Add.class})
@Length(max = 100, message = "场所地址不能超过100个字符", groups = {Add.class})
private String address;
/**
* 字典value,场所规模0:10人以下 1:10-20人 2:21-40人 3:41-100人 4:100人以上
*/
@NotBlank(message = "场所规模不能为空", groups = {Add.class})
private String scale;
/**
* 场所负责人
*/
@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;
//token中userId
private String staffId;
public interface Add { }
}

84
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditPlaceOrgFormDTO.java

@ -0,0 +1,84 @@
/**
* 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;
/**
* @Author sun
* @Description 修改删除九小场所下组织
**/
@Data
public class EditPlaceOrgFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 场所Id
*/
@NotBlank(message = "场所Id不能为空", groups = {Edit.class, Del.class, Detail.class})
private String placeOrgId;
/**
* 网格Id场所区域
*/
private String gridId;
/**
* 场所类型admin库sys_dict_data表九小场所value值
*/
private String ninePlaceVal;
/**
* 场所名称
*/
@Length(max = 20, message = "场所名称不能超过20个字符", groups = {Edit.class})
private String placeOrgName;
/**
* 场所地址
*/
@Length(max = 100, message = "场所地址不能超过100个字符", groups = {Edit.class})
private String address;
/**
* 字典value,场所规模0:10人以下 1:10-20人 2:21-40人 3:41-100人 4:100人以上
*/
private String scale;
/**
* 场所负责人
*/
@Length(max = 20, message = "负责人名称不能超过20个字符", groups = {Edit.class})
private String personInCharge;
/**
* 负责人电话
*/
@Length(max = 11, message = "负责人电话不能超过11个字符", groups = {Edit.class})
private String mobile;
/**
* 备注
*/
private String remarks;
public interface Edit { }
public interface Del { }
public interface Detail { }
}

56
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlaceOrgFormDTO.java

@ -0,0 +1,56 @@
/**
* 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 GetListPlaceOrgFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
//场所名称
private String placeOrgName;
//联系电话
private String mobile;
//场所规模【 0:10人以下 1:10-20人 2:21-40人 3:41-100人 4:100人以上】
private String scale;
//场所区域【网格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 placeOrgId;
}

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

@ -0,0 +1,43 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author sun
* @Description 九小场所下组织列表查询
**/
@Data
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;
}
}

35
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlaceOrgDetailResultDTO.java

@ -0,0 +1,35 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author sun
* @Description 九小场所下组织列表查询
**/
@Data
public class PlaceOrgDetailResultDTO implements Serializable {
//场所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;
}

6
epmet-module/gov-org/gov-org-server/pom.xml

@ -119,6 +119,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-admin-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

98
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/PlaceOrgController.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.PlaceOrgDTO;
import com.epmet.excel.PlaceOrgExcel;
import com.epmet.dto.form.AddPlaceOrgFormDTO;
import com.epmet.dto.form.EditPlaceOrgFormDTO;
import com.epmet.dto.form.GetListPlaceOrgFormDTO;
import com.epmet.dto.result.GetListPlaceOrgResultDTO;
import com.epmet.dto.result.PlaceOrgDetailResultDTO;
import com.epmet.service.PlaceOrgService;
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 PlaceOrgController {
@Autowired
private PlaceOrgService placeOrgService;
@GetMapping("page")
public Result<PageData<PlaceOrgDTO>> page(@RequestParam Map<String, Object> params){
PageData<PlaceOrgDTO> page = placeOrgService.page(params);
return new Result<PageData<PlaceOrgDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<PlaceOrgDTO> get(@PathVariable("id") String id){
PlaceOrgDTO data = placeOrgService.get(id);
return new Result<PlaceOrgDTO>().ok(data);
/**
* @Author sun
* @Description 新增九小场所下组织
**/
@PostMapping("add")
public Result add(@LoginUser TokenDto tokenDto, @RequestBody AddPlaceOrgFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AddPlaceOrgFormDTO.Add.class);
formDTO.setCustomerId(tokenDto.getToken());
formDTO.setStaffId(tokenDto.getUserId());
placeOrgService.add(formDTO);
return new Result();
}
@PostMapping
public Result save(@RequestBody PlaceOrgDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
placeOrgService.save(dto);
/**
* @Author sun
* @Description 修改九小场所下组织
**/
@PostMapping("edit")
public Result edit(@LoginUser TokenDto tokenDto, @RequestBody EditPlaceOrgFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, EditPlaceOrgFormDTO.Edit.class);
placeOrgService.edit(formDTO);
return new Result();
}
@PutMapping
public Result update(@RequestBody PlaceOrgDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
placeOrgService.update(dto);
/**
* @Author sun
* @Description 删除九小场所下组织
**/
@PostMapping("del")
public Result del(@LoginUser TokenDto tokenDto, @RequestBody EditPlaceOrgFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, EditPlaceOrgFormDTO.Del.class);
placeOrgService.del(formDTO.getPlaceOrgId());
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
placeOrgService.delete(ids);
return new Result();
/**
* @Author sun
* @Description 九小场所下组织详情
**/
@PostMapping("detail")
public Result<PlaceOrgDetailResultDTO> detail(@LoginUser TokenDto tokenDto, @RequestBody EditPlaceOrgFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, EditPlaceOrgFormDTO.Detail.class);
return new Result<PlaceOrgDetailResultDTO>().ok(placeOrgService.detail(formDTO.getPlaceOrgId()));
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<PlaceOrgDTO> list = placeOrgService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, PlaceOrgExcel.class);
/**
* @Author sun
* @Description 九小场所下组织列表查询
**/
@PostMapping("getlist")
public Result<GetListPlaceOrgResultDTO> getList(@LoginUser TokenDto tokenDto, @RequestBody GetListPlaceOrgFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<GetListPlaceOrgResultDTO>().ok(placeOrgService.getList(formDTO));
}
}

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

@ -18,9 +18,13 @@
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.entity.PlaceOrgEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 九小场所下组织管理
*
@ -30,4 +34,10 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PlaceOrgDao extends BaseDao<PlaceOrgEntity> {
/**
* @Author sun
* @Description 九小场所下组织列表查询
**/
List<GetListPlaceOrgResultDTO.PlaceOrgList> getList(GetListPlaceOrgFormDTO formDTO);
}

80
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/PlaceOrgService.java

@ -18,13 +18,13 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.PlaceOrgDTO;
import com.epmet.dto.form.AddPlaceOrgFormDTO;
import com.epmet.dto.form.EditPlaceOrgFormDTO;
import com.epmet.dto.form.GetListPlaceOrgFormDTO;
import com.epmet.dto.result.GetListPlaceOrgResultDTO;
import com.epmet.dto.result.PlaceOrgDetailResultDTO;
import com.epmet.entity.PlaceOrgEntity;
import java.util.List;
import java.util.Map;
/**
* 九小场所下组织管理
*
@ -34,62 +34,32 @@ import java.util.Map;
public interface PlaceOrgService extends BaseService<PlaceOrgEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<PlaceOrgDTO>
* @author generator
* @date 2021-11-18
*/
PageData<PlaceOrgDTO> page(Map<String, Object> params);
* @Author sun
* @Description 新增九小场所下组织
**/
void add(AddPlaceOrgFormDTO formDTO);
/**
* 默认查询
*
* @param params
* @return java.util.List<PlaceOrgDTO>
* @author generator
* @date 2021-11-18
*/
List<PlaceOrgDTO> list(Map<String, Object> params);
* @Author sun
* @Description 修改九小场所下组织
**/
void edit(EditPlaceOrgFormDTO formDTO);
/**
* 单条查询
*
* @param id
* @return PlaceOrgDTO
* @author generator
* @date 2021-11-18
*/
PlaceOrgDTO get(String id);
* @Author sun
* @Description 删除九小场所下组织
**/
void del(String placeOrgId);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-11-18
*/
void save(PlaceOrgDTO dto);
* @Author sun
* @Description 九小场所下组织详情
**/
PlaceOrgDetailResultDTO detail(String placeOrgId);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-11-18
*/
void update(PlaceOrgDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-11-18
*/
void delete(String[] ids);
* @Author sun
* @Description 九小场所下组织列表查询
**/
GetListPlaceOrgResultDTO getList(GetListPlaceOrgFormDTO formDTO);
}

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

@ -17,23 +17,36 @@
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.PlaceOrgDao;
import com.epmet.dto.PlaceOrgDTO;
import com.epmet.dto.form.AddPlaceOrgFormDTO;
import com.epmet.dto.form.EditPlaceOrgFormDTO;
import com.epmet.dto.form.GetListPlaceOrgFormDTO;
import com.epmet.dto.form.UserIdsFormDTO;
import com.epmet.dto.result.GetListPlaceOrgResultDTO;
import com.epmet.dto.result.GetListSocietyOrgResultDTO;
import com.epmet.dto.result.PlaceOrgDetailResultDTO;
import com.epmet.dto.result.StaffSinGridResultDTO;
import com.epmet.entity.PlaceOrgEntity;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.service.PlaceOrgService;
import org.apache.commons.lang3.StringUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
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.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 九小场所下组织管理
@ -43,58 +56,98 @@ import java.util.Map;
*/
@Service
public class PlaceOrgServiceImpl extends BaseServiceImpl<PlaceOrgDao, PlaceOrgEntity> implements PlaceOrgService {
private static final Logger log = LoggerFactory.getLogger(PlaceOrgServiceImpl.class);
@Autowired
private EpmetAdminOpenFeignClient epmetAdminOpenFeignClient;
/**
* @Author sun
* @Description 新增九小场所下组织
**/
@Override
public PageData<PlaceOrgDTO> page(Map<String, Object> params) {
IPage<PlaceOrgEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, PlaceOrgDTO.class);
public void add(AddPlaceOrgFormDTO formDTO) {
PlaceOrgEntity entity = ConvertUtils.sourceToTarget(formDTO, PlaceOrgEntity.class);
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
entity.setAgencyId(staffInfoCache.getAgencyId());
entity.setPids(staffInfoCache.getAgencyPIds());
insert(entity);
}
/**
* @Author sun
* @Description 修改九小场所下组织
**/
@Override
public List<PlaceOrgDTO> list(Map<String, Object> params) {
List<PlaceOrgEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, PlaceOrgDTO.class);
public void edit(EditPlaceOrgFormDTO formDTO) {
PlaceOrgEntity entity = baseDao.selectById(formDTO.getPlaceOrgId());
if (null == entity) {
throw new RenException(String.format("修改九小场所下组织信息失败,场所信息不存在,场所Id->%s", formDTO.getPlaceOrgId()));
}
private QueryWrapper<PlaceOrgEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<PlaceOrgEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
entity = ConvertUtils.sourceToTarget(formDTO, PlaceOrgEntity.class);
baseDao.updateById(entity);
}
/**
* @Author sun
* @Description 删除九小场所下组织
**/
@Override
public PlaceOrgDTO get(String id) {
PlaceOrgEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, PlaceOrgDTO.class);
public void del(String placeOrgId) {
if (baseDao.deleteById(placeOrgId) < NumConstant.ONE) {
throw new RenException(String.format("修改九小场所下组织信息删除失败,场所Id->%s", placeOrgId));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(PlaceOrgDTO dto) {
PlaceOrgEntity entity = ConvertUtils.sourceToTarget(dto, PlaceOrgEntity.class);
insert(entity);
}
/**
* @Author sun
* @Description 九小场所下组织详情
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void update(PlaceOrgDTO dto) {
PlaceOrgEntity entity = ConvertUtils.sourceToTarget(dto, PlaceOrgEntity.class);
updateById(entity);
public PlaceOrgDetailResultDTO detail(String placeOrgId) {
PlaceOrgDetailResultDTO resultDTO = new PlaceOrgDetailResultDTO();
//1.查询场所基础信息
GetListPlaceOrgFormDTO dto = new GetListPlaceOrgFormDTO();
dto.setPlaceOrgId(placeOrgId);
List<GetListPlaceOrgResultDTO.PlaceOrgList> result = baseDao.getList(dto);
if (CollectionUtils.isEmpty(result)) {
return resultDTO;
}
resultDTO = ConvertUtils.sourceToTarget(result.get(0), PlaceOrgDetailResultDTO.class);
//2.查询九小场所信息
Result<List<OptionResultDTO>> result1 = epmetAdminOpenFeignClient.getNineSmallPlacesOption();
if (!result1.success()) {
throw new RenException("获取九小场所基本信息失败......");
}
for (OptionResultDTO d : result1.getData()) {
if (d.getValue().equals(resultDTO.getNinePlaceVal())) {
resultDTO.setNinePlaceName(d.getLabel());
}
}
return resultDTO;
}
/**
* @Author sun
* @Description 九小场所下组织列表查询
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
public GetListPlaceOrgResultDTO getList(GetListPlaceOrgFormDTO formDTO) {
GetListPlaceOrgResultDTO resultDTO = new GetListPlaceOrgResultDTO();
//1.根据查询条件分页查询场所数据
PageInfo<GetListPlaceOrgResultDTO.PlaceOrgList> 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.查询九小场所信息
Result<List<OptionResultDTO>> result1 = epmetAdminOpenFeignClient.getNineSmallPlacesOption();
if (!result1.success()) {
throw new RenException("获取九小场所基本信息失败......");
}
result.getList().forEach(r -> result1.getData().stream().filter(u -> r.getNinePlaceVal().equals(u.getValue())).forEach(u -> r.setNinePlaceName(u.getLabel())));
resultDTO.setList(result.getList());
return resultDTO;
}
}

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

@ -3,6 +3,44 @@
<mapper namespace="com.epmet.dao.PlaceOrgDao">
<select id="getList" resultType="com.epmet.dto.result.GetListPlaceOrgResultDTO$PlaceOrgList">
SELECT
a.id placeOrgId,
a.grid_id gridId,
b.grid_name gridName,
a.nine_place_val ninePlaceVale,
a.place_org_name placeOrgName,
a.address address,
a.scale scale,
a.person_in_charge personInCharge,
a.mobile mobile
FROM
place_org a
LEFT JOIN customer_grid b ON a.GRID_ID = b.ID
WHERE
a.del_flag = '0'
<if test="placeOrgId != null and placeOrgId.trim() != ''">
AND a.id = #{placeOrgId}
</if>
<if test="customerId != null and customerId.trim() != ''">
AND a.customer_id = #{customerId}
</if>
<if test="gridId != null and gridId.trim() != ''">
AND a.grid_id = #{gridId}
</if>
<if test="ninePlacsVal != null and ninePlacsVal.trim() != ''">
AND a.nine_place_val = #{ninePlacsVal}
</if>
<if test="placeOrgName != null and placeOrgName.trim() != ''">
AND a.place_org_name LIKE CONCAT('%', #{placeOrgName}, '%')
</if>
<if test="mobile != null and mobile.trim() != ''">
AND a.mobile = #{mobile}
</if>
<if test="scale != null and scale.trim() != ''">
AND a.scale = #{scale}
</if>
ORDER BY a.created_time DESC
</select>
</mapper>
Loading…
Cancel
Save