Merge branch 'master' of https://codeup.aliyun.com/bsdtec/biz-api-cloud
This commit is contained in:
commit
8ae983807a
19 files changed
+128
-24
No files matched your search
+4
@@ -37,4 +37,8 @@ public class CanteenErpMaterialSaveDTO {
|
||||
*/
|
||||
@Schema(description="库存下限")
|
||||
private Integer inventoryLowerLimit;
|
||||
|
||||
|
||||
@Schema(description="采购价格")
|
||||
private Integer purchasePrice;
|
||||
}
|
||||
+1
-1
@@ -86,7 +86,7 @@ public class CanteenInventoryRecordEditDTO {
|
||||
/**
|
||||
* @Link SmCgPlanEditItemDTO
|
||||
*/
|
||||
@Schema(description="item")
|
||||
@Schema(description="items")
|
||||
private List<CanteenInventoryRecordEditItemDTO> items;
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ public class CanteenInventoryRecordsdDTO {
|
||||
|
||||
|
||||
@Schema(description="入库明细")
|
||||
private List <CanteenInventoryRecordsItemDTO> canteenInventoryRecordsItemDTOS;
|
||||
private List <CanteenInventoryRecordsItemDTO> items;
|
||||
|
||||
|
||||
}
|
||||
+5
@@ -90,5 +90,10 @@ public class CanteenErpMaterialEntity extends Model<CanteenErpMaterialEntity> {
|
||||
private Long tenantId;
|
||||
|
||||
|
||||
/**
|
||||
* 采购价格
|
||||
*/
|
||||
@Schema(description="采购价格")
|
||||
private Integer purchasePrice;
|
||||
|
||||
}
|
||||
+4
@@ -43,4 +43,8 @@ public class CanteenErpMaterialVO {
|
||||
|
||||
@Schema(description="当前总库存")
|
||||
private Double currentStock;
|
||||
|
||||
|
||||
@Schema(description="采购价格")
|
||||
private Integer purchasePrice;
|
||||
}
|
||||
+4
@@ -33,4 +33,8 @@ public class ErpMaterialPageVo {
|
||||
*/
|
||||
@Schema(description="当前库存数量")
|
||||
private Double stock;
|
||||
|
||||
|
||||
@Schema(description="采购价格")
|
||||
private Integer purchasePrice;
|
||||
}
|
||||
+9
@@ -22,6 +22,9 @@ public class InventoryRecordItemVo {
|
||||
@Schema(description="食材id")
|
||||
private Long erpMaterialId;
|
||||
|
||||
@Schema(description="食材名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 主表id
|
||||
*/
|
||||
@@ -45,6 +48,12 @@ public class InventoryRecordItemVo {
|
||||
@Schema(description="累计总金额")
|
||||
private Integer totalAmount;
|
||||
|
||||
/**
|
||||
* 累计数量
|
||||
*/
|
||||
@Schema(description="累计数量")
|
||||
private Integer totalNumber;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
||||
+3
-1
@@ -44,6 +44,7 @@ public class CanteenErpMaterialServiceImpl extends ServiceImpl<CanteenErpMateria
|
||||
canteenErpMaterialEntity.setName(canteenErpMaterialSaveDTO.getName());
|
||||
canteenErpMaterialEntity.setUnit(canteenErpMaterialSaveDTO.getUnit());
|
||||
canteenErpMaterialEntity.setDeptId(deptId);
|
||||
canteenErpMaterialEntity.setPurchasePrice(canteenErpMaterialSaveDTO.getPurchasePrice());
|
||||
int insert = baseMapper.insert(canteenErpMaterialEntity);
|
||||
CanteenStockEntity canteenStockEntity = new CanteenStockEntity();
|
||||
canteenStockEntity.setItemType("1");
|
||||
@@ -64,6 +65,7 @@ public class CanteenErpMaterialServiceImpl extends ServiceImpl<CanteenErpMateria
|
||||
canteenErpMaterialEntity.setId(id);
|
||||
canteenErpMaterialEntity.setName(canteenErpMaterialEditorDTO.getName());
|
||||
canteenErpMaterialEntity.setUnit(canteenErpMaterialEditorDTO.getUnit());
|
||||
canteenErpMaterialEntity.setPurchasePrice(canteenErpMaterialEditorDTO.getPurchasePrice());
|
||||
|
||||
LambdaQueryWrapper<CanteenStockEntity> canteenStockEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
canteenStockEntityLambdaQueryWrapper.eq(CanteenStockEntity::getItemId, id);
|
||||
@@ -75,7 +77,6 @@ public class CanteenErpMaterialServiceImpl extends ServiceImpl<CanteenErpMateria
|
||||
canteenStockEntity.setCurrentStock(canteenErpMaterialEditorDTO.getBaseStock()+(sourceCanteenStockEntity.getCurrentStock()-sourceCanteenStockEntity.getBaseStock()));
|
||||
canteenStockEntity.setInventoryUpperLimit(canteenErpMaterialEditorDTO.getInventoryUpperLimit());
|
||||
canteenStockEntity.setInventoryLowerLimit(canteenErpMaterialEditorDTO.getInventoryLowerLimit());
|
||||
|
||||
int i = baseMapper.updateById(canteenErpMaterialEntity);
|
||||
canteenStockMapper.update(canteenStockEntity,
|
||||
new LambdaQueryWrapper<CanteenStockEntity>().eq(CanteenStockEntity::getItemId, id));
|
||||
@@ -103,6 +104,7 @@ public class CanteenErpMaterialServiceImpl extends ServiceImpl<CanteenErpMateria
|
||||
canteenErpMaterialVO.setInventoryUpperLimit(sourceCanteenStockEntity.getInventoryUpperLimit());
|
||||
canteenErpMaterialVO.setInventoryLowerLimit(sourceCanteenStockEntity.getInventoryLowerLimit());
|
||||
canteenErpMaterialVO.setCurrentStock(sourceCanteenStockEntity.getCurrentStock());
|
||||
canteenErpMaterialVO.setPurchasePrice(canteenErpMaterialEntity.getPurchasePrice());
|
||||
return canteenErpMaterialVO;
|
||||
}
|
||||
|
||||
|
||||
+9
-5
@@ -5,13 +5,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.canteen.constant.OrderTypeEnum;
|
||||
import com.bsd.pjcloud.canteen.dto.erp.*;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenErpMaterialEntity;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsEntity;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsItemEntity;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenProductionRecordEntity;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenInventoryRecordsItemMapper;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenInventoryRecordsMapper;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenProductionRecordItemMapper;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenStockMapper;
|
||||
import com.bsd.pjcloud.canteen.mapper.*;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenInventoryRecordsService;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenStockService;
|
||||
import com.bsd.pjcloud.canteen.vo.erp.CanteenProductionRecordPageVO;
|
||||
@@ -47,6 +45,8 @@ public class CanteenInventoryRecordsServiceImpl extends ServiceImpl<CanteenInven
|
||||
private final CanteenStockMapper canteenStockMapper;
|
||||
|
||||
private final CanteenStockService canteenStockService;
|
||||
|
||||
private final CanteenErpMaterialMapper canteenErpMaterialMapper;
|
||||
@Override
|
||||
@Transactional
|
||||
public Object saveCanteenInventoryRecordsdDTO(CanteenInventoryRecordsdDTO canteenInventoryRecordsdDTO) {
|
||||
@@ -58,7 +58,7 @@ public class CanteenInventoryRecordsServiceImpl extends ServiceImpl<CanteenInven
|
||||
baseMapper.insert(canteenInventoryRecordsEntity);
|
||||
Long id = canteenInventoryRecordsEntity.getId();
|
||||
|
||||
List<CanteenInventoryRecordsItemDTO> canteenInventoryRecordsItemDTOS = canteenInventoryRecordsdDTO.getCanteenInventoryRecordsItemDTOS();
|
||||
List<CanteenInventoryRecordsItemDTO> canteenInventoryRecordsItemDTOS = canteenInventoryRecordsdDTO.getItems();
|
||||
List<CanteenInventoryRecordsItemEntity> canteenInventoryRecordsItemEntityList = BeanUtils.toBean(canteenInventoryRecordsItemDTOS, CanteenInventoryRecordsItemEntity.class);
|
||||
|
||||
|
||||
@@ -185,6 +185,10 @@ public class CanteenInventoryRecordsServiceImpl extends ServiceImpl<CanteenInven
|
||||
|
||||
InventoryRecordVo bean = BeanUtils.toBean(smErpInventoryRecordsEntity, InventoryRecordVo.class, (source) -> {
|
||||
List<InventoryRecordItemVo> smeErpCgPlanItemVos = BeanUtils.toBean(list, InventoryRecordItemVo.class);
|
||||
smeErpCgPlanItemVos.stream().forEach(item -> {
|
||||
CanteenErpMaterialEntity canteenErpMaterialEntity = canteenErpMaterialMapper.selectById(item.getErpMaterialId());
|
||||
item.setName(canteenErpMaterialEntity.getName());
|
||||
});
|
||||
source.setItems(smeErpCgPlanItemVos);
|
||||
});
|
||||
|
||||
|
||||
+5
-1
@@ -151,7 +151,11 @@ public class CanteenSpuServiceImpl extends ServiceImpl<CanteenSpuMapper, Canteen
|
||||
List<CanteenSpuSimpleVO> canteenSpuSimpleVOList = BeanUtils.toBean(pageData.getRecords(), CanteenSpuSimpleVO.class);
|
||||
Page<CanteenSpuSimpleVO> canteenSpuSimpleVOPage = new Page<>();
|
||||
canteenSpuSimpleVOPage.setRecords(canteenSpuSimpleVOList);
|
||||
org.springframework.beans.BeanUtils.copyProperties(pageData, pageData, "records"); // 复制分页参数
|
||||
pageData.setCurrent(pageData.getCurrent());
|
||||
canteenSpuSimpleVOPage.setPages(pageData.getPages());
|
||||
canteenSpuSimpleVOPage.setSize(pageData.getSize());
|
||||
canteenSpuSimpleVOPage.setTotal(pageData.getTotal());
|
||||
// 复制分页参数
|
||||
return canteenSpuSimpleVOPage;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class CanteenStockServiceImpl extends ServiceImpl<CanteenStockMapper, Can
|
||||
updateStockWithLockWrapper.eq(CanteenStockEntity::getVersion,smErpStockEntity.getVersion());
|
||||
CanteenStockEntity updateSmErpStockEntity = new CanteenStockEntity();
|
||||
Double currentStock = smErpStockEntity.getCurrentStock();
|
||||
if (currentStock<Math.abs(item.getIncrCount())){
|
||||
if (item.getIncrCount()<0 &¤tStock<Math.abs(item.getIncrCount())){
|
||||
LambdaQueryWrapper<CanteenErpMaterialEntity> canteenErpMaterialEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
canteenErpMaterialEntityLambdaQueryWrapper.eq(CanteenErpMaterialEntity::getId,item.getId());
|
||||
CanteenErpMaterialEntity canteenErpMaterialEntity = canteenErpMaterialMapper.selectOne(canteenErpMaterialEntityLambdaQueryWrapper);
|
||||
|
||||
+2
@@ -14,12 +14,14 @@
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
<result property="purchasePrice" column="purchase_price"/>
|
||||
</resultMap>
|
||||
<select id="selectPageDataByScope" resultType="com.bsd.pjcloud.canteen.vo.erp.CanteenErpMaterialVO">
|
||||
SELECT
|
||||
m.id,
|
||||
m.name,
|
||||
m.unit,
|
||||
m.purchase_price,
|
||||
s.base_stock AS baseStock,
|
||||
s.inventory_upper_limit AS inventoryUpperLimit,
|
||||
s.inventory_lower_limit AS inventoryLowerLimit,
|
||||
|
||||
+2
-1
@@ -48,6 +48,7 @@
|
||||
and cpr.production_time = #{inventoryDate}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY r.id;
|
||||
GROUP BY r.id
|
||||
order by r.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.bsd.pjcloud.integrated.vo.meeting.app;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class EquipmentVo {
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@Schema(description="设备名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 设备数量
|
||||
*/
|
||||
@Schema(description="设备数量")
|
||||
private Integer quantity;
|
||||
}
|
||||
+2
@@ -68,6 +68,8 @@ public class MeetingRoomPageVo {
|
||||
private String availableTime;
|
||||
|
||||
|
||||
@Schema(description="设备名称")
|
||||
private List<EquipmentVo> equipmentNames;
|
||||
|
||||
|
||||
}
|
||||
+2
-2
@@ -143,10 +143,10 @@ public class MeetingRoomController {
|
||||
|
||||
|
||||
/**---------------------------APP------------------------------*/
|
||||
@GetMapping("/app/list")
|
||||
@GetMapping("/app/page")
|
||||
public R<Page<MeetingRoomPageVo>> appList(@ParameterObject Page page, @ParameterObject MeetingRoomEntity meetingRoom) {
|
||||
LambdaQueryWrapper<MeetingRoomEntity> meetingRoomEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
meetingRoomEntityLambdaQueryWrapper.eq(MeetingRoomEntity::getStatus, YesNoEnum.YES.getCode());
|
||||
meetingRoomEntityLambdaQueryWrapper.eq(MeetingRoomEntity::getStatus, YesNoEnum.NO.getCode());
|
||||
meetingRoomEntityLambdaQueryWrapper.orderByDesc(MeetingRoomEntity::getSort).orderByDesc(MeetingRoomEntity::getId);
|
||||
|
||||
Page<MeetingRoomPageVo> pageData = meetingRoomService.MeetingRoomPageScope(page, meetingRoomEntityLambdaQueryWrapper);
|
||||
|
||||
+6
@@ -4,8 +4,14 @@ import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.integrated.entity.MeetingBookingEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface MeetingBookingMapper extends PjcloudBaseMapper<MeetingBookingEntity> {
|
||||
|
||||
|
||||
|
||||
|
||||
List<MeetingBookingEntity> findByRoomIdAndDate(Long roomId, LocalDate date);
|
||||
}
|
||||
+44
-11
@@ -4,13 +4,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.integrated.entity.MeetingBookingEntity;
|
||||
import com.bsd.pjcloud.integrated.entity.MeetingEquipmentEntity;
|
||||
import com.bsd.pjcloud.integrated.entity.MeetingRoomEntity;
|
||||
import com.bsd.pjcloud.integrated.entity.MeetingRoomEquipmentEntity;
|
||||
import com.bsd.pjcloud.integrated.mapper.MeetingBookingMapper;
|
||||
import com.bsd.pjcloud.integrated.mapper.MeetingEquipmentMapper;
|
||||
import com.bsd.pjcloud.integrated.mapper.MeetingRoomEquipmentMapper;
|
||||
import com.bsd.pjcloud.integrated.mapper.MeetingRoomMapper;
|
||||
import com.bsd.pjcloud.integrated.service.MeetingRoomService;
|
||||
import com.bsd.pjcloud.integrated.vo.meeting.app.EquipmentVo;
|
||||
import com.bsd.pjcloud.integrated.vo.meeting.app.MeetingRoomPageVo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -18,10 +21,8 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -37,6 +38,7 @@ public class MeetingRoomServiceImpl extends ServiceImpl<MeetingRoomMapper, Meeti
|
||||
private final MeetingRoomEquipmentMapper meetingRoomEquipmentMapper;
|
||||
private final MeetingEquipmentMapper meetingEquipmentMapper;
|
||||
|
||||
private final MeetingBookingMapper meetingBookingMapper ;
|
||||
@Override
|
||||
public Object pageScope(Page page, LambdaQueryWrapper<MeetingRoomEntity> wrapper) {
|
||||
return baseMapper.selectPageByScope(page, wrapper, DataScope.of());
|
||||
@@ -157,21 +159,31 @@ public class MeetingRoomServiceImpl extends ServiceImpl<MeetingRoomMapper, Meeti
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 3.1 批量查询设备关联信息
|
||||
// Map<Long, List<MeetingRoomEquipmentEntity>> equipmentMap = getRoomEquipmentMap(roomIds);
|
||||
Map<Long, List<MeetingRoomEquipmentEntity>> equipmentMap = getRoomEquipmentMap(roomIds);
|
||||
|
||||
LocalDate today = LocalDate.now();
|
||||
// 4. 转换记录列表
|
||||
List<MeetingRoomPageVo> voRecords = entityPage.getRecords().stream().map(entity -> {
|
||||
List<String> timeline = buildTimelineForRoom(entity.getId(), today);
|
||||
|
||||
MeetingRoomPageVo vo = new MeetingRoomPageVo();
|
||||
// 4.1 基础字段拷贝
|
||||
BeanUtils.copyProperties(entity, vo);
|
||||
|
||||
// 4.2 设置设备信息
|
||||
// List<MeetingRoomEquipmentEntity> equipments = equipmentMap.get(entity.getId());
|
||||
// if (!CollectionUtils.isEmpty(equipments)) {
|
||||
// vo.setEquipmentNames(equipments.stream()
|
||||
// .map(MeetingRoomEquipmentEntity::getEquipmentName)
|
||||
// .collect(Collectors.toList()));
|
||||
// }
|
||||
List<MeetingRoomEquipmentEntity> equipments = equipmentMap.get(entity.getId());
|
||||
List<EquipmentVo> equipmentVos = new ArrayList<EquipmentVo>();
|
||||
|
||||
if (!CollectionUtils.isEmpty(equipments)) {
|
||||
equipments.forEach(roomEquip -> {
|
||||
EquipmentVo equipmentVo = new EquipmentVo();
|
||||
equipmentVo.setName(roomEquip.getEquipmentName());
|
||||
equipmentVo.setQuantity(roomEquip.getQuantity());
|
||||
equipmentVos.add(equipmentVo);
|
||||
});
|
||||
|
||||
}
|
||||
vo.setEquipmentNames(equipmentVos);
|
||||
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
@@ -179,6 +191,7 @@ public class MeetingRoomServiceImpl extends ServiceImpl<MeetingRoomMapper, Meeti
|
||||
voPage.setRecords(voRecords);
|
||||
return voPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取会议室设备关联信息
|
||||
*/
|
||||
@@ -214,4 +227,24 @@ public class MeetingRoomServiceImpl extends ServiceImpl<MeetingRoomMapper, Meeti
|
||||
return equipmentList.stream()
|
||||
.collect(Collectors.groupingBy(MeetingRoomEquipmentEntity::getRoomId));
|
||||
}
|
||||
|
||||
|
||||
public List<String> buildTimelineForRoom(Long roomId, LocalDate date) {
|
||||
int startHour = 8, endHour = 24, slotCount = endHour - startHour;
|
||||
List<String> timeline = new ArrayList<>(Collections.nCopies(slotCount, "free"));
|
||||
List<MeetingBookingEntity> bookings = meetingBookingMapper.findByRoomIdAndDate(roomId, date);
|
||||
for (MeetingBookingEntity booking : bookings) {
|
||||
int bookingStart = booking.getStartTime().getHour();
|
||||
int bookingEnd = booking.getEndTime().getHour();
|
||||
for (int h = bookingStart; h < bookingEnd; h++) {
|
||||
int idx = h - startHour;
|
||||
if (idx >= 0 && idx < slotCount) {
|
||||
timeline.set(idx, "busy");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 例:12:00-13:00 不可用
|
||||
timeline.set(4, "disabled");
|
||||
return timeline;
|
||||
}
|
||||
}
|
||||
+3
@@ -21,4 +21,7 @@
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
<select id="findByRoomIdAndDate" resultType="com.bsd.pjcloud.integrated.entity.MeetingBookingEntity">
|
||||
SELECT * FROM meeting_booking WHERE room_id = #{roomId} AND start_time >= #{startTime} AND start_time <= #{endTime}
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in new issue
Block a user