Commit 2157aed5 by 李小惠

新增装备绑定箱门数据结构以及控制层方法

parent 22dd9de4
2024-03-22 08:41:56.419 ERROR 16168 --- [http-nio-10030-exec-6] c.j.j.b.c.handle.GlobalExceptionHandler : >授权异常>>获取token失败,请检查header和param中是否传递了用户token
2024-03-22 08:44:27.804 ERROR 16168 --- [http-nio-10030-exec-6] c.j.j.b.c.handle.GlobalExceptionHandler : >授权异常>>账号或密码错误
2024-03-22 08:45:17.271 ERROR 16168 --- [http-nio-10030-exec-10] c.j.j.b.c.handle.GlobalExceptionHandler : 业务异常,错误信息为:应用名称已存在
2024-03-22 13:12:20.078 ERROR 24848 --- [main] c.j.v.c.listener.ConfigInitListener : 初始化系统配置表失败,执行查询语句失败
java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:906)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:831)
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at com.junmp.v2.config.listener.ConfigInitListener.eventCallback(ConfigInitListener.java:79)
at com.junmp.v2.common.listener.ContextInitializedListener.onApplicationEvent(ContextInitializedListener.java:30)
at com.junmp.v2.common.listener.ContextInitializedListener.onApplicationEvent(ContextInitializedListener.java:20)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
at org.springframework.boot.context.event.EventPublishingRunListener.contextPrepared(EventPublishingRunListener.java:89)
at org.springframework.boot.SpringApplicationRunListeners.lambda$contextPrepared$3(SpringApplicationRunListeners.java:67)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
at org.springframework.boot.SpringApplicationRunListeners.contextPrepared(SpringApplicationRunListeners.java:67)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:391)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:325)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1313)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
at com.junmp.jyzb.boot.JyzbBootApplication.main(JyzbBootApplication.java:46)
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:91)
at com.mysql.cj.NativeSession.connect(NativeSession.java:144)
at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:850)
... 24 common frames omitted
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:75)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:476)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:218)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:200)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:162)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:394)
at java.net.Socket.connect(Socket.java:606)
at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155)
at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:65)
... 26 common frames omitted
2024-03-22 13:12:20.163 ERROR 24848 --- [main] o.s.boot.SpringApplication : Application run failed
com.junmp.v2.config.api.exception.ConfigException: 初始化系统配置表失败,执行查询语句失败
at com.junmp.v2.config.listener.ConfigInitListener.eventCallback(ConfigInitListener.java:95)
at com.junmp.v2.common.listener.ContextInitializedListener.onApplicationEvent(ContextInitializedListener.java:30)
at com.junmp.v2.common.listener.ContextInitializedListener.onApplicationEvent(ContextInitializedListener.java:20)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
at org.springframework.boot.context.event.EventPublishingRunListener.contextPrepared(EventPublishingRunListener.java:89)
at org.springframework.boot.SpringApplicationRunListeners.lambda$contextPrepared$3(SpringApplicationRunListeners.java:67)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
at org.springframework.boot.SpringApplicationRunListeners.contextPrepared(SpringApplicationRunListeners.java:67)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:391)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:325)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1313)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
at com.junmp.jyzb.boot.JyzbBootApplication.main(JyzbBootApplication.java:46)
......@@ -49,3 +49,88 @@
2024-03-22 09:15:34.236 INFO 16168 --- [http-nio-10030-exec-8] c.j.v2.ws.channel.WsSessionContainer : 推送消息>>{"data":"23","serverMsgType":"102","toUserId":"1760955516758704130"}
2024-03-22 09:15:34.236 INFO 16168 --- [http-nio-10030-exec-8] c.j.v2.ws.server.ScreenWebSocketServer : 已建立连接
2024-03-22 09:21:35.307 WARN 16168 --- [http-nio-10030-exec-4] c.j.v2.ws.server.ScreenWebSocketServer : 会话已关闭
2024-03-22 13:12:13.009 INFO 24848 --- [main] c.j.v.c.listener.ConfigInitListener : 当前数据库驱动类>>>com.mysql.cj.jdbc.Driver
2024-03-22 13:12:13.314 WARN 24848 --- [background-preinit] o.s.h.c.j.Jackson2ObjectMapperBuilder : For Jackson Kotlin classes support please add "com.fasterxml.jackson.module:jackson-module-kotlin" to the classpath
2024-03-22 13:12:20.078 ERROR 24848 --- [main] c.j.v.c.listener.ConfigInitListener : 初始化系统配置表失败,执行查询语句失败
java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:906)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:831)
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at com.junmp.v2.config.listener.ConfigInitListener.eventCallback(ConfigInitListener.java:79)
at com.junmp.v2.common.listener.ContextInitializedListener.onApplicationEvent(ContextInitializedListener.java:30)
at com.junmp.v2.common.listener.ContextInitializedListener.onApplicationEvent(ContextInitializedListener.java:20)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
at org.springframework.boot.context.event.EventPublishingRunListener.contextPrepared(EventPublishingRunListener.java:89)
at org.springframework.boot.SpringApplicationRunListeners.lambda$contextPrepared$3(SpringApplicationRunListeners.java:67)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
at org.springframework.boot.SpringApplicationRunListeners.contextPrepared(SpringApplicationRunListeners.java:67)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:391)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:325)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1313)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
at com.junmp.jyzb.boot.JyzbBootApplication.main(JyzbBootApplication.java:46)
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:91)
at com.mysql.cj.NativeSession.connect(NativeSession.java:144)
at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:850)
... 24 common frames omitted
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:75)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:476)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:218)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:200)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:162)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:394)
at java.net.Socket.connect(Socket.java:606)
at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155)
at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:65)
... 26 common frames omitted
2024-03-22 13:12:20.163 ERROR 24848 --- [main] o.s.boot.SpringApplication : Application run failed
com.junmp.v2.config.api.exception.ConfigException: 初始化系统配置表失败,执行查询语句失败
at com.junmp.v2.config.listener.ConfigInitListener.eventCallback(ConfigInitListener.java:95)
at com.junmp.v2.common.listener.ContextInitializedListener.onApplicationEvent(ContextInitializedListener.java:30)
at com.junmp.v2.common.listener.ContextInitializedListener.onApplicationEvent(ContextInitializedListener.java:20)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
at org.springframework.boot.context.event.EventPublishingRunListener.contextPrepared(EventPublishingRunListener.java:89)
at org.springframework.boot.SpringApplicationRunListeners.lambda$contextPrepared$3(SpringApplicationRunListeners.java:67)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
at org.springframework.boot.SpringApplicationRunListeners.contextPrepared(SpringApplicationRunListeners.java:67)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:391)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:325)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1313)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
at com.junmp.jyzb.boot.JyzbBootApplication.main(JyzbBootApplication.java:46)
......@@ -7,6 +7,7 @@ import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
/**
......@@ -16,12 +17,13 @@ import java.util.List;
@EqualsAndHashCode(callSuper = true)
public class EquipmentBindReq extends BaseRequest {
/**
* 单警柜箱号id
* epc
*/
@NotBlank(message = "箱号id不能为空",groups = {edit.class})
private String cabinetBoxId;
private String epc;
/**
* 装备id集合
* type_id
*/
List<String> equipmentList;
private String typeId;
private String sizeId;
private BigDecimal price;
}
package com.junmp.jyzb.api.bean.req;
import lombok.Data;
import java.util.List;
@Data
public class UpdateEqsBoxReq {
private Long orgId;
private String locationId;
private List<String> epcList;
private List<EquipmentBindReq> eqsList;
}
......@@ -29,6 +29,7 @@ public enum PolicemanExceptionEnum implements IExceptionEnum {
*/
POLICECODE_IS_EXISTS(CommonConstant.DEFAULT_USER_ERROR_CODE,"警员编号已经存在,警员编号重复"),
POLICENAME_IS_EXISTS(CommonConstant.DEFAULT_USER_ERROR_CODE,"警员姓名已经存在,警员姓名重复"),
POLICE_IS_EXISTS(CommonConstant.DEFAULT_USER_ERROR_CODE,"警员姓名+警号已经存在,请勿重复添加"),
/**
* 该警员已经绑定账号
......
......@@ -74,7 +74,7 @@ public class CabinetController {
@PostMapping(path="/UpdateCabinetClient",name="修改单警柜信息,警柜使用#logType=30")
@ApiOperation("修改单警柜信息,警柜使用")
public ApiRes<Boolean> UpdateCabinetClient(@RequestBody UpdateCabinetReq req) {
boolean result = cabinetService.updateCabinetInfo(req);
boolean result = cabinetService.updateCabinetClient(req);
if (!result){
return ApiRes.failure("操作失败");
}
......
......@@ -5,8 +5,8 @@ import com.junmp.jyzb.api.bean.dto.*;
import com.junmp.jyzb.api.bean.dto.FetchingDataDto.EquipmentDto;
import com.junmp.jyzb.api.bean.query.*;
import com.junmp.jyzb.api.bean.req.BatchEditingInvsReq;
import com.junmp.jyzb.api.bean.req.EquipmentBindReq;
import com.junmp.jyzb.api.bean.req.RabbitMqOrderReq;
import com.junmp.jyzb.api.bean.req.UpdateEqsBoxReq;
import com.junmp.jyzb.entity.InventorySummary;
import com.junmp.jyzb.entity.LogDetail;
import com.junmp.jyzb.entity.LogSummary;
......@@ -46,11 +46,11 @@ public class InventoryController {
//装备绑定箱门
@PostMapping(path="/EquipmentBind",name="装备绑定箱门#logType=30")
@ApiOperation("装备绑定箱门")
public ApiRes<Boolean> InventoryBind(@RequestBody @Validated(ValidationApi.edit.class) EquipmentBindReq req){
return ApiRes.success(inventoryService.InventoryBind(req));
}
// @PostMapping(path="/EquipmentBind",name="装备绑定箱门#logType=30")
// @ApiOperation("装备绑定箱门")
// public ApiRes<Boolean> InventoryBind(@RequestBody @Validated(ValidationApi.edit.class) EquipmentBindReq req){
// return ApiRes.success(inventoryService.InventoryBind(req));
// }
//手动修改仓库数量信息,修改的是base_warehouse中的个别字段(总数,总价,入库数,出库数),是通过inventory_summary进行统计的
......@@ -316,6 +316,18 @@ public class InventoryController {
return ApiRes.success(inventoryService.GetByPeriodAndDate(req));
}
//装备绑定箱门
@PostMapping(path = "/EqsBindBox",name = "装备绑定箱门#logType=30")
@ApiOperation("装备绑定箱门")
public ApiRes<Boolean> EqsBindBox(@RequestBody UpdateEqsBoxReq req){
return ApiRes.success(inventoryService.EqsBindBox(req));
}
//装备解绑箱门
@PostMapping(path = "/EqsUnBindBox",name = "装备解绑箱门#logType=30")
@ApiOperation("装备解绑箱门")
public ApiRes<Boolean> EqsUnBindBox(@RequestBody UpdateEqsBoxReq req){
return ApiRes.success(inventoryService.EqsUnBindBox(req));
}
......
......@@ -247,6 +247,12 @@ public class PoliceController {
public ApiRes<Boolean> PoliceBindBox(@RequestBody @Validated(ValidationApi.add.class) PolicemanReq req){
return ApiRes.success(policemanService.PoliceBindBox(req));
}
//人员解绑箱门
@PostMapping(path = "PoliceUnBindBox",name = "人员解绑箱门#logType=30")
@ApiOperation("人员解绑箱门")
public ApiRes<Boolean> PoliceUnBindBox(@RequestBody @Validated(ValidationApi.add.class) PolicemanReq req){
return ApiRes.success(policemanService.PoliceUnBindBox(req));
}
//删除账号的同时,将警员的信息进行更新
......
package com.junmp.jyzb.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* @TableName base_police_equipment_detail
*/
@TableName(value ="base_police_equipment_detail")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PoliceEquipmentDetail implements Serializable {
/**
* 主键id
*/
@TableId(value = "id",type = IdType.ASSIGN_UUID)
private String id;
/**
* 警员id
*/
@TableField(value = "police_id")
private String policeId;
/**
* epc
*/
@TableField(value = "epc")
private String epc;
/**
* 组织机构id
*/
@TableField(value = "org_id")
private String orgId;
/**
* 位置id
*/
@TableField(value = "location_id")
private String locationId;
/**
* 类型id
*/
@TableField(value = "type_id")
private String typeId;
/**
* 号型id
*/
@TableField(value = "size_id")
private String sizeId;
/**
* 单价
*/
@TableField(value = "price")
private BigDecimal price;
/**
* 创建时间
*/
@TableField(value = "create_time")
private Date createTime;
/**
* 更新时间
*/
@TableField(value = "update_time")
private Date updateTime;
/**
* 创建人员
*/
@TableField(value = "create_user")
private String createUser;
/**
* 更新人员
*/
@TableField(value = "update_user")
private String updateUser;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import com.junmp.jyzb.entity.PoliceEquipmentDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author Administrator
* @description 针对表【base_police_equipment_detail】的数据库操作Mapper
* @createDate 2024-03-25 14:18:17
* @Entity aaa.domain.PoliceEquipmentDetail
*/
public interface PoliceEquipmentDetailMapper extends BaseMapper<PoliceEquipmentDetail> {
}
......@@ -7,8 +7,9 @@ import com.junmp.jyzb.api.bean.dto.FetchingDataDto.EquipmentDto;
import com.junmp.jyzb.api.bean.query.*;
import com.junmp.jyzb.api.bean.req.BatchEditingInvsReq;
import com.junmp.jyzb.api.bean.req.EquipmentBindReq;
import com.junmp.jyzb.api.bean.req.RabbitMqOrderReq;
import com.junmp.jyzb.api.bean.req.UpdateEqsBoxReq;
import com.junmp.jyzb.entity.Inventory;
import com.junmp.jyzb.entity.InventorySummary;
import com.junmp.jyzb.entity.LogDetail;
......@@ -29,7 +30,7 @@ public interface InventoryService extends IService<Inventory> {
boolean UpdateCabinetInsNum(CabinetReq req);
boolean InventoryBind(EquipmentBindReq req);
// boolean InventoryBind(EquipmentBindReq req);
List<InventoryDto> GetInvInfoByEpc(InventoryReq req);
......@@ -95,4 +96,7 @@ public interface InventoryService extends IService<Inventory> {
List<PeriodAndDateDto> GetByPeriodAndDate(InventoryReq req);
List<Inventory> selectSum(List<Object[]> searchItem,Integer epctype);
boolean EqsBindBox(UpdateEqsBoxReq req);
boolean EqsUnBindBox(UpdateEqsBoxReq req);
}
package com.junmp.jyzb.service;
import com.junmp.jyzb.entity.PoliceEquipmentDetail;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author Administrator
* @description 针对表【base_police_equipment_detail】的数据库操作Service
* @createDate 2024-03-25 14:18:17
*/
public interface PoliceEquipmentDetailService extends IService<PoliceEquipmentDetail> {
}
......@@ -27,6 +27,8 @@ import java.util.List;
public interface PolicemanService extends IService<Policeman> {
Object addEs();
//添加警员
......@@ -136,4 +138,8 @@ public interface PolicemanService extends IService<Policeman> {
boolean CreateAllUserId();
boolean PoliceUnBindBox(PolicemanReq req);
}
......@@ -15,8 +15,8 @@ import com.junmp.jyzb.api.bean.dto.*;
import com.junmp.jyzb.api.bean.dto.FetchingDataDto.EquipmentDto;
import com.junmp.jyzb.api.bean.query.*;
import com.junmp.jyzb.api.bean.req.BatchEditingInvsReq;
import com.junmp.jyzb.api.bean.req.EquipmentBindReq;
import com.junmp.jyzb.api.bean.req.RabbitMqOrderReq;
import com.junmp.jyzb.api.bean.req.UpdateEqsBoxReq;
import com.junmp.jyzb.api.bean.vo.InventoryVo;
import com.junmp.jyzb.api.exception.JYZBAppException;
import com.junmp.jyzb.api.exception.enums.*;
......@@ -165,26 +165,26 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
}
//装备绑定箱门
@Override
public boolean InventoryBind(EquipmentBindReq req) {
//判断箱门是否存在
CabinetBox cabinetBox = cabinetBoxService.CabinetBoxExist(req.getCabinetBoxId());
if (Objects.isNull(cabinetBox)){
throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_ISNOT_EXISTS);
}
List<String> equipmentList = req.getEquipmentList();
if (equipmentList.size()==0){
throw new ServiceException(CabinetExceptionEnum.PARAMETER_ERROR);
}
List<Inventory> inventoryList=new ArrayList<>();
for (String id: equipmentList) {
Inventory inventory = getById(id);
//locationId:根据单警柜的不同存放的内容不同,单警柜存放箱门id,仓库存放仓库id
inventory.setLocationId(req.getCabinetBoxId());
inventoryList.add(inventory);
}
return updateBatchById(inventoryList);
}
// @Override
// public boolean InventoryBind(EquipmentBindReq req) {
// //判断箱门是否存在
// CabinetBox cabinetBox = cabinetBoxService.CabinetBoxExist(req.getCabinetBoxId());
// if (Objects.isNull(cabinetBox)){
// throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_ISNOT_EXISTS);
// }
// List<String> equipmentList = req.getEquipmentList();
// if (equipmentList.size()==0){
// throw new ServiceException(CabinetExceptionEnum.PARAMETER_ERROR);
// }
// List<Inventory> inventoryList=new ArrayList<>();
// for (String id: equipmentList) {
// Inventory inventory = getById(id);
// //locationId:根据单警柜的不同存放的内容不同,单警柜存放箱门id,仓库存放仓库id
// inventory.setLocationId(req.getCabinetBoxId());
// inventoryList.add(inventory);
// }
// return updateBatchById(inventoryList);
// }
//根据Epc查询装备信息
@Override
......@@ -894,5 +894,27 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
return inventoryMapper.selectSum(searchItem,epcType);
}
//装备绑定箱门
@Override
public boolean EqsBindBox(UpdateEqsBoxReq req) {
//1.修改具体epc位置信息
// for (:) {
//
// }
//2.修改原始出库仓库的库存汇总信息
//3.新增绑定箱门的库存汇总信息
//4.具体epc绑定人员
return false;
}
//装备解绑箱门
@Override
public boolean EqsUnBindBox(UpdateEqsBoxReq req) {
//1.修改epc具体位置信息
//2.修改绑定单警柜的库存信息
return false;
}
}
\ No newline at end of file
package com.junmp.jyzb.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.jyzb.entity.PoliceEquipmentDetail;
import com.junmp.jyzb.service.PoliceEquipmentDetailService;
import com.junmp.jyzb.mapper.PoliceEquipmentDetailMapper;
import org.springframework.stereotype.Service;
/**
* @author Administrator
* @description 针对表【base_police_equipment_detail】的数据库操作Service实现
* @createDate 2024-03-25 14:18:17
*/
@Service
public class PoliceEquipmentDetailServiceImpl extends ServiceImpl<PoliceEquipmentDetailMapper, PoliceEquipmentDetail>
implements PoliceEquipmentDetailService{
}
......@@ -180,6 +180,9 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
private PolicemanService policemanService;
@Resource
private PoliceEquipmentDetailService policeEquipmentDetailService;
@Resource
private SysUserMapper sysUserMapper;
private static final String REDIS_POLICE = "Policeman_";
......@@ -206,17 +209,15 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
throw new ServiceException(UserExceptionEnum.USER_IS_EXIST);
}
//判断警员编号是否已经存在
//判断警员编号+姓名是否已经存在,并且该身份是民警,如果存在,那么直接添加失败
List<Policeman> list = list(new LambdaQueryWrapper<Policeman>().eq(Policeman::getPoliceCode, req.getPoliceCode())
.eq(Policeman::getIdentity, req.getIdentity()).or().eq(Policeman::getName, req.getName()));
for (Policeman policeman:list) {
if (policeman.getPoliceCode().equals(req.getPoliceCode())){
throw new ServiceException(PolicemanExceptionEnum.POLICECODE_IS_EXISTS);
}
if (policeman.getName().equals(req.getName())){
throw new ServiceException(PolicemanExceptionEnum.POLICENAME_IS_EXISTS);
}
.eq(Policeman::getIdentity, req.getIdentity()).eq(Policeman::getName, req.getName()));
if (CollectionUtil.isNotEmpty(list)){
throw new ServiceException(PolicemanExceptionEnum.POLICE_IS_EXISTS);
}
//查询传入的组织机构id是否存在
pubOrgService.PubOrgExist(req.getOrgId());
//绑定账号
......@@ -549,12 +550,15 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
public boolean DeletePolice(UpdatePolicemanReq req) {
//通过警员id查询警员信息
Policeman policeman = PoliceExist(req.getId());
cabinetBoxPoliceService.list(new LambdaQueryWrapper<CabinetBoxPolice>().eq(CabinetBoxPolice::getPoliceId,req.getId()));
List<CabinetBoxPolice> list = cabinetBoxPoliceService
.list(new LambdaQueryWrapper<CabinetBoxPolice>()
.eq(CabinetBoxPolice::getPoliceId, req.getId()));
//通过警员信息中的userId对账号进行删除
sysUserService.remove(new LambdaQueryWrapper<SysUser>()
sysUserService.update(new LambdaUpdateWrapper<SysUser>().set(SysUser::getDelFlag,1)
.eq(SysUser::getUserId, policeman.getUserId()));
//还要对关系表进行删除
sysUserOrgService.remove(new LambdaQueryWrapper<SysUserOrg>().eq(SysUserOrg::getUserId,policeman.getUserId()));
sysUserOrgService.remove(new LambdaQueryWrapper<SysUserOrg>()
.eq(SysUserOrg::getUserId,policeman.getUserId()));
return removeById(req.getId());
}
......@@ -615,16 +619,9 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
//判断警员是否存在
Policeman one = PoliceExist(req.getId());
List<Policeman> list = list(new LambdaQueryWrapper<Policeman>().eq(Policeman::getPoliceCode, req.getPoliceCode())
.eq(Policeman::getIdentity, req.getIdentity()).or().eq(Policeman::getName, req.getName()));
for (Policeman policeman:list) {
if (!policeman.getId().equals(one.getId())){
if (policeman.getPoliceCode().equals(req.getPoliceCode())){
throw new ServiceException(PolicemanExceptionEnum.POLICECODE_IS_EXISTS);
}
if (policeman.getName().equals(req.getName())){
throw new ServiceException(PolicemanExceptionEnum.POLICENAME_IS_EXISTS);
}
}
.eq(Policeman::getIdentity, req.getIdentity()).eq(Policeman::getName, req.getName()));
if (CollectionUtil.isNotEmpty(list)){
throw new ServiceException(PolicemanExceptionEnum.POLICE_IS_EXISTS);
}
//判断传入的修改的警员编号与本身编号一致,如果一致则无所谓,如果不一致则需要判断修改的警员编号是否已经存在
BeanPlusUtil.copyProperties(req, one);
......@@ -640,6 +637,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
SysUser user= sysUserService.getById(req.getUserId());
user.setPassword(req.getPassword());
user.setNickName(req.getName());
user.setAccount(req.getName()+req.getPoliceCode());
sysUserService.updateById(user);
//修改角色
if (req.getRolesList().size()>0){
......@@ -1378,7 +1376,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
//调岗警员绑定第一个单警柜以后,不管之后他是否还有单警柜,我都默认是不绑了。
// 判断他下面是否有箱门,如果有则表示他已经帮过单警柜并且调岗携带的装备都已经记录过,那么将不再被记录
if (ObjectUtil.isNotNull(orderLog) && list1.size()==0 && !flag ){
if (orderLog== null && list1.size()==0 && !flag ){
flag=true;
cabinetBox = cabinetBoxService.getById(boxId);
......@@ -1409,6 +1407,45 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
return result;
}
//人员解绑箱门
@Override
@Transactional
public boolean PoliceUnBindBox(PolicemanReq req) {
//判断传递的警员id是否存在,判断传递的箱门id是否绑定在该警员下面
Policeman policeman = PoliceExist(req.getId());
List<CabinetBoxPolice> list = cabinetBoxPoliceService.list(new LambdaQueryWrapper<CabinetBoxPolice>()
.eq(CabinetBoxPolice::getPoliceId, policeman.getId()));
List<CabinetBoxPolice> delList=new ArrayList<>();
if (req.getBoxList().size()>0) {
for (CabinetBoxPolice boxPolice:list) {
for (String boxId:req.getBoxList()) {
if (boxId.equals(boxPolice.getCabinetBoxId())){
delList.add(boxPolice);
}
}
}
}
if (CollectionUtil.isNotEmpty(delList)){
cabinetBoxPoliceService.removeBatchByIds(delList);
}
//人员与箱门装备表是否存在绑定关系,如果存在,那么进行解绑操作
// List<PoliceEquipmentDetail> eqsPoliceList = policeEquipmentDetailService.list(new LambdaQueryWrapper<PoliceEquipmentDetail>()
// .eq(PoliceEquipmentDetail::getPoliceId, policeman.getId()));
// if (eqsPoliceList.size()>0){
// for (PoliceEquipmentDetail policeEqsDetail:eqsPoliceList) {
// for (String boxId:req.getBoxList()) {
// if (boxId.equals(policeEqsDetail.getLocationId())){
// policeEqsDetail.setPoliceId(null);
// }
// }
// }
// policeEquipmentDetailService.updateBatchById(eqsPoliceList);
// }
return true;
}
//添加调岗第一次调入人员绑定箱门时修改装备汇总表的信息以及记录日志
private boolean updateSumDataAndLog(Long orgId,CabinetBox cabinetbox,List<PoliceEquipment> policeEqsList,List<Object[]> searchItem){
PubOrg pubOrg = pubOrgService.PubOrgExist(orgId);
......@@ -1524,8 +1561,6 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
public boolean changePoliceOrg(UpdateReassignmentReq req) {
//通过警员id查询出该警员的基本信息
Policeman policeman = getById(req.getPoliceId());
SysDict sysDict = sysDictService.getOne(new LambdaQueryWrapper<SysDict>()
.eq(SysDict::getDictCode, "reassignment_type"));
StringBuilder stringBuilder = new StringBuilder();
Integer inventoryQuantity=0;
......@@ -1583,7 +1618,10 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
//箱门进行解绑删除
cabinetBoxPoliceService.remove(new LambdaQueryWrapper<CabinetBoxPolice>()
.eq(CabinetBoxPolice::getPoliceId,policeman.getId()));
//拿到警员绑定的装备详情,根据具体epc进行设置orgId和locationId为空
List<PoliceEquipmentDetail> EqsDetaillist = policeEquipmentDetailService.list(new LambdaQueryWrapper<PoliceEquipmentDetail>()
.eq(PoliceEquipmentDetail::getPoliceId, policeman.getId())
.groupBy(PoliceEquipmentDetail::getTypeId,PoliceEquipmentDetail::getSizeId,PoliceEquipmentDetail::getPrice));
//判断前端传递的装备列表字段是否为空,如果为空则表示该警员不拿走任何装备信息(不做任何操作)
if (ObjectUtil.isNotNull(req.getDetailList()) || !req.getDetailList().trim().isEmpty()){
......@@ -1594,9 +1632,9 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
stringBuilder.append(req.getOrgName()+"的警员"+req.getPoliceName()+
",警号为:"+req.getPoliceCode()+",因调岗拿走以下装备:");
for (PoliceEquipment policeEquipment:list1) {
for (PoliceEquipment policeEquipment:list1) {//库中存在装备
boolean flag=false;
for (PoliceEquipment one:reqEquipments) {
for (PoliceEquipment one:reqEquipments) {//传递装备
if (policeEquipment.getSizeId().equals(one.getSizeId())
&& policeEquipment.getTypeId().equals(one.getTypeId())){
......@@ -1637,40 +1675,48 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
for (Object[] obj:searchItem) {
if (obj[1].equals(is.getLocationId())&& obj[2].equals(is.getTypeId())
&& obj[3].equals(is.getSizeId()) && is.getUnitPrice().compareTo((BigDecimal) obj[4])==0){
is.setOutboundNumber(is.getOutboundNumber()-(Integer) obj[5]);
is.setNumber(is.getNumber()-(Integer) obj[5]);
is.setOutboundNumberPrice(is.getUnitPrice().multiply(BigDecimal.valueOf(is.getOutboundNumber())));
is.setPrice(is.getUnitPrice().multiply(BigDecimal.valueOf(is.getNumber())));
//需要判断位置是在单警柜还是在仓库下面,如果在仓库下面,那么数量应该减去仓库的出库数量,
// 如果是在单警柜下面,那么数量应该减去单警柜的在库数量
if (is.getLocationType().equals("0")){
is.setOutboundNumber(is.getOutboundNumber()-(Integer) obj[5]);
is.setNumber(is.getNumber()-(Integer) obj[5]);
is.setOutboundNumberPrice(is.getUnitPrice().multiply(BigDecimal.valueOf(is.getOutboundNumber())));
is.setPrice(is.getUnitPrice().multiply(BigDecimal.valueOf(is.getNumber())));
}else{
is.setStockNumber(is.getStockNumber()-(Integer) obj[5]);
is.setNumber(is.getNumber()-(Integer) obj[5]);
is.setStockNumberPrice(is.getUnitPrice().multiply(BigDecimal.valueOf(is.getStockNumber())));
is.setPrice(is.getUnitPrice().multiply(BigDecimal.valueOf(is.getNumber())));
}
break;
}
}
}
inventorySummaryService.updateBatchById(inventorySummaryList);
//将epc设空(根据具体调岗带走装备数量)
}
}
//记录日志(如果警员携带装备,则进行记录 )
if (ObjectUtil.isNotNull(reqEquipments)){
OrderLog orderLog = new OrderLog();
String string = stringBuilder.toString();
string=string.substring(0,string.length()-1);
orderLog.setHistoryMsg(string);
orderLog.setOrgId(req.getOrgId());
//特殊记号,警员+警员编号
orderLog.setOrderType(req.getPoliceName()+req.getPoliceCode());
orderLog.setBussinessType(req.getReassignmentType());
orderLog.setOrderCode(req.getOrderCode());
orderLog.setOrderId(req.getId());
orderLog.setOrgName(req.getOrgName());
orderLog.setInventoryQuantity(inventoryQuantity);
orderLog.setActualQuantity(actualQuantity);
orderLog.setCreateTime(DateTimeUtil.getCurrentDateTime());
orderLogService.save(orderLog);
}
}
//记录日志(如果警员携带装备,则进行记录 )
OrderLog orderLog = new OrderLog();
String string = stringBuilder.toString();
string=string.substring(0,string.length()-1);
orderLog.setHistoryMsg(string);
orderLog.setOrgId(req.getOrgId());
//特殊记号,警员+警员编号
orderLog.setOrderType(req.getPoliceName()+req.getPoliceCode());
orderLog.setBussinessType(req.getReassignmentType());
orderLog.setProcessType(req.getReassignmentType());
orderLog.setOrderCode(req.getOrderCode());
orderLog.setOrderId(req.getId());
orderLog.setOrgName(req.getOrgName());
orderLog.setInventoryQuantity(inventoryQuantity);
orderLog.setActualQuantity(actualQuantity);
orderLog.setCreateTime(DateTimeUtil.getCurrentDateTime());
orderLogService.save(orderLog);
return updateById(policeman);
}
......@@ -2466,7 +2512,6 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
i--;
}
}
List<SysUserRole> sysUserRoleList=new ArrayList<>();
List<SysUserOrg> sysUserOrgList=new ArrayList<>();
List<SysUser> sysUserList=new ArrayList<>();
......@@ -2512,4 +2557,5 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
}
......@@ -753,7 +753,7 @@
</select>
<select id="GetByPeriodAndDate" resultType="com.junmp.jyzb.api.bean.PeriodAndDateDto">
select count(*) as zkCount,location_id,max(location_name) as location_name,warranty_period,production_date,price as unit_price,org_id FROM(
select count(*) as zk_count,location_id,max(location_name) as location_name,warranty_period,production_date,price as unit_price,org_id FROM(
SELECT a.*,b.warranty_period,b.production_date,b.price FROM
(SELECT org_id,size_id,type_id,location_id,epc,location_name FROM `base_warehouse_inventory` wi
where org_id=#{req.orgId} and type_id=#{req.typeId}
......@@ -781,7 +781,7 @@
and price =#{req.price}
</if>
<if test="req.zkCount != null and req.zkCount !=''">
and zkCount =#{req.zkCount}
and zk_count =#{req.zkCount}
</if>
<if test="req.warrantyPeriod != null and req.warrantyPeriod !=''">
and warranty_period =#{req.warrantyPeriod}
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.PoliceEquipmentDetailMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.entity.PoliceEquipmentDetail">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="policeId" column="police_id" jdbcType="VARCHAR"/>
<result property="epc" column="epc" jdbcType="VARCHAR"/>
<result property="orgId" column="org_id" jdbcType="VARCHAR"/>
<result property="locationId" column="location_id" jdbcType="VARCHAR"/>
<result property="typeId" column="type_id" jdbcType="VARCHAR"/>
<result property="sizeId" column="size_id" jdbcType="VARCHAR"/>
<result property="price" column="price" jdbcType="DECIMAL"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="createUser" column="create_user" jdbcType="VARCHAR"/>
<result property="updateUser" column="update_user" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id,police_id,epc,
org_id,location_id,type_id,
size_id,price,create_time,
update_time,create_user,update_user
</sql>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论