Commit 51d8b982 by 赵剑炜

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

parents 981daf63 4e0cd685
......@@ -16,8 +16,8 @@ public class CabinetBoxDto implements Serializable {
/**
* 箱号
*/
@ApiModelProperty(value = "箱号")
private Integer num;
@ApiModelProperty(value = "箱号")
private Integer BoxNum;
/**
* 异常状态:1正常/0异常
......@@ -31,5 +31,14 @@ public class CabinetBoxDto implements Serializable {
@ApiModelProperty(value = "异常原因")
private String errorMsg;
/**
* 箱门绑定警员id
*/
private String policeId;
/**
* 箱门绑定警员名称
*/
private String policeName;
}
......@@ -23,7 +23,7 @@ public class CabinetDto implements Serializable{
/**
* 箱数
*/
@ApiModelProperty(value = "箱")
@ApiModelProperty(value = "箱门数量")
private Integer num;
/**
......@@ -36,8 +36,12 @@ public class CabinetDto implements Serializable{
* 组织机构号
*/
@ApiModelProperty(value = "组织机构号")
private String orgId;
private Long orgId;
/**
* 组织机构名称
*/
@ApiModelProperty(value = "组织机构名称")
private String orgName;
/**
* 位置信息
*/
......
......@@ -15,6 +15,7 @@ public class OrderMainReq extends BaseRequest {
@NotBlank(message = "任务单id不能为空",groups = {detail.class})
private String id;
@NotBlank(message = "业务类型不能为空",groups = {edit.class})
private String orderType;
private String processId;
......
package com.junmp.jyzb.controller;
import com.junmp.jyzb.api.bean.query.OrderMainReq;
import com.junmp.jyzb.entity.OrderLog;
import com.junmp.jyzb.service.OrderLogService;
import com.junmp.v2.common.bean.request.ValidationApi;
import com.junmp.v2.common.bean.response.ApiRes;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
......@@ -20,10 +21,10 @@ import java.util.List;
public class LogController {
@Resource
private OrderLogService orderLogService;
//查看单据日志
//查看单据日志(通过组织机构id和出入库状态)
@PostMapping("/getLogsList")
@ApiOperation("获取日志")
public ApiRes<List<OrderLog>> getLogsList(){
return ApiRes.success(orderLogService.getLogsList());
public ApiRes<List<OrderLog>> getLogsList(@RequestBody @Validated(ValidationApi.edit.class) OrderMainReq req){
return ApiRes.success(orderLogService.getLogsList(req));
}
}
package com.junmp.jyzb.service;
import com.junmp.jyzb.api.bean.query.OrderMainReq;
import com.junmp.jyzb.entity.OrderLog;
import com.baomidou.mybatisplus.extension.service.IService;
......@@ -13,5 +14,5 @@ import java.util.List;
public interface OrderLogService extends IService<OrderLog> {
List<OrderLog> getLogsList();
List<OrderLog> getLogsList(OrderMainReq req);
}
......@@ -175,21 +175,32 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
@Override
public List<CabinetDto> getAllCabinetList(CabinetReq req) {
//判断组织机构是否存在
pubOrgService.PubOrgExist(req.getOrgId());
PubOrg pubOrg = pubOrgService.PubOrgExist(req.getOrgId());
List<CabinetDto> cabinetList=new ArrayList<>();
List<CabinetBoxDto> cabinetBoxList=new ArrayList<>();
List<Cabinet> list = list(new LambdaQueryWrapper<Cabinet>().eq(Cabinet::getOrgId, req.getOrgId()));
List<Cabinet> list = list(new LambdaQueryWrapper<Cabinet>()
.eq(Cabinet::getOrgId, req.getOrgId()));
for (Cabinet cabinet:list) {
CabinetDto cabinetDto = new CabinetDto();
BeanPlusUtil.copyProperties(cabinet,cabinetDto);
List<CabinetBox> list1 = cabinetBoxService.list(new LambdaQueryWrapper<CabinetBox>()
.eq(CabinetBox::getCabinetId, cabinet.getId()));
List<CabinetBoxDto> cabinetBoxList=new ArrayList<>();
for (CabinetBox cabinetBox:list1) {
CabinetBoxDto cabinetBoxDto = new CabinetBoxDto();
BeanPlusUtil.copyProperties(cabinetBox,cabinetBoxDto);
//查询箱门绑定的警员id和姓名
List<Policeman> policeList = policemanService.list(new LambdaQueryWrapper<Policeman>()
.eq(Policeman::getCabinetBoxId, cabinetBox.getId()));
if (policeList.size()!=0){
Policeman policeman = policeList.get(0);
cabinetBoxDto.setPoliceId(policeman.getId());
cabinetBoxDto.setPoliceName(policeman.getName());
}
cabinetBoxDto.setBoxNum(cabinetBox.getNum());
cabinetBoxList.add(cabinetBoxDto);
}
cabinetDto.setCabinetBoxList(cabinetBoxList);
cabinetDto.setOrgName(pubOrg.getOrgName());
cabinetList.add(cabinetDto);
}
return cabinetList;
......
package com.junmp.jyzb.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.jyzb.api.bean.query.OrderMainReq;
import com.junmp.jyzb.api.exception.enums.CabinetExceptionEnum;
import com.junmp.jyzb.entity.OrderLog;
import com.junmp.jyzb.service.OrderLogService;
import com.junmp.jyzb.mapper.OrderLogMapper;
import com.junmp.jyzb.service.PubOrgService;
import com.junmp.v2.common.exception.base.ServiceException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
......@@ -19,9 +26,23 @@ import java.util.List;
public class OrderLogServiceImpl extends ServiceImpl<OrderLogMapper, OrderLog>
implements OrderLogService {
@Resource
private PubOrgService pubOrgService;
@Override
public List<OrderLog> getLogsList() {
public List<OrderLog> getLogsList(OrderMainReq req) {
//判断组织机构id是否传递,如果传递判断是否存在,否则抛出异常
pubOrgService.PubOrgExist(req.getOrgId());
//判断orderType业务是入库还是出库,根据出入库的不同,查询的单据也不同
if (req.getOrderType().equals("in")){
// list(new LambdaQueryWrapper<OrderLog>()
// .eq(OrderLog::get)
// .eq());
} else if (req.getOrderType().equals("out")) {
}else {
throw new ServiceException(CabinetExceptionEnum.PARAMETER_ERROR);
}
return list();
}
}
......
package com.junmp.jyzb.service.impl;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -16,6 +17,7 @@ import com.junmp.jyzb.api.exception.enums.OrderExceptionEnum;
import com.junmp.jyzb.entity.*;
import com.junmp.jyzb.mapper.OrderMainMapper;
import com.junmp.jyzb.service.OrderDetailService;
import com.junmp.jyzb.service.OrderNumService;
import com.junmp.jyzb.service.OrderService;
import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.util.BeanPlusUtil;
......@@ -25,9 +27,9 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.core.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.databind.ObjectMapper;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.*;
......@@ -37,14 +39,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain> i
@Resource
private OrderDetailService orderDetailService;
@Resource
private OrderMainMapper orderMainMapper;
@Resource
private RabbitTemplate rabbitTemplate;
@Resource
private RabbitAdmin rabbitAdmin;
@Resource
private ObjectMapper objectMapper;
@Resource
private OrderNumService orderNumService;
......@@ -53,6 +53,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain> i
public String AddOrder(UpdateOrderReq req) {
OrderMain order = new OrderMain();
BeanPlusUtil.copyProperties(req, order);
//设置单据单号
OrderNum orderNum = setOrderCode(req);
String codeValue=String.format("%04d",orderNum.getNum());
order.setOrderCode(orderNum.getBussinessType()+"-"+orderNum.getOutInType()+"-"+orderNum.getYear()+"-"+codeValue);
//保存
this.save(order);
List<OrderDetail> detailList = new ArrayList<>();
......@@ -67,10 +71,41 @@ public class OrderServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain> i
detailList.add(detail);
});
orderDetailService.saveBatch(detailList);
//设置采购单号,需要先判断改组织机构的采购单号是否存在,如果存在则将数量进行增加,如果不存在则新增一条对应的数据
return order.getId();
}
//设置单据单号(并且对order_num表进行新增或者更新)
public OrderNum setOrderCode(UpdateOrderReq req){
//设置采购单号,需要先判断改组织机构的采购单号是否存在,如果存在则将数量进行增加,如果不存在则新增一条对应的数据
OrderNum orderNum = new OrderNum();
//获取年份,获取业务出入状态,获取组织机构id,获取业务类型
orderNum.setYear(LocalDateTime.now().getYear());
//判断是出库还是入库,出库为发物单位,入库为收物单位
if (req.getOrderType().equals("in")){
orderNum.setOrgId(Long.valueOf(req.getEndOrgId()));
}else {
orderNum.setOrgId(Long.valueOf(req.getStartOrgId()));
}
//业务类型
orderNum.setBussinessType(req.getBussinessType());
//出入业务状态
orderNum.setOutInType(req.getOrderType());
OrderNum one = orderNumService.getOne(new LambdaQueryWrapper<OrderNum>()
.eq(OrderNum::getOrgId, orderNum.getOrgId())
.eq(OrderNum::getBussinessType, orderNum.getBussinessType())
.eq(OrderNum::getYear, orderNum.getYear())
.eq(OrderNum::getOutInType, orderNum.getOutInType()));
if (ObjectUtil.isNull(one)){
orderNum.setNum(1);
orderNumService.save(orderNum);
}else {
orderNum.setNum(one.getNum()+1);
orderNumService.updateById(orderNum);
}
return orderNum;
}
@Transactional(rollbackFor = Exception.class)
@Override
......
<?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="generator.mapper.OrderNumMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.entity.OrderNum">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="outInType" column="out_in_type" jdbcType="VARCHAR"/>
<result property="bussinessType" column="bussiness_type" jdbcType="VARCHAR"/>
<result property="num" column="num" jdbcType="INTEGER"/>
<result property="year" column="year" jdbcType="VARCHAR"/>
<result property="orgId" column="org_id" jdbcType="BIGINT"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,out_in_type,bussiness_type,
num,year,org_id,
update_time,create_time
</sql>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论