Commit dc078e49 by 赵剑炜

Merge branch 'develop' of http://gitlab.sothing.top/843502640/jyzb_platformV2 into develop-zhaojw

parents 39f51752 41153705
...@@ -41,7 +41,7 @@ public class CabinetReq extends BaseRequest { ...@@ -41,7 +41,7 @@ public class CabinetReq extends BaseRequest {
* 组织机构号 * 组织机构号
*/ */
@ApiModelProperty(value = "组织机构号") @ApiModelProperty(value = "组织机构号")
private String orgId; private Long orgId;
/** /**
* 位置信息 * 位置信息
......
...@@ -5,6 +5,7 @@ import lombok.Data; ...@@ -5,6 +5,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date; import java.util.Date;
@Data @Data
...@@ -16,9 +17,10 @@ public class PolicemanReq extends BaseRequest { ...@@ -16,9 +17,10 @@ public class PolicemanReq extends BaseRequest {
private String name; private String name;
@NotBlank(message = "箱门id不能为空", groups = {edit.class, delete.class, detail.class}) @NotBlank(message = "箱门id不能为空", groups = {edit.class, delete.class})
private String cabinetBoxId; private String cabinetBoxId;
@NotNull(message = "组织机构id不能为空",groups = {})
private Long orgId; private Long orgId;
private Long departmentId; private Long departmentId;
......
package com.junmp.jyzb.api.bean.query; package com.junmp.jyzb.api.bean.query;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.junmp.v2.common.bean.request.BaseRequest; import com.junmp.v2.common.bean.request.BaseRequest;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class WarehouseReq extends BaseRequest { public class WarehouseReq extends BaseRequest {
@NotBlank(message = "仓库主键不能为空", groups = {edit.class, delete.class, detail.class}) @NotBlank(message = "仓库主键不能为空", groups = {updateStatus.class, delete.class, detail.class})
private String id; private String id;
private Long departmentId; private Long departmentId;
...@@ -38,7 +32,7 @@ public class WarehouseReq extends BaseRequest { ...@@ -38,7 +32,7 @@ public class WarehouseReq extends BaseRequest {
private String updateUser; private String updateUser;
@JsonProperty(value = "orgId") @NotNull(message = "组织机构id不能为空", groups = {edit.class})
private Long orgId; private Long orgId;
private Boolean isLocked; private Boolean isLocked;
...@@ -51,11 +45,11 @@ public class WarehouseReq extends BaseRequest { ...@@ -51,11 +45,11 @@ public class WarehouseReq extends BaseRequest {
private BigDecimal priceTotal; private BigDecimal priceTotal;
@NotNull(message = "仓库状态不能为空", groups = {edit.class}) @NotNull(message = "仓库状态不能为空", groups = {updateStatus.class})
private Integer state; private Integer state;
private Long orderId; private Long orderId;
@JsonProperty(value = "IncludeLowerLevel") @NotBlank(message = "IncludeLowerLevel不能为空", groups = {edit.class})
private String IncludeLowerLevel; private String IncludeLowerLevel;
} }
\ No newline at end of file
...@@ -13,7 +13,7 @@ import javax.validation.constraints.NotNull; ...@@ -13,7 +13,7 @@ import javax.validation.constraints.NotNull;
public class UpdateCabinetBoxReq extends BaseRequest { public class UpdateCabinetBoxReq extends BaseRequest {
@NotBlank(message = "箱门id不能为空",groups = {add.class,edit.class}) @NotBlank(message = "箱门id不能为空",groups = {add.class,edit.class})
private String id; private String id;
@NotBlank(message = "箱门状态不能为空",groups = {edit.class}) @NotNull(message = "箱门状态不能为空",groups = {edit.class})
private Integer state; private Integer state;
private String errorMsg; private String errorMsg;
......
...@@ -43,9 +43,9 @@ public class UpdateCabinetReq extends BaseRequest { ...@@ -43,9 +43,9 @@ public class UpdateCabinetReq extends BaseRequest {
/** /**
* 组织机构号 * 组织机构号
*/ */
@NotBlank(message = "组织机构号不能为空", groups = {add.class,edit.class, detail.class}) @NotNull(message = "组织机构号不能为空", groups = {add.class,edit.class, detail.class})
@ApiModelProperty(value = "组织机构号") @ApiModelProperty(value = "组织机构号")
private String orgId; private Long orgId;
/** /**
* 位置信息 * 位置信息
......
...@@ -11,23 +11,23 @@ import java.util.Date; ...@@ -11,23 +11,23 @@ import java.util.Date;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class UpdatePolicemanReq extends BaseRequest { public class UpdatePolicemanReq extends BaseRequest {
@NotNull(message = "警员主键不能为空", groups = {add.class,edit.class, delete.class, detail.class}) @NotNull(message = "警员主键不能为空", groups = {edit.class, delete.class, detail.class})
private String id; private String id;
@NotNull(message = "警员名字不能为空", groups = {add.class,edit.class, delete.class, detail.class}) @NotNull(message = "警员名字不能为空", groups = {add.class,edit.class})
private String name; private String name;
private String cabinetBoxId; private String cabinetBoxId;
@NotNull(message = "组织机构id不能为空", groups = {add.class,edit.class, delete.class, detail.class}) @NotNull(message = "组织机构id不能为空", groups = {add.class,edit.class})
private Long orgId; private Long orgId;
private Long departmentId; private Long departmentId;
@NotNull(message = "警员编号不能为空", groups = {add.class,edit.class, delete.class, detail.class}) @NotNull(message = "警员编号不能为空", groups = {add.class,edit.class})
private String policeCode; private String policeCode;
@NotNull(message = "性别不能为空", groups = {add.class,edit.class, delete.class, detail.class}) @NotNull(message = "性别不能为空", groups = {add.class,edit.class})
private String sex; private String sex;
private String faceInfo; private String faceInfo;
...@@ -38,7 +38,7 @@ public class UpdatePolicemanReq extends BaseRequest { ...@@ -38,7 +38,7 @@ public class UpdatePolicemanReq extends BaseRequest {
private String password; private String password;
@NotNull(message = "电话不能为空", groups = {add.class,edit.class, delete.class, detail.class}) @NotNull(message = "电话不能为空", groups = {add.class,edit.class})
private String photo; private String photo;
private String phone; private String phone;
...@@ -47,7 +47,7 @@ public class UpdatePolicemanReq extends BaseRequest { ...@@ -47,7 +47,7 @@ public class UpdatePolicemanReq extends BaseRequest {
private Date updateTime; private Date updateTime;
@NotNull(message = "身份证号不能为空", groups = {add.class,edit.class, delete.class, detail.class}) @NotNull(message = "身份证号不能为空", groups = {add.class,edit.class})
private String idCard; private String idCard;
private String updateUser; private String updateUser;
......
...@@ -14,32 +14,29 @@ import java.util.List; ...@@ -14,32 +14,29 @@ import java.util.List;
@Data @Data
public class UpdateWarehouseReq extends BaseRequest { public class UpdateWarehouseReq extends BaseRequest {
@NotBlank(message = "仓库主键不能为空", groups = {edit.class, delete.class, detail.class}) @NotBlank(message = "仓库主键不能为空", groups = {edit.class, detail.class})
private String id; private String id;
private Long departmentId; private Long departmentId;
@NotBlank(message = "仓库名称不能为空", groups = {add.class,edit.class, delete.class, detail.class}) @NotBlank(message = "仓库名称不能为空", groups = {add.class,edit.class, detail.class})
private String name; private String name;
@NotBlank(message = "仓库地点不能为空", groups = {add.class,edit.class, delete.class, detail.class}) @NotBlank(message = "仓库地点不能为空", groups = {add.class,edit.class, detail.class})
private String location; private String location;
@NotBlank(message = "联系方式不能为空", groups = {add.class,edit.class, delete.class, detail.class}) @NotBlank(message = "联系方式不能为空", groups = {add.class,edit.class, detail.class})
private String phone; private String phone;
private String video; private String video;
@TableField(value = "create_time",fill = FieldFill.INSERT)
private Date createTime; private Date createTime;
@TableField(value = "update_time",fill = FieldFill.UPDATE)
private Date updateTime; private Date updateTime;
private String updateUser; private String updateUser;
@JsonProperty(value = "orgId") @NotNull(message = "组织机构id不能为空", groups = {add.class,edit.class, detail.class})
@NotNull(message = "组织机构id不能为空", groups = {add.class,edit.class, delete.class, detail.class})
private Long orgId; private Long orgId;
private Boolean isLocked; private Boolean isLocked;
......
...@@ -21,7 +21,6 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -21,7 +21,6 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map;
@RestController @RestController
@Slf4j @Slf4j
...@@ -35,6 +34,13 @@ public class CabinetController { ...@@ -35,6 +34,13 @@ public class CabinetController {
private CabinetBoxService cabinetBoxService; private CabinetBoxService cabinetBoxService;
@PostMapping("/AddCabinetInfo")
@ApiOperation("添加单警柜信息")
public ApiRes<String> addCabinetInfo(@RequestBody @Validated(ValidationApi.add.class) UpdateCabinetReq req){
String cabinetId = cabinetService.addCabinetInfo(req);
return ApiRes.success(cabinetId);
}
@PostMapping("/ErrorState") @PostMapping("/ErrorState")
@ApiOperation("单警柜状态变更") @ApiOperation("单警柜状态变更")
public ApiRes<Boolean> ChangeCabinetState(@RequestBody UpdateCabinetReq req) { public ApiRes<Boolean> ChangeCabinetState(@RequestBody UpdateCabinetReq req) {
...@@ -45,12 +51,6 @@ public class CabinetController { ...@@ -45,12 +51,6 @@ public class CabinetController {
return ApiRes.success(result); return ApiRes.success(result);
} }
@PostMapping("/AddCabinetInfo")
@ApiOperation("添加单警柜信息")
public ApiRes<String> addCabinetInfo(@RequestBody @Validated(ValidationApi.add.class) UpdateCabinetReq req){
String cabinetId = cabinetService.addCabinetInfo(req);
return ApiRes.success(cabinetId);
}
@PostMapping("/DeleteCabinetInfo") @PostMapping("/DeleteCabinetInfo")
@ApiOperation("删除单警柜信息") @ApiOperation("删除单警柜信息")
...@@ -73,11 +73,12 @@ public class CabinetController { ...@@ -73,11 +73,12 @@ public class CabinetController {
//通过单警柜id查询单个箱门及其箱门信息 //通过单警柜id查询单个箱门及其箱门信息
@PostMapping("/ShowOneCabinet") @PostMapping("/ShowOneCabinet")
@ApiOperation("查询单个单警柜及其箱门信息") @ApiOperation("查询单个单警柜及其箱门信息")
public ApiRes<CabinetDto> showOneCabinet(@RequestBody CabinetReq req){ public ApiRes<CabinetDto> showOneCabinet(@RequestBody @Validated(ValidationApi.detail.class) CabinetReq req){
return ApiRes.success(cabinetService.showOneCabinet(req)); return ApiRes.success(cabinetService.showOneCabinet(req));
} }
//根据组织机构id查询出单警柜的详细信息
@PostMapping("/ShowCabinetList") @PostMapping("/ShowCabinetList")
@ApiOperation("查询单警柜列表") @ApiOperation("查询单警柜列表")
public ApiRes<List<CabinetDto>> showCabinetList(@RequestBody CabinetReq req){ public ApiRes<List<CabinetDto>> showCabinetList(@RequestBody CabinetReq req){
...@@ -108,8 +109,8 @@ public class CabinetController { ...@@ -108,8 +109,8 @@ public class CabinetController {
@PostMapping("/SearchOrgId") @PostMapping("/SearchOrgId")
@ApiOperation("/根据单警柜id查询组织机构id") @ApiOperation("/根据单警柜id查询组织机构id")
public ApiRes<Long> SearchOrgId(String id){ public ApiRes<Long> SearchOrgId(@RequestBody @Validated(ValidationApi.detail.class) CabinetReq req){
return ApiRes.success(cabinetService.SearchOrgId(id)); return ApiRes.success(cabinetService.SearchOrgId(req));
} }
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ package com.junmp.jyzb.controller; ...@@ -3,6 +3,7 @@ package com.junmp.jyzb.controller;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.junmp.jyzb.api.bean.dto.PoliceDto; import com.junmp.jyzb.api.bean.dto.PoliceDto;
import com.junmp.jyzb.api.bean.dto.PolicemanDto; import com.junmp.jyzb.api.bean.dto.PolicemanDto;
import com.junmp.jyzb.api.bean.query.CabinetReq;
import com.junmp.jyzb.api.bean.query.PolicemanReq; import com.junmp.jyzb.api.bean.query.PolicemanReq;
import com.junmp.jyzb.api.bean.req.UpdatePolicemanReq; import com.junmp.jyzb.api.bean.req.UpdatePolicemanReq;
import com.junmp.jyzb.entity.Policeman; import com.junmp.jyzb.entity.Policeman;
...@@ -37,7 +38,7 @@ public class PoliceController { ...@@ -37,7 +38,7 @@ public class PoliceController {
@PostMapping("/DeletePolice") @PostMapping("/DeletePolice")
@ApiOperation("删除警员信息") @ApiOperation("删除警员信息")
public ApiRes<Boolean> DeletePolice(@RequestBody UpdatePolicemanReq req) { public ApiRes<Boolean> DeletePolice(@RequestBody @Validated(ValidationApi.delete.class) UpdatePolicemanReq req) {
boolean b = policemanService.DeletePolice(req); boolean b = policemanService.DeletePolice(req);
if (!b){ if (!b){
return ApiRes.failure("删除失败"); return ApiRes.failure("删除失败");
...@@ -71,8 +72,8 @@ public class PoliceController { ...@@ -71,8 +72,8 @@ public class PoliceController {
//根据组织机构id查询,只查询本级,不包含下级 //根据组织机构id查询,只查询本级,不包含下级
@PostMapping("/ShowPoliceList") @PostMapping("/ShowPoliceList")
@ApiOperation("查询某个组织机构下的所有警员信息") @ApiOperation("查询某个组织机构下的所有警员信息")
public ApiRes<PoliceDto> GetAllPolicemanList(Long orgId){ public ApiRes<PoliceDto> GetAllPolicemanList(@RequestBody PolicemanReq req){
PoliceDto policeDto = policemanService.GetAllPolicemanList(orgId); PoliceDto policeDto = policemanService.GetAllPolicemanList(req);
return ApiRes.success(policeDto); return ApiRes.success(policeDto);
} }
...@@ -85,7 +86,7 @@ public class PoliceController { ...@@ -85,7 +86,7 @@ public class PoliceController {
*/ */
@PostMapping("/GetPoliceDetail") @PostMapping("/GetPoliceDetail")
@ApiOperation("查询单个警员信息") @ApiOperation("查询单个警员信息")
public ApiRes<PolicemanDto> GetOnePolice(@RequestBody PolicemanReq req) { public ApiRes<PolicemanDto> GetOnePolice(@RequestBody @Validated(ValidationApi.detail.class) PolicemanReq req) {
return ApiRes.success(policemanService.GetOnePolice(req)); return ApiRes.success(policemanService.GetOnePolice(req));
} }
...@@ -97,9 +98,9 @@ public class PoliceController { ...@@ -97,9 +98,9 @@ public class PoliceController {
*/ */
@PostMapping("/GetPoliceData") @PostMapping("/GetPoliceData")
@ApiOperation("查询与单警柜绑定的警员信息") //根据单警柜id查询 @ApiOperation("查询与单警柜绑定的警员信息") //根据单警柜id查询
public ApiRes<PoliceDto> GetPoliceData(String id){ public ApiRes<PoliceDto> GetPoliceData(@RequestBody CabinetReq req){
//获取该组织机构下所有警员的id //获取该组织机构下所有警员的id
PoliceDto policeDto = policemanService.GetPoliceData(id); PoliceDto policeDto = policemanService.GetPoliceData(req);
return ApiRes.success(policeDto); return ApiRes.success(policeDto);
} }
...@@ -115,7 +116,7 @@ public class PoliceController { ...@@ -115,7 +116,7 @@ public class PoliceController {
@PostMapping("/AddFaceInfo") @PostMapping("/AddFaceInfo")
@ApiOperation("添加警员面部信息") @ApiOperation("添加警员面部信息")
public ApiRes<Boolean> AddFaceInfo(@RequestBody UpdatePolicemanReq req) { public ApiRes<Boolean> AddFaceInfo(@RequestBody @Validated(ValidationApi.detail.class) UpdatePolicemanReq req) {
boolean b = policemanService.AddFaceInfo(req); boolean b = policemanService.AddFaceInfo(req);
if (!b){ if (!b){
return ApiRes.failure("添加失败"); return ApiRes.failure("添加失败");
...@@ -125,7 +126,7 @@ public class PoliceController { ...@@ -125,7 +126,7 @@ public class PoliceController {
@PostMapping("/UpdateFaceInfo") @PostMapping("/UpdateFaceInfo")
@ApiOperation("修改、删除人脸信息") @ApiOperation("修改、删除人脸信息")
public ApiRes<Boolean> UpdateFaceInfo(@RequestBody UpdatePolicemanReq req) { public ApiRes<Boolean> UpdateFaceInfo(@RequestBody @Validated(ValidationApi.detail.class) UpdatePolicemanReq req) {
boolean b = policemanService.UpdateFaceInfo(req); boolean b = policemanService.UpdateFaceInfo(req);
if (!b){ if (!b){
return ApiRes.failure("操作失败"); return ApiRes.failure("操作失败");
...@@ -135,7 +136,7 @@ public class PoliceController { ...@@ -135,7 +136,7 @@ public class PoliceController {
@PostMapping("/SearchFaceInfo") @PostMapping("/SearchFaceInfo")
@ApiOperation("查找人脸信息") @ApiOperation("查找人脸信息")
public ApiRes<Policeman> SearchFaceInfo(@RequestBody PolicemanReq req) { public ApiRes<Policeman> SearchFaceInfo(@RequestBody @Validated(ValidationApi.detail.class) PolicemanReq req) {
Policeman policeman = policemanService.SearchFaceInfo(req); Policeman policeman = policemanService.SearchFaceInfo(req);
if (ObjectUtil.isEmpty(policeman)){ if (ObjectUtil.isEmpty(policeman)){
return ApiRes.failure("未找到警员信息"); return ApiRes.failure("未找到警员信息");
......
...@@ -28,7 +28,7 @@ public class PolicemanFingerController implements PolicemanFingerDoc { ...@@ -28,7 +28,7 @@ public class PolicemanFingerController implements PolicemanFingerDoc {
@PostMapping("/AddFingerInfo") @PostMapping("/AddFingerInfo")
@ApiOperation("添加指纹信息") @ApiOperation("添加指纹信息")
public ApiRes<Boolean> addFingerInfo(@RequestBody @Validated(ValidationApi.add.class) UpdatePoliceFingerReq req) { public ApiRes<Integer> addFingerInfo(@RequestBody @Validated(ValidationApi.add.class) UpdatePoliceFingerReq req) {
return ApiRes.success(policeFingerService.addFingerInfo(req)) ; return ApiRes.success(policeFingerService.addFingerInfo(req)) ;
} }
......
...@@ -55,16 +55,22 @@ public class WarehouseController { ...@@ -55,16 +55,22 @@ public class WarehouseController {
@PostMapping("/ChangeWarehouseState") @PostMapping("/ChangeWarehouseState")
@ApiOperation("禁用/启用仓库") @ApiOperation("禁用/启用仓库")
public ApiRes<Boolean> changeWarehouseState(@RequestBody @Validated(WarehouseReq.edit.class) WarehouseReq req) { public ApiRes<Boolean> changeWarehouseState(@RequestBody @Validated(ValidationApi.updateStatus.class) WarehouseReq req) {
return ApiRes.success(warehouseService.changeWarehouseState(req)); return ApiRes.success(warehouseService.changeWarehouseState(req));
} }
/**
* 通过组织机构id获取仓库列表
* @param req
* @return
*/
@PostMapping("/ShowWarehouse") @PostMapping("/ShowWarehouse")
@ApiOperation("查询仓库列表") @ApiOperation("查询仓库列表")
public ApiRes<List<WarehouseDto>> getAllWarehouse(@RequestBody WarehouseReq req){ public ApiRes<List<WarehouseDto>> getAllWarehouse(@RequestBody @Validated(ValidationApi.edit.class) WarehouseReq req){
return ApiRes.success(warehouseService.getAllWarehouse(req)); return ApiRes.success(warehouseService.getAllWarehouse(req));
} }
//通过仓库id查询列表
@PostMapping("/GetWarehouseDetail") @PostMapping("/GetWarehouseDetail")
@ApiOperation("查询单个仓库信息") @ApiOperation("查询单个仓库信息")
public ApiRes<WarehouseDto> getOneWarehouse(@RequestBody @Validated(WarehouseReq.detail.class)WarehouseReq req) { public ApiRes<WarehouseDto> getOneWarehouse(@RequestBody @Validated(WarehouseReq.detail.class)WarehouseReq req) {
...@@ -73,7 +79,7 @@ public class WarehouseController { ...@@ -73,7 +79,7 @@ public class WarehouseController {
@PostMapping("/UpdateWarehouse") @PostMapping("/UpdateWarehouse")
@ApiOperation("修改仓库信息") @ApiOperation("修改仓库信息")
public ApiRes<Boolean> updateWarehouse(@RequestBody @Validated(WarehouseReq.edit.class) UpdateWarehouseReq req) { public ApiRes<Boolean> updateWarehouse(@RequestBody @Validated(ValidationApi.edit.class) UpdateWarehouseReq req) {
return ApiRes.success(warehouseService.updateWarehouse(req)); return ApiRes.success(warehouseService.updateWarehouse(req));
} }
...@@ -104,7 +110,7 @@ public class WarehouseController { ...@@ -104,7 +110,7 @@ public class WarehouseController {
@PostMapping("/AddShelf") @PostMapping("/AddShelf")
@ApiOperation("添加货架") @ApiOperation("添加货架")
public ApiRes<Boolean> AddShelf(@RequestBody @Validated(ValidationApi.add.class) UpdateShelfReq req) { public ApiRes<String> AddShelf(@RequestBody @Validated(ValidationApi.add.class) UpdateShelfReq req) {
return ApiRes.success(shelfService.AddShelf(req)); return ApiRes.success(shelfService.AddShelf(req));
} }
......
...@@ -14,7 +14,7 @@ import java.util.List; ...@@ -14,7 +14,7 @@ import java.util.List;
@Api(value = "警员指纹管理",tags = "警员指纹管理接口") @Api(value = "警员指纹管理",tags = "警员指纹管理接口")
public interface PolicemanFingerDoc { public interface PolicemanFingerDoc {
@ApiOperation(value = "添加指纹信息", tags = "警员指纹管理接口") @ApiOperation(value = "添加指纹信息", tags = "警员指纹管理接口")
ApiRes<Boolean> addFingerInfo(UpdatePoliceFingerReq req); ApiRes<Integer> addFingerInfo(UpdatePoliceFingerReq req);
@ApiOperation(value = "修改指纹信息", tags = "警员指纹管理接口") @ApiOperation(value = "修改指纹信息", tags = "警员指纹管理接口")
ApiRes<Boolean> updateFingerInfo(UpdatePoliceFingerReq req); ApiRes<Boolean> updateFingerInfo(UpdatePoliceFingerReq req);
......
...@@ -20,6 +20,7 @@ public class User implements Serializable { ...@@ -20,6 +20,7 @@ public class User implements Serializable {
@TableField(value = "real_name") @TableField(value = "real_name")
private String realName; private String realName;
private String nickName; private String nickName;
private String account; private String account;
private String password; private String password;
......
...@@ -44,14 +44,11 @@ public class Warehouse implements Serializable { ...@@ -44,14 +44,11 @@ public class Warehouse implements Serializable {
private String updateUser; private String updateUser;
@TableField("org_id_int") @TableField("org_id_int")
private Long orgIdInt; private Long orgId;
@TableField("is_locked") @TableField("is_locked")
private Boolean isLocked; private Boolean isLocked;
@TableField("org_id")
private String orgId;
@TableField("sum") @TableField("sum")
private Integer sum; private Integer sum;
......
...@@ -16,7 +16,7 @@ import lombok.NoArgsConstructor; ...@@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
@TableName("base_warehouse_area") @TableName("base_warehouse_area")
public class WarehouseArea implements Serializable { public class WarehouseArea implements Serializable {
@TableId(value = "area_id", type = IdType.ASSIGN_UUID) @TableId(value = "area_id", type = IdType.ASSIGN_UUID)
private String id; private String areaId;
@TableField("area_name") @TableField("area_name")
private String areaName; private String areaName;
......
...@@ -12,7 +12,7 @@ import java.util.Map; ...@@ -12,7 +12,7 @@ import java.util.Map;
@Mapper @Mapper
public interface CabinetMapper extends BaseMapper<Cabinet> { public interface CabinetMapper extends BaseMapper<Cabinet> {
List<Cabinet> getAllCabinetByOrgList(@Param("allOrgId") List<String> allOrgId); List<Cabinet> getAllCabinetByOrgList(@Param("allOrgId") List<Long> allOrgId);
......
...@@ -16,4 +16,7 @@ public interface CabinetBoxService extends IService<CabinetBox> { ...@@ -16,4 +16,7 @@ public interface CabinetBoxService extends IService<CabinetBox> {
//添加箱门信息 //添加箱门信息
boolean AddBoxInfo(UpdateCabinetBoxReq req); boolean AddBoxInfo(UpdateCabinetBoxReq req);
//判断箱门信息是否存在
CabinetBox CabinetBoxExist(String id);
} }
...@@ -68,5 +68,10 @@ public interface CabinetService extends IService<Cabinet> { ...@@ -68,5 +68,10 @@ public interface CabinetService extends IService<Cabinet> {
*/ */
boolean ChangeCabinetState(UpdateCabinetReq req); boolean ChangeCabinetState(UpdateCabinetReq req);
Long SearchOrgId(String id); //根据单警柜id查询出组织机构id
Long SearchOrgId(CabinetReq req);
//判断单警柜是否存在
Cabinet CabinetExist(String id);
} }
...@@ -17,7 +17,7 @@ public interface PoliceFingerService extends IService<PoliceFinger> { ...@@ -17,7 +17,7 @@ public interface PoliceFingerService extends IService<PoliceFinger> {
* @param req * @param req
* @return * @return
*/ */
boolean addFingerInfo(UpdatePoliceFingerReq req); Integer addFingerInfo(UpdatePoliceFingerReq req);
/** /**
* 更新指纹信息 * 更新指纹信息
......
...@@ -3,6 +3,7 @@ package com.junmp.jyzb.service; ...@@ -3,6 +3,7 @@ package com.junmp.jyzb.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.jyzb.api.bean.dto.PoliceDto; import com.junmp.jyzb.api.bean.dto.PoliceDto;
import com.junmp.jyzb.api.bean.dto.PolicemanDto; import com.junmp.jyzb.api.bean.dto.PolicemanDto;
import com.junmp.jyzb.api.bean.query.CabinetReq;
import com.junmp.jyzb.api.bean.query.PolicemanReq; import com.junmp.jyzb.api.bean.query.PolicemanReq;
import com.junmp.jyzb.api.bean.req.UpdatePolicemanReq; import com.junmp.jyzb.api.bean.req.UpdatePolicemanReq;
import com.junmp.jyzb.entity.Policeman; import com.junmp.jyzb.entity.Policeman;
...@@ -34,11 +35,11 @@ public interface PolicemanService extends IService<Policeman> { ...@@ -34,11 +35,11 @@ public interface PolicemanService extends IService<Policeman> {
//通过组织机构id查询警员列表 //通过组织机构id查询警员列表
PoliceDto GetAllPolicemanList(Long orgId); PoliceDto GetAllPolicemanList(PolicemanReq req);
//根据单警柜id查询警员列表 //根据单警柜id查询警员列表
PoliceDto GetPoliceData(String id); PoliceDto GetPoliceData(CabinetReq req);
boolean UpdateFaceInfo(UpdatePolicemanReq req); boolean UpdateFaceInfo(UpdatePolicemanReq req);
...@@ -50,4 +51,6 @@ public interface PolicemanService extends IService<Policeman> { ...@@ -50,4 +51,6 @@ public interface PolicemanService extends IService<Policeman> {
boolean PoliceBindBox(PolicemanReq req); boolean PoliceBindBox(PolicemanReq req);
//判断警员信息是否存在
Policeman PoliceExist(String policeId);
} }
...@@ -16,7 +16,7 @@ public interface PubOrgService extends IService<PubOrg> { ...@@ -16,7 +16,7 @@ public interface PubOrgService extends IService<PubOrg> {
ResponseResult setShortName(Map<String, Object> orgId); ResponseResult setShortName(Map<String, Object> orgId);
List<String> getLowerOrg(String orgId); List<Long> getLowerOrg(Long orgId);
ResponseResult setOrgParentIds(); ResponseResult setOrgParentIds();
...@@ -25,4 +25,7 @@ public interface PubOrgService extends IService<PubOrg> { ...@@ -25,4 +25,7 @@ public interface PubOrgService extends IService<PubOrg> {
Boolean ChangeState(UpdateOrgReq req); Boolean ChangeState(UpdateOrgReq req);
//根据组织机构id查询出组织机构是否存在
PubOrg PubOrgExist(Long id);
} }
...@@ -9,7 +9,7 @@ import com.junmp.jyzb.entity.Shelf; ...@@ -9,7 +9,7 @@ import com.junmp.jyzb.entity.Shelf;
import java.util.List; import java.util.List;
public interface ShelfService extends IService<Shelf> { public interface ShelfService extends IService<Shelf> {
boolean AddShelf(UpdateShelfReq req); String AddShelf(UpdateShelfReq req);
boolean UpdateShelf(UpdateShelfReq req); boolean UpdateShelf(UpdateShelfReq req);
......
...@@ -44,4 +44,7 @@ public interface WarehouseService extends IService<Warehouse> { ...@@ -44,4 +44,7 @@ public interface WarehouseService extends IService<Warehouse> {
ResponseResult setWarehouseInventory(Map<String, Object> msg); ResponseResult setWarehouseInventory(Map<String, Object> msg);
//通过仓库id 判断仓库是否存在
Warehouse WarehoustExist(String id);
} }
...@@ -26,8 +26,6 @@ import java.util.Map; ...@@ -26,8 +26,6 @@ import java.util.Map;
@Service @Service
public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, CabinetBox> implements CabinetBoxService { public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, CabinetBox> implements CabinetBoxService {
@Resource
private CabinetBoxMapper cabinetBoxMapper;
@Resource @Resource
private CabinetService cabinetService; private CabinetService cabinetService;
...@@ -51,20 +49,22 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet ...@@ -51,20 +49,22 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean AddBoxInfo(UpdateCabinetBoxReq req) { public boolean AddBoxInfo(UpdateCabinetBoxReq req) {
CabinetBox one = this.getOne(new LambdaQueryWrapper<CabinetBox>() Cabinet cabinet = cabinetService.getOne(new LambdaQueryWrapper<Cabinet>()
.eq(CabinetBox::getId, req.getId())); .eq(Cabinet::getCabinetNum, req.getCabinetNum()));
if (ObjectUtil.isNotNull(one)){ if (ObjectUtil.isNull(cabinet)){
throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
}
//判断传递的箱号是否存在
CabinetBox one = getOne(new LambdaQueryWrapper<CabinetBox>()
.eq(CabinetBox::getCabinetId, cabinet.getId())
.eq(CabinetBox::getNum, req.getNum()));
if (ObjectUtil.isNull(one)){
throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_IS_EXISTS); throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_IS_EXISTS);
} }
CabinetBox cabinetBox = new CabinetBox(); CabinetBox cabinetBox = new CabinetBox();
BeanPlusUtil.copyProperties(req,cabinetBox); BeanPlusUtil.copyProperties(req,cabinetBox);
//添加单警柜箱门信息默认状态为1 //添加单警柜箱门信息默认状态为1
cabinetBox.setState(1); cabinetBox.setState(1);
Cabinet cabinet = cabinetService.getOne(new LambdaQueryWrapper<Cabinet>()
.eq(Cabinet::getCabinetNum, req.getCabinetNum()));
if (ObjectUtil.isNull(cabinet)){
throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
}
cabinetBox.setCabinetId(cabinet.getId()); cabinetBox.setCabinetId(cabinet.getId());
Integer num = cabinet.getNum(); Integer num = cabinet.getNum();
if (num==null){ if (num==null){
...@@ -77,4 +77,15 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet ...@@ -77,4 +77,15 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet
return save(cabinetBox); return save(cabinetBox);
} }
//判断箱子信息是否存在
@Override
public CabinetBox CabinetBoxExist(String id) {
CabinetBox cabinetBox = getOne(new LambdaQueryWrapper<CabinetBox>()
.eq(CabinetBox::getId,id));
if (ObjectUtil.isNull(cabinetBox)) {
throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_ISNOT_EXISTS);
}
return cabinetBox;
}
} }
...@@ -31,7 +31,6 @@ import javax.annotation.Resource; ...@@ -31,7 +31,6 @@ import javax.annotation.Resource;
import java.util.*; import java.util.*;
import static com.junmp.jyzb.utils.CheckBlank.checkNotBlank;
@Service @Service
public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> implements CabinetService { public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> implements CabinetService {
...@@ -49,8 +48,8 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -49,8 +48,8 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
private PolicemanService policemanService; private PolicemanService policemanService;
private List<String> getAllOrgId(CabinetReq req, String includeLowerLevel) { private List<Long> getAllOrgId(CabinetReq req, String includeLowerLevel) {
List<String> allOrg = new ArrayList<>(); List<Long> allOrg = new ArrayList<>();
if (includeLowerLevel.equals("false")) { if (includeLowerLevel.equals("false")) {
allOrg.add(req.getOrgId()); allOrg.add(req.getOrgId());
} else if (includeLowerLevel.equals("true")) { } else if (includeLowerLevel.equals("true")) {
...@@ -60,7 +59,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -60,7 +59,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
return allOrg; return allOrg;
} }
private List<Cabinet> getAllCabinetByOrg( List<String> allOrgId) { private List<Cabinet> getAllCabinetByOrg( List<Long> allOrgId) {
List<Cabinet> allCabinet = new ArrayList<>(); List<Cabinet> allCabinet = new ArrayList<>();
allCabinet = cabinetMapper.getAllCabinetByOrgList(allOrgId); allCabinet = cabinetMapper.getAllCabinetByOrgList(allOrgId);
return allCabinet; return allCabinet;
...@@ -97,12 +96,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -97,12 +96,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
public String addCabinetInfo(UpdateCabinetReq req) { public String addCabinetInfo(UpdateCabinetReq req) {
Cabinet cabinet = new Cabinet(); Cabinet cabinet = new Cabinet();
//查询传入的组织机构id是否存在 //查询传入的组织机构id是否存在
PubOrg puborg = pubOrgService.getOne(new LambdaQueryWrapper<PubOrg>() pubOrgService.PubOrgExist(req.getOrgId());
.eq(ObjectUtil.isNotEmpty(req.getOrgId()),PubOrg::getOrgId,req.getOrgId()));
if (ObjectUtil.isEmpty(puborg)) {
//抛出组织机构不存在异常
throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST);
}
//查询是否有重复的单警柜编号 //查询是否有重复的单警柜编号
List<Cabinet> list = this.list(new LambdaQueryWrapper<Cabinet>() List<Cabinet> list = this.list(new LambdaQueryWrapper<Cabinet>()
.eq(ObjectUtil.isNotEmpty(req.getCabinetNum()),Cabinet::getCabinetNum,req.getCabinetNum())); .eq(ObjectUtil.isNotEmpty(req.getCabinetNum()),Cabinet::getCabinetNum,req.getCabinetNum()));
...@@ -151,12 +145,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -151,12 +145,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
//遍历单警柜id列表 //遍历单警柜id列表
for (String id:cabinetIdList) { for (String id:cabinetIdList) {
//通过单警柜id查询出他的箱门数 //通过单警柜id查询出他的箱门数
Cabinet cabinet = this.getOne(new LambdaQueryWrapper<Cabinet>() Cabinet cabinet = CabinetExist(id);
.eq(ObjectUtil.isNotEmpty(id), Cabinet::getId,id));
//如果查询不到单警柜抛出异常
if (ObjectUtil.isEmpty(cabinet)) {
throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
}
//查询出单警柜之后添加到列表中 //查询出单警柜之后添加到列表中
cabinetList.add(cabinet); cabinetList.add(cabinet);
//通过单警柜id循环遍历出并删除所有箱门信息 //通过单警柜id循环遍历出并删除所有箱门信息
...@@ -197,6 +186,8 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -197,6 +186,8 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
*/ */
@Override @Override
public List<CabinetDto> getAllCabinetList(CabinetReq req) { public List<CabinetDto> getAllCabinetList(CabinetReq req) {
//判断组织机构是否存在
pubOrgService.PubOrgExist(req.getOrgId());
List<Cabinet> cabinets = new ArrayList<>(); List<Cabinet> cabinets = new ArrayList<>();
List<CabinetDto> cabinetList=new ArrayList<>(); List<CabinetDto> cabinetList=new ArrayList<>();
List<CabinetBoxDto> cabinetBoxList=new ArrayList<>(); List<CabinetBoxDto> cabinetBoxList=new ArrayList<>();
...@@ -222,7 +213,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -222,7 +213,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
} }
//分两种情况,如果说是本级及下级(全部)所有的单警柜信息,则incluLowerLevel为true,如果是查询本级的单警柜信息则为false //分两种情况,如果说是本级及下级(全部)所有的单警柜信息,则incluLowerLevel为true,如果是查询本级的单警柜信息则为false
if (req.getIncludeLowerLevel().equals("true") || req.getIncludeLowerLevel().equals("false")) { if (req.getIncludeLowerLevel().equals("true") || req.getIncludeLowerLevel().equals("false")) {
List<String> allOrgId = getAllOrgId(req, req.getIncludeLowerLevel()); List<Long> allOrgId = getAllOrgId(req, req.getIncludeLowerLevel());
if (allOrgId.size()==0) { if (allOrgId.size()==0) {
//抛出组织机构不存在异常 //抛出组织机构不存在异常
throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST); throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST);
...@@ -259,11 +250,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -259,11 +250,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
@Override @Override
public CabinetDto showOneCabinet(CabinetReq req) { public CabinetDto showOneCabinet(CabinetReq req) {
//查询单警柜信息 //查询单警柜信息
Cabinet one = getOne(new LambdaQueryWrapper<Cabinet>() Cabinet cabinet = CabinetExist(req.getId());
.eq(ObjectUtil.isNotEmpty(req.getId()), Cabinet::getId, req.getId()));
if (ObjectUtil.isNull(one)){
throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
}
//查询单警柜的箱门信息 //查询单警柜的箱门信息
List<CabinetBox> list = cabinetBoxService.list(new LambdaQueryWrapper<CabinetBox>() List<CabinetBox> list = cabinetBoxService.list(new LambdaQueryWrapper<CabinetBox>()
.eq(ObjectUtil.isNotEmpty(req.getId()), CabinetBox::getCabinetId, req.getId())); .eq(ObjectUtil.isNotEmpty(req.getId()), CabinetBox::getCabinetId, req.getId()));
...@@ -275,7 +262,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -275,7 +262,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
} }
//将单警柜的信息和它的箱门信息返回 //将单警柜的信息和它的箱门信息返回
CabinetDto cabinetDto = new CabinetDto(); CabinetDto cabinetDto = new CabinetDto();
BeanPlusUtil.copyProperties(one,cabinetDto); BeanPlusUtil.copyProperties(cabinet,cabinetDto);
cabinetDto.setCabinetBoxList(boxList); cabinetDto.setCabinetBoxList(boxList);
return cabinetDto; return cabinetDto;
} }
...@@ -289,15 +276,10 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -289,15 +276,10 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
@Override @Override
public boolean updateCabinetInfo(UpdateCabinetReq req) { public boolean updateCabinetInfo(UpdateCabinetReq req) {
//查询传入的组织机构id是否存在 //查询传入的组织机构id是否存在
PubOrg puborg = pubOrgService.getOne(new LambdaQueryWrapper<PubOrg>() pubOrgService.PubOrgExist(req.getOrgId());
.eq(ObjectUtil.isNotEmpty(req.getOrgId()),PubOrg::getOrgId,req.getOrgId()));
if (ObjectUtil.isEmpty(puborg)) {
//抛出组织机构不存在异常
throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST);
}
//查询是否有重复的单警柜编号 //查询是否有重复的单警柜编号
List<Cabinet> list = this.list(new LambdaQueryWrapper<Cabinet>() List<Cabinet> list = this.list(new LambdaQueryWrapper<Cabinet>()
.eq(ObjectUtil.isNotEmpty(req.getCabinetNum()),Cabinet::getCabinetNum,req.getCabinetNum())); .eq(Cabinet::getCabinetNum,req.getCabinetNum()));
if (list.size()>0) { if (list.size()>0) {
//判断是否是本身,如果是则不抛出异常(根据单警柜id进行比较) //判断是否是本身,如果是则不抛出异常(根据单警柜id进行比较)
Cabinet cabinet = list.get(0); Cabinet cabinet = list.get(0);
...@@ -363,11 +345,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -363,11 +345,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean ChangeCabinetState(UpdateCabinetReq req) { public boolean ChangeCabinetState(UpdateCabinetReq req) {
//查询单警柜是否存在 //查询单警柜是否存在
Cabinet cabinet = getOne(new LambdaQueryWrapper<Cabinet>() CabinetExist(req.getId());
.eq(Cabinet::getId, req.getId()));
if (ObjectUtil.isNull(cabinet)){
throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
}
List<UpdateCabinetBoxReq> cabinetBoxList = req.getCabinetBoxList(); List<UpdateCabinetBoxReq> cabinetBoxList = req.getCabinetBoxList();
List<CabinetBox> list =new ArrayList<>(); List<CabinetBox> list =new ArrayList<>();
for (UpdateCabinetBoxReq updateCabinet:cabinetBoxList) { for (UpdateCabinetBoxReq updateCabinet:cabinetBoxList) {
...@@ -378,25 +356,21 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -378,25 +356,21 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
return cabinetBoxService.updateBatchById(list); return cabinetBoxService.updateBatchById(list);
} }
//根据单警柜id查询出组织机构id
@Override
public Long SearchOrgId(CabinetReq req) {
Cabinet cabinet = CabinetExist(req.getId());
return cabinet.getOrgId();
}
//根据单警柜id判断单警柜是否存在
@Override @Override
public Long SearchOrgId(String id) { public Cabinet CabinetExist(String id) {
Cabinet one = getOne(new LambdaQueryWrapper<Cabinet>().eq(Cabinet::getId, id)); Cabinet one = getOne(new LambdaQueryWrapper<Cabinet>().eq(Cabinet::getId, id));
if (ObjectUtil.isNull(one)){ if (ObjectUtil.isNull(one)){
throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS); throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
} }
return one.getOrgId(); return one;
} }
//查询机构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
...@@ -35,10 +35,9 @@ public class PoliceFingerServiceImpl extends ServiceImpl<PoliceFingerMapper, Pol ...@@ -35,10 +35,9 @@ public class PoliceFingerServiceImpl extends ServiceImpl<PoliceFingerMapper, Pol
//新增指纹信息 //新增指纹信息
@Override @Override
public boolean addFingerInfo(UpdatePoliceFingerReq req) { public Integer addFingerInfo(UpdatePoliceFingerReq req) {
//判断警员是否存在 //判断警员是否存在
PoliceExist(req.getPoliceId()); policemanService.PoliceExist(req.getPoliceId());
PoliceFinger policeFinger = getOne(new LambdaQueryWrapper<PoliceFinger>() PoliceFinger policeFinger = getOne(new LambdaQueryWrapper<PoliceFinger>()
.eq(ObjectUtil.isNotEmpty(req.getPoliceId()),PoliceFinger::getPoliceId,req.getPoliceId()) .eq(ObjectUtil.isNotEmpty(req.getPoliceId()),PoliceFinger::getPoliceId,req.getPoliceId())
.eq(ObjectUtil.isNotEmpty(req.getFingerInfo()),PoliceFinger::getFingerInfo,req.getFingerInfo())); .eq(ObjectUtil.isNotEmpty(req.getFingerInfo()),PoliceFinger::getFingerInfo,req.getFingerInfo()));
...@@ -48,7 +47,8 @@ public class PoliceFingerServiceImpl extends ServiceImpl<PoliceFingerMapper, Pol ...@@ -48,7 +47,8 @@ public class PoliceFingerServiceImpl extends ServiceImpl<PoliceFingerMapper, Pol
} }
PoliceFinger policeFinger1=new PoliceFinger(); PoliceFinger policeFinger1=new PoliceFinger();
BeanPlusUtil.copyProperties(req, policeFinger1); BeanPlusUtil.copyProperties(req, policeFinger1);
return this.save(policeFinger1); save(policeFinger1);
return policeFinger1.getId();
} }
//修改指纹信息 //修改指纹信息
...@@ -62,6 +62,7 @@ public class PoliceFingerServiceImpl extends ServiceImpl<PoliceFingerMapper, Pol ...@@ -62,6 +62,7 @@ public class PoliceFingerServiceImpl extends ServiceImpl<PoliceFingerMapper, Pol
//查询指纹信息 //查询指纹信息
@Override @Override
public List<PoliceFinger> searchFingerInfo(PolicemanFingerReq req) { public List<PoliceFinger> searchFingerInfo(PolicemanFingerReq req) {
policemanService.PoliceExist(req.getPoliceId());
LambdaQueryWrapper<PoliceFinger> wrapper = createWrapper(req); LambdaQueryWrapper<PoliceFinger> wrapper = createWrapper(req);
return this.list(wrapper); return this.list(wrapper);
} }
...@@ -71,7 +72,7 @@ public class PoliceFingerServiceImpl extends ServiceImpl<PoliceFingerMapper, Pol ...@@ -71,7 +72,7 @@ public class PoliceFingerServiceImpl extends ServiceImpl<PoliceFingerMapper, Pol
@Override @Override
public boolean deleteFinger(UpdatePoliceFingerReq req) { public boolean deleteFinger(UpdatePoliceFingerReq req) {
//判断警员是否存在 //判断警员是否存在
PoliceExist(req.getPoliceId()); policemanService.PoliceExist(req.getPoliceId());
PoliceFinger policeFinger = PolicemanFingerExist(req.getId(), req.getPoliceId()); PoliceFinger policeFinger = PolicemanFingerExist(req.getId(), req.getPoliceId());
return removeById(policeFinger); return removeById(policeFinger);
} }
...@@ -107,15 +108,6 @@ public class PoliceFingerServiceImpl extends ServiceImpl<PoliceFingerMapper, Pol ...@@ -107,15 +108,6 @@ public class PoliceFingerServiceImpl extends ServiceImpl<PoliceFingerMapper, Pol
return wrapper; return wrapper;
} }
//判断警员是否存在
public boolean PoliceExist(String id){
Policeman one = policemanService.getOne(new LambdaQueryWrapper<Policeman>()
.eq(Policeman::getId, id));
if (ObjectUtil.isNull(one)){
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
return true;
}
//判断指纹信息是否存在 //判断指纹信息是否存在
public PoliceFinger PolicemanFingerExist(Integer fingerId,String policeId){ public PoliceFinger PolicemanFingerExist(Integer fingerId,String policeId){
PoliceFinger one = getOne(new LambdaQueryWrapper<PoliceFinger>() PoliceFinger one = getOne(new LambdaQueryWrapper<PoliceFinger>()
......
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.jyzb.api.bean.dto.PoliceDto; import com.junmp.jyzb.api.bean.dto.PoliceDto;
import com.junmp.jyzb.api.bean.dto.PoliceFingerDto; import com.junmp.jyzb.api.bean.dto.PoliceFingerDto;
import com.junmp.jyzb.api.bean.dto.PolicemanDto; import com.junmp.jyzb.api.bean.dto.PolicemanDto;
import com.junmp.jyzb.api.bean.query.CabinetReq;
import com.junmp.jyzb.api.bean.query.PolicemanReq; import com.junmp.jyzb.api.bean.query.PolicemanReq;
import com.junmp.jyzb.api.bean.req.UpdatePolicemanReq; import com.junmp.jyzb.api.bean.req.UpdatePolicemanReq;
import com.junmp.jyzb.entity.*; import com.junmp.jyzb.entity.*;
...@@ -39,17 +40,6 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -39,17 +40,6 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
@Resource @Resource
private PolicemanMapper policemanMapper; private PolicemanMapper policemanMapper;
@Resource
private PoliceFingerMapper policeFingerMapper;
@Resource
private CabinetBoxMapper cabinetBoxMapper;
@Resource
private CabinetMapper cabinetMapper;
@Resource
private PubOrgMapper pubOrgMapper;
@Resource @Resource
private PubOrgService pubOrgService; private PubOrgService pubOrgService;
...@@ -58,9 +48,6 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -58,9 +48,6 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
private CabinetService cabinetService; private CabinetService cabinetService;
@Resource @Resource
private PolicemanService policemanService;
@Resource
private CabinetBoxService cabinetBoxService; private CabinetBoxService cabinetBoxService;
@Resource @Resource
...@@ -82,14 +69,9 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -82,14 +69,9 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
@Override @Override
public String AddPoliceman(UpdatePolicemanReq req) { public String AddPoliceman(UpdatePolicemanReq req) {
//查询传入的组织机构id是否存在 //查询传入的组织机构id是否存在
PubOrg puborg = pubOrgService.getOne(new LambdaQueryWrapper<PubOrg>() pubOrgService.PubOrgExist(req.getOrgId());
.eq(ObjectUtil.isNotEmpty(req.getOrgId()), PubOrg::getOrgId, req.getOrgId()));
if (ObjectUtil.isEmpty(puborg)) {
//抛出组织机构不存在异常
throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST);
}
//查询是否有重复的policeCode //查询是否有重复的policeCode
List<Policeman> list = policemanService.list(new LambdaQueryWrapper<Policeman>() List<Policeman> list = list(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotEmpty(req.getPoliceCode()), Policeman::getPoliceCode, req.getPoliceCode())); .eq(ObjectUtil.isNotEmpty(req.getPoliceCode()), Policeman::getPoliceCode, req.getPoliceCode()));
if (list.size() > 0) { if (list.size() > 0) {
throw new ServiceException(PolicemanExceptionEnum.POLICECODE_IS_EXISTS); throw new ServiceException(PolicemanExceptionEnum.POLICECODE_IS_EXISTS);
...@@ -97,7 +79,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -97,7 +79,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
Policeman policeman = new Policeman(); Policeman policeman = new Policeman();
BeanPlusUtil.copyProperties(req, policeman); BeanPlusUtil.copyProperties(req, policeman);
//添加警员绑定用户信息 //添加警员绑定用户信息
policemanService.save(policeman); save(policeman);
return policeman.getId(); return policeman.getId();
} }
...@@ -143,11 +125,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -143,11 +125,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
*/ */
@Override @Override
public PolicemanDto GetOnePolice(PolicemanReq req) { public PolicemanDto GetOnePolice(PolicemanReq req) {
Policeman one = getOne(new LambdaQueryWrapper<Policeman>() Policeman one = PoliceExist(req.getId());
.eq(ObjectUtil.isNotNull(req.getId()), Policeman::getId, req.getId()));
if (ObjectUtil.isNull(one)) {
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
PolicemanDto policemanDto = new PolicemanDto(); PolicemanDto policemanDto = new PolicemanDto();
BeanPlusUtil.copyProperties(one, policemanDto); BeanPlusUtil.copyProperties(one, policemanDto);
//将警员的指纹信息查询出来 //将警员的指纹信息查询出来
...@@ -174,12 +152,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -174,12 +152,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
@Override @Override
public boolean DeletePolice(UpdatePolicemanReq req) { public boolean DeletePolice(UpdatePolicemanReq req) {
//通过警员id查询警员信息 //通过警员id查询警员信息
Policeman policeman = policemanService.getOne(new LambdaQueryWrapper<Policeman>() Policeman policeman = PoliceExist(req.getId());
.eq(ObjectUtil.isNotNull(req.getId()), Policeman::getId, req.getId()));
//查询不到警员信息则抛异常
if (ObjectUtil.isNull(policeman)) {
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
//如果查询出来的警员信息中没有绑定箱门而参数传递了箱门id,则抛出异常警员绑定箱门错误 //如果查询出来的警员信息中没有绑定箱门而参数传递了箱门id,则抛出异常警员绑定箱门错误
//如果传递的箱门id参数与查询出来的箱门id不一致,则抛出异常警员绑定的箱门与实际绑定不符合 //如果传递的箱门id参数与查询出来的箱门id不一致,则抛出异常警员绑定的箱门与实际绑定不符合
if ((ObjectUtil.isNull(policeman.getCabinetBoxId()) && ObjectUtil.isNotNull(req.getCabinetBoxId()))) { if ((ObjectUtil.isNull(policeman.getCabinetBoxId()) && ObjectUtil.isNotNull(req.getCabinetBoxId()))) {
...@@ -188,7 +161,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -188,7 +161,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
//通过警员信息中的userId对账号进行删除 //通过警员信息中的userId对账号进行删除
sysUserService.remove(new LambdaQueryWrapper<User>() sysUserService.remove(new LambdaQueryWrapper<User>()
.eq(User::getUserId, policeman.getUserId())); .eq(User::getUserId, policeman.getUserId()));
return policemanService.removeById(policeman); return removeById(policeman);
} }
...@@ -204,31 +177,24 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -204,31 +177,24 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
Policeman policeman = new Policeman(); Policeman policeman = new Policeman();
BeanPlusUtil.copyProperties(req, policeman); BeanPlusUtil.copyProperties(req, policeman);
//查询传入的组织机构id是否存在 //查询传入的组织机构id是否存在
PubOrg puborg = pubOrgService.getOne(new LambdaQueryWrapper<PubOrg>() pubOrgService.PubOrgExist(req.getOrgId());
.eq(ObjectUtil.isNotEmpty(req.getOrgId()), PubOrg::getOrgId, req.getOrgId()));
if (ObjectUtil.isEmpty(puborg)) {
//抛出组织机构不存在异常
throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST);
}
//判断传入的修改的警员编号与本身编号一致,如果一致则无所谓,如果不一致则需要判断修改的警员编号是否已经存在 //判断传入的修改的警员编号与本身编号一致,如果一致则无所谓,如果不一致则需要判断修改的警员编号是否已经存在
Policeman one = policemanService.getOne(new LambdaQueryWrapper<Policeman>() //判断警员是否存在
.eq(ObjectUtil.isNotNull(req.getId()), Policeman::getId, req.getId())); Policeman one = PoliceExist(req.getId());
if (!req.getPoliceCode().equals(one.getPoliceCode())) { if (!req.getPoliceCode().equals(one.getPoliceCode())) {
Policeman one1 = policemanService.getOne(new LambdaQueryWrapper<Policeman>() Policeman one1 = getOne(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotNull(req.getPoliceCode()), Policeman::getPoliceCode, req.getPoliceCode())); .eq(ObjectUtil.isNotNull(req.getPoliceCode()), Policeman::getPoliceCode, req.getPoliceCode()));
if (ObjectUtil.isNotNull(one1)) { if (ObjectUtil.isNotNull(one1)) {
throw new ServiceException(PolicemanExceptionEnum.POLICECODE_IS_EXISTS); throw new ServiceException(PolicemanExceptionEnum.POLICECODE_IS_EXISTS);
} }
} }
//判断是否传递了箱子id,如果传了则判断箱子是否存在
//查询单警柜箱号是否存在,箱门不存在抛异常 if (ObjectUtil.isNotEmpty(req.getCabinetBoxId())||!req.getCabinetBoxId().equals("")){
CabinetBox cabinetBox = cabinetBoxService.getOne(new LambdaQueryWrapper<CabinetBox>() //查询单警柜箱号是否存在,箱门不存在抛异常
.eq(CabinetBox::getId, req.getCabinetBoxId())); cabinetBoxService.CabinetBoxExist(req.getCabinetBoxId());
if (ObjectUtil.isNull(cabinetBox)) {
throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_ISNOT_EXISTS);
} }
policeman.setUpdateTime(DateTimeUtil.getCurrentDateTime()); policeman.setUpdateTime(DateTimeUtil.getCurrentDateTime());
return policemanService.updateById(policeman); return updateById(policeman);
} }
...@@ -241,13 +207,9 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -241,13 +207,9 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
@Override @Override
public boolean ChangePoliceState(UpdatePolicemanReq req) { public boolean ChangePoliceState(UpdatePolicemanReq req) {
//通过警员id查询出警员信息 //通过警员id查询出警员信息
Policeman one = getOne(new LambdaQueryWrapper<Policeman>() Policeman one = PoliceExist(req.getId());
.eq(ObjectUtil.isNotNull(req.getId()), Policeman::getId, req.getId()));
if (ObjectUtil.isNull(one)) {
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
one.setState(req.getState()); one.setState(req.getState());
return policemanService.updateById(one); return updateById(one);
} }
...@@ -282,20 +244,15 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -282,20 +244,15 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
/** /**
* 通过组织机构id查询警员列表 * 通过组织机构id查询警员列表
* *
* @param orgId * @param
*/ */
@Override @Override
public PoliceDto GetAllPolicemanList(Long orgId) { public PoliceDto GetAllPolicemanList(PolicemanReq req) {
//查询传入的组织机构id是否存在 //查询传入的组织机构id是否存在
PubOrg puborg = pubOrgService.getOne(new LambdaQueryWrapper<PubOrg>() PubOrg pubOrg = pubOrgService.PubOrgExist(req.getOrgId());
.eq(ObjectUtil.isNotEmpty(orgId), PubOrg::getOrgId, orgId));
if (ObjectUtil.isNull(puborg)) {
//抛出组织机构不存在异常
throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST);
}
//查询出组织机构下的所有警员信息 //查询出组织机构下的所有警员信息
List<Policeman> list = list(new LambdaQueryWrapper<Policeman>() List<Policeman> list = list(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotEmpty(orgId), Policeman::getOrgId, orgId) .eq(ObjectUtil.isNotEmpty(req.getOrgId()), Policeman::getOrgId, req.getOrgId())
.eq(Policeman::getState, 1)); .eq(Policeman::getState, 1));
List<PolicemanDto> policeList = new ArrayList<>(); List<PolicemanDto> policeList = new ArrayList<>();
//查询出警员信息下的指纹列表信息 //查询出警员信息下的指纹列表信息
...@@ -317,8 +274,8 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -317,8 +274,8 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
PoliceDto policeDto = new PoliceDto(); PoliceDto policeDto = new PoliceDto();
policeDto.setPolicemanlist(policeList); policeDto.setPolicemanlist(policeList);
//设置组织机构名 //设置组织机构名
policeDto.setOrgName(puborg.getOrgName()); policeDto.setOrgName(pubOrg.getOrgName());
policeDto.setOrgId(orgId); policeDto.setOrgId(req.getOrgId());
return policeDto; return policeDto;
} }
...@@ -326,16 +283,12 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -326,16 +283,12 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
//根据单警柜id查询警员信息 //根据单警柜id查询警员信息
@Override @Override
public PoliceDto GetPoliceData(String id) { public PoliceDto GetPoliceData(CabinetReq req) {
PoliceDto policeDto = new PoliceDto(); PoliceDto policeDto = new PoliceDto();
//判断单警柜id是否正确 //判断单警柜id是否正确
Cabinet cabinet = cabinetService.getOne(new LambdaQueryWrapper<Cabinet>() Cabinet cabinet = cabinetService.CabinetExist(req.getId());
.eq(Cabinet::getId, id));
if (ObjectUtil.isNull(cabinet)) {
throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
}
//通过箱门id查询出警员 //通过箱门id查询出警员
List<Policeman> policemenList = policemanMapper.SearchPoliceList(id); List<Policeman> policemenList = policemanMapper.SearchPoliceList(req.getId());
List<PolicemanDto> list = new ArrayList<>(); List<PolicemanDto> list = new ArrayList<>();
for (Policeman policeman : policemenList) { for (Policeman policeman : policemenList) {
PolicemanDto policemanDto = new PolicemanDto(); PolicemanDto policemanDto = new PolicemanDto();
...@@ -369,14 +322,10 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -369,14 +322,10 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
if (ObjectUtil.isNull(req.getFaceInfo()) || ObjectUtil.isEmpty(req.getFaceInfo())) { if (ObjectUtil.isNull(req.getFaceInfo()) || ObjectUtil.isEmpty(req.getFaceInfo())) {
return false; return false;
} }
Policeman police = getOne(new LambdaQueryWrapper<Policeman>() Policeman police = PoliceExist(req.getId());
.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.setFaceInfo(req.getFaceInfo());
police.setUpdateTime(DateTimeUtil.getCurrentDateTime()); police.setUpdateTime(DateTimeUtil.getCurrentDateTime());
return policemanService.updateById(police); return updateById(police);
} }
/** /**
...@@ -389,15 +338,10 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -389,15 +338,10 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
**/ **/
@Override @Override
public boolean UpdateFaceInfo(UpdatePolicemanReq req) { public boolean UpdateFaceInfo(UpdatePolicemanReq req) {
//警员id不能为空 Policeman police = PoliceExist(req.getId());
if (ObjectUtil.isEmpty(req.getId()) || ObjectUtil.isNull(req.getId())) {
return false;
}
Policeman police = policemanService.getOne(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotEmpty(req.getId()), Policeman::getId, req.getId()));
police.setFaceInfo(req.getFaceInfo()); police.setFaceInfo(req.getFaceInfo());
police.setUpdateTime(DateTimeUtil.getCurrentDateTime()); police.setUpdateTime(DateTimeUtil.getCurrentDateTime());
return policemanService.updateById(police); return updateById(police);
} }
...@@ -410,15 +354,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -410,15 +354,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
**/ **/
@Override @Override
public Policeman SearchFaceInfo(PolicemanReq req) { public Policeman SearchFaceInfo(PolicemanReq req) {
//警员id不能为空 Policeman policeman = PoliceExist(req.getId());
if (ObjectUtil.isEmpty(req.getId()) || ObjectUtil.isNull(req.getId())) {
return null;
}
Policeman policeman = policemanService.getOne(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotEmpty(req.getId()), Policeman::getId, req.getId()));
if (ObjectUtil.isNull(policeman)) {
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
return policeman; return policeman;
} }
...@@ -434,7 +370,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -434,7 +370,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
public boolean PoliceBindUser(PolicemanReq req) { public boolean PoliceBindUser(PolicemanReq req) {
User user = new User(); User user = new User();
BeanPlusUtil.copyProperties(req, user); BeanPlusUtil.copyProperties(req, user);
//密码加密,依赖注入错误 //密码加密,bcrypt加密方式
BcryptPasswordStoredEncrypt passwordStoredEncrypt = new BcryptPasswordStoredEncrypt(); BcryptPasswordStoredEncrypt passwordStoredEncrypt = new BcryptPasswordStoredEncrypt();
String encrypt = passwordStoredEncrypt.encrypt(req.getPassword()); String encrypt = passwordStoredEncrypt.encrypt(req.getPassword());
user.setPassword(encrypt); user.setPassword(encrypt);
...@@ -447,36 +383,42 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -447,36 +383,42 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
} }
user.setRealName(req.getName()); user.setRealName(req.getName());
user.setNickName(req.getName()); user.setNickName(req.getName());
System.out.println("user = " + user);
sysUserService.save(user); sysUserService.save(user);
//判断警员是否存在
Policeman policeman = PoliceExist(req.getId());
//通过警员id将查询到的警员信息进行修改设置 //通过警员id将查询到的警员信息进行修改设置
Policeman policeman = policemanService.getOne(new LambdaQueryWrapper<Policeman>()
.eq(Policeman::getId, req.getId()));
if (ObjectUtil.isNull(policeman)) {
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
policeman.setUserId(user.getUserId()); policeman.setUserId(user.getUserId());
policeman.setIsCreatedAccount(true); policeman.setIsCreatedAccount(true);
policeman.setPassword(encrypt); policeman.setPassword(encrypt);
return policemanService.updateById(policeman); return updateById(policeman);
} }
//人员绑定箱门 //人员绑定箱门
@Override @Override
public boolean PoliceBindBox(PolicemanReq req) { public boolean PoliceBindBox(PolicemanReq req) {
Policeman policeman = new Policeman(); Policeman policeman = PoliceExist(req.getId());
BeanPlusUtil.copyProperties(req, policeman); BeanPlusUtil.copyProperties(req, policeman);
Policeman one = policemanService.getOne(new LambdaQueryWrapper<Policeman>()
.eq(Policeman::getId, req.getId()));
if (ObjectUtil.isNull(one)) {
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
}
//判断箱子是否存在 //判断箱子是否存在
CabinetBox cabinetBox = cabinetBoxService.getOne(new LambdaQueryWrapper<CabinetBox>() cabinetBoxService.CabinetBoxExist(req.getCabinetBoxId());
.eq(CabinetBox::getId, req.getCabinetBoxId())); return updateById(policeman);
if (ObjectUtil.isNull(cabinetBox)) { }
throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_ISNOT_EXISTS);
/**
* 通过警员id判断警员是否存在,不存在则抛出异常
*/
@Override
public Policeman PoliceExist(String policeId) {
Policeman policeman = getOne(new LambdaQueryWrapper<Policeman>()
.eq(Policeman::getId,policeId));
if (ObjectUtil.isNull(policeman)) {
throw new ServiceException(PolicemanExceptionEnum.POLICEMAN_NOT_EXIST);
} }
return policemanService.updateById(policeman); return policeman;
} }
} }
...@@ -11,6 +11,7 @@ import com.junmp.jyzb.api.bean.req.UpdateOrgReq; ...@@ -11,6 +11,7 @@ import com.junmp.jyzb.api.bean.req.UpdateOrgReq;
import com.junmp.jyzb.api.exception.JYZBAppException; import com.junmp.jyzb.api.exception.JYZBAppException;
import com.junmp.jyzb.api.exception.enums.EquipmentTypeExceptionEnum; import com.junmp.jyzb.api.exception.enums.EquipmentTypeExceptionEnum;
import com.junmp.jyzb.api.exception.enums.OrgExceptionEnum; import com.junmp.jyzb.api.exception.enums.OrgExceptionEnum;
import com.junmp.jyzb.api.exception.enums.PubOrgExceptionEnum;
import com.junmp.jyzb.entity.EquipmentType; import com.junmp.jyzb.entity.EquipmentType;
import com.junmp.jyzb.entity.PubOrg; import com.junmp.jyzb.entity.PubOrg;
import com.junmp.jyzb.entity.Supplier; import com.junmp.jyzb.entity.Supplier;
...@@ -18,6 +19,7 @@ import com.junmp.jyzb.utils.HttpStatus; ...@@ -18,6 +19,7 @@ import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.RedisUtils; import com.junmp.jyzb.utils.RedisUtils;
import com.junmp.jyzb.utils.ResponseResult; import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.jyzb.utils.ReturnMsg; import com.junmp.jyzb.utils.ReturnMsg;
import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.util.BeanPlusUtil; import com.junmp.v2.common.util.BeanPlusUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -52,7 +54,7 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem ...@@ -52,7 +54,7 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
@Override @Override
public List<String> getLowerOrg(String orgId) { public List<Long> getLowerOrg(Long orgId) {
//构建 Redis 缓存� //构建 Redis 缓存�
String redisKey = "getLowerOrg"; String redisKey = "getLowerOrg";
...@@ -66,40 +68,40 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem ...@@ -66,40 +68,40 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
redisUtils.set(redisKey, menuList); redisUtils.set(redisKey, menuList);
} }
List<String> resultList = new ArrayList<>(); // 存储最终的菜单树结果 List<Long> resultList = new ArrayList<>(); // 存储最终的菜单树结果
Map<String, List<String>> childrenMap = new HashMap<>(); // 存储每个菜单项的子菜单映射 Map<String, List<Long>> childrenMap = new HashMap<>(); // 存储每个菜单项的子菜单映射
resultList.add(orgId); //将自己加入到返回的List中 resultList.add(orgId); //将自己加入到返回的List中
// 构建子菜单映射表 // 构建子菜单映射表
for (PubOrg menu : menuList) { for (PubOrg menu : menuList) {
String org = menu.getOrgId().toString(); Long org = menu.getOrgId();
if (!childrenMap.containsKey(menu.getOrgParentId().toString())) { // 如果父菜单还不存在于映射表中 if (!childrenMap.containsKey(menu.getOrgParentId().toString())) { // 如果父菜单还不存在于映射表中
childrenMap.put(menu.getOrgParentId().toString(), new ArrayList<>()); // 创建一个新的子菜单列表 childrenMap.put(menu.getOrgParentId().toString(), new ArrayList<>()); // 创建一个新的子菜单列表
} }
childrenMap.get(menu.getOrgParentId().toString()).add(org); // 将当前菜单项放入对应的子菜单列表中 childrenMap.get(menu.getOrgParentId()).add(org); // 将当前菜单项放入对应的子菜单列表中
} }
Long orgInfo = Long.valueOf(orgId);//获取输入的组织机构id信息 Long orgInfo = Long.valueOf(orgId);//获取输入的组织机构id信息
//Long orgInfo = new BigInteger(orgId); // 获取顶级菜单的标识符 //Long orgInfo = new BigInteger(orgId); // 获取顶级菜单的标识符
// 获取顶级菜单 // 获取顶级菜单
List<String> topMenus = childrenMap.get(orgId); List<Long> topMenus = childrenMap.get(orgId);
// 迭代构建菜单树 // 迭代构建菜单树
if (topMenus != null) { if (topMenus != null) {
for (String topMenu : topMenus) { for (Long topMenu : topMenus) {
Stack<String> stack = new Stack<>(); // 使用栈结构辅助构建菜单树 Stack<Long> stack = new Stack<>(); // 使用栈结构辅助构建菜单树
stack.push(topMenu); // 将当前顶级菜单项放入栈中 stack.push(topMenu); // 将当前顶级菜单项放入栈中
while (!stack.isEmpty()) { while (!stack.isEmpty()) {
String currentMenu = stack.pop(); // 取出队首的当前菜单项 Long currentMenu = stack.pop(); // 取出队首的当前菜单项
//Long currentMenuId = currentMenu; // 获取当前菜单项的标识符 //Long currentMenuId = currentMenu; // 获取当前菜单项的标识符
if (childrenMap.containsKey(currentMenu)) { // 如果当前菜单项有子菜单 if (childrenMap.containsKey(currentMenu)) { // 如果当前菜单项有子菜单
List<String> children = childrenMap.get(currentMenu); // 获取子菜单列表 List<Long> children = childrenMap.get(currentMenu); // 获取子菜单列表
for (int i = children.size() - 1; i >= 0; i--) { for (int i = children.size() - 1; i >= 0; i--) {
stack.push(children.get(i)); stack.push(children.get(i));
...@@ -244,6 +246,8 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem ...@@ -244,6 +246,8 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
} }
} }
public List<String> CheckOrgList(List<String> req){ public List<String> CheckOrgList(List<String> req){
LambdaQueryWrapper<PubOrg> wp = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PubOrg> wp = new LambdaQueryWrapper<>();
wp.in(ObjectUtil.isNotEmpty(req), PubOrg::getOrgId, req); wp.in(ObjectUtil.isNotEmpty(req), PubOrg::getOrgId, req);
...@@ -359,6 +363,18 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem ...@@ -359,6 +363,18 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
return wrapper; return wrapper;
} }
//根据组织机构id查询出组织机构是否存在
@Override
public PubOrg PubOrgExist(Long id) {
PubOrg puborg = getOne(new LambdaQueryWrapper<PubOrg>()
.eq(PubOrg::getOrgId,id));
if (ObjectUtil.isEmpty(puborg)) {
//抛出组织机构不存在异常
throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST);
}
return puborg;
}
} }
......
...@@ -28,10 +28,13 @@ public class ShelfServiceImpl extends ServiceImpl<ShelfMapper, Shelf> implements ...@@ -28,10 +28,13 @@ public class ShelfServiceImpl extends ServiceImpl<ShelfMapper, Shelf> implements
private WarehouseService warehouseService; private WarehouseService warehouseService;
@Override @Override
public boolean AddShelf(UpdateShelfReq req) { public String AddShelf(UpdateShelfReq req) {
//判断仓库是否存在
warehouseService.WarehoustExist(req.getWarehouseId());
Shelf shelf = new Shelf(); Shelf shelf = new Shelf();
BeanPlusUtil.copyProperties(req,shelf); BeanPlusUtil.copyProperties(req,shelf);
return this.save(shelf); save(shelf);
return shelf.getShelfId();
} }
@Override @Override
...@@ -51,13 +54,9 @@ public class ShelfServiceImpl extends ServiceImpl<ShelfMapper, Shelf> implements ...@@ -51,13 +54,9 @@ public class ShelfServiceImpl extends ServiceImpl<ShelfMapper, Shelf> implements
@Override @Override
public List<ShelfDto> GetShelfList(ShelfReq req) { public List<ShelfDto> GetShelfList(ShelfReq req) {
//判断仓库id是否存在 //判断仓库id是否存在
Warehouse one = warehouseService.getOne(new LambdaQueryWrapper<Warehouse>() warehouseService.WarehoustExist(req.getWarehouseId());
.eq(Warehouse::getId, req.getWarehouseId())); List<Shelf> list = list(new LambdaQueryWrapper<Shelf>()
if (ObjectUtil.isNull(one)){ .eq(Shelf::getWarehouseId,req.getWarehouseId()));
throw new ServiceException(WarehouseExceptionEnum.WAREHOUSE_NOT_EXIST);
}
LambdaQueryWrapper<Shelf> wrapper = createWrapper(req);
List<Shelf> list = list(wrapper);
List<ShelfDto> shelfDtoList=new ArrayList<>(); List<ShelfDto> shelfDtoList=new ArrayList<>();
for (Shelf shelf:list) { for (Shelf shelf:list) {
ShelfDto shelfDto = new ShelfDto(); ShelfDto shelfDto = new ShelfDto();
...@@ -80,17 +79,4 @@ public class ShelfServiceImpl extends ServiceImpl<ShelfMapper, Shelf> implements ...@@ -80,17 +79,4 @@ public class ShelfServiceImpl extends ServiceImpl<ShelfMapper, Shelf> implements
return shelf; return shelf;
} }
private LambdaQueryWrapper<Shelf> createWrapper(ShelfReq req) {
LambdaQueryWrapper<Shelf> wrapper = new LambdaQueryWrapper<>();
if (ObjectUtil.isEmpty(req)) {
return wrapper;
}
//根据货架id查询
wrapper.eq(ObjectUtil.isNotEmpty(req.getShelfId()), Shelf::getShelfId, req.getShelfId());
//根据货架名称、货架编号模糊查询
wrapper.like(ObjectUtil.isNotEmpty(req.getShelfName()), Shelf::getCode, req.getShelfName());
wrapper.orderByDesc(Shelf::getCreateTime);
return wrapper;
}
} }
...@@ -65,7 +65,7 @@ public class WarehouseAreaServiceImpl extends ServiceImpl<WarehouseAreaMapper, W ...@@ -65,7 +65,7 @@ public class WarehouseAreaServiceImpl extends ServiceImpl<WarehouseAreaMapper, W
WarehouseAreaExist(req.getAreaId()); WarehouseAreaExist(req.getAreaId());
WarehouseArea warehouseArea = new WarehouseArea(); WarehouseArea warehouseArea = new WarehouseArea();
BeanPlusUtil.copyProperties(req,warehouseArea); BeanPlusUtil.copyProperties(req,warehouseArea);
return this.removeById(warehouseArea.getId()); return this.removeById(warehouseArea);
} }
@Override @Override
......
package com.junmp.jyzb.service.impl; package com.junmp.jyzb.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...@@ -18,6 +19,7 @@ import com.junmp.jyzb.utils.*; ...@@ -18,6 +19,7 @@ import com.junmp.jyzb.utils.*;
import com.junmp.v2.common.exception.base.ServiceException; import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.util.BeanPlusUtil; import com.junmp.v2.common.util.BeanPlusUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -48,16 +50,12 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse> ...@@ -48,16 +50,12 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse>
@Override @Override
public WarehouseDto getOneWarehouse(WarehouseReq req) { public WarehouseDto getOneWarehouse(WarehouseReq req) {
Warehouse warehouseMsg=this.getById(req.getId()); Warehouse warehouse = WarehoustExist(req.getId());
if (ObjectUtil.isNull(warehouseMsg)){
throw new ServiceException(WarehouseExceptionEnum.WAREHOUSE_NOT_EXIST);
}
WarehouseDto warehouseDto = new WarehouseDto(); WarehouseDto warehouseDto = new WarehouseDto();
BeanPlusUtil.copyProperties(warehouseMsg,warehouseDto); BeanPlusUtil.copyProperties(warehouse,warehouseDto);
//获取组织机构名称 //获取组织机构名称
PubOrg one = pubOrgService.getOne(new LambdaQueryWrapper<PubOrg>() PubOrg pubOrg = pubOrgService.PubOrgExist(warehouse.getOrgId());
.eq(PubOrg::getOrgId, warehouseMsg.getOrgId())); warehouseDto.setOrgName(pubOrg.getOrgName());
warehouseDto.setOrgName(one.getOrgName());
return warehouseDto; return warehouseDto;
} }
...@@ -88,13 +86,9 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse> ...@@ -88,13 +86,9 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse>
List<Warehouse> allWarehouse=new ArrayList<>(); List<Warehouse> allWarehouse=new ArrayList<>();
List<WarehouseDto> warehouseDtoList=new ArrayList<>(); List<WarehouseDto> warehouseDtoList=new ArrayList<>();
//判断组织机构是否存在 //判断组织机构是否存在
PubOrg one = pubOrgService.getOne(new LambdaQueryWrapper<PubOrg>() PubOrg pubOrg = pubOrgService.PubOrgExist(msg.getOrgId());
.eq(PubOrg::getOrgId, msg.getOrgId()));
if (ObjectUtil.isNull(one)){
throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST);
}
//根据组织机构id查询组织机构名称 //根据组织机构id查询组织机构名称
String orgName = one.getOrgName(); String orgName = pubOrg.getOrgName();
//如果组织机构是浙江省公安厅 //如果组织机构是浙江省公安厅
if (msg.getOrgId().equals(1369509498032808905L) && msg.getIncludeLowerLevel().equals("true")){ if (msg.getOrgId().equals(1369509498032808905L) && msg.getIncludeLowerLevel().equals("true")){
allWarehouse = this.list(); allWarehouse = this.list();
...@@ -108,7 +102,7 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse> ...@@ -108,7 +102,7 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse>
} }
//获取组织机构Id //获取组织机构Id
List<String> allOrgId =getAllOrgId(msg); List<Long> allOrgId =getAllOrgId(msg);
allWarehouse = getAllWarehouseByOrg(allOrgId); allWarehouse = getAllWarehouseByOrg(allOrgId);
...@@ -122,22 +116,22 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse> ...@@ -122,22 +116,22 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse>
} }
private List<String> getAllOrgId(WarehouseReq msg) { private List<Long> getAllOrgId(WarehouseReq msg) {
List<String> allOrg = new ArrayList<>(); List<Long> allOrg = new ArrayList<>();
if (msg.getIncludeLowerLevel().equals("false")){ if (msg.getIncludeLowerLevel().equals("false")){
allOrg.add(msg.getOrgId().toString()); allOrg.add(msg.getOrgId());
}else if(msg.getIncludeLowerLevel().equals("true")){ }else if(msg.getIncludeLowerLevel().equals("true")){
//查询某组织机构的本级及下级 //查询某组织机构的本级及下级
allOrg = pubOrgService.getLowerOrg(msg.getOrgId().toString()); allOrg = pubOrgService.getLowerOrg(msg.getOrgId());
} }
return allOrg; return allOrg;
} }
private List<Warehouse> getAllWarehouseByOrg(List<String> allOrgId) { private List<Warehouse> getAllWarehouseByOrg(List<Long> allOrgId) {
List<Warehouse> allWarehouse = new ArrayList<>(); List<Warehouse> allWarehouse = new ArrayList<>();
LambdaQueryWrapper<Warehouse> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Warehouse> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(Warehouse::getOrgIdInt, allOrgId); queryWrapper.in(Warehouse::getOrgId, allOrgId);
allWarehouse = warehouseMapper.selectList(queryWrapper); allWarehouse = warehouseMapper.selectList(queryWrapper);
return allWarehouse; return allWarehouse;
...@@ -171,24 +165,21 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse> ...@@ -171,24 +165,21 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper,Warehouse>
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS); return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
} }
private Warehouse queryWarehouse(WarehouseReq req) { private Warehouse queryWarehouse(WarehouseReq req) {
Warehouse app = this.getById(req.getId()); Warehouse warehouse = WarehoustExist(req.getId());
if (ObjectUtil.isNull(app)) { return warehouse;
throw new ServiceException(WarehouseExceptionEnum.WAREHOUSE_NOT_EXIST);
}
return app;
} }
private LambdaQueryWrapper<Product> createWrapper(ProductReq req) { //判断仓库是否存在
LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>(); @Override
if (ObjectUtil.isEmpty(req)) { public Warehouse WarehoustExist(String id) {
return wrapper; Warehouse warehouseMsg=this.getById(id);
if (ObjectUtil.isNull(warehouseMsg)){
throw new ServiceException(WarehouseExceptionEnum.WAREHOUSE_NOT_EXIST);
} }
//根据业务编码查询 return warehouseMsg;
wrapper.like(ObjectUtil.isNotEmpty(req.getProductCode()), Product::getProductCode, req.getProductCode());
//根据企业名称模糊查询
wrapper.like(ObjectUtil.isNotEmpty(req.getName()), Product::getName, req.getName());
wrapper.orderByDesc(Product::getUpdateTime);
return wrapper;
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论