Commit b6162003 by 李小惠

单警柜模块所有接口调试修改

parent ce565ede
package com.junmp.jyzb.api.bean.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class CabinetBoxDto implements Serializable {
/**
* 主键ID
*/
@ApiModelProperty(value = "主键ID")
private String id;
/**
* 箱号
*/
@ApiModelProperty(value = "箱号")
private Integer num;
/**
* 异常状态:1正常/0异常
*/
@ApiModelProperty(value = "异常状态:1正常/0异常")
private Integer state;
/**
* 异常原因
*/
@ApiModelProperty(value = "异常原因")
private String errorMsg;
}
package com.junmp.jyzb.api.bean.dto; package com.junmp.jyzb.api.bean.dto;
import com.junmp.v2.common.bean.request.BaseRequest;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@Data @Data
public class CabinetDto implements Serializable{
public class CabinetDto implements Serializable {
/** /**
* 单警柜ID * 单警柜ID
*/ */
...@@ -49,32 +44,9 @@ public class CabinetDto implements Serializable { ...@@ -49,32 +44,9 @@ public class CabinetDto implements Serializable {
@ApiModelProperty(value = "位置信息") @ApiModelProperty(value = "位置信息")
private String location; private String location;
/**
* 单警柜当前状态,0正常,1异常
*/
@ApiModelProperty(value = "单警柜当前状态,0正常,1异常")
private Integer state; private Integer state;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
private Date updateTime;
/**
* 更新人员
*/
@ApiModelProperty(value = "更新人员")
private String updateUser;
private List<CabinetBoxDto> cabinetBoxList;
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 lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Data
@EqualsAndHashCode(callSuper = true)
public class UpdateCabinetBoxReq extends BaseRequest {
@NotBlank(message = "箱门id不能为空",groups = {add.class,edit.class})
private String id;
@NotBlank(message = "箱门状态不能为空",groups = {edit.class})
private Integer state;
private String errorMsg;
//单警柜编号
@NotBlank(message = "单警柜编号不能为空",groups = {add.class})
private String cabinetNum;
@NotNull(message = "箱号不能为空",groups = {add.class})
private Integer num;
}
...@@ -5,8 +5,10 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -5,8 +5,10 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.Date; import java.util.Date;
import java.util.List;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
...@@ -14,14 +16,14 @@ public class UpdateCabinetReq extends BaseRequest { ...@@ -14,14 +16,14 @@ public class UpdateCabinetReq extends BaseRequest {
/** /**
* 单警柜ID * 单警柜ID
*/ */
@NotNull(message = "单警柜ID主键不能为空", groups = {edit.class, delete.class, detail.class}) @NotBlank(message = "单警柜ID主键不能为空", groups = {edit.class, detail.class})
@ApiModelProperty(value = "单警柜ID") @ApiModelProperty(value = "单警柜ID")
private String id; private String id;
/** /**
* 单警柜编号 * 单警柜编号
*/ */
@NotNull(message = "单警柜编号不能为空", groups = {edit.class, delete.class, detail.class}) @NotBlank(message = "单警柜编号不能为空", groups = {add.class,edit.class, detail.class})
@ApiModelProperty(value = "单警柜编号") @ApiModelProperty(value = "单警柜编号")
private String cabinetNum; private String cabinetNum;
...@@ -34,20 +36,21 @@ public class UpdateCabinetReq extends BaseRequest { ...@@ -34,20 +36,21 @@ public class UpdateCabinetReq extends BaseRequest {
/** /**
* 单警柜名称 * 单警柜名称
*/ */
@NotNull(message = "单警柜名称不能为空", groups = {edit.class, delete.class, detail.class}) @NotBlank(message = "单警柜名称不能为空", groups = {add.class,edit.class, detail.class})
@ApiModelProperty(value = "单警柜名称") @ApiModelProperty(value = "单警柜名称")
private String name; private String name;
/** /**
* 组织机构号 * 组织机构号
*/ */
@NotNull(message = "组织机构号不能为空", groups = {edit.class, delete.class, detail.class}) @NotBlank(message = "组织机构号不能为空", groups = {add.class,edit.class, detail.class})
@ApiModelProperty(value = "组织机构号") @ApiModelProperty(value = "组织机构号")
private String orgId; private String orgId;
/** /**
* 位置信息 * 位置信息
*/ */
@NotBlank(message = "位置信息不能为空", groups = {add.class, edit.class})
@ApiModelProperty(value = "位置信息") @ApiModelProperty(value = "位置信息")
private String location; private String location;
...@@ -81,11 +84,13 @@ public class UpdateCabinetReq extends BaseRequest { ...@@ -81,11 +84,13 @@ public class UpdateCabinetReq extends BaseRequest {
@ApiModelProperty(value = "本机及下级") @ApiModelProperty(value = "本机及下级")
private String includeLowerLevel; private String includeLowerLevel;
// /**
// * 单警柜与箱门一对多关系 //箱门信息列表
// */ private List<UpdateCabinetBoxReq> cabinetBoxList;
// private List<CabinetBox> list;
// private List<CabinetBox> a ; //单警柜id列表
@NotBlank(message = "单警柜不能为空", groups = {delete.class})
private List<String> cabinetList;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }
\ No newline at end of file
package com.junmp.jyzb.Dto;
import com.junmp.jyzb.entity.CabinetBox;
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 CabinetDto extends BaseRequest {
/**
* 单警柜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;
/**
* 是否包含本级及下级,true为包含,false为不包含,只显示本级
*/
@ApiModelProperty(value = "本机及下级")
private String includeLowerLevel;
/**
* 单警柜与箱门一对多关系
*/
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.api.bean.req.UpdateCabinetBoxReq;
import com.junmp.jyzb.service.CabinetBoxService;
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;
@RestController
@Slf4j
@RequestMapping("/CabinetBox")
@Api(tags = "箱门信息模块")
public class CabinetBoxController {
@Resource
private CabinetBoxService cabinetBoxService;
//添加箱门信息
@PostMapping("/AddBoxInfo")
@ApiOperation("添加箱门信息")
public ApiRes<Boolean> AddBoxInfo(@RequestBody @Validated(ValidationApi.add.class) UpdateCabinetBoxReq req){
boolean b = cabinetBoxService.AddBoxInfo(req);
if (!b){
return ApiRes.failure("添加失败");
}
return ApiRes.success(b);
}
}
package com.junmp.jyzb.controller; package com.junmp.jyzb.controller;
import com.junmp.jyzb.Dto.CabinetDto; import com.junmp.jyzb.api.bean.dto.CabinetDto;
import com.junmp.jyzb.api.bean.query.CabinetBoxReq; import com.junmp.jyzb.api.bean.query.CabinetBoxReq;
import com.junmp.jyzb.api.bean.query.CabinetReq; import com.junmp.jyzb.api.bean.query.CabinetReq;
import com.junmp.jyzb.api.bean.req.UpdateCabinetReq; import com.junmp.jyzb.api.bean.req.UpdateCabinetReq;
import com.junmp.jyzb.entity.Cabinet;
import com.junmp.jyzb.entity.CabinetBox; import com.junmp.jyzb.entity.CabinetBox;
import com.junmp.jyzb.service.CabinetBoxService; import com.junmp.jyzb.service.CabinetBoxService;
import com.junmp.jyzb.service.CabinetService; import com.junmp.jyzb.service.CabinetService;
import com.junmp.jyzb.utils.ResponseResult; import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.v2.common.bean.request.ValidationApi;
import com.junmp.v2.common.bean.response.ApiRes; import com.junmp.v2.common.bean.response.ApiRes;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -34,29 +35,46 @@ public class CabinetController { ...@@ -34,29 +35,46 @@ public class CabinetController {
private CabinetBoxService cabinetBoxService; private CabinetBoxService cabinetBoxService;
@PostMapping("/ErrorState")
@ApiOperation("单警柜状态变更")
public ApiRes<Boolean> ChangeCabinetState(@RequestBody UpdateCabinetReq req) {
boolean result = cabinetService.ChangeCabinetState(req);
if (!result){
return ApiRes.failure("操作失败");
}
return ApiRes.success(result);
}
@PostMapping("/ShowCabinet") @PostMapping("/AddCabinetInfo")
@ApiOperation("查询单警柜") @ApiOperation("添加单警柜信息")
public ResponseResult showCabinet(@RequestBody Map<String, Object> msg){ public ApiRes<String> addCabinetInfo(@RequestBody @Validated(ValidationApi.add.class) UpdateCabinetReq req){
ResponseResult returnMsg = cabinetService.getAllCabinet(msg); String cabinetId = cabinetService.addCabinetInfo(req);
return returnMsg; return ApiRes.success(cabinetId);
} }
@PostMapping("/DeleteCabinetInfo")
@ApiOperation("删除单警柜信息")
public ApiRes<Boolean> deleteCabinetInfo(@RequestBody @Validated(ValidationApi.delete.class) UpdateCabinetReq req) {
return ApiRes.success(cabinetService.deleteCabinetInfo(req));
}
@PostMapping("/ErrorState") @PostMapping("/UpdateCabinetInfo")
@ApiOperation("单警柜状态变更") @ApiOperation("修改单警柜信息")
public ResponseResult changeCabinetState(@RequestBody Map<String,Object> msg) { public ApiRes<Boolean> updateCabinetInfo(@RequestBody @Validated(ValidationApi.edit.class) UpdateCabinetReq req) {
ResponseResult returnMsg = cabinetService.changeCabinetState(msg); boolean result = cabinetService.updateCabinetInfo(req);
return returnMsg; if (!result){
return ApiRes.failure("操作失败");
}
return ApiRes.success(result);
} }
@PostMapping("/GetCabinetDetail") //通过单警柜id查询单个箱门及其箱门信息
@ApiOperation("查询单警柜及其箱号信息") @PostMapping("/ShowOneCabinet")
public ResponseResult getCabinetDetail(@RequestBody Map<String, Object> msg){ @ApiOperation("查询单个单警柜及其箱门信息")
ResponseResult returnMsg = cabinetService.getCabinetDetail(msg); public ApiRes<CabinetDto> showOneCabinet(@RequestBody CabinetReq req){
return returnMsg; return ApiRes.success(cabinetService.showOneCabinet(req));
} }
@PostMapping("/GetCabinetByOrgId") @PostMapping("/GetCabinetByOrgId")
...@@ -65,56 +83,26 @@ public class CabinetController { ...@@ -65,56 +83,26 @@ public class CabinetController {
ResponseResult returnMsg = cabinetService.getCabinetByOrgId(msg); ResponseResult returnMsg = cabinetService.getCabinetByOrgId(msg);
return returnMsg; return returnMsg;
} }
@PostMapping("/AddCabinetInfo")
@ApiOperation("添加单警柜信息(新)")
public ApiRes<String> addCabinetInfo(@RequestBody UpdateCabinetReq req){
String cabinetId = cabinetService.addCabinetInfo(req);
return ApiRes.success(cabinetId);
}
@PostMapping("/DeleteCabinetInfo")
@ApiOperation("删除单警柜信息(新)")
public ApiRes<Boolean> deleteCabinetInfo(@RequestBody UpdateCabinetReq req) {
return ApiRes.success(cabinetService.deleteCabinetInfo(req));
}
@PostMapping("/ShowCabinetList") @PostMapping("/ShowCabinetList")
@ApiOperation("查询单警柜列表(新)") @ApiOperation("查询单警柜列表")
public ApiRes<List<Cabinet>> showCabinetList(@RequestBody CabinetReq req){ public ApiRes<List<CabinetDto>> showCabinetList(@RequestBody CabinetReq req){
List<Cabinet> allCabinetList = cabinetService.getAllCabinetList(req); List<CabinetDto> allCabinetList = cabinetService.getAllCabinetList(req);
if (allCabinetList.size()<=0){ if (allCabinetList.size()<=0){
return ApiRes.failure("查询失败,列表为null"); return ApiRes.failure("查询失败,列表为null");
} }
return ApiRes.success(allCabinetList); return ApiRes.success(allCabinetList);
} }
//通过单警柜id查询单个箱门及其箱门信息
@PostMapping("/ShowOneCabinet")
@ApiOperation("查询单个单警柜及其箱门信息(新)")
public ApiRes<CabinetDto> showOneCabinet(@RequestBody CabinetReq req){
return ApiRes.success(cabinetService.showOneCabinet(req));
}
@PostMapping("/getCabinetBoxList") @PostMapping("/getCabinetBoxList")
@ApiOperation("通过单警柜id获取箱门列表(新)") @ApiOperation("通过单警柜id获取箱门列表")
public ApiRes<List<CabinetBox>> getCabinetBoxList(@RequestBody CabinetReq req){ public ApiRes<List<CabinetBox>> getCabinetBoxList(@RequestBody CabinetReq req){
return ApiRes.success(cabinetBoxService.getCabinetBoxList(req)); return ApiRes.success(cabinetBoxService.getCabinetBoxList(req));
} }
@PostMapping("/UpdateCabinetInfo")
@ApiOperation("修改单警柜信息(新)")
public ApiRes<Boolean> updateCabinetInfo(@RequestBody UpdateCabinetReq req) {
boolean result = cabinetService.updateCabinetInfo(req);
if (!result){
return ApiRes.failure("操作失败");
}
return ApiRes.success(result);
}
@PostMapping("/boxBindPolice") @PostMapping("/boxBindPolice")
@ApiOperation("箱门绑定人员(新)") @ApiOperation("箱门绑定人员")
public ApiRes<Boolean> boxBindPolice(@RequestBody CabinetBoxReq req) { public ApiRes<Boolean> boxBindPolice(@RequestBody CabinetBoxReq req) {
boolean result = cabinetService.boxBindPolice(req); boolean result = cabinetService.boxBindPolice(req);
if (!result){ if (!result){
...@@ -122,4 +110,11 @@ public class CabinetController { ...@@ -122,4 +110,11 @@ public class CabinetController {
} }
return ApiRes.success(result); return ApiRes.success(result);
} }
@PostMapping("/SearchOrgId")
@ApiOperation("/根据单警柜id查询组织机构id")
public ApiRes<Long> SearchOrgId(String id){
return ApiRes.success(cabinetService.SearchOrgId(id));
}
} }
\ No newline at end of file
...@@ -12,8 +12,6 @@ public interface CabinetBoxMapper extends BaseMapper<CabinetBox> { ...@@ -12,8 +12,6 @@ public interface CabinetBoxMapper extends BaseMapper<CabinetBox> {
List<Map<String, Object>> getBoxMsg(String id); List<Map<String, Object>> getBoxMsg(String id);
void changeCabinetState(CabinetBox cabinetBox);
List<CabinetBox> selectByIdCabinetBoxes(String id); List<CabinetBox> selectByIdCabinetBoxes(String id);
......
package com.junmp.jyzb.mapper; package com.junmp.jyzb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.junmp.jyzb.Dto.CabinetDto; import com.junmp.jyzb.api.bean.dto.CabinetDto;
import com.junmp.jyzb.entity.Cabinet; import com.junmp.jyzb.entity.Cabinet;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -36,7 +36,6 @@ public interface CabinetMapper extends BaseMapper<Cabinet> { ...@@ -36,7 +36,6 @@ public interface CabinetMapper extends BaseMapper<Cabinet> {
String getCabinetNumById(String id); String getCabinetNumById(String id);
List<Cabinet> getAllCabinetByOrgList(List<String> allOrgId); List<Cabinet> getAllCabinetByOrgList(List<String> allOrgId);
List<CabinetDto> getAllCabinetByOrgList111(List<String> allOrgId);
void setCabinetSumInventory(@Param("updateId") String id); void setCabinetSumInventory(@Param("updateId") String id);
......
...@@ -2,6 +2,7 @@ package com.junmp.jyzb.service; ...@@ -2,6 +2,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.query.CabinetReq; import com.junmp.jyzb.api.bean.query.CabinetReq;
import com.junmp.jyzb.api.bean.req.UpdateCabinetBoxReq;
import com.junmp.jyzb.entity.CabinetBox; import com.junmp.jyzb.entity.CabinetBox;
import com.junmp.jyzb.entity.Policeman; import com.junmp.jyzb.entity.Policeman;
...@@ -15,4 +16,6 @@ public interface CabinetBoxService extends IService<CabinetBox> { ...@@ -15,4 +16,6 @@ public interface CabinetBoxService extends IService<CabinetBox> {
List<CabinetBox> getCabinetBoxList(CabinetReq req); List<CabinetBox> getCabinetBoxList(CabinetReq req);
//添加箱门信息
boolean AddBoxInfo(UpdateCabinetBoxReq req);
} }
package com.junmp.jyzb.service; package com.junmp.jyzb.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.jyzb.Dto.CabinetDto; import com.junmp.jyzb.api.bean.dto.CabinetDto;
import com.junmp.jyzb.api.bean.query.CabinetBoxReq; import com.junmp.jyzb.api.bean.query.CabinetBoxReq;
import com.junmp.jyzb.api.bean.query.CabinetReq; import com.junmp.jyzb.api.bean.query.CabinetReq;
import com.junmp.jyzb.api.bean.req.UpdateCabinetReq; import com.junmp.jyzb.api.bean.req.UpdateCabinetReq;
...@@ -21,13 +21,9 @@ public interface CabinetService extends IService<Cabinet> { ...@@ -21,13 +21,9 @@ public interface CabinetService extends IService<Cabinet> {
Map<String, Object> getOneCabinet(String cabinetId); Map<String, Object> getOneCabinet(String cabinetId);
ResponseResult changeCabinetState(Map<String, Object> msg);
List<String> getAllCabinetBoxId(String id); List<String> getAllCabinetBoxId(String id);
ResponseResult getAllCabinet(Map<String, Object> msg);
ResponseResult getCabinetDetail(Map<String, Object> msg);
ResponseResult setCabinetInventory(Map<String, Object> msg); ResponseResult setCabinetInventory(Map<String, Object> msg);
...@@ -50,7 +46,7 @@ public interface CabinetService extends IService<Cabinet> { ...@@ -50,7 +46,7 @@ public interface CabinetService extends IService<Cabinet> {
* @param req * @param req
* @return * @return
*/ */
List<Cabinet> getAllCabinetList(CabinetReq req); List<CabinetDto> getAllCabinetList(CabinetReq req);
...@@ -81,4 +77,13 @@ public interface CabinetService extends IService<Cabinet> { ...@@ -81,4 +77,13 @@ public interface CabinetService extends IService<Cabinet> {
* @return * @return
*/ */
ResponseResult getCabinetByOrgId(Map<String, Object> msg); ResponseResult getCabinetByOrgId(Map<String, Object> msg);
/**
* 修改单警柜箱门状态
* @param req
* @return
*/
boolean ChangeCabinetState(UpdateCabinetReq req);
Long SearchOrgId(String id);
} }
...@@ -4,17 +4,26 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -4,17 +4,26 @@ 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;
import com.junmp.jyzb.api.bean.query.CabinetReq; import com.junmp.jyzb.api.bean.query.CabinetReq;
import com.junmp.jyzb.api.bean.req.UpdateCabinetBoxReq;
import com.junmp.jyzb.entity.Cabinet;
import com.junmp.jyzb.entity.CabinetBox; import com.junmp.jyzb.entity.CabinetBox;
import com.junmp.jyzb.entity.Policeman; import com.junmp.jyzb.entity.Policeman;
import com.junmp.jyzb.exception.enums.CabinetExceptionEnum;
import com.junmp.jyzb.mapper.CabinetBoxMapper; import com.junmp.jyzb.mapper.CabinetBoxMapper;
import com.junmp.jyzb.mapper.PoliceFingerMapper; import com.junmp.jyzb.mapper.PoliceFingerMapper;
import com.junmp.jyzb.mapper.PolicemanMapper; import com.junmp.jyzb.mapper.PolicemanMapper;
import com.junmp.jyzb.service.CabinetBoxService; import com.junmp.jyzb.service.CabinetBoxService;
import com.junmp.jyzb.service.CabinetService;
import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.util.BeanPlusUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID;
@Service @Service
public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, CabinetBox> implements CabinetBoxService { public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, CabinetBox> implements CabinetBoxService {
...@@ -31,6 +40,9 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet ...@@ -31,6 +40,9 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet
@Resource @Resource
private PoliceFingerMapper policeFingerMapper; private PoliceFingerMapper policeFingerMapper;
@Resource
private CabinetService cabinetService;
@Override @Override
public List<Map<String, Object>> getAllBoxMsg(String id) { public List<Map<String, Object>> getAllBoxMsg(String id) {
return cabinetBoxMapper.getBoxMsg(id); return cabinetBoxMapper.getBoxMsg(id);
...@@ -50,4 +62,29 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet ...@@ -50,4 +62,29 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet
return cabinetBoxList; return cabinetBoxList;
} }
//添加箱门信息
@Override
@Transactional(rollbackFor = Exception.class)
public boolean AddBoxInfo(UpdateCabinetBoxReq req) {
CabinetBox cabinetBox = new CabinetBox();
BeanPlusUtil.copyProperties(req,cabinetBox);
//添加单警柜箱门信息默认状态为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());
Integer num = cabinet.getNum();
if (num==null){
num=1;
cabinet.setNum(num);
}else {
cabinet.setNum(cabinet.getNum()+1);
}
cabinetService.updateById(cabinet);
return save(cabinetBox);
}
} }
...@@ -3,9 +3,12 @@ package com.junmp.jyzb.service.impl; ...@@ -3,9 +3,12 @@ package com.junmp.jyzb.service.impl;
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;
import com.junmp.jyzb.Dto.CabinetDto; import com.junmp.jyzb.api.bean.dto.CabinetDto;
import com.junmp.jyzb.api.bean.dto.CabinetBoxDto;
import com.junmp.jyzb.api.bean.dto.CabinetDto;
import com.junmp.jyzb.api.bean.query.CabinetBoxReq; import com.junmp.jyzb.api.bean.query.CabinetBoxReq;
import com.junmp.jyzb.api.bean.query.CabinetReq; import com.junmp.jyzb.api.bean.query.CabinetReq;
import com.junmp.jyzb.api.bean.req.UpdateCabinetBoxReq;
import com.junmp.jyzb.api.bean.req.UpdateCabinetReq; import com.junmp.jyzb.api.bean.req.UpdateCabinetReq;
import com.junmp.jyzb.entity.Cabinet; import com.junmp.jyzb.entity.Cabinet;
import com.junmp.jyzb.entity.CabinetBox; import com.junmp.jyzb.entity.CabinetBox;
...@@ -85,56 +88,11 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -85,56 +88,11 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
@Override @Override
public ResponseResult changeCabinetState(Map<String, Object> msg) {
// 进行参数校验
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) {
checkNotBlank(box.get("cabinetBoxId"), "cabinetBoxId不能为空");
checkNotBlank(box.get("state"), "state不能为空");
}
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, e.getMessage());
}
//判断组织机构id是否正确
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) {
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);
}
@Override
public List<String> getAllCabinetBoxId(String id) { public List<String> getAllCabinetBoxId(String id) {
List<String> msg = cabinetMapper.getAllCabinetBoxId(id); List<String> msg = cabinetMapper.getAllCabinetBoxId(id);
return msg; return msg;
} }
@Override
public ResponseResult getAllCabinet(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("orgId"), "orgId不能为空");
checkNotBlank(msg.get("IncludeLowerLevel"), "IncludeLowerLevel不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR, e.getMessage());
}
List<Map<String, Object>> allCabinet = new ArrayList<>();
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS, allCabinet);
}
private List<String> getAllOrgId(CabinetReq req, String includeLowerLevel) { private List<String> getAllOrgId(CabinetReq req, String includeLowerLevel) {
List<String> allOrg = new ArrayList<>(); List<String> allOrg = new ArrayList<>();
...@@ -152,11 +110,6 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -152,11 +110,6 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
allCabinet = cabinetMapper.getAllCabinetByOrgList(allOrgId); allCabinet = cabinetMapper.getAllCabinetByOrgList(allOrgId);
return allCabinet; return allCabinet;
} }
private List<CabinetDto> getAllCabinetByOrg111( List<String> allOrgId) {
List<CabinetDto> allCabinet = new ArrayList<>();
allCabinet = cabinetMapper.getAllCabinetByOrgList111(allOrgId);
return allCabinet;
}
@Override @Override
public List<String> getAllCabinetId(Map<String, Object> msg) { public List<String> getAllCabinetId(Map<String, Object> msg) {
...@@ -197,25 +150,6 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -197,25 +150,6 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
return cabinetId; return cabinetId;
} }
@Override
public ResponseResult getCabinetDetail(Map<String, Object> msg) {
// 进行参数校验
try {
checkNotBlank(msg.get("id"), "id不能为空");
} catch (IllegalArgumentException e) {
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);
}
List<Map<String, Object>> allBoxMsg = cabinetBoxMapper.getBoxMsg(idMsg);
cabinetMsg.put("cabinetBoxList", allBoxMsg);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS, cabinetMsg);
}
public ResponseResult setCabinetInventory(Map<String, Object> msg) { public ResponseResult setCabinetInventory(Map<String, Object> msg) {
String id; String id;
...@@ -269,7 +203,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -269,7 +203,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
.eq(ObjectUtil.isNotEmpty(ObjectUtil.isNotEmpty(req.getCabinetNum())), Cabinet::getCabinetNum, req.getCabinetNum()) .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.getOrgId())), Cabinet::getOrgId, req.getOrgId())
.eq(ObjectUtil.isNotEmpty(ObjectUtil.isNotEmpty(req.getName())), Cabinet::getName, req.getName())); .eq(ObjectUtil.isNotEmpty(ObjectUtil.isNotEmpty(req.getName())), Cabinet::getName, req.getName()));
ArrayList<CabinetBox> objects = new ArrayList<>(); List<CabinetBox> objects = new ArrayList<>();
for (int i = 1; i <= req.getNum(); i++) { for (int i = 1; i <= req.getNum(); i++) {
CabinetBox cabinetBox = new CabinetBox(); CabinetBox cabinetBox = new CabinetBox();
cabinetBox.setCabinetId(one.getId()); cabinetBox.setCabinetId(one.getId());
...@@ -284,35 +218,55 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -284,35 +218,55 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
/** /**
* 删除单警柜 * 删除单警柜(批量删除)
* *
* @param req * @param req
* @return * @return
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public boolean deleteCabinetInfo(UpdateCabinetReq req) { public boolean deleteCabinetInfo(UpdateCabinetReq req) {
//获取传递的id列表
List<String> cabinetIdList = req.getCabinetList();
List<Cabinet> cabinetList=new ArrayList<>();
//遍历单警柜id列表
for (String id:cabinetIdList) {
//通过单警柜id查询出他的箱门数 //通过单警柜id查询出他的箱门数
Cabinet cabinet = this.getOne(new LambdaQueryWrapper<Cabinet>() Cabinet cabinet = this.getOne(new LambdaQueryWrapper<Cabinet>()
.eq(ObjectUtil.isNotEmpty(req.getId()), Cabinet::getId, req.getId())); .eq(ObjectUtil.isNotEmpty(id), Cabinet::getId,id));
//如果查询不到单警柜抛出异常 //如果查询不到单警柜抛出异常
if (ObjectUtil.isEmpty(cabinet)) { if (ObjectUtil.isEmpty(cabinet)) {
throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS); throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
} }
//查询出单警柜之后添加到列表中
cabinetList.add(cabinet);
//通过单警柜id循环遍历出并删除所有箱门信息 //通过单警柜id循环遍历出并删除所有箱门信息
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(id), CabinetBox::getCabinetId, id));
//创建police列表方便批量删除操作
List<Policeman> policemanList=new ArrayList<>();
//创建cabinetBox列表方便批量删除操作
List<CabinetBox> cabinetBoxList=new ArrayList<>();
for (CabinetBox cabinetBox: list) { for (CabinetBox cabinetBox: list) {
CabinetBox cabinetBox1 = new CabinetBox();
BeanPlusUtil.copyProperties(cabinetBox,cabinetBox1);
cabinetBoxList.add(cabinetBox1);
//删除箱门信息的同时需要去判断箱门是否绑定警员,如果有,则解除绑定 //删除箱门信息的同时需要去判断箱门是否绑定警员,如果有,则解除绑定
Policeman one = policemanService.getOne(new LambdaQueryWrapper<Policeman>() Policeman one = policemanService.getOne(new LambdaQueryWrapper<Policeman>()
.eq(ObjectUtil.isNotEmpty(cabinetBox.getId()),Policeman::getCabinetBoxId,cabinetBox.getId())); .eq(ObjectUtil.isNotEmpty(cabinetBox.getId()),Policeman::getCabinetBoxId,cabinetBox.getId()));
if (!ObjectUtil.isNull(one)){ if (!ObjectUtil.isNull(one)){
one.setCabinetBoxId(null); one.setCabinetBoxId(null);
policemanService.updateById(one); policemanList.add(one);
} }
cabinetBoxService.removeById(cabinetBox.getId());
} }
//删除单警柜id //批量修改绑定箱门的警员信息,将其解绑
return this.removeById(cabinet.getId()); policemanService.updateBatchById(policemanList);
//批量删除箱门数
cabinetBoxService.removeBatchByIds(cabinetBoxList);
//批量删除单警柜id
removeBatchByIds(cabinetList);
}
return true;
} }
/** /**
...@@ -323,22 +277,52 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -323,22 +277,52 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
* @return * @return
*/ */
@Override @Override
public List<Cabinet> getAllCabinetList(CabinetReq req) { public List<CabinetDto> getAllCabinetList(CabinetReq req) {
List<Cabinet> cabinets = new ArrayList<>(); List<Cabinet> cabinets = new ArrayList<>();
List<CabinetDto> cabinetList=new ArrayList<>();
List<CabinetBoxDto> cabinetBoxList=new ArrayList<>();
//如果组织机构时浙江省公安厅 //如果组织机构时浙江省公安厅
if (req.getOrgId().equals("1369509498032808905") && req.getIncludeLowerLevel().equals("true")) { if (req.getOrgId().equals("1369509498032808905") && req.getIncludeLowerLevel().equals("true")) {
cabinets = cabinetMapper.getAllCabinet(); cabinets = cabinetMapper.getAllCabinet();
return cabinets; for (Cabinet cabinet:cabinets) {
CabinetDto cabinetDto = new CabinetDto();
BeanPlusUtil.copyProperties(cabinet,cabinetDto);
//添加箱门信息列表
List<CabinetBox> list = cabinetBoxService.list(new LambdaQueryWrapper<CabinetBox>()
.eq(CabinetBox::getCabinetId, cabinet.getId()));
for (CabinetBox cabinetBox:list) {
CabinetBoxDto cabinetBoxDto = new CabinetBoxDto();
BeanPlusUtil.copyProperties(cabinetBox,cabinetBoxDto);
cabinetBoxList.add(cabinetBoxDto);
}
cabinetDto.setCabinetBoxList(cabinetBoxList);
cabinetList.add(cabinetDto);
}
return cabinetList;
} }
//分两种情况,如果说是本级及下级(全部)所有的单警柜信息,则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<String> allOrgId = getAllOrgId(req, req.getIncludeLowerLevel());
if (allOrgId.isEmpty()) { if (allOrgId.size()==0) {
//抛出组织机构不存在异常 //抛出组织机构不存在异常
throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST); throw new ServiceException(PubOrgExceptionEnum.PUBORG_NOT_EXIST);
} }
cabinets = getAllCabinetByOrg(allOrgId); cabinets = getAllCabinetByOrg(allOrgId);
return cabinets; for (Cabinet cabinet:cabinets) {
CabinetDto cabinetDto = new CabinetDto();
BeanPlusUtil.copyProperties(cabinet,cabinetDto);
//添加箱门信息列表
List<CabinetBox> list = cabinetBoxService.list(new LambdaQueryWrapper<CabinetBox>()
.eq(CabinetBox::getCabinetId, cabinet.getId()));
for (CabinetBox cabinetBox:list) {
CabinetBoxDto cabinetBoxDto = new CabinetBoxDto();
BeanPlusUtil.copyProperties(cabinetBox,cabinetBoxDto);
cabinetBoxList.add(cabinetBoxDto);
}
cabinetDto.setCabinetBoxList(cabinetBoxList);
cabinetList.add(cabinetDto);
}
return cabinetList;
} else { } else {
//传递的数据是否正确,不正确抛异常(只接受true、false) //传递的数据是否正确,不正确抛异常(只接受true、false)
throw new ServiceException(CabinetExceptionEnum.PARAMETER_ERROR); throw new ServiceException(CabinetExceptionEnum.PARAMETER_ERROR);
...@@ -348,6 +332,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -348,6 +332,7 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
/** /**
* 通过单警柜id查询单个单警柜及其箱门信息 * 通过单警柜id查询单个单警柜及其箱门信息
*
* @param req * @param req
* @return * @return
*/ */
...@@ -362,10 +347,16 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -362,10 +347,16 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
//查询单警柜的箱门信息 //查询单警柜的箱门信息
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()));
List<CabinetBoxDto> boxList=new ArrayList<>();
for (CabinetBox cabinetBox: list) {
CabinetBoxDto cabinetBoxDto = new CabinetBoxDto();
BeanPlusUtil.copyProperties(cabinetBox,cabinetBoxDto);
boxList.add(cabinetBoxDto);
}
//将单警柜的信息和它的箱门信息返回 //将单警柜的信息和它的箱门信息返回
CabinetDto cabinetDto = new CabinetDto(); CabinetDto cabinetDto = new CabinetDto();
BeanPlusUtil.copyProperties(one,cabinetDto); BeanPlusUtil.copyProperties(one,cabinetDto);
cabinetDto.setList(list); cabinetDto.setCabinetBoxList(boxList);
return cabinetDto; return cabinetDto;
} }
...@@ -388,35 +379,16 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -388,35 +379,16 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
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()));
if (list.size()>0) { if (list.size()>0) {
//判断是否是本身,如果是则不抛出异常(根据单警柜id进行比较)
Cabinet cabinet = list.get(0);
if (!cabinet.getId().equals(req.getId())){
//抛出单警柜重复异常 //抛出单警柜重复异常
throw new ServiceException(CabinetExceptionEnum.CABINETID_IS_EXISTS); throw new ServiceException(CabinetExceptionEnum.CABINETID_IS_EXISTS);
} }
Cabinet cabinet = new Cabinet();
BeanPlusUtil.copyProperties(req, cabinet);
//如果新增箱门个数,那么对应的箱门表中也需要插入对应对应数量的箱门记录条数
Cabinet cabinet1 = this.getOne(new LambdaQueryWrapper<Cabinet>()
.eq(ObjectUtil.isNotEmpty(req.getOrgId()), Cabinet::getOrgId, req.getOrgId())
.eq(ObjectUtil.isNotEmpty(req.getCabinetNum()), Cabinet::getCabinetNum, req.getCabinetNum()));
Integer oldNum = cabinet1.getNum();
Integer totalBoxNum = cabinet1.getNum()+req.getNum();
List<CabinetBox> objects = new ArrayList<>();
//循环新增箱数信息
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);
//保存到list
objects.add(cabinetBox);
} }
//批量插入 Cabinet cabinet = new Cabinet();
cabinetBoxService.saveBatch(objects); BeanPlusUtil.copyProperties(req, cabinet);
//总箱门数就是原来的箱门数+新增的箱门数
cabinet.setNum(totalBoxNum);
return this.updateById(cabinet); return this.updateById(cabinet);
} }
...@@ -485,6 +457,38 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl ...@@ -485,6 +457,38 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS, allCabinet); return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS, allCabinet);
} }
/**
* 修改单警柜箱门状态
* @param req
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public boolean ChangeCabinetState(UpdateCabinetReq req) {
//查询单警柜是否存在
Cabinet cabinet = getOne(new LambdaQueryWrapper<Cabinet>()
.eq(Cabinet::getId, req.getId()));
if (ObjectUtil.isNull(cabinet)){
throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
}
List<UpdateCabinetBoxReq> cabinetBoxList = req.getCabinetBoxList();
List<CabinetBox> list =new ArrayList<>();
for (UpdateCabinetBoxReq updateCabinet:cabinetBoxList) {
CabinetBox cabinetBox = new CabinetBox();
BeanPlusUtil.copyProperties(updateCabinet,cabinetBox);
list.add(cabinetBox);
}
return cabinetBoxService.updateBatchById(list);
}
@Override
public Long SearchOrgId(String id) {
Cabinet one = getOne(new LambdaQueryWrapper<Cabinet>().eq(Cabinet::getId, id));
if (ObjectUtil.isNull(one)){
throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
}
return one.getOrgId();
}
//查询机构id是否存在 //查询机构id是否存在
......
...@@ -393,6 +393,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -393,6 +393,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
} }
policemanDto.setFingersList(policeFingerDtoList); policemanDto.setFingersList(policeFingerDtoList);
policeList.add(policemanDto); policeList.add(policemanDto);
} }
PoliceDto policeDto = new PoliceDto(); PoliceDto policeDto = new PoliceDto();
policeDto.setPolicemanlist(policeList); policeDto.setPolicemanlist(policeList);
......
...@@ -22,11 +22,6 @@ ...@@ -22,11 +22,6 @@
WHERE f.cabinet_id = #{id}; WHERE f.cabinet_id = #{id};
</select> </select>
<update id="changeCabinetState">
update base_cabinet_box f
set state = #{state},error_msg=#{errorMsg}
where f.id =#{id}
</update>
<select id="selectByIdCabinetBoxes" resultType="com.junmp.jyzb.entity.CabinetBox" <select id="selectByIdCabinetBoxes" resultType="com.junmp.jyzb.entity.CabinetBox"
parameterType="java.lang.String"> parameterType="java.lang.String">
......
...@@ -146,26 +146,6 @@ ...@@ -146,26 +146,6 @@
#{item} #{item}
</foreach> </foreach>
</select> </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">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论