forked from luyan/epmet-cloud-lingshan
9 changed files with 843 additions and 0 deletions
@ -0,0 +1,80 @@ |
|||||
|
package com.epmet.dto.form.yt; |
||||
|
|
||||
|
import com.epmet.commons.tools.dto.form.PageFormDTO; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author yzm |
||||
|
* @Date 2023/5/6 13:53 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CommunityBuildingManagerPageFormDTO extends PageFormDTO { |
||||
|
// start
|
||||
|
private String customerId; |
||||
|
private String staffId; |
||||
|
/** |
||||
|
* 工作人员所属组织的org_id_path |
||||
|
* 列表数据应查询本组织及下级 |
||||
|
* 网格的全路径,包含网格id |
||||
|
*/ |
||||
|
private String orgIdPath; |
||||
|
// end
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 姓名 |
||||
|
*/ |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 联系电话 |
||||
|
*/ |
||||
|
private String phone; |
||||
|
|
||||
|
/** |
||||
|
* 身份证号 |
||||
|
*/ |
||||
|
private String idCard; |
||||
|
|
||||
|
/** |
||||
|
* 类型:0楼长;1单元长 |
||||
|
*/ |
||||
|
private String type; |
||||
|
|
||||
|
/** |
||||
|
* 所属区县id;取名字关联customer_agency |
||||
|
*/ |
||||
|
private String districtId; |
||||
|
|
||||
|
/** |
||||
|
* 所属街道id;取名字关联customer_agency |
||||
|
*/ |
||||
|
private String streetId; |
||||
|
|
||||
|
/** |
||||
|
* 所属社区id;取名字关联customer_agency |
||||
|
*/ |
||||
|
private String communityId; |
||||
|
|
||||
|
/** |
||||
|
* 所属网格id;取名字关联customer_grid |
||||
|
*/ |
||||
|
private String gridId; |
||||
|
|
||||
|
/** |
||||
|
* 所属小区id |
||||
|
*/ |
||||
|
private String viliageId; |
||||
|
|
||||
|
/** |
||||
|
* 所属楼栋id |
||||
|
*/ |
||||
|
private String buildingId; |
||||
|
|
||||
|
/** |
||||
|
* 所属单元id; 单元长时必填此列 |
||||
|
*/ |
||||
|
private String unitId; |
||||
|
} |
||||
|
|
@ -0,0 +1,110 @@ |
|||||
|
package com.epmet.dto.result; |
||||
|
|
||||
|
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
||||
|
import lombok.Data; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 楼长单元长信息表(烟台) |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-05-06 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CommunityBuildingManagerDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -2526419541953300212L; |
||||
|
public interface AddShowGroup extends CustomerClientShowGroup { |
||||
|
} |
||||
|
|
||||
|
public interface UpdateShowGroup extends CustomerClientShowGroup { |
||||
|
} |
||||
|
/** |
||||
|
* 主键(烟台需求) |
||||
|
*/ |
||||
|
@NotBlank(message ="id不能为空" ,groups = {UpdateShowGroup.class}) |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户Id customer.id |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 姓名 |
||||
|
*/ |
||||
|
@Length(max = 50,message = "姓名最多输入50字",groups = {AddShowGroup.class,UpdateShowGroup.class}) |
||||
|
@NotBlank(message ="姓名不能为空" ,groups = {AddShowGroup.class,UpdateShowGroup.class}) |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 联系电话 |
||||
|
*/ |
||||
|
@Length(max = 50,message = "联系电话最多输入50字",groups = {AddShowGroup.class,UpdateShowGroup.class}) |
||||
|
@NotBlank(message ="联系电话不能为空" ,groups = {AddShowGroup.class,UpdateShowGroup.class}) |
||||
|
private String phone; |
||||
|
|
||||
|
/** |
||||
|
* 身份证号 |
||||
|
*/ |
||||
|
@Length(max = 50,message = "身份证号最多输入50字",groups = {AddShowGroup.class,UpdateShowGroup.class}) |
||||
|
@NotBlank(message ="身份证号不能为空" ,groups = {AddShowGroup.class,UpdateShowGroup.class}) |
||||
|
private String idCard; |
||||
|
|
||||
|
/** |
||||
|
* 类型:0楼长;1单元长 |
||||
|
*/ |
||||
|
@NotBlank(message ="类型不能为空" ,groups = {AddShowGroup.class,UpdateShowGroup.class}) |
||||
|
private String type; |
||||
|
|
||||
|
/** |
||||
|
* 所属区县id;取名字关联customer_agency |
||||
|
*/ |
||||
|
@NotBlank(message ="所属区县不能为空" ,groups = {AddShowGroup.class,UpdateShowGroup.class}) |
||||
|
private String districtId; |
||||
|
|
||||
|
/** |
||||
|
* 所属街道id;取名字关联customer_agency |
||||
|
*/ |
||||
|
@NotBlank(message ="所属街道不能为空" ,groups = {AddShowGroup.class,UpdateShowGroup.class}) |
||||
|
private String streetId; |
||||
|
|
||||
|
/** |
||||
|
* 所属社区id;取名字关联customer_agency |
||||
|
*/ |
||||
|
@NotBlank(message ="所属社区不能为空" ,groups = {AddShowGroup.class,UpdateShowGroup.class}) |
||||
|
private String communityId; |
||||
|
|
||||
|
/** |
||||
|
* 所属网格id;取名字关联customer_grid |
||||
|
*/ |
||||
|
@NotBlank(message ="所属网格不能为空" ,groups = {AddShowGroup.class,UpdateShowGroup.class}) |
||||
|
private String gridId; |
||||
|
|
||||
|
/** |
||||
|
* 网格的全路径,包含网格id |
||||
|
*/ |
||||
|
private String orgIdPath; |
||||
|
|
||||
|
/** |
||||
|
* 所属小区id |
||||
|
*/ |
||||
|
@NotBlank(message ="所属小区不能为空" ,groups = {AddShowGroup.class,UpdateShowGroup.class}) |
||||
|
private String viliageId; |
||||
|
|
||||
|
/** |
||||
|
* 所属楼栋id |
||||
|
*/ |
||||
|
@NotBlank(message ="楼栋不能为空" ,groups = {AddShowGroup.class,UpdateShowGroup.class}) |
||||
|
private String buildingId; |
||||
|
|
||||
|
/** |
||||
|
* 所属单元id; 单元长时必填此列 |
||||
|
*/ |
||||
|
private String unitId; |
||||
|
|
||||
|
} |
@ -0,0 +1,102 @@ |
|||||
|
package com.epmet.dto.result.yt; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 楼长单元长信息表(烟台) |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-05-06 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CommunityBuildingManagerResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 主键(烟台需求) |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户Id customer.id |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 姓名 |
||||
|
*/ |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 联系电话 |
||||
|
*/ |
||||
|
private String phone; |
||||
|
|
||||
|
/** |
||||
|
* 身份证号 |
||||
|
*/ |
||||
|
private String idCard; |
||||
|
|
||||
|
/** |
||||
|
* 类型:0楼长;1单元长 |
||||
|
*/ |
||||
|
private String type; |
||||
|
|
||||
|
/** |
||||
|
* 所属区县id;取名字关联customer_agency |
||||
|
*/ |
||||
|
private String districtId; |
||||
|
private String districtName; |
||||
|
/** |
||||
|
* 所属街道id;取名字关联customer_agency |
||||
|
*/ |
||||
|
private String streetId; |
||||
|
private String streetName; |
||||
|
|
||||
|
/** |
||||
|
* 所属社区id;取名字关联customer_agency |
||||
|
*/ |
||||
|
private String communityId; |
||||
|
private String communityName; |
||||
|
|
||||
|
/** |
||||
|
* 所属网格id;取名字关联customer_grid |
||||
|
*/ |
||||
|
private String gridId; |
||||
|
private String gridName; |
||||
|
|
||||
|
/** |
||||
|
* 网格的全路径,包含网格id |
||||
|
*/ |
||||
|
private String orgIdPath; |
||||
|
|
||||
|
/** |
||||
|
* 所属小区id |
||||
|
*/ |
||||
|
private String viliageId; |
||||
|
/** |
||||
|
* 所属小区id |
||||
|
*/ |
||||
|
private String viliageName; |
||||
|
|
||||
|
/** |
||||
|
* 所属楼栋id |
||||
|
*/ |
||||
|
private String buildingId; |
||||
|
private String buildingName; |
||||
|
|
||||
|
/** |
||||
|
* 所属单元id; 单元长时必填此列 |
||||
|
*/ |
||||
|
private String unitId; |
||||
|
/** |
||||
|
* 所属单元id; 单元长时必填此列 |
||||
|
*/ |
||||
|
private String unitName; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,111 @@ |
|||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.annotation.LoginUser; |
||||
|
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
||||
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
||||
|
import com.epmet.commons.tools.exception.EpmetException; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.security.dto.TokenDto; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.dto.form.yt.CommunityBuildingManagerPageFormDTO; |
||||
|
import com.epmet.dto.result.CommunityBuildingManagerDTO; |
||||
|
import com.epmet.dto.result.yt.CommunityBuildingManagerResultDTO; |
||||
|
import com.epmet.service.CommunityBuildingManagerService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.util.CollectionUtils; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 楼长单元长信息表(烟台) |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-05-06 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("communityBuildingManager") |
||||
|
public class CommunityBuildingManagerController { |
||||
|
|
||||
|
@Autowired |
||||
|
private CommunityBuildingManagerService communityBuildingManagerService; |
||||
|
|
||||
|
/** |
||||
|
* 列表分页查询 |
||||
|
* @param formDTO |
||||
|
* @return |
||||
|
*/ |
||||
|
@RequestMapping("page") |
||||
|
public Result<PageData<CommunityBuildingManagerResultDTO>> page(@LoginUser TokenDto tokenDto, @RequestBody CommunityBuildingManagerPageFormDTO formDTO){ |
||||
|
formDTO.setCustomerId(tokenDto.getCustomerId()); |
||||
|
formDTO.setStaffId(tokenDto.getUserId()); |
||||
|
PageData<CommunityBuildingManagerResultDTO> page = communityBuildingManagerService.page(formDTO); |
||||
|
return new Result<PageData<CommunityBuildingManagerResultDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查看详情 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@RequestMapping(value = "detail/{id}",method = {RequestMethod.POST}) |
||||
|
public Result<CommunityBuildingManagerResultDTO> get(@PathVariable("id") String id){ |
||||
|
CommunityBuildingManagerResultDTO data = communityBuildingManagerService.get(id); |
||||
|
return new Result<CommunityBuildingManagerResultDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增楼长/单元长 |
||||
|
* todo: 同步到具体的楼栋 |
||||
|
* @param dto |
||||
|
* @return |
||||
|
*/ |
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("save") |
||||
|
public Result save(@LoginUser TokenDto tokenDto,@RequestBody CommunityBuildingManagerDTO dto){ |
||||
|
dto.setCustomerId(tokenDto.getCustomerId()); |
||||
|
ValidatorUtils.validateEntity(dto, CommunityBuildingManagerDTO.AddShowGroup.class); |
||||
|
//类型:0楼长;1单元长
|
||||
|
if("1".equals(dto.getType())&& StringUtils.isBlank(dto.getUnitId())){ |
||||
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"单元长必须选择所属单元","单元长必须选择所属单元"); |
||||
|
} |
||||
|
communityBuildingManagerService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 编辑楼长/单元长 |
||||
|
* todo: 同步到具体的楼栋 |
||||
|
* @param dto |
||||
|
* @return |
||||
|
*/ |
||||
|
@NoRepeatSubmit |
||||
|
@PostMapping("update") |
||||
|
public Result update(@RequestBody CommunityBuildingManagerDTO dto){ |
||||
|
ValidatorUtils.validateEntity(dto, CommunityBuildingManagerDTO.UpdateShowGroup.class); |
||||
|
//类型:0楼长;1单元长
|
||||
|
if("1".equals(dto.getType())&& StringUtils.isBlank(dto.getUnitId())){ |
||||
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"单元长必须选择所属单元","单元长必须选择所属单元"); |
||||
|
} |
||||
|
communityBuildingManagerService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 批量删除楼长/单元长 |
||||
|
* todo: 同时清空楼栋表里的信息 |
||||
|
* @param ids |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("delete") |
||||
|
public Result delete(@RequestBody List<String> ids){ |
||||
|
if(!CollectionUtils.isEmpty(ids)){ |
||||
|
communityBuildingManagerService.delete(ids); |
||||
|
} |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,50 @@ |
|||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.dto.result.yt.CommunityBuildingManagerResultDTO; |
||||
|
import com.epmet.entity.CommunityBuildingManagerEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 楼长单元长信息表(烟台) |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-05-06 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CommunityBuildingManagerDao extends BaseDao<CommunityBuildingManagerEntity> { |
||||
|
/** |
||||
|
* 楼长单元长分页列表查询 |
||||
|
* @param customerId |
||||
|
* @param orgIdPath |
||||
|
* @param name |
||||
|
* @param phone |
||||
|
* @param idCard |
||||
|
* @param type |
||||
|
* @param districtId |
||||
|
* @param streetId |
||||
|
* @param communityId |
||||
|
* @param gridId |
||||
|
* @param viliageId |
||||
|
* @param buildingId |
||||
|
* @param unitId |
||||
|
* @return |
||||
|
*/ |
||||
|
List<CommunityBuildingManagerResultDTO> pageList(@Param("customerId") String customerId, |
||||
|
@Param("orgIdPath")String orgIdPath, |
||||
|
@Param("name")String name, |
||||
|
@Param("phone")String phone, |
||||
|
@Param("idCard")String idCard, |
||||
|
@Param("type")String type, |
||||
|
@Param("districtId")String districtId, |
||||
|
@Param("streetId")String streetId, |
||||
|
@Param("communityId")String communityId, |
||||
|
@Param("gridId")String gridId, |
||||
|
@Param("viliageId")String viliageId, |
||||
|
@Param("buildingId")String buildingId, |
||||
|
@Param("unitId")String unitId, |
||||
|
@Param("id")String id); |
||||
|
} |
@ -0,0 +1,86 @@ |
|||||
|
package com.epmet.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* 楼长单元长信息表(烟台) |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-05-06 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("community_building_manager") |
||||
|
public class CommunityBuildingManagerEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 客户Id customer.id |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 姓名 |
||||
|
*/ |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 联系电话 |
||||
|
*/ |
||||
|
private String phone; |
||||
|
|
||||
|
/** |
||||
|
* 身份证号 |
||||
|
*/ |
||||
|
private String idCard; |
||||
|
|
||||
|
/** |
||||
|
* 类型:0楼长;1单元长 |
||||
|
*/ |
||||
|
private String type; |
||||
|
|
||||
|
/** |
||||
|
* 所属区县id;取名字关联customer_agency |
||||
|
*/ |
||||
|
private String districtId; |
||||
|
|
||||
|
/** |
||||
|
* 所属街道id;取名字关联customer_agency |
||||
|
*/ |
||||
|
private String streetId; |
||||
|
|
||||
|
/** |
||||
|
* 所属社区id;取名字关联customer_agency |
||||
|
*/ |
||||
|
private String communityId; |
||||
|
|
||||
|
/** |
||||
|
* 所属网格id;取名字关联customer_grid |
||||
|
*/ |
||||
|
private String gridId; |
||||
|
|
||||
|
/** |
||||
|
* 网格的全路径,包含网格id |
||||
|
*/ |
||||
|
private String orgIdPath; |
||||
|
|
||||
|
/** |
||||
|
* 所属小区id |
||||
|
*/ |
||||
|
private String viliageId; |
||||
|
|
||||
|
/** |
||||
|
* 所属楼栋id |
||||
|
*/ |
||||
|
private String buildingId; |
||||
|
|
||||
|
/** |
||||
|
* 所属单元id; 单元长时必填此列 |
||||
|
*/ |
||||
|
private String unitId; |
||||
|
|
||||
|
} |
@ -0,0 +1,66 @@ |
|||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.dto.form.yt.CommunityBuildingManagerPageFormDTO; |
||||
|
import com.epmet.dto.result.CommunityBuildingManagerDTO; |
||||
|
import com.epmet.dto.result.yt.CommunityBuildingManagerResultDTO; |
||||
|
import com.epmet.entity.CommunityBuildingManagerEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 楼长单元长信息表(烟台) |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-05-06 |
||||
|
*/ |
||||
|
public interface CommunityBuildingManagerService extends BaseService<CommunityBuildingManagerEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param formDTO |
||||
|
* @return PageData<CommunityBuildingManagerResultDTO> |
||||
|
* @author generator |
||||
|
* @date 2023-05-06 |
||||
|
*/ |
||||
|
PageData<CommunityBuildingManagerResultDTO> page(CommunityBuildingManagerPageFormDTO formDTO); |
||||
|
|
||||
|
/** |
||||
|
* 查看详情 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return CommunityBuildingManagerResultDTO |
||||
|
* @author generator |
||||
|
* @date 2023-05-06 |
||||
|
*/ |
||||
|
CommunityBuildingManagerResultDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 新增楼长/单元长 |
||||
|
* todo: 同步到具体的楼栋表 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return |
||||
|
*/ |
||||
|
void save(CommunityBuildingManagerDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 编辑楼长/单元长 |
||||
|
* todo: 同步到具体的楼栋 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return |
||||
|
*/ |
||||
|
void update(CommunityBuildingManagerDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除楼长/单元长 |
||||
|
* todo: 同时清空楼栋表里的信息 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return |
||||
|
*/ |
||||
|
void delete(List<String> ids); |
||||
|
} |
@ -0,0 +1,144 @@ |
|||||
|
package com.epmet.service.impl; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.commons.tools.constant.NumConstant; |
||||
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
||||
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
||||
|
import com.epmet.commons.tools.exception.EpmetException; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
||||
|
import com.epmet.commons.tools.utils.ConvertUtils; |
||||
|
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
||||
|
import com.epmet.commons.tools.utils.PidUtils; |
||||
|
import com.epmet.commons.tools.utils.SpringContextUtils; |
||||
|
import com.epmet.dao.CommunityBuildingManagerDao; |
||||
|
import com.epmet.dto.CustomerGridDTO; |
||||
|
import com.epmet.dto.form.yt.CommunityBuildingManagerPageFormDTO; |
||||
|
import com.epmet.dto.result.CommunityBuildingManagerDTO; |
||||
|
import com.epmet.dto.result.yt.CommunityBuildingManagerResultDTO; |
||||
|
import com.epmet.entity.CommunityBuildingManagerEntity; |
||||
|
import com.epmet.service.CommunityBuildingManagerService; |
||||
|
import com.epmet.service.CustomerGridService; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
import org.springframework.util.CollectionUtils; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 楼长单元长信息表(烟台) |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2023-05-06 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class CommunityBuildingManagerServiceImpl extends BaseServiceImpl<CommunityBuildingManagerDao, CommunityBuildingManagerEntity> implements CommunityBuildingManagerService { |
||||
|
|
||||
|
/** |
||||
|
* 列表分页查询 |
||||
|
* |
||||
|
* @param formDTO |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public PageData<CommunityBuildingManagerResultDTO> page(CommunityBuildingManagerPageFormDTO formDTO) { |
||||
|
// 默认查询本组织及下级
|
||||
|
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); |
||||
|
if (null == staffInfoCacheResult) { |
||||
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询工作人员信息异常staffId:" + formDTO.getStaffId(), "查询工作人员信息异常"); |
||||
|
} |
||||
|
formDTO.setOrgIdPath(PidUtils.convertPid2OrgIdPath(staffInfoCacheResult.getAgencyId(), staffInfoCacheResult.getAgencyPIds())); |
||||
|
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); |
||||
|
List<CommunityBuildingManagerResultDTO> resList = baseDao.pageList(formDTO.getCustomerId(), |
||||
|
formDTO.getOrgIdPath(), |
||||
|
formDTO.getName(), |
||||
|
formDTO.getPhone(), |
||||
|
formDTO.getIdCard(), |
||||
|
formDTO.getType(), |
||||
|
formDTO.getDistrictId(), |
||||
|
formDTO.getStreetId(), |
||||
|
formDTO.getCommunityId(), |
||||
|
formDTO.getGridId(), |
||||
|
formDTO.getViliageId(), |
||||
|
formDTO.getBuildingId(), |
||||
|
formDTO.getUnitId(), null); |
||||
|
PageInfo<CommunityBuildingManagerResultDTO> pageInfo = new PageInfo<>(resList); |
||||
|
return new PageData<>(resList, pageInfo.getTotal()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查看详情 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public CommunityBuildingManagerResultDTO get(String id) { |
||||
|
List<CommunityBuildingManagerResultDTO> resList = baseDao.pageList(EpmetRequestHolder.getLoginUserCustomerId(), |
||||
|
null, |
||||
|
null, |
||||
|
null, |
||||
|
null, |
||||
|
null, |
||||
|
null, |
||||
|
null, |
||||
|
null, |
||||
|
null, |
||||
|
null, |
||||
|
null, |
||||
|
null, id); |
||||
|
if (CollectionUtils.isEmpty(resList)) { |
||||
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "community_building_manager表记录不存在:id:" + id, "记录不存在"); |
||||
|
} |
||||
|
return resList.get(NumConstant.ZERO); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增楼长/单元长 |
||||
|
* todo: 同步到具体的楼栋表 |
||||
|
* |
||||
|
* @param addFormDto |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(CommunityBuildingManagerDTO addFormDto) { |
||||
|
// 唯一性判断,同一个楼可以有多个楼长吗?待定。。。
|
||||
|
CommunityBuildingManagerEntity entity = ConvertUtils.sourceToTarget(addFormDto, CommunityBuildingManagerEntity.class); |
||||
|
CustomerGridDTO gridDTO = SpringContextUtils.getBean(CustomerGridService.class).get(addFormDto.getGridId()); |
||||
|
entity.setOrgIdPath(PidUtils.convertPid2OrgIdPath(gridDTO.getId(), gridDTO.getPids())); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 编辑楼长/单元长 |
||||
|
* todo: 同步到具体的楼栋 |
||||
|
* |
||||
|
* @param updateFormDto |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(CommunityBuildingManagerDTO updateFormDto) { |
||||
|
CommunityBuildingManagerEntity entity = ConvertUtils.sourceToTarget(updateFormDto, CommunityBuildingManagerEntity.class); |
||||
|
CustomerGridDTO gridDTO = SpringContextUtils.getBean(CustomerGridService.class).get(updateFormDto.getGridId()); |
||||
|
entity.setOrgIdPath(PidUtils.convertPid2OrgIdPath(gridDTO.getId(), gridDTO.getPids())); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 批量删除楼长/单元长 |
||||
|
* todo: 同时清空楼栋表里的信息 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(List<String> ids) { |
||||
|
baseDao.deleteBatchIds(ids); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,94 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
|
||||
|
<mapper namespace="com.epmet.dao.CommunityBuildingManagerDao"> |
||||
|
|
||||
|
<resultMap type="com.epmet.entity.CommunityBuildingManagerEntity" id="communityBuildingManagerMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="customerId" column="CUSTOMER_ID"/> |
||||
|
<result property="name" column="NAME"/> |
||||
|
<result property="phone" column="PHONE"/> |
||||
|
<result property="idCard" column="ID_CARD"/> |
||||
|
<result property="type" column="TYPE"/> |
||||
|
<result property="districtId" column="DISTRICT_ID"/> |
||||
|
<result property="streetId" column="STREET_ID"/> |
||||
|
<result property="communityId" column="COMMUNITY_ID"/> |
||||
|
<result property="gridId" column="GRID_ID"/> |
||||
|
<result property="orgIdPath" column="ORG_ID_PATH"/> |
||||
|
<result property="viliageId" column="VILIAGE_ID"/> |
||||
|
<result property="buildingId" column="BUILDING_ID"/> |
||||
|
<result property="unitId" column="UNIT_ID"/> |
||||
|
<result property="delFlag" column="DEL_FLAG"/> |
||||
|
<result property="revision" column="REVISION"/> |
||||
|
<result property="createdBy" column="CREATED_BY"/> |
||||
|
<result property="createdTime" column="CREATED_TIME"/> |
||||
|
<result property="updatedBy" column="UPDATED_BY"/> |
||||
|
<result property="updatedTime" column="UPDATED_TIME"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
<!-- 分页查询 --> |
||||
|
<select id="pageList" parameterType="map" resultType="com.epmet.dto.result.yt.CommunityBuildingManagerResultDTO"> |
||||
|
SELECT |
||||
|
m.*, |
||||
|
d.ORGANIZATION_NAME AS districtName, |
||||
|
s.ORGANIZATION_NAME AS streetName, |
||||
|
c.ORGANIZATION_NAME AS communityName, |
||||
|
cg.GRID_NAME AS gridName, |
||||
|
n.NEIGHBOR_HOOD_NAME AS viliageName, |
||||
|
b.BUILDING_NAME AS buildingName, |
||||
|
u.UNIT_NAME AS unitName |
||||
|
FROM |
||||
|
community_building_manager m |
||||
|
LEFT JOIN customer_agency d ON ( m.DISTRICT_ID = d.ID ) |
||||
|
LEFT JOIN customer_agency s ON ( m.STREET_ID = s.ID ) |
||||
|
LEFT JOIN customer_agency c ON ( m.COMMUNITY_ID = c.ID ) |
||||
|
LEFT JOIN customer_grid cg ON ( m.GRID_ID = cg.ID ) |
||||
|
LEFT JOIN ic_neighbor_hood n ON ( m.VILIAGE_ID = n.ID ) |
||||
|
LEFT JOIN ic_building b ON ( m.BUILDING_ID = b.ID ) |
||||
|
LEFT JOIN ic_building_unit u ON ( m.UNIT_ID = u.ID ) |
||||
|
WHERE |
||||
|
m.DEL_FLAG = '0' |
||||
|
AND m.CUSTOMER_ID = #{customerId} |
||||
|
<if test="name != null and name != ''"> |
||||
|
AND m.`NAME` LIKE concat( '%', #{name}, '%' ) |
||||
|
</if> |
||||
|
<if test="phone != null and phone != ''"> |
||||
|
AND m.PHONE LIKE concat( '%', #{phone}, '%' ) |
||||
|
</if> |
||||
|
<if test="idCard != null and idCard != ''"> |
||||
|
AND m.ID_CARD LIKE concat( '%', #{idCard}, '%' ) |
||||
|
</if> |
||||
|
<if test="type != null and type != ''"> |
||||
|
AND m.TYPE = #{type} |
||||
|
</if> |
||||
|
<if test="districtId != null and districtId != ''"> |
||||
|
AND m.DISTRICT_ID = #{districtId} |
||||
|
</if> |
||||
|
<if test="streetId != null and streetId != ''"> |
||||
|
AND m.STREET_ID = #{streetId} |
||||
|
</if> |
||||
|
<if test="communityId != null and communityId != ''"> |
||||
|
AND m.COMMUNITY_ID = #{communityId} |
||||
|
</if> |
||||
|
<if test="gridId != null and gridId != ''"> |
||||
|
AND m.GRID_ID = #{gridId} |
||||
|
</if> |
||||
|
<if test="viliageId != null and viliageId != ''"> |
||||
|
AND m.VILIAGE_ID = #{viliageId} |
||||
|
</if> |
||||
|
<if test="buildingId != null and buildingId != ''"> |
||||
|
AND m.BUILDING_ID = #{buildingId} |
||||
|
</if> |
||||
|
<if test="unitId != null and unitId != ''"> |
||||
|
AND m.UNIT_ID = #{unitId} |
||||
|
</if> |
||||
|
<if test="orgIdPath != null and orgIdPath != ''"> |
||||
|
AND m.ORG_ID_PATH LIKE concat( #{orgIdPath}, '%' ) |
||||
|
</if> |
||||
|
<if test="id != null and id != ''"> |
||||
|
AND m.id = #{id} |
||||
|
</if> |
||||
|
ORDER BY |
||||
|
m.ID ASC |
||||
|
</select> |
||||
|
</mapper> |
Loading…
Reference in new issue