| | |
| | | or ja.article_range is null or ja.article_range = '') |
| | | </if> |
| | | |
| | | <if test="article.userId != null"> |
| | | and (jpd.user_ids like concat('%',#{article.userId},'%') |
| | | <if test="article.householdId != null"> |
| | | and (FIND_IN_SET ( #{article.householdId}, jpd.user_ids ) |
| | | OR jpd.user_ids IS NULL or jpd.user_ids = '') |
| | | </if> |
| | | |
| | |
| | | import org.springblade.modules.article.vo.ArticleVO; |
| | | import org.springblade.modules.district.entity.DistrictEntity; |
| | | import org.springblade.modules.district.service.IDistrictService; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | import org.springblade.modules.property.entity.PropertyCompanyDistrictEntity; |
| | | import org.springblade.modules.property.entity.PropertyCompanyEntity; |
| | | import org.springblade.modules.property.service.IPropertyCompanyDistrictService; |
| | |
| | | // 查询用户小区的id |
| | | String districId = baseMapper.getDistrictId(article.getHouseCode()); |
| | | article.setDistrictId(districId); |
| | | article.setUserId(AuthUtil.getUserId()); |
| | | |
| | | IHouseholdService householdService = SpringUtils.getBean(IHouseholdService.class); |
| | | HouseholdEntity householdEntity = householdService.getOne(Wrappers.<HouseholdEntity>lambdaQuery() |
| | | .eq(HouseholdEntity::getHouseCode, article.getHouseCode()) |
| | | .eq(HouseholdEntity::getAssociatedUserId,AuthUtil.getUserId()) |
| | | .eq(HouseholdEntity::getIsDeleted,0) |
| | | .last("limit 1")); |
| | | if (householdEntity != null) { |
| | | article.setHouseholdId(householdEntity.getId()); |
| | | } |
| | | List<ArticleVO> articleVOS = baseMapper.selectArticlePageByApp(page, article); |
| | | return page.setRecords(articleVOS); |
| | | } |
| | |
| | | |
| | | private String houseCode; |
| | | |
| | | private Long householdId; |
| | | |
| | | private String districtId; |
| | | |
| | | private String parentId; |
| | |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详情", notes = "传入publicDiscuss") |
| | | public R<PublicDiscussEntity> detail(PublicDiscussVO publicDiscuss) { |
| | | publicDiscuss.setUserId(AuthUtil.getUserId()); |
| | | // publicDiscuss.setUserId(AuthUtil.getUserId()); |
| | | PublicDiscussEntity detail = publicDiscussService.getDetail(publicDiscuss); |
| | | return R.data(detail); |
| | | } |
| | |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "新增", notes = "传入userPublicEnroll") |
| | | public R save(@Valid @RequestBody UserPublicEnrollEntity userPublicEnroll) { |
| | | userPublicEnroll.setUserId(AuthUtil.getUserId()); |
| | | // 判断是否一户一票 还是一人一票 |
| | | IPublicDiscussService bean = SpringUtil.getBean(IPublicDiscussService.class); |
| | | PublicDiscussEntity one = bean.getOne(Wrappers.<PublicDiscussEntity>lambdaQuery().eq(PublicDiscussEntity::getArticleId, userPublicEnroll.getArticleId())); |
| | | // 一户一票 |
| | | if (one.getVoteRestrictions().equals(CommonConstant.NUMBER_ONE)) { |
| | | long count = userPublicEnrollService.count(Wrappers.<UserPublicEnrollEntity>lambdaQuery() |
| | | .eq(UserPublicEnrollEntity::getArticleId, userPublicEnroll.getArticleId()) |
| | | .eq(UserPublicEnrollEntity::getHouseCode, userPublicEnroll.getHouseCode())); |
| | | if (count > 0) { |
| | | return R.fail("您房屋已经报名,不能重复报名!"); |
| | | } |
| | | // 一人一票 |
| | | } else { |
| | | long count = userPublicEnrollService.count(Wrappers.<UserPublicEnrollEntity>lambdaQuery() |
| | | .eq(UserPublicEnrollEntity::getArticleId, userPublicEnroll.getArticleId()) |
| | | .eq(UserPublicEnrollEntity::getUserId, userPublicEnroll.getUserId())); |
| | | if (count > 0) { |
| | | return R.fail("您已报名,不能重复报名!"); |
| | | } |
| | | Integer aBoolean = userPublicEnrollService.saveUserPublicEnrollEntity(userPublicEnroll); |
| | | if (aBoolean.equals(3)) { |
| | | return R.fail("您已报名,不能重复报名!"); |
| | | } else if (aBoolean.equals(4)) { |
| | | return R.fail("您已报名,不能重复报名!"); |
| | | } else if (aBoolean.equals(1)) { |
| | | return R.status(true); |
| | | } |
| | | return R.status(userPublicEnrollService.save(userPublicEnroll)); |
| | | return R.fail("失败!"); |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入userTopics") |
| | | public R submit(@Valid @RequestBody UserTopicsEntity userTopics) { |
| | | userTopics.setUserId(AuthUtil.getUserId()); |
| | | return R.status(userTopicsService.save(userTopics)); |
| | | return R.status(userTopicsService.saveUserTopicsEntity(userTopics)); |
| | | } |
| | | |
| | | /** |
| | |
| | | private List<TopicsDTO> children; |
| | | |
| | | private Long userId; |
| | | private Long householdId; |
| | | |
| | | private String houseCode; |
| | | |
| | |
| | | @TableField("public_discuss_id") |
| | | private Integer publicDiscussId; |
| | | |
| | | /** 用户id */ |
| | | @ApiModelProperty(value = "用户id", example = "") |
| | | @TableField("user_id") |
| | | private Long userId; |
| | | /** |
| | | * 住户id |
| | | */ |
| | | @ApiModelProperty(value = "住户id", example = "") |
| | | @TableField("household_id") |
| | | private Long householdId; |
| | | |
| | | /** |
| | | * 创建时间 |
| | |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 用户id |
| | | * 住户id |
| | | */ |
| | | @ApiModelProperty(value = "用户id", example = "") |
| | | @TableField("user_id") |
| | | private Long userId; |
| | | @ApiModelProperty(value = "住户id", example = "") |
| | | @TableField("household_id") |
| | | private Long householdId; |
| | | |
| | | /** |
| | | * 议题id |
| | |
| | | jpd.signature_flag, |
| | | GROUP_CONCAT(jh.name) userName |
| | | from jczz_public_discuss jpd |
| | | LEFT JOIN jczz_household jh on jpd.user_ids like CONCAT('%',jh.associated_user_id,'%') |
| | | LEFT JOIN jczz_household jh ON FIND_IN_SET ( jh.id, jpd.user_ids ) |
| | | <where> |
| | | <if test="publicDiscuss.id != null "> and id = #{publicDiscuss.id}</if> |
| | | <if test="publicDiscuss.title != null and publicDiscuss.title != ''"> and title = #{publicDiscuss.title}</if> |
| | |
| | | jpd.user_ids, |
| | | jpd.event_type, |
| | | jpd.signature_flag, |
| | | (SELECT user_id from jczz_user_public_enroll where user_id = #{userId} and article_id = jpd.article_id)userId |
| | | (SELECT household_id from jczz_user_public_enroll where household_id = #{householdId} and article_id = jpd.article_id)householdId |
| | | from |
| | | jczz_public_discuss jpd |
| | | <where> |
| | |
| | | LEFT JOIN jczz_topics jts ON jts.id = jut.topics_id |
| | | WHERE |
| | | jut.article_id = jt.article_id |
| | | AND jts.parent_id = jt.id AND jut.user_id = #{userId} AND jut.house_code = #{houseCode} |
| | | AND jts.parent_id = jt.id AND jut.household_id = #{householdId} AND jut.house_code = #{houseCode} |
| | | limit 1 |
| | | ) selected |
| | | FROM |
| | |
| | | <resultMap id="userPublicEnrollResultMap" type="org.springblade.modules.discuss.vo.UserPublicEnrollVO"> |
| | | <result property="id" column="id" /> |
| | | <result property="publicDiscussId" column="public_discuss_id" /> |
| | | <result property="userId" column="user_id" /> |
| | | <result property="householdId" column="household_id" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="deletedFlag" column="deleted_flag" /> |
| | |
| | | SELECT |
| | | jup.id, |
| | | jup.public_discuss_id, |
| | | jup.user_id, |
| | | jup.household_id, |
| | | jup.create_time, |
| | | jup.update_time, |
| | | jup.deleted_flag, |
| | | jup.signature_path, |
| | | bu.avatar, |
| | | bu.`name`, |
| | | bu.phone, |
| | | jh.`name`, |
| | | jh.phone_number phone, |
| | | jda.address_name, |
| | | jda.aoi_name |
| | | FROM |
| | | jczz_user_public_enroll jup |
| | | LEFT JOIN blade_user bu ON jup.user_id = bu.id |
| | | AND bu.is_deleted = 0 |
| | | LEFT JOIN jczz_household jh ON jh.house_code = jup.house_code |
| | | AND jh.is_deleted = 0 and jup.user_id =jh.associated_user_id |
| | | AND jh.is_deleted = 0 |
| | | AND jup.household_id = jh.id |
| | | LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jh.house_code |
| | | LEFT JOIN blade_user bu ON jh.associated_user_id = bu.id |
| | | AND bu.is_deleted = 0 |
| | | <where> |
| | | <if test="userPublicEnroll.id != null "> and jup.id = #{userPublicEnroll.id}</if> |
| | | <if test="userPublicEnroll.publicDiscussId != null "> and jup.public_discuss_id = #{userPublicEnroll.publicDiscussId}</if> |
| | | <if test="userPublicEnroll.userId != null "> and jup.user_id = #{userPublicEnroll.userId}</if> |
| | | <if test="userPublicEnroll.householdId != null "> and jup.household_id = #{userPublicEnroll.householdId}</if> |
| | | <if test="userPublicEnroll.createTime != null "> and jup.create_time = #{userPublicEnroll.createTime}</if> |
| | | <if test="userPublicEnroll.updateTime != null "> and jup.update_time = #{userPublicEnroll.updateTime}</if> |
| | | <if test="userPublicEnroll.deletedFlag != null "> and jup.deleted_flag = #{userPublicEnroll.deletedFlag}</if> |
| | |
| | | |
| | | |
| | | <select id="selectUserTopicsPage" resultMap="userTopicsResultMap"> |
| | | SELECT distinct |
| | | SELECT |
| | | jut.article_id, |
| | | jut.delete_flag, |
| | | jut.signature_path, |
| | | jut.create_time, |
| | | jut.household_id, |
| | | bu.avatar, |
| | | bu.`name`, |
| | | bu.phone, |
| | | jh.name, |
| | | jh.phone_number phone, |
| | | jda.address_name, |
| | | jda.aoi_name, |
| | | jt.option_content |
| | | jda.aoi_name |
| | | <if test="userTopics.articleId != null ">, |
| | | group_concat(jt.option_content) optionContent </if> |
| | | FROM |
| | | jczz_user_topics as jut |
| | | LEFT JOIN blade_user bu ON jut.user_id = bu.id AND bu.is_deleted = 0 |
| | | LEFT JOIN jczz_household jh ON jh.house_code = jut.house_code |
| | | AND jh.is_deleted = 0 and jut.user_id =jh.associated_user_id |
| | | LEFT JOIN jczz_household jh ON jh.id = jut.household_id and jh.is_deleted = 0 |
| | | LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jh.house_code |
| | | LEFT JOIN jczz_topics jt on jt.id = jut.topics_id |
| | | LEFT JOIN blade_user bu ON jh.associated_user_id = bu.id AND bu.is_deleted = 0 |
| | | <where> |
| | | <if test="userTopics.id != null ">and jut.id = #{userTopics.id}</if> |
| | | <if test="userTopics.name != null and userTopics.name != ''"> |
| | |
| | | </foreach> |
| | | </if> |
| | | |
| | | <if test="userTopics.userId != null ">and jut.user_id = #{userTopics.userId}</if> |
| | | <if test="userTopics.householdId != null ">and jut.household_id = #{userTopics.householdId}</if> |
| | | <if test="userTopics.topicsId != null ">and jut.topics_id = #{userTopics.topicsId}</if> |
| | | <if test="userTopics.createTime != null ">and jut.create_time = #{userTopics.createTime}</if> |
| | | <if test="userTopics.updateTime != null ">and jut.update_time = #{userTopics.updateTime}</if> |
| | | <if test="userTopics.deleteFlag != null ">and jut.delete_flag = #{userTopics.deleteFlag}</if> |
| | | <if test="userTopics.articleId != null ">and jut.article_id = #{userTopics.articleId} |
| | | <if test="userTopics.articleId != null "> |
| | | and jut.article_id = #{userTopics.articleId} |
| | | and jut.delete_flag = 0 |
| | | GROUP BY jut.article_id, jut.signature_path,jut.create_time,jut.delete_flag, |
| | | GROUP BY jut.article_id, jut.signature_path,jut.create_time,jut.household_id,jut.delete_flag, |
| | | bu.avatar, |
| | | bu.`name`, |
| | | bu.phone, |
| | | jh.name, |
| | | jh.phone_number, |
| | | jda.address_name, |
| | | jda.aoi_name, |
| | | jt.option_content |
| | | jda.aoi_name |
| | | </if> |
| | | </where> |
| | | </select> |
| | |
| | | |
| | | |
| | | Long getCount(Integer id); |
| | | |
| | | Integer saveUserPublicEnrollEntity(UserPublicEnrollEntity userPublicEnroll); |
| | | } |
| | |
| | | Integer getCount(Integer id); |
| | | |
| | | List<UserTopicsExcel> exportUser(UserTopicsVO userTopics); |
| | | |
| | | Boolean saveUserTopicsEntity(UserTopicsEntity userTopics); |
| | | } |
| | |
| | | package org.springblade.modules.discuss.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.common.utils.SpringUtils; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.modules.discuss.entity.PublicDiscussEntity; |
| | | import org.springblade.modules.discuss.entity.UserTopicsEntity; |
| | | import org.springblade.modules.discuss.mapper.PublicDiscussMapper; |
| | |
| | | import org.springblade.modules.discuss.service.IUserTopicsService; |
| | | import org.springblade.modules.discuss.vo.PublicDiscussVO; |
| | | import org.springblade.modules.discuss.vo.UserTopicsVO; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | List<PublicDiscussVO> publicDiscussVOS = baseMapper.selectPublicDiscussPage(page, publicDiscuss); |
| | | for (PublicDiscussVO publicDiscussVO : publicDiscussVOS) { |
| | | Long result = iUserPublicEnrollService.getCount(publicDiscussVO.getId()); |
| | | if(result != null){ |
| | | if (result != null) { |
| | | publicDiscussVO.setEnrollCount(result.intValue()); |
| | | } |
| | | UserTopicsVO userTopicsVo = new UserTopicsVO(); |
| | |
| | | |
| | | @Override |
| | | public PublicDiscussVO getDetail(PublicDiscussVO publicDiscuss) { |
| | | IHouseholdService householdService = SpringUtils.getBean(IHouseholdService.class); |
| | | HouseholdEntity householdEntity = householdService.getOne(Wrappers.<HouseholdEntity>lambdaQuery() |
| | | .eq(HouseholdEntity::getHouseCode, publicDiscuss.getHouseCode()) |
| | | .eq(HouseholdEntity::getAssociatedUserId, AuthUtil.getUserId()) |
| | | .eq(HouseholdEntity::getIsDeleted, 0) |
| | | .last("limit 1")); |
| | | if (householdEntity != null) { |
| | | publicDiscuss.setHouseholdId(householdEntity.getId()); |
| | | } |
| | | return baseMapper.selectPublicDiscuss(publicDiscuss); |
| | | } |
| | | } |
| | |
| | | package org.springblade.modules.discuss.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.common.utils.SpringUtils; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.modules.discuss.dto.TopicsDTO; |
| | | import org.springblade.modules.discuss.entity.TopicsEntity; |
| | | import org.springblade.modules.discuss.mapper.TopicsMapper; |
| | | import org.springblade.modules.discuss.service.ITopicsService; |
| | | import org.springblade.modules.discuss.vo.TopicsVO; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | @Override |
| | | public List<TopicsDTO> selectTopicsList(TopicsDTO topicsDTO) { |
| | | topicsDTO.setUserId(AuthUtil.getUserId()); |
| | | IHouseholdService householdService = SpringUtils.getBean(IHouseholdService.class); |
| | | HouseholdEntity householdEntity = householdService.getOne(Wrappers.<HouseholdEntity>lambdaQuery() |
| | | .eq(HouseholdEntity::getHouseCode, topicsDTO.getHouseCode()) |
| | | .eq(HouseholdEntity::getAssociatedUserId,AuthUtil.getUserId()) |
| | | .eq(HouseholdEntity::getIsDeleted,0) |
| | | .last("limit 1")); |
| | | if (householdEntity != null) { |
| | | topicsDTO.setHouseholdId(householdEntity.getId()); |
| | | } |
| | | return baseMapper.selectTopicsList( topicsDTO); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.common.constant.CommonConstant; |
| | | import org.springblade.common.utils.SpringUtils; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.SpringUtil; |
| | | import org.springblade.modules.discuss.entity.PublicDiscussEntity; |
| | | import org.springblade.modules.discuss.entity.UserPublicEnrollEntity; |
| | | import org.springblade.modules.discuss.mapper.UserPublicEnrollMapper; |
| | | import org.springblade.modules.discuss.service.IPublicDiscussService; |
| | | import org.springblade.modules.discuss.service.IUserPublicEnrollService; |
| | | import org.springblade.modules.discuss.vo.UserPublicEnrollVO; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | |
| | | |
| | | @Override |
| | | public IPage<UserPublicEnrollVO> selectUserPublicEnrollPage(IPage<UserPublicEnrollVO> page, UserPublicEnrollVO userPublicEnroll) { |
| | | IHouseholdService householdService = SpringUtils.getBean(IHouseholdService.class); |
| | | HouseholdEntity householdEntity = householdService.getOne(Wrappers.<HouseholdEntity>lambdaQuery() |
| | | .eq(HouseholdEntity::getHouseCode, userPublicEnroll.getHouseCode()) |
| | | .eq(HouseholdEntity::getAssociatedUserId, AuthUtil.getUserId()) |
| | | .eq(HouseholdEntity::getIsDeleted,0) |
| | | .last("limit 1")); |
| | | if (householdEntity != null) { |
| | | userPublicEnroll.setHouseholdId(householdEntity.getId()); |
| | | } |
| | | return page.setRecords(baseMapper.selectUserPublicEnrollPage(page, userPublicEnroll)); |
| | | } |
| | | |
| | |
| | | return baseMapper.selectCount(Wrappers.<UserPublicEnrollEntity>lambdaQuery(). |
| | | eq(UserPublicEnrollEntity::getPublicDiscussId, id)); |
| | | } |
| | | |
| | | @Override |
| | | public Integer saveUserPublicEnrollEntity(UserPublicEnrollEntity userPublicEnroll) { |
| | | // userPublicEnroll.setUserId(AuthUtil.getUserId()); |
| | | IHouseholdService householdService = SpringUtils.getBean(IHouseholdService.class); |
| | | HouseholdEntity householdEntity = householdService.getOne(Wrappers.<HouseholdEntity>lambdaQuery() |
| | | .eq(HouseholdEntity::getHouseCode, userPublicEnroll.getHouseCode()) |
| | | .eq(HouseholdEntity::getAssociatedUserId, AuthUtil.getUserId()) |
| | | .eq(HouseholdEntity::getIsDeleted, 0) |
| | | .last("limit 1")); |
| | | if (householdEntity != null) { |
| | | userPublicEnroll.setHouseholdId(householdEntity.getId()); |
| | | } |
| | | // 判断是否一户一票 还是一人一票 |
| | | IPublicDiscussService bean = SpringUtil.getBean(IPublicDiscussService.class); |
| | | PublicDiscussEntity one = bean.getOne(Wrappers.<PublicDiscussEntity>lambdaQuery().eq(PublicDiscussEntity::getArticleId, userPublicEnroll.getArticleId())); |
| | | // 一户一票 |
| | | if (one.getVoteRestrictions().equals(CommonConstant.NUMBER_ONE)) { |
| | | long count = count(Wrappers.<UserPublicEnrollEntity>lambdaQuery() |
| | | .eq(UserPublicEnrollEntity::getArticleId, userPublicEnroll.getArticleId()) |
| | | .eq(UserPublicEnrollEntity::getHouseCode, userPublicEnroll.getHouseCode())); |
| | | if (count > 0) { |
| | | return 3; |
| | | } |
| | | // 一人一票 |
| | | } else { |
| | | long count = count(Wrappers.<UserPublicEnrollEntity>lambdaQuery() |
| | | .eq(UserPublicEnrollEntity::getArticleId, userPublicEnroll.getArticleId()) |
| | | .eq(UserPublicEnrollEntity::getHouseholdId, userPublicEnroll.getHouseholdId())); |
| | | if (count > 0) { |
| | | return 4; |
| | | } |
| | | } |
| | | boolean save = save(userPublicEnroll); |
| | | return save ? 1 : 2; |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import liquibase.pro.packaged.H; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jetbrains.annotations.Nullable; |
| | | import org.springblade.common.constant.CommonConstant; |
| | |
| | | import org.springblade.modules.discuss.vo.UserTopicsVO; |
| | | import org.springblade.modules.district.entity.DistrictEntity; |
| | | import org.springblade.modules.district.service.IDistrictService; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | userTopics.setAoiCodeList(collect); |
| | | } |
| | | } |
| | | return page.setRecords(baseMapper.selectUserTopicsPage(page, userTopics)); |
| | | IHouseholdService householdService = SpringUtils.getBean(IHouseholdService.class); |
| | | HouseholdEntity householdEntity = householdService.getOne(Wrappers.<HouseholdEntity>lambdaQuery() |
| | | .eq(HouseholdEntity::getHouseCode, userTopics.getHouseCode()) |
| | | .eq(HouseholdEntity::getAssociatedUserId,AuthUtil.getUserId()) |
| | | .eq(HouseholdEntity::getIsDeleted,0) |
| | | .last("limit 1")); |
| | | if (householdEntity != null) { |
| | | userTopics.setHouseholdId(householdEntity.getId()); |
| | | } |
| | | List<UserTopicsVO> userTopicsVOS = baseMapper.selectUserTopicsPage(page, userTopics); |
| | | return page.setRecords(userTopicsVOS); |
| | | } |
| | | |
| | | |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public String batchSave(List<TopicsVO> topics) throws Exception { |
| | | // 判断是否一户一票 还是一人一票 |
| | | IHouseholdService householdService = SpringUtils.getBean(IHouseholdService.class); |
| | | HouseholdEntity householdEntity = householdService.getOne(Wrappers.<HouseholdEntity>lambdaQuery() |
| | | .eq(HouseholdEntity::getHouseCode, topics.get(0).getHouseCode()) |
| | | .eq(HouseholdEntity::getAssociatedUserId,AuthUtil.getUserId()) |
| | | .eq(HouseholdEntity::getIsDeleted,0) |
| | | .last("limit 1")); |
| | | IPublicDiscussService bean = SpringUtil.getBean(IPublicDiscussService.class); |
| | | PublicDiscussEntity one = bean.getOne(Wrappers.<PublicDiscussEntity>lambdaQuery().eq(PublicDiscussEntity::getArticleId, topics.get(0).getArticleId())); |
| | | // 一户一票 |
| | |
| | | } else { |
| | | // |
| | | long count = count(Wrappers.<UserTopicsEntity>lambdaQuery() |
| | | .eq(UserTopicsEntity::getUserId, AuthUtil.getUserId()) |
| | | .eq(UserTopicsEntity::getHouseholdId, householdEntity.getId()) |
| | | .eq(UserTopicsEntity::getArticleId, topics.get(0).getArticleId())); |
| | | if (count > 0) { |
| | | return "您已投票,不能重复投票!"; |
| | | } |
| | | } |
| | | Boolean userTopics = getaBoolean(topics); |
| | | Boolean userTopics = getaBoolean(topics,householdEntity); |
| | | if (userTopics) return "200"; |
| | | return "操作失败!"; |
| | | } |
| | | |
| | | @Nullable |
| | | private Boolean getaBoolean(List<TopicsVO> topics) { |
| | | private Boolean getaBoolean(List<TopicsVO> topics,HouseholdEntity householdEntity) { |
| | | List<UserTopicsEntity> objects = new ArrayList<>(); |
| | | Boolean result = false; |
| | | for (TopicsVO topic : topics) { |
| | | UserTopicsEntity userTopicsEntity = new UserTopicsEntity(); |
| | | userTopicsEntity.setUserId(AuthUtil.getUserId()); |
| | | userTopicsEntity.setHouseholdId(householdEntity.getId()); |
| | | userTopicsEntity.setSelected(topic.getSelected()); |
| | | userTopicsEntity.setTopicsId(topic.getId()); |
| | | userTopicsEntity.setPublicDiscussId(topic.getPublicDiscussId()); |
| | |
| | | } |
| | | UserTopicsEntity userTopics = new UserTopicsEntity(); |
| | | userTopics.setSelected(topic.getSelected()); |
| | | userTopics.setUserId(AuthUtil.getUserId()); |
| | | userTopics.setHouseholdId(householdEntity.getId()); |
| | | userTopics.setPublicDiscussId(topic.getPublicDiscussId()); |
| | | userTopics.setTopicsId(Integer.valueOf(topic.getSelected())); |
| | | userTopics.setArticleId(topic.getArticleId()); |
| | |
| | | for (Object o : objects1) { |
| | | UserTopicsEntity userTopics = new UserTopicsEntity(); |
| | | userTopics.setSelected(topic.getSelected()); |
| | | userTopics.setUserId(AuthUtil.getUserId()); |
| | | userTopics.setHouseholdId(householdEntity.getId()); |
| | | userTopics.setPublicDiscussId(topic.getPublicDiscussId()); |
| | | userTopics.setArticleId(topic.getArticleId()); |
| | | userTopics.setHouseCode(topic.getHouseCode()); |
| | |
| | | public Integer getCount(Integer id) { |
| | | List<UserTopicsEntity> list = list(Wrappers.<UserTopicsEntity>lambdaQuery() |
| | | .eq(UserTopicsEntity::getPublicDiscussId, id) |
| | | .groupBy(UserTopicsEntity::getUserId)); |
| | | .groupBy(UserTopicsEntity::getHouseholdId)); |
| | | return list.size(); |
| | | } |
| | | |
| | |
| | | List<UserTopicsExcel> userTopicsExcels = baseMapper.exportUser(userTopics); |
| | | return userTopicsExcels; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean saveUserTopicsEntity(UserTopicsEntity userTopics) { |
| | | IHouseholdService householdService = SpringUtils.getBean(IHouseholdService.class); |
| | | HouseholdEntity householdEntity = householdService.getOne(Wrappers.<HouseholdEntity>lambdaQuery() |
| | | .eq(HouseholdEntity::getHouseCode, userTopics.getHouseCode()) |
| | | .eq(HouseholdEntity::getAssociatedUserId,AuthUtil.getUserId()) |
| | | .eq(HouseholdEntity::getIsDeleted,0) |
| | | .last("limit 1")); |
| | | if (householdEntity != null) { |
| | | userTopics.setHouseholdId(householdEntity.getId()); |
| | | } |
| | | return save(userTopics); |
| | | } |
| | | } |
| | |
| | | |
| | | private Integer topsCount; |
| | | |
| | | private Long UserId; |
| | | private Long householdId; |
| | | private String userName; |
| | | |
| | | private String houseCode; |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过小区id查询用户 |
| | | */ |
| | | @GetMapping("/getUserInfoByDistrictIds") |
| | | @ApiOperation(value = "通过小区id查询用户") |
| | | public R<IPage<HouseholdVO>> getUserInfoByDistrictIds(Query query,HouseholdVO householdVO) { |
| | | IPage<HouseholdVO> pages = householdService.getUserInfoByDistrictIds(householdVO, Condition.getPage(query)); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | @MapKey(value = "id") |
| | | Map<Integer, TreeIntegerNode> getlabelStatistics(@Param("household") HouseholdVO household); |
| | | |
| | | /** |
| | | * 多个小区id查询用户 |
| | | * |
| | | * @param list |
| | | * @return |
| | | */ |
| | | List<HouseholdVO> getUserInfoByDistrictIds(@Param("list") List<String> list, @Param("vo") HouseholdVO householdVO, IPage<HouseholdVO> page); |
| | | |
| | | } |
| | |
| | | and jl.parent_id != '1001' |
| | | </select> |
| | | |
| | | <select id="getUserInfoByDistrictIds" resultType="org.springblade.modules.house.vo.HouseholdVO"> |
| | | SELECT |
| | | jh.*, |
| | | jhe.house_name address, |
| | | jhe.building, |
| | | jhe.unit |
| | | FROM |
| | | jczz_household jh |
| | | LEFT JOIN jczz_house jhe ON jhe.house_code = jh.house_code |
| | | AND jh.is_deleted = 0 |
| | | LEFT JOIN jczz_district jd ON jd.aoi_code = jhe.district_code |
| | | <where> |
| | | and jd.id in |
| | | <foreach collection="list" index="index" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | and jh.relationship !=18 |
| | | <if test="vo.building != null and vo.building !=''"> |
| | | and jhe.building like concat('%',#{vo.building},'%') |
| | | </if> |
| | | <if test="vo.unit != null and vo.unit !=''"> |
| | | and jhe.unit like concat('%',#{vo.unit},'%') |
| | | </if> |
| | | <if test="vo.name != null and vo.name !=''"> |
| | | and jh.name like concat('%',#{vo.name},'%') |
| | | </if> |
| | | <if test="vo.phoneNumber != null and vo.phoneNumber !=''"> |
| | | and jh.phone_number like concat('%',#{vo.phoneNumber},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | List<HouseholdVO> getHouseholdListByParam(List<Integer> list); |
| | | |
| | | List<TreeIntegerNode> getlabelStatistics(HouseholdVO household); |
| | | |
| | | /** |
| | | * 通过小区id查询用户 |
| | | * @param districtIds |
| | | * @param building |
| | | * @param unit |
| | | * @param name |
| | | * @return |
| | | */ |
| | | IPage<HouseholdVO> getUserInfoByDistrictIds(HouseholdVO householdVO,IPage<HouseholdVO> page); |
| | | } |
| | |
| | | */ |
| | | package org.springblade.modules.house.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | node.setChildren(null); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 通过小区id查询用户 |
| | | * @param householdVO |
| | | * @param page |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<HouseholdVO> getUserInfoByDistrictIds(HouseholdVO householdVO, IPage<HouseholdVO> page) { |
| | | List<String> list = JSON.parseArray(householdVO.getDistrictIds()).toJavaList(String.class); |
| | | List<HouseholdVO> userInfoByDistrictIds = baseMapper.getUserInfoByDistrictIds(list, householdVO, page); |
| | | return page.setRecords(userInfoByDistrictIds); |
| | | } |
| | | |
| | | } |
| | |
| | | return R.data(userService.getUserInfoByDistrictId(districtId, building)); |
| | | } |
| | | |
| | | /** |
| | | * 通过小区id查询用户 |
| | | */ |
| | | @GetMapping("/getUserInfoByDistrictIds") |
| | | @ApiOperation(value = "通过小区id查询用户") |
| | | public R<IPage<HouseholdVO>> getUserInfoByDistrictIds(Query query,HouseholdVO householdVO) { |
| | | IPage<HouseholdVO> pages = userService.getUserInfoByDistrictIds(householdVO, Condition.getPage(query)); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | List<User> getUserInfoByPropertyId(String deptId, String roleId); |
| | | |
| | | /** |
| | | * 多个小区id查询用户 |
| | | * |
| | | * @param list |
| | | * @return |
| | | */ |
| | | List<HouseholdVO> getUserInfoByDistrictIds(@Param("list") List<String> list, @Param("vo") HouseholdVO householdVO, IPage<HouseholdVO> page); |
| | | |
| | | /** |
| | | * 通过机构查询用户 |
| | |
| | | ) |
| | | |
| | | </select> |
| | | <select id="getUserInfoByDistrictIds" resultType="org.springblade.modules.house.vo.HouseholdVO"> |
| | | |
| | | SELECT |
| | | jhe.house_name address, |
| | | bu.id, |
| | | bu.tenant_id, |
| | | bu.code, |
| | | bu.user_type, |
| | | bu.account, |
| | | jh.name, |
| | | bu.real_name, |
| | | bu.avatar, |
| | | bu.email, |
| | | bu.phone phoneNumber, |
| | | bu.birthday, |
| | | jhe.building, |
| | | jhe.unit |
| | | FROM |
| | | blade_user bu |
| | | LEFT JOIN jczz_household jh ON bu.id = jh.associated_user_id and jh.is_deleted=0 |
| | | LEFT JOIN jczz_house jhe ON jhe.house_code = jh.house_code |
| | | LEFT JOIN jczz_district jd on jd.aoi_code=jhe.district_code |
| | | <where> |
| | | and jd.id in |
| | | <foreach collection="list" index="index" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | and bu.is_deleted = 0 |
| | | and jh.relationship !=18 |
| | | <if test="vo.building != null and vo.building !=''"> |
| | | and jhe.building like concat('%',#{vo.building},'%') |
| | | </if> |
| | | <if test="vo.unit != null and vo.unit !=''"> |
| | | and jhe.unit like concat('%',#{vo.unit},'%') |
| | | </if> |
| | | <if test="vo.name != null and vo.name !=''"> |
| | | and jh.name like concat('%',#{vo.name},'%') |
| | | </if> |
| | | <if test="vo.phoneNumber != null and vo.phoneNumber !=''"> |
| | | and jh.phone_number like concat('%',#{vo.phoneNumber},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | <select id="selectUserByDept" resultMap="userResultMap"> |
| | |
| | | */ |
| | | void importPoliceUser(List<PoliceUserExcel> data); |
| | | |
| | | /** |
| | | * 通过小区id查询用户 |
| | | * @param districtIds |
| | | * @param building |
| | | * @param unit |
| | | * @param name |
| | | * @return |
| | | */ |
| | | IPage<HouseholdVO> getUserInfoByDistrictIds(HouseholdVO householdVO,IPage<HouseholdVO> page); |
| | | |
| | | /** |
| | | * 查询500M内的民警 |
| | |
| | | return baseMapper.getUserInfoByDistrictId(districtId, building); |
| | | } |
| | | |
| | | /** |
| | | * 通过小区id查询用户 |
| | | * |
| | | * @param districtIds |
| | | * @param building |
| | | * @param unit |
| | | * @param name |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<HouseholdVO> getUserInfoByDistrictIds(HouseholdVO householdVO, IPage<HouseholdVO> page) { |
| | | List<String> list = JSON.parseArray(householdVO.getDistrictIds()).toJavaList(String.class); |
| | | List<HouseholdVO> userInfoByDistrictIds = baseMapper.getUserInfoByDistrictIds(list, householdVO, page); |
| | | return page.setRecords(userInfoByDistrictIds); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 处理漏绑定的user_dept |