src/main/java/org/springblade/common/node/TreeIntegerNode.java
@@ -31,6 +31,11 @@ private String name; /** * 排序 */ private Integer sort; /** * 父节点ID */ @JsonSerialize(using = ToStringSerializer.class) src/main/java/org/springblade/modules/house/controller/UserHouseLabelController.java
@@ -17,24 +17,31 @@ 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 io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import lombok.AllArgsConstructor; import javax.validation.Valid; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.excel.util.ExcelUtil; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.modules.house.entity.UserHouseLabelEntity; import org.springblade.modules.house.excel.UserHouseLabelExcel; import org.springblade.modules.house.excel.UserHouseLabelImporter; import org.springblade.modules.house.service.IUserHouseLabelService; import org.springblade.modules.house.vo.HouseholdLabelVO; import org.springblade.modules.house.wrapper.HouseholdLabelWrapper; import org.springblade.modules.house.service.IUserHouseLabelService; import org.springblade.core.boot.ctrl.BladeController; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.util.ArrayList; import java.util.List; /** * 住户-标签 控制器 @@ -140,11 +147,34 @@ @PostMapping("/removeHouseholdLabel") public R removeHouseholdLabel(@RequestBody UserHouseLabelEntity householdLabel) { QueryWrapper<UserHouseLabelEntity> wrapper = new QueryWrapper<>(); wrapper.eq("household_id",householdLabel.getHouseholdId()) .eq("label_id",householdLabel.getLabelId()); wrapper.eq("household_id", householdLabel.getHouseholdId()) .eq("label_id", householdLabel.getLabelId()); // 返回 return R.status(householdLabelService.remove(wrapper)); } /** * 导入用户 */ @PostMapping("import-userHouseLabel") @ApiOperationSupport(order = 12) @ApiOperation(value = "标签住户导入", notes = "传入excel") public R importUser(MultipartFile file, @RequestParam(value = "isCovered", defaultValue = "0") Integer isCovered) { UserHouseLabelImporter userHouseLabelImporter = new UserHouseLabelImporter(householdLabelService, isCovered == 1); ExcelUtil.save(file, userHouseLabelImporter, UserHouseLabelExcel.class); return R.success("操作成功"); } /** * 导出模板 */ @GetMapping("export-userHouseLabel") @ApiOperationSupport(order = 14) @ApiOperation(value = "导出标签住户模板") public void exportUser(HttpServletResponse response) { List<UserHouseLabelExcel> list = new ArrayList<>(); ExcelUtil.export(response, "标签住户数据模板", "标签住户数据表", list, UserHouseLabelExcel.class); } } src/main/java/org/springblade/modules/house/entity/UserHouseLabelEntity.java
@@ -83,6 +83,6 @@ /** 住户id */ @ApiModelProperty(value = "住户id", example = "") @TableField("household_id") private Long householdId; private Integer householdId; } src/main/java/org/springblade/modules/house/excel/UserHouseLabelExcel.java
New file @@ -0,0 +1,61 @@ package org.springblade.modules.house.excel; import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.alibaba.excel.annotation.write.style.ContentRowHeight; import com.alibaba.excel.annotation.write.style.HeadRowHeight; import lombok.Data; import java.io.Serializable; /** * HouseExcel * * @author Chill */ @Data @ColumnWidth(25) @HeadRowHeight(20) @ContentRowHeight(18) public class UserHouseLabelExcel implements Serializable { private static final long serialVersionUID = 2L; /** 门牌地址编码 */ @ExcelProperty( "门牌地址编码") private String houseCode; /** 标签ID */ @ExcelProperty( "标签ID") private Long labelId; /** 标签名称 */ @ExcelProperty( "标签名称") private String labelName; /** 颜色 */ @ExcelProperty( "颜色") private String color; /** 备注 */ @ExcelProperty( "备注") private String remark; /** 用户id */ @ExcelProperty( "用户id") private Long userId; // /** 标签类型:1:人:2房屋 */ // @ExcelProperty( "标签类型:1:人:2房屋") // private Integer lableType; /** 住户id */ @ExcelProperty( "住户id") private Integer householdId; } src/main/java/org/springblade/modules/house/excel/UserHouseLabelImporter.java
New file @@ -0,0 +1,42 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.modules.house.excel; import lombok.RequiredArgsConstructor; import org.springblade.core.excel.support.ExcelImporter; import org.springblade.modules.house.service.IUserHouseLabelService; import org.springblade.modules.system.excel.UserExcel; import org.springblade.modules.system.service.IUserService; import java.util.List; /** * 用户数据导入类 * * @author Chill */ @RequiredArgsConstructor public class UserHouseLabelImporter implements ExcelImporter<UserHouseLabelExcel> { private final IUserHouseLabelService householdLabelService; private final Boolean isCovered; @Override public void save(List<UserHouseLabelExcel> data) { householdLabelService.importUserHouseLabel(data, isCovered); } } src/main/java/org/springblade/modules/house/service/IUserHouseLabelService.java
@@ -19,8 +19,10 @@ import com.baomidou.mybatisplus.extension.service.IService; import org.springblade.modules.house.dto.UserHouseLabelDTO; import org.springblade.modules.house.entity.UserHouseLabelEntity; import org.springblade.modules.house.excel.UserHouseLabelExcel; import org.springblade.modules.house.vo.HouseholdLabelVO; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.modules.system.excel.UserExcel; import java.util.List; @@ -50,4 +52,6 @@ List<Integer> selectUserLabelList(UserHouseLabelDTO userHouseLabelDTO); void importUserHouseLabel(List<UserHouseLabelExcel> data, Boolean isCovered); } src/main/java/org/springblade/modules/house/service/impl/UserHouseLabelServiceImpl.java
@@ -18,8 +18,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.modules.house.dto.UserHouseLabelDTO; import org.springblade.modules.house.entity.HouseholdEntity; import org.springblade.modules.house.entity.UserHouseLabelEntity; import org.springblade.modules.house.excel.UserHouseLabelExcel; import org.springblade.modules.house.vo.HouseholdLabelVO; import org.springblade.modules.house.mapper.UserHouseLabelMapper; import org.springblade.modules.house.service.IUserHouseLabelService; @@ -30,6 +33,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import java.util.List; import java.util.Objects; /** * 住户-标签 服务实现类 @@ -78,4 +82,12 @@ List<Integer> userLabelList = baseMapper.getUserLabelList(userHouseLabelDTO); return userLabelList; } @Override public void importUserHouseLabel(List<UserHouseLabelExcel> data, Boolean isCovered) { data.forEach(houseHoldExcel -> { UserHouseLabelEntity userHouseLabelEntity = Objects.requireNonNull(BeanUtil.copy(houseHoldExcel, UserHouseLabelEntity.class)); this.save(userHouseLabelEntity); }); } } src/main/java/org/springblade/modules/label/controller/LabelController.java
@@ -25,6 +25,7 @@ import org.springblade.common.node.TreeIntegerNode; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springblade.modules.label.entity.LabelEntity; @@ -132,6 +133,7 @@ @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入label") public R submit(@Valid @RequestBody LabelEntity label) { label.setCreateUser(AuthUtil.getUserId()); return R.status(labelService.saveOrUpdate(label)); } src/main/java/org/springblade/modules/label/entity/LabelEntity.java
@@ -16,19 +16,17 @@ */ package org.springblade.modules.label.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.*; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import lombok.Data; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.util.Date; import lombok.EqualsAndHashCode; import org.springblade.core.tenant.mp.TenantEntity; /** * 标签管理 实体类 @@ -42,33 +40,58 @@ public class LabelEntity implements Serializable { private static final long serialVersionUID = 1L; /** * 主键 */ @JsonSerialize(using = ToStringSerializer.class) @ApiModelProperty("主键id") /** 标签ID */ @ApiModelProperty(value = "主键ID", example = "") @TableId(value = "id", type = IdType.AUTO) private Integer id; /** * 父级id */ @ApiModelProperty(value = "父级id") /** 父级id */ @ApiModelProperty(value = "父级id", example = "") @TableField("parent_id") private Integer parentId; /** * 标签名称 */ @ApiModelProperty(value = "标签名称") /** 标签名称 */ @ApiModelProperty(value = "标签名称", example = "") @TableField("label_name") private String labelName; /** * 排序 */ @ApiModelProperty(value = "排序") /** 排序 */ @ApiModelProperty(value = "排序", example = "") @TableField("sort") private Integer sort; /** * 备注 */ @ApiModelProperty(value = "备注") /** 是否删除 0否,1是 */ @ApiModelProperty(value = "是否删除 0否,1是", example = "") @TableField("is_deleted") @TableLogic private Integer isDeleted; /** 创建人 */ @ApiModelProperty(value = "创建人", example = "") @TableField("create_user") private Long createUser; /** 创建时间 */ @ApiModelProperty(value = "创建时间", example = "") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @TableField(value = "create_time",fill = FieldFill.INSERT) private Date createTime; /** 更新人 */ @ApiModelProperty(value = "更新人", example = "") @TableField("update_user") private Long updateUser; /** 更新时间 */ @ApiModelProperty(value = "更新时间", example = "") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @TableField("update_time") private Date updateTime; /** 备注 */ @ApiModelProperty(value = "备注", example = "") @TableField("remark") private String remark; } src/main/java/org/springblade/modules/label/mapper/LabelMapper.xml
@@ -29,7 +29,7 @@ <select id="getLabelTreeList" resultType="org.springblade.common.node.TreeIntegerNode"> select id as id,parent_id as parentId,label_name as name FROM jczz_label where is_deleted = 0 select id as id,parent_id as parentId,label_name as name, sort FROM jczz_label where is_deleted = 0 </select> src/main/java/org/springblade/modules/task/controller/TaskLabelReportingEventController.java
@@ -59,7 +59,7 @@ @ApiOperation(value = "详情", notes = "传入taskLabelReportingEvent") public R<TaskLabelReportingEventVO> detail(TaskLabelReportingEventEntity taskLabelReportingEvent) { TaskLabelReportingEventEntity detail = taskLabelReportingEventService.getOne(Condition.getQueryWrapper(taskLabelReportingEvent)); return R.data(TaskLabelReportingEventWrapper.build().entityVO(detail)); return R.data(TaskLabelReportingEventWrapper.build(). entityVO(detail)); } /** * 打金店报事 分页