Commit 4b0c70d3 by 李小惠

修改出入库接口,修改本地主机上报接口业务逻辑代码

parent cb06d496
...@@ -194,5 +194,12 @@ public class BusFormDto { ...@@ -194,5 +194,12 @@ public class BusFormDto {
* 维保期 * 维保期
*/ */
private Integer maintenancePeriod; private Integer maintenancePeriod;
/**
* 单据当前状态(forbidden禁止使用,outgoing 仅出库使用,incoming仅入库使用,bothuseing出入库都可以使用一次)
*/
private String orderCurrentState;
/**
* 单据上次状态(forbidden禁止使用,outgoing 仅出库使用,incoming仅入库使用,bothuseing出入库都可以使用一次)
*/
private String orderLastState;
} }
...@@ -61,4 +61,6 @@ public class OrderDetailDto implements Serializable { ...@@ -61,4 +61,6 @@ public class OrderDetailDto implements Serializable {
* 维保期 * 维保期
*/ */
private Integer maintenancePeriod; private Integer maintenancePeriod;
private String remark;
} }
package com.junmp.jyzb.api.bean.dto; package com.junmp.jyzb.api.bean.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
...@@ -23,6 +24,11 @@ public class OrderDto implements Serializable { ...@@ -23,6 +24,11 @@ public class OrderDto implements Serializable {
*/ */
private String bussinessType; private String bussinessType;
/** /**
* 业务单据编号
*/
private String bussinessCode;
/**
* 订单号 * 订单号
*/ */
private String orderCode; private String orderCode;
...@@ -37,6 +43,7 @@ public class OrderDto implements Serializable { ...@@ -37,6 +43,7 @@ public class OrderDto implements Serializable {
/** /**
* 供应商名称 * 供应商名称
*/ */
private String supplierId;
private String supplierName; private String supplierName;
/** /**
* 收物单位 * 收物单位
...@@ -75,10 +82,7 @@ public class OrderDto implements Serializable { ...@@ -75,10 +82,7 @@ public class OrderDto implements Serializable {
*/ */
private String invList; private String invList;
/**
* 生产厂商
*/
private String manufacturerName;
/** /**
* 明细列表 * 明细列表
*/ */
...@@ -89,8 +93,6 @@ public class OrderDto implements Serializable { ...@@ -89,8 +93,6 @@ public class OrderDto implements Serializable {
private String createUser; private String createUser;
private String allocateType; private String allocateType;
private String repairName;
private String destoryName;
/** /**
* 附件地址 * 附件地址
...@@ -103,4 +105,24 @@ public class OrderDto implements Serializable { ...@@ -103,4 +105,24 @@ public class OrderDto implements Serializable {
private String returnUser; private String returnUser;
/**
* 移入仓库id
*/
private String locationId;
/**
* 移入仓库名称
*/
private String locationName;
/**
* 移入仓库id
*/
private String removeLocationId;
/**
* 移入仓库名称
*/
private String removeLocationName;
private String note;
} }
package com.junmp.jyzb.api.bean.dto; package com.junmp.jyzb.api.bean.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
...@@ -36,7 +37,7 @@ public class OrderMainDto implements Serializable { ...@@ -36,7 +37,7 @@ public class OrderMainDto implements Serializable {
//收物单位 //收物单位
private String endOrgName; private String endOrgName;
private String supplierId;
//供应商名称 //供应商名称
private String supplierName; private String supplierName;
...@@ -72,10 +73,7 @@ public class OrderMainDto implements Serializable { ...@@ -72,10 +73,7 @@ public class OrderMainDto implements Serializable {
*/ */
private Integer manualState; private Integer manualState;
/**
* 生产厂商id
*/
private String manufacturerId;
/** /**
* 调拨类型(2支拨,1价拨),调拨出入库才有 * 调拨类型(2支拨,1价拨),调拨出入库才有
...@@ -97,5 +95,23 @@ public class OrderMainDto implements Serializable { ...@@ -97,5 +95,23 @@ public class OrderMainDto implements Serializable {
*/ */
private String createUser; private String createUser;
/**
* 移入仓库id
*/
private String locationId;
/**
* 移入仓库名称
*/
private String locationName;
/**
* 移入仓库id
*/
private String removeLocationId;
/**
* 移入仓库名称
*/
private String removeLocationName;
} }
...@@ -5,12 +5,21 @@ import lombok.Data; ...@@ -5,12 +5,21 @@ import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
/**
* 主单据实体类
*/
@Data @Data
public class OrderReq { public class OrderReq {
private String id; private String id;
private BigDecimal price; private BigDecimal price;
private Integer actualQuantity; private Integer actualQuantity;
private Integer orderState; private String orderState;
//组织机构id
private Long orgId;
//组织机构名称
private String orgName;
//业务类型
private String bussinessType;
private List<DetailOrderReq> orderDetail; private List<DetailOrderReq> orderDetail;
private List<PurchaseEqsReq> purchaseList; private List<PurchaseEqsReq> purchaseList;
} }
...@@ -4,26 +4,19 @@ import lombok.Data; ...@@ -4,26 +4,19 @@ import lombok.Data;
import java.util.List; import java.util.List;
/**
* 总的出入记录上报实体类对象
*/
@Data @Data
public class OutInLogsReq { public class OutInLogsReq {
//组织机构id /**
private Long orgId; * 主单据对象
//组织机构名称 */
private String orgName; private OrderReq order;
//设备标识 /**
private String device; * 出入库记录对象
//出入设备 */
private Integer deviceType; private List<SummaryLogReq> logList;
//业务类型
private String bussinessType;
//出入状态
private String outInState;
//所属位置(0仓库1单警柜)
private Integer locationType;
private OrderReq orderMain;
private List<SummaryLogReq> logSummaryList;
} }
...@@ -15,9 +15,13 @@ public class PurchaseEqsReq { ...@@ -15,9 +15,13 @@ public class PurchaseEqsReq {
private Date productionDate; private Date productionDate;
private Integer warranyPeriod; private Integer warranyPeriod;
private Integer maintenancePeriod; private Integer maintenancePeriod;
//仓库id和仓库name
private String locationId;
private String locationName;
private String supplierId; private String supplierId;
private String supplierName; private String supplierName;
//装备类型0单件,1装备包 //装备类型0单件,1装备包
private Integer equipmentType; private Integer equipmentType;
private BigDecimal price; private BigDecimal price;
} }
...@@ -11,10 +11,25 @@ public class SummaryLogReq { ...@@ -11,10 +11,25 @@ public class SummaryLogReq {
private String orderCode; private String orderCode;
private String locationId; private String locationId;
private String locationName; private String locationName;
//组织机构id
private Long orgId;
//组织机构名称
private String orgName;
private String userName; private String userName;
private Date useTime; private Date useTime;
private String picture; private String picture;
private String equipmentList; private String equipmentList;
private Integer number; private Integer number;
//业务类型
private String bussinessType;
//设备标识
private String device;
//出入设备
private Integer deviceType;
//出入状态
private String outInState;
//所属位置(0仓库1单警柜)
private Integer locationType;
private List<DetailLogReq> logDetailList; private List<DetailLogReq> logDetailList;
} }
...@@ -72,5 +72,5 @@ public class OrderDetailReq extends BaseRequest { ...@@ -72,5 +72,5 @@ public class OrderDetailReq extends BaseRequest {
* 维保期 * 维保期
*/ */
private Integer maintenancePeriod; private Integer maintenancePeriod;
private String remark;
} }
package com.junmp.jyzb.api.bean.query; package com.junmp.jyzb.api.bean.query;
import com.baomidou.mybatisplus.annotation.TableField;
import com.junmp.v2.common.bean.request.BaseRequest; import com.junmp.v2.common.bean.request.BaseRequest;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
...@@ -35,6 +36,7 @@ public class OrderMainReq extends BaseRequest { ...@@ -35,6 +36,7 @@ public class OrderMainReq extends BaseRequest {
private Long endOrgId; private Long endOrgId;
private String endOrgName; private String endOrgName;
private String supplierId;
/** /**
* 供应商名称 * 供应商名称
*/ */
...@@ -65,6 +67,7 @@ public class OrderMainReq extends BaseRequest { ...@@ -65,6 +67,7 @@ public class OrderMainReq extends BaseRequest {
private String attachmentLocation; private String attachmentLocation;
private String invList; private String invList;
private String typeName;
/** /**
* 创建时间 * 创建时间
...@@ -91,10 +94,7 @@ public class OrderMainReq extends BaseRequest { ...@@ -91,10 +94,7 @@ public class OrderMainReq extends BaseRequest {
//排序规则 //排序规则
private String order; private String order;
/**
* 生产厂商id
*/
private String manufacturerName;
/** /**
* 调拨类型(2支拨,1价拨),调拨出入库才有 * 调拨类型(2支拨,1价拨),调拨出入库才有
...@@ -106,6 +106,24 @@ public class OrderMainReq extends BaseRequest { ...@@ -106,6 +106,24 @@ public class OrderMainReq extends BaseRequest {
*/ */
private String returnUserId; private String returnUserId;
/**
* 移入仓库id
*/
private String locationId;
/**
* 移入仓库名称
*/
private String locationName;
/**
* 移入仓库id
*/
private String removeLocationId;
/**
* 移入仓库名称
*/
private String removeLocationName;
private List<OrderDetailReq> detailList; private List<OrderDetailReq> detailList;
} }
...@@ -13,10 +13,10 @@ import java.util.List; ...@@ -13,10 +13,10 @@ import java.util.List;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class PolicemanReq extends BaseRequest { public class PolicemanReq extends BaseRequest {
@NotBlank(message = "警员主键不能为空", groups = {add.class,edit.class, delete.class, detail.class}) @NotBlank(message = "警员主键不能为空", groups = {add.class, detail.class})
private String id; private String id;
@NotBlank(message = "姓名不能为空", groups = {add.class}) @NotBlank(message = "姓名不能为空")
private String name; private String name;
private String cabinetId; private String cabinetId;
...@@ -30,7 +30,7 @@ public class PolicemanReq extends BaseRequest { ...@@ -30,7 +30,7 @@ public class PolicemanReq extends BaseRequest {
private String policeCode; private String policeCode;
@NotBlank(message = "性别不能为空", groups = {add.class}) @NotBlank(message = "性别不能为空")
private String sex; private String sex;
private String faceInfo; private String faceInfo;
...@@ -43,16 +43,16 @@ public class PolicemanReq extends BaseRequest { ...@@ -43,16 +43,16 @@ public class PolicemanReq extends BaseRequest {
private String doorCode; private String doorCode;
//账号 //账号
@NotBlank(message = "账号不能为空", groups = {add.class}) @NotBlank(message = "账号不能为空")
private String account; private String account;
//密码 //密码
@NotBlank(message = "密码不能为空", groups = {add.class}) @NotBlank(message = "密码不能为空")
private String password; private String password;
private String photo; private String photo;
@NotBlank(message = "电话不能为空", groups = {add.class}) @NotBlank(message = "电话不能为空")
private String phone; private String phone;
private Date createTime; private Date createTime;
......
package com.junmp.jyzb.api.bean.query; package com.junmp.jyzb.api.bean.query;
import com.baomidou.mybatisplus.annotation.TableField;
import com.junmp.v2.common.bean.request.BaseRequest; import com.junmp.v2.common.bean.request.BaseRequest;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
...@@ -211,4 +212,13 @@ public class QueryBusFormReq extends BaseRequest { ...@@ -211,4 +212,13 @@ public class QueryBusFormReq extends BaseRequest {
//是否创建空数据,true则创建,false则不创建 //是否创建空数据,true则创建,false则不创建
private Boolean isCreateNullDate; private Boolean isCreateNullDate;
/**
* 单据当前状态(forbidden禁止使用,outgoing 仅出库使用,incoming仅入库使用,bothuseing出入库都可以使用一次)
*/
private String orderCurrentState;
/**
* 单据上次状态(forbidden禁止使用,outgoing 仅出库使用,incoming仅入库使用,bothuseing出入库都可以使用一次)
*/
private String orderLastState;
} }
...@@ -185,5 +185,14 @@ public class UpdateBusFormReq extends BaseRequest { ...@@ -185,5 +185,14 @@ public class UpdateBusFormReq extends BaseRequest {
*/ */
private String invList; private String invList;
/**
* 单据当前状态(forbidden禁止使用,outgoing 仅出库使用,incoming仅入库使用,bothuseing出入库都可以使用一次)
*/
private String orderCurrentState;
/**
* 单据上次状态(forbidden禁止使用,outgoing 仅出库使用,incoming仅入库使用,bothuseing出入库都可以使用一次)
*/
private String orderLastState;
} }
...@@ -79,4 +79,6 @@ public class UpdateOrderDetailReq implements Serializable { ...@@ -79,4 +79,6 @@ public class UpdateOrderDetailReq implements Serializable {
*/ */
private Integer maintenancePeriod; private Integer maintenancePeriod;
private String remark;
} }
package com.junmp.jyzb.api.bean.req; package com.junmp.jyzb.api.bean.req;
import com.baomidou.mybatisplus.annotation.TableField;
import com.junmp.jyzb.api.bean.Validator.IsNumber; import com.junmp.jyzb.api.bean.Validator.IsNumber;
import com.junmp.v2.common.bean.request.BaseRequest; import com.junmp.v2.common.bean.request.BaseRequest;
import lombok.Data; import lombok.Data;
...@@ -131,10 +132,6 @@ public class UpdateOrderReq extends BaseRequest implements Serializable { ...@@ -131,10 +132,6 @@ public class UpdateOrderReq extends BaseRequest implements Serializable {
*/ */
private List<UpdateOrderDetailReq> detailList; private List<UpdateOrderDetailReq> detailList;
/**
* 生产厂商
*/
private String manufacturerName;
/** /**
* 调拨类型(2支拨,1价拨),调拨出入库才有 * 调拨类型(2支拨,1价拨),调拨出入库才有
...@@ -155,6 +152,24 @@ public class UpdateOrderReq extends BaseRequest implements Serializable { ...@@ -155,6 +152,24 @@ public class UpdateOrderReq extends BaseRequest implements Serializable {
//备注 //备注
private String note; private String note;
/**
* 移入仓库id
*/
private String locationId;
/**
* 移入仓库名称
*/
private String locationName;
/**
* 移入仓库id
*/
private String removeLocationId;
/**
* 移入仓库名称
*/
private String removeLocationName;
//消息类型()
private String api;
} }
...@@ -265,4 +265,9 @@ public class InventoryController { ...@@ -265,4 +265,9 @@ public class InventoryController {
return ApiRes.success(inventorySummaryService.selectTotalNum(req)); return ApiRes.success(inventorySummaryService.selectTotalNum(req));
} }
@PostMapping("/selectSumByItems")
public ApiRes<List<InventorySummary>> selectSumByItems(@RequestBody SelectTotalNumReq req){
return ApiRes.success(inventorySummaryService.selectSumByItems(req));
}
} }
...@@ -69,9 +69,9 @@ public class OutAndInboundController { ...@@ -69,9 +69,9 @@ public class OutAndInboundController {
return ApiRes.success(logDetailService.getInOutRecords(req)); return ApiRes.success(logDetailService.getInOutRecords(req));
} }
@PostMapping("/OutInRecords") // @PostMapping("/OutInRecords")
public ApiRes<Boolean> OutInRecords(@RequestBody OutInLogsReq req){ // public ApiRes<Boolean> OutInRecords(@RequestBody OutInLogsReq req){
return ApiRes.success(logSummaryService.processInventoryRecords(req)); // return ApiRes.success(logSummaryService.processInventoryRecords(req));
} // }
} }
...@@ -186,7 +186,7 @@ public class PoliceController { ...@@ -186,7 +186,7 @@ public class PoliceController {
*/ */
@PostMapping("/PoliceBindBox") @PostMapping("/PoliceBindBox")
@ApiOperation("人员绑定箱门") @ApiOperation("人员绑定箱门")
public ApiRes<Boolean> PoliceBindBox(@RequestBody PolicemanReq req){ public ApiRes<Boolean> PoliceBindBox(@RequestBody @Validated(ValidationApi.add.class) PolicemanReq req){
return ApiRes.success(policemanService.PoliceBindBox(req)); return ApiRes.success(policemanService.PoliceBindBox(req));
} }
......
...@@ -225,10 +225,15 @@ public class BusForm implements Serializable { ...@@ -225,10 +225,15 @@ public class BusForm implements Serializable {
private String currentAssign; private String currentAssign;
/** /**
* 单据使用次数(forbidden禁止使用,outgoing 仅出库使用,incoming仅入库使用,bothuseing出入库都可以使用一次) * 单据当前状态(forbidden禁止使用,outgoing 仅出库使用,incoming仅入库使用,bothuseing出入库都可以使用一次)
*/ */
@TableField(value = "use_count") @TableField(value = "order_current_state")
private String useCount; private String orderCurrentState;
/**
* 单据上次状态(forbidden禁止使用,outgoing 仅出库使用,incoming仅入库使用,bothuseing出入库都可以使用一次)
*/
@TableField(value = "order_last_state")
private String orderLastState;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
package com.junmp.jyzb.entity; package com.junmp.jyzb.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
...@@ -16,7 +18,7 @@ public class CabinetBoxPolice implements Serializable { ...@@ -16,7 +18,7 @@ public class CabinetBoxPolice implements Serializable {
/** /**
* *
*/ */
@TableField(value = "id") @TableId(value = "id", type = IdType.AUTO)
private Long id; private Long id;
/** /**
......
...@@ -25,8 +25,8 @@ public class EquipmentSize implements Serializable { ...@@ -25,8 +25,8 @@ public class EquipmentSize implements Serializable {
* 装备号型ID * 装备号型ID
*/ */
@ApiModelProperty(value = "装备号型ID") @ApiModelProperty(value = "装备号型ID")
@TableField("id")
@Id @Id
@TableId(value = "id",type = IdType.ASSIGN_UUID)
private String id; private String id;
/** /**
......
...@@ -20,8 +20,10 @@ public class InventorySummary implements Serializable { ...@@ -20,8 +20,10 @@ public class InventorySummary implements Serializable {
* 装备汇总id * 装备汇总id
*/ */
@ApiModelProperty(value = "装备汇总id") @ApiModelProperty(value = "装备汇总id")
private String id; @TableId(type = IdType.AUTO)
private Long id;
private String valuekey;
/** /**
* 组织机构id * 组织机构id
*/ */
......
package com.junmp.jyzb.entity; package com.junmp.jyzb.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
...@@ -18,7 +19,7 @@ public class LogDetail implements Serializable { ...@@ -18,7 +19,7 @@ public class LogDetail implements Serializable {
/** /**
* 出入库明细ID * 出入库明细ID
*/ */
@TableId(type = IdType.AUTO)
private Long detailId; private Long detailId;
/** /**
* 出入库汇总id * 出入库汇总id
......
...@@ -20,6 +20,7 @@ public class LogSummary implements Serializable { ...@@ -20,6 +20,7 @@ public class LogSummary implements Serializable {
/** /**
* 出入库汇总ID * 出入库汇总ID
*/ */
@TableId(type = IdType.AUTO)
private Long id; private Long id;
/** /**
......
package com.junmp.jyzb.entity; package com.junmp.jyzb.entity;
import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
...@@ -17,7 +15,7 @@ import java.util.Date; ...@@ -17,7 +15,7 @@ import java.util.Date;
@NoArgsConstructor @NoArgsConstructor
@TableName("bussiness_order_detail") @TableName("bussiness_order_detail")
public class OrderDetail implements Serializable { public class OrderDetail implements Serializable {
@TableField("id") @TableId(type = IdType.AUTO)
private Long id; private Long id;
@TableField("order_id") @TableField("order_id")
...@@ -105,4 +103,7 @@ import java.util.Date; ...@@ -105,4 +103,7 @@ import java.util.Date;
*/ */
@TableField("maintenance_period") @TableField("maintenance_period")
private Integer maintenancePeriod; private Integer maintenancePeriod;
@TableField("remark")
private String remark;
} }
...@@ -14,7 +14,7 @@ import java.util.Date; ...@@ -14,7 +14,7 @@ import java.util.Date;
@NoArgsConstructor @NoArgsConstructor
@TableName("bussiness_order_main") @TableName("bussiness_order_main")
public class OrderMain implements Serializable { public class OrderMain implements Serializable {
@TableId(value = "id",type = IdType.ASSIGN_UUID)
private String id; private String id;
@TableField("order_type") @TableField("order_type")
...@@ -44,6 +44,8 @@ public class OrderMain implements Serializable { ...@@ -44,6 +44,8 @@ public class OrderMain implements Serializable {
@TableField("end_org_name") @TableField("end_org_name")
private String endOrgName; private String endOrgName;
@TableField("supplier_id")
private String supplierId;
@TableField("supplier_name") @TableField("supplier_name")
private String supplierName; private String supplierName;
...@@ -89,8 +91,7 @@ public class OrderMain implements Serializable { ...@@ -89,8 +91,7 @@ public class OrderMain implements Serializable {
@TableField("current_assign") @TableField("current_assign")
private String currentAssign; private String currentAssign;
@TableField("return_date")
private Date returnDate;
@TableField("use_date") @TableField("use_date")
private Date useDate; private Date useDate;
...@@ -116,11 +117,6 @@ public class OrderMain implements Serializable { ...@@ -116,11 +117,6 @@ public class OrderMain implements Serializable {
@TableField("update_user") @TableField("update_user")
private String updateUser; private String updateUser;
/**
* 生产厂商id
*/
@TableField("manufacturer_name")
private String manufacturerName;
/** /**
* 调拨类型(2支拨,1价拨) * 调拨类型(2支拨,1价拨)
...@@ -133,16 +129,33 @@ public class OrderMain implements Serializable { ...@@ -133,16 +129,33 @@ public class OrderMain implements Serializable {
@TableField("return_user_id") @TableField("return_user_id")
private String returnUserId; private String returnUserId;
@TableField("repair_name") @TableField("return_user")
private String repairName; private String returnUser;
@TableField("destory_name")
private String destoryName;
@TableField("return_date")
private Date returnDate;
/**
* 移入仓库id
*/
@TableField("location_id") @TableField("location_id")
private String locationId; private String locationId;
/**
* 移入仓库名称
*/
@TableField("location_name") @TableField("location_name")
private String locationName; private String locationName;
/**
* 移入仓库id
*/
@TableField("remove_location_id")
private String removeLocationId;
/**
* 移入仓库名称
*/
@TableField("remove_location_name")
private String removeLocationName;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }
\ No newline at end of file
...@@ -24,7 +24,7 @@ import java.util.Date; ...@@ -24,7 +24,7 @@ import java.util.Date;
@TableName("vie_price_sum_summary") @TableName("vie_price_sum_summary")
public class PriceSumSummary implements Serializable { public class PriceSumSummary implements Serializable {
@TableId(value = "id") @TableId(value = "id",type = IdType.ASSIGN_UUID)
private String id; private String id;
/** /**
......
package com.junmp.jyzb.entity; package com.junmp.jyzb.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
...@@ -23,7 +24,7 @@ public class Reassignment implements Serializable { ...@@ -23,7 +24,7 @@ public class Reassignment implements Serializable {
/** /**
* id * id
*/ */
@TableId(value = "id",type = IdType.ASSIGN_UUID)
private String id; private String id;
/** /**
......
...@@ -28,6 +28,8 @@ import com.junmp.v2.message.api.bean.req.MessageSendReq; ...@@ -28,6 +28,8 @@ import com.junmp.v2.message.api.bean.req.MessageSendReq;
import com.junmp.v2.sys.api.UserServiceApi; import com.junmp.v2.sys.api.UserServiceApi;
import com.junmp.v2.sys.api.bean.user.dto.RoleUserDto; import com.junmp.v2.sys.api.bean.user.dto.RoleUserDto;
import com.junmp.v2.sys.api.bean.user.vo.QueryUserInfoVo; import com.junmp.v2.sys.api.bean.user.vo.QueryUserInfoVo;
import com.junmp.v2.sys.user.entity.SysUserOrg;
import com.junmp.v2.sys.user.service.SysUserOrgService;
import com.junmp.v2.sys.user.service.SysUserService; import com.junmp.v2.sys.user.service.SysUserService;
import org.flowable.bpmn.model.Process; import org.flowable.bpmn.model.Process;
import org.flowable.bpmn.model.UserTask; import org.flowable.bpmn.model.UserTask;
...@@ -68,6 +70,9 @@ public class CounterSignListener implements ExecutionListener { ...@@ -68,6 +70,9 @@ public class CounterSignListener implements ExecutionListener {
private OrgUserMapper orgUserMapper; private OrgUserMapper orgUserMapper;
@Resource @Resource
private ReassignmentService reassignmentService; private ReassignmentService reassignmentService;
@Resource
private SysUserOrgService sysUserOrgService;
@Override @Override
public void notify(DelegateExecution execution) { public void notify(DelegateExecution execution) {
String currentActivityId = execution.getCurrentActivityId(); String currentActivityId = execution.getCurrentActivityId();
...@@ -91,7 +96,8 @@ public class CounterSignListener implements ExecutionListener { ...@@ -91,7 +96,8 @@ public class CounterSignListener implements ExecutionListener {
} }
ApproverGroups group=currentNode.getApproverGroups().get(0); ApproverGroups group=currentNode.getApproverGroups().get(0);
String Type=group.getApproverType(); String Type=group.getApproverType();
if (Type.equals("1")||Type.equals("8"))//指定人员,不处理 // if (Type.equals("1")||Type.equals("8"))//指定人员,不处理
if (Type.equals("8"))//指定人员,不处理
{ {
List<String> assignedUser = group.getApproverIds(); List<String> assignedUser = group.getApproverIds();
...@@ -175,21 +181,58 @@ public class CounterSignListener implements ExecutionListener { ...@@ -175,21 +181,58 @@ public class CounterSignListener implements ExecutionListener {
{ {
LoginUser StartUser= LoginContext.getContext().getLoginUser(); LoginUser StartUser= LoginContext.getContext().getLoginUser();
List<UserListDTO> userList= orgUserMapper.QueryUserWithParentOrg(StartUser.getUserId().toString()); List<UserListDTO> userList= orgUserMapper.QueryUserWithParentOrg(StartUser.getUserId().toString());
List<String> Roles=group.getApproverIds();
String roleList="";
if (Roles.size()>0) { //角色不为空
//开始拼接传入的多角色
roleList = "(";
for (String role : Roles) {
roleList += role + ",";
}
roleList = roleList.substring(0, roleList.length() - 1);
roleList += ")";//至此拼接完成
}else {
throw new WorkFlowException("审核流配置不正确,无指定的组织机构!");
}
if (userList.size()<=0)//没有上级则本身已是上级 if (userList.size()<=0)//没有上级则本身已是上级
{ {
//那么我就直接照同级下的满足角色的userId
List<UserListDTO> userList1 = orgUserMapper.QueryUserByRoleId(roleList, StartUser.getUserId().toString());
for (UserListDTO userId : userList1) {
assigneeList.add(userId.getUserID());
}
assigneeList.add(StartUser.getUserId().toString()); }
else//表示他不是最上级的组织机构,还需要进行判断
{
//判断当前登录人是否在上级的userIdlist中,如果存在,则表示下一个节点的也是当前登录人所在组织机构下的userID中
boolean flag=false;
for (UserListDTO currentUser :userList) {
if (currentUser.getUserID().equals(StartUser.getUserId().toString())){
flag=true;
}
} }
else// //如果未找到则表示下一个节点是上级组织机构下的某个角色的userId
if (!flag){
List<UserListDTO> userList1=orgUserMapper.QueryUserByRoleId(roleList, userList.get(0).getUserID());
for (UserListDTO userId :userList1)
{ {
for (UserListDTO userId :userList) assigneeList.add(userId.getUserID());
}
}
else{//下一个节点的审核人和当前灯枯人是同一个组织机构
List<UserListDTO> userList1=orgUserMapper.QueryUserByRoleId(roleList, StartUser.getUserId().toString());
for (UserListDTO userId :userList1)
{ {
assigneeList.add("1"); assigneeList.add(userId.getUserID());
// assigneeList.add(userId.getUserID());
} }
} }
}
} }
else if (Type.equals("10"))//自己审批 else if (Type.equals("10"))//自己审批
......
package com.junmp.jyzb.rabbitmq; package com.junmp.jyzb.rabbitmq;
import com.alibaba.fastjson.JSON;
import com.junmp.jyzb.api.bean.query.InAndOutRecordReq.OutInLogsReq; import com.junmp.jyzb.api.bean.query.InAndOutRecordReq.OutInLogsReq;
import com.junmp.jyzb.service.LogSummaryService; import com.junmp.jyzb.service.LogSummaryService;
import com.junmp.jyzb.service.OrderMainService; import com.junmp.jyzb.service.OrderMainService;
...@@ -18,11 +19,13 @@ public class OutInLogsReceiver { ...@@ -18,11 +19,13 @@ public class OutInLogsReceiver {
@Resource @Resource
private LogSummaryService logSummaryService; private LogSummaryService logSummaryService;
@RabbitListener(queues = "11111")//监听队列名 @RabbitListener(queues = "orderResult")//监听队列名
private void a(OutInLogsReq req, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag){ private void a(String msg, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag){
try { try {
System.out.println("req = " + req); System.out.println("msg = " + msg);
OutInLogsReq req = JSON.parseObject(msg, OutInLogsReq.class);
//将消息进行消费 //将消息进行消费
Boolean result = logSummaryService.processInventoryRecords(req); Boolean result = logSummaryService.processInventoryRecords(req);
if (result){ if (result){
......
...@@ -42,7 +42,7 @@ public interface InventorySummaryService extends IService<InventorySummary> { ...@@ -42,7 +42,7 @@ public interface InventorySummaryService extends IService<InventorySummary> {
List<InventorySummary> EquipmentStatistics(InventorySumReq req); List<InventorySummary> EquipmentStatistics(InventorySumReq req);
//出入库时无单据查询库存汇总并统计更新或者记账时根据单据查询库存汇总并统计更新 //出入库时无单据查询库存汇总并统计更新或者记账时根据单据查询库存汇总并统计更新
List<InventorySummary> selectSumByItems(List<Object[]> searchCriteria); List<InventorySummary> selectSumByItems(SelectTotalNumReq req);
boolean insertToSummary(); boolean insertToSummary();
......
...@@ -108,7 +108,8 @@ public class BusFormServiceImpl extends ServiceImpl<BusFormMapper, BusForm> impl ...@@ -108,7 +108,8 @@ public class BusFormServiceImpl extends ServiceImpl<BusFormMapper, BusForm> impl
BusForm busForm = new BusForm(); BusForm busForm = new BusForm();
BeanUtil.copyProperties(req,busForm); BeanUtil.copyProperties(req,busForm);
//设置业务单的使用次数(默认是出库一次,入库一次) //设置业务单的使用次数(默认是出库一次,入库一次)
busForm.setUseCount("bothUsing"); busForm.setOrderCurrentState("bothuseing");
busForm.setOrderLastState("bothuseing");
if (ObjectUtil.isNull(req.getId())){ if (ObjectUtil.isNull(req.getId())){
String id= UUID.randomUUID().toString(); String id= UUID.randomUUID().toString();
busForm.setId(id); busForm.setId(id);
...@@ -465,6 +466,19 @@ public class BusFormServiceImpl extends ServiceImpl<BusFormMapper, BusForm> impl ...@@ -465,6 +466,19 @@ public class BusFormServiceImpl extends ServiceImpl<BusFormMapper, BusForm> impl
} }
eq.eq(ObjectUtil.isNotNull(req.getAllocateType()) && !req.getAllocateType().isEmpty(),BusForm::getAllocateType,req.getAllocateType()); eq.eq(ObjectUtil.isNotNull(req.getAllocateType()) && !req.getAllocateType().isEmpty(),BusForm::getAllocateType,req.getAllocateType());
} }
//当前单子状态
if (ObjectUtil.isNotNull(req.getOrderCurrentState())){
List<String> orderCurrentStateList=new ArrayList<>();
if (req.getOrderCurrentState().equals("incoming")){
orderCurrentStateList.add("incoming");
orderCurrentStateList.add("bothuseing");
eq.in( BusForm::getOrderCurrentState,orderCurrentStateList);
}else if (req.getOrderCurrentState().equals("outgoing")){
orderCurrentStateList.add("outgoing");
orderCurrentStateList.add("bothuseing");
eq.in( BusForm::getOrderCurrentState,orderCurrentStateList);
}
}
return eq; return eq;
} }
......
...@@ -283,7 +283,7 @@ public class EquipmentTypeServiceImpl extends ServiceImpl<EquipmentTypeMapper, E ...@@ -283,7 +283,7 @@ public class EquipmentTypeServiceImpl extends ServiceImpl<EquipmentTypeMapper, E
ElasticsearchUtil es=new ElasticsearchUtil<>(client); ElasticsearchUtil es=new ElasticsearchUtil<>(client);
// 先从ES中拿到检索数据 // 先从ES中拿到检索数据
List<EquipmentType> searchResults = es.searchEntities("type_pinyin","name",0, 50, req.getTypeName(),EquipmentType.class); List<EquipmentType> searchResults = es.searchEntities("type_pinyin","name",0, 50,req.getType(), req.getTypeName(),EquipmentType.class);
LambdaQueryWrapper<EquipmentType> wp = this.createWrapper(req); LambdaQueryWrapper<EquipmentType> wp = this.createWrapper(req);
// 获取所有组织机构数据 // 获取所有组织机构数据
List<EquipmentType> allTypes = this.list(wp); List<EquipmentType> allTypes = this.list(wp);
......
...@@ -30,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -30,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -250,8 +251,45 @@ public class InventorySummaryServiceImpl extends ServiceImpl<InventorySummaryMa ...@@ -250,8 +251,45 @@ public class InventorySummaryServiceImpl extends ServiceImpl<InventorySummaryMa
//出入库时无单据查询库存汇总并统计更新或者记账时根据单据查询库存汇总并统计更新 //出入库时无单据查询库存汇总并统计更新或者记账时根据单据查询库存汇总并统计更新
@Override @Override
public List<InventorySummary> selectSumByItems(List<Object[]> searchCriteria) { public List<InventorySummary> selectSumByItems(SelectTotalNumReq req) {
return inventorySummaryMapper.selectSumByItems(searchCriteria); List<InventorySumReq> list = req.getList();
List<Object[]> searchItem=new ArrayList<>();
for (InventorySumReq inv:list) {
Object[] item=new Object[]{inv.getOrgId(),inv.getLocationId(),inv.getTypeId(),inv.getSizeId(),inv.getUnitPrice()};
searchItem.add(item);
}
List<InventorySummary> inventorySummaryList = inventorySummaryMapper.selectSumByItems(searchItem);
//判断装备的list是否和传入的list的size是否相等,如果相等则表示所有的库存数量都能查询到,如果不相等则进行遍历将不满足要求的进行新增一条装备数量为0的库存信息进行返回给前端
if (list.size()==inventorySummaryList.size()){
return inventorySummaryList;
}else {
List<InventorySummary> returnList=new ArrayList<>();
for (InventorySumReq inv:list) {
boolean flag=false;
for (InventorySummary is:inventorySummaryList) {
if (inv.getOrgId().equals(is.getOrgId())&& inv.getLocationId().equals(is.getLocationId())
&& inv.getTypeId().equals(is.getTypeId()) && inv.getSizeId().equals(is.getTypeId())
&& is.getUnitPrice().compareTo(new BigDecimal(inv.getUnitPrice()))==0){
flag=true;
returnList.add(is);
break;
}
}
if (!flag){
InventorySummary inventorySummary = new InventorySummary();
BeanPlusUtil.copyProperties(inv,inventorySummary);
inventorySummary.setStockNumber(0);
inventorySummary.setOutboundNumber(0);
inventorySummary.setPrice(BigDecimal.ZERO);
inventorySummary.setBrokenNumber(0);
inventorySummary.setDestructionNumber(0);
returnList.add(inventorySummary);
}
}
return returnList;
}
} }
@Override @Override
......
...@@ -2,6 +2,8 @@ package com.junmp.jyzb.service.impl; ...@@ -2,6 +2,8 @@ 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.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.jyzb.api.bean.dto.InventorySumDto; import com.junmp.jyzb.api.bean.dto.InventorySumDto;
...@@ -22,8 +24,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -22,8 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -83,32 +84,22 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm ...@@ -83,32 +84,22 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
} }
//本地主机返回出入库结果 //本地主机返回出入库结果
@Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean processInventoryRecords(OutInLogsReq req) { public Boolean processInventoryRecords(OutInLogsReq req) {
//1.判断业务类型,如果是采购,更新装备库存表
boolean a=false; //1.判断是否有单据,order对象是否为空,如果不为空则进行处理
if (req.getBussinessType().equals("purchase")){ OrderReq order = req.getOrder();
List<PurchaseEqsReq> purchaseList = req.getOrderMain().getPurchaseList(); boolean a=true;
List<Inventory> collect = purchaseList.stream().map(purchaseEqsReq -> { boolean b=true;
Inventory inventory = new Inventory(); boolean c=true;
BeanPlusUtil.copyProperties(purchaseEqsReq, inventory); if (ObjectUtil.isNotNull(order)){
return inventory; List<DetailOrderReq> orderDetailList = order.getOrderDetail();
}).collect(Collectors.toList());
a=inventoryService.saveBatch(collect);
}
//2.如果有单据,更新单据
boolean b=false;
boolean c=false;
if (ObjectUtil.isNotNull(req.getOrderMain())){
OrderReq orderMain = req.getOrderMain();
List<DetailOrderReq> orderDetailList = orderMain.getOrderDetail();
OrderMain one = orderMainService.getOne(new LambdaQueryWrapper<OrderMain>() OrderMain one = orderMainService.getOne(new LambdaQueryWrapper<OrderMain>()
.eq(OrderMain::getId, orderMain.getId())); .eq(OrderMain::getId, order.getId()));
one.setPrice(orderMain.getPrice()); one.setPrice(order.getPrice());
one.setActualQuantity(orderMain.getActualQuantity()); one.setActualQuantity(order.getActualQuantity());
one.setOrderState(one.getOrderState()); one.setOrderState(one.getOrderState());
b=orderMainService.updateById(one); a=orderMainService.updateById(one);
List<OrderDetail> collect = orderDetailList.stream().map(detailOrderReq -> { List<OrderDetail> collect = orderDetailList.stream().map(detailOrderReq -> {
OrderDetail orderDetail = new OrderDetail(); OrderDetail orderDetail = new OrderDetail();
BeanPlusUtil.copyProperties(detailOrderReq, orderDetail); BeanPlusUtil.copyProperties(detailOrderReq, orderDetail);
...@@ -116,23 +107,194 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm ...@@ -116,23 +107,194 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
orderDetail.setModifyQuantity(detailOrderReq.getActualNum()); orderDetail.setModifyQuantity(detailOrderReq.getActualNum());
return orderDetail; return orderDetail;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
c=orderDetailService.updateBatchById(collect); b=orderDetailService.updateBatchById(collect);
//2.判断业务类型,如果是采购,更新装备库存表
if (order.getBussinessType().equals("purchase")){
List<PurchaseEqsReq> purchaseList = order.getPurchaseList();
List<Inventory> collect1 = purchaseList.stream().map(purchaseEqsReq -> {
Inventory inventory = new Inventory();
BeanPlusUtil.copyProperties(purchaseEqsReq, inventory);
inventory.setId(UUID.randomUUID().toString());
inventory.setCreateTime(DateTimeUtil.getCurrentDateTime());
inventory.setState("normal");
inventory.setLocationState("in");
inventory.setBussinessState("normal");
inventory.setLocationType(0);
inventory.setOrgId(order.getOrgId());
return inventory;
}).collect(Collectors.toList());
c=inventoryService.saveBatch(collect1);
}
}
//3.处理出入库记录对象
//判断出入库记录是否为空
List<NormalInOutDto> normalInOutDtos=new ArrayList<>();
if(ObjectUtil.isNotNull(req.getLogList()) && req.getLogList().size()>0){
normalInOutDtos = saveInOutRecords(req);
}
//4.对正常出入库记录进行装备汇总统计
boolean d=true;
if (normalInOutDtos.size()>0){
String outInState = normalInOutDtos.get(0).getOutInState();
d = updateNumToSum(outInState, normalInOutDtos);
}
return a && b && c && d;
}
// 对出入库记录进行分类汇总存储()
public List<NormalInOutDto> saveInOutRecords(OutInLogsReq req) {
//返回结果,用于日常出入库时计算更新库存汇总表
List<SummaryLogReq> logSummaryList = req.getLogList();
//遍历logSummaryList查询出没有单据的作为日常出入库,并再次存放到list中,后面用于进行修改库存汇总
//返回returnList结果,用于日常出入库时计算更新库存汇总表
List<NormalInOutDto> returnList=new ArrayList<>();
//存一个list用于修改库存inventory表的数据(采购时那么这个inventoryList就为空)
List<Inventory> inventoryList=new ArrayList<>();
for (SummaryLogReq logreq:logSummaryList) {
//如果类型为normal,那么则表示作为日常出入库的记录,否则则作为单据的出入库记录
List<DetailLogReq> logList = logreq.getLogDetailList();
//出入库list
List<LogDetail> collect = new ArrayList<>();
LogSummary logSummary = saveLogSummary(logreq);
logSummaryService.save(logSummary);
Map<String, String> map = setState(logreq.getOutInState(), logreq.getBussinessType());
//无单据的时候
for (DetailLogReq detailLogReq : logList) {
//将所有装备信息进行存放(为后面计算汇总信息)
if (logreq.getBussinessType().equals("normal")) {
NormalInOutDto normalInOutDto = new NormalInOutDto();
BeanPlusUtil.copyProperties(detailLogReq, normalInOutDto);
normalInOutDto.setLocationId(logSummary.getLocationId());
normalInOutDto.setLocationName(logSummary.getLocationName());
normalInOutDto.setOrgId(logSummary.getOrgId());
normalInOutDto.setOrgName(logSummary.getOrgName());
normalInOutDto.setNumber(1);
returnList.add(normalInOutDto);
}
//判断logSummary是否为采购,
//如果是采购则不处理,因为采购的inventory是跟着单子来处理的,其他的单子直接根据出入库记录来处理
if (!logreq.getBussinessType().equals("purchase")){
if (logreq.getOutInState().equals("in")){
Inventory inventory = saveInventory(detailLogReq, map, logSummary.getOutInState());
inventoryList.add(inventory);
}else {
Inventory inventory = saveInventory(detailLogReq, map, logSummary.getOutInState());
inventoryList.add(inventory);
}
} }
//存放logdetail信息
LogDetail logDetail = new LogDetail();
BeanPlusUtil.copyProperties(detailLogReq, logDetail);
logDetail.setSummaryId(logSummary.getId());
logDetail.setCreateTime(DateTimeUtil.getCurrentDateTime());
logDetail.setBussinessType(logreq.getBussinessType());
logDetail.setOutInState(logreq.getOutInState());
collect.add(logDetail);
}
boolean b = logDetailService.saveBatch(collect);
//3.对出入库记录进行存储 }
List<NormalInOutDto> inventorySumDtos = saveInOutRecords(req); //修改inventory表中的数据(如果不为空则表示不是采购单或者已经将采购单的信息过滤掉)
if (inventoryList.size()>0){
LambdaUpdateWrapper<Inventory> updateStateWrapper = Wrappers.lambdaUpdate();
for (Inventory inventory:inventoryList) {
updateStateWrapper.or().eq(Inventory::getId,inventory.getId())
.set(Inventory::getLocationState,inventory.getLocationState())
.set(Inventory::getBussinessState,inventory.getBussinessState())
.set(Inventory::getState,inventory.getState());
}
inventoryService.update(updateStateWrapper);
}
//4.如果没有单据当作日常出入库或者采购时,需要对库存汇总表进行更新 return returnList;
boolean d=false;
if (req.getBussinessType().equals("normal")|| req.getBussinessType().equals("purchase")){
//获取到组织机构和仓库,将出入库的装备进行分组统计,并且对inventorysummary进行更新操作
d = updateNumToSum(req.getOutInState(), inventorySumDtos, req.getOutInState());
} }
return (a && b && c && d); // 创建logsummary
private LogSummary saveLogSummary(SummaryLogReq req){
LogSummary logSummary = new LogSummary();
BeanPlusUtil.copyProperties(req,logSummary);
logSummary.setOutInState(req.getOutInState());
logSummary.setCreateTime(DateTimeUtil.getCurrentDateTime());
logSummary.setUpdateTime(DateTimeUtil.getCurrentDateTime());
logSummary.setBussinessType(req.getBussinessType());
logSummary.setOrgId(req.getOrgId());
logSummary.setOrgName(req.getOrgName());
return logSummary;
} }
//对库存汇总表进行更新(只限于日常出入库) private Inventory saveInventory(DetailLogReq req,Map<String, String> map,String outInState){
public boolean updateNumToSum(String outInState,List<NormalInOutDto> inventorySumDtos,String OutInState) { Inventory inventory = new Inventory();
BeanPlusUtil.copyProperties(req,inventory);
inventory.setId(req.getInventoryId());
inventory.setLocationState(outInState);
inventory.setState(map.get("state"));
inventory.setBussinessState(map.get("bussinessType"));
return inventory;
}
private Map<String,String> setState(String outInState,String bussinessType){
Map<String,String> map=new HashMap<>();
String state="";
String bussinessState="";
if (outInState.equals("in")){
switch (bussinessType){
case "return":
case "gift":
case "other":
state="normal";
bussinessState="normal";
break;
case "allocate":
state="normal";
bussinessState="allocate";
break;
case "repair":
state="normal";
bussinessState="repair";
break;
}
}else {
switch (bussinessType){
case "use":
state="normal";
bussinessState="use";
break;
case "allocate":
state="normal";
bussinessState="allocate";
break;
case "repair":
state="fix";
bussinessState="repair";
break;
case "destruction":
state="destory";
bussinessState="destruction";
break;
case "other":
state="normal";
bussinessState="normal";
break;
}
}
map.put("state",state);
map.put("bussinessState",bussinessState);
return map;
}
// 对库存汇总表进行更新(只限于日常出入库)
public boolean updateNumToSum(String outInState,List<NormalInOutDto> inventorySumDtos) {
List<NormalInOutDto> groupedResult = inventorySumDtos.stream() List<NormalInOutDto> groupedResult = inventorySumDtos.stream()
.collect(Collectors.groupingBy(dto -> dto.getOrgId() + "_" + dto.getLocationId() + "_" + .collect(Collectors.groupingBy(dto -> dto.getOrgId() + "_" + dto.getLocationId() + "_" +
...@@ -211,78 +373,6 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm ...@@ -211,78 +373,6 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
return a; return a;
} }
//对出入库记录进行存储
public List<NormalInOutDto> saveInOutRecords(OutInLogsReq req) {
//返回结果,用于日常出入库时计算更新库存汇总表
List<NormalInOutDto> returnList=new ArrayList<>();
List<LogDetail> logDetailList=new ArrayList<>();
List<SummaryLogReq> logSummaryList = req.getLogSummaryList();
//如果是日常出入库,那么将这些出入库数据进行计算,最终更新库存汇总表中的数据
if (req.getBussinessType().equals("normal")){
for (SummaryLogReq summaryLogReq:logSummaryList) {
LogSummary logSummary = new LogSummary();
BeanPlusUtil.copyProperties(summaryLogReq,logSummary);
logSummary.setOutInState(req.getOutInState());
logSummary.setCreateTime(DateTimeUtil.getCurrentDateTime());
logSummary.setUpdateTime(DateTimeUtil.getCurrentDateTime());
logSummary.setBussinessType(req.getBussinessType());
logSummary.setOrgId(req.getOrgId());
logSummary.setOrgName(req.getOrgName());
logSummaryService.save(logSummary);
List<DetailLogReq> logList = summaryLogReq.getLogDetailList();
//出入库list
List<LogDetail> collect=new ArrayList<>();
//用于装备汇总list
List<NormalInOutDto> list=new ArrayList<>();
for (DetailLogReq detailLogReq: logList) {
//将所有装备信息进行存放(为后面计算汇总信息)
NormalInOutDto normalInOutDto = new NormalInOutDto();
BeanPlusUtil.copyProperties(detailLogReq,normalInOutDto);
normalInOutDto.setLocationId(logSummary.getLocationId());
normalInOutDto.setLocationName(logSummary.getLocationName());
normalInOutDto.setOrgId(logSummary.getOrgId());
normalInOutDto.setOrgName(logSummary.getOrgName());
normalInOutDto.setNumber(1);
list.add(normalInOutDto);
//存放logdetail信息
LogDetail logDetail = new LogDetail();
BeanPlusUtil.copyProperties(detailLogReq, logDetail);
logDetail.setSummaryId(logSummary.getId());
collect.add(logDetail);
}
logDetailList.addAll(collect);
returnList.addAll(list);
}
logDetailService.saveBatch(logDetailList);
return returnList;
}else {
//外层的logSummary只能逐个进行插入,logDetail可以批量进行插入
for (SummaryLogReq summaryLogReq:logSummaryList) {
LogSummary logSummary = new LogSummary();
BeanPlusUtil.copyProperties(summaryLogReq,logSummary);
logSummary.setOutInState(req.getOutInState());
logSummary.setCreateTime(DateTimeUtil.getCurrentDateTime());
logSummary.setUpdateTime(DateTimeUtil.getCurrentDateTime());
logSummary.setBussinessType(req.getBussinessType());
logSummary.setOrgId(req.getOrgId());
logSummary.setOrgName(req.getOrgName());
logSummaryService.save(logSummary);
List<LogDetail> collect = summaryLogReq.getLogDetailList().stream().map(detailLogReq -> {
LogDetail logDetail = new LogDetail();
NormalInOutDto inventorySumDto = new NormalInOutDto();
BeanPlusUtil.copyProperties(detailLogReq,inventorySumDto);
BeanPlusUtil.copyProperties(detailLogReq, logDetail);
logDetail.setSummaryId(logSummary.getId());
return logDetail;
}).collect(Collectors.toList());
logDetailList.addAll(collect);
}
logDetailService.saveBatch(logDetailList);
return returnList;
}
}
} }
......
...@@ -18,6 +18,7 @@ import com.junmp.jyzb.api.bean.vo.InOrderInfo; ...@@ -18,6 +18,7 @@ import com.junmp.jyzb.api.bean.vo.InOrderInfo;
import com.junmp.jyzb.api.exception.enums.CabinetExceptionEnum; import com.junmp.jyzb.api.exception.enums.CabinetExceptionEnum;
import com.junmp.jyzb.api.exception.enums.OrderExceptionEnum; import com.junmp.jyzb.api.exception.enums.OrderExceptionEnum;
import com.junmp.jyzb.entity.*; import com.junmp.jyzb.entity.*;
import com.junmp.jyzb.mapper.InventorySummaryMapper;
import com.junmp.jyzb.mapper.OrderMainMapper; import com.junmp.jyzb.mapper.OrderMainMapper;
import com.junmp.jyzb.service.*; import com.junmp.jyzb.service.*;
import com.junmp.jyzb.utils.DateTimeUtil; import com.junmp.jyzb.utils.DateTimeUtil;
...@@ -111,6 +112,10 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -111,6 +112,10 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
@Resource @Resource
protected TaskService taskService; protected TaskService taskService;
@Resource
private InventorySummaryMapper inventorySummaryMapper;
@Autowired @Autowired
private RabbitMQSendMsg MQ; private RabbitMQSendMsg MQ;
...@@ -118,6 +123,72 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -118,6 +123,72 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public List<String> AddOrder(UpdateOrderReq req) { public List<String> AddOrder(UpdateOrderReq req) {
//修改单据使用次数状态,判断数据库是否有该单据,如果有,那么就判断当前单号是否一致,如果不一致,修改单据使用次数
Long orgId;
if (ObjectUtil.isNotNull(req.getId())){
OrderMain one = orderMainExist(req.getId());
if (ObjectUtil.isNotNull(one.getBussinessCode()) && ObjectUtil.isNotNull(one.getBussinessCode())) {
if (!one.getBussinessCode().equals(req.getBussinessCode())) {
if (req.getOrderType().equals("in")) {
orgId = req.getEndOrgId();
} else {
orgId = Long.parseLong(req.getStartOrgId());
}
//入参
BusForm one1 = setState1(orgId, req.getBussinessCode());
busFormService.updateById(one1);
//库存
BusForm one2 = setState2(orgId, one.getBussinessCode());
busFormService.updateById(one2);
}
}
//入参不为空,库里为空
else if (ObjectUtil.isNotNull(one.getBussinessCode()) && ObjectUtil.isNull(one.getBussinessCode())){
//只需要改一条数据
if (req.getOrderType().equals("in")){
orgId=req.getEndOrgId();
}else {
orgId=Long.parseLong(req.getStartOrgId());
}
//入参
BusForm one1 = setState1(orgId, req.getBussinessCode());
busFormService.updateById(one1);
}
//入参为空,库里不为空
else if (ObjectUtil.isNull(one.getBussinessCode()) && ObjectUtil.isNotNull(one.getBussinessCode())){
//只需要改一条数据
if (req.getOrderType().equals("in")){
orgId=req.getEndOrgId();
}else {
orgId=Long.parseLong(req.getStartOrgId());
}
//库存
BusForm one2 = setState2(orgId, one.getBussinessCode());
busFormService.updateById(one2);
}
}else {
if (ObjectUtil.isNotNull(req.getBussinessCode())){
//只需要更改一条单据
//只需要改一条数据
if (req.getOrderType().equals("in")){
orgId=req.getEndOrgId();
}else {
orgId=Long.parseLong(req.getStartOrgId());
}
//入参
BusForm one1 = setState1(orgId, req.getBussinessCode());
busFormService.updateById(one1);
}
}
//判断是否有工作流id,如果有则将状态进行修改 //判断是否有工作流id,如果有则将状态进行修改
if (ObjectUtil.isEmpty(req.getProcessDefinitionId())) { if (ObjectUtil.isEmpty(req.getProcessDefinitionId())) {
req.setExamineState("none"); req.setExamineState("none");
...@@ -214,9 +285,51 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -214,9 +285,51 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
for (OrderDetail orderDetail:detailList) { for (OrderDetail orderDetail:detailList) {
list.add(Long.toString(orderDetail.getId())); list.add(Long.toString(orderDetail.getId()));
} }
return list; return list;
} }
private BusForm setState2(Long orgId,String bussinessCode){
BusForm busform = busFormService.getOne(new LambdaQueryWrapper<BusForm>()
.eq(BusForm::getOrgId, orgId)
.in(BusForm::getBussinessCode, bussinessCode));
busform.setOrderCurrentState(busform.getOrderLastState());
switch (busform.getOrderCurrentState()){
case "none":
busform.setOrderCurrentState("outgoing");
break;
case "incoming":
busform.setOrderCurrentState("bothuseing");
break;
case "outgoing":
busform.setOrderCurrentState("bothuseing");
break;
}
return busform;
}
private BusForm setState1(Long orgId,String bussinessCode){
BusForm busform = busFormService.getOne(new LambdaQueryWrapper<BusForm>()
.eq(BusForm::getOrgId, orgId)
.in(BusForm::getBussinessCode, bussinessCode));
busform.setOrderCurrentState(busform.getOrderLastState());
switch (busform.getOrderCurrentState()){
case "bothuseing":
busform.setOrderCurrentState("outgoing");
break;
case "incoming":
busform.setOrderCurrentState("forbidden");
break;
case "outgoing":
busform.setOrderCurrentState("forbidden");
break;
}
return busform;
}
//设置单据单号(并且对order_num表进行新增或者更新) //设置单据单号(并且对order_num表进行新增或者更新)
public OrderNum setOrderCode(UpdateOrderReq req){ public OrderNum setOrderCode(UpdateOrderReq req){
...@@ -289,6 +402,9 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -289,6 +402,9 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
req.setDetailList(collect); req.setDetailList(collect);
} }
//单据类型,分发单据
req.setApi("DistributeOrder");
//将完成的任务单直接推送到消息队列rabbitmq中(需要判断是入库单还是出库单,入库单传发物单位id,出库单传收物单位id) //将完成的任务单直接推送到消息队列rabbitmq中(需要判断是入库单还是出库单,入库单传发物单位id,出库单传收物单位id)
//方法2:一个交换机,多个队列。动态创建队列 //方法2:一个交换机,多个队列。动态创建队列
String exchangeName="orderExchange"; String exchangeName="orderExchange";
...@@ -414,15 +530,8 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -414,15 +530,8 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
List<OrderDetailDto> orderDetailDtoList=new ArrayList<>(); List<OrderDetailDto> orderDetailDtoList=new ArrayList<>();
for (OrderDetail orderDetail:list) { for (OrderDetail orderDetail:list) {
OrderDetailDto orderDetailDto = new OrderDetailDto(); OrderDetailDto orderDetailDto = new OrderDetailDto();
BeanPlusUtil.copyProperties(orderDetail,orderDetailDto); BeanPlusUtil.copyProperties(orderDetail,orderDetailDto);
// if (orderMain.getOrderType().equals("out")){
// InventorySummary one = inventorySummaryService.getOne(new LambdaQueryWrapper<InventorySummary>()
// .eq(InventorySummary::getLocationId, orderDetail.getWarehouseId())
// .eq(InventorySummary::getSizeId, orderDetail.getSizeId())
// .eq(InventorySummary::getTypeId, orderDetail.getTypeId())
// .eq(InventorySummary::getUnitPrice, orderDetail.getPrice()));
// orderDetailDto.setStockNumber(one.getStockNumber());
// }
orderDetailDtoList.add(orderDetailDto); orderDetailDtoList.add(orderDetailDto);
} }
orderDto.setDetailList(orderDetailDtoList); orderDto.setDetailList(orderDetailDtoList);
...@@ -611,7 +720,7 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -611,7 +720,7 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
Object[] criteria=new Object[]{orgId,upReq.getWarehouseId(),upReq.getTypeId(),upReq.getSizeId(),upReq.getPrice()}; Object[] criteria=new Object[]{orgId,upReq.getWarehouseId(),upReq.getTypeId(),upReq.getSizeId(),upReq.getPrice()};
searchCriteria.add(criteria); searchCriteria.add(criteria);
} }
List<InventorySummary> inventorySummaryList = inventorySummaryService.selectSumByItems(searchCriteria); List<InventorySummary> inventorySummaryList = inventorySummaryMapper.selectSumByItems(searchCriteria);
List<InventorySummary> addList=new ArrayList<>(); List<InventorySummary> addList=new ArrayList<>();
List<InventorySummary> updateList=new ArrayList<>(); List<InventorySummary> updateList=new ArrayList<>();
for (UpdateOrderDetailReq upReq: orderDetailReqList) { for (UpdateOrderDetailReq upReq: orderDetailReqList) {
...@@ -908,9 +1017,9 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -908,9 +1017,9 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
//将summary汇总表中数据进行修改(修改该组织机构下的装备汇总信息将库存信息的在库数,库存总数,总价还有其他数据数量进行修改) //将summary汇总表中数据进行修改(修改该组织机构下的装备汇总信息将库存信息的在库数,库存总数,总价还有其他数据数量进行修改)
//那么首先将原来的仓库下的装备汇总信息进行查询出来,对其进行修改 //那么首先将原来的仓库下的装备汇总信息进行查询出来,对其进行修改
List<InventorySummary> oldSummaryList = inventorySummaryService.selectSumByItems(searchCriteria); List<InventorySummary> oldSummaryList = inventorySummaryMapper.selectSumByItems(searchCriteria);
//其次查询出修改后的仓库下面的汇总信息,判断该仓库下是否已经存在该号型、类型、单价相同的装备数据 //其次查询出修改后的仓库下面的汇总信息,判断该仓库下是否已经存在该号型、类型、单价相同的装备数据
List<InventorySummary> newSummaryList = inventorySummaryService.selectSumByItems(updateCriteria); List<InventorySummary> newSummaryList = inventorySummaryMapper.selectSumByItems(updateCriteria);
//第一步:判断是否将报废区的数据也同样进行移库(flag=true表示将报废区的数量进行一起移动) //第一步:判断是否将报废区的数据也同样进行移库(flag=true表示将报废区的数量进行一起移动)
boolean flag = oldSummaryList.stream() boolean flag = oldSummaryList.stream()
.filter(oldsum -> oldsum.getBrokenNumber() > 0) .filter(oldsum -> oldsum.getBrokenNumber() > 0)
......
...@@ -626,42 +626,39 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -626,42 +626,39 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean PoliceBindBox(PolicemanReq req) { public boolean PoliceBindBox(PolicemanReq req) {
Policeman policeman = PoliceExist(req.getId()); Policeman policeman = PoliceExist(req.getId());
//判断箱子是否存在
Cabinet cabinet=new Cabinet();
//判断该警员是否是调入的警员,如果是调入警员,那么查询log表中是否有记录,如果有记录表示他携带装备
List<OrderLog> list = orderLogService.list(new LambdaQueryWrapper<OrderLog>()
.eq(OrderLog::getOrgId, req.getOrgId())
.eq(OrderLog::getOrderType, policeman.getName() + policeman.getPoliceCode())
.orderByDesc(OrderLog::getCreateTime));
List<PoliceEquipment> policeEqsList = policeEquipmentService.list(new LambdaQueryWrapper<PoliceEquipment>()
.eq(PoliceEquipment::getPoliceId, policeman.getId()));
String locationId = policeEqsList.get(0).getLocationId();
OrderLog orderLog=new OrderLog();
if (list.size()>0){
orderLog= list.get(0);
}
List<Object[]> searchItem=new ArrayList<>();
//判断调岗警员是否已经绑定了箱门
List<CabinetBoxPolice> list1 = cabinetBoxPoliceService.list(new LambdaQueryWrapper<CabinetBoxPolice>()
.eq(CabinetBoxPolice::getPoliceId, policeman.getId()));
//判断箱门是否存在 //判断箱门是否存在
boolean a=true; boolean result=true;
//判断是否需要添加汇总信息标识
boolean flag=false;
if (req.getBoxList().size()>0){ if (req.getBoxList().size()>0){
// List<String> cabinetIdList=new ArrayList<>();
// for (CabinetBoxReq cabinetBoxReq:req.getBoxList()) {
// if (cabinetIdList.size()==0){
// cabinetIdList.add(cabinetBoxReq.getCabinetId());
// }
// if (!cabinetIdList.contains(cabinetBoxReq.getCabinetId())){
// cabinetIdList.add(cabinetBoxReq.getCabinetId());
// }
// }
// List<Cabinet> list1 = cabinetService.list(new LambdaQueryWrapper<Cabinet>()
// .in(Cabinet::getId, cabinetIdList)
// .eq(Cabinet::getOrgIdInt, req.getOrgId()));
//
//
// List<String> collect1 = req.getBoxList().stream()
// .map(CabinetBoxReq::getId)
// .collect(Collectors.toList());
// List<CabinetBox> list = cabinetBoxService.list(new LambdaQueryWrapper<CabinetBox>()
// .notIn(CabinetBox::getId, collect1));
// if (list.size()>0){
// List<String> collect = list.stream()
// .map(CabinetBox::getId)
// .collect(Collectors.toList());
// String msg="以下箱门号不存在:" +String.join(",", collect);
// throw new JYZBAppException(CabinetBoxExceptionEnum.BOXS_ISNOT_EXISTS, msg);
// }
//根据警员id和箱门id绑定公共柜 //根据警员id和箱门id绑定公共柜
List<CabinetBoxPolice> cabinetBoxPoliceList=new ArrayList<>(); List<CabinetBoxPolice> cabinetBoxPoliceList=new ArrayList<>();
List<CabinetBoxReq> boxList = req.getBoxList(); List<CabinetBoxReq> boxList = req.getBoxList();
//将箱门全部清除 //将箱门全部清除
cabinetBoxPoliceService.remove(new LambdaQueryWrapper<CabinetBoxPolice>().eq(CabinetBoxPolice::getPoliceId, req.getId())); cabinetBoxPoliceService.remove(new LambdaQueryWrapper<CabinetBoxPolice>().eq(CabinetBoxPolice::getPoliceId, req.getId()));
//公共柜和单警柜一起批量绑定
for (CabinetBoxReq boxReq:boxList ) { for (CabinetBoxReq boxReq:boxList ) {
CabinetBoxPolice cabinetBoxPolice = new CabinetBoxPolice(); CabinetBoxPolice cabinetBoxPolice = new CabinetBoxPolice();
cabinetBoxPolice.setPoliceId(req.getId()); cabinetBoxPolice.setPoliceId(req.getId());
...@@ -672,19 +669,116 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -672,19 +669,116 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
cabinetBoxPolice.setNum(boxReq.getNum()); cabinetBoxPolice.setNum(boxReq.getNum());
cabinetBoxPolice.setContainType(boxReq.getContainType()); cabinetBoxPolice.setContainType(boxReq.getContainType());
cabinetBoxPoliceList.add(cabinetBoxPolice); cabinetBoxPoliceList.add(cabinetBoxPolice);
//调岗警员绑定第一个单警柜以后,不管之后他是否还有单警柜,我都默认是不绑了。
// 判断他下面是否有箱门,如果有则表示他已经帮过单警柜并且调岗携带的装备都已经记录过,那么将不再被记录
if (boxReq.getContainType()==1 && ObjectUtil.isNotNull(orderLog) && list1.size()==0 && !flag && ObjectUtil.isNotNull(locationId)){
flag=true;
cabinet = cabinetService.getById(boxReq.getCabinetId());
for (PoliceEquipment equipment:policeEqsList) {
equipment.setLocationId(boxReq.getCabinetId());
equipment.setOrgId(req.getOrgId());
Object[] item=new Object[]{req.getOrgId(),boxReq.getCabinetId(),equipment.getTypeId(),equipment.getSizeId(),equipment.getPrice()};
searchItem.add(item);
}
policeEquipmentService.updateBatchById(policeEqsList);
}
} }
if (cabinetBoxPoliceList.size()>0){ if (cabinetBoxPoliceList.size()>0){
a= cabinetBoxPoliceService.saveBatch(cabinetBoxPoliceList); result = cabinetBoxPoliceService.saveBatch(cabinetBoxPoliceList);
} }
}else { }else {
a= cabinetBoxPoliceService.remove(new LambdaQueryWrapper<CabinetBoxPolice>().eq(CabinetBoxPolice::getPoliceId, req.getId())); result = cabinetBoxPoliceService.remove(new LambdaQueryWrapper<CabinetBoxPolice>().eq(CabinetBoxPolice::getPoliceId, req.getId()));
} }
return a; //判断summary表中是否有该警员的数据,如果有,summary表直接更新数据,如果summary表没有,那么直接新增一条数据
if (flag){
boolean b = updateSumDataAndLog(req.getOrgId(), cabinet, policeEqsList, searchItem);
}
return result;
} }
//添加调岗第一次调入人员绑定箱门时修改装备汇总表的信息以及记录日志
private boolean updateSumDataAndLog(Long orgId,Cabinet cabinet,List<PoliceEquipment> policeEqsList,List<Object[]> searchItem){
PubOrg pubOrg = pubOrgService.PubOrgExist(orgId);
StringBuilder stringBuilder = new StringBuilder();
//将警员调岗携带的装备进行查询出来,并对summary表进行计算
List<InventorySummary> inventorySummaryList = inventorySummaryMapper.selectSumByItems(searchItem);
List<InventorySummary> addSumList=new ArrayList<>();
if (inventorySummaryList.size()>0){
for (PoliceEquipment equipment:policeEqsList) {
boolean a=false;
//找到库存汇总
for (InventorySummary is:inventorySummaryList) {
if (equipment.getTypeId().equals(is.getTypeId())
&& equipment.getSizeId().equals(is.getSizeId())
&& equipment.getPrice().compareTo(is.getUnitPrice())==0){
a=true;
Integer totalNum=is.getNumber()+equipment.getNum();
stringBuilder.append("将"+cabinet.getName()+"下的"+equipment.getTypeName()+equipment.getSizeName()+"装备的在库数量数量从"+is.getStockNumber()+"改成"+totalNum+",并且修改了价格和总数;");
is.setNumber(totalNum);
is.setPrice(is.getPrice().add(equipment.getPrice().multiply(BigDecimal.valueOf(equipment.getNum()))));
is.setStockNumber(is.getStockNumber()+equipment.getNum());
break;
}
}
//没找到,直接新增
if (!a){
stringBuilder.append("新增装备"+equipment.getTypeName()+equipment.getSizeName()+",在库数为"+equipment.getNum()+",并且修改了价格和总数;");
InventorySummary inventorySummary = getInventorySummary(pubOrg, equipment, cabinet);
addSumList.add(inventorySummary);
}
}
}else {
for (PoliceEquipment equipment:policeEqsList) {
stringBuilder.append("新增装备"+equipment.getTypeName()+equipment.getSizeName()+",在库数为"+equipment.getNum()+",并且修改了价格和总数;");
InventorySummary inventorySummary = getInventorySummary(pubOrg, equipment, cabinet);
addSumList.add(inventorySummary);
}
}
boolean a=true;
if (addSumList.size()>0){
a=inventorySummaryService.saveBatch(addSumList);
}
boolean b=true;
if (inventorySummaryList.size()>0){
b=inventorySummaryService.updateBatchById(inventorySummaryList);
}
//记录日志
OrderLog orderLog1 = new OrderLog();
orderLog1.setBussinessType("调入警员修改库存汇总");
orderLog1.setHistoryMsg(stringBuilder.toString());
orderLog1.setOrgId(pubOrg.getOrgId());
orderLog1.setOrgName(pubOrg.getOrgName());
orderLog1.setCreateTime(DateTimeUtil.getCurrentDateTime());
boolean c = orderLogService.save(orderLog1);
return a && b && c;
}
private InventorySummary getInventorySummary(PubOrg pubOrg, PoliceEquipment equipment, Cabinet cabinet) {
InventorySummary inventorySummary = new InventorySummary();
inventorySummary.setValuekey(pubOrg.getOrgCode() + equipment.getSizeId());
inventorySummary.setOrgId(pubOrg.getOrgId());
inventorySummary.setOrgName(pubOrg.getOrgName());
inventorySummary.setOrgCode(pubOrg.getOrgCode());
inventorySummary.setTypeId(equipment.getTypeName());
inventorySummary.setTypeName(equipment.getTypeName());
inventorySummary.setSizeId(equipment.getSizeId());
inventorySummary.setSizeName(equipment.getSizeName());
inventorySummary.setLocationType("0");
inventorySummary.setLocationId(cabinet.getId());
inventorySummary.setLocationName(cabinet.getName());
inventorySummary.setNumber(equipment.getNum());
inventorySummary.setPrice(equipment.getPrice().multiply(BigDecimal.valueOf(equipment.getNum())));
inventorySummary.setUnitPrice(equipment.getPrice());
inventorySummary.setStockNumber(equipment.getNum());
inventorySummary.setOutboundNumber(0);
inventorySummary.setCreateTime(DateTimeUtil.getCurrentDateTime());
return inventorySummary;
}
/** /**
* 通过警员id判断警员是否存在,不存在则抛出异常 * 通过警员id判断警员是否存在,不存在则抛出异常
...@@ -722,6 +816,10 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -722,6 +816,10 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
List<SysDictItem> list = sysDictItemService.list(new LambdaQueryWrapper<SysDictItem>().eq(SysDictItem::getDictId, sysDict.getDictId())); List<SysDictItem> list = sysDictItemService.list(new LambdaQueryWrapper<SysDictItem>().eq(SysDictItem::getDictId, sysDict.getDictId()));
String itemValue = list.get(0).getItemValue(); String itemValue = list.get(0).getItemValue();
String itemValue1 = list.get(1).getItemValue(); String itemValue1 = list.get(1).getItemValue();
StringBuilder stringBuilder = new StringBuilder();
Integer inventoryQuantity=0;
Integer actualQuantity=0;
List<PoliceEquipment> reqEquipments = JSON.parseArray(req.getDetailList(), PoliceEquipment.class);
//判断是调入单还是调出单 //判断是调入单还是调出单
//0是调入警员,1是调出警员 //0是调入警员,1是调出警员
if(req.getReassignmentType().equals(itemValue) && itemValue.equals("assign")){ if(req.getReassignmentType().equals(itemValue) && itemValue.equals("assign")){
...@@ -734,11 +832,9 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -734,11 +832,9 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
//将警员中的组织机构id设置 //将警员中的组织机构id设置
policeman.setOrgId(req.getOrgId()); policeman.setOrgId(req.getOrgId());
//如果调入的警员携带装备,那么我应该怎么处理呢 //如果调入的警员携带装备,那么我应该怎么处理呢
List<PoliceEquipment> reqEquipments = JSON.parseArray(req.getDetailList(), PoliceEquipment.class);
StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("警员:"+req.getPoliceName()+",警号为:"+req.getPoliceCode()+"因调岗携带以下装备:");
stringBuilder.append("警员:"+req.getPoliceName()+"因调岗携带以下装备:");
Integer inventoryQuantity=0;
Integer actualQuantity=0;
if(ObjectUtil.isNotNull(reqEquipments)){ if(ObjectUtil.isNotNull(reqEquipments)){
for (PoliceEquipment equipment:reqEquipments) { for (PoliceEquipment equipment:reqEquipments) {
stringBuilder.append("装备"+equipment.getTypeName()+","+equipment.getSizeName()+"数量为:"+equipment.getNum()+","); stringBuilder.append("装备"+equipment.getTypeName()+","+equipment.getSizeName()+"数量为:"+equipment.getNum()+",");
...@@ -746,18 +842,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -746,18 +842,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
actualQuantity+=equipment.getNum(); actualQuantity+=equipment.getNum();
} }
} }
//记录日志(如果警员携带装备,则进行记录 )
OrderLog orderLog = new OrderLog();
orderLog.setHistoryMsg(stringBuilder.toString());
orderLog.setOrgId(req.getOrgId());
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);
//(调岗调入时在配置箱门的时候进行添加装备信息) //(调岗调入时在配置箱门的时候进行添加装备信息)
}else if (req.getReassignmentType().equals(itemValue1) && itemValue1.equals("reassign")){ }else if (req.getReassignmentType().equals(itemValue1) && itemValue1.equals("reassign")){
...@@ -794,12 +879,9 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -794,12 +879,9 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
} else {//将该警员拿走的装备的组织机构设置为空,并且其他装备进行跟警员进行解绑删除 } else {//将该警员拿走的装备的组织机构设置为空,并且其他装备进行跟警员进行解绑删除
List<PoliceEquipment> removeList=new ArrayList<>(); List<PoliceEquipment> removeList=new ArrayList<>();
List<PoliceEquipment> updateList=new ArrayList<>(); List<PoliceEquipment> updateList=new ArrayList<>();
List<PoliceEquipment> reqEquipments = JSON.parseArray(req.getDetailList(), PoliceEquipment.class);
List<Object[]> searchItem=new ArrayList<>(); List<Object[]> searchItem=new ArrayList<>();
StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("原组织机构为"+req.getOrgId()+"的警员"+req.getPoliceName()+",警号为:"+req.getPoliceCode()+"因调岗拿走以下装备:");
stringBuilder.append("原组织机构为"+req.getOrgId()+"的警员"+req.getPoliceName()+"因调岗拿走以下装备:");
Integer inventoryQuantity=0;
Integer actualQuantity=0;
for (PoliceEquipment policeEquipment:list1) { for (PoliceEquipment policeEquipment:list1) {
boolean flag=false; boolean flag=false;
for (PoliceEquipment one:reqEquipments) { for (PoliceEquipment one:reqEquipments) {
...@@ -813,6 +895,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -813,6 +895,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
policeEquipment.setNum(one.getNum()); policeEquipment.setNum(one.getNum());
policeEquipment.setOrgId(null); policeEquipment.setOrgId(null);
policeEquipment.setLocationId(null); policeEquipment.setLocationId(null);
policeEquipment.setStorageLocation(null);
updateList.add(policeEquipment); updateList.add(policeEquipment);
flag=true; flag=true;
break; break;
...@@ -824,18 +907,6 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -824,18 +907,6 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
} }
policeEquipmentService.updateBatchById(updateList); policeEquipmentService.updateBatchById(updateList);
policeEquipmentService.removeBatchByIds(removeList); policeEquipmentService.removeBatchByIds(removeList);
//记录日志(如果警员拿走装备,则进行记录 )
OrderLog orderLog = new OrderLog();
orderLog.setHistoryMsg(stringBuilder.toString());
orderLog.setOrgId(req.getOrgId());
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);
//修改库存数量 //修改库存数量
List<InventorySummary> inventorySummaryList = inventorySummaryMapper.selectSumByItems(searchItem); List<InventorySummary> inventorySummaryList = inventorySummaryMapper.selectSumByItems(searchItem);
...@@ -856,6 +927,23 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -856,6 +927,23 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
} }
} }
//记录日志(如果警员携带装备,则进行记录 )
if (ObjectUtil.isNotNull(reqEquipments)){
OrderLog orderLog = new OrderLog();
orderLog.setHistoryMsg(stringBuilder.toString());
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);
}
} }
......
package com.junmp.jyzb.utils; package com.junmp.jyzb.utils;
import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
...@@ -25,7 +26,7 @@ public class ElasticsearchUtil<T> { ...@@ -25,7 +26,7 @@ public class ElasticsearchUtil<T> {
this.client = client; this.client = client;
} }
public List<T> searchEntities(String typeName,String index, Integer pageNum, Integer pageSize, String keyword, Class<T> entityClass) throws IOException { public List<T> searchEntities(String typeName,String index, Integer pageNum, Integer pageSize,Integer type, String keyword, Class<T> entityClass) throws IOException {
if (pageNum < 0) pageNum = 0; if (pageNum < 0) pageNum = 0;
SearchRequest request = new SearchRequest(typeName); SearchRequest request = new SearchRequest(typeName);
...@@ -44,6 +45,9 @@ public class ElasticsearchUtil<T> { ...@@ -44,6 +45,9 @@ public class ElasticsearchUtil<T> {
{ {
builder.postFilter(new TermQueryBuilder("delFlag", 1)); builder.postFilter(new TermQueryBuilder("delFlag", 1));
} }
if (ObjectUtil.isNotNull(type)){
builder.postFilter(new TermQueryBuilder("type",type));
}
builder.query(boolQueryBuilder); builder.query(boolQueryBuilder);
builder.timeout(new TimeValue(60, TimeUnit.SECONDS)); builder.timeout(new TimeValue(60, TimeUnit.SECONDS));
......
package com.junmp.jyzb.utils; package com.junmp.jyzb.utils;
import com.alibaba.fastjson.JSON;
import org.springframework.amqp.core.BindingBuilder; import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange; import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Exchange; import org.springframework.amqp.core.Exchange;
...@@ -22,6 +23,7 @@ public class RabbitMQSendMsg { ...@@ -22,6 +23,7 @@ public class RabbitMQSendMsg {
rabbitAdmin.declareQueue(queue); rabbitAdmin.declareQueue(queue);
rabbitAdmin.declareExchange(exchange); rabbitAdmin.declareExchange(exchange);
rabbitAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange).with(name).noargs()); rabbitAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange).with(name).noargs());
rabbitTemplate.convertAndSend(exchangeName, name, msg); String jsonString = JSON.toJSONString(msg);
rabbitTemplate.convertAndSend(exchangeName, name, jsonString);
} }
} }
...@@ -72,6 +72,9 @@ ...@@ -72,6 +72,9 @@
<if test="null != req.bussinessType and '' != req.bussinessType "> <if test="null != req.bussinessType and '' != req.bussinessType ">
and bussiness_type = #{req.bussinessType} and bussiness_type = #{req.bussinessType}
</if> </if>
<if test="null != req.typeName and '' != req.typeName ">
and inv_list like concat('%',#{req.typeName},'%')
</if>
<if test="req.startOrgId != null and req.startOrgId != ''"> <if test="req.startOrgId != null and req.startOrgId != ''">
and start_org_id = #{req.startOrgId} and start_org_id = #{req.startOrgId}
</if> </if>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论