springcloud_k8s_panzhihuazhihuishequ/common/pom.xml
@@ -15,6 +15,11 @@ <dependencies> <dependency> <groupId>cn.hutool</groupId> <artifactId>hutool-core</artifactId> <version>5.6.7</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> </dependency> @@ -137,13 +142,6 @@ <!-- go to https://search.maven.org/search?q=tencentcloud-sdk-java and get the latest version. --> <!-- 请到https://search.maven.org/search?q=tencentcloud-sdk-java查询所有版本,最新版本如下 --> <version>3.1.286</version> </dependency> <dependency> <groupId>cn.hutool</groupId> <artifactId>hutool-core</artifactId> <version>4.0.7</version> </dependency> <dependency> <groupId>cn.hutool</groupId> springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/api/LangchaoApiConstants.java
@@ -10,6 +10,10 @@ { /** * 将浪潮对接接口中所需的token存在Redis里面的KEY */ public static final String LANG_CHAO_TOKEN ="lang_chao_token"; /** * 获取token */ public static final String GRID_GET_TOKEN_URL = "http://171.217.92.33:53303/aaToken?username=#username&password=#password"; @@ -41,4 +45,8 @@ * 通过AREAID获取辖区网格树 */ public static final String GRID_GET_EVENT_INFO_AREA_ID_URL = "http://171.217.92.33:53303/area/getAreaGridTreeByAreaId"; /** * 获取所有或者根据姓名和工号查询,分页 */ public static final String GRID_GET_GETALL_SEARCH_PAGE_URL = "http://171.217.92.33:53303/gridOperator/getAllOrSearchByPage?areaId=jhRxqEQp&limit=200&page=1"; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/api/LcReturnObject.java
New file @@ -0,0 +1,28 @@ package com.panzhihua.common.api; import lombok.Data; /** * 攀枝花综治网格化-事件接口请求返回的对象 * des * @author manailin * @date 2021/06/20 */ @Data public class LcReturnObject { /** * 返回code */ private String code; /** *返回消息信息 */ private String message; /** *返回对象信息 */ private String data; /** *返回的是否成功标识 */ private Boolean success; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/enums/KeyPersonLabelEnum.java
@@ -3,9 +3,9 @@ import lombok.Getter; /** * 婚姻状况 * * @author huanghongfa * * * @author manaiilin */ @Getter public enum KeyPersonLabelEnum springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/enums/LocalEventToLangChaoEventTypeEnum.java
New file @@ -0,0 +1,46 @@ package com.panzhihua.common.enums; import lombok.Getter; /** * desc 本地事件类型和浪潮接口对应的事件类型的对应关系 * 本地事件类型1治安隐患、2公共服务、3矛盾纠纷、4不稳定因素、5突发事件、6特殊人群信息上报 7宣传教育 * @author manaiilin */ @Getter public enum LocalEventToLangChaoEventTypeEnum { ZA(1, "6","治安隐患"), GG(2, "4","公共服务"), MD(3, "5","矛盾纠纷"), TF(5, "1b62afbccc2a4bb98125f999b7133242","突发事件"), TSRQ(6, "7da14163537b4b7e9a73ae28f4a58b72","特殊人群信息上报"), XC(8, "9306ca7327a44b5ca474426f2da0e206","宣传教育"); private final Integer code; private final String name; private final String eventName; LocalEventToLangChaoEventTypeEnum(Integer code, String name,String eventName) { this.code = code; this.name = name; this.eventName = eventName; } public static String getCodeByName(Integer code) { for (LocalEventToLangChaoEventTypeEnum item : LocalEventToLangChaoEventTypeEnum.values()) { if (item.getCode().equals(code)) { return item.getName(); } } return ZA.getName(); } public static String getEventNameByCode(Integer code) { for (LocalEventToLangChaoEventTypeEnum item : LocalEventToLangChaoEventTypeEnum.values()) { if (item.getCode().equals(code)) { return item.getEventName(); } } return ZA.getEventName(); } } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/api/EventFile.java
New file @@ -0,0 +1,35 @@ package com.panzhihua.common.model.dtos.api; import lombok.Data; /** * program 攀枝花智慧社区项目 * description 上报事件关联的文件实体对象 * * @author manailin * Date 2021-06-17 15:30 **/ @Data public class EventFile { /** * 事件业务ID,本地的ID */ private String dataId; /** * 事件关联的文件对象 */ private String files; /** * 文件类型 */ private String fileName; /** * 文件类型 */ private String type; /** * 关联模块 */ private String module; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/api/EventInfo.java
New file @@ -0,0 +1,86 @@ package com.panzhihua.common.model.dtos.api; import lombok.Data; import java.util.ArrayList; import java.util.List; /** * program 攀枝花智慧社区项目 * description 上报事件实体对象 * * @author manailin * Date 2021-06-17 15:30 **/ @Data public class EventInfo { /** *网格id,APP端每个网格员应该是固定的网格 */ private String gridId; /** *网格 名称 */ private String gridName; /** *事件类型code */ private String caseTypeCode; /** *事件类型名称 */ private String caseTypeName; /** *事件发生时间,时间的实际发生时间,网格员可以修改的时间 */ private String happenTime; /** *地址,手动填写或通过天地图获取的地址信息 */ private String happenAddress; /** *经度,double字符串 */ private String longitude; /** *纬度,double字符串 */ private String latitude; /** *对本次事件的描述信息 */ private String caseDescription; /** *对本次事件记录的时间,APP记录本条数据的时间,网格员自己看不到 */ private String caseRecordTime; /** *处理方式,caseReport(立即上报)、caseHandler(事件自处)、caseCache(事件暂存) */ private String handleType; /** *处理的描述信息 */ private String handleDescription; /** *APP生产的数据id,用于平台判断重复提交 */ private String dataId; /** *用户id */ private String userId; /** *处理的时间,APP点击提交的时间,并非平台接收的时间(APP可以离线使用 */ private String handleTime; /** * 标题 */ private String caseName; /** *当事人姓名 */ private List<PartiesBody> partiesBody =new ArrayList<>(); } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/api/LcGridMember.java
New file @@ -0,0 +1,47 @@ package com.panzhihua.common.model.dtos.api; import lombok.Data; /** * program 攀枝花智慧社区项目 * description 上报事件关联的网格员实体对象 * * @author manailin * Date 2021-06-17 15:30 **/ @Data public class LcGridMember { /** * 网格员名字 */ private String name; /** * 网格员电话 */ private String contactPhone; /** * 网格员工号 */ private String jobNum; /** * 网格员联系电话 */ private String imei; /** * 网格员登录密码 */ private String password; /** * 网格员任职时间 2021-06-18 */ private String orgDutyDate; /** * 网格员责任网格 8c86b8b467194270b6b066b9c32e3b9b,a028fe8a7fff455781fa0bc3f66132fd */ private String select; /** * 网格员责任网格 8c86b8b467194270b6b066b9c32e3b9b,a028fe8a7fff455781fa0bc3f66132fd */ private String gridDutyId; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/api/PartiesBody.java
New file @@ -0,0 +1,22 @@ package com.panzhihua.common.model.dtos.api; import lombok.Data; /** * program 攀枝花智慧社区项目 * description 上报事件中当事人实体对象 * * @author manailin * Date 2021-06-17 15:30 **/ @Data public class PartiesBody { /** * 当事人名字 */ private String partyName; /** * 当事人电话 */ private String partyPhone; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/DisabledPersonsDTO.java
@@ -1,5 +1,6 @@ package com.panzhihua.common.model.dtos.community; import cn.afterturn.easypoi.excel.annotation.Excel; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; @@ -33,16 +34,19 @@ * 名字 */ @ExcelProperty(value = "名字" ,index = 0) @Excel(name = "姓名(必填项)", width = 20, isImportField = "true_st") private String name; /** * 身份证号码 */ @ExcelProperty(value = "身份证号码" ,index = 1) @Excel(name = "身份证号码(必填项)", width = 20, isImportField = "true_st") private String cardNo; /** * 残疾人证编码 */ @ExcelProperty(value = "残疾人证编码" ,index = 2) @Excel(name = "残疾人证编码(必填项)", width = 20, isImportField = "true_st") private String disableSn; /** * 出生年月 @@ -51,12 +55,14 @@ /** * 残疾人证 */ @ExcelProperty(value = "残疾人证" ,index = 3) @ExcelProperty(value = "残疾人证类型" ,index = 3) @Excel(name = "残疾人证类型(必填项)", width = 20, isImportField = "true_st") private String level; /** * 性别(取字典表国家编码) */ @ExcelProperty(value = "性别" ,index = 4) @Excel(name = "性别(必填项)", width = 20, isImportField = "true_st") private String sex; /** * 性别名称 @@ -66,36 +72,43 @@ * 文化程度(取字典表国家编码)) */ @ExcelProperty(value = "文化程度" ,index = 5) @Excel(name = "文化程度(必填项)", width = 20, isImportField = "true_st") private String cultureLevel; /** * 民族 */ @ExcelProperty(value = "民族" ,index = 6) @Excel(name = "民族(必填项)", width = 20, isImportField = "true_st") private String nation; /** * 残疾部位/类别 */ @ExcelProperty(value = "残疾部位" ,index = 7) @ExcelProperty(value = "残疾类别" ,index = 7) @Excel(name = "残疾类别(必填项)", width = 20, isImportField = "true_st") private String disableType; /** * 残疾级别 */ @ExcelProperty(value = "残疾级别" ,index = 8) @Excel(name = "残疾级别(必填项)", width = 20, isImportField = "true_st") private String disableLevel; /** * 联系电话 */ @ExcelProperty(value = "联系电话" ,index = 9) @Excel(name = "联系电话(必填项)", width = 20, isImportField = "true_st") private String phone; /** * 监护人联系电话 */ @ExcelProperty(value = "监护人联系电话" ,index =10) @Excel(name = "监护人联系电话(必填项)", width = 20, isImportField = "true_st") private String guardianPhone; /** * 地址 */ @ExcelProperty(value = "地址" ,index = 11) @Excel(name = "地址(必填项)", width = 20, isImportField = "true_st") private String address; /** * 创建用户 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/community/bigscreen/event/ScreenEventListDTO.java
@@ -5,6 +5,7 @@ import lombok.Data; import javax.validation.constraints.NotNull; import java.util.List; @Data @ApiModel("大屏事件列表请求参数") @@ -27,10 +28,10 @@ private String endTime; @ApiModelProperty(value="网格id") private Long gridId; private List<Long> gridIds; @ApiModelProperty(value="事件类型(1治安隐患、2公共服务、3矛盾纠纷、4不稳定因素、5突发事件、6特殊人群信息上报 8宣传教育)") private Integer eventType; private List<Integer> eventTypes; @ApiModelProperty(value="事件分类(1、办件事件2、宣传事件3、阅读事件)",hidden = true) private Integer eventCategory = 1; springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/screen/event/EventGridStatisticsVO.java
@@ -1,5 +1,7 @@ package com.panzhihua.common.model.vos.community.screen.event; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -11,6 +13,7 @@ public class EventGridStatisticsVO { @ApiModelProperty("网格id") @JsonSerialize(using = ToStringSerializer.class) private Long id; @ApiModelProperty("网格名称") springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/screen/event/EventListVO.java
@@ -68,4 +68,13 @@ @ApiModelProperty("发生区域") private String gridName; @ApiModelProperty(value = "音频") private List<EventResourceVO> audios; @ApiModelProperty(value = "视频") private List<EventResourceVO> videos; @ApiModelProperty(value = "图片") private List<EventResourceVO> pics; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/screen/event/EventTransferRecordDetailVO.java
New file @@ -0,0 +1,19 @@ package com.panzhihua.common.model.vos.community.screen.event; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @ApiModel("大屏事件播报流转记录详情返回参数") public class EventTransferRecordDetailVO { @ApiModelProperty("街道名称") private String streetName; @ApiModelProperty("社区名称") private String communityName; @ApiModelProperty("网格名称") private String gridName; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/screen/event/EventTransferRecordVO.java
@@ -17,4 +17,31 @@ @ApiModelProperty("事件处理结果") private String processResult; @ApiModelProperty("业务处理类型 1 网格员处理 2 派发到社区 3 社区处理 4 社区标为无效 5 标为无效后处理 6 验证 7 撤销 8 重新发布已撤销事件 9 社区重新发布已标为无效的事件") private Integer processType; @ApiModelProperty("事件处理人") private String fromName; @ApiModelProperty(value = "来源类型(1、网格员2、社区3、是街道)",hidden = true) private Integer fromType; @ApiModelProperty(value = "事件来源机构或网格员",hidden = true) private Long fromId; @ApiModelProperty("上级关系") private String superiorRelationship; @ApiModelProperty(value = "事件id",hidden = true) private Long eventId; /** * 来源类型(1、网格员2、社区3、是街道) */ public interface fromType{ int wgy = 1; int sq = 2; int jd = 3; } } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/ComActNeighborCircleAdminVO.java
@@ -21,6 +21,9 @@ @ApiModelProperty("发布人id") private Long releaseId; @ApiModelProperty("发布人头像url") private String imageUrl; @ApiModelProperty("发布人") private String releaseName; springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/screen/ComActEasyPhotoScreenVO.java
@@ -18,14 +18,14 @@ @ApiModelProperty("本月新增") private Long currentNum; @ApiModelProperty("已处理") private List<PieElementVO> deal; @ApiModelProperty("已处理随手拍") private List<EastPhotoTypeVO> deal; @ApiModelProperty("已公示") private List<PieElementVO> pub; @ApiModelProperty("已公示随手拍") private List<EastPhotoTypeVO> pub; @ApiModelProperty("已驳回") private List<PieElementVO> approved; @ApiModelProperty("已审核随手拍") private List<EastPhotoTypeVO> approved; @ApiModelProperty("未处理") private Long noneDeal; @@ -34,10 +34,8 @@ private Integer pubPoint; @ApiModelProperty("平均耗时") private String dealTime; private Integer dealTime; @ApiModelProperty("线形图统计时间段") private String listTimes; @ApiModelProperty("随手拍线形列表") private List<EastPhotoVO> list; springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/screen/ComActPopulationScreenVO.java
@@ -1,7 +1,5 @@ package com.panzhihua.common.model.vos.screen; import com.panzhihua.common.model.vos.community.screen.civil.CivilVillageStatisticsVO; import com.panzhihua.common.model.vos.community.screen.event.EventGridStatisticsVO; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -48,11 +46,5 @@ @ApiModelProperty("实有人口文化程度统计") private List<ComActPopulationCultureVO> cultureGroup; @ApiModelProperty("大屏网格数据") private List<EventGridStatisticsVO> gridStatisticsList; @ApiModelProperty("小区列表数据") private List<CivilVillageStatisticsVO> villageStatisticsList; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/screen/ComActWorkScreenVO.java
@@ -23,18 +23,13 @@ @ApiModelProperty("每天完成") private String everyDayNum; @ApiModelProperty("完成总数") private Integer totalCompleted; @ApiModelProperty("未完成总数") private Integer totalNoneCompleted; @ApiModelProperty("总完成度") private Integer totalCompletedPoint; @ApiModelProperty("已完成") private List<PieElementVO> completetList; private List<ActWorkCountVO> completetPoint; @ApiModelProperty("未完成") private List<PieElementVO> noneList; private List<ActWorkCountVO> nonePoint; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/screen/EasyPhotoPointVO.java
New file @@ -0,0 +1,20 @@ package com.panzhihua.common.model.vos.screen; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @author xyh * @date 2021/6/16 16:21 */ @ApiModel("随手拍饼状图") @Data public class EasyPhotoPointVO { @ApiModelProperty("类型名") private String typeName; @ApiModelProperty("占比") private Integer point; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/screen/PbWorkVO.java
@@ -22,4 +22,9 @@ @ApiModelProperty("党员活动") private Long activity; @ApiModelProperty(hidden = true) private String start; @ApiModelProperty(hidden = true) private String end; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/api/ApiServiceFeign.java
New file @@ -0,0 +1,62 @@ package com.panzhihua.common.service.api; import com.panzhihua.common.model.dtos.api.EventFile; import com.panzhihua.common.model.dtos.api.EventInfo; import com.panzhihua.common.model.dtos.grid.*; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.grid.*; import io.swagger.annotations.ApiOperation; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.*; import java.util.List; /** * * @author manailin * desc 主要是提供给浪潮服务器上传事件 * @version 1.0 * @since 1.0 * @date 2021-05-26 * */ @FeignClient(name = "serviceApi") public interface ApiServiceFeign { /** * description 生成或更新redis里面的对接浪潮所需的token信息 * @param name 账号 * @param password 密码 * @author manailin * @date 2021/6/10 17:00 */ @GetMapping("get/token") void getToken(@RequestParam("name") String name,@RequestParam("password") String password); /** * description 向浪潮服务器提交网格事件登记 * * @param eventInfo 事件信息对象 * @author manailin * @date 2021/6/10 17:00 */ @PostMapping("lc/event/upload") void automationUpload(@RequestBody EventInfo eventInfo); /** * description 提交事件登记关联的文件或者图片信息 * @param eventFile 文件对象 * @return R 上传结果 * @author manailin * @date 2021/6/10 17:00 */ @PostMapping("lc/event/upload/file") R automationUploadFile(@RequestBody EventFile eventFile); /** * description 提交事件登记关联的文件或者图片信息 * * @author manailin * @date 2021/6/10 17:00 */ @ApiOperation(value = "提交事件登记关联的文件或者图片信息") @PostMapping("lc/event/upload/event_and_file") void automationUploadEventAndFile(); } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -47,7 +47,6 @@ import com.panzhihua.common.model.vos.shop.ShopStoreVO; import com.panzhihua.common.model.vos.user.UserElectronicFileVO; import com.panzhihua.common.model.vos.user.UserPhoneVO; import com.panzhihua.common.utlis.ExcelSelectObject; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; @@ -2872,10 +2871,17 @@ */ @PostMapping("/elders/records/page") R pageQueryEldersAuthRecord(@RequestBody PageEldersAuthRecordDTO pageEldersAuthElderlyDTO); /** * description 批量保存重点人群人员信息 * * @param list 重点人群信息 * @return R 保存结果 * @author manailin * @date 2021/6/10 17:00 */ @PostMapping("/key_person/batch/save") R saveBatchKeyPerson(@RequestBody List<KeyPersonInfoDTO> list); @GetMapping("/screen/population/statistic") R statistic(@RequestParam("communityId")Long communityId); @@ -2893,7 +2899,7 @@ @PostMapping("/elders/getAuthHistoryExport") R getAuthHistoryExport(@RequestBody PageEldersAuthHistoryDTO pageEldersAuthElderlyDTO); @GetMapping("/screen/work/neighborCircle") R statisticNeighborCircle(@RequestParam("communityId") Long communityId); @@ -2956,7 +2962,7 @@ */ @GetMapping("/screen/getScreenCivil") R getScreenCivil(@RequestParam("communityId")Long communityId); /** * 大屏统计邻里圈 */ @@ -3003,7 +3009,7 @@ */ @GetMapping("/screen/work/workCount") R workCount(@RequestParam("communityId")Long communityId); /** * description 批量保存残疾人人员信息 * springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/grid/GridService.java
@@ -909,4 +909,43 @@ */ @PostMapping("/event/special/population/list") R specialPopulationList(@RequestBody PageEventSpecialPopulationDTO specialPopulationDTO); /** * description 根据本地网格ID,查询对于的浪潮市平台对应的ID * * @param id 本地网格ID * @return String 浪潮市平台对应的ID * @author manailin * @date 2021/6/10 17:00 */ @GetMapping("/lc_compare/{id}") String getLcGridIdByLocal(@PathVariable("id") Long id); /** * description 根据本地网格ID,查询对于的浪潮市平台对应的ID * * @param localUserId 本地网格员ID * @return String 浪潮市平台对应的ID * @author manailin * @date 2021/6/10 17:00 */ @GetMapping("/lc_compare/getLcUserId") String getLcUserIdByLocalUserId(@RequestParam("localUserId") String localUserId); /** * description 获取所有未上传到浪潮平台的事件列表 * * @return String 事件列表 * @author manailin * @date 2021/6/10 17:00 */ @GetMapping("/event/getUnUploadEvent") List<EventDetailsVO> getUnUploadEvent(); /** * description 更新上传是否成功标识 * @param id 事件主键ID * @return Boolean 上传是否成功 * @author manailin * @date 2021/6/10 17:00 */ @GetMapping("/event/updateLcUploadFlag") Boolean updateLcUploadFlag(@RequestParam("id")Long id); } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/DateUtils.java
@@ -127,6 +127,13 @@ } /** * 返回当前事件的时间戳 * @return */ public static Long getCurrentDateTimeStamp(){ return LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli(); } /** * 获取当前时间字符串,格式为yyyy-MM-dd HH:mm:ss * @return */ @@ -746,13 +753,10 @@ public static void main(String[]args)throws Exception{ isValidDate("2020/12/4"); // Date date= new Date(); // Date after = new Date(); // System.out.println(calTimeDifference(date,after)); System.out.println(getYearMonthStart(2021,2)); } } springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/DisablePersonApi.java
@@ -79,9 +79,9 @@ @ApiOperation(value = "导出用于导入的模板EXCEL", notes = "导出用于导入的模板EXCEL") @GetMapping("diabled_person/export/model") public void exportUser(HttpServletResponse response) throws IOException { List<ExcelSelectObject> selectListObject = keyPersonBizService.defineExcelModelData(); List<ExcelSelectObject> selectListObject = keyPersonBizService.defineDisableUserExcelModelData(); //导出操作 ExcelUtil.exportExcelForSelectList(Collections.emptyList(), "残疾人员信息导入模版", "残疾人员信息导入模版", KeyPersonExcelExportDto.class, "残疾人员信息导入模版.xls", selectListObject, response); ExcelUtil.exportExcelForSelectList(Collections.emptyList(), "残疾人员信息导入模版", "残疾人员信息导入模版", DisabledPersonsDTO.class, "残疾人员信息导入模版.xls", selectListObject, response); } } springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ScreenWorkApi.java
@@ -9,6 +9,7 @@ import com.panzhihua.common.model.dtos.neighbor.DetailNeighborAllCommentByAdminDTO; import com.panzhihua.common.model.dtos.neighbor.DetailNeighborCommentReplyByAdminDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.ComActDynVO; import com.panzhihua.common.model.vos.community.screen.work.ActActivityListVO; import com.panzhihua.common.model.vos.community.screen.work.ActActivityPeopleListVO; import com.panzhihua.common.model.vos.community.screen.work.DiscussListVO; @@ -20,6 +21,7 @@ import com.panzhihua.common.model.vos.screen.*; import com.panzhihua.common.service.community.CommunityService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; @@ -189,4 +191,19 @@ return communityService.detailNeighborCommentAllReply(dto); } @ApiOperation(value = "分页查询社区动态", response = ComActDynVO.class) @PostMapping("pagedynamic") public R pageDynamic(@RequestBody ComActDynVO comActDynVO) { Long communityId = this.getCommunityId(); comActDynVO.setCommunityId(communityId); return communityService.pageDynamicByAdmin(comActDynVO); } @ApiOperation(value = "社区动态详情", response = ComActDynVO.class) @GetMapping("detaildynamic") @ApiImplicitParam(name = "id", value = "社区动态主键", required = true) public R detailDynamic(@RequestParam("id") Long id) { return communityService.detailDynamic(id); } } springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/biz/KeyPersonBizServiceImpl.java
@@ -65,7 +65,6 @@ */ public List<ExcelSelectObject> definePopulationExcelModelData() { HashMap map = new HashMap(5); List<String> dictNames = Arrays.asList("sex", "family", "education", "nation", "key_person_type"); dictNames.forEach(dictName -> { List<BcDictionaryVO> dictionaryItem = communityService.listDictionaryByKey(dictName).getData(); @@ -80,4 +79,19 @@ excelSelectObjectList.add(new ExcelSelectObject(17, 17, (String[]) map.get("family"))); return excelSelectObjectList; } public List<ExcelSelectObject> defineDisableUserExcelModelData() { HashMap map = new HashMap(5); List<String> dictNames = Arrays.asList("sex", "education", "nation"); dictNames.forEach(dictName -> { List<BcDictionaryVO> dictionaryItem = communityService.listDictionaryByKey(dictName).getData(); String[] dataMap = dictionaryItem.stream().map(dictionaryVO -> dictionaryVO.getDictName() + split + dictionaryVO.getDictValue()).distinct().toArray(String[]::new); map.put(dictName, dataMap); }); List<ExcelSelectObject> excelSelectObjectList = new ArrayList<>(); excelSelectObjectList.add(new ExcelSelectObject(4, 4, (String[]) map.get("sex"))); excelSelectObjectList.add(new ExcelSelectObject(5, 5, (String[]) map.get("education"))); excelSelectObjectList.add(new ExcelSelectObject(6, 6, (String[]) map.get("nation"))); return excelSelectObjectList; } } springcloud_k8s_panzhihuazhihuishequ/pom.xml
@@ -209,6 +209,8 @@ <module>grid_backstage</module> <!--网格治理-基础服务service--> <module>service_grid</module> <!--网格治理-对接浪潮的市平台综治接口--> <module>service_api</module> </modules> <packaging>pom</packaging> springcloud_k8s_panzhihuazhihuishequ/service_api/pom.xml
New file @@ -0,0 +1,122 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.panzhihua</groupId> <artifactId>zhihuishequ</artifactId> <version>1.0-SNAPSHOT</version> </parent> <groupId>com.panzhihua</groupId> <artifactId>service_api</artifactId> <version>0.0.1-SNAPSHOT</version> <name>service_api</name> <description>对接第三方接口项目</description> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-config</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-openfeign</artifactId> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>com.panzhihua</groupId> <artifactId>common</artifactId> </dependency> <dependency> <groupId>com.netflix.hystrix</groupId> <artifactId>hystrix-javanica</artifactId> </dependency> <dependency> <groupId>com.github.xiaoymin</groupId> <artifactId>swagger-bootstrap-ui</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>cn.hutool</groupId> <artifactId>hutool-http</artifactId> <version>5.6.7</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <mainClass>com.panzhihua.serviceapi.ServiceApiApplication</mainClass> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId> <version>1.2.0</version> <configuration> <imageName>registry.cn-chengdu.aliyuncs.com/panzhihua/service_api:v1</imageName> <serverId></serverId> <baseImage>java</baseImage> <entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint> <resources> <resource> <targetPath>/</targetPath> <directory>${project.build.directory}</directory> <include>${project.build.finalName}.jar</include> </resource> </resources> </configuration> </plugin> </plugins> </build> <repositories> <repository> <id>spring-snapshots</id> <name>Spring Snapshots</name> <url>https://repo.spring.io/snapshot</url> <snapshots> <enabled>true</enabled> </snapshots> </repository> <repository> <id>spring-milestones</id> <name>Spring Milestones</name> <url>https://repo.spring.io/milestone</url> </repository> </repositories> </project> springcloud_k8s_panzhihuazhihuishequ/service_api/src/main/java/com/panzhihua/serviceapi/ServiceApiApplication.java
New file @@ -0,0 +1,30 @@ package com.panzhihua.serviceapi; import org.springframework.boot.SpringApplication; import org.springframework.cloud.client.SpringCloudApplication; import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.ComponentScan; import springfox.documentation.swagger2.annotations.EnableSwagger2; /** * program 攀枝花智慧社区项目-对接第三方接口 * description 对接浪潮市平台事件管理API * * @author manailin * Date 2021-06-18 15:30 **/ @EnableSwagger2 @SpringCloudApplication @EnableCircuitBreaker @EnableEurekaClient @EnableFeignClients(basePackages = {"com.panzhihua.common.service"}) @ComponentScan({"com.panzhihua.serviceapi","com.panzhihua.common"}) public class ServiceApiApplication { public static void main(String[] args) { SpringApplication.run(ServiceApiApplication.class, args); } } springcloud_k8s_panzhihuazhihuishequ/service_api/src/main/java/com/panzhihua/serviceapi/aop/OperLogAspect.java
New file @@ -0,0 +1,227 @@ package com.panzhihua.serviceapi.aop; import com.alibaba.fastjson.JSONObject; import com.panzhihua.common.constants.Constants; import com.panzhihua.common.constants.TokenConstant; import com.panzhihua.common.interfaces.OperLog; import com.panzhihua.common.model.vos.LoginUserInfoVO; import com.panzhihua.common.model.vos.user.SysOperLogVO; import com.panzhihua.common.service.user.UserService; import com.panzhihua.common.utlis.AES; import com.panzhihua.common.utlis.IPUtil; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; import org.springframework.stereotype.Component; import org.springframework.util.ObjectUtils; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.BufferedReader; import java.io.IOException; import java.lang.reflect.Method; import java.util.Date; import java.util.HashMap; import java.util.Map; /** * 切面处理类,操作日志异常日志记录处理 * * @author wu * @date 2019/03/21 */ @Slf4j @Aspect @Component public class OperLogAspect { @Resource private UserService userService; /** * 设置操作日志切入点 记录操作日志 在注解的位置切入代码 */ @Pointcut("@annotation(com.panzhihua.common.interfaces.OperLog)") public void operLogPoinCut() { } // /** // * 设置操作异常切入点记录异常日志 扫描所有controller包下操作 // */ // @Pointcut("execution(* com.hyd.zcar.cms.controller..*.*(..))") // public void operExceptionLogPoinCut() { // } /** * 正常返回通知,拦截用户操作日志,连接点正常执行完成后执行, 如果连接点抛出异常,则不会执行 * * @param joinPoint 切入点 * @param keys 返回结果 */ @AfterReturning(value = "operLogPoinCut()", returning = "keys") public void saveOperLog(JoinPoint joinPoint, Object keys) { log.info("进入切面"); // 获取RequestAttributes RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); // 从获取RequestAttributes中获取HttpServletRequest的信息 HttpServletRequest request = (HttpServletRequest) requestAttributes .resolveReference(RequestAttributes.REFERENCE_REQUEST); // 登录对象信息 String userInfo = request.getHeader(TokenConstant.TOKEN_USERINFO); boolean empty = ObjectUtils.isEmpty(userInfo); if (empty) { log.error("操作日志获取登录用户信息失败【{}】",joinPoint); return; } byte[] bytes = AES.parseHexStr2Byte(userInfo); byte[] decrypt = AES.decrypt(bytes, Constants.AES_KEY); userInfo=new String(decrypt); LoginUserInfoVO loginUserInfoVO= JSONObject.parseObject(userInfo,LoginUserInfoVO.class); SysOperLogVO operlog = new SysOperLogVO(); try { // 从切面织入点处通过反射机制获取织入点处的方法 MethodSignature signature = (MethodSignature) joinPoint.getSignature(); // 获取切入点所在的方法 Method method = signature.getMethod(); // 获取操作 OperLog opLog = method.getAnnotation(OperLog.class); if (opLog != null) { String operModul = opLog.operModul(); int operType = opLog.operType(); operlog.setTitle(operModul); // 操作模块 operlog.setBusinessType(operType); // 操作类型 } // 获取请求的类名 String className = joinPoint.getTarget().getClass().getName(); // 获取请求的方法名 String methodName = method.getName(); methodName = className + "." + methodName; operlog.setMethod(methodName); // 请求方法 if (joinPoint.getArgs().length > 0) { for (Object o : joinPoint.getArgs()) { if (o instanceof HttpServletRequest || o instanceof HttpServletResponse) { continue; } operlog.setOperParam(JSONObject.toJSONString(o)); // 请求参数 } } operlog.setJsonResult(JSONObject.toJSONString(keys)); // 返回结果 operlog.setAccount(loginUserInfoVO.getAccount()); operlog.setOperName(loginUserInfoVO.getName()); // 请求用户名称 operlog.setOperIp(IPUtil.getIpAddress(request)); // 请求IP operlog.setOperUrl(request.getRequestURI()); // 请求URI operlog.setRequestMethod(request.getMethod()); operlog.setOperLocation(IPUtil.getIpBelongAddress(request)); operlog.setOperTime(new Date()); // 创建时间 operlog.setAccount(loginUserInfoVO.getAccount()); Long communityId = loginUserInfoVO.getCommunityId(); operlog.setCommunityId(null==communityId?0:communityId); userService.addOperLog(operlog); } catch (Exception e) { e.printStackTrace(); } } // /** // * 异常返回通知,用于拦截异常日志信息 连接点抛出异常后执行 // * // * @param joinPoint 切入点 // * @param e 异常信息 // */ // @AfterThrowing(pointcut = "operExceptionLogPoinCut()", throwing = "e") // public void saveExceptionLog(JoinPoint joinPoint, Throwable e) { // // 获取RequestAttributes // RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); // // 从获取RequestAttributes中获取HttpServletRequest的信息 // HttpServletRequest request = (HttpServletRequest) requestAttributes // .resolveReference(RequestAttributes.REFERENCE_REQUEST); // // ExceptionLog excepLog = new ExceptionLog(); // try { // // 从切面织入点处通过反射机制获取织入点处的方法 // MethodSignature signature = (MethodSignature) joinPoint.getSignature(); // // 获取切入点所在的方法 // Method method = signature.getMethod(); // excepLog.setExcId(UuidUtil.get32UUID()); // // 获取请求的类名 // String className = joinPoint.getTarget().getClass().getName(); // // 获取请求的方法名 // String methodName = method.getName(); // methodName = className + "." + methodName; // // 请求的参数 // Map<String, String> rtnMap = converMap(request.getParameterMap()); // // 将参数所在的数组转换成json // String params = JSON.toJSONString(rtnMap); // excepLog.setExcRequParam(params); // 请求参数 // excepLog.setOperMethod(methodName); // 请求方法名 // excepLog.setExcName(e.getClass().getName()); // 异常名称 // excepLog.setExcMessage(stackTraceToString(e.getClass().getName(), e.getMessage(), e.getStackTrace())); // 异常信息 // excepLog.setOperUserId(UserShiroUtil.getCurrentUserLoginName()); // 操作员ID // excepLog.setOperUserName(UserShiroUtil.getCurrentUserName()); // 操作员名称 // excepLog.setOperUri(request.getRequestURI()); // 操作URI // excepLog.setOperIp(IPUtil.getRemortIP(request)); // 操作员IP // excepLog.setOperVer(operVer); // 操作版本号 // excepLog.setOperCreateTime(new Date()); // 发生异常时间 // // exceptionLogService.insert(excepLog); // // } catch (Exception e2) { // e2.printStackTrace(); // } // // } /** * 转换request 请求参数 * * @param paramMap request获取的参数数组 */ public Map<String, String> converMap(Map<String, String[]> paramMap) { Map<String, String> rtnMap = new HashMap<String, String>(); for (String key : paramMap.keySet()) { rtnMap.put(key, paramMap.get(key)[0]); } return rtnMap; } private String getPostData(HttpServletRequest request) { StringBuffer data = new StringBuffer(); String line = null; BufferedReader reader = null; try { reader = request.getReader(); while (null != (line = reader.readLine())) data.append(line); } catch (IOException e) { } finally { } return data.toString(); } /** * 转换异常信息为字符串 * * @param exceptionName 异常名称 * @param exceptionMessage 异常信息 * @param elements 堆栈信息 */ public String stackTraceToString(String exceptionName, String exceptionMessage, StackTraceElement[] elements) { StringBuffer strbuff = new StringBuffer(); for (StackTraceElement stet : elements) { strbuff.append(stet + "\n"); } String message = exceptionName + ":" + exceptionMessage + "\n\t" + strbuff.toString(); return message; } } springcloud_k8s_panzhihuazhihuishequ/service_api/src/main/java/com/panzhihua/serviceapi/api/LcEventApi.java
New file @@ -0,0 +1,138 @@ package com.panzhihua.serviceapi.api; import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.model.dtos.api.EventFile; import com.panzhihua.common.model.dtos.api.EventInfo; import com.panzhihua.common.model.vos.R; import com.panzhihua.serviceapi.biz.LcApiService; import com.panzhihua.serviceapi.model.dto.LcGridData; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.Collections; import java.util.List; /** * program 攀枝花智慧社区项目 * description 浪潮事件管理API * * @author manailin * Date 2021-01-22 15:30 **/ @Slf4j @Api(tags = {"浪潮事件管理API"}) @RestController @RequestMapping("/") public class LcEventApi extends BaseController { @Resource private LcApiService lcApiService; /** * description 向浪潮服务器提交网格事件登记 * * @param eventInfo 事件信息对象 * @author manailin * @date 2021/6/10 17:00 */ @ApiOperation(value = "向浪潮服务器提交网格事件登记") @PostMapping("lc/event/upload") public void automationUpload(@RequestBody EventInfo eventInfo) { try { lcApiService.submitEventRegister(eventInfo); } catch (Exception e) { log.error("向浪潮服务器提交网格事件登记出现错误:{}", e.getMessage()); } } /** * description 提交事件登记关联的文件或者图片信息 * * @param eventFile 文件对象 * @author manailin * @date 2021/6/10 17:00 */ @ApiOperation(value = "提交事件登记关联的文件或者图片信息") @PostMapping("lc/event/upload/file") public R automationUploadFile(@RequestBody EventFile eventFile) { return lcApiService.submitEventRelationFile(eventFile); } /** * description 提交事件登记关联的文件或者图片信息 * * @author manailin * @date 2021/6/10 17:00 */ @ApiOperation(value = "提交事件登记关联的文件或者图片信息") @PostMapping("lc/event/upload/event_and_file") public void automationUploadEventAndFile() { try { lcApiService.automationUploadEventAndFile(); } catch (Exception e) { log.error("提交事件登记关联的文件或者图片信息出现错误:{}", e.getMessage()); } } /** * description 获取指定事件信息 * * @param eventId 事件ID * @return String 事件信息 * @author manailin * @date 2021/6/10 17:00 */ @ApiOperation(value = "获取指定事件信息") @GetMapping("lc/event/getEventInfoById") public String getEventInfoById(String eventId) { try { return lcApiService.getEventInfoById(eventId); } catch (Exception e) { log.error("获取指定事件信息出现错误:{}", e.getMessage()); } return eventId; } /** * description 获取所有或者根据姓名和工号查询,分页 * * @param eventId 事件ID * @return String 事件信息 * @author manailin * @date 2021/6/10 17:00 */ @ApiOperation(value = "获取所有或者根据姓名和工号查询,分页") @GetMapping("lc/event/getGridMemberListByAreaIdOrName") public String getGridMemberListByAreaIdOrName(String eventId) { try { return lcApiService.getGridMemberListByAreaIdOrName(eventId); } catch (Exception e) { log.error("获取所有或者根据姓名和工号查询,分页出现错误:{}", e.getMessage()); } return eventId; } /** * description 获取指定区域网格列表 * * @param areaId 区域ID * @return String 事件信息 * @author manailin * @date 2021/6/10 17:00 */ @ApiOperation(value = "获取指定区域网格列表") @GetMapping("lc/grid/list") public List<LcGridData> getGridListByAreaId(String areaId) { try { return lcApiService.getGridListByAreaId(areaId); } catch (Exception e) { log.error("获取指定区域网格列表出现错误:{}", e.getMessage()); } return Collections.emptyList(); } } springcloud_k8s_panzhihuazhihuishequ/service_api/src/main/java/com/panzhihua/serviceapi/api/TokenApi.java
New file @@ -0,0 +1,49 @@ package com.panzhihua.serviceapi.api; import com.panzhihua.common.controller.BaseController; import com.panzhihua.serviceapi.biz.LcApiService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; /** * program 攀枝花智慧社区项目 * description token管理API * * @author manailin * Date 2021-01-22 15:30 **/ @Slf4j @Api(tags = {"token管理API"}) @RestController @RequestMapping("/") public class TokenApi extends BaseController { @Resource private LcApiService lcApiService; /** * description 生成或更新redis里面的对接浪潮所需的token信息 * * @param name 账号 * @param password 密码 * @author manailin * @date 2021/6/10 17:00 */ @ApiOperation(value = "生成或更新redis里面的对接浪潮所需的token信息") @GetMapping("get/token") public void getToken(String name, String password) { try { lcApiService.saveTokenFromRemoteRequest(name, password); } catch (Exception e) { log.error("对接浪潮接口——更新或生成token出现错误:{}", e.getMessage()); } } } springcloud_k8s_panzhihuazhihuishequ/service_api/src/main/java/com/panzhihua/serviceapi/biz/LcApiService.java
New file @@ -0,0 +1,98 @@ package com.panzhihua.serviceapi.biz; import com.panzhihua.common.model.dtos.api.EventFile; import com.panzhihua.common.model.dtos.api.EventInfo; import com.panzhihua.common.model.vos.R; import com.panzhihua.serviceapi.model.dto.LcGridData; import java.util.List; /** * program 攀枝花智慧社区项目 * description 浪潮综治市平台网格管理API * * @author manailin * Date 2021-01-22 15:30 **/ public interface LcApiService { /** * description 获取token,并将token存入到redis,设置失效时间是12小时 * 超过12个小时,重新获取token存入到redis数据库 * * @param name 账号 * @param password 密码 * @return String token * @author manailin * @date 2021/6/10 17:00 */ String saveTokenFromRemoteRequest(String name, String password); /** * description 获取全部的事件类型信息 * * @return String token * @author manailin * @date 2021/6/10 17:00 */ String getAllEventTypeList(); /** * description 提交事件登记 * * @param eventInfo 事件信息 * @return String 上传成功或失败信息 * @author manailin * @date 2021/6/10 17:00 */ String submitEventRegister(EventInfo eventInfo); /** * description 提交事件登记关联的文件或者图片信息 * * @param eventFile 事件信息 * @return String 上传成功或失败信息 * @author manailin * @date 2021/6/10 17:00 */ R submitEventRelationFile(EventFile eventFile); /** * description 获取指定事件信息 * * @param eventId 事件ID * @return String 事件信息 * @author manailin * @date 2021/6/10 17:00 */ String getEventInfoById(String eventId); /** * description 获取指定区域网格列表 * * @param areaId 区域ID * @return String 事件信息 * @author manailin * @date 2021/6/10 17:00 */ List<LcGridData> getGridListByAreaId(String areaId); /** * description 获取所有或者根据姓名和工号查询,分页 * * @param areaId 区域ID * @return String 网格员列表 * @author manailin * @date 2021/6/10 17:00 */ String getGridMemberListByAreaIdOrName(String areaId); /** * description 提交事件登记关联的文件或者图片信息 * * @author manailin * @date 2021/6/10 17:00 */ void automationUploadEventAndFile(); } springcloud_k8s_panzhihuazhihuishequ/service_api/src/main/java/com/panzhihua/serviceapi/biz/impl/LcApiServiceImpl.java
New file @@ -0,0 +1,246 @@ package com.panzhihua.serviceapi.biz.impl; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.panzhihua.common.api.LangchaoApiConstants; import com.panzhihua.common.api.LcReturnObject; import com.panzhihua.common.constants.TokenConstant; import com.panzhihua.common.enums.LocalEventToLangChaoEventTypeEnum; import com.panzhihua.common.model.dtos.api.EventFile; import com.panzhihua.common.model.dtos.api.EventInfo; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.grid.EventDetailsVO; import com.panzhihua.common.model.vos.grid.EventGridDataDetailsVO; import com.panzhihua.common.model.vos.grid.EventResourceVO; import com.panzhihua.common.service.grid.GridService; import com.panzhihua.common.utlis.DateUtils; import com.panzhihua.serviceapi.biz.LcApiService; import com.panzhihua.serviceapi.model.dto.LcGridData; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.ValueOperations; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; /** * program 攀枝花智慧社区项目 * description 第三方浪潮市平台对接接口管理API * * @author manailin * Date 2021-01-22 15:30 **/ @Slf4j @Service public class LcApiServiceImpl implements LcApiService { @Resource private GridService gridService; @Autowired private StringRedisTemplate redisTemplate; /** * 从redis获取token * * @return String 浪潮对接的token */ private String getAuthToken() { ValueOperations<String, String> valueOperations = redisTemplate.opsForValue(); if (valueOperations.get(LangchaoApiConstants.LANG_CHAO_TOKEN) == null) { saveTokenFromRemoteRequest("18080799023", "123456"); } return valueOperations.get(LangchaoApiConstants.LANG_CHAO_TOKEN); } @Override public String saveTokenFromRemoteRequest(String name, String password) { if (redisTemplate.hasKey(LangchaoApiConstants.LANG_CHAO_TOKEN)) { //如果redis存在token,直接返回redis存储的token ValueOperations<String, String> valueOperations = redisTemplate.opsForValue(); return valueOperations.get(LangchaoApiConstants.LANG_CHAO_TOKEN); } else { //如果第一次请求浪潮的token请求,请求完成后,保存对于的token到数据库中。便于12小时内重复调用 HttpRequest request = HttpUtil.createPost(LangchaoApiConstants.GRID_GET_TOKEN_URL.replace("#username", name).replace("#password", password)); HttpResponse result = request.execute(); ValueOperations<String, String> valueOperations = redisTemplate.opsForValue(); valueOperations.set(LangchaoApiConstants.LANG_CHAO_TOKEN, result.body(), TokenConstant.EXPIRETIME, TimeUnit.MINUTES); return result.toString(); } } @Override public String getAllEventTypeList() { HttpRequest request = HttpUtil.createPost(LangchaoApiConstants.GRID_EVENT_CATEGORY_URL); request.auth(getAuthToken()); HttpResponse result = request.execute(); return result.body(); } @Override public String submitEventRegister(EventInfo eventInfo) { HttpRequest request = HttpUtil.createPost(LangchaoApiConstants.GRID_REGIST_EVENT_URL); request.auth(getAuthToken()); ObjectMapper mapper = new ObjectMapper(); try { //对象转map Map m = mapper.readValue(mapper.writeValueAsString(eventInfo), Map.class); request.form(m); } catch (JsonProcessingException e) { log.info("方法submitEventRegister发生错误:{}", e.getMessage()); } HttpResponse result = request.execute(); log.info("submit上传浪潮事件信息:{}", result.body()); return result.body(); } @Override public R submitEventRelationFile(EventFile eventFile) { HttpRequest request = HttpUtil.createPost(LangchaoApiConstants.GRID_EVENT_FILE_UPLOAD_URL); request.auth(getAuthToken()); try { HttpURLConnection httpUrl = (HttpURLConnection) new URL(eventFile.getFiles()).openConnection(); httpUrl.connect(); File file = inputStreamToFile(httpUrl.getInputStream(), eventFile.getFileName()); request.form("files", file); httpUrl.disconnect(); request.form("dataId", eventFile.getDataId()); request.form("type", eventFile.getType()); request.form("module", eventFile.getModule()); HttpResponse result = request.execute(); file.delete(); return R.ok(result.body()); } catch (Exception e) { log.info("方法submitEventRelationFile发生错误:{}", e.getMessage()); } return R.fail(); } @Override public String getEventInfoById(String eventId) { HttpRequest request = HttpUtil.createPost(LangchaoApiConstants.GRID_APP_EVENT_INFO_DETAIL_URL); request.auth(getAuthToken()); request.form("eventId", eventId); HttpResponse result = request.execute(); return result.body(); } @Override public List<LcGridData> getGridListByAreaId(String areaId) { HttpRequest request = HttpUtil.createPost(LangchaoApiConstants.GRID_GET_EVENT_INFO_AREA_ID_URL); request.auth(getAuthToken()); request.form("areaId", areaId); HttpResponse result = request.execute(); return JSONArray.parseArray(result.body(), LcGridData.class); } @Override public String getGridMemberListByAreaIdOrName(String areaId) { HttpRequest request = HttpUtil.createPost(LangchaoApiConstants.GRID_GET_GETALL_SEARCH_PAGE_URL); request.auth(getAuthToken()); request.form("areaId", areaId); HttpResponse result = request.execute(); return result.body(); } @Override public void automationUploadEventAndFile() { List<EventDetailsVO> unUploadEventList = gridService.getUnUploadEvent(); unUploadEventList.forEach(eventInfoVo -> { log.info("定时向浪潮服务器提交网格事件登记开始"); EventInfo eventInfo = new EventInfo(); String lcGrid = gridService.getLcGridIdByLocal(eventInfoVo.getGridId()); String lcGridUserId = gridService.getLcUserIdByLocalUserId(eventInfoVo.getGridMemberId().toString()); eventInfo.setGridId(lcGrid); R grid = gridService.eventGridDataDetails(eventInfoVo.getGridId()); EventGridDataDetailsVO gridData = (EventGridDataDetailsVO) grid.getData(); eventInfo.setGridName(gridData.getGridName()); eventInfo.setCaseTypeCode(LocalEventToLangChaoEventTypeEnum.getCodeByName(eventInfoVo.getEventType())); String caseTypeName = LocalEventToLangChaoEventTypeEnum.getEventNameByCode(eventInfoVo.getEventType()); eventInfo.setCaseTypeName(caseTypeName); if (eventInfoVo.getEventCategory() != 1L) { eventInfo.setHappenTime(String.valueOf(eventInfoVo.getPropagandaTime().getTime())); } else { eventInfo.setHappenTime(String.valueOf(eventInfoVo.getHappenTime().getTime())); } eventInfo.setHappenAddress(eventInfoVo.getHappenAddress()); String[] data = eventInfoVo.getHappentLatLng().split(","); eventInfo.setLongitude(data[0]); eventInfo.setLatitude(data[1]); eventInfo.setCaseDescription(eventInfoVo.getEventDes()); eventInfo.setCaseRecordTime(String.valueOf(eventInfoVo.getCreateAt().getTime())); eventInfo.setHandleType("REPORT"); eventInfo.setHandleDescription(eventInfoVo.getProcessDesc()); eventInfo.setDataId(eventInfoVo.getId().toString()); //获取系统网格员映射的浪潮网格员对于的用户ID eventInfo.setUserId(lcGridUserId); eventInfo.setHandleTime(DateUtils.getCurrentDateTimeStamp().toString()); eventInfo.setCaseName(gridData.getGridName().concat(caseTypeName)); log.info("事件请求数据:{}", JSONObject.toJSONString(eventInfo)); String remoteData = submitEventRegister(eventInfo); LcReturnObject lcReturnObject = JSONObject.parseObject(remoteData, LcReturnObject.class); log.info("提交浪潮服务器,接口返回结果为:{}", remoteData); if (lcReturnObject.getSuccess()) { log.info("定时向浪潮服务器提交网格事件登记结束"); log.info("开始上传附件信息"); List<EventResourceVO> picsList = eventInfoVo.getPics(); uploadLcApiEventFile(eventInfoVo, picsList, "png"); List<EventResourceVO> audiosList = eventInfoVo.getAudios(); uploadLcApiEventFile(eventInfoVo, audiosList, "mp3"); List<EventResourceVO> videoList = eventInfoVo.getVideos(); uploadLcApiEventFile(eventInfoVo, videoList, "mp4"); log.info("结束上传附件信息"); gridService.updateLcUploadFlag(eventInfoVo.getId()); } }); } private void uploadLcApiEventFile(EventDetailsVO eventInfoVo, List<EventResourceVO> picsList, String type) { picsList.forEach(eventResourceVO -> { EventFile eventFile = new EventFile(); eventFile.setDataId(eventInfoVo.getId().toString()); eventFile.setFiles(eventResourceVO.getUrl()); eventFile.setType(type); eventFile.setModule("event"); eventFile.setFileName(eventResourceVO.getResourceName()); submitEventRelationFile(eventFile); }); } /** * 工具方法 * inputStream 转 File */ public static File inputStreamToFile(InputStream ins, String name) throws Exception { File file = new File(System.getProperty("java.io.tmpdir") + File.separator + name); log.info(System.getProperty("java.io.tmpdir") + File.separator + name); if (file.exists()) { return file; } OutputStream os = new FileOutputStream(file); int bytesRead; int len = 8192; byte[] buffer = new byte[len]; while ((bytesRead = ins.read(buffer, 0, len)) != -1) { os.write(buffer, 0, bytesRead); } os.close(); ins.close(); return file; } } springcloud_k8s_panzhihuazhihuishequ/service_api/src/main/java/com/panzhihua/serviceapi/config/SwaggerConfig.java
New file @@ -0,0 +1,40 @@ package com.panzhihua.serviceapi.config; import io.swagger.annotations.ApiOperation; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; /** * @program: springcloud_k8s_panzhihuazhihuishequ * @description: swagger3 * @author: huang.hongfa weixin hhf9596 qq 959656820 * @create: 2020-11-19 16:08 **/ @Configuration public class SwaggerConfig { @Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) .paths(PathSelectors.any()) .build(); } private ApiInfo apiInfo() { return new ApiInfoBuilder() .title("社区后台管理接口") .description("。") .contact(new Contact("Ray。", "http://www.ruiyeclub.cn", "ruiyeclub@foxmail.com")) .version("1.0") .build(); } } springcloud_k8s_panzhihuazhihuishequ/service_api/src/main/java/com/panzhihua/serviceapi/model/dto/LcGridData.java
New file @@ -0,0 +1,29 @@ package com.panzhihua.serviceapi.model.dto; import lombok.Data; import java.util.ArrayList; import java.util.List; /** * program 攀枝花智慧社区项目 * description 浪潮接口返回的网格数据接口,网格按照区域层级展开 * * @author manailin * Date 2021-06-22 15:30 **/ @Data public class LcGridData { private String id; private String title; private String level; private String other; private String other4; private String name; private String open; private String checked; private String count; private String pid; private List<LcGridData> children = new ArrayList<>(); } springcloud_k8s_panzhihuazhihuishequ/service_api/src/main/resources/bootstrap.yml
New file @@ -0,0 +1,23 @@ spring: application: name: serviceApi cloud: config: discovery: enabled: true service-id: config # 注册中心的服务名 profile: ${ENV:dev} # 指定配置文件的环境 uri: http://${CONFIG_URL:localhost}:8193/ profiles: active: ${ENV:dev} servlet: multipart: max-file-size: 10MB max-request-size: 10MB eureka: client: service-url: defaultZone: http://${EUREKA_URL:localhost}:8192/eureka server: port: 8065 springcloud_k8s_panzhihuazhihuishequ/service_api/src/main/resources/logback-spring.xml
New file @@ -0,0 +1,51 @@ <?xml version="1.0" encoding="UTF-8"?> <configuration debug="false"> <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径--> <springProfile name="dev"> <property name="LOG_HOME" value="F:/log" /> </springProfile> <springProfile name="test"> <property name="LOG_HOME" value="/mnt/data/gocd/log" /> </springProfile> <property name="LOG_HOME" value="/mnt/data/gocd/log" /> <!-- 控制台输出 --> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> </encoder> </appender> <!-- 按照每天生成日志文件 --> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!--日志文件输出的文件名--> <FileNamePattern>${LOG_HOME}/community_backstage.log.%d{yyyy-MM-dd}.log</FileNamePattern> <!--日志文件保留天数--> <MaxHistory>30</MaxHistory> </rollingPolicy> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> </encoder> <!--日志文件最大的大小--> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <MaxFileSize>10MB</MaxFileSize> </triggeringPolicy> </appender> <!--myibatis log configure--> <logger name="com.apache.ibatis" level="TRACE"/> <logger name="java.sql.Connection" level="DEBUG"/> <logger name="java.sql.Statement" level="DEBUG"/> <logger name="java.sql.PreparedStatement" level="DEBUG"/> <logger name="com.panzhihua.community_backstage" level="DEBUG"/> <!-- 日志输出级别 --> <root level="DEBUG"> <appender-ref ref="STDOUT" /> </root> <root level="INFO"> <appender-ref ref="STDOUT" /> <appender-ref ref="FILE" /> </root> </configuration> springcloud_k8s_panzhihuazhihuishequ/service_api/src/test/java/com/panzhihua/service_api/biz/impl/LcApiServiceImplTest.java
New file @@ -0,0 +1,181 @@ package com.panzhihua.service_api.biz.impl; import cn.hutool.core.util.RandomUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.serializer.SerializerFeature; import com.panzhihua.common.enums.LocalEventToLangChaoEventTypeEnum; import com.panzhihua.common.model.dtos.api.EventFile; import com.panzhihua.common.model.dtos.api.EventInfo; import com.panzhihua.common.model.dtos.api.PartiesBody; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.grid.EventDetailsVO; import com.panzhihua.common.model.vos.grid.EventGridDataDetailsVO; import com.panzhihua.common.model.vos.grid.EventResourceVO; import com.panzhihua.common.service.api.ApiServiceFeign; import com.panzhihua.common.service.grid.GridService; import com.panzhihua.common.utlis.DateUtils; import com.panzhihua.serviceapi.ServiceApiApplication; import com.panzhihua.serviceapi.biz.LcApiService; import com.panzhihua.serviceapi.model.dto.LcGridData; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import javax.annotation.Resource; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.List; @Slf4j @SpringBootTest(classes = ServiceApiApplication.class) class LcApiServiceImplTest { @Autowired private LcApiService lcApiService; @Resource private GridService gridService; @Resource private ApiServiceFeign ApiServiceFeign; @Test void saveTokenFromRemoteRequest() { String result = lcApiService.saveTokenFromRemoteRequest("18080799023", "123456"); log.info(JSONObject.toJSONString(result)); } @Test void getAllEventTypeList() { String result = lcApiService.getAllEventTypeList(); log.info(result); } @Test void automationUploadEventAndFile() { lcApiService.automationUploadEventAndFile(); } @Test void submitEventRegister() { EventInfo eventInfo = new EventInfo(); eventInfo.setGridId("8c86b8b467194270b6b066b9c32e3b9b"); eventInfo.setGridName("金沙社区网格1"); eventInfo.setCaseTypeCode("04e0506d78884d218050a4c89a2e34c3"); eventInfo.setCaseTypeName("18080799023"); eventInfo.setHappenTime(String.valueOf(DateUtils.getCurrentDataLong())); eventInfo.setHappenAddress("四川省攀枝花市"); eventInfo.setLongitude("116.397128"); eventInfo.setLatitude("39.916527"); eventInfo.setCaseDescription("描述"); eventInfo.setCaseRecordTime(String.valueOf(DateUtils.getCurrentDataLong())); eventInfo.setHandleType("REPORT"); eventInfo.setHandleDescription("处理描述"); String dataID = String.valueOf(RandomUtil.randomLong(20)); log.info("random:" + dataID); eventInfo.setDataId(dataID); eventInfo.setUserId("3e318dbeddc048328933d8b4ca759a36"); eventInfo.setHandleTime(String.valueOf(DateUtils.getCurrentDataLong())); eventInfo.setCaseName("测试标题17"); List<PartiesBody> partiesBody = new ArrayList<>(); PartiesBody partiesBody1 = new PartiesBody(); partiesBody1.setPartyName("测试见证人"); partiesBody1.setPartyPhone("17345623565"); partiesBody.add(partiesBody1); eventInfo.setPartiesBody(partiesBody); String result = lcApiService.submitEventRegister(eventInfo); log.info(result); } @Test void submitEventRelationFile() throws URISyntaxException { EventFile eventFile = new EventFile(); eventFile.setDataId("1111116"); //eventFile.setFiles("https://www.baidu.com/img/flexible/logo/pc/result@2.png"); eventFile.setFiles("http://image.panzhihua.nhys.cdnhxx.com//idcard/4f843ad2d756456e900d5f24b419aa7c.mp4"); eventFile.setType("mp4"); eventFile.setModule("event"); eventFile.setFileName("4f843ad2d756456e900d5f24b419aa7c.mp4"); R result = lcApiService.submitEventRelationFile(eventFile); log.info(JSONObject.toJSONString(result)); } @Test void submitEventRegisterJobTest() { log.info("定时向浪潮服务器提交网格事件登记开始"); R<EventDetailsVO> event = gridService.eventDetails(4545676L); EventDetailsVO eventInfoVo = event.getData(); EventInfo eventInfo = new EventInfo(); String lcGrid = gridService.getLcGridIdByLocal(eventInfoVo.getGridId()); String lcGridUserId = gridService.getLcUserIdByLocalUserId(eventInfoVo.getGridMemberId().toString()); eventInfo.setGridId(lcGrid); R grid = gridService.eventGridDataDetails(eventInfoVo.getGridId()); EventGridDataDetailsVO gridData = (EventGridDataDetailsVO) grid.getData(); eventInfo.setGridName(gridData.getGridName()); eventInfo.setCaseTypeCode(LocalEventToLangChaoEventTypeEnum.getCodeByName(eventInfoVo.getEventType())); String caseTypeName= LocalEventToLangChaoEventTypeEnum.getEventNameByCode(eventInfoVo.getEventType()); eventInfo.setCaseTypeName(caseTypeName); eventInfo.setHappenTime(String.valueOf(eventInfoVo.getHappenTime().getTime())); eventInfo.setHappenAddress(eventInfoVo.getHappenAddress()); String[] data = eventInfoVo.getHappentLatLng().split(","); eventInfo.setLongitude(data[0]); eventInfo.setLatitude(data[1]); eventInfo.setCaseDescription(eventInfoVo.getEventDes()); eventInfo.setCaseRecordTime(String.valueOf(eventInfoVo.getCreateAt().getTime())); eventInfo.setHandleType("REPORT"); eventInfo.setHandleDescription(eventInfoVo.getProcessDesc()); eventInfo.setDataId(eventInfoVo.getId().toString()); //获取系统网格员映射的浪潮网格员对于的用户ID eventInfo.setUserId(lcGridUserId); eventInfo.setHandleTime(String.valueOf(eventInfoVo.getHappenTime().getTime())); eventInfo.setCaseName(gridData.getGridName().concat(caseTypeName).concat(eventInfoVo.getEventTitle())); lcApiService.submitEventRegister(eventInfo); log.info("定时向浪潮服务器提交网格事件登记结束"); log.info("开始上传附件图片信息"); List<EventResourceVO> picsList = eventInfoVo.getPics(); picsList.forEach(eventResourceVO -> { EventFile eventFile = new EventFile(); eventFile.setDataId(eventInfoVo.getId().toString()); eventFile.setFiles(eventResourceVO.getUrl()); eventFile.setType("png"); eventFile.setModule("event"); eventFile.setFileName(eventResourceVO.getResourceName()); lcApiService.submitEventRelationFile(eventFile); }); List<EventResourceVO> audiosList = eventInfoVo.getAudios(); audiosList.forEach(eventResourceVO -> { EventFile eventFile = new EventFile(); eventFile.setDataId(eventInfoVo.getId().toString()); eventFile.setFiles(eventResourceVO.getUrl()); eventFile.setType("mp3"); eventFile.setModule("event"); eventFile.setFileName(eventResourceVO.getResourceName()); lcApiService.submitEventRelationFile(eventFile); }); List<EventResourceVO> videoList = eventInfoVo.getVideos(); videoList.forEach(eventResourceVO -> { EventFile eventFile = new EventFile(); eventFile.setDataId(eventInfoVo.getId().toString()); eventFile.setFiles(eventResourceVO.getUrl()); eventFile.setType("mp4"); eventFile.setModule("event"); eventFile.setFileName(eventResourceVO.getResourceName()); lcApiService.submitEventRelationFile(eventFile); }); log.info("结束上传附件图片信息"); } @Test void getGridListByAreaId() { //jhRxqEQp 代表西区 List<LcGridData> list = lcApiService.getGridListByAreaId("jhRxqEQp"); String pretty = JSONArray.toJSONString(list, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteDateUseDateFormat); log.info(pretty); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommonDataApi.java
@@ -7,7 +7,6 @@ import com.panzhihua.common.model.vos.user.UserElectronicFileVO; import com.panzhihua.common.validated.AddGroup; import com.panzhihua.service_community.service.*; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; @@ -47,6 +46,7 @@ /** * 小程序用户车辆登记 * * @param comCvtBusinessDTO * @return */ @@ -57,6 +57,7 @@ /** * 小程序用户车辆列表 * * @param userId * @return */ @@ -67,6 +68,7 @@ /** * 社区后台车辆管理列表 * * @param pageComMngCarDTO * @return */ @@ -77,16 +79,18 @@ /** * 社区后台添加修改车辆 * * @param comMngCarSaveDTO * @return */ @PostMapping("/car/save") public R saveComMngCar(@Validated({AddGroup.class}) @RequestBody ComMngCarSaveDTO comMngCarSaveDTO) { public R saveComMngCar(@Validated({AddGroup.class}) @RequestBody ComMngCarSaveDTO comMngCarSaveDTO) { return comMngCarService.saveComMngCar(comMngCarSaveDTO); } /** * 社区后台删除车辆 * * @param id * @return */ @@ -94,19 +98,22 @@ public R deleteComMngCar(@RequestParam(value = "id") Long id) { return comMngCarService.deleteComMngCar(id); } /** * 社区后台导入车辆 * @param list 车辆列表 * * @param list 车辆列表 * @param communityId 社区编号 * @return */ @PostMapping("/car/import") public R listSaveMngCarExcelVO(@RequestBody List<ComMngCarExcelVO> list, @RequestParam("communityId") Long communityId){ return comMngCarService.listSaveMngCarExcelVO(list,communityId); public R listSaveMngCarExcelVO(@RequestBody List<ComMngCarExcelVO> list, @RequestParam("communityId") Long communityId) { return comMngCarService.listSaveMngCarExcelVO(list, communityId); } /** * 社区后台实有单位管理列表 * * @param pageComMngRealCompanyDTO * @return */ @@ -117,6 +124,7 @@ /** * 社区后台添加修改实有单位 * * @param comMngRealCompanyVO * @return */ @@ -127,6 +135,7 @@ /** * 社区后台删除实有单位 * * @param id * @return */ @@ -144,30 +153,34 @@ public R belongsComMngRealCompany(@RequestBody ComMngRealCompanyBelongsDTO comMngRealCompanyBelongsDTO) { return comMngRealCompanyService.belongsComMngRealCompany(comMngRealCompanyBelongsDTO); } /** * 社区后台导入实有单位 * @param list 车实有单位列表 * * @param list 车实有单位列表 * @param communityId 社区编号 * @return */ @PostMapping("/company/import") public R listSaveMngRealCompanyExcelVO(@RequestBody List<ComMngRealCompanyExcelVO> list, @RequestParam("communityId") Long communityId){ return comMngRealCompanyService.listSaveMngRealCompanyExcelVO(list,communityId); public R listSaveMngRealCompanyExcelVO(@RequestBody List<ComMngRealCompanyExcelVO> list, @RequestParam("communityId") Long communityId) { return comMngRealCompanyService.listSaveMngRealCompanyExcelVO(list, communityId); } /** * 导出实有单位 * * @param exportRealCompanyExcelDTO 实有单位导出查询参数 * @return */ @PostMapping("/company/export") public R exportRealCompanyExcel(@RequestBody ExportRealCompanyExcelDTO exportRealCompanyExcelDTO ){ public R exportRealCompanyExcel(@RequestBody ExportRealCompanyExcelDTO exportRealCompanyExcelDTO) { return comMngRealCompanyService.exportRealCompanyExcel(exportRealCompanyExcelDTO); } /** * 社区后台实有资产管理列表 * * @param pageComMngRealAssetsDTO * @return */ @@ -178,6 +191,7 @@ /** * 社区后台添加修改实有资产 * * @param comMngRealAssetsVO * @return */ @@ -188,6 +202,7 @@ /** * 社区后台删除实有资产 * * @param id * @return */ @@ -203,27 +218,30 @@ /** * 社区后台导入实有资产 * @param list 车实有资产列表 * * @param list 车实有资产列表 * @param communityId 社区编号 * @return */ @PostMapping("/assets/import") public R listSaveMngRealAssetsExcelVO(@RequestBody List<ComMngRealAssetsExcelVO> list, @RequestParam("communityId") Long communityId){ return comMngRealAssetsService.listSaveMngRealAssetsExcelVO(list,communityId); public R listSaveMngRealAssetsExcelVO(@RequestBody List<ComMngRealAssetsExcelVO> list, @RequestParam("communityId") Long communityId) { return comMngRealAssetsService.listSaveMngRealAssetsExcelVO(list, communityId); } /** * 导出实有资产 * * @param exportRealAssetsExcelDTO 实有资产导出查询参数 * @return */ @PostMapping("/assets/export") public R exportRealAssetsExcel(@RequestBody ExportRealAssetsExcelDTO exportRealAssetsExcelDTO ){ public R exportRealAssetsExcel(@RequestBody ExportRealAssetsExcelDTO exportRealAssetsExcelDTO) { return comMngRealAssetsService.exportRealAssetsExcel(exportRealAssetsExcelDTO); } /** * 查询所有省份 * * @return */ @GetMapping("/province") @@ -233,38 +251,42 @@ /** * 查询省份下所有的城市 * * @param provinceAdcode * @return */ @GetMapping("/city") public R getCityByProvinceCode(@RequestParam(value = "provinceAdcode") Integer provinceAdcode){ public R getCityByProvinceCode(@RequestParam(value = "provinceAdcode") Integer provinceAdcode) { return comMngProvinceService.getCityByProvinceCode(provinceAdcode); } /** * 查询城市下所有的区县 * * @param cityAdcode * @return */ @GetMapping("/district") R getDistrictByCityCode(@RequestParam(value = "cityAdcode") Integer cityAdcode){ R getDistrictByCityCode(@RequestParam(value = "cityAdcode") Integer cityAdcode) { return comMngProvinceService.getDistrictByCityCode(cityAdcode); } /** * 查询特定省下所有区域 tree结构 * * @param provinceAdcode * @return */ @GetMapping("/area/all") R getCityTreeByProvinceCode(@RequestParam(value = "provinceAdcode") Integer provinceAdcode){ R getCityTreeByProvinceCode(@RequestParam(value = "provinceAdcode") Integer provinceAdcode) { return comMngProvinceService.getCityTreeByProvinceCode(provinceAdcode); } /** * 社区后台实有人口管理列表 * * @param comMngPopulationVO 查询参数 * @return 实有人口分页查询结果 * @return 实有人口分页查询结果 */ @PostMapping("/population/page") public R pagePopulation(@RequestBody ComMngPopulationDTO comMngPopulationVO) { @@ -273,32 +295,35 @@ /** * 社区后台导入实有人口 * @param list 数据 * * @param list 数据 * @param communityId 社区编号 * @return */ @PostMapping("/population/import") @Transactional(rollbackFor = Exception.class) public R listSavePopulationExcelVO(@RequestBody List<ComMngPopulationServeExcelVO> list, @RequestParam(value = "communityId") Long communityId) throws Exception{ return comMngPopulationService.listSavePopulation(list,communityId); public R listSavePopulationExcelVO(@RequestBody List<ComMngPopulationServeExcelVO> list, @RequestParam(value = "communityId") Long communityId) throws Exception { return comMngPopulationService.listSavePopulation(list, communityId); } /** * 确认导入实有人口(有则更新,无则新建) * @param list 用户信息 * @param communityId 社区id * @return 导入结果 * * @param list 用户信息 * @param communityId 社区id * @return 导入结果 */ @PostMapping("/population/import/confirm") @Transactional(rollbackFor = Exception.class) public R listSavePopulationConfirm(@RequestBody List<ComMngPopulationServeExcelVO> list, @RequestParam(value = "communityId") Long communityId){ return comMngPopulationService.listSavePopulationConfirm(list,communityId); public R listSavePopulationConfirm(@RequestBody List<ComMngPopulationServeExcelVO> list, @RequestParam(value = "communityId") Long communityId) { return comMngPopulationService.listSavePopulationConfirm(list, communityId); } /** * 根据实有人口id查询详情 * * @param populationId 实有人口id * @return 实有人口详情查询结果 * @return 实有人口详情查询结果 */ @PostMapping("/population/detail") public R detailPopulation(@RequestParam(value = "populationId") Long populationId) { @@ -307,8 +332,9 @@ /** * 查询实有人口电子档信息 * @param populationId 实有人口id * @return 实有人口电子档信息 * * @param populationId 实有人口id * @return 实有人口电子档信息 */ @PostMapping("/population/electronicArchives") public R electronicArchivesPopulation(@RequestParam(value = "populationId") Long populationId) { @@ -318,8 +344,9 @@ /** * 根据实有人口id修改标签列表 * * @param populationTagDTO 请求参数 * @return 修改结果 * @return 修改结果 */ @PostMapping("/population/editTag") public R editTagPopulation(@RequestBody ComMngPopulationTagDTO populationTagDTO) { @@ -339,8 +366,9 @@ /** * 批量删除实有人口 * @param Ids 删除id集合 * @return 删除结果 * * @param Ids 删除id集合 * @return 删除结果 */ @PostMapping("/population/delete") public R deletePopulations(@RequestBody List<Long> Ids) { @@ -349,8 +377,9 @@ /** * 根据社区id查询所有实有人口 * @param communityId 社区id * @return 查询结果 * * @param communityId 社区id * @return 查询结果 */ @PostMapping("/population/getAll") public R getPopulationListByCommunityId(@RequestParam(value = "communityId") Long communityId) { @@ -359,8 +388,9 @@ /** * 根据id集合查询实有人口 * @param Ids 实有人口id集合 * @return 查询结果 * * @param Ids 实有人口id集合 * @return 查询结果 */ @PostMapping("/population/getList") public R getPopulationLists(@RequestBody List<Long> Ids) { @@ -369,18 +399,20 @@ /** * 编辑实有人口 * * @param populationEditDTO * @return */ @PostMapping("/population/edit") R editPopulation(@RequestBody ComMngPopulationEditDTO populationEditDTO,@RequestParam("communityId") Long communityId) throws Exception{ R editPopulation(@RequestBody ComMngPopulationEditDTO populationEditDTO, @RequestParam("communityId") Long communityId) throws Exception { return comMngPopulationService.editPopulation(populationEditDTO, communityId); } /** * 分页查询特殊群体 * @param pageInputUserDTO 请求参数 * @return 特殊群体列表 * * @param pageInputUserDTO 请求参数 * @return 特殊群体列表 */ @PostMapping("/special/page") public R specialInputUser(@RequestBody PageInputUserDTO pageInputUserDTO) { @@ -389,28 +421,31 @@ /** * 删除特殊群体人员 * @param id 特殊群体id * @return 删除结果 * * @param id 特殊群体id * @return 删除结果 */ @PostMapping("/special/delete") public R deleteSpecialInputUser(@RequestParam(value = "id") Long id){ public R deleteSpecialInputUser(@RequestParam(value = "id") Long id) { return comMngPopulationService.deleteSpecialInputUser(id); } /** * 编辑实有人口_电子档案 * * @param userElectronicFileVO * @return */ @PostMapping("/population/edit/electronicArchives") R editPopulation(@RequestBody UserElectronicFileVO userElectronicFileVO){ R editPopulation(@RequestBody UserElectronicFileVO userElectronicFileVO) { return comMngPopulationService.editUserElectronicFile(userElectronicFileVO); } /** * 实有人口统计 * @param communityId 社区id * @return 统计结果 * * @param communityId 社区id * @return 统计结果 */ @PostMapping("/population/statistics") public R getPopulationTotalByAdmin(@RequestParam("communityId") Long communityId) { @@ -419,28 +454,31 @@ /** * 查询房屋级联菜单 * @param cascadeHouseDTO 请求参数 * @return 菜单列表 * * @param cascadeHouseDTO 请求参数 * @return 菜单列表 */ @PostMapping("/population/cascade/list") public R getCascadeHouseAddress(@RequestBody CascadeHouseDTO cascadeHouseDTO){ public R getCascadeHouseAddress(@RequestBody CascadeHouseDTO cascadeHouseDTO) { return comMngPopulationHouseService.getCascadeHouseAddress(cascadeHouseDTO); } /** * 分页查询房屋列表 * @param populationHouseAdminDTO 请求参数 * @return 房屋列表 * * @param populationHouseAdminDTO 请求参数 * @return 房屋列表 */ @PostMapping("/population/page/house") public R getPageHouse(@RequestBody ComMngPopulationHouseAdminDTO populationHouseAdminDTO){ public R getPageHouse(@RequestBody ComMngPopulationHouseAdminDTO populationHouseAdminDTO) { return comMngPopulationHouseService.getPageHouse(populationHouseAdminDTO); } /** * 根据id查询实有房屋信息 * @param houseId 房屋id * @return 房屋信息 * * @param houseId 房屋id * @return 房屋信息 */ @PostMapping("/population/house/detail") public R getHouseDetail(@RequestParam(value = "houseId") Long houseId) { @@ -449,8 +487,9 @@ /** * 编辑实有房屋信息 * * @param houseEditAdminDTO 请求参数 * @return 编辑结果 * @return 编辑结果 */ @PostMapping("/population/house/edit") public R editHouse(@RequestBody ComMngPopulationHouseEditAdminDTO houseEditAdminDTO) { @@ -459,18 +498,20 @@ /** * 根据房屋id列表删除房屋信息 * @param Ids 请求参数 * @return 删除结果 * * @param Ids 请求参数 * @return 删除结果 */ @PostMapping("/population/house/delete") public R deleteHouses(@RequestBody List<Long> Ids){ public R deleteHouses(@RequestBody List<Long> Ids) { return comMngPopulationHouseService.deleteHouses(Ids); } /** * 实有房屋统计 * @param communityId 社区id * @return 统计结果 * * @param communityId 社区id * @return 统计结果 */ @PostMapping("/population/house/statistics") public R getHouseTotalByAdmin(@RequestParam("communityId") Long communityId) { @@ -479,8 +520,9 @@ /** * 根据社区id查询社区所有省市区 * @param communityId 社区id * @return 社区所在省市区 * * @param communityId 社区id * @return 社区所在省市区 */ @PostMapping("/village/getRegion") public R getRegion(@RequestParam("communityId") Long communityId) { @@ -489,8 +531,9 @@ /** * 统计社区内小区数量 * @param communityId 社区id * @return 统计小区数量 * * @param communityId 社区id * @return 统计小区数量 */ @PostMapping("/village/statistics") public R villageStatistics(@RequestParam("communityId") Long communityId) { springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ScreenWorkApi.java
@@ -31,10 +31,7 @@ private ComActMicroWishService comActMicroWishService; /** * * 大屏统计邻里圈 * 状态-显示(2) * 本月新增-显示(2) * @param communityId * @return */ @@ -44,10 +41,7 @@ } /** * 大屏统计心愿单, * 累计实现-已完成(6) * 等待实现-非已完成(1、2、3、4、5) * 本月新增-所有状态(1、2、3、4、5、6) * 大屏统计心愿单 * @param communityId * @return */ @@ -58,10 +52,6 @@ /** * 大屏统计社区活动 * 状态:报名中(3)、进行中(4)、已结束(5) * 本月新增:报名中(3)、进行中(4)、已结束(5) * 志愿者活动-参与者人数上限为0 * 居民活动-参与者人数上限>0 * @param communityId * @return */ @@ -72,7 +62,6 @@ /** * 大屏统计一起议 * 参与人数-点赞、评论、评论点赞 * @param communityId * @return */ @@ -83,8 +72,6 @@ /** * 大屏统计党建工作 * 党员活动:报名中(3)、进行中(4)、已结束(5) * 党员宣传(党员动态): * @param communityId * @return */ @@ -95,16 +82,6 @@ /** * 大屏统计随手拍 * 新增的-所有状态 * 已处理-3已驳回 4已完成 * 已公示-4已完成 * 未公示-3已驳回 * 未处理-1待审核 * 公示比例-已公示/(已公示+已驳回) * 平均耗时-创建时间至反馈时间(已完成状态) * 线形图-随手拍数量-累计 * 线形图-新增随手拍-时间段新增 * 线形图-处理随手拍-时间段(已驳回和已完成) * @param communityId * @return */ springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActivityDAO.java
@@ -261,19 +261,20 @@ " AND a.community_id =#{communityId}") CommunityActivitiesVO selectCommunityActivitiesVO(@Param("communityId") Long communityId, @Param("date")Date date); @Select("SELECT COUNT(id) AS currentNum," + "(SELECT COUNT(id) FROM com_act_activity WHERE community_id = #{communityId} AND (status = 3 OR status = 4 OR status = 5) AND participant_max > 0)AS commonNum," + "(SELECT COUNT(aas.id) FROM com_act_activity a INNER JOIN com_act_act_sign aas ON a.id = aas.activity_id WHERE a.participant_max > 0 AND (a.status = 3 OR a.status = 4 OR a.status = 5) AND a.community_id=#{communityId})AS commonPeopleNum," + @Select("SELECT COUNT(id) AS totalNum," + "(SELECT COUNT(id) FROM com_act_activity WHERE community_id = #{communityId} AND (status = 3 OR status = 4 OR status = 5) AND create_at LIKE CONCAT(#{nowDate},'%'))AS currentNum," + "(SELECT COUNT(id) FROM com_act_activity WHERE community_id = #{communityId} AND (status = 3 OR status = 4 OR status = 5) AND volunteer_max = 0)AS commonNum," + "(SELECT COUNT(aas.id) FROM com_act_activity a INNER JOIN com_act_act_sign aas ON a.id = aas.activity_id WHERE a.volunteer_max = 0 AND (a.status = 3 OR a.status = 4 OR a.status = 5) AND a.community_id=#{communityId})AS commonPeopleNum," + "(SELECT COUNT(id) FROM com_act_activity WHERE community_id = #{communityId} AND (status = 3 OR status = 4 OR status = 5) AND participant_max = 0)AS volunteerNum," + "(SELECT COUNT(aas.id) FROM com_act_activity a INNER JOIN com_act_act_sign aas ON a.id = aas.activity_id WHERE a.community_id=#{communityId} AND a.participant_max = 0 AND (a.status = 3 OR a.status = 4 OR a.status = 5))AS volunteerPeopleNum" + " FROM com_act_activity WHERE community_id = #{communityId} AND (status = 3 OR status = 4 OR status = 5) AND create_at LIKE CONCAT(#{nowDate},'%') ") " FROM com_act_activity where community_id=#{communityId} AND (status = 3 OR status = 4 OR status = 5)") Map<String, Long> countByCommunityId(@Param("communityId")Long communityId,@Param("nowDate")String nowDate); @Select("SELECT id,activity_name as content,IF(participant_max = 0,'志愿者活动','居民活动') AS typeName FROM com_act_activity " + @Select("SELECT id,activity_name as content,IF(volunteer_max = 0,'居民活动','志愿者活动') AS typeName FROM com_act_activity " + "WHERE community_id = #{communityId} AND (status = 3 OR status = 4 OR status = 5) ORDER BY create_at DESC LIMIT #{pageSize}") List<CarouselInfoVO> screenActivity(@Param("communityId")Long communityId, @Param("pageSize")Integer pageSize); @Select("SELECT cover FROM com_act_activity WHERE community_id = #{communityId} AND (status = 3 OR status = 4 OR status = 5)") @Select("SELECT cover FROM com_act_activity WHERE community_id = #{communityId}") List<String> listImg(@Param("communityId")Long communityId); @Select("<script> " + springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActDiscussDAO.java
@@ -193,8 +193,9 @@ "GROUP BY d.id") ComActDiscussVO selectHaveSignAndHaveVote(@Param("id") Long id, @Param("loginUserId")Long loginUserId); @Select(" SELECT COUNT(id) AS currentNum," + "(SELECT COUNT(id) FROM com_act_discuss WHERE community_id = 2 AND type = 1)AS imgNum," + @Select(" SELECT COUNT(id) AS totalNum," + "(SELECT COUNT(id) FROM com_act_discuss WHERE community_id = 2 AND create_at LIKE CONCAT('','%'))AS currentNum," + "(SELECT COUNT(id) FROM com_act_discuss WHERE community_id = 2 AND TYPE = 1)AS imgNum," + "(" + "SELECT COUNT(DISTINCT(user_id)) FROM (" + " SELECT c.user_id FROM com_act_discuss d INNER JOIN com_act_discuss_comment c ON d.id = c.discuss_id WHERE d.community_id = 2 AND d.type = 1 " + @@ -205,8 +206,7 @@ " UNION ALL " + " SELECT u.user_id FROM com_act_discuss d INNER JOIN com_act_discuss_user u ON d.id = u.discuss_id WHERE d.community_id = 2 AND d.type = 1 " + ")d " + ")AS imgPeopleNum," + "(SELECT COUNT(id) FROM com_act_discuss WHERE community_id = 2 AND type = 2)AS voteNum," + ")AS commonPeopleNum," + "(" + "SELECT COUNT(DISTINCT(user_id)) FROM (" + " SELECT c.user_id FROM com_act_discuss d INNER JOIN com_act_discuss_comment c ON d.id = c.discuss_id WHERE d.community_id = 2 AND d.type = 2 " + @@ -217,8 +217,8 @@ " UNION ALL " + " SELECT u.user_id FROM com_act_discuss d INNER JOIN com_act_discuss_user u ON d.id = u.discuss_id WHERE d.community_id = 2 AND d.type = 2 " + ")d " + ")AS votePeopleNum " + " FROM com_act_discuss WHERE community_id = 2 AND create_at LIKE CONCAT('','%')") ")AS volunteerPeopleNum " + " FROM com_act_discuss") Map<String, Long> countByCommunityId(@Param("communityId")Long communityId, @Param("date")String date); @Select(" SELECT id,discuss_subject AS content,IF(type = 1,'图文','投票') AS typeName FROM com_act_discuss WHERE community_id = #{communityId} ORDER BY create_at DESC LIMIT #{pageSize}") springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActEasyPhotoDAO.java
@@ -5,7 +5,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.panzhihua.common.model.vos.community.ComActEasyPhotoVO; import com.panzhihua.common.model.vos.community.TodoEventsVO; import com.panzhihua.common.model.vos.screen.*; import com.panzhihua.common.model.vos.screen.EastPhotoTypeVO; import com.panzhihua.common.model.vos.screen.EastPhotoVO; import com.panzhihua.common.model.vos.screen.EasyPhotoDataVO; import com.panzhihua.common.model.vos.screen.PbWorkVO; import com.panzhihua.service_community.model.dos.ComActEasyPhotoDO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -239,34 +242,34 @@ IPage<ComActEasyPhotoVO> pageEasyPhotoApplets(Page page, @Param("comActEasyPhotoVO")ComActEasyPhotoVO comActEasyPhotoVO); @Select("SELECT t.name,COUNT(p.id) as num FROM com_act_easy_photo_type t LEFT JOIN com_act_easy_photo_type_relation r ON t.id = r.easy_type_id " + "LEFT JOIN com_act_easy_photo p ON r.easy_id = p.id AND p.community_id = #{communityId} AND p.status = 1 " + "LEFT JOIN com_act_easy_photo p ON r.easy_id = p.id AND p.handle_status = 1 AND p.community_id = #{communityId} " + "GROUP BY t.name ") List<PieElementVO> countDeal(@Param("communityId")Long communityId); List<EastPhotoTypeVO> countDeal(@Param("communityId")Long communityId); @Select("SELECT t.name,COUNT(p.id) as num FROM com_act_easy_photo_type t LEFT JOIN com_act_easy_photo_type_relation r ON t.id = r.easy_type_id " + "LEFT JOIN com_act_easy_photo p ON r.easy_id = p.id AND p.community_id = #{communityId} AND p.status = 4 " + "LEFT JOIN com_act_easy_photo p ON r.easy_id = p.id AND p.is_publicity = 1 AND p.community_id = #{communityId} " + "GROUP BY t.name ") List<PieElementVO> countPub(@Param("communityId")Long communityId); List<EastPhotoTypeVO> countPub(@Param("communityId")Long communityId); @Select("SELECT t.name,COUNT(p.id) as num FROM com_act_easy_photo_type t LEFT JOIN com_act_easy_photo_type_relation r ON t.id = r.easy_type_id " + "LEFT JOIN com_act_easy_photo p ON r.easy_id = p.id and p.community_id = #{communityId} AND p.status = 3 " + "LEFT JOIN com_act_easy_photo p ON r.easy_id = p.id AND p.status = 4 where p.community_id = #{communityId} " + "GROUP BY t.name ") List<PieElementVO> countApproved(@Param("communityId")Long communityId); List<EastPhotoTypeVO> countApproved(@Param("communityId")Long communityId); @Select("SELECT COUNT(id) AS noneDeal," + "(" + "SELECT COUNT(id) FROM com_act_easy_photo WHERE community_id = 2 AND create_at LIKE concat(#{nowDate},'%') " + ") AS currentNum," + "(" + "(SELECT COUNT(id) FROM com_act_easy_photo WHERE community_id = #{communityId} AND status = 4 )*100/(SELECT COUNT(id) FROM com_act_easy_photo WHERE community_id = #{communityId} and (status = 3 or status = 4)) " + "(SELECT COUNT(id) FROM com_act_easy_photo WHERE community_id = #{communityId} AND STATUS = 4 AND handle_status = 2)*100/(SELECT COUNT(id) FROM com_act_easy_photo WHERE community_id = #{communityId} AND handle_status = 2) " + ") AS pubPoint," + "(SELECT AVG(TIMESTAMPDIFF(MINUTE,create_at,feedback_at)) FROM com_act_easy_photo WHERE community_id = #{communityId} and status = 4 ) AS dealTime " + "FROM com_act_easy_photo where community_id = #{communityId} and status = 1 ") "(SELECT AVG(TIMESTAMPDIFF(HOUR,create_at,feedback_at)) FROM com_act_easy_photo WHERE community_id = #{communityId} and handle_status = 2 ) AS dealTime " + "FROM com_act_easy_photo where community_id = #{communityId}") Map<String, Object> countByCommunityId(@Param("communityId")Long communityId,@Param("nowDate") String nowDate); @Select("SELECT COUNT(id) AS total, " + "(SELECT COUNT(id) FROM com_act_easy_photo WHERE community_id = #{communityId} AND #{start} < create_at and create_at < #{end} ) AS adds, " + "(SELECT COUNT(id) FROM com_act_easy_photo WHERE community_id =#{communityId} AND (status = 3 or status = 4) AND #{start} < create_at and create_at < #{end}) AS deal " + "FROM com_act_easy_photo WHERE community_id = #{communityId} AND create_at < #{end} ") "(SELECT COUNT(id) FROM com_act_easy_photo WHERE community_id =#{communityId} AND handle_status = 2 AND #{start} < create_at and create_at < #{end}) AS deal " + "FROM com_act_easy_photo WHERE community_id = #{communityId} AND #{start} < create_at and create_at < #{end} ") EastPhotoVO countByTime(@Param("start")String start, @Param("end")String end, @Param("nowDate")String nowDate, @Param("communityId")Long communityId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActMicroWishDAO.java
@@ -165,8 +165,8 @@ int updateStatusAutoConfirm(); @Select("SELECT COUNT(id) AS completedNum," + "(SELECT COUNT(id) FROM com_act_micro_wish WHERE community_id = #{communityId} AND (status =1 OR status =2 OR status = 3 OR status = 4 OR status = 5)) AS willNum ," + "(SELECT COUNT(id) FROM com_act_micro_wish WHERE community_id = #{communityId} AND create_at LIKE CONCAT(#{nowDate},'%')) AS currentNum " + "(SELECT COUNT(id) FROM com_act_micro_wish WHERE community_id = #{communityId} AND (status =1 OR status =2 OR status = 3 OR status = 5)) AS willNum ," + "(SELECT COUNT(id) FROM com_act_micro_wish WHERE community_id = #{communityId} AND (status =1 OR status =2 OR status = 3 OR status = 5 OR status = 6) AND create_at LIKE CONCAT(#{nowDate},'%')) AS currentNum " + "FROM com_act_micro_wish WHERE community_id = #{communityId} AND status = 6 ") Map<String, Long> countByCommunityId(@Param("communityId") Long communityId,@Param("nowDate") String nowDate); springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActNeighborCircleDAO.java
@@ -8,7 +8,6 @@ import com.panzhihua.common.model.vos.neighbor.*; import com.panzhihua.common.model.vos.screen.CarouselInfoVO; import com.panzhihua.common.model.vos.screen.ComActNeighborCircleScreenVO; import com.panzhihua.common.model.vos.screen.PieElementVO; import com.panzhihua.common.model.vos.user.AdministratorsUserVO; import com.panzhihua.service_community.model.dos.ComActNeighborCircleDO; import org.apache.ibatis.annotations.Mapper; @@ -71,7 +70,7 @@ @Select("<script> \n"+ "SELECT\n" + "nc.*,\n" + "u.`nick_name` AS releaseName,u.`type` as userType\n" + "u.`nick_name` AS releaseName,u.`type` as userType,u.image_url\n" + ",u.name as communityName\n" + "FROM\n" + "com_act_neighbor_circle nc\n" + @@ -114,49 +113,18 @@ " where reply.comment_id = #{commentId} and reply.status = 1") IPage<ComActNeighborCommentReplyAppVO> neighborCommentReplyByApp(Page page, @Param("commentId") Long commentId); @Select("SELECT id,release_content as content FROM com_act_neighbor_circle WHERE community_id =#{communityId} and status = 2 ORDER BY create_at DESC limit #{pageSize}") @Select("SELECT id,release_content as content FROM com_act_neighbor_circle WHERE community_id =#{communityId} and(status = 2 or status = 3) ORDER BY create_at DESC limit #{pageSize}") List<CarouselInfoVO> screenNeighborCircle(@Param("communityId") Long communityId, @Param("pageSize") Integer pageSize); @Select(" SELECT COUNT(id) AS totalNum," + " (SELECT COUNT(id) FROM com_act_neighbor_circle WHERE community_id = #{communityId} AND status = 2 AND create_at LIKE CONCAT(#{nowDate},'%')) AS currentNum " + " FROM com_act_neighbor_circle WHERE community_id = #{communityId} AND status = 2") " (SELECT COUNT(id) FROM com_act_neighbor_circle WHERE community_id = #{communityId} AND (status = 2 OR status = 3) AND create_at LIKE CONCAT(#{nowDate},'%')) AS currentNum " + " FROM com_act_neighbor_circle WHERE community_id = #{communityId} AND(status = 2 OR status =3)") Map<String, Long> countByCommunityId(@Param("communityId")Long communityId,@Param("nowDate")String nowDate); @Select("SELECT SUM(comment_num) as commentNum,SUM(fabulous_num) as fabulousNum,SUM(forward_num) as forwardNum FROM com_act_neighbor_circle WHERE community_id = #{communityId} and status = 2 ") @Select("SELECT SUM(comment_num) as commentNum,SUM(fabulous_num) as fabulousNum,SUM(forward_num) as forwardNum FROM com_act_neighbor_circle WHERE community_id = #{communityId} and (status = 2 OR status =3) ") Map<String, Object> sumScreenNum(@Param("communityId")Long communityId); @Select("SELECT release_images FROM com_act_neighbor_circle WHERE community_id = #{communityId} and status = 2 order by create_at desc limit #{pageSize}") @Select("SELECT release_images FROM com_act_neighbor_circle WHERE community_id = #{communityId} and (status = 2 OR status =3) order by create_at desc limit #{pageSize}") List<String> screenNeighborCircleImgs(@Param("communityId") Long communityId,@Param("pageSize") Integer pageSize); @Select("SELECT COUNT(id) as num,'随手拍' as name FROM com_act_easy_photo WHERE community_id = #{communityId} AND STATUS = 4 " + "UNION ALL " + "SELECT COUNT(id) as num,'微心愿' as name FROM com_act_micro_wish WHERE community_id = #{communityId} AND STATUS = 6 " + "UNION ALL " + "SELECT COUNT(id) as num,'一起议' as name FROM com_act_discuss WHERE community_id = #{communityId} " + "UNION ALL " + "SELECT COUNT(id) as num,'邻里圈' as name FROM com_act_neighbor_circle WHERE community_id = #{communityId} AND STATUS = 2 " + "UNION ALL " + "SELECT (SELECT COUNT(id) FROM com_pb_activity WHERE community_id = #{communityId} AND STATUS = 5)+(SELECT COUNT(id) FROM com_pb_dyn WHERE community_id = #{communityId} AND STATUS = 2) as num, '党建工作' as name FROM DUAL " + "UNION ALL " + "SELECT COUNT(id) as num,'社区活动' as name FROM com_act_activity WHERE community_id = #{communityId} AND STATUS = 5 ") List<PieElementVO> countAllCompletedWorkByCommunityId(@Param("communityId")Long communityId); @Select("SELECT COUNT(id) as num,'随手拍' as name FROM com_act_easy_photo WHERE community_id = #{communityId} AND (STATUS = 1 or STATUS = 2) " + "UNION ALL " + "SELECT COUNT(id) as num,'微心愿' as name FROM com_act_micro_wish WHERE community_id = #{communityId} AND (STATUS = 1 or STATUS = 2 or STATUS = 3 or STATUS = 4) " + "UNION ALL " + "SELECT COUNT(id) as num,'一起议' as name FROM com_act_discuss WHERE community_id = #{communityId} " + "UNION ALL " + "SELECT COUNT(id) as num,'邻里圈' as name FROM com_act_neighbor_circle WHERE community_id = #{communityId} AND STATUS = 1 " + "UNION ALL " + "SELECT (SELECT COUNT(id) FROM com_pb_activity WHERE community_id = #{communityId} AND (STATUS = 1 or STATUS = 2 or STATUS = 3 or STATUS = 4) )+(SELECT COUNT(id) FROM com_pb_dyn WHERE community_id = #{communityId} AND STATUS = 1) as num ,'党建工作' as name FROM DUAL " + "UNION ALL " + "SELECT COUNT(id),'社区活动' as name FROM com_act_activity WHERE community_id = #{communityId} AND (STATUS = 1 or STATUS = 2 or STATUS = 3 or STATUS = 4) ") List<PieElementVO> countAllNoneCompletedWorkByCommunityId(@Param("communityId")Long communityId); @Select(" SELECT AVG(b.t)AS avgTime " + " FROM (SELECT TIMESTAMPDIFF(MINUTE,create_at,feedback_at) AS t FROM com_act_easy_photo WHERE community_id = #{communityId} and STATUS = 4 " + " UNION ALL SELECT TIMESTAMPDIFF(MINUTE,create_at,finish_at) AS t FROM com_act_micro_wish WHERE community_id = #{communityId} and STATUS = 6 " + " )AS b ") Map<String, Object> countAvgByCommunityId(@Param("communityId")Long communityId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java
@@ -842,9 +842,25 @@ " e.id = #{eventId}") EventNewStatisticsVO getEventScreenEventDetail(@Param("eventId") Long eventId); @Select("select process_date,process_result from event_transfer_record where event_id = #{eventId}") @Select("select process_date,process_result,process_type,from_type,from_id,from_name,event_id from event_transfer_record where event_id = #{eventId}") List<EventTransferRecordVO> getEventScreenEventTransList(@Param("eventId") Long eventId); @Select("SELECT " + " cs.address AS streetName, " + " ca.`name` AS communityName, " + " egd.grid_name " + "FROM " + " `event` AS e " + " LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id " + " LEFT JOIN com_act AS ca ON egd.grid_community_id = ca.community_id " + " LEFT JOIN com_street AS cs ON cs.street_id = ca.street_id " + "WHERE " + " e.id = #{eventId}") EventTransferRecordDetailVO getEventScreenEventTransDetail(@Param("eventId") Long eventId); @Select("select ca.`name` AS communityName,cs.address AS streetName from com_act as ca LEFT JOIN com_street AS cs ON cs.street_id = ca.street_id where ca.community_id = #{communityId}") EventTransferRecordDetailVO getEventScreenEventTransDetailByCommunityId(@Param("communityId") Long communityId); @Select("select count(id) from com_elders_auth_elderly WHERE community_id = #{communityId}") Integer getStatisticsCount(@Param("communityId") Long communityId); springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComPbDynDAO.java
@@ -15,7 +15,7 @@ public interface ComPbDynDAO { @Select("SELECT COUNT(id) AS activityNum ," + "(SELECT COUNT(id) FROM com_pb_dyn WHERE community_id = #{communityId} AND dyn_type = 1 AND STATUS = 2) AS dynNum," + "(SELECT COUNT(id) FROM com_pb_dyn WHERE community_id = #{communityId} AND STATUS = 2) AS dynNum," + "(" + " (SELECT COUNT(id) FROM com_pb_activity WHERE community_id = #{communityId} AND (STATUS = 3 or STATUS = 4 or STATUS = 5 ) AND create_at LIKE CONCAT(#{nowDate},'%')) + " + " (SELECT COUNT(id) FROM com_pb_dyn WHERE community_id = #{communityId} AND STATUS = 2 AND create_at LIKE CONCAT(#{nowDate},'%'))" + @@ -25,7 +25,7 @@ @Select("SELECT " + "(SELECT COUNT(id) FROM com_pb_activity WHERE community_id = #{communityId} AND (STATUS = 3 or STATUS = 4 or STATUS = 5 ) AND #{start} < create_at AND create_at < #{end}) AS activity," + "(SELECT COUNT(id) FROM com_pb_dyn WHERE community_id = #{communityId} AND dyn_type = 1 AND STATUS = 2 AND #{start} < create_at AND create_at < #{end}) AS dyn " + "(SELECT COUNT(id) FROM com_pb_dyn WHERE community_id = #{communityId} AND STATUS = 2 AND #{start} < create_at AND create_at < #{end}) AS dyn " + "FROM DUAL") PbWorkVO countByTime(@Param("start")String start,@Param("end")String end, @Param("communityId")Long communityId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/DisabledPersonsDO.java
@@ -82,10 +82,12 @@ /** * 联系电话 */ @EncryptDecryptField private String phone; /** * 监护人联系电话 */ @EncryptDecryptField private String guardianPhone; /** * 地址 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/KeyPersonInfoDO.java
@@ -57,7 +57,6 @@ /** * 户口所在地 */ @EncryptDecryptField private String censusRegister; /** * 居住地址 @@ -75,7 +74,6 @@ /** * (法轮功类填写)基本情况 */ @EncryptDecryptField private String basicInfo; /** * 是否有效 @@ -84,7 +82,6 @@ /** * 备注 */ @EncryptDecryptField private String note; /** * 文化程度(取字典表国家编码)) @@ -110,12 +107,10 @@ /** * (精神类人群填写)目前诊断 */ @EncryptDecryptField private String diagnose; /** * 上报提交时间 */ @TableField(fill = FieldFill.INSERT) private Date submitDate; /** * (精神类人群填写)监护人名称 @@ -124,6 +119,7 @@ /** * (精神类人群填写)监护人电话 */ @EncryptDecryptField private String guardianPhone; /** * (精神类人群填写)监护人关系 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngPopulationService.java
@@ -77,7 +77,6 @@ * @return 导入结果 */ R listSavePopulationConfirm(List<ComMngPopulationServeExcelVO> list, Long communityId); /** * 根据实有人口id修改用户标签 * @@ -177,7 +176,7 @@ * @return 统计结果 */ R getScreenCivil(Long communityId); /** * description 根据身份证信息修改用户标签信息 * springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
@@ -1,6 +1,5 @@ package com.panzhihua.service_community.service.impl; import cn.hutool.core.util.IdcardUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -20,7 +19,6 @@ import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.area.AreaAddressVO; import com.panzhihua.common.model.vos.community.*; import com.panzhihua.common.model.vos.screen.ComActPopulationCultureVO; import com.panzhihua.common.model.vos.community.bigscreen.BigScreenStatisticPartyBuild; import com.panzhihua.common.model.vos.community.screen.civil.CivilPopulationStatisticsVO; import com.panzhihua.common.model.vos.community.screen.civil.CivilStatisticsVO; @@ -29,10 +27,14 @@ import com.panzhihua.common.model.vos.community.screen.index.*; import com.panzhihua.common.model.vos.grid.EventGridDataVO; import com.panzhihua.common.model.vos.grid.EventResourceVO; import com.panzhihua.common.model.vos.screen.ComActPopulationCultureVO; import com.panzhihua.common.model.vos.screen.ComActPopulationScreenVO; import com.panzhihua.common.model.vos.screen.ComMngPopulationAgeVO; import com.panzhihua.common.model.vos.user.*; import com.panzhihua.common.utlis.*; import com.panzhihua.common.utlis.AgeUtils; import com.panzhihua.common.utlis.DateUtils; import com.panzhihua.common.utlis.Snowflake; import com.panzhihua.common.utlis.StringUtils; import com.panzhihua.service_community.dao.*; import com.panzhihua.service_community.model.dos.*; import com.panzhihua.service_community.service.ComMngPopulationHouseUserService; @@ -45,14 +47,11 @@ import org.springframework.util.ObjectUtils; import javax.annotation.Resource; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.util.*; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** @@ -168,13 +167,13 @@ // } //查询当前用户电子档信息 if(!StringUtils.isEmpty(comMngPopulationDO.getCardNo())){ if (!StringUtils.isEmpty(comMngPopulationDO.getCardNo())) { UserElectronicFileVO electronicFileVO = populationDAO.getSysUserElectronicFile(comMngPopulationDO.getCardNo()); if(electronicFileVO != null){ if (electronicFileVO != null) { comMngPopulationVO.setUserElectronicFileVO(electronicFileVO); //查询家庭成员信息 List<ComMngFamilyInfoVO> familyInfoVOList = populationDAO.listFamilyByUserId(electronicFileVO.getUserId()); if(!familyInfoVOList.isEmpty()){ if (!familyInfoVOList.isEmpty()) { comMngPopulationVO.setFamilyInfoVOList(familyInfoVOList); } } @@ -182,8 +181,8 @@ //查询当前用户房屋信息 List<ComMngHouseVo> houseList = comMngPopulationHouseDAO.getPopulHouseListByPopulId(populationId); if(!houseList.isEmpty()){ houseList.forEach(house ->{ if (!houseList.isEmpty()) { houseList.forEach(house -> { }); comMngPopulationVO.setHouseList(houseList); @@ -191,7 +190,7 @@ //查询当前实有人口车辆信息 List<ComMngPopulationCarVO> carList = comMngCarDAO.getPopulationCarListByIdCard(comMngPopulationDO.getCardNo()); if(!carList.isEmpty()){ if (!carList.isEmpty()) { comMngPopulationVO.setCarList(carList); } return R.ok(comMngPopulationVO); @@ -209,18 +208,18 @@ Long pageNum = comMngPopulationVO.getPageNum(); Long pageSize = comMngPopulationVO.getPageSize(); if (null == pageNum || 0 == pageNum) { pageNum = 1l; pageNum = 1L; } if (null == pageSize || 0 == pageSize) { pageSize = 10l; pageSize = 10L; } page.setSize(pageSize); page.setCurrent(pageNum); if(comMngPopulationVO.getHouseId() != null){ if (comMngPopulationVO.getHouseId() != null) { ComMngPopulationHouseDO houseDO = comMngPopulationHouseDAO.selectById(comMngPopulationVO.getHouseId()); if(houseDO != null){ switch (comMngPopulationVO.getLevel()){ if (houseDO != null) { switch (comMngPopulationVO.getLevel()) { case 1: comMngPopulationVO.setRoad(houseDO.getAlley()); break; @@ -252,24 +251,24 @@ } } if(StringUtils.isNotEmpty(comMngPopulationVO.getAgeStart())){ String ageStartTime = DateUtils.getDateFormatString(DateUtils.yearAddNum(new Date(),-(Integer.parseInt(comMngPopulationVO.getAgeStart()) + 1)),"yyyy-MM-dd"); if(StringUtils.isNotEmpty(ageStartTime)){ if (StringUtils.isNotEmpty(comMngPopulationVO.getAgeStart())) { String ageStartTime = DateUtils.getDateFormatString(DateUtils.yearAddNum(new Date(), -(Integer.parseInt(comMngPopulationVO.getAgeStart()) + 1)), "yyyy-MM-dd"); if (StringUtils.isNotEmpty(ageStartTime)) { comMngPopulationVO.setAgeStartTime(ageStartTime); } } if(StringUtils.isNotEmpty(comMngPopulationVO.getAgeEnd())){ String ageEndTime = DateUtils.getDateFormatString(DateUtils.yearAddNum(new Date(),-(Integer.parseInt(comMngPopulationVO.getAgeEnd()) + 1)),"yyyy-MM-dd"); if(StringUtils.isNotEmpty(ageEndTime)){ if (StringUtils.isNotEmpty(comMngPopulationVO.getAgeEnd())) { String ageEndTime = DateUtils.getDateFormatString(DateUtils.yearAddNum(new Date(), -(Integer.parseInt(comMngPopulationVO.getAgeEnd()) + 1)), "yyyy-MM-dd"); if (StringUtils.isNotEmpty(ageEndTime)) { comMngPopulationVO.setAgeEndTime(ageEndTime); } } IPage<ComMngPopulationVO> iPage = populationDAO.pagePopulation(page, comMngPopulationVO); if(!iPage.getRecords().isEmpty()){ if (!iPage.getRecords().isEmpty()) { iPage.getRecords().forEach(populDO -> { if(StringUtils.isNotEmpty(populDO.getBirthday())){ if (StringUtils.isNotEmpty(populDO.getBirthday())) { populDO.setAge(AgeUtils.getAgeFromBirthTimes(populDO.getBirthday())); } }); @@ -313,17 +312,17 @@ @Override @Transactional(rollbackFor = Exception.class) public R listSavePopulation(List<ComMngPopulationServeExcelVO> list, Long communityId) throws Exception{ public R listSavePopulation(List<ComMngPopulationServeExcelVO> list, Long communityId) throws Exception { List<ComMngPopulationImportErrorVO> populationImportErrorVOList = new ArrayList<>(); //查询该社区 ComActDO comActDO = comActDAO.selectById(communityId); //查询该社区的省市区地址 AreaAddressVO areaAddressVO = populationDAO.getAreaAddress(comActDO.getProvinceCode(),comActDO.getCityCode(),comActDO.getAreaCode()); AreaAddressVO areaAddressVO = populationDAO.getAreaAddress(comActDO.getProvinceCode(), comActDO.getCityCode(), comActDO.getAreaCode()); //查询社区上街道信息 String streetName = ""; if(comActDO.getStreetId() != null){ if (comActDO.getStreetId() != null) { ComStreetDO streetDO = comStreetDAO.selectById(comActDO.getStreetId()); if(streetDO != null){ if (streetDO != null) { streetName = streetDO.getName(); } } @@ -333,17 +332,17 @@ for (ComMngPopulationServeExcelVO vo : list) { String address = ""; //查询街路巷是否存在 ComMngVillageDO comMngVillageDO = comActVillageDAO.selectOne(new QueryWrapper<ComMngVillageDO>().eq("alley",vo.getRoad()).eq("house_num",vo.getDoorNo()).eq("community_id",communityId)); ComMngVillageDO comMngVillageDO = comActVillageDAO.selectOne(new QueryWrapper<ComMngVillageDO>().eq("alley", vo.getRoad()).eq("house_num", vo.getDoorNo()).eq("community_id", communityId)); if (comMngVillageDO == null) { ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); importErrorVO.setErrorMsg("街路巷或小区号不存在"); importErrorVO.setErrorPosition("街路巷:" + vo.getRoad() + ",小区号:"+vo.getDoorNo()); importErrorVO.setErrorPosition("街路巷:" + vo.getRoad() + ",小区号:" + vo.getDoorNo()); populationImportErrorVOList.add(importErrorVO); // index++; continue; } if(!comMngVillageDO.getHouseNum().contains("号")){ if (!comMngVillageDO.getHouseNum().contains("号")) { comMngVillageDO.setHouseNum(comMngVillageDO.getHouseNum() + "号"); } @@ -354,38 +353,38 @@ //先判断房屋是否存在 ComMngPopulationHouseDO populationHouseDO = comMngPopulationHouseDAO.selectOne(new QueryWrapper<ComMngPopulationHouseDO>().lambda() .eq(ComMngPopulationHouseDO::getCommunityId,communityId).eq(ComMngPopulationHouseDO::getVillageId,comMngVillageDO.getVillageId()) .eq(ComMngPopulationHouseDO::getFloor,vo.getFloor()).eq(ComMngPopulationHouseDO::getUnitNo,vo.getUnitNo()) .eq(ComMngPopulationHouseDO::getHouseNo,vo.getHouseNo())); if(populationHouseDO == null){ .eq(ComMngPopulationHouseDO::getCommunityId, communityId).eq(ComMngPopulationHouseDO::getVillageId, comMngVillageDO.getVillageId()) .eq(ComMngPopulationHouseDO::getFloor, vo.getFloor()).eq(ComMngPopulationHouseDO::getUnitNo, vo.getUnitNo()) .eq(ComMngPopulationHouseDO::getHouseNo, vo.getHouseNo())); if (populationHouseDO == null) { //房屋信息不存在建立房屋信息 populationHouseDO = savePopulationHouse(vo,comMngVillageDO,communityId,address,areaPath,comActDO.getName()); populationHouseDO = savePopulationHouse(vo, comMngVillageDO, communityId, address, areaPath, comActDO.getName()); } if(StringUtils.isEmpty(vo.getName()) && StringUtils.isEmpty(vo.getCardNo())){ if (StringUtils.isEmpty(vo.getName()) && StringUtils.isEmpty(vo.getCardNo())) { //空户处理完房屋信息,直接返回 continue; } String cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey); //判断实有人口是否已存在 ComMngPopulationDO populationDO = this.baseMapper.selectOne(new QueryWrapper<ComMngPopulationDO>().lambda() .eq(ComMngPopulationDO::getCardNo,cardNoAES)); if(populationDO == null){ .eq(ComMngPopulationDO::getCardNo, cardNoAES)); if (populationDO == null) { //不存在实有人口,则新增 populationDO = savePopulationDO(vo,comActDO,comMngVillageDO,cardNoAES); }else { populationDO = savePopulationDO(vo, comActDO, comMngVillageDO, cardNoAES); } else { //如果存在人口信息,且是自用房,则更新人口默认的房屋信息 if(vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())){ populationDO = updatePopulationHouseUse(vo,populationDO,cardNoAES); if (vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) { populationDO = updatePopulationHouseUse(vo, populationDO, cardNoAES); } } //处理实有人口房屋居住信息 if(populationDO != null){ if (populationDO != null) { ComMngPopulationHouseUserDO populationHouseUserDO = comMngPopulationHouseUserDAO.selectOne(new QueryWrapper<ComMngPopulationHouseUserDO>() .lambda().eq(ComMngPopulationHouseUserDO::getHouseId,populationHouseDO.getId()) .eq(ComMngPopulationHouseUserDO::getPopulId,populationDO.getId())); if(populationHouseUserDO == null){ .lambda().eq(ComMngPopulationHouseUserDO::getHouseId, populationHouseDO.getId()) .eq(ComMngPopulationHouseUserDO::getPopulId, populationDO.getId())); if (populationHouseUserDO == null) { populationHouseUserDO = new ComMngPopulationHouseUserDO(); populationHouseUserDO.setId(Snowflake.getId()); populationHouseUserDO.setHouseId(populationHouseDO.getId()); @@ -403,13 +402,13 @@ } this.saveBatch(populationDOList);*/ if(!populationImportErrorVOList.isEmpty()){ if (!populationImportErrorVOList.isEmpty()) { return R.fail(JSON.toJSONString(populationImportErrorVOList)); } return R.ok(); } private ComMngPopulationDO updatePopulationHouseUse(ComMngPopulationServeExcelVO vo, ComMngPopulationDO populationDO,String cardNoAES) throws Exception { private ComMngPopulationDO updatePopulationHouseUse(ComMngPopulationServeExcelVO vo, ComMngPopulationDO populationDO, String cardNoAES) throws Exception { populationDO.setRoad(vo.getRoad()); populationDO.setDoorNo(vo.getDoorNo()); populationDO.setFloor(vo.getFloor()); @@ -417,16 +416,16 @@ populationDO.setHouseNo(vo.getHouseNo()); populationDO.setCardNo(cardNoAES); populationDO.setCardNoStr(vo.getCardNo()); if(StringUtils.isNotEmpty(populationDO.getPhone())){ if (StringUtils.isNotEmpty(populationDO.getPhone())) { populationDO.setPhone(AESUtil.encrypt128(populationDO.getPhone(), aesKey)); } this.baseMapper.updateById(populationDO); return populationDO; } private ComMngPopulationDO savePopulationDO(ComMngPopulationServeExcelVO vo, ComActDO comActDO, ComMngVillageDO comMngVillageDO,String cardNoAES) { private ComMngPopulationDO savePopulationDO(ComMngPopulationServeExcelVO vo, ComActDO comActDO, ComMngVillageDO comMngVillageDO, String cardNoAES) { ComMngPopulationDO populationDO = new ComMngPopulationDO(); BeanUtils.copyProperties(vo,populationDO); BeanUtils.copyProperties(vo, populationDO); populationDO.setId(Snowflake.getId()); List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList()); populationDO.setVillageId(comMngVillageDO.getVillageId()); @@ -441,7 +440,7 @@ return populationDO; } private ComMngPopulationHouseDO savePopulationHouse(ComMngPopulationServeExcelVO vo, ComMngVillageDO comMngVillageDO, Long communityId, String address, StringBuilder areaPath,String actName) { private ComMngPopulationHouseDO savePopulationHouse(ComMngPopulationServeExcelVO vo, ComMngVillageDO comMngVillageDO, Long communityId, String address, StringBuilder areaPath, String actName) { //查询该房屋未建立,执行建立房屋信息 ComMngPopulationHouseDO populationHouseDO = new ComMngPopulationHouseDO(); populationHouseDO.setId(Snowflake.getId()); @@ -460,22 +459,22 @@ populationHouseDO.setConstructPurpose(vo.getBuildPurpose()); StringBuilder housePath = new StringBuilder(); housePath.append(populationHouseDO.getAlley()).append(">").append(actName).append(">").append(comMngVillageDO.getName()).append(">").append(address); populationHouseDO.setPath(areaPath.toString()+ housePath.toString()); populationHouseDO.setPath(areaPath.toString() + housePath.toString()); try { populationHouseDO.setConstructArea(new BigDecimal(vo.getBuildArea())); }catch (Exception e){ } catch (Exception e) { } if(StringUtils.isEmpty(vo.getName()) && StringUtils.isEmpty(vo.getCardNo())){ if (StringUtils.isEmpty(vo.getName()) && StringUtils.isEmpty(vo.getCardNo())) { populationHouseDO.setIsEmpty(PopulIsOksEnum.YES.getCode()); } if(vo.getHouseStatus() != null){ if (vo.getHouseStatus() != null) { populationHouseDO.setStatus(vo.getHouseStatus()); } if(vo.getHousePurpose() != null){ if (vo.getHousePurpose() != null) { populationHouseDO.setPurpose(vo.getHousePurpose()); } if(vo.getControlStatus() != null){ if (vo.getControlStatus() != null) { populationHouseDO.setControlStatus(vo.getControlStatus()); } comMngPopulationHouseDAO.insert(populationHouseDO); @@ -484,9 +483,10 @@ /** * 确认导入实有人口(有则更新,无则新建) * @param list 用户信息 * @param communityId 社区id * @return 导入结果 * * @param list 用户信息 * @param communityId 社区id * @return 导入结果 */ @Override public R listSavePopulationConfirm(List<ComMngPopulationServeExcelVO> list, Long communityId) { @@ -501,7 +501,7 @@ list.forEach(vo -> { ComMngPopulationDO comMngPopulationDO = new ComMngPopulationDO(); //查询街路巷是否存在 ComMngVillageDO comMngVillageDO = comActVillageDAO.selectOne(new QueryWrapper<ComMngVillageDO>().eq("alley",vo.getRoad()).eq("house_num",vo.getDoorNo()).eq("community_id",communityId)); ComMngVillageDO comMngVillageDO = comActVillageDAO.selectOne(new QueryWrapper<ComMngVillageDO>().eq("alley", vo.getRoad()).eq("house_num", vo.getDoorNo()).eq("community_id", communityId)); // ComMngVillageDO comMngVillageDO = villageDOList.stream().filter(village -> village.getAlley().equals(vo.getRoad()) && village.getHouseNum().equals(Integer.valueOf(vo.getDoorNo()))).findFirst().orElse(null); BeanUtils.copyProperties(vo, comMngPopulationDO); if (comMngVillageDO == null) { @@ -516,7 +516,7 @@ populationDOList.add(comMngPopulationDO); }); if(!populationDOList.isEmpty()){ if (!populationDOList.isEmpty()) { //循环遍历待导入人员信息,如果数据库存在则更新,如果不存在则新建 populationDOList.forEach(population -> { try { @@ -526,14 +526,14 @@ //查询这个用户是否存在 ComMngPopulationDO comMngPopulationDO = this.populationDAO.selectOne(new QueryWrapper<ComMngPopulationDO>().lambda() .eq(ComMngPopulationDO::getCardNo, population.getCardNo())); if(comMngPopulationDO != null){ if (comMngPopulationDO != null) { population.setId(comMngPopulationDO.getId()); BeanUtils.copyProperties(population,comMngPopulationDO); BeanUtils.copyProperties(population, comMngPopulationDO); this.populationDAO.updateById(population); }else{ } else { this.populationDAO.insert(population); } }catch (Exception e){ } catch (Exception e) { log.error("导入实有人口失败"); } }); @@ -553,6 +553,7 @@ /** * 根据id修改实有人口标签 * * @param populationTagDTO 请求参数 * @return 修改结果 */ @@ -562,10 +563,10 @@ if (comMngPopulationDO == null) { return R.fail("未查询到人口记录"); } BeanUtils.copyProperties(populationTagDTO,comMngPopulationDO); BeanUtils.copyProperties(populationTagDTO, comMngPopulationDO); int nub = populationDAO.updateById(comMngPopulationDO); if(nub < 1){ if (nub < 1) { return R.fail(); } return R.ok(); @@ -573,13 +574,14 @@ /** * 批量删除实有人口 * * @param Ids * @return */ @Override @Transactional(rollbackFor = Exception.class) public R deletePopulations(List<Long> Ids) { if(!Ids.isEmpty()){ if (!Ids.isEmpty()) { Ids.forEach(id -> { //清除用户房屋居住信息 comMngPopulationHouseUserDAO.deletePopulationHouseByUserId(id); @@ -594,17 +596,18 @@ /** * 根据社区id查询所有实有人口 * @param communityId 社区id * @return 查询结果 * * @param communityId 社区id * @return 查询结果 */ @Override public R getPopulationListByCommunityId(Long communityId) { List<ComMngPopulationDO> list = populationDAO.selectList(new QueryWrapper<ComMngPopulationDO>().eq("act_id",communityId)); List<ComMngPopulationDO> list = populationDAO.selectList(new QueryWrapper<ComMngPopulationDO>().eq("act_id", communityId)); List<ComMngPopulationVO> resultList = new ArrayList<>(); if(list.size() > 0){ if (list.size() > 0) { list.forEach(populationDO -> { ComMngPopulationVO populationVO=new ComMngPopulationVO(); BeanUtils.copyProperties(populationDO,populationVO); ComMngPopulationVO populationVO = new ComMngPopulationVO(); BeanUtils.copyProperties(populationDO, populationVO); resultList.add(populationVO); }); } @@ -613,17 +616,18 @@ /** * 根据id集合查询实有人口 * @param Ids 实有人口id集合 * @return 查询结果 * * @param Ids 实有人口id集合 * @return 查询结果 */ @Override public R getPopulationLists(List<Long> Ids) { List<ComMngPopulationDO> list = populationDAO.selectBatchIds(Ids); List<ComMngPopulationVO> resultList = new ArrayList<>(); if(list.size() > 0){ if (list.size() > 0) { list.forEach(populationDO -> { ComMngPopulationVO populationVO = new ComMngPopulationVO(); BeanUtils.copyProperties(populationDO,populationVO); BeanUtils.copyProperties(populationDO, populationVO); resultList.add(populationVO); }); } @@ -631,23 +635,23 @@ } @Override public R editPopulation(ComMngPopulationEditDTO vo, Long communityId) throws Exception{ public R editPopulation(ComMngPopulationEditDTO vo, Long communityId) throws Exception { ComMngPopulationDO populationDO = populationDAO.selectById(vo.getId()); if(populationDO == null){ if (populationDO == null) { return R.fail(); } BeanUtils.copyProperties(vo,populationDO); if(StringUtils.isEmpty(vo.getLabel())){ BeanUtils.copyProperties(vo, populationDO); if (StringUtils.isEmpty(vo.getLabel())) { populationDO.setLabel(null); } if(StringUtils.isEmpty(vo.getRemark())){ if (StringUtils.isEmpty(vo.getRemark())) { populationDO.setRemark(null); } populationDO.setCardNo(null); populationDO.setPhone(AESUtil.encrypt128(vo.getPhone(), aesKey)); ComActDO comActDO = comActDAO.selectById(communityId); if(comActDO != null){ if (comActDO != null) { populationDO.setActId(comActDO.getCommunityId()); populationDO.setStreetId(comActDO.getStreetId()); } @@ -656,13 +660,13 @@ List<Long> houseIds = comMngPopulationHouseUserDAO.getPopulationHouseIdByUserId(vo.getId()); //清除用户房屋居住信息 comMngPopulationHouseUserDAO.deletePopulationHouseByUserId(vo.getId()); if(!houseIds.isEmpty()){ if (!houseIds.isEmpty()) { houseIds.forEach(houseId -> { //查询当前房屋下是否有人口信息,如果没有则将房屋设置为空户 List<Long> oldHouseIds = comMngPopulationHouseUserDAO.getPopulationHouseIdByhHosueId(houseId); if(oldHouseIds.isEmpty()){ if (oldHouseIds.isEmpty()) { //修改房屋信息为空户 comMngPopulationHouseDAO.updateHouseByIsEmpty(houseId,1); comMngPopulationHouseDAO.updateHouseByIsEmpty(houseId, 1); } }); } @@ -671,91 +675,93 @@ //更新用户的房屋信息 Long houseId = null; List<ComMngPopulationHouseUserDO> populationHouseUserDOList = new ArrayList<>(); if(!vo.getHouseEditDTOList().isEmpty()){ for (ComMngPopulationHouseEditDTO houseEditDto:vo.getHouseEditDTOList()) { if (!vo.getHouseEditDTOList().isEmpty()) { for (ComMngPopulationHouseEditDTO houseEditDto : vo.getHouseEditDTOList()) { ComMngPopulationHouseUserDO populationHouseUserDO = new ComMngPopulationHouseUserDO(); populationHouseUserDO.setPopulId(populationDO.getId()); populationHouseUserDO.setHouseId(houseEditDto.getId()); if(houseEditDto.getIsResidence().equals(ComMngPopulationHouseEditDTO.isResidence.yes)){ if (houseEditDto.getIsResidence().equals(ComMngPopulationHouseEditDTO.isResidence.yes)) { houseId = houseEditDto.getId();//居住地 } populationHouseUserDOList.add(populationHouseUserDO); //修改房屋信息不为空户 comMngPopulationHouseDAO.updateHouseByIsEmpty(houseEditDto.getId(),2); comMngPopulationHouseDAO.updateHouseByIsEmpty(houseEditDto.getId(), 2); } } comMngPopulationHouseUserService.saveBatch(populationHouseUserDOList); if(houseId != null){//居住地更新 if (houseId != null) {//居住地更新 ComMngPopulationHouseDO houseDO = comMngPopulationHouseDAO.selectById(houseId); if(houseDO != null){ if (houseDO != null) { populationDO.setRoad(houseDO.getAlley()); populationDO.setDoorNo(houseDO.getHouseNum()); populationDO.setFloor(houseDO.getFloor()); populationDO.setUnitNo(houseDO.getUnitNo()); populationDO.setHouseNo(houseDO.getHouseNo()); ComMngVillageDO comMngVillageDO = comActVillageDAO.selectOne(new QueryWrapper<ComMngVillageDO>().lambda() .eq(ComMngVillageDO::getAlley,houseDO.getAlley()).eq(ComMngVillageDO::getHouseNum,houseDO.getHouseNum()) .eq(ComMngVillageDO::getCommunityId,communityId)); .eq(ComMngVillageDO::getAlley, houseDO.getAlley()).eq(ComMngVillageDO::getHouseNum, houseDO.getHouseNum()) .eq(ComMngVillageDO::getCommunityId, communityId)); if (comMngVillageDO != null) { populationDO.setVillageId(comMngVillageDO.getVillageId()); if(!StringUtils.isEmpty(comMngVillageDO.getGroupAt())){ if (!StringUtils.isEmpty(comMngVillageDO.getGroupAt())) { populationDO.setVillageName(comMngVillageDO.getGroupAt()); } } } } populationDO.setUpdateAt(new Date()); if(populationDAO.updateById(populationDO) > 0){ if (populationDAO.updateById(populationDO) > 0) { return R.ok(); }else{ } else { return R.fail("修改失败"); } } @Override public R specialInputUser(PageInputUserDTO pageInputUserDTO){ public R specialInputUser(PageInputUserDTO pageInputUserDTO) { IPage<InputUserInfoVO> iPage = populationDAO.specialInputUser(new Page<>(pageInputUserDTO.getPageNum() ,pageInputUserDTO.getPageSize()), pageInputUserDTO); , pageInputUserDTO.getPageSize()), pageInputUserDTO); return R.ok(iPage); } /** * 删除特殊群体人员 * @param id 特殊群体id * @return 删除结果 * * @param id 特殊群体id * @return 删除结果 */ @Override public R deleteSpecialInputUser(Long id){ public R deleteSpecialInputUser(Long id) { //查询特殊群体人员 ComMngPopulationDO populationDO = this.baseMapper.selectById(id); if(populationDO == null){ if (populationDO == null) { return R.fail("未查询到该记录"); } populationDO.setLabel(null); if(this.baseMapper.updateById(populationDO) > 0){ if (this.baseMapper.updateById(populationDO) > 0) { return R.ok(); }else{ } else { return R.fail(); } } /** * 查询实有人口电子档信息 * @param populationId 实有人口id * @return 实有人口电子档信息 * * @param populationId 实有人口id * @return 实有人口电子档信息 */ @Override public R electronicArchivesPopulation(Long populationId){ public R electronicArchivesPopulation(Long populationId) { ComMngPopulationDO comMngPopulationDO = populationDAO.selectById(populationId); if (ObjectUtils.isEmpty(comMngPopulationDO)) { return R.fail("用户信息不存在"); } //查询当前用户电子档信息 if(!StringUtils.isEmpty(comMngPopulationDO.getCardNo())){ if (!StringUtils.isEmpty(comMngPopulationDO.getCardNo())) { UserElectronicFileVO electronicFileVO = populationDAO.getSysUserElectronicFile(comMngPopulationDO.getCardNo()); if(electronicFileVO != null){ if (electronicFileVO != null) { return R.ok(electronicFileVO); } } @@ -765,30 +771,69 @@ @Override public R editUserElectronicFile(UserElectronicFileVO userElectronicFileVO) { UserElectronicFileVO electronicFileVO = populationDAO.getSysUserById(userElectronicFileVO.getUserId()); if(electronicFileVO==null){ if (electronicFileVO == null) { return R.fail("id有误!"); } populationDAO.updateSysUserElectronicFile(userElectronicFileVO); populationDAO.updateSysUserElectronicFile(userElectronicFileVO); return R.ok(); } /** * 实有人口统计 * @param communityId 社区id * @return 统计结果 * * @param communityId 社区id * @return 统计结果 */ @Override public R getPopulationTotalByAdmin(Long communityId){ public R getPopulationTotalByAdmin(Long communityId) { return R.ok(this.baseMapper.getPopulationTotalByAdmin(communityId)); } @Override public R editTagPopulationByCardNo(ComMngPopulationTagCardNoDTO comMngPopulationTagCardNoDTO) { ComMngPopulationDO comMngPopulationDO = getPopulationByCardNo(comMngPopulationTagCardNoDTO.getCardNo()); if (comMngPopulationDO == null) { return R.fail("未查询到人口记录"); } ComMngPopulationDO comMngPopulation = new ComMngPopulationDO(); if (comMngPopulationDO.getLabel() != null) { if (!comMngPopulationDO.getLabel().contains(comMngPopulationTagCardNoDTO.getLabel())) { comMngPopulation.setLabel(comMngPopulationTagCardNoDTO.getLabel().concat(",").concat(comMngPopulationDO.getLabel())); } } else { comMngPopulation.setLabel(comMngPopulationTagCardNoDTO.getLabel()); } comMngPopulation.setCardNo(null); comMngPopulation.setId(comMngPopulationDO.getId()); int nub = populationDAO.updateById(comMngPopulation); if (nub < 1) { return R.fail(); } return R.ok(); } @Override public ComMngPopulationDO getPopulationByCardNo(String cardNo) { try { String aesCardNo = AESUtil.encrypt128(cardNo, aesKey); return baseMapper.selectOne( new QueryWrapper<ComMngPopulationDO>() .eq("card_no", aesCardNo) ); } catch (Exception e) { log.error("根据身份证查询业务-加密证件信息出错:{}", e.getCause()); } return null; } /** * 首页大屏统计接口 * @param communityId 社区id * @return 统计结果 * * @param communityId 社区id * @return 统计结果 */ @Override public R getScreenIndex(Long communityId){ public R getScreenIndex(Long communityId) { //创建统计返回参数 IndexStatisticsVO statisticsVO = new IndexStatisticsVO(); @@ -823,9 +868,9 @@ eventGridStatisticsVO.setGridEventStatisticsList(gridEventStatistics); //查询网格数据 List<EventGridDataVO> gridDataList = comMngPopulationDAO.getGridDataListByCommunityId(communityId); if(!gridDataList.isEmpty()){ if (!gridDataList.isEmpty()) { gridDataList.forEach(gridData -> { if(gridData != null){ if (gridData != null) { IndexGridStatisticsVO gridStatisticsVO = new IndexGridStatisticsVO(); gridStatisticsVO.setEventData(gridData.getGridName()); //根据网格id查询网格事件列表 @@ -850,30 +895,30 @@ IndexSpecialStatisticsVO otherSpecialVO = new IndexSpecialStatisticsVO(); otherSpecialVO.setTitle("其他"); otherSpecialVO.setSum(0); if(!userTagList.isEmpty()){ if (!userTagList.isEmpty()) { userTagList.forEach(userTag -> { if(userTag != null){ if(userTag.getSysFlag().equals(0)){ if (userTag != null) { if (userTag.getSysFlag().equals(0)) { Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName()); otherSpecialVO.setSum(otherSpecialVO.getSum() + count); }else{ if(StringUtils.isNotEmpty(userTag.getTagName())){ if(userTag.getTagName().equals("特扶家庭")){ } else { if (StringUtils.isNotEmpty(userTag.getTagName())) { if (userTag.getTagName().equals("特扶家庭")) { IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); specialStatisticsVO.setSum(22); specialStatisticsVOList.add(specialStatisticsVO); }else if(userTag.getTagName().equals("低保户")){ } else if (userTag.getTagName().equals("低保户")) { IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); specialStatisticsVO.setSum(94); specialStatisticsVOList.add(specialStatisticsVO); }else if(userTag.getTagName().equals("低收入人群")){ } else if (userTag.getTagName().equals("低收入人群")) { IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); specialStatisticsVO.setSum(2); specialStatisticsVOList.add(specialStatisticsVO); }else if(userTag.getTagName().equals("退役军人")){ } else if (userTag.getTagName().equals("退役军人")) { IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); specialStatisticsVO.setSum(264); @@ -900,8 +945,8 @@ return R.ok(statisticsVO); } private List<IndexPopulationAgeStatisticsVO> statisticsAge(Long communityId){ Map<String,Long> ageMap = populationDAO.indexCountByAge(communityId); private List<IndexPopulationAgeStatisticsVO> statisticsAge(Long communityId) { Map<String, Long> ageMap = populationDAO.indexCountByAge(communityId); List<IndexPopulationAgeStatisticsVO> agePopulationList = new ArrayList<>(); IndexPopulationAgeStatisticsVO ageStatisticsVO1 = new IndexPopulationAgeStatisticsVO(); IndexPopulationAgeStatisticsVO ageStatisticsVO2 = new IndexPopulationAgeStatisticsVO(); @@ -916,14 +961,14 @@ ageStatisticsVO5.setType(5); ageStatisticsVO6.setType(6); if(ageMap.isEmpty()){ if (ageMap.isEmpty()) { ageStatisticsVO1.setSum(0); ageStatisticsVO2.setSum(0); ageStatisticsVO3.setSum(0); ageStatisticsVO4.setSum(0); ageStatisticsVO5.setSum(0); ageStatisticsVO6.setSum(0); }else{ } else { ageStatisticsVO1.setSum(ageMap.get("age16").intValue()); ageStatisticsVO2.setSum(ageMap.get("age27").intValue()); ageStatisticsVO3.setSum(ageMap.get("age35").intValue()); @@ -943,11 +988,12 @@ /** * 事件大屏统计接口 * @param communityId 社区id * @return 统计结果 * * @param communityId 社区id * @return 统计结果 */ @Override public R getScreenEvent(Long communityId){ public R getScreenEvent(Long communityId) { //创建统计返回参数 EventStatisticsVO statisticsVO = new EventStatisticsVO(); @@ -966,7 +1012,7 @@ //查询事件播报模块数据 EventNewStatisticsVO newStatisticsVO = this.baseMapper.getEventScreenRightTop(communityId); if(newStatisticsVO != null){ if (newStatisticsVO != null) { //查询事件资源文件 List<EventResourceDO> eventResourceDOList = eventResourceService.getBaseMapper().selectList(new LambdaQueryWrapper<EventResourceDO>() @@ -1034,11 +1080,12 @@ /** * 民生大屏统计接口 * @param communityId 社区id * @return 统计结果 * * @param communityId 社区id * @return 统计结果 */ @Override public R getScreenCivil(Long communityId){ public R getScreenCivil(Long communityId) { //创建统计返回参数 CivilStatisticsVO civilStatisticsVO = new CivilStatisticsVO(); @@ -1050,30 +1097,30 @@ IndexSpecialStatisticsVO otherSpecialVO = new IndexSpecialStatisticsVO(); otherSpecialVO.setTitle("其他"); otherSpecialVO.setSum(0); if(!userTagList.isEmpty()){ if (!userTagList.isEmpty()) { userTagList.forEach(userTag -> { if(userTag != null){ if(userTag.getSysFlag().equals(0)){ if (userTag != null) { if (userTag.getSysFlag().equals(0)) { Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName()); otherSpecialVO.setSum(otherSpecialVO.getSum() + count); }else{ if(StringUtils.isNotEmpty(userTag.getTagName())){ if(userTag.getTagName().equals("特扶家庭")){ } else { if (StringUtils.isNotEmpty(userTag.getTagName())) { if (userTag.getTagName().equals("特扶家庭")) { IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); specialStatisticsVO.setSum(22); specialStatisticsVOList.add(specialStatisticsVO); }else if(userTag.getTagName().equals("低保户")){ } else if (userTag.getTagName().equals("低保户")) { IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); specialStatisticsVO.setSum(94); specialStatisticsVOList.add(specialStatisticsVO); }else if(userTag.getTagName().equals("低收入人群")){ } else if (userTag.getTagName().equals("低收入人群")) { IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); specialStatisticsVO.setSum(2); specialStatisticsVOList.add(specialStatisticsVO); }else if(userTag.getTagName().equals("退役军人")){ } else if (userTag.getTagName().equals("退役军人")) { IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); specialStatisticsVO.setSum(264); @@ -1098,8 +1145,8 @@ //计算特殊人群总数 specialStatisticsVOList.add(otherSpecialVO); Integer specialNum = 0; if(!specialStatisticsVOList.isEmpty()){ for (IndexSpecialStatisticsVO special:specialStatisticsVOList) { if (!specialStatisticsVOList.isEmpty()) { for (IndexSpecialStatisticsVO special : specialStatisticsVOList) { specialNum += special.getSum(); } } @@ -1108,12 +1155,12 @@ //计算环比上月增长率 BigDecimal rate = BigDecimal.ZERO; CivilPopulationStatisticsVO populationStatisticsVO = this.baseMapper.getCivilScreenPopulation(communityId,DateUtils.getFirstDayOfMonth()); if(populationStatisticsVO != null){ if(populationStatisticsVO.getToMonthSpecialTotal().equals(0)){ CivilPopulationStatisticsVO populationStatisticsVO = this.baseMapper.getCivilScreenPopulation(communityId, DateUtils.getFirstDayOfMonth()); if (populationStatisticsVO != null) { if (populationStatisticsVO.getToMonthSpecialTotal().equals(0)) { rate = BigDecimal.valueOf(100); }else{ rate = BigDecimal.valueOf(populationStatisticsVO.getSpecialTotal() - populationStatisticsVO.getToMonthSpecialTotal()).divide(BigDecimal.valueOf(populationStatisticsVO.getToMonthSpecialTotal()),3,BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)); } else { rate = BigDecimal.valueOf(populationStatisticsVO.getSpecialTotal() - populationStatisticsVO.getToMonthSpecialTotal()).divide(BigDecimal.valueOf(populationStatisticsVO.getToMonthSpecialTotal()), 3, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)); } } civilStatisticsVO.setRate(rate); @@ -1127,43 +1174,6 @@ civilStatisticsVO.setVillageStatisticsList(villageStatisticsList); return R.ok(civilStatisticsVO); } @Override public R editTagPopulationByCardNo(ComMngPopulationTagCardNoDTO comMngPopulationTagCardNoDTO) { ComMngPopulationDO comMngPopulationDO = getPopulationByCardNo(comMngPopulationTagCardNoDTO.getCardNo()); if (comMngPopulationDO == null) { return R.fail("未查询到人口记录"); } ComMngPopulationDO comMngPopulation = new ComMngPopulationDO(); if(comMngPopulationDO.getLabel()!=null) { if(!comMngPopulationDO.getLabel().contains(comMngPopulationTagCardNoDTO.getLabel())) { comMngPopulation.setLabel(comMngPopulationTagCardNoDTO.getLabel().concat(",").concat(comMngPopulationDO.getLabel())); } }else{ comMngPopulation.setLabel(comMngPopulationTagCardNoDTO.getLabel()); } comMngPopulation.setCardNo(null); comMngPopulation.setId(comMngPopulationDO.getId()); int nub = populationDAO.updateById(comMngPopulation); if (nub < 1) { return R.fail(); } return R.ok(); } @Override public ComMngPopulationDO getPopulationByCardNo(String cardNo) { try { String aesCardNo = AESUtil.encrypt128(cardNo, aesKey); return baseMapper.selectOne( new QueryWrapper<ComMngPopulationDO>() .eq("card_no",aesCardNo) ); } catch (Exception e) { log.error("根据身份证查询业务-加密证件信息出错"); } return null; } @Override @@ -1241,32 +1251,24 @@ comActPopulationScreenVO.setUsedCommunityNum(count == null ? 0 : count); //统计性别 Map<String,Long> sexMap = populationDAO.countBySex(communityId); Map<String, Long> sexMap = populationDAO.countBySex(communityId); comActPopulationScreenVO.setWoman(sexMap.get("woman") == null ? 0L : sexMap.get("woman")); comActPopulationScreenVO.setManNum(sexMap.get("man") == null ? 0L : sexMap.get("man")); int manPoint = (int) (((double)comActPopulationScreenVO.getManNum()/(double)comActPopulationScreenVO.getTotalNum())*100); int manPoint = (int) (((double) comActPopulationScreenVO.getManNum() / (double) comActPopulationScreenVO.getTotalNum()) * 100); comActPopulationScreenVO.setManPoint(manPoint); comActPopulationScreenVO.setWomanPoint(100 - manPoint); //统计年龄结构 setAgeGroup(comActPopulationScreenVO,communityId); setAgeGroup(comActPopulationScreenVO, communityId); //统计学历 setCultureGroup(comActPopulationScreenVO,communityId); //查询网格数据 List<EventGridStatisticsVO> gridStatisticsList = this.baseMapper.getEventScreenGridData(communityId); comActPopulationScreenVO.setGridStatisticsList(gridStatisticsList); //查询小区列表 List<CivilVillageStatisticsVO> villageStatisticsList = this.baseMapper.getCivilScreenVillageList(communityId); comActPopulationScreenVO.setVillageStatisticsList(villageStatisticsList); setCultureGroup(comActPopulationScreenVO, communityId); return R.ok(comActPopulationScreenVO); } private void setCultureGroup(ComActPopulationScreenVO comActPopulationScreenVO, Long communityId) { Map<String,Long> cultureMap = populationDAO.countByCulture(communityId); Map<String, Long> cultureMap = populationDAO.countByCulture(communityId); List<ComActPopulationCultureVO> cultureGroup = new ArrayList<>(); ComActPopulationCultureVO xx = new ComActPopulationCultureVO(); xx.setLevel(PopulCultureLevelEnum.XX.getName()); @@ -1316,8 +1318,8 @@ comActPopulationScreenVO.setCultureGroup(cultureGroup); } private void setAgeGroup(ComActPopulationScreenVO comActPopulationScreenVO,Long communityId) { Map<String,Long> ageMap = populationDAO.countByAge(communityId); private void setAgeGroup(ComActPopulationScreenVO comActPopulationScreenVO, Long communityId) { Map<String, Long> ageMap = populationDAO.countByAge(communityId); List<ComMngPopulationAgeVO> ageList = new ArrayList<>(); ComMngPopulationAgeVO ageVO16 = new ComMngPopulationAgeVO(); ageVO16.setGroup("0-16岁"); @@ -1348,25 +1350,25 @@ } @Override public R getScreenGirds(Long communityId){ public R getScreenGirds(Long communityId) { return R.ok(this.baseMapper.getEventScreenGridData(communityId)); } @Override public R getScreenEventDetail(BigScreenEventDetailDTO eventDetailDTO){ public R getScreenEventDetail(BigScreenEventDetailDTO eventDetailDTO) { EventNewStatisticsVO statisticsVO = new EventNewStatisticsVO(); if(eventDetailDTO.getType().equals(7)){//随手拍详情 if (eventDetailDTO.getType().equals(7)) {//随手拍详情 statisticsVO = this.baseMapper.getEventScreenSSPDateil(eventDetailDTO.getEventId()); if(statisticsVO != null && StringUtils.isNotEmpty(statisticsVO.getPhotoPathList())){ if (statisticsVO != null && StringUtils.isNotEmpty(statisticsVO.getPhotoPathList())) { statisticsVO.setDangerLevel("0"); statisticsVO.setMajor(false); statisticsVO.setUrgent(false); if(statisticsVO.getEventDealStatus().equals(2)){ if (statisticsVO.getEventDealStatus().equals(2)) { statisticsVO.setEventDealStatus(4); } List<EventResourceVO> picList = new ArrayList<>(); String [] pics = statisticsVO.getPhotoPathList().split(","); if(pics.length > 0){ String[] pics = statisticsVO.getPhotoPathList().split(","); if (pics.length > 0) { for (int i = 0; i < pics.length; i++) { EventResourceVO resourceVO = new EventResourceVO(); resourceVO.setType(1); @@ -1376,9 +1378,9 @@ } statisticsVO.setPics(picList); } }else{//事件详情 } else {//事件详情 statisticsVO = this.baseMapper.getEventScreenEventDetail(eventDetailDTO.getEventId()); if(statisticsVO != null){ if (statisticsVO != null) { //查询事件资源文件 List<EventResourceDO> eventResourceDOList = eventResourceService.getBaseMapper().selectList(new LambdaQueryWrapper<EventResourceDO>() @@ -1413,13 +1415,26 @@ //查询事件流转记录 List<EventTransferRecordVO> transferRecordList = this.baseMapper.getEventScreenEventTransList(eventDetailDTO.getEventId()); if(!transferRecordList.isEmpty()){ transferRecordList.forEach(transfer -> { if(transfer.getFromType().equals(EventTransferRecordVO.fromType.wgy)){ //查询上级网格信息 EventTransferRecordDetailVO transferRecordDetailVO = this.baseMapper.getEventScreenEventTransDetail(transfer.getEventId()); transfer.setSuperiorRelationship(transferRecordDetailVO.getStreetName() + "-" + transferRecordDetailVO.getCommunityName() + "-" + transferRecordDetailVO.getGridName()); }else if(transfer.getFromType().equals(EventTransferRecordVO.fromType.sq)){ //查询上级社区信息 EventTransferRecordDetailVO transferRecordDetailVO = this.baseMapper.getEventScreenEventTransDetailByCommunityId(transfer.getFromId()); transfer.setSuperiorRelationship(transferRecordDetailVO.getStreetName() + "-" + transferRecordDetailVO.getCommunityName()); } }); } statisticsVO.setTransferRecordList(transferRecordList); } } return R.ok(statisticsVO); } public static void main(String[] args) { // List<ComMngPopulationHouseUserDO> distinctClass = populationHouseUserDOList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getPopulId() + ";" + o.getHouseId() + ";" + o.getId() + ";" + o.getRelation()))), ArrayList::new)); } } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/DisabledPersonsServiceImpl.java
@@ -2,7 +2,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.panzhihua.common.model.dtos.community.ComMngPopulationTagCardNoDTO; import com.panzhihua.common.model.dtos.community.DisabledPersonsDTO; import com.panzhihua.common.model.helper.AESUtil; import com.panzhihua.common.model.vos.R; @@ -47,20 +46,22 @@ public R saveBatchDisabledPerson(List<DisabledPersonsDTO> list) { list.forEach(disabledPersonsDTO -> { DisabledPersonsDO dbKeyPerson = checkExistFromDb(disabledPersonsDTO); ComMngPopulationDO population = comMngPopulationService.getPopulationByCardNo(disabledPersonsDTO.getCardNo()); if (population != null) { disabledPersonsDTO.setUserId(population.getId()); } if (dbKeyPerson != null) { //已经存在数据,进行数据更新操作 DisabledPersonsDO disabledPersonsDO = new DisabledPersonsDO(); BeanUtils.copyProperties(disabledPersonsDTO, disabledPersonsDO); disabledPersonsDO.setId(dbKeyPerson.getId()); ComMngPopulationTagCardNoDTO comMngPopulationTagCardNoDTO = new ComMngPopulationTagCardNoDTO(); comMngPopulationTagCardNoDTO.setCardNo(dbKeyPerson.getCardNo()); ComMngPopulationDO population = comMngPopulationService.getPopulationByCardNo(disabledPersonsDTO.getCardNo()); if (population != null) { disabledPersonsDO.setUserId(population.getId()); } try { String aesCardNo = AESUtil.encrypt128(disabledPersonsDTO.getCardNo(), aesKey); String phone = AESUtil.encrypt128(disabledPersonsDTO.getPhone(), aesKey); String guardianPhone = AESUtil.encrypt128(disabledPersonsDTO.getGuardianPhone(), aesKey); disabledPersonsDO.setCardNo(aesCardNo); disabledPersonsDO.setPhone(phone); disabledPersonsDO.setGuardianPhone(guardianPhone); updateById(disabledPersonsDO); } catch (Exception e) { log.error("根据身份证查询残疾人群业务-加密证件信息出错"); @@ -84,7 +85,6 @@ .eq("card_no", aesCardNo) ); } catch (Exception e) { log.error("根据身份证查询残疾人群业务-加密证件信息出错"); } return null; springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/KeyPersonInfoServiceImpl.java
@@ -18,12 +18,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import java.io.UnsupportedEncodingException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.util.Date; import java.util.List; /** @@ -41,6 +36,7 @@ @Value("${domain.aesKey:}") private String aesKey; /** * description 批量保存重点人群人员信息 * 处理逻辑:同一个人的信息可以被多个社区重复录入 @@ -56,6 +52,10 @@ public R saveBatchKeyPerson(List<KeyPersonInfoDTO> list) { list.forEach(keyPersonInfoDTO -> { KeyPersonInfoDO dbKeyPerson = checkExistFromDb(keyPersonInfoDTO); ComMngPopulationDO population = comMngPopulationService.getPopulationByCardNo(keyPersonInfoDTO.getCardNo()); if (population != null) { keyPersonInfoDTO.setUserId(population.getId()); } if (dbKeyPerson != null) { //已经存在数据,进行数据更新操作 KeyPersonInfoDO keyPersonInfoDO = new KeyPersonInfoDO(); @@ -65,22 +65,26 @@ comMngPopulationTagCardNoDTO.setCardNo(dbKeyPerson.getCardNo()); comMngPopulationTagCardNoDTO.setLabel(calculateLabel(dbKeyPerson)); comMngPopulationService.editTagPopulationByCardNo(comMngPopulationTagCardNoDTO); ComMngPopulationDO population=comMngPopulationService.getPopulationByCardNo(keyPersonInfoDO.getCardNo()); if(population !=null){ keyPersonInfoDO.setUserId(population.getId()); try { String aesCardNo = AESUtil.encrypt128(keyPersonInfoDTO.getCardNo(), aesKey); String phone = AESUtil.encrypt128(keyPersonInfoDTO.getPhone(), aesKey); String guardianPhone = AESUtil.encrypt128(keyPersonInfoDTO.getGuardianPhone(), aesKey); keyPersonInfoDO.setCardNo(aesCardNo); keyPersonInfoDO.setPhone(phone); keyPersonInfoDO.setGuardianPhone(guardianPhone); keyPersonInfoDO.setVisiterType(Integer.parseInt(keyPersonInfoDTO.getVisiterType())); keyPersonInfoDO.setInvalid(false); keyPersonInfoDO.setSubmitDate(new Date()); updateById(keyPersonInfoDO); } catch (Exception e) { log.error("根据身份证查询残疾人群业务-加密证件信息出错"); } keyPersonInfoDO.setVisiterType(Integer.parseInt(keyPersonInfoDTO.getVisiterType())); keyPersonInfoDO.setInvalid(false); updateById(keyPersonInfoDO); } else { KeyPersonInfoDO keyPersonInfoDO = new KeyPersonInfoDO(); BeanUtils.copyProperties(keyPersonInfoDTO, keyPersonInfoDO); ComMngPopulationDO population=comMngPopulationService.getPopulationByCardNo(keyPersonInfoDO.getCardNo()); if(population !=null){ keyPersonInfoDO.setUserId(population.getId()); } keyPersonInfoDO.setVisiterType(Integer.parseInt(keyPersonInfoDTO.getVisiterType())); keyPersonInfoDO.setInvalid(false); keyPersonInfoDO.setSubmitDate(new Date()); save(keyPersonInfoDO); } }); @@ -110,7 +114,7 @@ return baseMapper.selectOne( new QueryWrapper<KeyPersonInfoDO>() .eq("act_id", keyPersonInfoDTO.getActId()) .eq("card_no",aesCardNo) .eq("card_no", aesCardNo) .eq("visiter_type", keyPersonInfoDTO.getVisiterType()) ); } catch (Exception e) { springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ScreenWorkServiceImpl.java
@@ -1,6 +1,5 @@ package com.panzhihua.service_community.service.impl; import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; import com.panzhihua.common.model.dtos.partybuilding.ComPbActivityDTO; @@ -9,14 +8,10 @@ import com.panzhihua.common.utlis.DateUtils; import com.panzhihua.common.utlis.StringUtils; import com.panzhihua.service_community.dao.*; import com.panzhihua.service_community.model.dos.ComActDO; import com.panzhihua.service_community.service.ScreenWorkService; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.math.BigDecimal; import java.math.RoundingMode; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -48,16 +43,7 @@ @Resource private ComActEasyPhotoDAO comActEasyPhotoDAO; @Resource ComActDAO comActDAO; /** * 项目开始时间,超过的不统计 */ private final String initMonth = "2020-12"; private final String moth_format_str = "yyyy-MM"; private final String moth_format_ch = "yyyy年MM月"; private final String[] monthStr = new String[]{"一","二","三","四","五","六","七","八","九","十","十一","十二"}; @@ -122,12 +108,12 @@ //统计本月新增、居民活动,志愿者活动 String date = DateUtils.getDateFormatString(new Date(),moth_format_str); Map<String,Long> countMap = actActivityDAO.countByCommunityId(communityId,date); comActActivityScreenVO.setTotalNum(countMap.get("totalNum") == null ? 0L : countMap.get("totalNum")); comActActivityScreenVO.setCurrentNum(countMap.get("currentNum") == null ? 0L : countMap.get("currentNum")); comActActivityScreenVO.setCommonNum(countMap.get("commonNum") == null ? 0L : countMap.get("commonNum")); comActActivityScreenVO.setCommonPeopleNum(countMap.get("commonPeopleNum") == null ? 0L : countMap.get("commonPeopleNum")); comActActivityScreenVO.setVolunteerNum(countMap.get("volunteerNum") == null ? 0L : countMap.get("volunteerNum")); comActActivityScreenVO.setVolunteerPeopleNum(countMap.get("volunteerPeopleNum") == null ? 0L : countMap.get("volunteerPeopleNum")); comActActivityScreenVO.setTotalNum(comActActivityScreenVO.getCommonNum()+comActActivityScreenVO.getVolunteerNum()); //最近活动 comActActivityScreenVO.setList(actActivityDAO.screenActivity(communityId,pageSize)); return R.ok(comActActivityScreenVO); @@ -140,11 +126,11 @@ String date = DateUtils.getDateFormatString(new Date(),moth_format_str); Map<String,Long> countMap = comActDiscussDAO.countByCommunityId(communityId,date); discussScreenVO.setCurrentNum(countMap.get("currentNum") == null ? 0L : countMap.get("currentNum")); discussScreenVO.setTotalNum(countMap.get("totalNum") == null ? 0L : countMap.get("totalNum")); discussScreenVO.setImgNum(countMap.get("imgNum") == null ? 0L : countMap.get("imgNum")); discussScreenVO.setImgPeopleNum(countMap.get("imgPeopleNum") == null ? 0L : countMap.get("imgPeopleNum")); discussScreenVO.setVoteNum(countMap.get("voteNum") == null ? 0L : countMap.get("voteNum")); discussScreenVO.setVoteNum(discussScreenVO.getTotalNum() - discussScreenVO.getImgNum()); discussScreenVO.setVotePeopleNum(countMap.get("votePeopleNum") == null ? 0L : countMap.get("votePeopleNum")); discussScreenVO.setTotalNum(discussScreenVO.getImgNum()+discussScreenVO.getVoteNum()); discussScreenVO.setList(comActDiscussDAO.screenDiscuss(communityId,pageSize)); return R.ok(discussScreenVO); } @@ -159,11 +145,10 @@ pbWorkScreenVO.setTotalNum(pbWorkScreenVO.getActivityNum() + pbWorkScreenVO.getDynNum()); pbWorkScreenVO.setCurrentNum(countMap.get("currentNum") == null ? 0L : countMap.get("currentNum")); //统计近半年数据 int n = 6; List<PbWorkVO> list = new ArrayList<>(); for(Map<String,String> map : listHalfYear(n)){ PbWorkVO result = comPbDynDAO.countByTime(map.get("start"),map.get("end"),communityId); result.setMonth(map.get("name")); for(PbWorkVO workVO: listHalfYear()){ PbWorkVO result = comPbDynDAO.countByTime(workVO.getStart(),workVO.getEnd(),communityId); result.setMonth(workVO.getMonth()); list.add(result); } pbWorkScreenVO.setList(list); @@ -171,30 +156,31 @@ } private List<Map<String,String>> listHalfYear(int num) { List<Map<String,String>> dateList = new ArrayList<>(); private List<PbWorkVO> listHalfYear() { List<PbWorkVO> dateList = new ArrayList<>(); Date now = new Date(); for(int i= num;i>=1;i--){ for(int i= 6;i>=1;i--){ Date date = DateUtils.getDateM(now,-i); DateTime endDay = DateUtil.endOfMonth(date); int m = DateUtil.month(endDay); if(m == 0){ m = 12; } m--; int day = DateUtil.dayOfMonth(endDay); int half = day/2; String month = DateUtil.format(date,moth_format_str); if(Objects.equals(month,initMonth)){ continue; } Map<String,String> startMap = new HashMap<>(); startMap.put("name",monthStr[m]+"月上旬"); startMap.put("start",month+ "-01 00:00:00"); startMap.put("end",month+ "-"+half+" 23:59:58"); dateList.add(startMap); Map<String,String> endMap = new HashMap<>(); endMap.put("name",monthStr[m]+"月下旬"); endMap.put("start",month+ "-"+half+" 23:59:59"); endMap.put("end",DateUtils.getDateFormatString(endDay,"yyyy-MM-dd HH:mm:ss")); dateList.add(endMap); PbWorkVO pbWorkVO = new PbWorkVO(); pbWorkVO.setMonth(monthStr[m]+"月上旬"); pbWorkVO.setStart(month+ "-01 00:00:00"); pbWorkVO.setEnd(month+ "-"+half+" 23:59:58"); dateList.add(pbWorkVO); PbWorkVO pbWorkVO2 = new PbWorkVO(); pbWorkVO2.setMonth(monthStr[m]+"月下旬"); pbWorkVO2.setStart(month+ "-"+half+" 23:59:58"); pbWorkVO2.setEnd(DateUtils.getDateFormatString(endDay,"yyyy-MM-dd HH:mm:ss")); dateList.add(pbWorkVO2); } return dateList; @@ -210,57 +196,95 @@ Map<String,Object> countMap = comActEasyPhotoDAO.countByCommunityId(communityId,date); comActEasyPhotoScreenVO.setCurrentNum(countMap.get("currentNum") == null ? 0L : Long.valueOf(countMap.get("currentNum").toString())); comActEasyPhotoScreenVO.setNoneDeal(countMap.get("noneDeal") == null ? 0L : Long.valueOf(countMap.get("noneDeal").toString())); comActEasyPhotoScreenVO.setPubPoint(countMap.get("pubPoint") == null ? 0 : Double.valueOf(countMap.get("pubPoint").toString()).intValue()); comActEasyPhotoScreenVO.setDealTime(countMap.get("dealTime") == null ? "0h" : convertTimeStr(Double.valueOf(countMap.get("dealTime").toString()).intValue())); comActEasyPhotoScreenVO.setPubPoint(countMap.get("pubPoint") == null ? 0 : Integer.valueOf(countMap.get("pubPoint").toString())); comActEasyPhotoScreenVO.setDealTime(countMap.get("dealTime") == null ? 0 : Double.valueOf(countMap.get("dealTime").toString()).intValue()); List<EastPhotoVO> list = new ArrayList<>(); //统计半年数据 int n = 6; List<Map<String,String>> timeList = listHalfYear(n); for(Map<String,String> map : timeList){ String nowDate = DateUtils.getDateFormatString(DateUtil.parseDate(map.get("start")),moth_format_str); EastPhotoVO result = comActEasyPhotoDAO.countByTime(map.get("start"),map.get("end"),nowDate,communityId); result.setMonth(map.get("name")); for(PbWorkVO workVO: listHalfYear()){ String nowDate = DateUtils.getDateFormatString(DateUtil.parseDate(workVO.getStart()),moth_format_str); EastPhotoVO result = comActEasyPhotoDAO.countByTime(workVO.getStart(),workVO.getEnd(),nowDate,communityId); result.setMonth(workVO.getMonth()); list.add(result); } comActEasyPhotoScreenVO.setList(list); comActEasyPhotoScreenVO.setListTimes(DateUtil.format(DateUtil.parse(timeList.get(0).get("start"),DatePattern.NORM_DATETIME_FORMAT),moth_format_ch)+"-"+DateUtil.format(DateUtil.parse(timeList.get(timeList.size()-1).get("start"),DatePattern.NORM_DATETIME_FORMAT),moth_format_ch)); return R.ok(comActEasyPhotoScreenVO); } private String convertTimeStr(int minute) { int hour = minute/60; int min = minute%60; StringBuilder timestr = new StringBuilder(); if(hour > 0){ timestr.append(hour).append("h"); } if(min > 0){ timestr.append(min).append("min"); } return timestr.toString(); } private List<EasyPhotoPointVO> getList(Map<String, Long> dealMap) { Set<Map.Entry<String,Long>> entrySet = dealMap.entrySet(); List<EasyPhotoPointVO> list = new ArrayList<>(); for(Map.Entry<String,Long> en:entrySet){ EasyPhotoPointVO easyPhotoPointVO = new EasyPhotoPointVO(); easyPhotoPointVO.setTypeName(en.getKey()); easyPhotoPointVO.setPoint(en.getValue().intValue()); list.add(easyPhotoPointVO); } return list; } @Override public R workCount(Long communityId) { ComActWorkScreenVO comActWorkScreenVO = new ComActWorkScreenVO(); //已完成 comActWorkScreenVO.setCompletetList(comActNeighborCircleDAO.countAllCompletedWorkByCommunityId(communityId)); comActWorkScreenVO.setAvgTime("1小时"); comActWorkScreenVO.setTotalCompletedPoint(70); comActWorkScreenVO.setEveryDayNum("0.3"); List<ActWorkCountVO> completetPoint = new ArrayList<>(); ActWorkCountVO easyPhoto = new ActWorkCountVO(); easyPhoto.setName("随手拍"); easyPhoto.setNum(10); completetPoint.add(easyPhoto); ActWorkCountVO wish = new ActWorkCountVO(); wish.setName("微心愿"); wish.setNum(23); completetPoint.add(wish); ActWorkCountVO discuss = new ActWorkCountVO(); discuss.setName("一起议"); discuss.setNum(33); completetPoint.add(discuss); ActWorkCountVO neighbor = new ActWorkCountVO(); neighbor.setName("邻里圈"); neighbor.setNum(43); completetPoint.add(neighbor); ActWorkCountVO pbWork = new ActWorkCountVO(); pbWork.setName("党建工作"); pbWork.setNum(13); completetPoint.add(pbWork); ActWorkCountVO activity = new ActWorkCountVO(); activity.setName("社区活动"); activity.setNum(63); completetPoint.add(activity); comActWorkScreenVO.setCompletetPoint(completetPoint); //未完成 comActWorkScreenVO.setNoneList(comActNeighborCircleDAO.countAllNoneCompletedWorkByCommunityId(communityId)); comActWorkScreenVO.setTotalCompleted(comActWorkScreenVO.getCompletetList().stream().mapToInt(PieElementVO::getNum).sum()); comActWorkScreenVO.setTotalNoneCompleted(comActWorkScreenVO.getNoneList().stream().mapToInt(PieElementVO::getNum).sum()); //统计平均耗时、平均每天完成个数 Map<String,Object> avgMap = comActNeighborCircleDAO.countAvgByCommunityId(communityId); comActWorkScreenVO.setAvgTime(avgMap.get("avgTime") == null?"0h":convertTimeStr(Double.valueOf(avgMap.get("avgTime").toString()).intValue())); ComActDO comActDO = comActDAO.selectById(communityId); BigDecimal days = new BigDecimal(DateUtil.betweenDay(comActDO.getCreateAt(),new Date(),false)); BigDecimal num = new BigDecimal(comActWorkScreenVO.getTotalCompleted()); BigDecimal rt = num.divide(days,1,RoundingMode.HALF_UP); comActWorkScreenVO.setEveryDayNum(rt.toString()); List<ActWorkCountVO> completetPoint2 = new ArrayList<>(); ActWorkCountVO easyPhoto2 = new ActWorkCountVO(); easyPhoto2.setName("随手拍"); easyPhoto2.setNum(10); completetPoint2.add(easyPhoto2); ActWorkCountVO wish2 = new ActWorkCountVO(); wish2.setName("微心愿"); wish2.setNum(23); completetPoint2.add(wish2); ActWorkCountVO discuss2 = new ActWorkCountVO(); discuss2.setName("一起议"); discuss2.setNum(33); completetPoint2.add(discuss2); ActWorkCountVO neighbor2 = new ActWorkCountVO(); neighbor2.setName("邻里圈"); neighbor2.setNum(43); completetPoint2.add(neighbor2); ActWorkCountVO pbWork2 = new ActWorkCountVO(); pbWork2.setName("党建工作"); pbWork2.setNum(13); completetPoint2.add(pbWork2); ActWorkCountVO activity2 = new ActWorkCountVO(); activity2.setName("社区活动"); activity2.setNum(63); completetPoint2.add(activity2); comActWorkScreenVO.setNonePoint(completetPoint2); return R.ok(comActWorkScreenVO); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/test/java/com/panzhihua/service_community/ServiceCommunityApplicationTests.java
@@ -1,13 +1,16 @@ package com.panzhihua.service_community; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @Slf4j @SpringBootTest class ServiceCommunityApplicationTests { @Test void contextLoads() { log.info("test"); } } springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/api/EventApi.java
@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; /** * @@ -29,6 +30,28 @@ private EventService eventService; /** * description 获取所有未上传到浪潮平台的事件列表 * * @return String 事件列表 * @author manailin * @date 2021/6/10 17:00 */ @GetMapping("/getUnUploadEvent") List<EventDetailsVO> getUnUploadEvent(){ return eventService.getUnUploadEvent(); } /** * description 更新上传是否成功标识 * @param id 事件主键ID * @return Boolean 上传是否成功 * @author manailin * @date 2021/6/10 17:00 */ @GetMapping("/updateLcUploadFlag") Boolean updateLcUploadFlag(Long id){ return eventService.updateLcUploadFlag(id); } /** * 分页查找事件 * @param pageEventDTO * @return 维护结果 springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/api/LcCompareCodeApi.java
New file @@ -0,0 +1,55 @@ package com.panzhihua.service_grid.api; import com.panzhihua.common.model.dtos.grid.*; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.grid.EventGridDataDetailsVO; import com.panzhihua.service_grid.service.EventGridDataService; import com.panzhihua.service_grid.service.LcCompareCodeService; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; /** * * @author cedoo email:cedoo(a)qq.com * @version 1.0 * @since 1.0 * @date 2021-05-26 * */ @Slf4j @RestController @RequestMapping("/lc_compare") public class LcCompareCodeApi { @Resource private LcCompareCodeService lcCompareCodeService; /** * description 根据本地网格ID,查询对于的浪潮市平台对应的ID * * @param id 本地网格ID * @return String 浪潮市平台对应的ID * @author manailin * @date 2021/6/10 17:00 */ @GetMapping("/{id}") String getLcGridIdByLocal(@PathVariable("id") Long id){ return lcCompareCodeService.getLcGridIdByLocal(id); } /** * description 根据本地网格ID,查询对于的浪潮市平台对应的ID * * @param localUserId 本地网格员ID * @return String 浪潮市平台对应的ID * @author manailin * @date 2021/6/10 17:00 */ @GetMapping("/getLcUserId") String getLcUserIdByLocalUserId(String localUserId){ return lcCompareCodeService.getLcUserIdByLocal(localUserId); } } springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/dao/LcCompareCodeMapper.java
New file @@ -0,0 +1,19 @@ package com.panzhihua.service_grid.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.panzhihua.service_grid.model.dos.LcCompareCodeDO; import org.apache.ibatis.annotations.Mapper; /** * program 攀枝花智慧社区项目 * description 本地网格和浪潮的对码表管理API * * @author manailin * Date 2021-01-22 15:30 **/ @Mapper public interface LcCompareCodeMapper extends BaseMapper<LcCompareCodeDO> { } springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/dao/LcCompareMemberCodeMapper.java
New file @@ -0,0 +1,19 @@ package com.panzhihua.service_grid.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.panzhihua.service_grid.model.dos.LcCompareCodeMemberDO; import org.apache.ibatis.annotations.Mapper; /** * program 攀枝花智慧社区项目 * description 本地网格和浪潮的对码表管理API * * @author manailin * Date 2021-01-22 15:30 **/ @Mapper public interface LcCompareMemberCodeMapper extends BaseMapper<LcCompareCodeMemberDO> { } springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/model/dos/EventDO.java
@@ -217,6 +217,8 @@ @TableField(fill = FieldFill.UPDATE) private Date updateAt; private Boolean upload; /** * 撤销人/社区ID 列: revoke_id */ springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/model/dos/EventResourceDO.java
@@ -64,4 +64,5 @@ */ @TableField(fill = FieldFill.INSERT) private Date createAt; private Boolean upload; } springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/model/dos/LcCompareCodeDO.java
New file @@ -0,0 +1,35 @@ package com.panzhihua.service_grid.model.dos; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.io.Serializable; import java.util.Date; /** * Description 本地网格和浪潮的对码表 * ClassName LcCompareCode * @author manailin */ @Data @TableName("lc_compare_code") public class LcCompareCodeDO implements Serializable { private static final long serialVersionUID = 1L; /**主键*/ @TableId(type = IdType.INPUT) private Long id; /**本地网格ID*/ private String localGridId; /**网格名称*/ private String gridName; /**浪潮市平台网格ID*/ private String lcGridId; /**浪潮市平台网格名称*/ private String lcGridName; /**创建时间*/ private Date createAt; /**修改时间*/ private Date updateAt; } springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/model/dos/LcCompareCodeMemberDO.java
New file @@ -0,0 +1,38 @@ package com.panzhihua.service_grid.model.dos; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.io.Serializable; import java.util.Date; /** * Description 本地网格和浪潮的对码表 * ClassName LcCompareCode * @author manailin */ @Data @TableName("lc_compare_code_member") public class LcCompareCodeMemberDO implements Serializable { private static final long serialVersionUID = 1L; /**主键*/ @TableId(type = IdType.INPUT) private Long id; /**本地网格ID*/ private String localGridMemberId; /**网格名称*/ private String gridMemberName; /**浪潮市平台网格ID*/ private String lcGridMemberId; /**浪潮市平台网格名称*/ private String lcGridMemberName; /**浪潮网格员绑定的用户ID*/ private String lcBindUserId; /**创建时间*/ private Date createAt; /**修改时间*/ private Date updateAt; } springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/EventService.java
@@ -10,6 +10,8 @@ import com.panzhihua.common.model.vos.grid.EventVO; import com.panzhihua.service_grid.model.dos.EventDO; import java.util.List; /** * 事件 service * @@ -255,4 +257,20 @@ * @return 社区人口数据列表 */ R specialPopulationList(PageEventSpecialPopulationDTO specialPopulationDTO); /** * description 获取所有未上传到浪潮平台的事件列表 * * @return String 事件列表 * @author manailin * @date 2021/6/10 17:00 */ List<EventDetailsVO> getUnUploadEvent(); /** * description 更新上传是否成功标识 * @param id 事件主键ID * @return Boolean 上传是否成功 * @author manailin * @date 2021/6/10 17:00 */ Boolean updateLcUploadFlag(Long id); } springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/LcCompareCodeService.java
New file @@ -0,0 +1,33 @@ package com.panzhihua.service_grid.service; import com.baomidou.mybatisplus.extension.service.IService; import com.panzhihua.service_grid.model.dos.LcCompareCodeDO; /** * program 攀枝花智慧社区项目 * description 本地网格和浪潮的对码表管理API * * @author manailin * Date 2021-01-22 15:30 **/ public interface LcCompareCodeService extends IService<LcCompareCodeDO> { /** * description 根据本地网格ID,查询对于的浪潮市平台对应的ID * * @param id 本地网格ID * @return String 浪潮市平台对应的ID * @author manailin * @date 2021/6/10 17:00 */ String getLcGridIdByLocal(Long id); /** * description 根据本地网格ID,查询对于的浪潮市平台对应的ID * * @param localUserId 本地网格员ID * @return String 浪潮市平台对应的ID * @author manailin * @date 2021/6/10 17:00 */ String getLcUserIdByLocal(String localUserId); } springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/EventServiceImpl.java
@@ -3,6 +3,7 @@ import cn.hutool.core.util.IdcardUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -17,6 +18,7 @@ import com.panzhihua.common.model.vos.community.screen.event.EventListVO; import com.panzhihua.common.model.vos.grid.*; import com.panzhihua.common.service.community.CommunityService; import com.panzhihua.common.utlis.ExcelSelectListUtil; import com.panzhihua.common.utlis.LngLatUtils; import com.panzhihua.common.utlis.StringUtils; import com.panzhihua.service_grid.dao.*; @@ -57,6 +59,10 @@ private EventSpecialCrowdRecordService eventSpecialCrowdRecordService; @Resource private EventSpecialCrowdRecordMapper eventSpecialCrowdRecordMapper; @Resource private EventGridDataService eventGridDataService; @Resource private EventResourceMapper eventResourceMapper; /** * 分页查找事件 @@ -2122,11 +2128,51 @@ * @return 事件列表 */ @Override public R getScreenEventList(ScreenEventListDTO eventListDTO){ if( eventListDTO.getEventType() != null && eventListDTO.getEventType().equals(ScreenEventListDTO.eventType.xc)){ eventListDTO.setEventCategory(2); public R getScreenEventList(ScreenEventListDTO eventListDTO) { if (eventListDTO.getEventTypes() != null && !eventListDTO.getEventTypes().isEmpty()) { eventListDTO.getEventTypes().forEach(eventType -> { if(eventType.equals(ScreenEventListDTO.eventType.xc)){ eventListDTO.setEventCategory(null); } }); } IPage<EventListVO> eventPageList = this.baseMapper.getScreenEventList(new Page(eventListDTO.getPageNum(),eventListDTO.getPageSize()),eventListDTO); IPage<EventListVO> eventPageList = this.baseMapper.getScreenEventList(new Page(eventListDTO.getPageNum(), eventListDTO.getPageSize()), eventListDTO); if(!eventPageList.getRecords().isEmpty()){ eventPageList.getRecords().forEach(event -> { //查询事件关联附件 List<EventResourceDO> eventResourceDOList = eventResourceService.getBaseMapper().selectList(new LambdaQueryWrapper<EventResourceDO>() .eq(EventResourceDO::getClassification, 1) .eq(EventResourceDO::getRefId, event.getId()) ); List<EventResourceVO> picList = new ArrayList<>(); List<EventResourceVO> audioList = new ArrayList<>(); List<EventResourceVO> videoList = new ArrayList<>(); eventResourceDOList.forEach(eventResourceDO -> { switch (eventResourceDO.getType()) { case 1: EventResourceVO picEventResourceVO = new EventResourceVO(); BeanUtils.copyProperties(eventResourceDO, picEventResourceVO); picList.add(picEventResourceVO); break; case 2: EventResourceVO audioResourceVO = new EventResourceVO(); BeanUtils.copyProperties(eventResourceDO, audioResourceVO); audioList.add(audioResourceVO); break; case 3: EventResourceVO videoResourceVO = new EventResourceVO(); BeanUtils.copyProperties(eventResourceDO, videoResourceVO); videoList.add(videoResourceVO); break; } }); event.setAudios(audioList); event.setPics(picList); event.setVideos(videoList); }); } return R.ok(eventPageList); } @@ -2139,5 +2185,33 @@ public R specialPopulationList(PageEventSpecialPopulationDTO specialPopulationDTO){ IPage<EventSpecialPopulationVO> specialPopulationVOIPage = this.baseMapper.specialPopulationList(new Page(specialPopulationDTO.getPageNum(),specialPopulationDTO.getPageSize()),specialPopulationDTO); return R.ok(specialPopulationVOIPage); @Override public List<EventDetailsVO> getUnUploadEvent() { List<EventDetailsVO> eventDetailsVOList =new ArrayList<>(); List<EventDO> unEventList = baseMapper.selectList( new QueryWrapper<EventDO>() .eq("upload", false) ); unEventList.forEach(eventDO -> { eventDetailsVOList.add(eventDetails(eventDO.getId()).getData()); }); return eventDetailsVOList; } @Override @Transactional(rollbackFor = Exception.class) public Boolean updateLcUploadFlag(Long id) { EventDO event = baseMapper.selectById(id); event.setUpload(true); baseMapper.updateById(event); EventResourceDO eventResourceDO =new EventResourceDO(); eventResourceDO.setUpload(true); int flag = eventResourceMapper.update(eventResourceDO, new QueryWrapper<EventResourceDO>() .eq("ref_id", id)); if(flag>0){ return true; } return false; } } springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/LcCompareCodeServiceImpl.java
New file @@ -0,0 +1,55 @@ package com.panzhihua.service_grid.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.panzhihua.common.model.helper.AESUtil; import com.panzhihua.service_grid.dao.LcCompareCodeMapper; import com.panzhihua.service_grid.dao.LcCompareMemberCodeMapper; import com.panzhihua.service_grid.model.dos.LcCompareCodeDO; import com.panzhihua.service_grid.model.dos.LcCompareCodeMemberDO; import com.panzhihua.service_grid.service.LcCompareCodeService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import javax.annotation.Resource; /** * program 攀枝花智慧社区项目 * description 本地网格和浪潮的对码表管理API * * @author manailin * Date 2021-01-22 15:30 **/ @Slf4j @Service public class LcCompareCodeServiceImpl extends ServiceImpl<LcCompareCodeMapper, LcCompareCodeDO> implements LcCompareCodeService { @Resource private LcCompareMemberCodeMapper compareMemberCodeMapper; @Override public String getLcGridIdByLocal(Long id) { try { return baseMapper.selectOne( new QueryWrapper<LcCompareCodeDO>() .eq("local_grid_id", id) ).getLcGridId(); } catch (Exception e) { log.error("根据本地GRID查询浪潮网格对应表数据出错"); } return null; } @Override public String getLcUserIdByLocal(String localUserId) { try { return compareMemberCodeMapper.selectOne( new QueryWrapper<LcCompareCodeMemberDO>() .eq("local_grid_member_id", localUserId) ).getLcBindUserId(); } catch (Exception e) { log.error("根据本地GRID查询浪潮网格对应表数据出错"); } return null; } } springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/resources/mapper/EventMapper.xml
@@ -921,16 +921,22 @@ and e.create_at <![CDATA[<=]]> #{eventListDTO.endTime} </if> <if test='eventListDTO.gridId != null'> and e.grid_id = #{eventListDTO.gridId} <if test='eventListDTO.gridIds != null and eventListDTO.gridIds.size > 0'> and e.grid_id in <foreach collection='eventListDTO.gridIds' item='id' index='index' open='(' close=')' separator=',' > #{id} </foreach> </if> <if test='eventListDTO.eventCategory != null'> and e.event_category = #{eventListDTO.eventCategory} </if> <if test='eventListDTO.eventType != null'> and e.event_type = #{eventListDTO.eventType} <if test='eventListDTO.eventTypes != null and eventListDTO.eventTypes.size > 0'> and e.event_type in <foreach collection='eventListDTO.eventTypes' item='id' index='index' open='(' close=')' separator=',' > #{id} </foreach> </if> <if test='eventListDTO.eventDealStatus != null'> springcloud_k8s_panzhihuazhihuishequ/service_grid/src/test/java/com/panzhihua/service_grid/service/impl/EventServiceImplTest.java
New file @@ -0,0 +1,37 @@ package com.panzhihua.service_grid.service.impl; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.serializer.SerializerFeature; import com.panzhihua.common.model.vos.grid.EventDetailsVO; import com.panzhihua.service_grid.ServiceGridApplication; import com.panzhihua.service_grid.service.EventService; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import javax.annotation.Resource; import java.util.List; import static org.junit.jupiter.api.Assertions.*; @Slf4j @SpringBootTest(classes = ServiceGridApplication.class) class EventServiceImplTest { @Resource private EventService eventService; @Test void getUnUploadEvent() { List<EventDetailsVO> eventList = eventService.getUnUploadEvent(); String pretty = JSONArray.toJSONString(eventList, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteDateUseDateFormat); log.info(pretty); } @Test void updateLcUploadFlag() { Boolean uploadFlag = eventService.updateLcUploadFlag(1111115L); log.info(uploadFlag.toString()); } } springcloud_k8s_panzhihuazhihuishequ/service_grid/src/test/java/com/panzhihua/service_grid/service/impl/LcCompareCodeServiceImplTest.java
New file @@ -0,0 +1,28 @@ package com.panzhihua.service_grid.service.impl; import com.panzhihua.service_grid.ServiceGridApplication; import com.panzhihua.service_grid.service.LcCompareCodeService; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @Slf4j @SpringBootTest(classes = ServiceGridApplication.class) class LcCompareCodeServiceImplTest { @Autowired private LcCompareCodeService lcCompareCodeService; @Test void getLcGridIdByLocal() { } @Test void getLcUserIdByLocal() { String lcUserId = lcCompareCodeService.getLcUserIdByLocal("2614"); log.info(lcUserId); } } springcloud_k8s_panzhihuazhihuishequ/timejob/src/main/java/com/panzhihua/timejob/jobhandler/LangChaoEventUploadJobHandler.java
New file @@ -0,0 +1,54 @@ package com.panzhihua.timejob.jobhandler; import com.panzhihua.common.service.api.ApiServiceFeign; import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.handler.annotation.XxlJob; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import javax.annotation.Resource; /** * program 攀枝花智慧社区项目 * description 定时上报事件信息 * * @author manailin * Date 2021-06-17 15:30 **/ @Slf4j @Component public class LangChaoEventUploadJobHandler { @Resource private ApiServiceFeign ApiServiceFeign; /** * description 生成或更新redis里面的对接浪潮所需的token信息,token有效期12小时 * * @author manailin * @date 2021/6/10 17:00 */ @XxlJob("langChaoGetToken") public ReturnT<String> langChaoGetToken(String param) { log.info("定时更新浪潮对接token。token有效期12小时"); ApiServiceFeign.getToken("18080799023", "123456"); log.info("定时更新浪潮对接token完成"); return ReturnT.SUCCESS; } /** * description 向浪潮服务器提交网格事件登记包括基础信息和文件(图片、mp3、mp4)信息 * * @author manailin * @date 2021/6/10 17:00 */ @XxlJob("langChaoAutomationUpload") public ReturnT<String> langChaoAutomationUpload(String param) { log.info("向浪潮服务器提交网格事件登记开始"); ApiServiceFeign.automationUploadEventAndFile(); log.info("向浪潮服务器提交网格事件登记完成"); return ReturnT.SUCCESS; } }