| | |
| | | <version>1.5.5.Final</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoBa; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.dy.common.po.BaseEntity; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.*; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | /** |
| | | * 取水口实体 |
| | | */ |
| | | @TableName(value = "ba_intake", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "取水口实体") |
| | | public class BaIntake implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 202312010953001L; |
| | | |
| | | @JSONField(serializeUsing = ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Long id; |
| | | |
| | | /** |
| | | * 取水口名称或编号 |
| | | */ |
| | | @Schema(description = "取水口名称或编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "取水口名称或编号不能为空") //不能为空也不能为null |
| | | @Length(message = "取水口名称或编号不大于{max}字,不小于{min}字", min = 1, max = 25) |
| | | public String name; |
| | | |
| | | /** |
| | | * 外键,指向片区 |
| | | */ |
| | | @JSONField(serializeUsing = ObjectWriterImplToString.class) |
| | | @Schema(description = "所在片区ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "所在片区不能为空") //不能为null |
| | | public Long blockId; |
| | | |
| | | /** |
| | | * 外键,指向分水口 |
| | | */ |
| | | @JSONField(serializeUsing = ObjectWriterImplToString.class) |
| | | @Schema(description = "所在分水口ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "所在分水口不能为空") //不能为null |
| | | public Long divideId; |
| | | |
| | | /** |
| | | * 负责人 |
| | | */ |
| | | @Schema(description = "负责人", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "负责人不大于{max}字,不小于{min}字", min = 1, max = 25) |
| | | public String header; |
| | | |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | @Schema(description = "联系电话", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "联系电话不能为空") //不能为空也不能为null |
| | | @Length(message = "联系电话必须{max}位数据", min = 11, max = 11) |
| | | public String phone; |
| | | |
| | | /** |
| | | * 外键,指向行政区 |
| | | */ |
| | | @JSONField(serializeUsing = ObjectWriterImplToString.class) |
| | | @Schema(description = "所在县ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "所在县不能为空") //不能为空也不能为null |
| | | public Long countyId; |
| | | |
| | | /** |
| | | * 外键,指向行政区 |
| | | */ |
| | | @JSONField(serializeUsing = ObjectWriterImplToString.class) |
| | | @Schema(description = "所在镇ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "所在镇不能为空") //不能为空也不能为null |
| | | public Long townId; |
| | | |
| | | /** |
| | | * 外键,指向行政区 |
| | | */ |
| | | @JSONField(serializeUsing = ObjectWriterImplToString.class) |
| | | @Schema(description = "所在村ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "所在村不能为空") //不能为空也不能为null |
| | | public Long villageId; |
| | | |
| | | /** |
| | | * 经度 |
| | | */ |
| | | @Schema(description = "经度", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Double lng; |
| | | |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | @Schema(description = "纬度", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Double lat; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "备注不大于{max}字,不小于{min}字", min = 1, max = 50) |
| | | public String remark; |
| | | |
| | | /** |
| | | * 删除标志 |
| | | */ |
| | | @Schema(description = "删除标识,表单不用填写", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Byte deleted; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoBa; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.dy.common.po.BaseEntity; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.*; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | /** |
| | | * 控制器实体,RTU阀控一体机 |
| | | */ |
| | | @TableName(value = "ba_intake", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Schema(name = "RTU阀控一体机实体") |
| | | public class BaRTU implements BaseEntity { |
| | | |
| | | public static final long serialVersionUID = 202312011021001L; |
| | | |
| | | @JSONField(serializeUsing = ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Long id; |
| | | |
| | | /** |
| | | * 控制器编号 |
| | | */ |
| | | @Schema(description = "控制器编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "控制器编号不能为空") //不能为空也不能为null |
| | | @Length(message = "控制器编号不大于{max}字,不小于{min}字", min = 1, max = 25) |
| | | public String num; |
| | | |
| | | /** |
| | | * 外键,指向取水口 |
| | | */ |
| | | @JSONField(serializeUsing = ObjectWriterImplToString.class) |
| | | @Schema(description = "所在取水口ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "所在取水口不能为空") //不能为null |
| | | public Long intakeId; |
| | | |
| | | /** |
| | | * 外键,指向农户(用水户) |
| | | */ |
| | | @JSONField(serializeUsing = ObjectWriterImplToString.class) |
| | | @Schema(description = "所属农户ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "所属农户不能为空") //不能为null |
| | | public Long clientId; |
| | | |
| | | /** |
| | | * 负责人 |
| | | */ |
| | | @Schema(description = "负责人", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "负责人不大于{max}字,不小于{min}字", min = 1, max = 25) |
| | | public String header; |
| | | |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | @Schema(description = "联系电话", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "联系电话不能为空") //不能为空也不能为null |
| | | @Length(message = "联系电话必须{max}位数据", min = 11, max = 11) |
| | | public String phone; |
| | | |
| | | /** |
| | | * 开关阀 |
| | | */ |
| | | @Schema(description = "开关阀", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "0关阀,1开阀") //不能为空也不能为null |
| | | @Length(message = "联系电话必须{max}位数据", min = 1, max = 1) |
| | | public Byte isOpen; |
| | | |
| | | /** |
| | | * 控制器名称 |
| | | */ |
| | | @Schema(description = "控制器名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotEmpty(message = "控制器名称非必填") //不能为空也不能为null |
| | | @Length(message = "控制器名称不大于{max}字,不小于{min}字", min = 1, max = 25) |
| | | public String name; |
| | | |
| | | /** |
| | | * 厂家名称 |
| | | */ |
| | | @Schema(description = "厂家名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotEmpty(message = "厂家名称非必填") //不能为空也不能为null |
| | | @Length(message = "厂家名称不大于{max}字,不小于{min}字", min = 1, max = 25) |
| | | public String manufacturer; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "备注不大于{max}字,不小于{min}字", min = 1, max = 50) |
| | | public String remark; |
| | | |
| | | /** |
| | | * 删除标志 |
| | | */ |
| | | @Schema(description = "删除标识,表单不用填写", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Byte deleted; |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.dy.common.mybatis.envm.Deleted; |
| | | import com.dy.common.mybatis.envm.Disabled; |
| | | import com.dy.common.po.BaseEntity; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.Max; |
| | | import jakarta.validation.constraints.Min; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import lombok.*; |
| | | import org.hibernate.validator.constraints.Length; |
| | |
| | | * 是否禁用 0:否,1:是 |
| | | */ |
| | | @Schema(description = "是否禁用", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Max(message = "是否禁用只能0或1", value = 1) |
| | | @Min(message = "是否禁用只能0或1",value = 0) |
| | | public Disabled disabled; |
| | | |
| | | /** |
| | |
| | | @TableField(exist = false) |
| | | public List<Integer> privileges; |
| | | //public transient List<Integer> privileges;//此种方式变量不存库, 也不参与序列化了 |
| | | |
| | | /** |
| | | * 用户所属角色Id |
| | | */ |
| | | @TableField(exist = false) |
| | | public String[] roleIds ; |
| | | } |
| | |
| | | |
| | | <packaging>jar</packaging> |
| | | <artifactId>pipIrr-mw-accept</artifactId> |
| | | <version>1.0.0</version> |
| | | <name>pipIrr-mw-accept</name> |
| | | <description>通信中间件</description> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-json</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-logging</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <!-- 系统监管 --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-actuator</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- api在线文档 https://springdoc.org/#modules--> |
| | | <dependency> |
| | | <groupId>org.springdoc</groupId> |
| | | <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springdoc</groupId> |
| | | <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springdoc</groupId> |
| | | <artifactId>springdoc-openapi-security</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- 动态加载新编译的类 --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-devtools</artifactId> |
| | | <scope>runtime</scope> |
| | | </dependency> |
| | | |
| | | <!--mysql驱动--> |
| | | <dependency> |
| | | <groupId>com.mysql</groupId> |
| | | <artifactId>mysql-connector-j</artifactId> |
| | | <version>8.0.33</version> |
| | | </dependency> |
| | | <!--druid-spring-boot连接池--> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>druid-spring-boot-starter</artifactId> |
| | | <version>1.2.20</version> |
| | | </dependency> |
| | | <!--mybatis-plus-spring-boot--> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-boot-starter</artifactId> |
| | | <version>3.5.3.2</version> |
| | | </dependency> |
| | | |
| | | <!-- bean和map互转换 --> |
| | | <dependency> |
| | | <groupId>org.apache.dubbo</groupId> |
| | | <artifactId>dubbo</artifactId> |
| | | <version>3.2.7</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>io.netty</groupId> |
| | | <artifactId>netty-all</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.yaml</groupId> |
| | | <artifactId>snakeyaml</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-context</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>com.alibaba.spring</groupId> |
| | | <artifactId>spring-context-support</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>com.alibaba.fastjson2</groupId> |
| | | <artifactId>fastjson2</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>hessian-lite</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.javassist</groupId> |
| | | <artifactId>javassist</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <!-- apache mina --> |
| | | <dependency> |
| | | <groupId>org.apache.mina</groupId> |
| | | <artifactId>mina-core</artifactId> |
| | | <version>2.2.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.mina</groupId> |
| | | <artifactId>mina-filter-compression</artifactId> |
| | | <version>2.2.1</version> |
| | | <version>2.2.2</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-api</artifactId> |
| | | <version>2.0.7</version> |
| | | </dependency> |
| | | |
| | | <!-- 测试 --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | </project> |
| | |
| | | import jakarta.validation.Valid; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | private UserSv sv ; |
| | | |
| | | @Value("${user.defaultPassword:ABC123}") |
| | | private String defaultPassword; |
| | | |
| | | @Autowired |
| | | private void setSv(UserSv sv){ |
| | | this.sv = sv ; |
| | |
| | | |
| | | /** |
| | | * 客户端请求得到所有用户数据 |
| | | * |
| | | * @return 所有用户数据 |
| | | */ |
| | | @Operation(summary = "获得一页用户", description = "返回一页用户数据") |
| | |
| | | |
| | | /** |
| | | * 得到一个用户数据 |
| | | * |
| | | * @return 一个用户数据 |
| | | */ |
| | | @Operation(summary = "一个用户", description = "得到一个用户数据") |
| | |
| | | |
| | | /** |
| | | * 保存用户 |
| | | * |
| | | * @param po 保存用户form表单对象 |
| | | * @return 是否成功 |
| | | */ |
| | |
| | | } |
| | | po.id = null ; |
| | | int count; |
| | | int count1; |
| | | try { |
| | | po.disabled = Disabled.NO ;//默认不禁用 |
| | | po.deleted = Deleted.NO ;//默认不删除 |
| | |
| | | po.password = new String(Base64.getDecoder().decode(po.password)) ; |
| | | */ |
| | | po.password = MD5.encrypt(po.password) ;//进行加密码 |
| | | } else { |
| | | po.password = MD5.encrypt(defaultPassword); |
| | | } |
| | | count = this.sv.save(po); |
| | | count1 = this.sv.setRoles(String.valueOf(po.id), po.roleIds); |
| | | } catch (Exception e) { |
| | | log.error("保存用户异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | if(count <= 0){ |
| | | if (count <= 0 || count1 <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败") ; |
| | | }else{ |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | |
| | | |
| | | /** |
| | | * 编辑修改用户 |
| | | * |
| | | * @param po 保存用户form表单对象 |
| | | * @return 是否成功 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 修改密码 |
| | | * |
| | | * @param id 用户ID |
| | | * @return 是否成功 |
| | | */ |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 重置密码为默认值 |
| | | * |
| | | * @param id 用户ID |
| | | * @return 是否成功 |
| | | */ |
| | | @Operation(summary = "重置密码", description = "提交用户ID") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "resetPassword", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | public BaseResponse<Boolean> resetPassword(@Parameter(description = "实体id", required = true) String id) throws Exception { |
| | | if (id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | | } |
| | | String password = MD5.encrypt(defaultPassword);//进行加密码 |
| | | Long idLg = Long.parseLong(id); |
| | | int count; |
| | | try { |
| | | BaUser po = this.sv.selectById(idLg); |
| | | if (Objects.isNull(po)) { |
| | | return BaseResponseUtils.buildFail("未得到用户,请求失败"); |
| | | } else { |
| | | count = this.sv.changePassword(idLg, password); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("保存用户异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 重置密码为随机数字加字母 |
| | | * |
| | | * @param id 用户ID |
| | | * @return 是否成功 |
| | | */ |
| | | @Operation(summary = "重置密码", description = "提交用户ID") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "resetPassword1", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | public BaseResponse<String> resetPassword1(@Parameter(description = "实体id", required = true) String id) throws Exception { |
| | | if (id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | | } |
| | | String randomPassword = this.sv.getStringRandom(6); |
| | | String password = MD5.encrypt(randomPassword);//进行加密码 |
| | | Long idLg = Long.parseLong(id); |
| | | int count; |
| | | try { |
| | | BaUser po = this.sv.selectById(idLg); |
| | | if (Objects.isNull(po)) { |
| | | return BaseResponseUtils.buildFail("未得到用户,请求失败"); |
| | | } else { |
| | | count = this.sv.changePassword(idLg, password); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("保存用户异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | | return BaseResponseUtils.buildSuccess(randomPassword); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置用户角色 |
| | | * |
| | | * @param id 用户ID |
| | | * @return 是否成功 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 删除用户 |
| | | * |
| | | * @param id 用户ID |
| | | * @return 是否成功 |
| | | */ |
| | |
| | | import com.dy.pipIrrGlobal.pojoBa.BaUser; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaUserRole; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.apache.dubbo.common.utils.PojoUtils ; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import java.util.Random; |
| | | |
| | | @Slf4j |
| | | @Service |
| | |
| | | |
| | | /** |
| | | * 得到一个用户 |
| | | * |
| | | * @param id 用户ID |
| | | * @return 用户实体 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 得到一个用户 |
| | | * |
| | | * @param vo 查询条件值对象 |
| | | * @return 用户实体 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 保存实体 |
| | | * |
| | | * @param po 实体 |
| | | * @return 影响记录数量 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 保存修改实体 |
| | | * |
| | | * @param po 实体 |
| | | * @return 影响记录数量 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 修改密码 |
| | | * |
| | | * @param id 用户ID |
| | | * @param password 新密码 |
| | | * @return 影响记录数量 |
| | |
| | | |
| | | /** |
| | | * 设置用户角色 |
| | | * |
| | | * @param userId 用户id |
| | | * @param roleIds 选择的角色id集合 |
| | | * @return 插入用户与角色关联记录数量 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 设置用户角色 |
| | | * |
| | | * @param userId 用户id |
| | | * @param roleIds 选择的角色id集合 |
| | | * @return 插入用户与角色关联记录数量 |
| | | */ |
| | | public int setRoles(String userId, String[] roleIds) { |
| | | this.urDao.deleteByUserId(Long.parseLong(userId)); |
| | | int count = 0; |
| | | if (roleIds != null && roleIds.length > 0) { |
| | | for (String roleId : roleIds) { |
| | | count += this.urDao.insertSelective(new BaUserRole(Long.parseLong(userId), Long.parseLong(roleId))); |
| | | } |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | /** |
| | | * 保存修改实体 |
| | | * |
| | | * @param id 实体ID |
| | | * @return 影响记录数量 |
| | | */ |
| | |
| | | return this.dao.deleteLogicById(id) ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 生成指定位数随机数字密码 |
| | | * |
| | | * @param length 多长随机数 |
| | | * @return 随机数 |
| | | */ |
| | | public String getStringRandom(int length) { |
| | | String val = ""; |
| | | Random random = new Random(); |
| | | for (int i = 0; i < length; i++) { |
| | | String charOrNum = random.nextInt(2) % 2 == 0 ? "char" : "num"; |
| | | if ("char".equalsIgnoreCase(charOrNum)) { |
| | | int temp = random.nextInt(2) % 2 == 0 ? 65 : 97; |
| | | val += (char) (random.nextInt(26) + temp); |
| | | } else if ("num".equalsIgnoreCase(charOrNum)) { |
| | | val += String.valueOf(random.nextInt(10)); |
| | | } |
| | | } |
| | | return val; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | spring: |
| | | profiles: |
| | | include: global, database, database-ym, database-pj |
| | | user: |
| | | defaultPassword: "ABC123" |
| | | |
| | | #actutor的web端口 |
| | | management: |
| | |
| | | <mapstruct.version>1.5.5.Final</mapstruct.version> |
| | | <hutool-all.version>5.8.22</hutool-all.version> |
| | | <org-jdom2.version>2.0.6.1</org-jdom2.version> |
| | | <compiler-plugin.version>3.11.0</compiler-plugin.version> |
| | | <surefire-plugin.version>3.0.0</surefire-plugin.version> |
| | | |
| | | <spring-boot-maven-plugin.version>3.2.0</spring-boot-maven-plugin.version> |
| | | <maven-jar-plugin-plugin.version>3.3.0</maven-jar-plugin-plugin.version> |
| | | <maven-dependency-plugin.version>3.5.0</maven-dependency-plugin.version> |
| | | <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version> |
| | | <maven-resources-plugin.version>3.3.1</maven-resources-plugin.version> |
| | | <maven-surefire-plugin.version>3.0.0</maven-surefire-plugin.version> |
| | | <maven-bundle-plugin.version>5.1.9</maven-bundle-plugin.version> |
| | | <encoding>UTF-8</encoding> |
| | | </properties> |
| | | |
| | | |
| | |
| | | <dependency> |
| | | <groupId>org.apache.mina</groupId> |
| | | <artifactId>mina-core</artifactId> |
| | | <version>2.2.1</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.mina</groupId> |
| | | <artifactId>mina-filter-compression</artifactId> |
| | | <version>2.2.1</version> |
| | | <version>2.2.2</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | |
| | | <!-- spring boot提供的maven打包插件 --> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <version>3.1.3</version> |
| | | <version>${spring-boot-maven-plugin.version}</version> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- 该插件不会将项目中引入的依赖打进最终的 Jar 文件 --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-jar-plugin</artifactId> |
| | | <version>${maven-jar-plugin-plugin.version}</version> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- 当项目中依赖比较多时,我们可以借助 maven-dependency-plugin 插件自动帮我们下载依赖的 Jar 文件,推荐将该插件绑定到package生命周期上 --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-dependency-plugin</artifactId> |
| | | <version>${maven-dependency-plugin.version}</version> |
| | | <executions> |
| | | <execution> |
| | | <!-- 绑定生命周期 --> |
| | | <phase>package</phase> |
| | | <goals> |
| | | <goal>copy-dependencies</goal> |
| | | </goals> |
| | | <!-- 设置依赖的存放路径 --> |
| | | <configuration> |
| | | <excludes> |
| | | <exclude> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </exclude> |
| | | </excludes> |
| | | <outputDirectory>${project.build.directory}/lib</outputDirectory> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- 设置java编译版本,运行环境版本 --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <version>${maven-compiler-plugin.version}</version> |
| | | <!-- source: 源代码编译版本;target: 目标平台编译版本;encoding: 字符集编码。 --> |
| | | <configuration> |
| | | <source>${java.version}</source> |
| | | <target>${java.version}</target> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- 解决资源文件的编码问题 --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-resources-plugin</artifactId> |
| | | <version>${maven-resources-plugin.version}</version> |
| | | <configuration> |
| | | <encoding>${encoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- maven里执行测试用例的插件 --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-surefire-plugin</artifactId> |
| | | <version>3.0.0</version> |
| | | <configuration> |
| | | <skipTests>true</skipTests> |
| | | </configuration> |
| | | <version>${maven-surefire-plugin.version}</version> |
| | | </plugin> |
| | | <plugin> |
| | | <!-- 强制设定 java编译版本,运行环境版本 --> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <version>${compiler-plugin.version}</version> |
| | | <configuration> |
| | | <source>20</source> |
| | | <target>20</target> |
| | | </configuration> |
| | | <!-- 下面解决:当进行Maven Lifecycle package时报错:Could not find artifact org.apache.mina:mina-core:bundle:2.2.1 in maven (https://repo1.maven.org/maven2/)--> |
| | | <groupId>org.apache.felix</groupId> |
| | | <artifactId>maven-bundle-plugin</artifactId> |
| | | <version>${maven-bundle-plugin.version}</version> |
| | | <extensions>true</extensions> |
| | | </plugin> |
| | | </plugins> |
| | | </pluginManagement> |