84 changed files with 3246 additions and 116 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,137 @@ |
|||
package com.epmet.dto.result.yt; |
|||
|
|||
import com.alibaba.excel.annotation.ExcelIgnore; |
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
|||
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; |
|||
|
|||
/** |
|||
* 主键(烟台需求) |
|||
*/ |
|||
@ExcelIgnore |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户Id customer.id |
|||
*/ |
|||
@ExcelIgnore |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 姓名 |
|||
*/ |
|||
@ExcelProperty(value = "姓名") |
|||
@ColumnWidth(20) |
|||
private String name; |
|||
|
|||
/** |
|||
* 联系电话 |
|||
*/ |
|||
@ExcelProperty(value = "联系电话") |
|||
@ColumnWidth(25) |
|||
private String phone; |
|||
|
|||
/** |
|||
* 身份证号 |
|||
*/ |
|||
@ExcelProperty(value = "身份证号") |
|||
@ColumnWidth(30) |
|||
private String idCard; |
|||
|
|||
/** |
|||
* 类型:0楼长;1单元长 |
|||
*/ |
|||
@ExcelIgnore |
|||
private String type; |
|||
|
|||
@ExcelProperty(value = "类型") |
|||
@ColumnWidth(20) |
|||
private String typeName; |
|||
|
|||
/** |
|||
* 所属区县id;取名字关联customer_agency |
|||
*/ |
|||
@ExcelIgnore |
|||
private String districtId; |
|||
@ExcelProperty(value = "所属区市") |
|||
@ColumnWidth(30) |
|||
private String districtName; |
|||
/** |
|||
* 所属街道id;取名字关联customer_agency |
|||
*/ |
|||
@ExcelIgnore |
|||
private String streetId; |
|||
@ExcelProperty(value = "所属镇街") |
|||
@ColumnWidth(30) |
|||
private String streetName; |
|||
|
|||
/** |
|||
* 所属社区id;取名字关联customer_agency |
|||
*/ |
|||
@ExcelIgnore |
|||
private String communityId; |
|||
@ExcelProperty(value = "所属社区") |
|||
@ColumnWidth(30) |
|||
private String communityName; |
|||
|
|||
/** |
|||
* 所属网格id;取名字关联customer_grid |
|||
*/ |
|||
@ExcelIgnore |
|||
private String gridId; |
|||
@ExcelProperty(value = "所属网格") |
|||
@ColumnWidth(30) |
|||
private String gridName; |
|||
|
|||
/** |
|||
* 网格的全路径,包含网格id |
|||
*/ |
|||
@ExcelIgnore |
|||
private String orgIdPath; |
|||
|
|||
/** |
|||
* 所属小区id |
|||
*/ |
|||
@ExcelIgnore |
|||
private String viliageId; |
|||
@ExcelProperty(value = "所属小区") |
|||
@ColumnWidth(30) |
|||
private String viliageName; |
|||
|
|||
/** |
|||
* 所属楼栋id |
|||
*/ |
|||
@ExcelIgnore |
|||
private String buildingId; |
|||
@ExcelProperty(value = "楼栋") |
|||
@ColumnWidth(20) |
|||
private String buildingName; |
|||
|
|||
/** |
|||
* 所属单元id; 单元长时必填此列 |
|||
*/ |
|||
@ExcelIgnore |
|||
private String unitId; |
|||
/** |
|||
* 所属单元id; 单元长时必填此列 |
|||
*/ |
|||
@ExcelProperty(value = "单元") |
|||
@ColumnWidth(20) |
|||
private String unitName; |
|||
|
|||
|
|||
} |
@ -0,0 +1,264 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.alibaba.excel.EasyExcel; |
|||
import com.alibaba.excel.ExcelWriter; |
|||
import com.alibaba.excel.write.metadata.WriteSheet; |
|||
import com.alibaba.excel.write.metadata.style.WriteCellStyle; |
|||
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; |
|||
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
|||
import com.alibaba.fastjson.JSON; |
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.EpmetException; |
|||
import com.epmet.commons.tools.feign.ResultDataResolver; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.DateUtils; |
|||
import com.epmet.commons.tools.utils.ExcelUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; |
|||
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 lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.io.IOUtils; |
|||
import org.apache.poi.ss.usermodel.IndexedColors; |
|||
import org.apache.poi.ss.usermodel.VerticalAlignment; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpHeaders; |
|||
import org.springframework.util.CollectionUtils; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import javax.servlet.ServletOutputStream; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
import java.io.PrintWriter; |
|||
import java.net.URLEncoder; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 楼长单元长信息表(烟台) |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-05-06 |
|||
*/ |
|||
@Slf4j |
|||
@RestController |
|||
@RequestMapping("communityBuildingManager") |
|||
public class CommunityBuildingManagerController implements ResultDataResolver { |
|||
|
|||
@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(); |
|||
} |
|||
|
|||
/** |
|||
* 楼长单元长-下载导入模板 |
|||
* @param response |
|||
* @throws IOException |
|||
*/ |
|||
@RequestMapping(value = "download-tem", method = {RequestMethod.GET, RequestMethod.POST}) |
|||
public void downloadTemplate(HttpServletResponse response) throws IOException { |
|||
response.setCharacterEncoding("UTF-8"); |
|||
response.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Content-Disposition"); |
|||
//response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.ms-excel");
|
|||
response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
|||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("楼长单元长导入模版", "UTF-8") + ".xlsx"); |
|||
|
|||
InputStream is = this.getClass().getClassLoader().getResourceAsStream("excel/yantai/community_building_manager_import_temp.xlsx"); |
|||
try { |
|||
ServletOutputStream os = response.getOutputStream(); |
|||
IOUtils.copy(is, os); |
|||
} finally { |
|||
if (is != null) { |
|||
is.close(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 楼长单元长-列表导出 |
|||
* |
|||
* @param tokenDto |
|||
* @param formDTO |
|||
* @param response |
|||
* @return |
|||
* @throws IOException |
|||
*/ |
|||
@PostMapping("export") |
|||
public void exportCommunityBuildingManager(@LoginUser TokenDto tokenDto, @RequestBody CommunityBuildingManagerPageFormDTO formDTO, HttpServletResponse response) throws IOException { |
|||
formDTO.setCustomerId(tokenDto.getCustomerId()); |
|||
formDTO.setStaffId(tokenDto.getUserId()); |
|||
ExcelWriter excelWriter = null; |
|||
formDTO.setPageNo(NumConstant.ONE); |
|||
formDTO.setPageSize(NumConstant.TEN_THOUSAND); |
|||
try { |
|||
String fileName = "楼长单元长列表导出" + DateUtils.format(new Date()) + ".xlsx"; |
|||
WriteCellStyle headWriteCellStyle = new WriteCellStyle(); |
|||
headWriteCellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex()); |
|||
WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); |
|||
contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER); |
|||
HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle); |
|||
FreezeAndFilter writeHandler = new FreezeAndFilter(); |
|||
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), CommunityBuildingManagerResultDTO.class) |
|||
.registerWriteHandler(horizontalCellStyleStrategy) |
|||
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
|||
.registerWriteHandler(writeHandler).build(); |
|||
WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); |
|||
PageData<CommunityBuildingManagerResultDTO> data = null; |
|||
do { |
|||
data = communityBuildingManagerService.page(formDTO); |
|||
formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); |
|||
excelWriter.write(data.getList(), writeSheet); |
|||
} while (org.apache.commons.collections4.CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize()); |
|||
} catch (EpmetException e) { |
|||
response.reset(); |
|||
response.setCharacterEncoding("UTF-8"); |
|||
response.setHeader("content-type", "application/json; charset=UTF-8"); |
|||
PrintWriter printWriter = response.getWriter(); |
|||
Result<Object> result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), e.getMsg()); |
|||
printWriter.write(JSON.toJSONString(result)); |
|||
printWriter.close(); |
|||
} catch (Exception e) { |
|||
log.error("楼长单元长导出异常export exception", e); |
|||
} finally { |
|||
if (excelWriter != null) { |
|||
excelWriter.finish(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 导入excel |
|||
* |
|||
* @return |
|||
*/ |
|||
@PostMapping("import") |
|||
public Result importExcel(@RequestPart("file") MultipartFile file) { |
|||
return new Result(); |
|||
/*// 1.暂存文件
|
|||
String originalFilename = file.getOriginalFilename(); |
|||
String extName = originalFilename.substring(originalFilename.lastIndexOf(".")); |
|||
|
|||
Path fileSavePath; |
|||
try { |
|||
Path importPath = FileUtils.getAndCreateDirUnderEpmetFilesDir(ImportTaskConstants.COMMUNITY_BUILDING_MANAGER, "import"); |
|||
fileSavePath = importPath.resolve(UUID.randomUUID().toString().concat(extName)); |
|||
} catch (IOException e) { |
|||
String errorMsg = ExceptionUtils.getErrorStackTrace(e); |
|||
log.error("【楼长单元长导入】创建临时存储文件失败:{}", errorMsg); |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "文件上传失败", "文件上传失败"); |
|||
} |
|||
|
|||
InputStream is = null; |
|||
FileOutputStream os = null; |
|||
|
|||
try { |
|||
is = file.getInputStream(); |
|||
os = new FileOutputStream(fileSavePath.toString()); |
|||
IOUtils.copy(is, os); |
|||
} catch (Exception e) { |
|||
log.error(ImportTaskConstants.COMMUNITY_BUILDING_MANAGER + "表 importExcel exception", e); |
|||
} finally { |
|||
org.apache.poi.util.IOUtils.closeQuietly(is); |
|||
org.apache.poi.util.IOUtils.closeQuietly(os); |
|||
} |
|||
|
|||
// 2.生成导入任务记录
|
|||
ImportTaskCommonResultDTO rstData = getResultDataOrThrowsException( |
|||
ImportTaskUtils.createImportTask(originalFilename, ImportTaskConstants.COMMUNITY_BUILDING_MANAGER), |
|||
ServiceConstant.EPMET_COMMON_SERVICE, |
|||
EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), |
|||
"楼长单元长导入excel错误", |
|||
"楼长单元长导入excel错误"); |
|||
|
|||
// 3.执行导入
|
|||
communityBuildingManagerService.execAsyncExcelImport(fileSavePath, rstData.getTaskId()); |
|||
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,120 @@ |
|||
package com.epmet.excel.handler; |
|||
|
|||
import com.alibaba.excel.context.AnalysisContext; |
|||
import com.alibaba.excel.read.listener.ReadListener; |
|||
import com.epmet.commons.tools.exception.EpmetException; |
|||
import com.epmet.commons.tools.exception.ExceptionUtils; |
|||
import com.epmet.commons.tools.exception.ValidateException; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.ObjectUtil; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.entity.IcPropertyManagementEntity; |
|||
import com.epmet.excel.yt.IcPropertyManagementImportExcelData; |
|||
import com.epmet.service.impl.IcPropertyManagementServiceImpl; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.collections4.CollectionUtils; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author yzm |
|||
* @Date 2023/5/8 14:23 |
|||
*/ |
|||
@Slf4j |
|||
public class IcPropertyManagementImportListener implements ReadListener<IcPropertyManagementImportExcelData> { |
|||
|
|||
// 最大条数阈值
|
|||
public static final int MAX_THRESHOLD = 200; |
|||
private String currentCustomerId; |
|||
private IcPropertyManagementServiceImpl propertyManagementService; |
|||
// 错误项列表
|
|||
private List<IcPropertyManagementImportExcelData.ErrorRow> errorRows = new ArrayList<>(); |
|||
// 要插入的数据
|
|||
private List<IcPropertyManagementEntity> insertDatas = new ArrayList<>(); |
|||
private List<IcPropertyManagementEntity> updateDatas = new ArrayList<>(); |
|||
|
|||
public IcPropertyManagementImportListener(String customerId, IcPropertyManagementServiceImpl propertyManagementService) { |
|||
this.currentCustomerId = customerId; |
|||
this.propertyManagementService = propertyManagementService; |
|||
} |
|||
|
|||
@Override |
|||
public void invoke(IcPropertyManagementImportExcelData data, AnalysisContext analysisContext) { |
|||
try { |
|||
// log.warn("有数据吗?"+JSON.toJSONString(data));
|
|||
// 不能为空先校验数据
|
|||
ValidatorUtils.validateEntity(data); |
|||
// 去除空格
|
|||
ObjectUtil.objectToTrim(data); |
|||
//物业名称唯一
|
|||
IcPropertyManagementEntity origin=propertyManagementService.getByName(currentCustomerId, data.getName()); |
|||
|
|||
IcPropertyManagementEntity propertyManagementEntity = ConvertUtils.sourceToTarget(data, IcPropertyManagementEntity.class); |
|||
propertyManagementEntity.setCustomerId(currentCustomerId); |
|||
if (null != origin) { |
|||
origin.setContactMobile(data.getContactMobile()); |
|||
origin.setContactName(data.getContactName()); |
|||
updateDatas.add(origin); |
|||
} else { |
|||
insertDatas.add(propertyManagementEntity); |
|||
} |
|||
|
|||
if (insertDatas.size() == MAX_THRESHOLD) { |
|||
execPersist(); |
|||
} |
|||
if (updateDatas.size() == MAX_THRESHOLD) { |
|||
execPersist(); |
|||
} |
|||
} catch (Exception e) { |
|||
String errorMsg = null; |
|||
if (e instanceof ValidateException) { |
|||
errorMsg = ((ValidateException) e).getMsg(); |
|||
} else if (e instanceof EpmetException) { |
|||
errorMsg = ((EpmetException) e).getInternalMsg(); |
|||
} else { |
|||
errorMsg = "未知错误"; |
|||
log.error("【物业管理表ic_property_management导入】出错:{}", ExceptionUtils.getErrorStackTrace(e)); |
|||
} |
|||
IcPropertyManagementImportExcelData.ErrorRow errorRow = ConvertUtils.sourceToTarget(data, IcPropertyManagementImportExcelData.ErrorRow.class); |
|||
errorRow.setErrorInfo(errorMsg); |
|||
errorRows.add(errorRow); |
|||
} |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
|||
// 最后几条达不到阈值,这里必须再调用一次
|
|||
execPersist(); |
|||
} |
|||
|
|||
/** |
|||
* 执行持久化 |
|||
*/ |
|||
private void execPersist() { |
|||
try { |
|||
if (CollectionUtils.isNotEmpty(insertDatas)) { |
|||
propertyManagementService.insertBatch(insertDatas); |
|||
} |
|||
|
|||
if (CollectionUtils.isNotEmpty(updateDatas)) { |
|||
propertyManagementService.updateBatchById(updateDatas); |
|||
} |
|||
} finally { |
|||
insertDatas.clear(); |
|||
updateDatas.clear(); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 获取错误行 |
|||
* |
|||
* @return |
|||
*/ |
|||
public List<IcPropertyManagementImportExcelData.ErrorRow> getErrorRows() { |
|||
return errorRows; |
|||
} |
|||
} |
|||
|
@ -0,0 +1,61 @@ |
|||
package com.epmet.excel.yt; |
|||
|
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author yzm |
|||
* @Date 2023/5/8 14:24 |
|||
*/ |
|||
@Data |
|||
public class IcPropertyManagementImportExcelData { |
|||
/** |
|||
* 物业名称 |
|||
*/ |
|||
@NotBlank(message = "物业名称必填") |
|||
@ExcelProperty(value = "*物业名称") |
|||
private String name; |
|||
|
|||
/** |
|||
* 烟台需求:物业联系人姓名 |
|||
*/ |
|||
@ExcelProperty(value = "物业联系人") |
|||
private String contactName; |
|||
|
|||
/** |
|||
* 烟台需求:物业联系人电话 |
|||
*/ |
|||
@ExcelProperty(value = "联系电话") |
|||
private String contactMobile; |
|||
|
|||
@Data |
|||
public static class ErrorRow { |
|||
/** |
|||
* 物业名称 |
|||
*/ |
|||
@ExcelProperty(value = "*物业名称") |
|||
private String name; |
|||
|
|||
/** |
|||
* 烟台需求:物业联系人姓名 |
|||
*/ |
|||
@ExcelProperty(value = "物业联系人") |
|||
private String contactName; |
|||
|
|||
/** |
|||
* 烟台需求:物业联系人电话 |
|||
*/ |
|||
@ExcelProperty(value = "联系电话") |
|||
private String contactMobile; |
|||
|
|||
|
|||
@ColumnWidth(60) |
|||
@ExcelProperty("错误信息") |
|||
private String errorInfo; |
|||
} |
|||
} |
|||
|
@ -0,0 +1,69 @@ |
|||
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.nio.file.Path; |
|||
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); |
|||
|
|||
void execAsyncExcelImport(Path fileSavePath, String taskId); |
|||
} |
@ -0,0 +1,191 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|||
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 lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.scheduling.annotation.Async; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import java.nio.file.Path; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 楼长单元长信息表(烟台) |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-05-06 |
|||
*/ |
|||
@Slf4j |
|||
@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(), formDTO.getPageSize()); |
|||
} |
|||
|
|||
/** |
|||
* 查看详情 |
|||
* |
|||
* @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) { |
|||
// 唯一性判断,类型+楼栋id或者类型+单元id唯一
|
|||
checkUnqiue(addFormDto.getType(), addFormDto.getBuildingId(), addFormDto.getUnitId(), null); |
|||
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); |
|||
} |
|||
|
|||
private void checkUnqiue(String type, String buildingId, String unitId, String id) { |
|||
// 1号楼只允许有一个楼长
|
|||
// 1号楼只允许有一个单元长
|
|||
LambdaQueryWrapper<CommunityBuildingManagerEntity> countQuery = new LambdaQueryWrapper<>(); |
|||
countQuery.eq(CommunityBuildingManagerEntity::getType, type) |
|||
.eq(CommunityBuildingManagerEntity::getBuildingId, buildingId) |
|||
.eq(StringUtils.isNotBlank(unitId), CommunityBuildingManagerEntity::getUnitId, unitId) |
|||
.ne(StringUtils.isNotBlank(id), CommunityBuildingManagerEntity::getId, id); |
|||
if (baseDao.selectCount(countQuery) > NumConstant.ZERO) { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所选楼栋(单元)已存在楼长(单元长)", "所选楼栋(单元)已存在楼长(单元长)"); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 编辑楼长/单元长 |
|||
* todo: 同步到具体的楼栋 |
|||
* |
|||
* @param updateFormDto |
|||
* @return |
|||
*/ |
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(CommunityBuildingManagerDTO updateFormDto) { |
|||
checkUnqiue(updateFormDto.getType(), updateFormDto.getBuildingId(), updateFormDto.getUnitId(), updateFormDto.getId()); |
|||
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) { |
|||
Date now=new Date(); |
|||
ids.forEach(id->{ |
|||
LambdaUpdateWrapper<CommunityBuildingManagerEntity> updateWrapper = new LambdaUpdateWrapper<>(); |
|||
updateWrapper.eq(CommunityBuildingManagerEntity::getId, id) |
|||
.set(CommunityBuildingManagerEntity::getDelFlag, NumConstant.ONE_STR) |
|||
.set(CommunityBuildingManagerEntity::getUpdatedBy, EpmetRequestHolder.getLoginUserId()) |
|||
.set(CommunityBuildingManagerEntity::getUpdatedTime, now); |
|||
baseDao.update(null, updateWrapper); |
|||
// todo
|
|||
}); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 执行Excel导入 |
|||
* |
|||
* @param filePath |
|||
* @param importTaskId |
|||
*/ |
|||
@Async |
|||
@Override |
|||
public void execAsyncExcelImport(Path filePath, String importTaskId) { |
|||
// todo
|
|||
return; |
|||
} |
|||
|
|||
|
|||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,100 @@ |
|||
<?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.*, |
|||
( |
|||
case when m.type='0' then '楼长' |
|||
when m.type='1' then '单元长' |
|||
else '-' |
|||
end |
|||
)as typeName, |
|||
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> |
@ -0,0 +1,33 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import com.epmet.commons.tools.dto.form.PageFormDTO; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author yzm |
|||
* @Date 2023/5/5 9:47 |
|||
*/ |
|||
@Data |
|||
public class RegisterRelationPageFormDTO extends PageFormDTO { |
|||
/** |
|||
* 客户Id (customer.id) |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* agencyId的所有上级,包含自己 |
|||
*/ |
|||
private String agencyIdPath; |
|||
|
|||
/** |
|||
* 网格Id (customer_grid.id) |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 首次注册用户 0表示不参与计数 1表示参与计数 |
|||
*/ |
|||
private String firstRegister; |
|||
} |
|||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue