New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * title: ComActActEvaluateDO 社区活动评价表 |
| | | * projectName 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * description: 记录和展示社区活动评价内容 |
| | | * |
| | | * @author txb |
| | | * @date 2021/8/24 10:21 |
| | | */ |
| | | |
| | | @Data |
| | | @ApiModel("社区活动评价表") |
| | | public class ComActActEvaluateExcelVO { |
| | | |
| | | @ExcelProperty(value = "姓名", index = 1) |
| | | private String name; |
| | | |
| | | @ExcelProperty(value = "身份", index = 2) |
| | | private String identity; |
| | | |
| | | @ExcelProperty(value = "电话", index = 3) |
| | | private String phone; |
| | | |
| | | @ExcelProperty(value = "评价时间", index = 0) |
| | | private Date createAt; |
| | | |
| | | @ExcelProperty(value = "评价星级", index = 4) |
| | | private Integer starLevel; |
| | | |
| | | @ExcelProperty(value = "评价详情", index = 5) |
| | | private String evaluateContent; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * title: ComActActEvaluateDO 社区活动评价表 |
| | | * projectName 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * description: 记录和展示社区活动评价内容 |
| | | * |
| | | * @author txb |
| | | * @date 2021/8/24 10:21 |
| | | */ |
| | | |
| | | @Data |
| | | @ApiModel("社区活动评价表") |
| | | public class ComActActEvaluateVO{ |
| | | |
| | | @ApiModelProperty("自增id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("所属活动id") |
| | | private Long activityId; |
| | | |
| | | @ApiModelProperty("用户id, 和用户信息表的相关id关联") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty("名字") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("用户昵称") |
| | | private String nickName; |
| | | |
| | | @ApiModelProperty("身份") |
| | | private String identity; |
| | | |
| | | @ApiModelProperty("手机号") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty("人员头像") |
| | | private String imageUrl; |
| | | |
| | | @ApiModelProperty(value = "列表人员类型 1 普通居民 2 志愿者", hidden = true) |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty("评价时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createAt; |
| | | |
| | | @ApiModelProperty("是否是志愿者 0 否 1 是") |
| | | private Integer isVolunteer; |
| | | |
| | | @ApiModelProperty("评分星级1.差 2.一般 3.还不错 4.很满意 5.强烈推荐") |
| | | private Integer starLevel; |
| | | |
| | | @ApiModelProperty("评价内容") |
| | | private String evaluateContent; |
| | | |
| | | @ApiModelProperty("人群标签") |
| | | private String tags; |
| | | |
| | | @ApiModelProperty("照片(多张以逗号隔开)") |
| | | private String photo; |
| | | |
| | | @ApiModelProperty("用户openid") |
| | | private String openid; |
| | | |
| | | @ApiModelProperty(value = "分页-当前页数", example = "1") |
| | | private Long pageNum = 1L; |
| | | |
| | | @ApiModelProperty(value = "分页-每页记录数", example = "10") |
| | | private Long pageSize = 10L; |
| | | } |
| | |
| | | @ApiModelProperty("活动地址") |
| | | private String activityAddr; |
| | | |
| | | @ApiModelProperty("纬度") |
| | | private String lat; |
| | | |
| | | @ApiModelProperty("经度") |
| | | private String lng; |
| | | |
| | | @ApiModelProperty("活动状态 1 待发布 2 未开始 3 报名中 4 进行中 5 已结束 6 已取消") |
| | | private Integer status; |
| | | |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date signUpEnd; |
| | | |
| | | @ApiModelProperty("参加人群(多个以逗号隔开)") |
| | | private String aattendPeople; |
| | | |
| | | @ApiModelProperty("志愿者人数下线") |
| | | private Integer volunteerMin; |
| | | |
| | | @ApiModelProperty("志愿者人数上限") |
| | | @ApiModelProperty("志愿者人数上限(不需要则不填写)") |
| | | private Integer volunteerMax; |
| | | |
| | | @ApiModelProperty("当前志愿者数量") |
| | |
| | | @ApiModelProperty("参与者人数下线") |
| | | private Integer participantMin; |
| | | |
| | | @ApiModelProperty("参与者人数上限") |
| | | @ApiModelProperty("参与者人数上限(不填写则默认不限人数)") |
| | | private Integer participantMax; |
| | | |
| | | @ApiModelProperty("当前参与者数量") |
| | |
| | | |
| | | @ApiModelProperty("是否有奖品 1 有 0 无") |
| | | private Integer hasPrize; |
| | | |
| | | @ApiModelProperty("是否二维码签到 1 是 0否") |
| | | private Integer isQrCode; |
| | | |
| | | @ApiModelProperty("联系人姓名") |
| | | private String contactName; |
| | | |
| | | @ApiModelProperty("联系人电话") |
| | | private String contactPhone; |
| | | |
| | | @ApiModelProperty("是否签到 1 是 0否") |
| | | private Integer isRegist; |
| | | |
| | | @ApiModelProperty("是否顶部 1 是 0否") |
| | | private Integer isTop; |
| | | |
| | | @ApiModelProperty("奖品备注") |
| | | private String prizeRemark; |
| | |
| | | @ApiModelProperty("活动奖品集合") |
| | | private List<ComActActPrizeVO> comActActPrizeVOList; |
| | | |
| | | @ApiModelProperty("活动评价集合") |
| | | private List<ComActActEvaluateVO> comActActEvaluateVOList; |
| | | |
| | | @ApiModelProperty("活动评价总数") |
| | | private Integer evaluateAmount; |
| | | |
| | | @ApiModelProperty("评分星级") |
| | | private Double evaluateLevel; |
| | | |
| | | @ApiModelProperty(value = "社区id", hidden = true) |
| | | private Long communityId; |
| | | |
| | |
| | | R listActivitySign(@RequestBody ActivitySignVO activitySignVO); |
| | | |
| | | /** |
| | | * description listActivityRegists 分页查询活动评价 |
| | | * @param comActActEvaluateVO 活动评价vo |
| | | * @return R 分页查询结果 |
| | | * @author txb |
| | | * @date 2021/8/24 14:03 |
| | | */ |
| | | @PostMapping("/activity/evaluate/page") |
| | | R pageActivityRegists(@RequestBody ComActActEvaluateVO comActActEvaluateVO); |
| | | |
| | | /** |
| | | * description getEvaluateListsByIds 批量查询活动评价 |
| | | * @param ids ids |
| | | * @return R 查询结果 |
| | | * @author txb |
| | | * @date 2021/8/24 14:03 |
| | | */ |
| | | @PostMapping("/activity/evaluate/getList") |
| | | R getEvaluateListsByIds(@RequestBody List<Long> ids); |
| | | |
| | | /** |
| | | * 活动报名名单 |
| | | * |
| | | * @param activitySignVO |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | |
| | | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
| | | import com.panzhihua.community_backstage.excel.CustomSheetWriteHandler; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | return communityService.listActivitySign(activitySignVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询活动评价") |
| | | @PostMapping("evaluate/page") |
| | | public R pageActivityRegists(@RequestBody ComActActEvaluateVO comActActEvaluateVO) { |
| | | if (ObjectUtils.isEmpty(comActActEvaluateVO.getActivityId())) { |
| | | return R.fail("活动id主键不能为空"); |
| | | } |
| | | return communityService.pageActivityRegists(comActActEvaluateVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "excel导出-活动评价") |
| | | @PostMapping("evaluate/export") |
| | | public R activityExportEvaluate(@RequestBody List<Long> Ids) { |
| | | String name = "活动评价导出数据.xlsx"; |
| | | String ftpUrl = "/mnt/data/web/excel/"; |
| | | R r = communityService.getEvaluateListsByIds(Ids); |
| | | if (R.isOk(r)) { |
| | | List<ComActActEvaluateExcelVO> excelVOS = |
| | | JSONArray.parseArray(JSONArray.toJSONString(r.getData()), ComActActEvaluateExcelVO.class); |
| | | try { |
| | | SFTPUtil sftp = new SFTPUtil(userName, password, host, port); |
| | | sftp.login(); |
| | | boolean existDir = sftp.isExistDir(ftpUrl + name); |
| | | if (!existDir) { |
| | | String property = System.getProperty("user.dir"); |
| | | String fileName = property + File.separator + name; |
| | | // 这里 需要指定写用哪个class去写 |
| | | ExcelWriter excelWriter = null; |
| | | InputStream inputStream = null; |
| | | try { |
| | | excelWriter = EasyExcel.write(fileName, ComActActEvaluateExcelVO.class) |
| | | .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
| | | .registerWriteHandler(new CustomSheetWriteHandler()).build(); |
| | | WriteSheet writeSheet = EasyExcel.writerSheet("活动评价导出数据").build(); |
| | | excelWriter.write(excelVOS, writeSheet); |
| | | excelWriter.finish(); |
| | | File file = new File(fileName); |
| | | inputStream = new FileInputStream(file); |
| | | sftp.uploadMore(ftpUrl, name, inputStream); |
| | | sftp.logout(); |
| | | inputStream.close(); |
| | | String absolutePath = file.getAbsolutePath(); |
| | | boolean delete = file.delete(); |
| | | log.info("删除excel【{}】结果【{}】", absolutePath, delete); |
| | | } finally { |
| | | // 千万别忘记finish 会帮忙关闭流 |
| | | if (inputStream != null) { |
| | | inputStream.close(); |
| | | } |
| | | if (excelWriter != null) { |
| | | excelWriter.finish(); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(excelUrl + name); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("文件传输失败【{}】", e.getMessage()); |
| | | return R.fail(); |
| | | } |
| | | } |
| | | return R.fail("未查询到用户"); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增社区动态") |
| | | @PostMapping("dynamic") |
| | | public R addDynamic(@RequestBody ComActDynVO comActDynVO) { |
| | |
| | | private ComEldersAuthHistoryRecordMapper comEldersAuthHistoryRecordMapper; |
| | | @Resource |
| | | private ComActEasyPhotoActivityService comActEasyPhotoActivityService; |
| | | @Resource |
| | | private ComActActEvaluateService comActActEvaluateService; |
| | | |
| | | /** |
| | | * 新增社区活动 |
| | |
| | | if (ObjectUtils.isEmpty(comActActivityVO)) { |
| | | return R.fail("活动不存在"); |
| | | } |
| | | //活动奖品 |
| | | List<ComActActPrizeDO> comActActPrizeDOS = comActActPrizeService |
| | | .list(new QueryWrapper<ComActActPrizeDO>().lambda().eq(ComActActPrizeDO::getActivityId, id)); |
| | | if (!ObjectUtils.isEmpty(comActActPrizeDOS)) { |
| | |
| | | }); |
| | | comActActivityVO.setComActActPrizeVOList(comActActPrizeVOS); |
| | | } |
| | | //活动评价 |
| | | List<ComActActEvaluateDO> comActActEvaluateDOList = comActActEvaluateService |
| | | .list(new QueryWrapper<ComActActEvaluateDO>().lambda().eq(ComActActEvaluateDO::getActivityId, id)); |
| | | if (!ObjectUtils.isEmpty(comActActEvaluateDOList)) { |
| | | List<ComActActEvaluateVO> comActActEvaluateVOList = new ArrayList<>(); |
| | | comActActEvaluateDOList.forEach(comActActEvaluateDO -> { |
| | | ComActActEvaluateVO comActActEvaluateVO = new ComActActEvaluateVO(); |
| | | BeanUtils.copyProperties(comActActEvaluateDO, comActActEvaluateVO); |
| | | comActActEvaluateVOList.add(comActActEvaluateVO); |
| | | }); |
| | | comActActivityVO.setComActActEvaluateVOList(comActActEvaluateVOList); |
| | | //活动评价总数 |
| | | comActActivityVO.setEvaluateAmount(comActActEvaluateDOList.size()); |
| | | } |
| | | //活动报名名单 |
| | | ActivitySignVO activitySignVO = new ActivitySignVO(); |
| | | activitySignVO.setActivityId(id); |
| | | R r = comActActivityService.listActivitySigns(activitySignVO); |
| | |
| | | } |
| | | |
| | | /** |
| | | * description listActivityRegists 分页查询活动评价 |
| | | * @param comActActEvaluateVO 活动评价vo |
| | | * @return R 分页查询结果 |
| | | * @author txb |
| | | * @date 2021/8/24 14:03 |
| | | */ |
| | | @PostMapping("activity/evaluate/page") |
| | | public R pageActivityRegists(@RequestBody ComActActEvaluateVO comActActEvaluateVO) { |
| | | return comActActivityService.pageActivityRegists(comActActEvaluateVO); |
| | | } |
| | | |
| | | /** |
| | | * description getEvaluateListsByIds 批量查询活动评价 |
| | | * @param ids ids |
| | | * @return R 查询结果 |
| | | * @author txb |
| | | * @date 2021/8/24 14:03 |
| | | */ |
| | | @PostMapping("/activity/evaluate/getList") |
| | | public R getEvaluateListsByIds(@RequestBody List<Long> ids){ |
| | | return comActActivityService.getEvaluateListsByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * 新增社区动态 |
| | | * |
| | | * @param comActDynVO |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.vos.community.ActivitySignVO; |
| | | import com.panzhihua.common.model.vos.community.ComActActEvaluateExcelVO; |
| | | import com.panzhihua.common.model.vos.community.ComActActEvaluateVO; |
| | | import com.panzhihua.service_community.model.dos.ComActActEvaluateDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * title: ComActActEvaluateDAO 社区》活动》活动评价表mapper类 |
| | | * projectName 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * description: 社区》活动》活动评价表mapper类 |
| | | * |
| | | * @author txb |
| | | * @date 2021/8/24 10:21 |
| | | */ |
| | | @Mapper |
| | | public interface ComActActEvaluateDAO extends BaseMapper<ComActActEvaluateDO> { |
| | | |
| | | IPage<ComActActEvaluateVO> pageActivityRegists(Page page, @Param("comActActEvaluateVO") ComActActEvaluateVO comActActEvaluateVO); |
| | | |
| | | List<ComActActEvaluateExcelVO> getEvaluateListsByIds(@Param("ids") List<Long> ids); |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.model.dos; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | |
| | | /** |
| | | * title: ComActActEvaluateDO 社区活动评价表 |
| | | * projectName 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * description: 记录和展示社区活动评价内容 |
| | | * |
| | | * @author txb |
| | | * @date 2021/8/24 10:21 |
| | | */ |
| | | |
| | | @Data |
| | | @TableName("com_act_act_evaluate") |
| | | public class ComActActEvaluateDO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 自增id |
| | | */ |
| | | @TableId(type = IdType.INPUT) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 所属活动id |
| | | */ |
| | | private Long activityId; |
| | | |
| | | /** |
| | | * 用户id, 和用户信息表的相关id关联 |
| | | */ |
| | | private Long userId; |
| | | |
| | | /** |
| | | * 评价时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createAt; |
| | | |
| | | /** |
| | | * 是否是志愿者 0 否 1 是 |
| | | */ |
| | | private Integer isVolunteer; |
| | | |
| | | /** |
| | | * 评分星级1.差 2.一般 3.还不错 4.很满意 5.强烈推荐 |
| | | */ |
| | | private Integer starLevel; |
| | | |
| | | /** |
| | | * 评价内容 |
| | | */ |
| | | private String evaluateContent; |
| | | |
| | | /** |
| | | * 照片(多张以逗号隔开) |
| | | */ |
| | | private String photo; |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "ComActActEvaluateDO{" + |
| | | "id=" + id + |
| | | ", activityId=" + activityId + |
| | | ", userId=" + userId + |
| | | ", createAt=" + createAt + |
| | | ", isVolunteer=" + isVolunteer + |
| | | ", starLevel=" + starLevel + |
| | | ", evaluateContent=" + evaluateContent + |
| | | ", photo=" + photo + |
| | | "}"; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | private String activityAddr; |
| | | |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | private String lat; |
| | | |
| | | /** |
| | | * 经度 |
| | | */ |
| | | private String lng; |
| | | |
| | | /** |
| | | * 活动状态 |
| | | */ |
| | | private Integer status; |
| | |
| | | private Date signUpEnd; |
| | | |
| | | /** |
| | | * 参加人群 |
| | | */ |
| | | private String aattendPeople; |
| | | |
| | | |
| | | /** |
| | | * 志愿者人数下线 |
| | | */ |
| | | private Integer volunteerMin; |
| | |
| | | private Integer hasPrize; |
| | | |
| | | /** |
| | | * 是否二维码签到 1 是 0否 |
| | | */ |
| | | private Integer isQrCode; |
| | | |
| | | /** |
| | | * 联系人姓名 |
| | | */ |
| | | private String contactName; |
| | | |
| | | /** |
| | | * 联系人电话 |
| | | */ |
| | | private String contactPhone; |
| | | |
| | | /** |
| | | * 是否签到 1 是 0否 |
| | | */ |
| | | private Integer isRegist; |
| | | |
| | | /** |
| | | * 是否顶部 1 是 0否 |
| | | */ |
| | | private Integer isTop; |
| | | |
| | | /** |
| | | * 奖品备注 |
| | | */ |
| | | private String prizeRemark; |
New file |
| | |
| | | package com.panzhihua.service_community.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.panzhihua.service_community.model.dos.ComActActEvaluateDO; |
| | | /** |
| | | * title: ComActActEvaluateService 社区》活动》活动评价表服务类 |
| | | * projectName 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * description: 社区》活动》活动评价表服务类 |
| | | * |
| | | * @author txb |
| | | * @date 2021/8/24 10:21 |
| | | */ |
| | | public interface ComActActEvaluateService extends IService<ComActActEvaluateDO> { |
| | | |
| | | } |
| | |
| | | import com.panzhihua.common.model.dtos.community.bigscreen.work.ScreenActActivityPeopleListDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ActivitySignVO; |
| | | import com.panzhihua.common.model.vos.community.ComActActEvaluateVO; |
| | | import com.panzhihua.common.model.vos.community.ComActActivityVO; |
| | | import com.panzhihua.common.model.vos.community.SignactivityVO; |
| | | import com.panzhihua.service_community.model.dos.ComActActivityDO; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | |
| | | R listActivitySigns(ActivitySignVO activitySignVO); |
| | | |
| | | /** |
| | | * description listActivityRegists 分页查询活动评价 |
| | | * @param comActActEvaluateVO 活动评价vo |
| | | * @return R 分页查询结果 |
| | | * @author txb |
| | | * @date 2021/8/24 14:03 |
| | | */ |
| | | R pageActivityRegists(ComActActEvaluateVO comActActEvaluateVO); |
| | | |
| | | /** |
| | | * description getEvaluateListsByIds 批量查询活动评价 |
| | | * @param ids ids |
| | | * @return R 查询结果 |
| | | * @author txb |
| | | * @date 2021/8/24 14:03 |
| | | */ |
| | | R getEvaluateListsByIds(List<Long> ids); |
| | | |
| | | /** |
| | | * 分页展示我的所有活动 时间倒序排列 |
| | | * |
| | | * @param comActActivityVO |
New file |
| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.panzhihua.service_community.dao.ComActActEvaluateDAO; |
| | | import com.panzhihua.service_community.model.dos.ComActActEvaluateDO; |
| | | import com.panzhihua.service_community.service.ComActActEvaluateService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | /** |
| | | * title: ComActActEvaluateServiceImpl 社区》活动》活动评价表服务实现类 |
| | | * projectName 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * description: 社区》活动》活动评价表服务实现类 |
| | | * |
| | | * @author txb |
| | | * @date 2021/8/24 10:21 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ComActActEvaluateServiceImpl extends ServiceImpl<ComActActEvaluateDAO, ComActActEvaluateDO> implements ComActActEvaluateService { |
| | | |
| | | } |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.panzhihua.service_community.dao.ComActActEvaluateDAO; |
| | | import com.panzhihua.service_community.model.dos.ComActActEvaluateDO; |
| | | import org.apache.commons.lang3.time.DateUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private ComActActSignDAO comActActSignDAO; |
| | | @Resource |
| | | private UserService userService; |
| | | @Resource |
| | | private ComActActEvaluateDAO comActActEvaluateDAO; |
| | | |
| | | /** |
| | | * 新增社区活动 |
| | |
| | | public R listActivitySigns(ActivitySignVO activitySignVO) { |
| | | List<ActivitySignVO> activitySignVOS = comActActSignDAO.listActivitySigns(activitySignVO); |
| | | return R.ok(activitySignVOS); |
| | | } |
| | | |
| | | @Override |
| | | public R pageActivityRegists(ComActActEvaluateVO comActActEvaluateVO) { |
| | | IPage<ComActActEvaluateVO> comActActEvaluateVOIPage = comActActEvaluateDAO |
| | | .pageActivityRegists(new Page(comActActEvaluateVO.getPageNum(), comActActEvaluateVO.getPageSize()), comActActEvaluateVO); |
| | | return R.ok(comActActEvaluateVOIPage); |
| | | } |
| | | |
| | | @Override |
| | | public R getEvaluateListsByIds(List<Long> ids) { |
| | | return R.ok(comActActEvaluateDAO.getEvaluateListsByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | page.setSize(pageSize); |
| | | page.setCurrent(pageNum); |
| | | IPage<ComActActivityVO> iPage = comActActivityDAO.pageActivityCommunityBack(page, comActActivityVO); |
| | | iPage.getRecords().forEach(vo ->{ |
| | | List<ComActActEvaluateDO> comActActEvaluateDOList = comActActEvaluateDAO |
| | | .selectList(new QueryWrapper<ComActActEvaluateDO>().lambda().eq(ComActActEvaluateDO::getActivityId, vo.getId())); |
| | | if (comActActEvaluateDOList != null && comActActEvaluateDOList.size() != 0) { |
| | | //总星级 |
| | | int starNum = comActActEvaluateDOList.stream().mapToInt(ComActActEvaluateDO::getStarLevel).sum(); |
| | | //评分星级=总星级/总评价人数 |
| | | vo.setEvaluateLevel(Double.valueOf(starNum/comActActEvaluateDOList.size())); |
| | | } |
| | | }); |
| | | return R.ok(iPage); |
| | | } |
| | | |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.panzhihua.service_community.dao.ComActActEvaluateDAO"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActActEvaluateDO"> |
| | | <id column="id" property="id" /> |
| | | <result column="activity_id" property="activityId" /> |
| | | <result column="user_id" property="userId" /> |
| | | <result column="create_at" property="createAt" /> |
| | | <result column="is_volunteer" property="isVolunteer" /> |
| | | <result column="star_level" property="starLevel" /> |
| | | <result column="evaluate_content" property="evaluateContent" /> |
| | | <result column="photo" property="photo" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, activity_id, user_id, create_at, is_volunteer, star_level, evaluate_content, photo |
| | | </sql> |
| | | |
| | | <select id="pageActivityRegists" resultType="com.panzhihua.common.model.vos.community.ComActActEvaluateVO"> |
| | | SELECT |
| | | caae.id, |
| | | caae.activity_id, |
| | | caae.create_at, |
| | | caae.photo, |
| | | caae.star_level, |
| | | caae.evaluate_content, |
| | | su.user_id, |
| | | su.`name`, |
| | | su.nick_name, |
| | | su.phone, |
| | | su.image_url, |
| | | su.tags, |
| | | caae.is_volunteer, |
| | | CASE |
| | | |
| | | WHEN su.is_partymember = 1 THEN |
| | | '党员' |
| | | WHEN caas.is_volunteer = 1 THEN |
| | | '志愿者' ELSE '居民' |
| | | END identity |
| | | |
| | | FROM |
| | | com_act_act_evaluate caae |
| | | LEFT JOIN com_act_act_sign caas ON caae.activity_id = caas.activity_id |
| | | LEFT JOIN sys_user su ON caae.user_id = su.user_id |
| | | where caae.activity_id = #{comActActEvaluateVO.activityId} |
| | | <if test="comActActEvaluateVO.phone != null and comActActEvaluateVO.phone !=''"> |
| | | AND su.phone = #{comActActEvaluateVO.phone} |
| | | </if> |
| | | <if test="comActActEvaluateVO.name != null and comActActEvaluateVO.name !=''"> |
| | | AND su.`name` = #{comActActEvaluateVO.name} |
| | | </if> |
| | | <if test="comActActEvaluateVO.starLevel != null"> |
| | | AND caae.star_level = #{comActActEvaluateVO.starLevel} |
| | | </if> |
| | | <if test="comActActEvaluateVO.createAt != null"> |
| | | AND caae.create_at = #{comActActEvaluateVO.createAt} |
| | | </if> |
| | | order by caae.create_at desc |
| | | </select> |
| | | |
| | | <select id="getEvaluateListsByIds" resultType="java.util.List"> |
| | | SELECT |
| | | caae.create_at, |
| | | caae.star_level, |
| | | caae.evaluate_content, |
| | | su.`name`, |
| | | su.phone, |
| | | CASE |
| | | |
| | | WHEN su.is_partymember = 1 THEN |
| | | '党员' |
| | | WHEN caas.is_volunteer = 1 THEN |
| | | '志愿者' ELSE '居民' |
| | | END identity |
| | | |
| | | FROM |
| | | com_act_act_evaluate caae |
| | | LEFT JOIN com_act_act_sign caas ON caae.activity_id = caas.activity_id |
| | | LEFT JOIN sys_user su ON caae.user_id = su.user_id |
| | | where caae.id in |
| | | <foreach collection="ids" item="id" open="(" close=")" separator=","> |
| | | #{id} |
| | | </foreach> |
| | | order by caae.create_at desc |
| | | </select> |
| | | </mapper> |