Merge remote-tracking branch 'origin/master'
| | |
| | | ) |
| | | </select> |
| | | |
| | | <!--户室map--> |
| | | <resultMap id="houseFuncNodeMap" type="org.springblade.modules.doorplateAddress.vo.FuncNode" autoMapping="true" > |
| | | <id column="id" property="id"/> |
| | | <collection property="householdLabelList" javaType="java.util.List" |
| | | ofType="org.springblade.modules.house.vo.HouseholdLabelVO" autoMapping="true"> |
| | | <id property="id" column="cid"/> |
| | | </collection> |
| | | </resultMap> |
| | | |
| | | <!--查询户室及住户相关信息,单元中包含住户--> |
| | | <select id="getUnitHouseholdList" resultType="org.springblade.modules.doorplateAddress.vo.FuncNode" > |
| | | <select id="getUnitHouseholdList" resultMap="houseFuncNodeMap" > |
| | | ( |
| | | select |
| | | ifnull(jda.unit_name,"未知单元") unitName,jda.unit_code unitCode,jda.floor,jda.house_name as houseNo, |
| | | jda.id,ifnull(jda.unit_name,"未知单元") unitName,jda.unit_code unitCode,jda.floor,jda.house_name as houseNo, |
| | | jda.address_code addressCode, |
| | | jh.name as realName,jh.role_type as roleType,1 as addressType |
| | | jh.name as realName,jh.relationship as roleType,1 as addressType, |
| | | juhl.id as cid,juhl.house_code,juhl.label_id,juhl.label_name,juhl.color,juhl.household_id |
| | | from jczz_doorplate_address jda |
| | | left join |
| | | (select house_code,name,role_type from jczz_household where role_type = 1) jh |
| | | ( |
| | | SELECT house_code, NAME, relationship FROM jczz_household WHERE id in( |
| | | SELECT max(id) FROM jczz_household where relationship = 1 GROUP BY house_code |
| | | ) |
| | | ) jh |
| | | on jda.address_code = jh.house_code |
| | | left join jczz_user_house_label juhl on juhl.house_code = jda.address_code and lable_type=1 |
| | | where 1=1 |
| | | and floor != '' |
| | | and house_name != '' |
| | |
| | | ) |
| | | union all |
| | | ( |
| | | select '' as unitName,address_code as unitCode,doorplate_name as floor,'' as houseNo,address_code as addressCode, |
| | | '' as realName,'' as roleType,2 as addressType |
| | | from jczz_doorplate_address |
| | | select jda2.id,'' as unitName,address_code as unitCode,doorplate_name as floor,'' as houseNo,address_code as addressCode, |
| | | '' as realName,'' as roleType,2 as addressType, |
| | | juhl.id as cid,juhl.house_code,juhl.label_id,juhl.label_name,juhl.color,juhl.household_id |
| | | from jczz_doorplate_address jda2 |
| | | left join jczz_user_house_label juhl on juhl.house_code = jda2.address_code and lable_type=1 |
| | | where 1=1 |
| | | and building_code = #{houseParam.code} |
| | | and building_name != '' |
| | |
| | | package org.springblade.modules.doorplateAddress.vo; |
| | | |
| | | import lombok.Data; |
| | | import org.springblade.modules.house.vo.HouseholdLabelVO; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class FuncNode implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| | | /** |
| | | * 单元编号 |
| | |
| | | */ |
| | | private List<FuncNode> children = new ArrayList<>(); |
| | | |
| | | /** |
| | | * 标签 |
| | | */ |
| | | private List<HouseholdLabelVO> householdLabelList = new ArrayList<>(); |
| | | |
| | | } |
| | |
| | | */ |
| | | @ApiModelProperty(value = "被访人用户id") |
| | | private Long householdId; |
| | | |
| | | /** |
| | | * 被访人姓名 |
| | | */ |
| | | @ApiModelProperty(value = "被访人姓名") |
| | | private String name; |
| | | /** |
| | | * 被访人电话 |
| | | */ |
| | | @ApiModelProperty(value = "被访人电话") |
| | | private String phone; |
| | | // |
| | | // /** |
| | | // * 被访人姓名 |
| | | // */ |
| | | // @ApiModelProperty(value = "被访人姓名") |
| | | // private String name; |
| | | // /** |
| | | // * 被访人电话 |
| | | // */ |
| | | // @ApiModelProperty(value = "被访人电话") |
| | | // private String phone; |
| | | /** |
| | | * 内容 |
| | | */ |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ColumnWidth(15) |
| | | @ExcelProperty("社区名称") |
| | | @ExcelProperty("社区网格名称") |
| | | private String communityName; |
| | | |
| | | |
| | | @ColumnWidth(15) |
| | | @ExcelProperty("网格名称") |
| | | private String gridName; |
| | | @ExcelProperty("网格编号") |
| | | private String gridCode; |
| | | |
| | | /** |
| | | * 网格员名称 |
| | | */ |
| | | @ApiModelProperty(value = "网格员姓名") |
| | | private String gridmanName; |
| | | /** |
| | | * 手机号 |
| | | */ |
| | | @ApiModelProperty(value = "联系电话") |
| | | private String mobile; |
| | | |
| | | /** |
| | | * 备注 |
| | | * 网格员电话 |
| | | */ |
| | | @ColumnWidth(50) |
| | | @ExcelProperty("备注") |
| | | private String remark; |
| | | @ApiModelProperty(value = "网格员电话") |
| | | private String mobile; |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.flowable.idm.engine.impl.persistence.entity.UserEntity; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | |
| | | } |
| | | //插入网格员信息 |
| | | gridman.setUserId(user.getId()); |
| | | flag = save(gridman); |
| | | //匹配 |
| | | QueryWrapper<GridmanEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("is_deleted",0) |
| | | .eq("grid_id",gridman.getGridId()) |
| | | .eq("user_id",gridman.getUserId()); |
| | | GridmanEntity one = getOne(queryWrapper); |
| | | if (null==one){ |
| | | flag = save(gridman); |
| | | } |
| | | } else { |
| | | saveUser(gridman); |
| | | // 插入网格员信息 |
| | | flag = save(gridman); |
| | | //匹配 |
| | | QueryWrapper<GridmanEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("is_deleted",0) |
| | | .eq("grid_id",gridman.getGridId()) |
| | | .eq("user_id",gridman.getUserId()); |
| | | GridmanEntity one = getOne(queryWrapper); |
| | | if (null==one){ |
| | | flag = save(gridman); |
| | | } |
| | | } |
| | | } |
| | | // 返回 |
| | |
| | | * @param isCovered |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void importGridman(List<GridmanExcel> data, Boolean isCovered) { |
| | | // 遍历 |
| | | for (GridmanExcel gridmanExcel : data) { |
| | | GridmanEntity gridmanEntity = Objects.requireNonNull(BeanUtil.copy(gridmanExcel, GridmanEntity.class)); |
| | | // 先查询当前网格社区对应的机构id |
| | | QueryWrapper<Region> regionWrapper = new QueryWrapper<>(); |
| | | regionWrapper.eq("name",gridmanExcel.getCommunityName()); |
| | | Region region = regionService.getOne(regionWrapper); |
| | | // 通过社区名称和网格名称获取网格id |
| | | QueryWrapper<GridEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("is_deleted",0) |
| | | .eq("community_code",region.getCode()) |
| | | .eq("grid_name",gridmanExcel.getGridName()); |
| | | .eq("grid_code",gridmanExcel.getGridCode()); |
| | | GridEntity gridEntity = gridService.getOne(queryWrapper); |
| | | // 设置网格id |
| | | gridmanEntity.setGridId(gridEntity.getId()); |
| | | // 通过手机号查询网格员id |
| | | QueryWrapper<GridmanEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("is_deleted",0).eq("mobile",gridmanEntity.getMobile()); |
| | | GridmanEntity one = getOne(wrapper); |
| | | if (one!=null){ |
| | | gridmanEntity.setId(one.getId()); |
| | | } |
| | | // 插入网格员 |
| | | saveOrUpdateGridman(gridmanEntity); |
| | | if (!Strings.isBlank(gridmanExcel.getMobile())) { |
| | | saveOrUpdateGridman(gridmanEntity); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.springblade.modules.grid.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.springblade.modules.grid.entity.GridWorkLogEntity; |
| | | import org.springblade.core.tool.node.INode; |
| | | import lombok.Data; |
| | |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class GridWorkLogVO extends GridWorkLogEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | /** |
| | | * 被访人姓名 |
| | | */ |
| | | @ApiModelProperty(value = "被访人姓名") |
| | | private String name; |
| | | /** |
| | | * 被访人电话 |
| | | */ |
| | | @ApiModelProperty(value = "被访人电话") |
| | | private String phone; |
| | | /** |
| | | * 被访人地址 |
| | | */ |
| | | @ApiModelProperty(value = "被访人地址") |
| | | private String address; |
| | | |
| | | } |
| | |
| | | */ |
| | | package org.springblade.modules.house.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.entity.UserHouseLabelEntity; |
| | | import org.springblade.modules.house.excel.HouseHoldExcel; |
| | | import org.springblade.modules.house.excel.HouseHoldImporter; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | import org.springblade.modules.house.service.IUserHouseLabelService; |
| | | import org.springblade.modules.house.vo.HouseholdVO; |
| | | import org.springblade.modules.house.wrapper.HouseholdWrapper; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | public class HouseholdController extends BladeController { |
| | | |
| | | private final IHouseholdService householdService; |
| | | private final IUserHouseLabelService userHouseLabelService; |
| | | |
| | | /** |
| | | * 住户 详情 |
| | |
| | | @PostMapping("/remove") |
| | | @ApiOperationSupport(order = 7) |
| | | @ApiOperation(value = "逻辑删除", notes = "传入ids") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
| | | return R.status(householdService.removeByIds(Func.toLongList(ids))); |
| | | List<Long> idList = Func.toLongList(ids); |
| | | boolean removeByIds = householdService.removeByIds(idList); |
| | | // 同时删除当前住户对应的标签 |
| | | removeHouseholdLabel(idList); |
| | | // 返回 |
| | | return R.status(removeByIds); |
| | | } |
| | | |
| | | /** |
| | | * 删除住户标签信息 |
| | | * @param idList |
| | | */ |
| | | public void removeHouseholdLabel(List<Long> idList) { |
| | | for (Long id : idList) { |
| | | QueryWrapper<UserHouseLabelEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("household_id",id); |
| | | userHouseLabelService.remove(wrapper); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | left join jczz_user_house_label jhl on jh.id = jhl.household_id |
| | | where 1=1 and jh.is_deleted = 0 |
| | | and jh.house_code = #{code} |
| | | order by jh.relationship asc,jh.id desc |
| | | </select> |
| | | |
| | | <!--查询房屋集合信息-按id--> |
| | |
| | | UserHouseLabelEntity userHouseLabelEntity = new UserHouseLabelEntity(); |
| | | userHouseLabelEntity.setLabelId(BigDecimal.valueOf(one1.getId()).longValue()); |
| | | userHouseLabelEntity.setHouseholdId(householdEntity.getId()); |
| | | // 设置默认的绿色 |
| | | userHouseLabelEntity.setColor("#30D17C"); |
| | | userHouseLabelEntity.setLableType(1); |
| | | userHouseLabelEntity.setLabelName(s); |
| | | userHouseLabelEntity.setHouseCode(houseAndHoldExcel.getHouseCode()); |
| | |
| | | } |
| | | // 户籍类型 |
| | | if (!Strings.isBlank(houseAndHoldExcel.getResidentType())){ |
| | | one.setResidentType(Integer.parseInt(houseAndHoldExcel.getResidentType())); |
| | | one.setResidentType(Integer.parseInt(houseAndHoldExcel.getResidentType().trim())); |
| | | } |
| | | // 户籍地区县 |
| | | if (!Strings.isBlank(houseAndHoldExcel.getResidentAdcode())){ |
| | |
| | | userHouseLabelEntity.setHouseholdId(one.getId()); |
| | | userHouseLabelEntity.setLableType(1); |
| | | userHouseLabelEntity.setLabelName(s); |
| | | // 设置默认的绿色 |
| | | userHouseLabelEntity.setColor("#30D17C"); |
| | | userHouseLabelEntity.setHouseCode(houseAndHoldExcel.getHouseCode()); |
| | | bean.save(userHouseLabelEntity); |
| | | } |