Commit e79c4c38 by 赵剑炜

Merge branch 'develop' into develop-zhaojw

# Conflicts:
#	.gitignore
parents f16f2ad3 fae8b7a3
......@@ -60,4 +60,4 @@ Thumbs.db
/jyzb-boot/src/main/resources/application.yml
/jyzb-boot/pom.xml
/.idea/encodings.xml
/jyzb-boot/src/main/resources/application.yml
/jyzb-api/jyzb-api.iml
......@@ -7,6 +7,7 @@
<module fileurl="file://$PROJECT_DIR$/jyzb-boot/jyzb-boot.iml" filepath="$PROJECT_DIR$/jyzb-boot/jyzb-boot.iml" />
<module fileurl="file://$PROJECT_DIR$/jyzb-mq/jyzb-mq-consumer/jyzb-mq-consumer.iml" filepath="$PROJECT_DIR$/jyzb-mq/jyzb-mq-consumer/jyzb-mq-consumer.iml" />
<module fileurl="file://$PROJECT_DIR$/jyzb-mq/jyzb-mq-producer/jyzb-mq-producer.iml" filepath="$PROJECT_DIR$/jyzb-mq/jyzb-mq-producer/jyzb-mq-producer.iml" />
<module fileurl="file://$PROJECT_DIR$/jyzb-process/jyzb-process.iml" filepath="$PROJECT_DIR$/jyzb-process/jyzb-process.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.20" level="project" />
<orderEntry type="library" name="Maven: com.junmp.v2:junmp-v2-common:1.0.0" level="project" />
<orderEntry type="library" name="Maven: com.github.oshi:oshi-core:6.3.2" level="project" />
<orderEntry type="library" name="Maven: net.java.dev.jna:jna:5.12.1" level="project" />
<orderEntry type="library" name="Maven: net.java.dev.jna:jna-platform:5.12.1" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.36" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.4.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.4.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.4.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.4.4" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.13.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.13.3" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.36" level="project" />
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.5" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.27" level="project" />
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.6.3" level="project" />
<orderEntry type="library" name="Maven: com.alibaba.fastjson2:fastjson2:2.0.27" level="project" />
<orderEntry type="library" name="Maven: com.github.whvcse:easy-captcha:1.6.2" level="project" />
<orderEntry type="library" name="Maven: com.junmp.v2:v2-validator-api:1.0.0" level="project" />
<orderEntry type="library" name="Maven: com.junmp.v2:v2-db-api:1.0.0" level="project" />
<orderEntry type="library" name="Maven: com.junmp.v2:v2-config-api:1.0.0" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.5.2" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.5.2" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.5.2" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.5.2" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.5.2" level="project" />
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.4" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.10" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.31" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib:1.4.31" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-common:1.4.31" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains:annotations:13.0" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.31" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.4.4" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.3.5" level="project" />
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:4.0.1" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:druid:1.2.4" level="project" />
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.4.4" level="project" />
<orderEntry type="library" name="Maven: org.glassfish:jakarta.el:3.0.3" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.1.7.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
<orderEntry type="library" name="Maven: io.jsonwebtoken:jjwt:0.9.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.4" level="project" />
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.22" level="project" />
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
</component>
</module>
\ No newline at end of file
......@@ -44,5 +44,6 @@
<artifactId>jakarta.validation-api</artifactId>
</dependency>
</dependencies>
</project>
package com.junmp.jyzb.api.bean.dto;
import com.junmp.v2.common.bean.request.BaseRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
@Data
public class CabinetDto implements Serializable {
/**
* 单警柜ID
*/
@ApiModelProperty(value = "单警柜ID")
private String id;
/**
* 单警柜编号
*/
@ApiModelProperty(value = "单警柜编号")
private String cabinetNum;
/**
* 箱数
*/
@ApiModelProperty(value = "箱数")
private Integer num;
/**
* 单警柜名称
*/
@ApiModelProperty(value = "单警柜名称")
private String name;
/**
* 组织机构号
*/
@ApiModelProperty(value = "组织机构号")
private String orgId;
/**
* 位置信息
*/
@ApiModelProperty(value = "位置信息")
private String location;
/**
* 单警柜当前状态,0正常,1异常
*/
@ApiModelProperty(value = "单警柜当前状态,0正常,1异常")
private Integer state;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
private Date updateTime;
/**
* 更新人员
*/
@ApiModelProperty(value = "更新人员")
private String updateUser;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.api.bean.req;
import com.baomidou.mybatisplus.annotation.TableField;
import com.junmp.v2.common.bean.request.BaseRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = true)
public class CabinetBoxReq extends BaseRequest {
/**
* 主键ID
*/
@ApiModelProperty(value = "主键ID")
private String id;
/**
* 主柜ID
*/
@ApiModelProperty(value = "主柜ID")
private String cabinetId;
/**
* 箱号
*/
@ApiModelProperty(value = "箱号")
private Integer num;
/**
* 异常状态:1正常/0异常
*/
@ApiModelProperty(value = "异常状态:1正常/0异常")
private Integer state;
/**
* 异常原因
*/
@ApiModelProperty(value = "异常原因")
private String errorMsg;
/**
* 使用日志存储位置信息
*/
@ApiModelProperty(value = "使用日志存储位置信息")
private String logMap;
/**
* 警员id
*/
@ApiModelProperty(value = "警员id")
private String policeId;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.api.bean.req;
import com.junmp.v2.common.bean.request.BaseRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = true)
public class CabinetReq extends BaseRequest {
/**
* 单警柜ID
*/
@NotNull(message = "单警柜ID主键不能为空", groups = {edit.class, delete.class, detail.class})
@ApiModelProperty(value = "单警柜ID")
private String id;
/**
* 单警柜编号
*/
@NotNull(message = "单警柜编号不能为空", groups = {edit.class, delete.class, detail.class})
@ApiModelProperty(value = "单警柜编号")
private String cabinetNum;
/**
* 箱数
*/
@ApiModelProperty(value = "箱数")
private Integer num;
/**
* 单警柜名称
*/
@NotNull(message = "单警柜名称不能为空", groups = {edit.class, delete.class, detail.class})
@ApiModelProperty(value = "单警柜名称")
private String name;
/**
* 组织机构号
*/
@NotNull(message = "组织机构号不能为空", groups = {edit.class, delete.class, detail.class})
@ApiModelProperty(value = "组织机构号")
private String orgId;
/**
* 位置信息
*/
@ApiModelProperty(value = "位置信息")
private String location;
/**
* 单警柜当前状态,0正常,1异常
*/
@ApiModelProperty(value = "单警柜当前状态,0正常,1异常")
private Integer state;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
private Date updateTime;
/**
* 更新人员
*/
@ApiModelProperty(value = "更新人员")
private String updateUser;
/**
* 是否包含本级及下级,true为包含,false为不包含,只显示本级
*/
@ApiModelProperty(value = "本机及下级")
private String includeLowerLevel;
// /**
// * 单警柜与箱门一对多关系
// */
//// private List<CabinetBox> list;
// private List<CabinetBox> a ;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.beanReq;
package com.junmp.jyzb.api.bean.req;
import com.junmp.v2.common.bean.request.BaseRequest;
import io.swagger.annotations.ApiModelProperty;
......@@ -14,14 +14,13 @@ public class PolicemanFingerReq extends BaseRequest {
/**
* 指纹id
*/
@NotNull(message = "指纹主键不能为空", groups = {edit.class, delete.class, detail.class})
@ApiModelProperty(value = "指纹id")
private Integer id;
/**
* 警员id
*/
@NotNull(message = "警员id不能为空", groups = {edit.class, delete.class, detail.class})
@ApiModelProperty(value = "警员id")
private String policeId;
......@@ -34,7 +33,6 @@ public class PolicemanFingerReq extends BaseRequest {
/**
* 指纹信息
*/
@NotNull(message = "指纹信息不能为空", groups = {edit.class, delete.class, detail.class})
@ApiModelProperty(value = "指纹信息")
private String fingerInfo;
......
......@@ -9,20 +9,22 @@ import javax.validation.constraints.NotNull;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = false)
@EqualsAndHashCode(callSuper = true)
public class PolicemanReq extends BaseRequest {
@NotNull(message = "警员主键不能为空", groups = {edit.class, delete.class, detail.class})
private String id;
@NotNull(message = "警员名字不能为空", groups = {edit.class, delete.class, detail.class})
private String name;
private String cabinetBoxId;
private Long orgIdInt;
@NotNull(message = "组织机构不能为空", groups = {edit.class, delete.class, detail.class})
private String orgId;
private Long orgIdInt;
private Long departmentId;
private String policeCode;
......@@ -50,4 +52,6 @@ public class PolicemanReq extends BaseRequest {
private String updateUser;
private Integer state;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -2,11 +2,14 @@ package com.junmp.jyzb.api.bean.req;
import com.junmp.v2.common.bean.request.BaseRequest;
import com.junmp.v2.validator.api.validators.unique.TableUniqueValue;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
/**
* <pre>
......@@ -95,4 +98,6 @@ public class ProductReq extends BaseRequest {
* 生产厂家名称
*/
private String mfBizName;
}
package com.junmp.jyzb.api.bean.req;
import com.junmp.v2.common.bean.request.BaseRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* <pre>
......@@ -63,4 +65,6 @@ public class ProductSkuReq extends BaseRequest {
* 预览属性3
*/
private String attr3;
}
......@@ -26,6 +26,11 @@ public enum ProductExceptionEnum implements IExceptionEnum {
PRODUCT_NOT_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 12, "产品信息不存在"),
/**
* 号型信息不存在
*/
SIZE_NOT_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 12, "号型信息不存在"),
/**
* 产品信息不存在
*/
PRODUCT_SKU_NOT_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 13, "号型不存在"),
......
......@@ -66,5 +66,13 @@
<version>31.1-jre</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-api</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-api</artifactId>
</dependency>
</dependencies>
</project>
package com.junmp.jyzb.beanReq;
package com.junmp.jyzb.Dto;
import com.junmp.jyzb.entity.CabinetBox;
import com.junmp.v2.common.bean.request.BaseRequest;
......@@ -12,7 +12,7 @@ import java.util.List;
@Data
@EqualsAndHashCode(callSuper = true)
public class CabinetReq extends BaseRequest {
public class CabinetDto extends BaseRequest {
/**
* 单警柜ID
*/
......@@ -78,9 +78,15 @@ public class CabinetReq extends BaseRequest {
private String updateUser;
/**
* 是否包含本级及下级,true为包含,false为不包含,只显示本级
*/
@ApiModelProperty(value = "本机及下级")
private String includeLowerLevel;
/**
* 单警柜与箱门一对多关系
*/
private List<CabinetBox> list;
private List<CabinetBox> list ;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.controller;
import com.junmp.jyzb.Dto.CabinetDto;
import com.junmp.jyzb.api.bean.req.CabinetBoxReq;
import com.junmp.jyzb.api.bean.req.CabinetReq;
import com.junmp.jyzb.entity.Cabinet;
import com.junmp.jyzb.entity.CabinetBox;
import com.junmp.jyzb.service.CabinetBoxService;
import com.junmp.jyzb.service.CabinetService;
import com.junmp.jyzb.service.PoliceFingerService;
......@@ -7,9 +12,12 @@ import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.jyzb.utils.ReturnData;
import com.junmp.jyzb.utils.ReturnMsg;
import com.junmp.v2.common.bean.request.ValidationApi;
import com.junmp.v2.common.bean.response.ApiRes;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -39,14 +47,14 @@ public class CabinetController {
}
@PostMapping("/DeleteCabinet")
@ApiOperation("删除单警柜信息")
@ApiOperation("删除单警柜")
public ResponseResult deleteCabinet(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = cabinetService.deleteCabinet(msg);
return returnMsg;
}
@PostMapping("/ShowCabinet")
@ApiOperation("查询单警柜列表")
@ApiOperation("查询单警柜")
public ResponseResult showCabinet(@RequestBody Map<String, Object> msg){
ResponseResult returnMsg = cabinetService.getAllCabinet(msg);
return returnMsg;
......@@ -74,11 +82,66 @@ public class CabinetController {
}
@PostMapping("/getCabinetBoxInfo")
@ApiOperation("获取箱门列表")
public ResponseResult getCabinetBoxInfo(@RequestBody Map<String, Object> msg){
ResponseResult returnMsg = cabinetBoxService.getCabinetBoxInfo(msg);
return returnMsg;
@PostMapping("/AddCabinetInfo")
@ApiOperation("添加单警柜信息(新)")
public ApiRes<Boolean> addCabinetInfo(@RequestBody CabinetReq req){
boolean result = cabinetService.addCabinetInfo(req);
if (!result){
return ApiRes.failure("操作失败");
}
return ApiRes.success(result);
}
@PostMapping("/DeleteCabinetInfo")
@ApiOperation("删除单警柜信息(新)")
public ApiRes<Boolean> deleteCabinetInfo(@RequestBody CabinetReq req) {
return ApiRes.success(cabinetService.deleteCabinetInfo(req));
}
@PostMapping("/ShowCabinetList")
@ApiOperation("查询单警柜列表(新)")
public ApiRes<List<Cabinet>> showCabinetList(@RequestBody CabinetReq req){
List<Cabinet> allCabinetList = cabinetService.getAllCabinetList(req);
if (allCabinetList.size()<=0){
return ApiRes.failure("查询失败,列表为null");
}
return ApiRes.success(allCabinetList);
}
//通过单警柜id查询单个箱门及其箱门信息
@PostMapping("/ShowOneCabinet")
@ApiOperation("查询单个单警柜及其箱门信息(新)")
public ApiRes<CabinetDto> showOneCabinet(@RequestBody CabinetReq req){
return ApiRes.success(cabinetService.showOneCabinet(req));
}
@PostMapping("/getCabinetBoxList")
@ApiOperation("通过单警柜id获取箱门列表(新)")
public ApiRes<List<CabinetBox>> getCabinetBoxList(@RequestBody CabinetReq req){
return ApiRes.success(cabinetBoxService.getCabinetBoxList(req));
}
@PostMapping("/UpdateCabinetInfo")
@ApiOperation("修改单警柜信息(新)")
public ApiRes<Boolean> updateCabinetInfo(@RequestBody CabinetReq req) {
boolean result = cabinetService.updateCabinetInfo(req);
if (!result){
return ApiRes.failure("操作失败");
}
return ApiRes.success(result);
}
@PostMapping("/boxBindPolice")
@ApiOperation("箱门绑定人员(新)")
public ApiRes<Boolean> boxBindPolice(@RequestBody CabinetBoxReq req) {
boolean result = cabinetService.boxBindPolice(req);
if (!result){
return ApiRes.failure("操作失败");
}
return ApiRes.success(result);
}
}
\ No newline at end of file
//package com.junmp.jyzb.controller;
//
//import com.junmp.jyzb.beanReq.CabinetReq;
//import com.junmp.jyzb.doc.CabinetDoc;
//import com.junmp.jyzb.entity.Cabinet;
//import com.junmp.jyzb.service.CabinetService;
//import com.junmp.v2.common.bean.request.ValidationApi;
//import com.junmp.v2.common.bean.response.ApiRes;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//import java.util.List;
//
//@RestController
//@Slf4j
//@RequestMapping("/Cabinet")
//@Api(tags = "单警柜基础信息模块")
//public class CabinetController111 implements CabinetDoc {
// @Resource
// public CabinetService cabinetService;
//
// @PostMapping("/AddCabinet")
// @ApiOperation("添加单警柜")
// public ApiRes<Boolean> addCabinet(@RequestBody @Validated(CabinetReq.add.class) CabinetReq req) throws Exception {
// return ApiRes.success(cabinetService.addCabinet(req));
// }
//
//
// @PostMapping("/DeleteCabinet")
// @ApiOperation("删除单警柜信息")
// public ApiRes<Boolean> deleteCabinet(@RequestBody @Validated(ValidationApi.edit.class) CabinetReq req) throws Exception {
// return ApiRes.success(cabinetService.deleteCabinet(req));
// }
//
// @PostMapping("/ShowCabinet")
// @ApiOperation("查询单警柜列表")
// public ApiRes<List<Cabinet>> showCabinet(@RequestBody @Validated(ValidationApi.edit.class) CabinetReq req,String includeLowerLevel){
// return ApiRes.success(cabinetService.getAllCabinet(req,includeLowerLevel));
// }
//
//
// @PostMapping("/UpdateCabinet")
// @ApiOperation("修改单警柜信息")
// public ApiRes<Boolean> updateCabinet(@RequestBody @Validated(ValidationApi.edit.class) CabinetReq req) throws Exception {
// return ApiRes.success(cabinetService.updateCabinet(req));
// }
//
//
//// @PostMapping("/ErrorState")
//// @ApiOperation("单警柜状态变更")
//
//
//// @PostMapping("/GetCabinetDetail")
//// @ApiOperation("查询单警柜及其箱号信息")
//
//// @PostMapping("/getCabinetBoxInfo")
//// @ApiOperation("获取箱门列表")
//}
package com.junmp.jyzb.controller;
import com.junmp.jyzb.api.bean.dto.InventoryDto;
import cn.hutool.core.util.ObjectUtil;
import com.junmp.jyzb.api.bean.req.CabinetReq;
import com.junmp.jyzb.api.bean.req.PolicemanReq;
import com.junmp.jyzb.api.bean.req.ProductReq;
import com.junmp.jyzb.entity.Policeman;
import com.junmp.jyzb.service.PolicemanService;
import com.junmp.jyzb.utils.ResponseResult;
......@@ -32,27 +32,38 @@ public class PoliceController {
return returnMsg;
}
@PostMapping("/AddFaceInfo")
@ApiOperation("添加警员面部信息")
public ResponseResult addFaceInfo(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = policemanService.addFaceInfo(msg);
return returnMsg;
public ApiRes<Boolean> addFaceInfo(@RequestBody PolicemanReq req) {
boolean b = policemanService.addFaceInfo(req);
if (!b){
return ApiRes.failure("添加失败");
}
return ApiRes.success(b);
}
@PostMapping("/updateFaceInfo")
@ApiOperation("修改、删除人脸信息")
public ResponseResult updateFaceInfo(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = policemanService.updateFaceInfo(msg);
return returnMsg;
public ApiRes<Boolean> updateFaceInfo(@RequestBody PolicemanReq req) {
boolean b = policemanService.updateFaceInfo(req);
if (!b){
return ApiRes.failure("操作失败");
}
return ApiRes.success(b);
}
@PostMapping("/searchFaceInfo")
@ApiOperation("查找人脸信息")
public ResponseResult searchFaceInfo(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = policemanService.searchFaceInfo(msg);
return returnMsg;
public ApiRes<Policeman> searchFaceInfo(@RequestBody PolicemanReq req) {
Policeman policeman = policemanService.searchFaceInfo(req);
if (ObjectUtil.isEmpty(policeman)){
return ApiRes.failure("未找到警员信息");
}
return ApiRes.success(policeman);
}
@PostMapping("/DeletePolice")
@ApiOperation("删除警员信息")
public ResponseResult deletePolice(@RequestBody Map<String,Object> msg) {
......@@ -67,17 +78,11 @@ public class PoliceController {
return returnMsg;
}
// @PostMapping("/ShowPolice")
// @ApiOperation("查询警员列表") //根据组织机构id查询
// public ResponseResult getAllPoliceman(@RequestBody Map<String, Object> orgId){
// ResponseResult returnMsg = policemanService.getAllPoliceman(orgId);
// return returnMsg;
// }
@PostMapping("/ShowPolice")
@ApiOperation("查询警员列表") //根据组织机构id查询
public ApiRes<List<Policeman>> getAllPoliceman(PolicemanReq req){
return ApiRes.success(policemanService.getAllPoliceman(req));
public ResponseResult getAllPoliceman(@RequestBody Map<String, Object> orgId){
ResponseResult returnMsg = policemanService.getAllPoliceman(orgId);
return returnMsg;
}
@PostMapping("/GetPoliceDetail")
......@@ -118,8 +123,12 @@ public class PoliceController {
**/
@PostMapping("/policeList")
@ApiOperation("人员列表")
public ResponseResult policeList(@RequestBody Map<String, Object> msg){
ResponseResult returnMsg =policemanService.getOrgPoliceman(msg);
return returnMsg;
public ApiRes<List<Policeman>> policeList(@RequestBody CabinetReq req){
List<Policeman> orgPoliceman = policemanService.getOrgPoliceman(req);
if (orgPoliceman.isEmpty()){
return ApiRes.failure("未查到人员信息");
}
return ApiRes.success(orgPoliceman);
}
}
package com.junmp.jyzb.controller;
import com.junmp.jyzb.beanReq.PolicemanFingerReq;
import com.junmp.jyzb.api.bean.req.PolicemanFingerReq;
import com.junmp.jyzb.doc.PolicemanFingerDoc;
import com.junmp.jyzb.entity.PoliceFinger;
import com.junmp.jyzb.service.PoliceFingerService;
......
package com.junmp.jyzb.doc;
import com.junmp.jyzb.api.bean.req.ProductReq;
import com.junmp.jyzb.beanReq.PolicemanFingerReq;
import com.junmp.jyzb.api.bean.req.PolicemanFingerReq;
import com.junmp.jyzb.entity.PoliceFinger;
import com.junmp.v2.common.bean.response.ApiRes;
import com.junmp.v2.db.api.page.PageResult;
......
package com.junmp.jyzb.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
......@@ -22,6 +21,7 @@ public class Cabinet implements Serializable {
/**
* 单警柜ID
*/
@TableId(value = "id",type = IdType.ASSIGN_UUID )
@ApiModelProperty(value = "单警柜ID")
private String id;
......@@ -94,14 +94,14 @@ public class Cabinet implements Serializable {
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
@TableField("create_time")
@TableField(value="create_time")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
@TableField("update_time")
@TableField(value = "update_time")
private Date updateTime;
/**
......@@ -124,10 +124,6 @@ public class Cabinet implements Serializable {
@ApiModelProperty(value = "箱数")
private Integer num;
/**
* 单警柜与箱门一对多关系
*/
private List<CabinetBox> list;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.entity;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -18,6 +20,7 @@ public class CabinetBox implements Serializable {
/**
* 主键ID
*/
@TableId(value = "id",type = IdType.ASSIGN_UUID)
@ApiModelProperty(value = "主键ID")
private String id;
......
......@@ -19,7 +19,7 @@ import java.util.Date;
@TableName("base_inventory")
public class Inventory implements Serializable {
@TableField("id")
@TableId(value = "id",type=IdType.ASSIGN_UUID)
private String ID;
/**
......
package com.junmp.jyzb.entity;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -17,9 +19,8 @@ import javax.validation.constraints.NotNull;
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("base_police_finger")
public class PoliceFinger implements Serializable {
@TableField(value = "id")
@TableId(value = "id",type= IdType.AUTO)
private Integer id;
@TableField(value = "police_id")
......
package com.junmp.jyzb.entity;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.junmp.jyzb.entity.Cabinet;
import io.swagger.annotations.ApiModel;
......@@ -20,20 +22,18 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
@TableName("base_policeman")
public class Policeman implements Serializable {
@TableField(value = "id")
@TableId(value = "id")
private String id;
@TableField(value = "name")
private String name;
@TableField(value = "cabinet_box_id")
@TableField(value = "cabinet_box_id",updateStrategy = FieldStrategy.IGNORED)
private String cabinetBoxId;
@TableField(value = "org_id_int")
private Long orgIdInt;
private Long orgId;
@TableField(value = "org_id")
private String orgId;
@TableField(value = "department_id")
private Long departmentId;
......@@ -44,7 +44,7 @@ public class Policeman implements Serializable {
@TableField(value = "sex")
private String sex;
@TableField(value = "face_info")
@TableField(value = "face_info",updateStrategy = FieldStrategy.IGNORED)
private String faceInfo;
@TableField(value = "isCreatedAccount")
......
package com.junmp.jyzb.exception.enums;
import com.junmp.v2.common.constant.CommonConstant;
import com.junmp.v2.common.exception.IExceptionEnum;
import lombok.Getter;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 13:08
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Getter
public enum CabinetExceptionEnum implements IExceptionEnum {
/**
* 组织机构不存在
*/
PUBORG_NOT_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE,"组织机构不存在"),
/**
* 单警柜编号重复
*/
CABINETID_IS_EXISTS(CommonConstant.DEFAULT_USER_ERROR_CODE,"单警柜编号重复"),
/**
* 单警柜不存在
*/
CABINET_ISNOT_EXISTS(CommonConstant.DEFAULT_USER_ERROR_CODE,"单警柜不存在"),
/**
* 传入参数错误
*/
PARAMETER_ERROR(CommonConstant.DEFAULT_USER_ERROR_CODE,"传入参数错误"),
/**
* 箱门id不存在
*/
CABINETBOX_ISNOT_EXISTS(CommonConstant.DEFAULT_USER_ERROR_CODE,"箱门id不存在"),
;
/**
* 错误编码
*/
private final Integer code;
/**
* 提示用户信息
*/
private final String message;
CabinetExceptionEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
}
package com.junmp.jyzb.exception.enums;
import com.junmp.jyzb.api.constant.JYZBConstant;
import com.junmp.v2.common.constant.CommonConstant;
import com.junmp.v2.common.exception.IExceptionEnum;
import lombok.Getter;
......
......@@ -10,6 +10,11 @@ public enum PolicemanFingerExceptionEnum implements IExceptionEnum {
* 警员指纹已存在
*/
POLICEMAN_FINGER_EXCEPTION_ENUM(CommonConstant.DEFAULT_USER_ERROR_CODE,"警员指纹信息已存在"),
/**
* 警员指纹不存在
*/
POLICEMAN_FINGER_NOTEXISTS(CommonConstant.DEFAULT_USER_ERROR_CODE,"警员指纹不存在"),
;
......
......@@ -15,4 +15,8 @@ public interface CabinetBoxMapper extends BaseMapper<CabinetBox> {
void changeCabinetState(CabinetBox cabinetBox);
String getOneCabinetBox(String cabinetBoxId);
List<CabinetBox> selectByIdCabinetBoxes(String id);
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.junmp.jyzb.Dto.CabinetDto;
import com.junmp.jyzb.entity.Cabinet;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -13,7 +14,9 @@ public interface CabinetMapper extends BaseMapper<Cabinet> {
public int addCabinet(Cabinet cabinet);
public List<Map<String, Object>> getAllCabinet();
public List<Cabinet> getAllCabinet();
public List<Cabinet> getAllCabinetList();
Map<String, Object> getOneCabinet(String id);
......@@ -33,7 +36,8 @@ public interface CabinetMapper extends BaseMapper<Cabinet> {
String getCabinetNumById(String id);
List<Map<String, Object>> getAllCabinetByOrgList(List<String> allOrgId);
List<Cabinet> getAllCabinetByOrgList(List<String> allOrgId);
List<CabinetDto> getAllCabinetByOrgList111(List<String> allOrgId);
void setCabinetSumInventory(@Param("updateId") String id);
......
package com.junmp.jyzb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
<<<<<<< HEAD
import com.junmp.jyzb.entity.Inventory;
=======
import com.junmp.jyzb.entity.EquipmentSize;
import com.junmp.jyzb.entity.Inventory;
>>>>>>> develop
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
<<<<<<< HEAD
public interface InventoryMapper extends BaseMapper<Inventory> {
=======
public interface InventoryMapper extends BaseMapper<Inventory> {
>>>>>>> develop
Map<String, Object> getSum(String queryType, String typeId);
Map<String, Object> getOrgNum(String typeId);
List<Map<String, Object>> getLocationInventory(@Param("queryType")String queryType, @Param("idMsg")String idMsg);
void deleteAllMsg();
void setOrgInventory();
void setCabinetInventory();
void setWarehouseInventory();
List<Map<String, Object>> getInventoryList(@Param("queryType")String queryType,@Param("typeCode") String typeCode,@Param("typeId") String typeId,@Param("sizeId") String sizeId);
List<Map<String, Object>> getInventoryByOrgId(String orgId);
}
\ No newline at end of file
package com.junmp.jyzb.service;
import com.junmp.jyzb.utils.ResponseResult;
import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.jyzb.api.bean.req.CabinetReq;
import com.junmp.jyzb.entity.CabinetBox;
import java.util.List;
import java.util.Map;
public interface CabinetBoxService{
public interface CabinetBoxService extends IService<CabinetBox> {
List<Map<String, Object>> getAllBoxMsg(String id);
ResponseResult getCabinetBoxInfo(Map<String, Object> msg);
List<CabinetBox> getCabinetBoxList(CabinetReq req);
}
package com.junmp.jyzb.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.jyzb.beanReq.CabinetReq;
import com.junmp.jyzb.Dto.CabinetDto;
import com.junmp.jyzb.api.bean.req.CabinetBoxReq;
import com.junmp.jyzb.api.bean.req.CabinetReq;
import com.junmp.jyzb.entity.Cabinet;
import com.junmp.jyzb.utils.ResponseResult;
......@@ -35,26 +37,42 @@ public interface CabinetService extends IService<Cabinet> {
* @param req
* @return
*/
boolean addCabinet(CabinetReq req) throws Exception;
boolean addCabinetInfo(CabinetReq req) ;
/**
* 删除单警柜
* @param req
* @return
*/
boolean deleteCabinet(CabinetReq req);
boolean deleteCabinetInfo(CabinetReq req);
/**
* 查询单警柜信息
* 查询单警柜信息,通过组织机构id进行查询
* @param req
* @return
*/
List<Cabinet> getAllCabinet(CabinetReq req,String includeLowerLevel);
List<Cabinet> getAllCabinetList(CabinetReq req);
/**
* 通过单警柜id进行查询单个单警柜信息及其箱门信息
* @param req
* @return
*/
CabinetDto showOneCabinet(CabinetReq req);
/**
* 修改单警柜信息
* @param req
* @return
*/
boolean updateCabinet(CabinetReq req) throws Exception;
boolean updateCabinetInfo(CabinetReq req);
/**
* 箱门绑定人员
* @param req
* @return
*/
boolean boxBindPolice(CabinetBoxReq req);
}
......@@ -18,11 +18,23 @@ public interface EquipmentSizeService extends IService<EquipmentSize> {
boolean updateSize(EquipmentSizeReq req);
ResponseResult addSize(Map<String, Object> msg);
ResponseResult getOneSize(Map<String, Object> msg);
ResponseResult deleteSize(Map<String, Object> msg);
ResponseResult updateSize(Map<String, Object> msg);
List<String> getAllSizeId(Map<String, Object> orgId);
boolean changeSizeState(EquipmentSizeReq req);
List<EquipmentSize> getAllSize(EquipmentSizeReq req);
ResponseResult changeSizeState(Map<String, Object> msg);
ResponseResult getAllSize(Map<String, Object> msg);
ResponseResult getSizeDevelop();
}
package com.junmp.jyzb.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.jyzb.api.bean.req.ProductReq;
import com.junmp.jyzb.beanReq.PolicemanFingerReq;
import com.junmp.jyzb.api.bean.req.PolicemanFingerReq;
import com.junmp.jyzb.entity.PoliceFinger;
import com.junmp.jyzb.entity.Product;
import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.v2.db.api.page.PageResult;
import java.util.List;
......
package com.junmp.jyzb.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.jyzb.api.bean.req.CabinetReq;
import com.junmp.jyzb.api.bean.req.PolicemanReq;
import com.junmp.jyzb.entity.PoliceFinger;
import com.junmp.jyzb.entity.Policeman;
......@@ -8,7 +10,7 @@ import com.junmp.jyzb.utils.ResponseResult;
import java.util.List;
import java.util.Map;
public interface PolicemanService{
public interface PolicemanService extends IService<Policeman> {
ResponseResult addPoliceman(Map<String, Object> msg);
ResponseResult getOnePolice(Map<String, Object> id);
......@@ -29,22 +31,20 @@ public interface PolicemanService{
//查询指纹信息
ResponseResult searchFingerInfo(Map<String, Object> msg);
ResponseResult addFaceInfo(Map<String, Object> msg);
boolean addFaceInfo(PolicemanReq req);
ResponseResult changePoliceState(Map<String, Object> msg);
//List<Map<String, Object>> getAllPoliceman(List<String> allPoliceId);
// ResponseResult getAllPoliceman(Map<String, Object> orgId);
List<Policeman> getAllPoliceman(PolicemanReq req);
ResponseResult getAllPoliceman(Map<String, Object> orgId);
ResponseResult getPoliceData(Map<String, Object> cabinetId);
ResponseResult updateFaceInfo(Map<String, Object> msg);
boolean updateFaceInfo(PolicemanReq req);
ResponseResult searchFaceInfo(Map<String, Object> msg);
Policeman searchFaceInfo(PolicemanReq req);
//通过单警柜获取组织机构id,再获取组织机构下的所有警员信息
ResponseResult getOrgPoliceman(Map<String, Object> msg);
List<Policeman> getOrgPoliceman(CabinetReq req);
}
package com.junmp.jyzb.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.jyzb.api.bean.req.CabinetReq;
import com.junmp.jyzb.entity.Cabinet;
import com.junmp.jyzb.entity.CabinetBox;
import com.junmp.jyzb.mapper.CabinetBoxMapper;
import com.junmp.jyzb.mapper.CabinetMapper;
import com.junmp.jyzb.service.CabinetBoxService;
import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult;
......@@ -16,11 +21,14 @@ import java.util.Map;
import static com.junmp.jyzb.utils.CheckBlank.checkNotBlank;
@Service
public class CabinetBoxServiceImpl implements CabinetBoxService {
public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, CabinetBox> implements CabinetBoxService {
@Resource
private CabinetBoxMapper cabinetBoxMapper;
@Resource
private CabinetBoxService cabinetBoxService;
@Override
public List<Map<String, Object>> getAllBoxMsg(String id) {
return cabinetBoxMapper.getBoxMsg(id);
......@@ -34,14 +42,9 @@ public class CabinetBoxServiceImpl implements CabinetBoxService {
* @return
**/
@Override
public ResponseResult getCabinetBoxInfo(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("cabinetId"), "cabinetId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
List<CabinetBox> cabinetBoxList = cabinetBoxMapper.selectList(new LambdaQueryWrapper<CabinetBox>()
.eq(CabinetBox::getCabinetId, msg.get("cabinetId")));
return new ResponseResult<>(HttpStatus.SUCCESS,"操作成功",cabinetBoxList);
public List<CabinetBox> getCabinetBoxList(CabinetReq req) {
List<CabinetBox> cabinetBoxList = cabinetBoxService.list(new LambdaQueryWrapper<CabinetBox>()
.eq(ObjectUtil.isNotEmpty(req.getId()),CabinetBox::getCabinetId, req.getId()));
return cabinetBoxList;
}
}
......@@ -3,15 +3,26 @@ package com.junmp.jyzb.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.jyzb.beanReq.CabinetReq;
import com.junmp.jyzb.Dto.CabinetDto;
import com.junmp.jyzb.api.bean.req.CabinetBoxReq;
import com.junmp.jyzb.api.bean.req.CabinetReq;
import com.junmp.jyzb.entity.Cabinet;
import com.junmp.jyzb.entity.CabinetBox;
import com.junmp.jyzb.entity.Policeman;
import com.junmp.jyzb.entity.PubOrg;
import com.junmp.jyzb.exception.enums.CabinetExceptionEnum;
import com.junmp.jyzb.exception.enums.PolicemanExceptionEnum;
import com.junmp.jyzb.mapper.*;
import com.junmp.jyzb.service.CabinetBoxService;
import com.junmp.jyzb.service.CabinetService;
import com.junmp.jyzb.service.PolicemanService;
import com.junmp.jyzb.service.PubOrgService;
import com.junmp.jyzb.utils.*;
import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.util.BeanPlusUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
......@@ -38,6 +49,11 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
@Resource
private PubOrgService pubOrgService;
@Resource
private CabinetBoxService cabinetBoxService;
@Resource
private PolicemanService policemanService;
private static final String REDIS_CABINET = "Cabinet_";
......@@ -51,22 +67,22 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
checkNotBlank(msg.get("num"), "num不能为空");
checkNotBlank(msg.get("cabinetNum"), "cabinetNum不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, e.getMessage());
}
String cabinetNum = msg.get("cabinetNum").toString();
//查询传入的组织机构id是否存在
Long onePubOrg = pubOrgMapper.getOnePubOrg(msg.get("orgId").toString());
if (onePubOrg == null || onePubOrg.equals("")){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"该组织机构不存在");
if (onePubOrg == null || onePubOrg.equals("")) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, "该组织机构不存在");
}
//查询是否有重复的cabinetNum
Map<String, Object> hashCabinetNum = cabinetMapper.getCabinetByCabinetNum(cabinetNum);
if (hashCabinetNum!=null){
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,"主柜编号重复");
if (hashCabinetNum != null) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, "主柜编号重复");
}
Cabinet cabinet =new Cabinet();
Cabinet cabinet = new Cabinet();
//将警员相关信息添加到警员表
//生成一个uuid
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
......@@ -75,40 +91,40 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
cabinet.setId(uuid);
cabinet.setCreateTime(currentDate);
cabinet.setUpdateTime(currentDate);
// cabinet.setOrgId((String) msg.get("orgId"));
cabinet.setOrgId((Long) msg.get("orgId"));
cabinet.setName((String) msg.get("name"));
//cabinet.setUpdateUser((String) msg.get("updateUser"));
cabinet.setLocation((String) msg.get("location"));
// cabinet.setNum((String) msg.get("num"));
cabinet.setNum((Integer) msg.get("num"));
cabinet.setCabinetNum(cabinetNum);
cabinetMapper.addCabinet(cabinet);
/**
* 更新缓存
* */
//构建Redis缓存键
String redisKey = REDIS_CABINET + "true" +'_'+ msg.get("orgId").toString();
String redisKey = REDIS_CABINET + "true" + '_' + msg.get("orgId").toString();
// 从 Redis 中获取数据
List<Map<String, Object>> cachedDataTrue = redisUtils.findCachedData(redisKey);
if (cachedDataTrue != null) {
cachedDataTrue.add(0,msg);
cachedDataTrue.add(0, msg);
//将查询结果存入 Redis 中
redisUtils.set(redisKey, cachedDataTrue);
}
//构建Redis缓存键
redisKey = REDIS_CABINET + "false" +'_'+ msg.get("orgId").toString();
redisKey = REDIS_CABINET + "false" + '_' + msg.get("orgId").toString();
// 从 Redis 中获取数据
List<Map<String, Object>> cachedDataFalse = redisUtils.findCachedData(redisKey);
if (cachedDataFalse != null) {
cachedDataFalse.add(0,msg);
cachedDataFalse.add(0, msg);
//将查询结果存入 Redis 中
redisUtils.set(redisKey, cachedDataFalse);
}
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,uuid);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS, uuid);
}
@Override
public Map<String,Object> getOneCabinet(String id) {
public Map<String, Object> getOneCabinet(String id) {
return cabinetMapper.getOneCabinet(id);
}
......@@ -119,16 +135,16 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
try {
checkNotBlank(msg.get("cabinetList"), "cabinetList不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, e.getMessage());
}
//批量删除操作
List<Object> cabinetList = (List<Object>) msg.get("cabinetList");
for (Object cabinetId:cabinetList){
for (Object cabinetId : cabinetList) {
cabinetMapper.deleteCabinet(cabinetId.toString());
}
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
//查询某组织机构的所有子机构
......@@ -153,40 +169,40 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
checkNotBlank(msg.get("name"), "name不能为空");
checkNotBlank(msg.get("orgId"), "orgId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, e.getMessage());
}
String cabinetNum = msg.get("cabinetNum").toString();
//查询传入的组织机构id是否存在
Long onePubOrg = pubOrgMapper.getOnePubOrg(msg.get("orgId").toString());
if (onePubOrg == null || onePubOrg.equals("")){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"该组织机构不存在");
if (onePubOrg == null || onePubOrg.equals("")) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, "该组织机构不存在");
}
//查询是否有重复的cabinetNum
Map<String, Object> hashCabinetNum = cabinetMapper.getCabinetByCabinetNum(cabinetNum);
//判断policeCode是否有变动
String oldCabinetNum = cabinetMapper.getCabinetNumById(msg.get("id").toString());
if (oldCabinetNum!=null && !oldCabinetNum.equals(cabinetNum)){
if (hashCabinetNum!=null){
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,"主柜编号重复");
if (oldCabinetNum != null && !oldCabinetNum.equals(cabinetNum)) {
if (hashCabinetNum != null) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, "主柜编号重复");
}
}
Cabinet cabinet =new Cabinet();
Cabinet cabinet = new Cabinet();
//生成当前时间
Date currentDate = DateTimeUtil.getCurrentDateTime();
cabinet.setUpdateTime(currentDate);
cabinet.setId((String) msg.get("id"));
cabinet.setCabinetNum((String) msg.get("cabinetNum"));
cabinet.setName((String) msg.get("name"));
// cabinet.setOrgId((String) msg.get("orgId"));
cabinet.setOrgId((Long) msg.get("orgId"));
cabinet.setLocation((String) msg.get("location"));
//cabinet.setUpdateUser((String) msg.get("updateUser"));
//cabinet.setState((Integer) msg.get("errorState"));
cabinetMapper.updateCabinet(cabinet);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
@Override
......@@ -195,30 +211,30 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
try {
checkNotBlank(msg.get("cabinetId"), "cabinetId不能为空");
checkNotBlank(msg.get("cabinetBoxList"), "cabinetBoxList不能为空");
List<Map<String,Object>> boxMsg = (List<Map<String,Object>>)msg.get("cabinetBoxList");
for (Map<String,Object> box:boxMsg){
List<Map<String, Object>> boxMsg = (List<Map<String, Object>>) msg.get("cabinetBoxList");
for (Map<String, Object> box : boxMsg) {
checkNotBlank(box.get("cabinetBoxId"), "cabinetBoxId不能为空");
checkNotBlank(box.get("state"), "state不能为空");
}
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, e.getMessage());
}
//判断组织机构id是否正确
CabinetBox cabinetBox =new CabinetBox();
CabinetBox cabinetBox = new CabinetBox();
//读取单警柜id
cabinetBox.setCabinetId(msg.get("cabinetId").toString());
//获取cabinetBoxList
List<Map<String,Object>> boxMsg = (List<Map<String,Object>>)msg.get("cabinetBoxList");
for (Map<String,Object> box:boxMsg){
List<Map<String, Object>> boxMsg = (List<Map<String, Object>>) msg.get("cabinetBoxList");
for (Map<String, Object> box : boxMsg) {
cabinetBox.setId((String) box.get("cabinetBoxId"));
cabinetBox.setState((Integer) box.get("state"));
cabinetBox.setErrorMsg((String) box.get("errorMsg"));
cabinetBoxMapper.changeCabinetState(cabinetBox);
}
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
@Override
......@@ -233,10 +249,10 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
checkNotBlank(msg.get("orgId"), "orgId不能为空");
checkNotBlank(msg.get("IncludeLowerLevel"), "IncludeLowerLevel不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, e.getMessage());
}
List<Map<String, Object>> allCabinet=new ArrayList<>();
List<Map<String, Object>> allCabinet = new ArrayList<>();
// // 构建 Redis 缓存键
// String redisKey = REDIS_CABINET;
......@@ -265,20 +281,20 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
// }
//如果组织机构是浙江省公安厅
if (msg.get("orgId").toString().equals("1369509498032808905") && msg.get("IncludeLowerLevel").toString().equals("true")){
allCabinet = cabinetMapper.getAllCabinet();
//将查询结果存入 Redis 中
//redisUtils.set(redisKey, allCabinet);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allCabinet);
}
// if (msg.get("orgId").toString().equals("1369509498032808905") && msg.get("IncludeLowerLevel").toString().equals("true")) {
// allCabinet = cabinetMapper.getAllCabinet();
// //将查询结果存入 Redis 中
// //redisUtils.set(redisKey, allCabinet);
// return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS, allCabinet);
// }
//获取该组织机构下所有仓库的id
List<String> allOrgId =getAllOrgId(msg);
if (allOrgId.isEmpty()){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"未查询到相关信息");
}
allCabinet = getAllCabinetByOrg(msg,allOrgId);
// List<String> allOrgId = getAllOrgId(msg);
// if (allOrgId.isEmpty()) {
// return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, "未查询到相关信息");
// }
//
// allCabinet = getAllCabinetByOrg(msg, allOrgId);
//List<Map<String, Object>> selectedCabinets = new ArrayList<>(); // 存放匹配到的柜子信息的列表
......@@ -295,8 +311,6 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
// }
// String orgId = msg.get("orgId").toString();
// List<String> allCabinetId =getAllCabinetId(msg);
// for (String cabinetId :allCabinetId){
......@@ -308,35 +322,40 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
//
//将查询结果存入 Redis 中
//redisUtils.set(redisKey, allCabinet);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allCabinet);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS, allCabinet);
}
private List<String> getAllOrgId(Map<String, Object> msg) {
private List<String> getAllOrgId(CabinetReq req, String includeLowerLevel) {
List<String> allOrg = new ArrayList<>();
if (msg.get("IncludeLowerLevel").equals("false")){
allOrg.add((String) msg.get("orgId"));
}else if(msg.get("IncludeLowerLevel").equals("true")){
if (includeLowerLevel.equals("false")) {
allOrg.add(req.getOrgId());
} else if (includeLowerLevel.equals("true")) {
//查询某组织机构的本级及下级
allOrg = pubOrgService.getLowerOrg(msg.get("orgId").toString());
allOrg = pubOrgService.getLowerOrg(req.getOrgId());
}
return allOrg;
}
private List<Map<String, Object>> getAllCabinetByOrg(Map<String, Object> msg, List<String> allOrgId) {
List<Map<String, Object>> allCabinet = new ArrayList<>();
private List<Cabinet> getAllCabinetByOrg( List<String> allOrgId) {
List<Cabinet> allCabinet = new ArrayList<>();
allCabinet = cabinetMapper.getAllCabinetByOrgList(allOrgId);
return allCabinet;
}
private List<CabinetDto> getAllCabinetByOrg111( List<String> allOrgId) {
List<CabinetDto> allCabinet = new ArrayList<>();
allCabinet = cabinetMapper.getAllCabinetByOrgList111(allOrgId);
return allCabinet;
}
@Override
public List<String> getAllCabinetId(Map<String, Object> msg) {
//如果组织机构是最高级的,获取所有id
if (msg.get("orgId").toString().equals("1369509498032808905")){
if (msg.get("orgId").toString().equals("1369509498032808905")) {
//构建 Redis 缓存键
String redisKey = "getAllCabinetId_"+msg.get("IncludeLowerLevel")+'_'+msg.get("orgId");
String redisKey = "getAllCabinetId_" + msg.get("IncludeLowerLevel") + '_' + msg.get("orgId");
// 从 Redis 中获取数据
List<String> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData!=null){
if (cachedData != null) {
return cachedData;
}
List<String> allCabinetId = cabinetMapper.getAllCabinetIdByHighest();
......@@ -346,18 +365,18 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
}
//构建 Redis 缓存键
String redisKey = "getAllCabinetId_"+msg.get("IncludeLowerLevel")+'_'+msg.get("orgId");
String redisKey = "getAllCabinetId_" + msg.get("IncludeLowerLevel") + '_' + msg.get("orgId");
// 从 Redis 中获取数据
List<String> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData!=null){
if (cachedData != null) {
return cachedData;
}
List<String> cabinetId = new ArrayList<>();
if (msg.get("IncludeLowerLevel").equals("false")){
if (msg.get("IncludeLowerLevel").equals("false")) {
cabinetId = cabinetMapper.getAllCabinetId(msg.get("orgId").toString());
}else{
} else {
List<String> orgIds = getSubIds(msg.get("orgId").toString()); //调用本级及下级的所有组织机构的id
for (String orgId:orgIds){
for (String orgId : orgIds) {
List<String> allPoliceId = cabinetMapper.getAllCabinetId(orgId);
cabinetId.addAll(allPoliceId);
}
......@@ -373,25 +392,25 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
try {
checkNotBlank(msg.get("id"), "id不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, e.getMessage());
}
String idMsg = msg.get("id").toString();
Map<String, Object> cabinetMsg = getOneCabinet(idMsg);
if (cabinetMsg==null){
return new ResponseResult(HttpStatus.NO_DATA,ReturnMsg.NO_DATA, ReturnData.NO_DATA);
if (cabinetMsg == null) {
return new ResponseResult(HttpStatus.NO_DATA, ReturnMsg.NO_DATA, ReturnData.NO_DATA);
}
List<Map<String, Object>> allBoxMsg = cabinetBoxMapper.getBoxMsg(idMsg);
cabinetMsg.put("cabinetBoxList",allBoxMsg);
cabinetMsg.put("cabinetBoxList", allBoxMsg);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,cabinetMsg);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS, cabinetMsg);
}
public ResponseResult setCabinetInventory(Map<String, Object> msg) {
String id;
if (msg.containsKey("locationId") && msg.get("locationId")!=""){
if (msg.containsKey("locationId") && msg.get("locationId") != "") {
id = msg.get("locationId").toString();
}else {
} else {
id = null;
}
//统计仓库 装备总数
......@@ -408,91 +427,262 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
/**
* 添加单警柜
*
* @param req
* @return
*/
@Transactional
@Override
public boolean addCabinet(CabinetReq req) throws Exception {
public boolean addCabinetInfo(CabinetReq req) {
Cabinet cabinet = new Cabinet();
//查询传日的组织机构id是否存在
Long onePubOrg = pubOrgMapper.getOnePubOrg(req.getOrgId());
if(onePubOrg == null || onePubOrg.equals("")){
throw new Exception("该组织机构不存在");
//查询传入的组织机构id是否存在
LambdaQueryWrapper<PubOrg> pubOrgWrapper = PubOrgWrapper(Long.parseLong(req.getOrgId()));
PubOrg puborg = pubOrgService.getOne(pubOrgWrapper);
if (ObjectUtil.isEmpty(puborg)) {
//抛出组织机构不存在异常
throw new ServiceException(CabinetExceptionEnum.PUBORG_NOT_EXIST);
}
//查询是否有重复的单警柜编号
Map<String, Object> hashCabinetNum = cabinetMapper.getCabinetByCabinetNum(req.getCabinetNum());
if (hashCabinetNum!=null){
throw new Exception("单警柜编号重复");
}
BeanPlusUtil.copyProperties(req,cabinet);
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
cabinet.setId(uuid);
LambdaQueryWrapper<Cabinet> wrapper2 = CabinetWrapper(req);
wrapper2.eq(ObjectUtil.isNotEmpty(req.getCabinetNum()),Cabinet::getCabinetNum,req.getCabinetNum());
List<Cabinet> list = this.list(wrapper2);
if (list.size()>0) {
//抛出单警柜重复异常
throw new ServiceException(CabinetExceptionEnum.CABINETID_IS_EXISTS);
}
BeanPlusUtil.copyProperties(req, cabinet);
cabinet.setCreateTime(DateTimeUtil.getCurrentDateTime());
cabinet.setUpdateTime(DateTimeUtil.getCurrentDateTime());
return this.save(cabinet);
boolean result = save(cabinet);
LambdaQueryWrapper<Cabinet> wrapper3 = CabinetWrapper(req);
wrapper3.eq(ObjectUtil.isNotEmpty(ObjectUtil.isNotEmpty(req.getCabinetNum())), Cabinet::getCabinetNum, req.getCabinetNum())
.eq(ObjectUtil.isNotEmpty(ObjectUtil.isNotEmpty(req.getOrgId())), Cabinet::getOrgId, req.getOrgId())
.eq(ObjectUtil.isNotEmpty(ObjectUtil.isNotEmpty(req.getName())), Cabinet::getName, req.getName());
Cabinet one = getOne(wrapper3);
for (int i = 1; i <= req.getNum(); i++) {
CabinetBox cabinetBox = new CabinetBox();
cabinetBox.setCabinetId(one.getId());
cabinetBox.setState(1);
cabinetBox.setNum(i);
//保存
cabinetBoxService.save(cabinetBox);
}
return result;
}
/**
* 删除单警柜
*
* @param req
* @return
*/
@Override
public boolean deleteCabinet(CabinetReq req) {
this.removeById(req.getId());
return true;
public boolean deleteCabinetInfo(CabinetReq req) {
//通过单警柜id查询出他的箱门数
LambdaQueryWrapper<Cabinet> wrapper = CabinetWrapper(req)
.eq(ObjectUtil.isNotEmpty(req.getId()), Cabinet::getId, req.getId());
Cabinet cabinet = this.getOne(wrapper);
//如果查询不到单警柜抛出异常
if (ObjectUtil.isEmpty(cabinet)) {
throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
}
//通过单警柜id循环遍历出并删除所有箱门信息
LambdaQueryWrapper<CabinetBox> eq = CabinetboxWrapper(req)
.eq(ObjectUtil.isNotEmpty(req.getId()), CabinetBox::getCabinetId, req.getId());
List<CabinetBox> list = cabinetBoxService.list(eq);
for (CabinetBox cabinetBox: list) {
//删除箱门信息的同时需要去判断箱门是否绑定警员,如果有,则解除绑定
Policeman one = policemanService.getOne(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotEmpty(cabinetBox.getId()),Policeman::getCabinetBoxId,cabinetBox.getId()));
if (!ObjectUtil.isNull(one)){
one.setCabinetBoxId(null);
policemanService.updateById(one);
}
cabinetBoxService.removeById(cabinetBox.getId());
}
//删除单警柜id
return this.removeById(cabinet.getId());
}
/**
* 获取单警柜列表
* @param req
*通过机构id进行查询
* @param req 单警柜信息
* @param req getIncludeLowerLevel true:查询本级及下级 false:查询本级
* @return
*/
@Override
public List<Cabinet> getAllCabinet(CabinetReq req,String includeLowerLevel) {
public List<Cabinet> getAllCabinetList(CabinetReq req) {
List<Cabinet> cabinets = new ArrayList<>();
//如果组织机构时浙江省公安厅
if (req.getOrgId().equals("1369509498032808905") && req.getIncludeLowerLevel().equals("true")) {
cabinets = cabinetMapper.getAllCabinet();
return cabinets;
}
//分两种情况,如果说是本级及下级(全部)所有的单警柜信息,则incluLowerLevel为true,如果是查询本级的单警柜信息则为false
if (req.getIncludeLowerLevel().equals("true") || req.getIncludeLowerLevel().equals("false")) {
List<String> allOrgId = getAllOrgId(req, req.getIncludeLowerLevel());
if (allOrgId.isEmpty()) {
//抛出组织机构不存在异常
throw new ServiceException(CabinetExceptionEnum.PUBORG_NOT_EXIST);
}
cabinets = getAllCabinetByOrg(allOrgId);
return cabinets;
} else {
//传递的数据是否正确,不正确抛异常(只接受true、false)
throw new ServiceException(CabinetExceptionEnum.PARAMETER_ERROR);
}
}
return null;
/**
* 通过单警柜id查询单个单警柜及其箱门信息
* @param req
* @return
*/
@Override
public CabinetDto showOneCabinet(CabinetReq req) {
//查询单警柜信息
LambdaQueryWrapper<Cabinet> eq = CabinetWrapper(req)
.eq(ObjectUtil.isNotEmpty(req.getId()), Cabinet::getId, req.getId());
Cabinet one = getOne(eq);
if (ObjectUtil.isNull(one)){
throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
}
//查询单警柜的箱门信息
LambdaQueryWrapper<CabinetBox> eq1 = CabinetboxWrapper(req)
.eq(ObjectUtil.isNotEmpty(req.getId()), CabinetBox::getCabinetId, req.getId());
List<CabinetBox> list = cabinetBoxService.list(eq1);
//将单警柜的信息和它的箱门信息返回
CabinetDto cabinetDto = new CabinetDto();
BeanPlusUtil.copyProperties(one,cabinetDto);
cabinetDto.setList(list);
return cabinetDto;
}
/**
* 修改单警柜信息
* 新增箱数
* @param req
* @return
*/
@Override
public boolean updateCabinet(CabinetReq req) throws Exception {
//查询传日的组织机构id是否存在
Long onePubOrg = pubOrgMapper.getOnePubOrg(req.getOrgId());
if(onePubOrg == null || onePubOrg.equals("")){
throw new Exception("该组织机构不存在");
}
//查询是否有重复的cabinetNum
Map<String, Object> hashCabinetNum = cabinetMapper.getCabinetByCabinetNum(req.getCabinetNum());
//判断policeCode是否有变动
String oldCabinetNum = cabinetMapper.getCabinetNumById(req.getId());
if (oldCabinetNum!=null && !oldCabinetNum.equals(req.getCabinetNum())){
if (hashCabinetNum!=null){
throw new Exception("主柜编号重复");
public boolean updateCabinetInfo(CabinetReq req) {
//查询传入的组织机构id是否存在
LambdaQueryWrapper<PubOrg> pubOrgwrapper = PubOrgWrapper(Long.parseLong(req.getOrgId()));
PubOrg puborg = pubOrgService.getOne(pubOrgwrapper);
if (ObjectUtil.isEmpty(puborg)) {
//抛出组织机构不存在异常
throw new ServiceException(CabinetExceptionEnum.PUBORG_NOT_EXIST);
}
//查询是否有重复的单警柜编号
LambdaQueryWrapper<Cabinet> wrapper2 = CabinetWrapper(req);
wrapper2.eq(ObjectUtil.isNotEmpty(req.getCabinetNum()),Cabinet::getCabinetNum,req.getCabinetNum());
List<Cabinet> list = this.list(wrapper2);
if (list.size()>0) {
//抛出单警柜重复异常
throw new ServiceException(CabinetExceptionEnum.CABINETID_IS_EXISTS);
}
Cabinet cabinet =new Cabinet();
BeanPlusUtil.copyProperties(req,cabinet);
Cabinet cabinet = new Cabinet();
BeanPlusUtil.copyProperties(req, cabinet);
//如果新增箱门个数,那么对应的箱门表中也需要插入对应对应数量的箱门记录条数
LambdaQueryWrapper<Cabinet> eq = CabinetWrapper(req)
.eq(ObjectUtil.isNotEmpty(req.getOrgId()), Cabinet::getOrgId, req.getOrgId())
.eq(ObjectUtil.isNotEmpty(req.getCabinetNum()), Cabinet::getCabinetNum, req.getCabinetNum());
Cabinet cabinet1 = this.getOne(eq);
Integer oldNum = cabinet1.getNum();
Integer totalBoxNum = cabinet1.getNum()+req.getNum();
//循环新增箱数信息
for (int i= oldNum+1;i<=totalBoxNum;i++){
CabinetBox cabinetBox = new CabinetBox();
//箱门id
String id = UUID.randomUUID().toString();
cabinetBox.setId(id);
cabinetBox.setCabinetId(req.getId());
cabinet.setState(1);
cabinetBox.setNum(i);
//保存
cabinetBoxService.save(cabinetBox);
}
//总箱门数就是原来的箱门数+新增的箱门数
cabinet.setNum(totalBoxNum);
return this.updateById(cabinet);
}
/**
* 箱门绑定人员
* 箱门id-->人员
* @param req
* @return
*/
@Override
public boolean boxBindPolice(CabinetBoxReq req) {
//通过箱门id查询出箱门信息
CabinetBox one = cabinetBoxService.getOne(new LambdaQueryWrapper<CabinetBox>()
.eq(ObjectUtil.isNotEmpty(req.getId()), CabinetBox::getId, req.getId()));
if (ObjectUtil.isEmpty(one)){
//箱门id不存在
throw new ServiceException(CabinetExceptionEnum.CABINETBOX_ISNOT_EXISTS);
}
//获取箱门的主柜id
String cabinetId = one.getCabinetId();
//通过主柜id获取机构id
Cabinet one1 = getOne(new LambdaQueryWrapper<Cabinet>()
.eq(ObjectUtil.isNotEmpty(cabinetId), Cabinet::getId,cabinetId));
if (ObjectUtil.isEmpty(one1)){
//单警柜不存在异常
throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
}
long orgId = one1.getOrgId();
//通过警员id获取警员所在的机构id
Policeman one2 = policemanService.getOne(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotEmpty(req.getPoliceId()), Policeman::getId, req.getPoliceId()));
if (ObjectUtil.isEmpty(one2)){
//警员不存在异常
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
Long orgId1 = one2.getOrgId();
//判断两个机构id是否相同,相同则可以绑定,不相同则绑定失败
if (!(orgId1==orgId)){
return false;
}
one2.setCabinetBoxId(one.getId());
return policemanService.updateById(one2);
}
//查询的各种条件信息
private LambdaQueryWrapper<Cabinet> createWrapper(CabinetReq req) {
//单警柜主柜查询条件
private LambdaQueryWrapper<Cabinet> CabinetWrapper(CabinetReq req) {
LambdaQueryWrapper<Cabinet> wrapper = new LambdaQueryWrapper<>();
//查询全部
if (ObjectUtil.isEmpty(req)) {
return wrapper;
}
return wrapper;
}
//箱门的查询条件
private LambdaQueryWrapper<CabinetBox> CabinetboxWrapper(CabinetReq req) {
LambdaQueryWrapper<CabinetBox> wrapper = new LambdaQueryWrapper<>();
//查询全部
if (ObjectUtil.isEmpty(req)) {
return wrapper;
}
//单警柜id
wrapper.like(ObjectUtil.isNotEmpty(req.getId()), Cabinet::getId, req.getId());
//模糊查询
//机构id
wrapper.like(ObjectUtil.isNotEmpty(req.getOrgId()), Cabinet::getOrgId, req.getOrgId());
wrapper.orderByDesc(Cabinet::getUpdateTime);
return wrapper;
}
//查询机构id是否存在
private LambdaQueryWrapper<PubOrg> PubOrgWrapper(long orgId) {
LambdaQueryWrapper<PubOrg> wrapper = new LambdaQueryWrapper<>();
//查询全部
if (ObjectUtil.isEmpty(orgId)) {
return wrapper;
}
//查询机构id是否存在
wrapper.eq(ObjectUtil.isNotEmpty(orgId),PubOrg::getOrgId,orgId);
return wrapper;
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.jyzb.api.bean.req.EquipmentSizeReq;
import com.junmp.jyzb.api.bean.req.ProductReq;
import com.junmp.jyzb.api.exception.enums.ProductExceptionEnum;
import com.junmp.jyzb.api.util.GenCodeUtil;
import com.junmp.jyzb.entity.EquipmentSize;
import com.junmp.jyzb.entity.Product;
......@@ -14,6 +15,7 @@ import com.junmp.jyzb.utils.DateTimeUtil;
import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.jyzb.utils.ReturnMsg;
import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.util.BeanPlusUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -202,8 +204,8 @@ public class EquipmentSizeServiceImpl extends ServiceImpl<EquipmentSizeMapper, E
@Override
public EquipmentSize getOneSize(EquipmentSizeReq req) {
LambdaQueryWrapper<EquipmentSize> wrapper = createWrapperById(req);
return null;
//LambdaQueryWrapper<EquipmentSize> wrapper = createWrapperById(req);
return this.getById(req);
}
private LambdaQueryWrapper<EquipmentSize> createWrapperById(EquipmentSizeReq req) {
......@@ -212,29 +214,59 @@ public class EquipmentSizeServiceImpl extends ServiceImpl<EquipmentSizeMapper, E
return wrapper;
}
//根据id编码查询
// wrapper.eq(ObjectUtil.isNotEmpty(req.getProductCode()), Product::getProductCode, req.getProductCode());
//
// wrapper.orderByDesc(Product::getCreateTime);
wrapper.eq(ObjectUtil.isNotEmpty(req.getId()), EquipmentSize::getId, req.getId());
wrapper.orderByDesc(EquipmentSize::getCreateTime);
return wrapper;
}
@Override
public boolean deleteSize(EquipmentSizeReq msg) {
return false;
public boolean deleteSize(EquipmentSizeReq req) {
EquipmentSize size = querySize(req);
this.removeById(req.getId());
return true;
}
@Override
public boolean updateSize(EquipmentSizeReq msg) {
return false;
public boolean updateSize(EquipmentSizeReq req) {
EquipmentSize size = this.querySize(req);
BeanPlusUtil.copyProperties(req, size);
return this.updateById(size);
}
@Override
public boolean changeSizeState(EquipmentSizeReq msg) {
return false;
public boolean changeSizeState(EquipmentSizeReq req) {
EquipmentSize size = this.querySize(req);
BeanPlusUtil.copyProperties(req, size);
return this.updateById(size);
}
@Override
public List<EquipmentSize> getAllSize(EquipmentSizeReq msg) {
return null;
public List<EquipmentSize> getAllSize(EquipmentSizeReq req) {
LambdaQueryWrapper<EquipmentSize> wrapper = createWrapper(req);
return this.list(wrapper);
}
private EquipmentSize querySize(EquipmentSizeReq req) {
EquipmentSize app = this.getById(req.getId());
if (ObjectUtil.isNull(app)) {
throw new ServiceException(ProductExceptionEnum.SIZE_NOT_EXIST);
}
return app;
}
private LambdaQueryWrapper<EquipmentSize> createWrapper(EquipmentSizeReq req) {
LambdaQueryWrapper<EquipmentSize> wrapper = new LambdaQueryWrapper<>();
if (ObjectUtil.isEmpty(req)) {
return wrapper;
}
//根据业务编码查询
wrapper.like(ObjectUtil.isNotEmpty(req.getTypeId()), EquipmentSize::getTypeId, req.getTypeId());
//根据名称模糊查询
wrapper.like(ObjectUtil.isNotEmpty(req.getName()), EquipmentSize::getName, req.getName());
wrapper.orderByDesc(EquipmentSize::getCreateTime);
return wrapper;
}
}
\ No newline at end of file
......@@ -4,13 +4,9 @@ import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.jyzb.api.bean.req.ProductReq;
import com.junmp.jyzb.api.exception.enums.ProductExceptionEnum;
import com.junmp.jyzb.beanReq.PolicemanFingerReq;
import com.junmp.jyzb.api.bean.req.PolicemanFingerReq;
import com.junmp.jyzb.entity.PoliceFinger;
import com.junmp.jyzb.entity.Product;
import com.junmp.jyzb.exception.enums.PolicemanFingerExceptionEnum;
import com.junmp.jyzb.mapper.ProductMapper;
import com.junmp.jyzb.service.PoliceFingerService;
import com.junmp.jyzb.utils.DateTimeUtil;
import com.junmp.v2.common.exception.base.ServiceException;
......@@ -41,23 +37,36 @@ public class PoliceFingerServiceImpl extends ServiceImpl<PoliceFingerMapper, Pol
//新增指纹信息
@Override
public boolean addFingerInfo(PolicemanFingerReq req) {
PoliceFinger policeFinger = new PoliceFinger();
BeanPlusUtil.copyProperties(req, policeFinger);
PoliceFinger policeFinger = getOne(new LambdaQueryWrapper<PoliceFinger>()
.eq(ObjectUtil.isNotEmpty(req.getPoliceId()),PoliceFinger::getPoliceId,req.getPoliceId())
.eq(ObjectUtil.isNotEmpty(req.getFingerInfo()),PoliceFinger::getFingerInfo,req.getFingerInfo()));
//指纹信息存在抛出异常
if (ObjectUtil.isNotNull(policeFinger)) {
throw new ServiceException(PolicemanFingerExceptionEnum.POLICEMAN_FINGER_EXCEPTION_ENUM);
}
PoliceFinger policeFinger1=new PoliceFinger();
BeanPlusUtil.copyProperties(req, policeFinger1);
//创建时间
policeFinger.setCreateTime(DateTimeUtil.getCurrentDateTime());
policeFinger1.setCreateTime(DateTimeUtil.getCurrentDateTime());
//更新时间
policeFinger.setUpdateTime(DateTimeUtil.getCurrentDateTime());
return this.save(policeFinger);
policeFinger1.setUpdateTime(DateTimeUtil.getCurrentDateTime());
return this.save(policeFinger1);
}
//修改指纹信息
@Override
public boolean updateFingerInfo(PolicemanFingerReq req) {
PoliceFinger policeFinger = this.queryPolicemanFinger(req);
BeanPlusUtil.copyProperties(req,policeFinger);
PoliceFinger one = getOne(new LambdaQueryWrapper<PoliceFinger>()
.eq(ObjectUtil.isNotEmpty(req.getId()), PoliceFinger::getId, req.getId()));
//指纹id错误,指纹信息不存在
if (ObjectUtil.isNull(one)){
throw new ServiceException(PolicemanFingerExceptionEnum.POLICEMAN_FINGER_NOTEXISTS);
}
BeanPlusUtil.copyProperties(req,one);
//更新时间
policeFinger.setUpdateTime(DateTimeUtil.getCurrentDateTime());
return this.updateById(policeFinger);
one.setUpdateTime(DateTimeUtil.getCurrentDateTime());
return this.updateById(one);
}
//查询指纹信息
......@@ -87,15 +96,6 @@ public class PoliceFingerServiceImpl extends ServiceImpl<PoliceFingerMapper, Pol
return PageResultFactory.createPageResult(page);
}
//添加指纹时判断指纹是否存在,如果存在则抛出异常
//异常信息为:指纹信息已经存在
private PoliceFinger queryPolicemanFinger(PolicemanFingerReq req) {
PoliceFinger policeFinger = this.getById(req);
if (ObjectUtil.isNull(policeFinger)) {
throw new ServiceException(PolicemanFingerExceptionEnum.POLICEMAN_FINGER_EXCEPTION_ENUM);
}
return policeFinger;
}
//查询的各种条件信息
private LambdaQueryWrapper<PoliceFinger> createWrapper(PolicemanFingerReq req) {
......@@ -105,7 +105,7 @@ public class PoliceFingerServiceImpl extends ServiceImpl<PoliceFingerMapper, Pol
}
//根据业务编码查询
//警员id
wrapper.like(ObjectUtil.isNotEmpty(req.getPoliceId()), PoliceFinger::getPoliceId, req.getPoliceId());
wrapper.eq(ObjectUtil.isNotEmpty(req.getPoliceId()), PoliceFinger::getPoliceId, req.getPoliceId());
//根据企业名称模糊查询
//指纹名称
wrapper.like(ObjectUtil.isNotEmpty(req.getName()), PoliceFinger::getName, req.getName());
......
package com.junmp.jyzb.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.jyzb.api.bean.req.CabinetReq;
import com.junmp.jyzb.api.bean.req.PolicemanReq;
import com.junmp.jyzb.api.bean.req.ProductReq;
import com.junmp.jyzb.entity.Cabinet;
import com.junmp.jyzb.entity.CabinetBox;
import com.junmp.jyzb.entity.PoliceFinger;
import com.junmp.jyzb.entity.Product;
import com.junmp.jyzb.exception.enums.PolicemanExceptionEnum;
import com.junmp.jyzb.mapper.*;
import com.junmp.jyzb.service.CabinetService;
import com.junmp.jyzb.service.PolicemanService;
import com.junmp.jyzb.service.PubOrgService;
import com.junmp.jyzb.utils.*;
import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.util.BeanPlusUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
......@@ -48,16 +53,16 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
@Resource
private PubOrgService pubOrgService;
@Resource
private CabinetService cabinetService;
@Resource
private PolicemanService policemanService;
private static final String REDIS_POLICE = "Policeman_";
private static final String REDIS_ORG = "Organization_";
@Override
public List<Policeman> getAllPoliceman(PolicemanReq req) {
LambdaQueryWrapper<Policeman> wrapper = createWrapper(req);
return this.list(wrapper);
}
@Override
public ResponseResult addPoliceman(Map<String, Object> policeman) {
// 进行参数校验
try {
......@@ -82,11 +87,12 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
//查询是否有重复的policeCode
List<String> policeCodeFlag = policemanMapper.getPoliceByPoliceCode((String) policeman.get("policeCode"));
if (!policeCodeFlag.isEmpty()){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"警员编号已存在");
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,"警员编号已存在");
}
//todo cabinetBoxId能否重复
//查询单警柜箱号是否存在
if (policeman.containsKey("cabinetBoxId") && policeman.get("cabinetBoxId").toString()!=""){ //如果cabinetBoxId的存在且值不为空
String oneCabinetBox = cabinetBoxMapper.getOneCabinetBox(policeman.get("cabinetBoxId").toString());
......@@ -105,7 +111,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
police.setUpdateTime(currentDate);
police.setId(uuid);
police.setOrgId((String) policeman.get("orgId"));
police.setOrgId((Long) policeman.get("orgId"));
police.setName((String) policeman.get("name"));
police.setPoliceCode((String) policeman.get("policeCode"));
police.setSex((String) policeman.get("sex"));
......@@ -116,6 +122,34 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
policemanMapper.addPoliceman(police);
// // 将uuid、创建时间、更新时间加入到policeman中
// policeman.put("id",uuid);
// long timestamp = currentDate.getTime(); // 将Date对象转换为long类型的时间戳
// policeman.put("updateTime",timestamp);
//
// /**
// * 更新缓存
// * */
// //构建Redis缓存键
// String redisKey = REDIS_ORG + "true" +'_'+ policeman.get("orgId").toString();
// // 从 Redis 中获取数据
// List<Map<String, Object>> cachedDataTrue = redisUtils.findCachedData(redisKey);
// if (cachedDataTrue != null) {
// cachedDataTrue.add(0,policeman);
// //将查询结果存入 Redis 中
// redisUtils.set(redisKey, cachedDataTrue);
// }
//
// //构建Redis缓存键
// redisKey = REDIS_ORG + "false" +'_'+ policeman.get("orgId").toString();
// // 从 Redis 中获取数据
// List<Map<String, Object>> cachedDataFalse = redisUtils.findCachedData(redisKey);
// if (cachedDataFalse != null) {
// cachedDataFalse.add(0,policeman);
// //将查询结果存入 Redis 中
// redisUtils.set(redisKey, cachedDataFalse);
// }
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,uuid);
}
......@@ -243,7 +277,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
//police.setId(uuid);
String id = policeman.get("id").toString();
police.setId(id);
police.setOrgId((String) policeman.get("orgId"));
police.setOrgId((Long) policeman.get("orgId"));
police.setName((String) policeman.get("name"));
police.setPoliceCode((String) policeman.get("policeCode"));
police.setSex((String) policeman.get("sex"));
......@@ -469,20 +503,19 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
}
@Override
public ResponseResult addFaceInfo(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("policeId"), "policeId不能为空");
checkNotBlank(msg.get("faceInfo"), "faceInfo不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
public boolean addFaceInfo(PolicemanReq req) {
//面部信息为null或者为空
if (ObjectUtil.isNull(req.getFaceInfo()) || ObjectUtil.isEmpty(req.getFaceInfo())){
return false;
}
Date currentDate = DateTimeUtil.getCurrentDateTime();
Policeman police =new Policeman();
police.setId(msg.get("policeId").toString());
police.setFaceInfo(msg.get("faceInfo").toString());
police.setUpdateTime(currentDate);
policemanMapper.addFaceInfo(police);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
Policeman police = getOne(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotEmpty(req.getId()),Policeman::getId,req.getId()));
if (ObjectUtil.isNull(police)){
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
police.setFaceInfo(req.getFaceInfo());
police.setUpdateTime(DateTimeUtil.getCurrentDateTime());
return policemanService.updateById(police);
}
@Override
......@@ -531,7 +564,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
return allPoliceman;
}
//@Override
@Override
public ResponseResult getAllPoliceman(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("orgId"), "orgId不能为空");
......@@ -676,23 +709,23 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
/**
* @author lxh
* @description 更新人脸信息\删除人脸信息
* 删除时:传一个null的人脸信息即可
* @since 2023/7/18 15:02
* @param
* @return
**/
@Override
public ResponseResult updateFaceInfo(Map<String, Object> msg) {
try{
checkNotBlank(msg.get("policeId"),"policeId不能为空");
}catch (IllegalArgumentException e){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,e.getMessage());
public boolean updateFaceInfo(PolicemanReq req) {
//警员id不能为空
if (ObjectUtil.isEmpty(req.getId()) || ObjectUtil.isNull(req.getId())){
return false;
}
Policeman police =new Policeman();
police.setId(msg.get("policeId").toString());
police.setFaceInfo(msg.get("faceInfo").toString());
LambdaQueryWrapper<Policeman> eq = PolicemanWrapper(req)
.eq(ObjectUtil.isNotEmpty(req.getId()), Policeman::getId, req.getId());
Policeman police = policemanService.getOne(eq);
police.setFaceInfo(req.getFaceInfo());
police.setUpdateTime(DateTimeUtil.getCurrentDateTime());
policemanMapper.updatePolice(police);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
return policemanService.updateById(police);
}
......@@ -704,51 +737,44 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
* @return
**/
@Override
public ResponseResult searchFaceInfo(Map<String, Object> msg) {
public Policeman searchFaceInfo(PolicemanReq req) {
//警员id不能为空
try {
checkNotBlank(msg.get("policeId"), "policeId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
if (ObjectUtil.isEmpty(req.getId()) || ObjectUtil.isNull(req.getId())){
return null;
}
LambdaQueryWrapper<Policeman> eq = PolicemanWrapper(req)
.eq(ObjectUtil.isNotEmpty(req.getId()), Policeman::getId, req.getId());
Policeman policeman = policemanService.getOne(eq);
if (ObjectUtil.isNull(policeman)){
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
Policeman policeman = policemanMapper.selectOne(new LambdaQueryWrapper<Policeman>()
.eq(Policeman::getId, msg.get("policeId")));
return new ResponseResult(HttpStatus.SUCCESS,"操作成功",policeman);
return policeman;
}
//通过单警柜获取组织机构id,再获取组织机构下的所有警员信息
@Override
public ResponseResult getOrgPoliceman(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("cabinetId"), "cabinetId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
public List<Policeman> getOrgPoliceman(CabinetReq req) {
//通过警柜id获取组织机构id
Cabinet cabinet = cabinetMapper.selectOne(new LambdaQueryWrapper<Cabinet>()
.eq(Cabinet::getId, msg.get("cabinetId")));
Cabinet cabinet = cabinetService.getOne(new LambdaQueryWrapper<Cabinet>()
.eq(ObjectUtil.isNotEmpty(req.getId()),Cabinet::getId, req.getId()));
if (ObjectUtil.isNull(cabinet)){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.NO_DATA,ReturnData.NO_DATA);
return null;
}
long orgId = cabinet.getOrgId();
//通过机构id获取机构下所有的警员信息
List<Policeman> policemenList = policemanMapper.selectList(new LambdaQueryWrapper<Policeman>()
List<Policeman> policemenList = policemanService.list(new LambdaQueryWrapper<Policeman>()
.eq(Policeman::getOrgId, orgId));
return new ResponseResult<>(HttpStatus.SUCCESS,"操作成功",policemenList);
return policemenList;
}
private LambdaQueryWrapper<Policeman> createWrapper(PolicemanReq req) {
private LambdaQueryWrapper<Policeman> PolicemanWrapper(PolicemanReq req) {
LambdaQueryWrapper<Policeman> wrapper = new LambdaQueryWrapper<>();
//查询全部
if (ObjectUtil.isEmpty(req)) {
return wrapper;
}
//根据组织机构编码查询
wrapper.like(ObjectUtil.isNotEmpty(req.getOrgId()), Policeman::getOrgId, req.getOrgId());
//根据警员姓名模糊查询
wrapper.like(ObjectUtil.isNotEmpty(req.getName()), Policeman::getName, req.getName());
//wrapper.orderByDesc(Product::getCreateTime);
return wrapper;
}
......
package com.junmp.jyzb.utils;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.time.Instant;
/**
* 定义统一的返回类
* */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResponseResult<T> {
......@@ -63,6 +64,18 @@ public class ResponseResult<T> {
return data;
}
public void setMessage(String message) {
this.message = message;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
public void setData(T data) {
this.data = data;
}
......
......@@ -6,9 +6,8 @@
<!--@Table base_cabinet_box-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="cabinet_id" jdbcType="VARCHAR" property="cabinetId" />
<result column="police_id" jdbcType="VARCHAR" property="policeId" />
<result column="police_name" jdbcType="VARCHAR" property="policeName" />
<result column="error_state" jdbcType="INTEGER" property="errorState" />
<result column="num" jdbcType="INTEGER" property="num" />
<result column="state" jdbcType="INTEGER" property="state" />
<result column="error_msg" jdbcType="VARCHAR" property="errorMsg" />
<result column="log_map" jdbcType="VARCHAR" property="logMap" />
</resultMap>
......@@ -34,4 +33,8 @@
from base_cabinet_box b
where b.id =#{cabinetBoxId}
</select>
<select id="selectByIdCabinetBoxes" resultType="com.junmp.jyzb.entity.CabinetBox"
parameterType="java.lang.String">
select * from base_cabinet_box b where b.cabinet_id=#{id}
</select>
</mapper>
\ No newline at end of file
......@@ -18,7 +18,11 @@
<result property="updateTime" column="update_time" />
<result property="createUser" column="create_user" />
<result property="updateUser" column="update_user" />
<result property="num" column="num" />
<!-- <collection property="list" ofType="com.junmp.jyzb.entity.CabinetBox" column="cabinet_id"-->
<!-- select="com.junmp.jyzb.mapper.CabinetBoxMapper.selectById">-->
<!-- </collection>-->
</resultMap>
......@@ -60,7 +64,7 @@
where p.id =#{id}
</update>
<select id="getAllCabinet" resultType="Map">
<select id="getAllCabinet" resultMap="BaseCabinetResultMap" >
select
c.id,
c.cabinet_num as cabinetNum,
......@@ -75,6 +79,7 @@
c.out_sum as outSum
from base_cabinet c
left join pub_org o on c.org_id_int =o.org_id
</select>
<select id="getAllCabinetId" resultType="String">
......@@ -130,8 +135,49 @@
#{item}
</foreach>
</select>
<select id="getAllCabinetList" resultType="com.junmp.jyzb.entity.Cabinet">
select
c.id,
c.cabinet_num as cabinetNum,
c.name,
o.org_id as orgId,
o.org_name as orgName,
c.location,
c.state,
c.update_time as updateTime,
c.sum as sum,
c.in_sum as inSum,
c.out_sum as outSum
from base_cabinet c
left join pub_org o on c.org_id_int =o.org_id
where c.org_id_int in
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="getAllCabinetByOrgList111" resultType="com.junmp.jyzb.Dto.CabinetDto">
select
c.id,
c.cabinet_num as cabinetNum,
c.name,
o.org_id as orgId,
o.org_name as orgName,
c.location,
c.state,
c.update_time as updateTime,
c.sum as sum,
c.in_sum as inSum,
c.out_sum as outSum
from base_cabinet c
left join pub_org o on c.org_id_int =o.org_id
where c.org_id_int in
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<update id="setCabinetSumInventory">
<update id="setCabinetSumInventory">
UPDATE base_cabinet AS c
SET sum = (
SELECT count(i.id)
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>junmp-jyzb-app</artifactId>
<groupId>com.junmp.jyzb</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jyzb-boot</artifactId>
<version>1.0.0</version>
<name>jyzb-boot</name>
<packaging>war</packaging>
<<<<<<< HEAD
=======
>>>>>>> develop
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>p6spy</groupId>
<artifactId>p6spy</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>log-biz-manage</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-security-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-config-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-db-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-log-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>swagger2-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-redis-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>file-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>system-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>auth-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>validator-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>job-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-biz</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-process</artifactId>
</dependency>
<!--MQTT-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-mqtt</artifactId>
</dependency>
</dependencies>
<build>
<finalName>jyzb-boot</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- 如果没有该项配置,则devtools不会起作用,即应用不会restart -->
<mainClass>com.junmp.jyzb.boot.JyzbBootApplication</mainClass>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
</project>
package com.junmp.jyzb.config;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* 创建消息接收监听类
* */
@Component
@RabbitListener(queues = "TestDirectQueue") //监听的队列名称 TestDirectQueue
public class DirectReceiver {
@RabbitHandler
public void process(Object testMessage) {
System.out.println("DirectReceiver消费者收到消息 : " + testMessage);
<<<<<<< HEAD
=======
>>>>>>> develop
}
}
\ No newline at end of file
......@@ -13,7 +13,7 @@
<module>jyzb-api</module>
<module>jyzb-boot</module>
<module>jyzb-biz</module>
<module>jyzb-process</module>
<!-- <module>jyzb-process</module>-->
<module>jyzb-common</module>
<module>jyzb-mq</module>
</modules>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论