Commit 7952b8c4 by 李小惠

修改记账接口bug,修改报表展开数据不一致问题(不包含各页面数据统一问题),修改出入库记录信息为空bug,修改库存管理页面bug与查看详情,修改其他bug

parent 6301545b
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -117,5 +117,6 @@ public class LogDetailReq { ...@@ -117,5 +117,6 @@ public class LogDetailReq {
private String userName; private String userName;
private Long orgId; private Long orgId;
private Integer property;
} }
package com.junmp.jyzb.controller;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.junmp.jyzb.entity.Inventory;
import com.junmp.jyzb.entity.InventorySummary;
import com.junmp.jyzb.service.EquipmentTypeService;
import com.junmp.jyzb.service.InventoryService;
import com.junmp.jyzb.service.InventorySummaryService;
import com.junmp.v2.common.bean.response.ApiRes;
import com.junmp.v2.db.api.factory.PageFactory;
import com.junmp.v2.dict.entity.SysDictItem;
import com.junmp.v2.dict.service.SysDictItemService;
import com.junmp.v2.message.api.MessageApi;
import com.junmp.v2.message.api.bean.req.MessageReq;
import com.junmp.v2.message.api.bean.req.MessageSendReq;
import io.swagger.annotations.Api;
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 javax.annotation.Resource;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@RestController
@Api("消息推送")
@RequestMapping("/MessageSend")
@Slf4j
public class MessageSendController {
@Resource
private InventoryService inventoryService;
@Resource
private InventorySummaryService inventorySummaryService;
@Resource
private EquipmentTypeService equipmentTypeService;
@Resource
private MessageApi messageApi;
@Resource
private SysDictItemService sysDictItemService;
// MessageSendReq sendReq = new MessageSendReq();
// sendReq.setSendUserId("1000");
// sendReq.setReceiveUserIds(userIds);
// sendReq.setMsgTitle(msgtTitle);
// sendReq.setBizType(bizType);
// sendReq.setMsgContent(msgContent);
// sendReq.setPriority("0");
// sendReq.setSendTime(DateTime.now());
// messageApi.sendMessage(sendReq);
// messageApi.queryCount(new MessageReq());
// /*推送发送未读数量*/
// for(Long userId :userIdList){
// MessageReq req1 = new MessageReq();
// req1.setReadFlag(0);
// req1.setReceiveUserId(userId);
// Integer count1 = messageApi.queryCount(req1);
// messageApi.pushMsgToUser(String.valueOf(userId),count1);
//消息推送场景1:物资低于物资阈值
// @PostMapping("/aaa")
// public ApiRes<Boolean> action1() {
//获取装备信息汇总,并且判断装备的汇总数量是否低于装备阈值,如果低于装备阈值,则进行消息提醒
//所有待判断的物资
// LambdaQueryWrapper<InventorySummary> wrapper = new LambdaQueryWrapper<InventorySummary>()
// .eq(InventorySummary::getLocationType, 0);
// //分页参数
// int pageSize=1000;
// int currentPage=1;
// //获取装备的所有库存数量
// long termCount= inventorySummaryService.count(wrapper);
// List<InventorySummary> list=new ArrayList<>();
// if (termCount>0) {
// // 分页查询
// while ((currentPage - 1) * pageSize < termCount) {
// List<InventorySummary> inventorySummaryList = processPageData1(currentPage, pageSize);
// currentPage++;
// list.addAll(inventorySummaryList);
// }
// }
// //超期物资查询出来之后,将超期物资进行消息推送提醒
// //直接对list进行处理操作推送消息即可
// for (InventorySummary inventorySummary:list) {
// MessageSendReq sendReq = new MessageSendReq();
// sendReq.setSendUserId("1000");
// sendReq.setReceiveUserIds("1000");
// sendReq.setMsgTitle("物资低于阈值");
// //设置业务类型
// SysDictItem one = sysDictItemService.getOne(new LambdaQueryWrapper<SysDictItem>()
// .eq(SysDictItem::getDictItemId, "1698969902300176385"));
// sendReq.setBizType(one.getItemValue());
// sendReq.setMsgContent(inventorySummary.getLocationName()+"仓库下的"+inventorySummary.getTypeName()+",号型为:"+inventorySummary.getSizeName()+"的物资低于阈值");
// sendReq.setPriority("0");
// sendReq.setSendTime(DateTime.now());
// messageApi.sendMessage(sendReq);
// }
// messageApi.queryCount(new MessageReq());
// /*推送发送未读数量*/
// List<Long> userIdList=new ArrayList<>();
// userIdList.add(1000L);
// for(Long userId :userIdList){
// MessageReq req1 = new MessageReq();
// req1.setReadFlag(0);
// req1.setReceiveUserId(userId);
// Integer count1 = messageApi.queryCount(req1);
// messageApi.pushMsgToUser(String.valueOf(userId),count1);
// }
// return ApiRes.success(true);
// }
// // 处理每页数据
// private List<InventorySummary> processPageData1(long pageSize, long currentPage) {
// //得到全局默认值(随机处理数据表中的一条数据为默认值)
// Integer threshold = equipmentTypeService.getById(100001).getThreshold();
// //查询inventory_summary表中的threshold字段是否存在值,
// // 如果存在则用summary表中的字段进行比较物资阈值,如果不存在则默认使用全局物资阈值进行比较
// LambdaQueryWrapper<InventorySummary> wrapper = new LambdaQueryWrapper<InventorySummary>()
// .eq(InventorySummary::getLocationType, 0);
// Page<InventorySummary> page = inventorySummaryService.page(PageFactory.getDefaultPage(pageSize, currentPage),wrapper);
// List<InventorySummary> records = page.getRecords();
// //使用自定义物资阈值进行比较
// List<InventorySummary> collect1 = records.stream()
// .filter(data -> ObjectUtil.isNotNull(data.getThreshold()))
// .filter(data -> data.getNumber() <= data.getThreshold())
// .collect(Collectors.toList());
// //使用全局物资阈值进行比较
// List<InventorySummary> collect2 = records.stream()
// .filter(data -> data.getNumber() <= threshold && ObjectUtil.isNull(data.getThreshold()))
// .collect(Collectors.toList());
// //将数据存储到一个list中
// List<InventorySummary> inventorySummaryList=new ArrayList<>();
// inventorySummaryList.addAll(collect1);
// inventorySummaryList.addAll(collect2);
// return inventorySummaryList;
// }
//消息推送场景2:物资超期
//消息推送场景3:过质保期
@PostMapping("/ccc")
public void action3() {
// LambdaQueryWrapper<Inventory> wrapper = new LambdaQueryWrapper<>();
// // 分页参数
// int pageSize = 1000; // 每页记录数,可以根据需求调整
// int currentPage = 1; // 当前页数
//
// //所有待判断的物资
// wrapper.eq( Inventory::getTermState, 0);
// //获取未超期的物资数量(并且他的state不是销毁状态)
// long termCount= inventoryService.count(wrapper);
// List<Inventory> list=new ArrayList<>();
// if (termCount>0) {
// // 分页查询
// while ((currentPage - 1) * pageSize < termCount) {
// List<Inventory> inventoryList = processPageData3(currentPage, pageSize);
// currentPage++;
// list.addAll(inventoryList);
// }
// }
// System.out.println(list);
// //超期物资查询出来之后,将超期物资进行消息推送提醒
// //直接对list进行处理操作推送消息即可
}
// 处理每页数据
private List<Inventory> processPageData3(long pageSize, long currentPage)
{
LocalDate localdate =LocalDate.now();
// 使用LambdaQueryWrapper构建查询条件
LambdaQueryWrapper<Inventory> wrapper = Wrappers.lambdaQuery();
wrapper.eq( Inventory::getTermState, 0);
//如果 生产日期 < 当前日期减去质保数,表示该装备已经超过质保期
wrapper.apply("production_date <= DATE_SUB({0}, INTERVAL warranty_period DAY)", "1970-03-01 00:00:00");
//获取过质保期的物资信息
List<Inventory> page= inventoryService.page(PageFactory.getDefaultPage(pageSize,currentPage),wrapper).getRecords();
page.forEach(o->o.setTermState(1));
inventoryService.saveOrUpdateBatch(page);
return page;
}
}
...@@ -153,12 +153,18 @@ public class PublicController { ...@@ -153,12 +153,18 @@ public class PublicController {
} }
@PostMapping(path = "/updateMessage",name = "更新消息#logType30") @PostMapping(path = "/updateMessage",name = "更新消息#logType=30")
@ApiOperation("更新消息") @ApiOperation("更新消息")
public ApiRes<Boolean> updateMessage(@RequestBody MessageReq req){ public ApiRes<Boolean> updateMessage(@RequestBody MessageReq req){
return ApiRes.success(publicService.updateMessage(req)); return ApiRes.success(publicService.updateMessage(req));
} }
@PostMapping(path = "/setReadMessage",name = "将消息设置为已读状态#logType=30")
@ApiOperation("将消息设置为已读状态")
public ApiRes<Boolean> setReadMessage(@RequestBody MessageReq req){
return ApiRes.success(publicService.setReadMessage(req));
}
@PostMapping("/aaa") @PostMapping("/aaa")
public ApiRes<List<Object>> aaa(@RequestBody OrderMainReq req){ public ApiRes<List<Object>> aaa(@RequestBody OrderMainReq req){
......
...@@ -32,7 +32,7 @@ public class OutInLogsReceiver { ...@@ -32,7 +32,7 @@ public class OutInLogsReceiver {
*/ */
@Resource @Resource
private LogRecordApi logRecordApi; private LogRecordApi logRecordApi;
@RabbitListener(queues = "orderResult")//监听队列名 @RabbitListener(queues = "11111")//监听队列名
private void a(String msg, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag){ private void a(String msg, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag){
LogRecordDto logRecordDTO = LogRecordFactory.createLogRecord(LogConstant.LOG_DEFAULT_NAME, "CabinetLogsRecord"); LogRecordDto logRecordDTO = LogRecordFactory.createLogRecord(LogConstant.LOG_DEFAULT_NAME, "CabinetLogsRecord");
......
...@@ -18,4 +18,5 @@ public interface PublicService { ...@@ -18,4 +18,5 @@ public interface PublicService {
boolean updateMessage(MessageReq req); boolean updateMessage(MessageReq req);
boolean setReadMessage(MessageReq req);
} }
...@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -10,6 +10,7 @@ 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.LogSummaryDto; import com.junmp.jyzb.api.bean.dto.LogSummaryDto;
import com.junmp.jyzb.api.bean.dto.NormalInOutDto; import com.junmp.jyzb.api.bean.dto.NormalInOutDto;
import com.junmp.jyzb.api.bean.query.ApplicationReq;
import com.junmp.jyzb.api.bean.query.InAndOutRecordReq.CabinetLogsRecordReq; import com.junmp.jyzb.api.bean.query.InAndOutRecordReq.CabinetLogsRecordReq;
import com.junmp.jyzb.api.bean.query.InAndOutRecordReq.*; import com.junmp.jyzb.api.bean.query.InAndOutRecordReq.*;
import com.junmp.jyzb.api.bean.query.LogDetailReq; import com.junmp.jyzb.api.bean.query.LogDetailReq;
...@@ -104,21 +105,10 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm ...@@ -104,21 +105,10 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
req.setColumn("create_time"); req.setColumn("create_time");
req.setOrder("desc"); req.setOrder("desc");
} }
LambdaQueryWrapper<LogSummary> eq = createWrapper(req);
LambdaQueryWrapper<LogSummary> eq = new LambdaQueryWrapper<LogSummary>()
.eq(ObjectUtil.isNotNull(req.getOrgId()),LogSummary::getOrgId,req.getOrgId())
.eq(LogSummary::getLocationType,req.getLocationType())
.eq(ObjectUtil.isNotNull(req.getOrderMainId()),LogSummary::getOrderMainId,req.getOrderMainId())
.eq(ObjectUtil.isNotNull(req.getBussinessType()) && !req.getBussinessType().trim().isEmpty(),LogSummary::getBussinessType,req.getBussinessType())
.eq(ObjectUtil.isNotNull(req.getOutInState()) && !req.getOutInState().trim().isEmpty(),LogSummary::getOutInState,req.getOutInState())
.eq(ObjectUtil.isNotNull(req.getLocationId()),LogSummary::getLocationId,req.getLocationId())
.eq(ObjectUtil.isNotNull(req.getUserName()),LogSummary::getUserName,req.getUserName())
.ge(ObjectUtil.isNotNull(req.getStartTime()),LogSummary::getUseTime,req.getStartTime())
.le(ObjectUtil.isNotNull(req.getEndTime()),LogSummary::getUseTime,req.getEndTime())
.like(ObjectUtil.isNotNull(req.getTypeName()),LogSummary::getEquipmentList,req.getTypeName())
.last("order by " + req.getColumn() + " " + req.getOrder());
Page<LogSummary> page = logSummaryService.page(PageFactory.getDefaultPage(req.getPageNo(), req.getPageSize()), eq); Page<LogSummary> page = logSummaryService.page(PageFactory.getDefaultPage(req.getPageNo(), req.getPageSize()), eq);
return PageResultFactory.createPageResult(page); return PageResultFactory.createPageResult(page);
} }
...@@ -136,8 +126,8 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm ...@@ -136,8 +126,8 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
} }
LogSummary logSummary = logSummaryMapper.ShowInOutRecordsByItemsCount(req); LogSummary logSummary = logSummaryMapper.ShowInOutRecordsByItemsCount(req);
return ObjectUtil.isNull(logSummary)?new LogSummary():logSummary ; return ObjectUtil.isNull(logSummary)?new LogSummary():logSummary ;
} }
//根据条件查询出入库记录(整个单子的汇总记录) //根据条件查询出入库记录(整个单子的汇总记录)
...@@ -151,12 +141,12 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm ...@@ -151,12 +141,12 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
req.setOrder(req.getOrder().toLowerCase()); req.setOrder(req.getOrder().toLowerCase());
} }
Page<LogSummaryDto> page = PageFactory.getDefaultPage(req.getPageNo(), req.getPageSize()); Page<LogSummaryDto> page = PageFactory.getDefaultPage(req.getPageNo(), req.getPageSize());
Calendar calendarBegin = DateUtil.parseByPatterns(DateUtil.endOfYear(DateTimeUtil.getCurrentDateTime()).toString(), "yyyy-MM-dd hh:mm:ss"); // Calendar calendarBegin = DateUtil.parseByPatterns(DateUtil.endOfYear(DateTimeUtil.getCurrentDateTime()).toString(), "yyyy-MM-dd hh:mm:ss");
Date time = calendarBegin.getTime(); // Date time = calendarBegin.getTime();
Calendar calendarEnd = DateUtil.parseByPatterns(DateUtil.beginOfYear(DateTimeUtil.getCurrentDateTime()).toString(), "yyyy-MM-dd hh:mm:ss"); // Calendar calendarEnd = DateUtil.parseByPatterns(DateUtil.beginOfYear(DateTimeUtil.getCurrentDateTime()).toString(), "yyyy-MM-dd hh:mm:ss");
Date time1 = calendarEnd.getTime(); // Date time1 = calendarEnd.getTime();
req.setStartTime(DateTimeUtil.TimeDateToString(time)); // req.setStartTime(DateTimeUtil.TimeDateToString(time));
req.setEndTime(DateTimeUtil.TimeDateToString(time1)); // req.setEndTime(DateTimeUtil.TimeDateToString(time1));
List<LogSummaryDto> logSummaryList=logSummaryMapper.RecordSumByOrderId(req,(req.getPageNo()-1)*req.getPageSize(), req.getPageSize()); List<LogSummaryDto> logSummaryList=logSummaryMapper.RecordSumByOrderId(req,(req.getPageNo()-1)*req.getPageSize(), req.getPageSize());
LogSummaryDto dto=logSummaryMapper.RecordSumByOrderIdSum(req); LogSummaryDto dto=logSummaryMapper.RecordSumByOrderIdSum(req);
page.setTotal(dto.getCount()); page.setTotal(dto.getCount());
...@@ -173,12 +163,12 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm ...@@ -173,12 +163,12 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
req.setColumn(req.getColumn().replaceAll("[A-Z]", "_$0").toLowerCase()); req.setColumn(req.getColumn().replaceAll("[A-Z]", "_$0").toLowerCase());
req.setOrder(req.getOrder().toLowerCase()); req.setOrder(req.getOrder().toLowerCase());
} }
Calendar calendarBegin = DateUtil.parseByPatterns(DateUtil.endOfYear(DateTimeUtil.getCurrentDateTime()).toString(), "yyyy-MM-dd hh:mm:ss"); // Calendar calendarBegin = DateUtil.parseByPatterns(DateUtil.endOfYear(DateTimeUtil.getCurrentDateTime()).toString(), "yyyy-MM-dd hh:mm:ss");
Date time = calendarBegin.getTime(); // Date time = calendarBegin.getTime();
Calendar calendarEnd = DateUtil.parseByPatterns(DateUtil.beginOfYear(DateTimeUtil.getCurrentDateTime()).toString(), "yyyy-MM-dd hh:mm:ss"); // Calendar calendarEnd = DateUtil.parseByPatterns(DateUtil.beginOfYear(DateTimeUtil.getCurrentDateTime()).toString(), "yyyy-MM-dd hh:mm:ss");
Date time1 = calendarEnd.getTime(); // Date time1 = calendarEnd.getTime();
req.setStartTime(DateTimeUtil.TimeDateToString(time)); // req.setStartTime(DateTimeUtil.TimeDateToString(time));
req.setEndTime(DateTimeUtil.TimeDateToString(time1)); // req.setEndTime(DateTimeUtil.TimeDateToString(time1));
LogSummaryDto dto=logSummaryMapper.RecordSumByOrderIdSum(req); LogSummaryDto dto=logSummaryMapper.RecordSumByOrderIdSum(req);
return dto; return dto;
} }
...@@ -331,217 +321,6 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm ...@@ -331,217 +321,6 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
} }
// 对出入库记录进行分类汇总存储()
// 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<>();
// //存一个list用于修改库存warehosuseInventory表的数据(采购时那么这个wInventoryList就为空)
// List<WarehouseInventory> wInbentoryList=new ArrayList<>();
// List<OrderLog> orderLogList=new ArrayList<>();
// String orderMainId="";
//
// List<LogSummary> sumList=new ArrayList<>();
// OrderMain ordermain=null;
// for (SummaryLogReq logreq:logSummaryList) {
// if (ObjectUtil.isNotNull(logreq.getPicture())){
// byte[] imageBytes = Base64.getDecoder().decode(logreq.getPicture());
// MultipartFile picture = new MockMultipartFile("sample", imageBytes);
// // 图片文件保存路径和文件名
// SysFileInfoReq sysFileInfoReq = new SysFileInfoReq();
// sysFileInfoReq.setFileBucket("jyzb");
// sysFileInfoReq.setFileLocation(3);
// sysFileInfoReq.setFileObjectName("OutInPrice/"+logreq.getOrgId()+"/");
// SysFileInfoResp sysFileInfoResp = sysFileInfoService.uploadFile(picture, sysFileInfoReq);
// logreq.setPicture(sysFileInfoResp.getAccessUrl());
// }
//
// if (ObjectUtil.isNotNull(logreq.getOrderMainId())){
// orderMainId=logreq.getOrderMainId();
// }
//
// if (ObjectUtil.isNotEmpty(orderMainId)){
// ordermain = orderMainService.getById(orderMainId);
// }
// //如果类型为normal,那么则表示作为日常出入库的记录,否则则作为单据的出入库记录
// List<DetailLogReq> logList = logreq.getLogDetailList();
//
// //出入库list
// List<LogDetail> collect = new ArrayList<>();
// LogSummary logSummary = saveLogSummary(logreq,logreq.getLocationId(),logreq.getLocationName(),logreq.getOutInState());
//
// String string="";
// String stringQuick="";
// if (logSummary.getOutInState().equals("in")){
// string=string+logSummary.getLocationName()+":入库【"+logSummary.getEquipmentList()+"】,数量:"+logSummary.getNumber()+"\n";
// }else {
// string=string+logSummary.getLocationName()+":出库【"+logSummary.getEquipmentList()+"】,数量:"+logSummary.getNumber()+"\n";
// }
// LogSummary logSummaryQuick=new LogSummary();
// if (logreq.getBussinessType().equals("quick")){//如果是快速出库的同时需要创建快速入库
// logSummaryQuick= saveLogSummary(logreq,ordermain.getLocationId(),ordermain.getLocationName(),"in");
// sumList.add(logSummaryQuick);
// stringQuick=stringQuick+logSummaryQuick.getLocationName()+":入库【"+logSummaryQuick.getEquipmentList()+"】,数量:"+logSummary.getNumber()+"\n";
// }
// sumList.add(logSummary);
// logSummaryService.saveBatch(sumList);
// sumList.clear();
// 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);
// normalInOutDto.setOutInState(logSummary.getOutInState());
// returnList.add(normalInOutDto);
// }
// //判断logSummary是否为采购,快速移库,和领用出库
// //如果是采购则不处理,因为采购的inventory是跟着单子来处理的,其他的单子直接根据出入库记录来处理
// if (!logreq.getBussinessType().equals("purchase") && !logreq.getBussinessType().equals("quick") ){
//// if (logreq.getOutInState().equals("in")){
// Inventory inventory = saveInventory(logreq.getOrgId(),logreq.getLocationId(),logreq,detailLogReq, map, logSummary.getOutInState());
// inventoryList.add(inventory);
//
// }
//// //如果是快速移库,那么直接将物资的locationId进行修改
// if(logreq.getBussinessType().equals("quick")){
// Inventory inventory = saveInventory(logreq.getOrgId(),ordermain.getLocationId(),logreq,detailLogReq, map, "in");
// inventoryList.add(inventory);
// }
// //存放logdetail信息
// LogDetail logDetail = new LogDetail();
// LogDetail logDetailQuick=new LogDetail();
// BeanPlusUtil.copyProperties(detailLogReq, logDetail);
// logDetail.setSummaryId(logSummary.getId());
// logDetail.setOrgId(logSummary.getOrgId());
// logDetail.setCreateTime(DateTimeUtil.getCurrentDateTime());
// logDetail.setBussinessType(logreq.getBussinessType());
// logDetail.setOutInState(logreq.getOutInState());
// if (logreq.getBussinessType().equals("quick")){
// BeanPlusUtil.copyProperties(logDetail,logDetailQuick);
// logDetailQuick.setSummaryId(logSummaryQuick.getId());
// logDetailQuick.setOutInState("in");
// collect.add(logDetailQuick);
// }
// collect.add(logDetail);
//
// }
//
// boolean b = logDetailService.saveBatch(collect);
// //创建出入库日志
// if (ObjectUtil.isNotNull(logSummary.getOrderMainId())){
// OrderLog orderLog = addLog(logSummary,string);
// OrderLog qucik = new OrderLog();
// if (logreq.getBussinessType().equals("quick")){
// qucik=addLog(logSummaryQuick,stringQuick);
// orderLogList.add(qucik);
// }
// orderLogList.add(orderLog);
// }
// }
// //判断是否有orderId的单子出入库,如果有则直接添加
// if (orderLogList.size()>0){
// boolean b = orderLogService.saveBatch(orderLogList);
// }
//
// //修改inventory表中的数据(如果不为空则表示不是采购单或者已经将采购单的信息过滤掉)
//
// if (inventoryList.size()>0){
//
// LambdaUpdateWrapper<Inventory> updateStateWrapper1 = Wrappers.lambdaUpdate();
// LambdaUpdateWrapper<Inventory> allocateInWrapper1 = Wrappers.lambdaUpdate();
// LambdaUpdateWrapper<WarehouseInventory> updateStateWrapper2 = Wrappers.lambdaUpdate();
// LambdaUpdateWrapper<WarehouseInventory> allocateInWrapper2 = Wrappers.lambdaUpdate();
// LambdaQueryWrapper<WarehouseInventory> destroyOutWrapper =Wrappers.lambdaQuery();
// for (Inventory inventory:inventoryList) {
// if (inventory.getBussinessType().equals("allocate") && inventory.getLocationState().equals("in") && !ObjectUtil.isNull(ordermain)){
// //调拨入库
// allocateInWrapper1.or().eq(Inventory::getEpc,inventory.getEpc())
// .set(Inventory::getOrgId,inventory.getOrgId())
// .set(Inventory::getLocationId,inventory.getLocationId())
// .set(Inventory::getLocationState,"in");
// allocateInWrapper2.or().eq(WarehouseInventory::getEpc,inventory.getEpc())
// .set(WarehouseInventory::getOrgId,inventory.getOrgId())
// .set(WarehouseInventory::getLocationId,inventory.getLocationId())
// .set(WarehouseInventory::getLocationState,"in");
//
// } else if (inventory.getBussinessType().equals("allocate") && inventory.getLocationState().equals("out") && !ObjectUtil.isNull(ordermain)){
// //调拨出库,不操作
// allocateInWrapper1.or().eq(Inventory::getEpc,inventory.getEpc())
// .set(Inventory::getOrgId,null)
// .set(Inventory::getLocationId,null)
// .set(Inventory::getLocationState,"out");
// allocateInWrapper2.or().eq(WarehouseInventory::getEpc,inventory.getEpc())
// .set(WarehouseInventory::getOrgId,null)
// .set(WarehouseInventory::getLocationId,null)
// .set(WarehouseInventory::getLocationState,"out");
// }else if (inventory.getBussinessType().equals("destruction")){
// updateStateWrapper1.or().eq(Inventory::getEpc,inventory.getEpc())
// .set(Inventory::getLocationState,"out")
// .set(Inventory::getBussinessState,"destruction")
// .set(Inventory::getLocationId,inventory.getLocationId())
// .set(Inventory::getState,"destory");
// destroyOutWrapper.or().eq(WarehouseInventory::getEpc,inventory.getEpc());
// }else{
// //其他情况
// if (inventory.getBussinessType().equals("quick")){
// updateStateWrapper1.or().eq(Inventory::getEpc,inventory.getEpc())
// .set(Inventory::getLocationState,"in")
// .set(Inventory::getBussinessState,"normal")
// .set(Inventory::getLocationId,inventory.getLocationId())
// .set(Inventory::getState,"normal");
//
// updateStateWrapper2.or().eq(WarehouseInventory::getEpc,inventory.getEpc())
// .set(WarehouseInventory::getLocationId,inventory.getLocationId())
// .set(WarehouseInventory::getLocationState,"in");
// }else {
// updateStateWrapper1.or().eq(Inventory::getEpc,inventory.getEpc())
// .set(Inventory::getLocationState,inventory.getLocationState())
// .set(Inventory::getBussinessState,inventory.getBussinessState())
// .set(Inventory::getState,inventory.getState());
//
// updateStateWrapper2.or().eq(WarehouseInventory::getEpc,inventory.getEpc())
// .set(WarehouseInventory::getLocationState,inventory.getLocationState());
//
// }
//
//
// }
//
// }
//
// if (!updateStateWrapper1.isEmptyOfWhere()){
//
// inventoryService.update(updateStateWrapper1);
//
// warehouseInventoryService.update(updateStateWrapper2);
// }
//
// if (!allocateInWrapper1.isEmptyOfWhere()){
//
// inventoryService.update(allocateInWrapper1);
// warehouseInventoryService.update(allocateInWrapper2);
// }
//
// }
//
// return returnList;
// }
private OrderLog addLog(LogSummary logSummary,String string){ private OrderLog addLog(LogSummary logSummary,String string){
OrderLog orderLog = new OrderLog(); OrderLog orderLog = new OrderLog();
orderLog.setId(UUID.randomUUID().toString()); orderLog.setId(UUID.randomUUID().toString());
...@@ -974,7 +753,23 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm ...@@ -974,7 +753,23 @@ public class LogSummaryServiceImpl extends ServiceImpl<LogSummaryMapper, LogSumm
return true; return true;
} }
} private LambdaQueryWrapper<LogSummary> createWrapper(LogSummaryReq req) {
LambdaQueryWrapper<LogSummary> eq = new LambdaQueryWrapper<LogSummary>()
.eq(ObjectUtil.isNotNull(req.getOrgId()),LogSummary::getOrgId,req.getOrgId())
.eq(LogSummary::getLocationType,req.getLocationType())
.eq(ObjectUtil.isNotNull(req.getOrderMainId()),LogSummary::getOrderMainId,req.getOrderMainId())
.eq(ObjectUtil.isNotNull(req.getBussinessType()) && !req.getBussinessType().trim().isEmpty(),LogSummary::getBussinessType,req.getBussinessType())
.eq(ObjectUtil.isNotNull(req.getOutInState()) && !req.getOutInState().trim().isEmpty(),LogSummary::getOutInState,req.getOutInState())
.eq(ObjectUtil.isNotNull(req.getLocationId()),LogSummary::getLocationId,req.getLocationId())
.like(ObjectUtil.isNotNull(req.getUserName()),LogSummary::getUserName,req.getUserName())
.ge(ObjectUtil.isNotNull(req.getStartTime()),LogSummary::getUseTime,req.getStartTime())
.le(ObjectUtil.isNotNull(req.getEndTime()),LogSummary::getUseTime,req.getEndTime())
.like(ObjectUtil.isNotNull(req.getTypeName()),LogSummary::getEquipmentList,req.getTypeName())
.last("order by " + req.getColumn() + " " + req.getOrder());
return eq;
}
}
......
...@@ -935,7 +935,7 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -935,7 +935,7 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
OrderDetail orderDetail = new OrderDetail(); OrderDetail orderDetail = new OrderDetail();
BeanPlusUtil.copyProperties(uploadDetailReq,orderDetail); BeanPlusUtil.copyProperties(uploadDetailReq,orderDetail);
//记空账(识别0,记账0) //记空账(识别0,记账0)
if (uploadDetailReq.getActualNum()==0 && req.getActualQuantity()==0){ if (uploadDetailReq.getActualNum()==0 && uploadDetailReq.getModifyQuantity()==0){
//添加出入库日志记录 //添加出入库日志记录
if (orderMain.getOrderType().equals("in")){ if (orderMain.getOrderType().equals("in")){
...@@ -1109,7 +1109,7 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -1109,7 +1109,7 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
} }
} }
//记账0 //记账0
if (flag){ if (!flag){
orderMain.setActualQuantity(updateQuantity); orderMain.setActualQuantity(updateQuantity);
orderMain.setOrderState("finished"); orderMain.setOrderState("finished");
//修改记账状态,0未记账,1已记账 //修改记账状态,0未记账,1已记账
...@@ -1139,14 +1139,15 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -1139,14 +1139,15 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
LogDetailReq logDetailReq = new LogDetailReq(); LogDetailReq logDetailReq = new LogDetailReq();
BeanPlusUtil.copyProperties(inv,logDetailReq); BeanPlusUtil.copyProperties(inv,logDetailReq);
logDetailReq.setOutInState(req.getOrderType()); logDetailReq.setOutInState(req.getOrderType());
logDetailReq.setBussinessType(orderMain.getBussinessType());
logDetailReq.setCreateTime(DateTimeUtil.getCurrentDateTime());
if (CollectionUtil.isEmpty(logDetailList)) { if (CollectionUtil.isEmpty(logDetailList)) {
lsReq.setLogList(new ArrayList<>()); lsReq.setLogList(new ArrayList<>());
logDetailList = lsReq.getLogList(); logDetailList = lsReq.getLogList();
} }
logDetailList.add(logDetailReq); logDetailList.add(logDetailReq);
LogSummaryReq logSummaryReq = logMap.get(inv.getLocationId()); lsReq.setLogList(logDetailList);
logSummaryReq.setLogList(logDetailList); logMap.put(inv.getLocationId(),lsReq);
logMap.put(inv.getLocationId(),logSummaryReq);
} }
} }
//出库记账logDetail //出库记账logDetail
...@@ -1158,15 +1159,15 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -1158,15 +1159,15 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
LogDetailReq logDetailReq = new LogDetailReq(); LogDetailReq logDetailReq = new LogDetailReq();
BeanPlusUtil.copyProperties(inv,logDetailReq); BeanPlusUtil.copyProperties(inv,logDetailReq);
logDetailReq.setOutInState(req.getOrderType()); logDetailReq.setOutInState(req.getOrderType());
logDetailReq.setBussinessType(orderMain.getBussinessType());
logDetailReq.setCreateTime(DateTimeUtil.getCurrentDateTime()); logDetailReq.setCreateTime(DateTimeUtil.getCurrentDateTime());
if (CollectionUtil.isEmpty(logDetailList)) { if (CollectionUtil.isEmpty(logDetailList)) {
lsReq.setLogList(new ArrayList<>()); lsReq.setLogList(new ArrayList<>());
logDetailList = lsReq.getLogList(); logDetailList = lsReq.getLogList();
} }
logDetailList.add(logDetailReq); logDetailList.add(logDetailReq);
LogSummaryReq logSummaryReq = logMap.get(inv.getLocationId()); lsReq.setLogList(logDetailList);
logSummaryReq.setLogList(logDetailList); logMap.put(inv.getLocationId(),lsReq);
logMap.put(inv.getLocationId(),logSummaryReq);
} }
} }
//出库更新装备状态和出库状态 //出库更新装备状态和出库状态
......
...@@ -203,7 +203,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -203,7 +203,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
} }
//判断警员编号是否已经存在 //判断警员编号是否已经存在
List<Policeman> list = list(new LambdaQueryWrapper<Policeman>().eq(Policeman::getPoliceCode, req.getPoliceCode()) List<Policeman> list = list(new LambdaQueryWrapper<Policeman>().eq(Policeman::getPoliceCode, req.getPoliceCode())
.eq(Policeman::getIdentity, req.getIdentity())); .eq(Policeman::getIdentity, req.getIdentity()).or().eq(Policeman::getName, req.getName()));
if (CollectionUtil.isNotEmpty(list)){ if (CollectionUtil.isNotEmpty(list)){
throw new ServiceException(PolicemanExceptionEnum.POLICECODE_IS_EXISTS); throw new ServiceException(PolicemanExceptionEnum.POLICECODE_IS_EXISTS);
} }
...@@ -230,7 +230,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -230,7 +230,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
policeman.setState(1); policeman.setState(1);
policeman.setUserId(sysUser.getUserId()); policeman.setUserId(sysUser.getUserId());
//如果有照片,将警员照片直接复制一下以防万一 //如果有照片,将警员照片直接复制一下以防万一
policeman.setPhoto(req.getFaceInfo()); policeman.setPhoto(req.getPhoto());
policeman.setCreateTime(DateTimeUtil.getCurrentDateTime()); policeman.setCreateTime(DateTimeUtil.getCurrentDateTime());
policeman.setUpdateTime(DateTimeUtil.getCurrentDateTime()); policeman.setUpdateTime(DateTimeUtil.getCurrentDateTime());
save(policeman); save(policeman);
...@@ -605,7 +605,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -605,7 +605,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
throw new ServiceException(PolicemanExceptionEnum.POLICECODE_IS_EXISTS); throw new ServiceException(PolicemanExceptionEnum.POLICECODE_IS_EXISTS);
} }
} }
one.setPhoto(req.getFaceInfo()); one.setPhoto(req.getPhoto());
one.setUpdateTime(DateTimeUtil.getCurrentDateTime()); one.setUpdateTime(DateTimeUtil.getCurrentDateTime());
SysUser user= sysUserService.getById(req.getUserId()); SysUser user= sysUserService.getById(req.getUserId());
user.setPassword(req.getPassword()); user.setPassword(req.getPassword());
...@@ -1545,13 +1545,9 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -1545,13 +1545,9 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
.eq(CabinetBoxPolice::getPoliceId,policeman.getId())); .eq(CabinetBoxPolice::getPoliceId,policeman.getId()));
//判断前端传递的装备列表字段是否为空,如果为空则表示该警员不拿走任何装备信息(不做任何操作) //判断前端传递的装备列表字段是否为空,如果为空则表示该警员不拿走任何装备信息(不做任何操作)
if (ObjectUtil.isNull(req.getDetailList()) || req.getDetailList().trim().isEmpty()){ if (ObjectUtil.isNotNull(req.getDetailList()) || !req.getDetailList().trim().isEmpty()){
// if (list1.size()>0){
//// policeEquipmentService.remove(eq);
// policeEquipmentService.removeBatchByIds(list1);
// }
} else {//将该警员拿走的装备的组织机构设置为空,并且其他装备进行跟警员进行解绑删除 //将该警员拿走的装备的组织机构设置为空,并且其他装备进行跟警员进行解绑删除
List<PoliceEquipment> removeList=new ArrayList<>(); List<PoliceEquipment> removeList=new ArrayList<>();
//更新装备(将装备信息进行删除) //更新装备(将装备信息进行删除)
List<PoliceEquipment> updateList=new ArrayList<>(); List<PoliceEquipment> updateList=new ArrayList<>();
...@@ -1584,26 +1580,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -1584,26 +1580,7 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
policeEquipmentService.updateBatchById(updateList); policeEquipmentService.updateBatchById(updateList);
policeEquipmentService.removeBatchByIds(removeList); policeEquipmentService.removeBatchByIds(removeList);
// if (searchItem.size()>0)
// {
// //修改库存数量
// List<InventorySummary> inventorySummaryList = inventorySummaryMapper.selectSumByItems(searchItem);
// List<InventorySummary> updateSummaryList=new ArrayList<>();
// for (InventorySummary is:inventorySummaryList) {
// for ( Object[] one: searchItem) {
// if (is.getLocationId().equals(one[1]) && is.getTypeId().equals(one[2])
// && is.getSizeId().equals(one[3]) && is.getUnitPrice().compareTo(new BigDecimal(one[4].toString()))==0){
// is.setOutboundNumber(is.getOutboundNumber()-Integer.parseInt(one[5].toString()));
// is.setNumber(is.getNumber()-Integer.parseInt(one[5].toString()));
// updateSummaryList.add(is);
// break;
// }
// }
// }
// if (updateSummaryList.size()>0){
// inventorySummaryService.updateBatchById(updateSummaryList);
// }
// }
} }
//记录日志(如果警员携带装备,则进行记录 ) //记录日志(如果警员携带装备,则进行记录 )
if (ObjectUtil.isNotNull(reqEquipments)){ if (ObjectUtil.isNotNull(reqEquipments)){
......
...@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateTime; ...@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
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.core.toolkit.Wrappers;
import com.junmp.junmpProcess.dto.json.UserInfo; import com.junmp.junmpProcess.dto.json.UserInfo;
import com.junmp.jyzb.service.PublicService; import com.junmp.jyzb.service.PublicService;
...@@ -119,4 +120,16 @@ public class PublicServiceImpl implements PublicService { ...@@ -119,4 +120,16 @@ public class PublicServiceImpl implements PublicService {
return true; return true;
} }
@Override
@Transactional(rollbackFor = Exception.class)
public boolean setReadMessage(MessageReq req) {
List<Long> msgIdList = req.getMsgIdList();
List<SysMessage> list = sysMessageService.list(new LambdaQueryWrapper<SysMessage>().in(SysMessage::getMsgId, msgIdList));
List<Long> collect = list.stream().map(SysMessage::getBizId).collect(Collectors.toList());
List<SysMessage> list1 = sysMessageService.list(new LambdaQueryWrapper<SysMessage>().in(SysMessage::getBizId, collect));
return sysMessageService.update(new LambdaUpdateWrapper<SysMessage>()
.set(SysMessage::getReadFlag, 1)
.in(SysMessage::getBizId, list1));
}
} }
...@@ -570,7 +570,8 @@ ...@@ -570,7 +570,8 @@
( (
sum( CASE WHEN `base_inventory_summary`.`location_type` = 0 THEN `base_inventory_summary`.`stock_number` ELSE 0 END ) + sum( CASE WHEN `base_inventory_summary`.`location_type` = 0 THEN `base_inventory_summary`.`stock_number` ELSE 0 END ) +
sum( CASE WHEN `base_inventory_summary`.`location_type` = 0 THEN `base_inventory_summary`.`outbound_number` ELSE 0 END ) + sum( CASE WHEN `base_inventory_summary`.`location_type` = 0 THEN `base_inventory_summary`.`outbound_number` ELSE 0 END ) +
sum( CASE WHEN `base_inventory_summary`.`location_type` = 0 THEN `base_inventory_summary`.`destruction_number` ELSE 0 END ) sum( CASE WHEN `base_inventory_summary`.`location_type` = 1 THEN `base_inventory_summary`.`stock_number` ELSE 0 END )+
sum( CASE WHEN `base_inventory_summary`.`location_type` = 1 THEN `base_inventory_summary`.`stock_number` ELSE 0 END )
) AS total_number, ) AS total_number,
sum( CASE WHEN ( `base_inventory_summary`.`location_type` = 0 ) THEN `base_inventory_summary`.`stock_number` ELSE 0 END ) AS `ck_stock_number`, sum( CASE WHEN ( `base_inventory_summary`.`location_type` = 0 ) THEN `base_inventory_summary`.`stock_number` ELSE 0 END ) AS `ck_stock_number`,
sum( CASE WHEN ( `base_inventory_summary`.`location_type` = 0 ) THEN `base_inventory_summary`.`outbound_number` ELSE 0 END ) AS `ck_outbound_number`, sum( CASE WHEN ( `base_inventory_summary`.`location_type` = 0 ) THEN `base_inventory_summary`.`outbound_number` ELSE 0 END ) AS `ck_outbound_number`,
...@@ -759,48 +760,44 @@ ...@@ -759,48 +760,44 @@
<select id="selectSumByItemsCount" resultType="java.lang.Integer" <select id="selectSumByItemsCount" resultType="java.lang.Integer"
parameterType="com.junmp.jyzb.api.bean.query.InventoryReq"> parameterType="com.junmp.jyzb.api.bean.query.InventoryReq">
select count(*) from ( select count(*) from (
SELECT wi.type_id,wi.size_id,wi.shelf_id,wi.shelf_location, wi.epc,wi.org_id,wi.location_state, SELECT wi.type_id,wi.size_id,wi.shelf_id,wi.shelf_location, wi.epc,wi.org_id,wi.location_state,wi.location_name,wi.type_name,wi.size_name,wi.org_name,
wi.location_type,wi.location_id,i.id,i.supplier_id,i.price,i.state,i.bussiness_state, wi.location_type,wi.location_id,i.id,i.supplier_id,i.price,i.state,i.bussiness_state,
i.production_date,i.warranty_period,i.maintenance_period, i.term_state, i.production_date,i.warranty_period,i.maintenance_period, i.term_state,i.property,
i.area_id,et.name as type_name,es.name as size_name,po.org_name as org_name, i.area_id,
bs.name as supplier_name,COALESCE(bc.name, bw.name) as location_name, bs.name as supplier_name,
es.photo as photo,es.instructions as instructions (select instructions FROM base_equipment_type where id=#{req.typeId}) as instructions,
FROM base_warehouse_inventory wi (select photo FROM base_equipment_type where id=#{req.typeId}) as type_photo,
LEFT JOIN base_inventory i ON i.epc = wi.epc es.photo as size_photo
LEFT JOIN base_equipment_type et ON et.id = i.type_id FROM base_warehouse_inventory wi
LEFT JOIN base_equipment_size es ON es.id = i.size_id LEFT JOIN base_inventory i ON i.epc = wi.epc
LEFT JOIN pub_org po ON i.org_id_int = po.org_id LEFT JOIN base_equipment_size es ON wi.size_id = es.id
LEFT JOIN base_supplier bs ON bs.id = i.supplier_id LEFT JOIN base_supplier bs ON bs.id = i.supplier_id
LEFT JOIN base_cabinet_box bcb ON i.location_id = bcb.id AND i.location_type = 1 WHERE wi.org_id=#{req.orgId} and wi.type_id=#{req.typeId} and i.state !="destory"
LEFT JOIN base_cabinet bc ON bcb.cabinet_id = bc.id <if test="req.locationType !='all' and req.locationType != null">
LEFT JOIN base_warehouse bw ON i.location_id = bw.id AND i.location_type = 0 and wi.location_type=#{req.locationType}
WHERE wi.org_id=#{req.orgId} and wi.type_id=#{req.typeId} </if>
<if test="req.locationType !='all' and req.locationType != null"> <if test="req.locationId != null and req.locationId != ''">
and wi.location_type=#{req.locationType} and wi.location_id =#{req.locationId}
</if> </if>
<if test="req.warehouseId != null and req.warehouseId != ''"> <if test="req.termState!= -1">
and wi.location_id =#{req.warehouseId} and i.term_state=#{req.termState}
</if> </if>
<if test="req.termState!= -1"> <if test="req.locationState!='all' and req.locationState !=null and req.locationState!=''">
and i.term_state=#{req.termState} and i.location_state=#{req.locationState}
</if> </if>
<if test="req.locationState!='all' and req.locationState !=null and req.locationState!=''"> <if test="req.sizeId !=null and req.sizeId != ''">
and i.location_state=#{req.locationState} and wi.size_id=#{req.sizeId}
</if> </if>
<if test="req.sizeId !=null and req.sizeId != ''"> <if test="req.price !=null and req.price != ''">
and wi.size_id=#{req.sizeId} and i.price=#{req.price}
</if> </if>
<if test="req.price !=null and req.price != ''"> <if test="req.warrantyPeriod != null and req.warrantyPeriod != ''">
and i.price=#{req.price} and i.warranty_period=#{req.warrantyPeriod}
</if> </if>
<if test="req.warrantyPeriod != null and req.warrantyPeriod != ''"> <if test="req.maintenancePeriod != null and req.maintenancePeriod != ''">
and i.warranty_period=#{req.warrantyPeriod} and i.maintenance_period=#{req.maintenancePeriod}
</if> </if>
<if test="req.maintenancePeriod != null and req.maintenancePeriod != ''"> ORDER BY wi.type_id,i.size_id
and i.maintenance_period=#{req.maintenancePeriod}
</if>
ORDER BY wi.type_id,i.size_id
) as a ) as a
</select> </select>
<select id="GetDetailByTerms" resultType="com.junmp.jyzb.api.bean.dto.InventoryDto"> <select id="GetDetailByTerms" resultType="com.junmp.jyzb.api.bean.dto.InventoryDto">
...@@ -817,7 +814,7 @@ ...@@ -817,7 +814,7 @@
LEFT JOIN base_inventory i ON i.epc = wi.epc LEFT JOIN base_inventory i ON i.epc = wi.epc
LEFT JOIN base_equipment_size es ON wi.size_id = es.id LEFT JOIN base_equipment_size es ON wi.size_id = es.id
LEFT JOIN base_supplier bs ON bs.id = i.supplier_id LEFT JOIN base_supplier bs ON bs.id = i.supplier_id
WHERE wi.org_id=#{req.orgId} and wi.type_id=#{req.typeId} WHERE wi.org_id=#{req.orgId} and wi.type_id=#{req.typeId} and i.state !="destory"
<if test="req.locationType !='all' and req.locationType != null"> <if test="req.locationType !='all' and req.locationType != null">
and wi.location_type=#{req.locationType} and wi.location_type=#{req.locationType}
</if> </if>
......
...@@ -92,145 +92,120 @@ ...@@ -92,145 +92,120 @@
where ls.org_id = #{orgId} where ls.org_id = #{orgId}
and ls.location_type = 0) as b and ls.location_type = 0) as b
</select> </select>
<select id="ShowInOutRecordsByItemsCount" resultType="com.junmp.jyzb.entity.LogSummary"> <select id="ShowInOutRecordsByItemsCount" resultType="com.junmp.jyzb.entity.LogSummary">
select sum(a.number) as number from ( select sum(a.number) as number from (
select number from base_log_summary ls where location_type=#{req.locationType} select number from base_log_summary ls where location_type=#{req.locationType}
<if test="req.orgId != null and req.orgId !=''"> <if test="req.orgId != null and req.orgId !=''">
and org_id=#{req.orgId} and org_id=#{req.orgId}
</if> </if>
<if test="req.orderMainId != null and req.orderMainId !=''"> <if test="req.orderMainId != null and req.orderMainId !=''">
and order_main_id=#{req.orderMainId} and order_main_id=#{req.orderMainId}
</if> </if>
<if test="req.bussinessType != null and req.bussinessType !=''"> <if test="req.bussinessType != null and req.bussinessType !=''">
and bussiness_type=#{req.bussinessType} and bussiness_type=#{req.bussinessType}
</if> </if>
<if test="req.outInState != null and req.outInState !=''"> <if test="req.outInState != null and req.outInState !=''">
and out_in_state=#{req.outInState} and out_in_state=#{req.outInState}
</if> </if>
<if test="req.locationId != null and req.locationId !=''"> <if test="req.locationId != null and req.locationId !=''">
and location_id=#{req.locationId} and location_id=#{req.locationId}
</if> </if>
<if test="req.userName != null and req.userName !=''"> <if test="req.userName != null and req.userName !=''">
and user_name=#{req.userName} and user_name like CONCAT('%', #{req.userName}, '%')
</if> </if>
<if test="req.startTime != null and req.startTime != ''"> <if test="req.startTime != null and req.startTime != ''">
and use_time &gt;= #{req.startTime} and use_time &gt;= #{req.startTime}
</if> </if>
<if test="req.endTime != null and req.endTime != ''"> <if test="req.endTime != null and req.endTime != ''">
and use_time &lt;= #{req.endTime} and use_time &lt;= #{req.endTime}
</if> </if>
<if test="req.typeName != null and req.typeName !=''"> <if test="req.typeName != null and req.typeName !=''">
and epuipment_list like concat('%',#{req.typeName},'%') and equipment_List like concat('%',#{req.typeName},'%')
</if> </if>
<if test="req.column != null and req.column != '' and req.order != null and req.order != '' "> <if test="req.column != null and req.column != '' and req.order != null and req.order != '' ">
order by ${req.column} ${req.order} order by ${req.column} ${req.order}
</if> </if>
) as a ) as a
</select> </select>
<select id="RecordSumByOrderId" resultType="com.junmp.jyzb.api.bean.dto.LogSummaryDto"> <select id="RecordSumByOrderId" resultType="com.junmp.jyzb.api.bean.dto.LogSummaryDto">
select t.* from (
(SELECT
ls.order_code,
ls.order_main_id,
GROUP_CONCAT(DISTINCT COALESCE (NULLIF( ls.device_type, '' ))) AS device_type,
GROUP_CONCAT(DISTINCT COALESCE (NULLIF( ls.user_name, '' ))) AS user_name,
GROUP_CONCAT(DISTINCT COALESCE (NULLIF( ls.equipment_list, '' ))) AS equipment_list,
GROUP_CONCAT(DISTINCT COALESCE (NULLIF( ls.location_name, '' ))) AS location_name,
ls.bussiness_type,
ls.out_in_state,
sum(number) as number
FROM
base_log_summary ls
where ls.order_main_id is not null or ls.order_main_id !='' and ls.org_id=#{req.orgId}
and ls.create_time>#{req.startTime} and ls.create_time &lt; #{req.endTime} and ls.location_type=0
GROUP BY ls.order_main_id,ls.order_code,ls.bussiness_type,ls.out_in_state)
union all (
SELECT SELECT
ls.order_code, max(order_code) as order_code,
ls.order_main_id, order_main_id,
device_type, GROUP_CONCAT(DISTINCT COALESCE (NULLIF( device_type, '' ))) AS device_type,
user_name, GROUP_CONCAT(DISTINCT COALESCE (NULLIF( user_name, '' ))) AS user_name,
equipment_list, GROUP_CONCAT(DISTINCT COALESCE (NULLIF( equipment_list, '' ))) AS equipment_list,
location_name, GROUP_CONCAT(DISTINCT COALESCE (NULLIF( location_name, '' ))) AS location_name,
ls.bussiness_type, bussiness_type,
ls.out_in_state, out_in_state,
number sum(number) as number
FROM FROM
base_log_summary ls base_log_summary
where ls.order_main_id is null or ls.order_main_id ='' and ls.org_id=#{req.orgId} where (order_main_id is not null and order_main_id !='') and org_id=#{req.orgId}
and ls.create_time>#{req.startTime} and ls.create_time &lt; #{req.endTime} and ls.location_type=0 and create_time>#{req.startTime} and create_time &lt; #{req.endTime} and location_type=0
)) as t
having 1=1
<if test="req.outInState != null and req.outInState != ''"> <if test="req.outInState != null and req.outInState != ''">
and t.out_in_state =#{req.outInState} and out_in_state =#{req.outInState}
</if> </if>
<if test="req.bussinessType != null and req.bussinessType != ''"> <if test="req.bussinessType != null and req.bussinessType != ''">
and t.bussiness_type =#{req.bussinessType} and bussiness_type =#{req.bussinessType}
</if> </if>
<if test="req.locationName != null and req.locationName != ''"> <if test="req.locationName != null and req.locationName != ''">
and t.location_name =#{req.locationName} and location_name like CONCAT('%', #{req.locationName}, '%')
</if>
<if test="req.locationId != null and req.locationId != ''">
and location_id =#{req.locationId}
</if> </if>
<if test="req.typeName != null and req.typeName != ''"> <if test="req.typeName != null and req.typeName != ''">
and t.equipment_list =#{req.equipmentList} and equipment_list like CONCAT('%', #{req.typeName}, '%')
</if> </if>
<if test="req.userName != null and req.userName != ''"> <if test="req.userName != null and req.userName != ''">
and t.user_name =#{req.userName} and user_name like CONCAT('%', #{req.userName}, '%')
</if> </if>
GROUP BY order_main_id,bussiness_type,out_in_state
<if test="req.column != 'create_time' and req.column != null and req.column != '' and req.order != null and req.order != '' "> <if test="req.column != 'create_time' and req.column != null and req.column != '' and req.order != null and req.order != '' ">
order by ${req.column} ${req.order} order by ${req.column} ${req.order}
</if> </if>
<if test="pageNo != null and pageNo != '' and pageSize != null and pageSize != '' "> <if test="pageNo != null and pageNo != '' and pageSize != null and pageSize != '' ">
limit #{pageNo},#{pageSize} limit #{pageNo},#{pageSize}
</if> </if>
</select> </select>
<select id="RecordSumByOrderIdSum" resultType="com.junmp.jyzb.api.bean.dto.LogSummaryDto"> <select id="RecordSumByOrderIdSum" resultType="com.junmp.jyzb.api.bean.dto.LogSummaryDto">
select sum(number) as number,count(*) as count FROM ( select sum(number) as number,count(*) as count FROM (
select t.* FROM(
(SELECT
ls.order_code,
ls.order_main_id,
GROUP_CONCAT(DISTINCT COALESCE (NULLIF( ls.device_type, '' ))) AS device_type,
GROUP_CONCAT(DISTINCT COALESCE (NULLIF( ls.user_name, '' ))) AS user_name,
GROUP_CONCAT(DISTINCT COALESCE (NULLIF( ls.equipment_list, '' ))) AS equipment_list,
GROUP_CONCAT(DISTINCT COALESCE (NULLIF( ls.location_name, '' ))) AS location_name,
ls.bussiness_type,
sum(number) as number
FROM
base_log_summary ls
where ls.order_main_id is not null or ls.order_main_id !='' and ls.org_id=#{req.orgId}
and ls.create_time>#{req.startTime} and ls.create_time &lt; #{req.endTime} and ls.location_type=0
GROUP BY ls.order_main_id,ls.order_code,ls.bussiness_type)
union all (
SELECT SELECT
ls.order_code, max(order_code) as order_code,
ls.order_main_id, order_main_id,
device_type, GROUP_CONCAT(DISTINCT COALESCE (NULLIF( device_type, '' ))) AS device_type,
user_name, GROUP_CONCAT(DISTINCT COALESCE (NULLIF( user_name, '' ))) AS user_name,
equipment_list, GROUP_CONCAT(DISTINCT COALESCE (NULLIF( equipment_list, '' ))) AS equipment_list,
location_name, GROUP_CONCAT(DISTINCT COALESCE (NULLIF( location_name, '' ))) AS location_name,
ls.bussiness_type, bussiness_type,
number out_in_state,
sum(number) as number
FROM FROM
base_log_summary ls base_log_summary
where ls.order_main_id is null or ls.order_main_id ='' and ls.org_id=#{req.orgId} where (order_main_id is not null and order_main_id !='') and org_id=#{req.orgId}
and ls.create_time>#{req.startTime} and ls.create_time &lt; #{req.endTime} and ls.location_type=0 and create_time>#{req.startTime} and create_time &lt; #{req.endTime} and location_type=0
)) as t
having 1=1
<if test="req.outInState != null and req.outInState != ''"> <if test="req.outInState != null and req.outInState != ''">
and t.out_in_state =#{req.outInState} and out_in_state =#{req.outInState}
</if> </if>
<if test="req.bussinessType != null and req.bussinessType != ''"> <if test="req.bussinessType != null and req.bussinessType != ''">
and t.bussiness_type =#{req.bussinessType} and bussiness_type =#{req.bussinessType}
</if> </if>
<if test="req.locationName != null and req.locationName != ''"> <if test="req.locationName != null and req.locationName != ''">
and t.location_name =#{req.locationName} and location_name like CONCAT('%', #{req.locationName}, '%')
</if>
<if test="req.locationId != null and req.locationId != ''">
and location_id =#{req.locationId}
</if> </if>
<if test="req.typeName != null and req.typeName != ''"> <if test="req.typeName != null and req.typeName != ''">
and t.equipment_list =#{req.equipmentList} and equipment_list like CONCAT('%', #{req.typeName}, '%')
</if> </if>
<if test="req.userName != null and req.userName != ''"> <if test="req.userName != null and req.userName != ''">
and t.user_name =#{req.userName} and user_name like CONCAT('%', #{req.userName}, '%')
</if> </if>
GROUP BY order_main_id,bussiness_type,out_in_state
) as a ) as a
</select> </select>
......
...@@ -36,7 +36,7 @@ knife4j: ...@@ -36,7 +36,7 @@ knife4j:
spring: spring:
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.1.128:3306/db_jyzb?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT&nullCatalogMeansCurrent=true url: jdbc:mysql://192.168.1.128:3306/db_jyzb_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT&nullCatalogMeansCurrent=true
username: root username: root
password: 123456 password: 123456
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论