master:后台管理系统BUG修改;
parent
b97d7b2f2b
commit
a36f3e27bd
|
|
@ -41,9 +41,9 @@ public class StoreFactoryController extends XktBaseController {
|
|||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')||@ss.hasSupplierSubRole()")
|
||||
@ApiOperation(value = "生产需求管理 工厂下拉列表", httpMethod = "GET", response = R.class)
|
||||
@GetMapping("/list")
|
||||
public R<List<StoreFactoryResVO>> getList() {
|
||||
return R.ok(BeanUtil.copyToList(storeFactoryService.getList(), StoreFactoryResVO.class));
|
||||
@GetMapping("/list/{storeId}")
|
||||
public R<List<StoreFactoryResVO>> getList(@PathVariable Long storeId) {
|
||||
return R.ok(BeanUtil.copyToList(storeFactoryService.getList(storeId), StoreFactoryResVO.class));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')||@ss.hasSupplierSubRole()")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,20 @@
|
|||
package com.ruoyi.web.controller.xkt;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.XktBaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.web.controller.xkt.vo.storeProductDemandDetail.StoreProdDemandDetailUpdateVO;
|
||||
import com.ruoyi.xkt.dto.storeProductDemandDetail.StoreProdDemandDetailUpdateDTO;
|
||||
import com.ruoyi.xkt.service.IStoreProductDemandDetailService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
|
@ -10,8 +24,21 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
* @author ruoyi
|
||||
* @date 2025-03-26
|
||||
*/
|
||||
@Api(tags = "档口商品需求单明细")
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rest/v1/prod-demand-details")
|
||||
public class StoreProductDemandDetailController extends XktBaseController {
|
||||
|
||||
final IStoreProductDemandDetailService demandDetailService;
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')||@ss.hasSupplierSubRole()")
|
||||
@ApiOperation(value = "编辑商品需求明细数量", httpMethod = "PUT", response = R.class)
|
||||
@Log(title = "编辑商品需求明细数量", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/quantity")
|
||||
public R<Integer> updateDetailQuantity(@Validated @RequestBody StoreProdDemandDetailUpdateVO updateVO) {
|
||||
return R.ok(demandDetailService.updateDetailQuantity(BeanUtil.toBean(updateVO, StoreProdDemandDetailUpdateDTO.class)));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.storeProductDemandDetail;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
public class StoreProdDemandDetailUpdateVO {
|
||||
|
||||
@NotNull(message = "商品需求明细ID不能为空")
|
||||
@ApiModelProperty(value = "商品需求明细ID", required = true)
|
||||
private Long storeProdDemandDetailId;
|
||||
@ApiModelProperty(value = "尺码30")
|
||||
private Integer size30;
|
||||
@ApiModelProperty(value = "尺码31")
|
||||
private Integer size31;
|
||||
@ApiModelProperty(value = "尺码32")
|
||||
private Integer size32;
|
||||
@ApiModelProperty(value = "尺码33")
|
||||
private Integer size33;
|
||||
@ApiModelProperty(value = "尺码34")
|
||||
private Integer size34;
|
||||
@ApiModelProperty(value = "尺码35")
|
||||
private Integer size35;
|
||||
@ApiModelProperty(value = "尺码36")
|
||||
private Integer size36;
|
||||
@ApiModelProperty(value = "尺码37")
|
||||
private Integer size37;
|
||||
@ApiModelProperty(value = "尺码38")
|
||||
private Integer size38;
|
||||
@ApiModelProperty(value = "尺码39")
|
||||
private Integer size39;
|
||||
@ApiModelProperty(value = "尺码40")
|
||||
private Integer size40;
|
||||
@ApiModelProperty(value = "尺码41")
|
||||
private Integer size41;
|
||||
@ApiModelProperty(value = "尺码42")
|
||||
private Integer size42;
|
||||
@ApiModelProperty(value = "尺码43")
|
||||
private Integer size43;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.ruoyi.xkt.dto.storeProductDemandDetail;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
public class StoreProdDemandDetailUpdateDTO {
|
||||
|
||||
@ApiModelProperty(value = "商品需求明细ID")
|
||||
private Long storeProdDemandDetailId;
|
||||
@ApiModelProperty(value = "尺码30")
|
||||
private Integer size30;
|
||||
@ApiModelProperty(value = "尺码31")
|
||||
private Integer size31;
|
||||
@ApiModelProperty(value = "尺码32")
|
||||
private Integer size32;
|
||||
@ApiModelProperty(value = "尺码33")
|
||||
private Integer size33;
|
||||
@ApiModelProperty(value = "尺码34")
|
||||
private Integer size34;
|
||||
@ApiModelProperty(value = "尺码35")
|
||||
private Integer size35;
|
||||
@ApiModelProperty(value = "尺码36")
|
||||
private Integer size36;
|
||||
@ApiModelProperty(value = "尺码37")
|
||||
private Integer size37;
|
||||
@ApiModelProperty(value = "尺码38")
|
||||
private Integer size38;
|
||||
@ApiModelProperty(value = "尺码39")
|
||||
private Integer size39;
|
||||
@ApiModelProperty(value = "尺码40")
|
||||
private Integer size40;
|
||||
@ApiModelProperty(value = "尺码41")
|
||||
private Integer size41;
|
||||
@ApiModelProperty(value = "尺码42")
|
||||
private Integer size42;
|
||||
@ApiModelProperty(value = "尺码43")
|
||||
private Integer size43;
|
||||
|
||||
}
|
||||
|
|
@ -5,8 +5,10 @@ import com.ruoyi.xkt.domain.StoreProductDemandDetail;
|
|||
import com.ruoyi.xkt.dto.storeProductDemand.StoreProdDemandPageDTO;
|
||||
import com.ruoyi.xkt.dto.storeProductDemand.StoreProdDemandPageResDTO;
|
||||
import com.ruoyi.xkt.dto.storeProductDemand.StoreProdDemandSimpleDTO;
|
||||
import com.ruoyi.xkt.dto.storeProductDemand.StoreProdDemandStatusCountResDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -33,4 +35,15 @@ public interface StoreProductDemandDetailMapper extends BaseMapper<StoreProductD
|
|||
*/
|
||||
List<StoreProdDemandSimpleDTO> selectDemandCodeList(@Param("detailIdList") List<Long> detailIdList);
|
||||
|
||||
/**
|
||||
* 查询各状态数量
|
||||
*
|
||||
* @param storeId 档口ID
|
||||
* @param sixMonthAgo 六个月前的时间
|
||||
* @param now 当前时间
|
||||
* @return StoreProdDemandStatusCountResDTO
|
||||
*/
|
||||
StoreProdDemandStatusCountResDTO getStatusNum(@Param("storeId") Long storeId,
|
||||
@Param("sixMonthAgo") Date sixMonthAgo,
|
||||
@Param("now") Date now);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,15 +33,4 @@ public interface StoreProductDemandMapper extends BaseMapper<StoreProductDemand>
|
|||
*/
|
||||
void deleteDemandList(@Param("deleteDemandIdList") List<Long> deleteDemandIdList);
|
||||
|
||||
/**
|
||||
* 查询各状态数量
|
||||
*
|
||||
* @param storeId 档口ID
|
||||
* @param sixMonthAgo 六个月前的时间
|
||||
* @param now 当前时间
|
||||
* @return StoreProdDemandStatusCountResDTO
|
||||
*/
|
||||
StoreProdDemandStatusCountResDTO getStatusNum(@Param("storeId") Long storeId,
|
||||
@Param("sixMonthAgo") Date sixMonthAgo,
|
||||
@Param("now") Date now);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,8 +75,9 @@ public interface IStoreFactoryService {
|
|||
/**
|
||||
* 获取所有的工厂列表
|
||||
*
|
||||
* @param storeId 档口ID
|
||||
* @return 生产需求管理 工厂下拉列表
|
||||
*/
|
||||
List<StoreFactoryResDTO> getList();
|
||||
List<StoreFactoryResDTO> getList(Long storeId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.ruoyi.xkt.service;
|
||||
|
||||
import com.ruoyi.xkt.dto.storeProductDemandDetail.StoreProdDemandDetailUpdateDTO;
|
||||
|
||||
/**
|
||||
* 档口商品需求单明细Service接口
|
||||
*
|
||||
|
|
@ -8,4 +10,12 @@ package com.ruoyi.xkt.service;
|
|||
*/
|
||||
public interface IStoreProductDemandDetailService {
|
||||
|
||||
/**
|
||||
* 更新商品需求单明细数量
|
||||
*
|
||||
* @param updateDTO 更新入参
|
||||
* @return 更新数量
|
||||
*/
|
||||
Integer updateDetailQuantity(StoreProdDemandDetailUpdateDTO updateDTO);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,12 +95,13 @@ public class StoreFactoryServiceImpl implements IStoreFactoryService {
|
|||
* 获取所有的工厂列表
|
||||
*
|
||||
* @return 生产需求管理 工厂下拉列表
|
||||
* @param storeId 档口ID
|
||||
*/
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<StoreFactoryResDTO> getList() {
|
||||
public List<StoreFactoryResDTO> getList(Long storeId) {
|
||||
List<StoreFactory> storeFactoryList = this.storeFactoryMapper.selectList(new LambdaQueryWrapper<StoreFactory>()
|
||||
.eq(StoreFactory::getDelFlag, Constants.UNDELETED));
|
||||
.eq(StoreFactory::getDelFlag, Constants.UNDELETED).eq(StoreFactory::getStoreId, storeId));
|
||||
return BeanUtil.copyToList(storeFactoryList, StoreFactoryResDTO.class);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,18 @@
|
|||
package com.ruoyi.xkt.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.xkt.domain.StoreProductDemandDetail;
|
||||
import com.ruoyi.xkt.dto.storeProductDemandDetail.StoreProdDemandDetailUpdateDTO;
|
||||
import com.ruoyi.xkt.mapper.StoreProductDemandDetailMapper;
|
||||
import com.ruoyi.xkt.service.IStoreProductDemandDetailService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 档口商品需求单明细Service业务层处理
|
||||
|
|
@ -10,6 +21,46 @@ import org.springframework.stereotype.Service;
|
|||
* @date 2025-03-26
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class StoreProductDemandDetailServiceImpl implements IStoreProductDemandDetailService {
|
||||
|
||||
final StoreProductDemandDetailMapper demandDetailMapper;
|
||||
|
||||
/**
|
||||
* 更新商品需求单明细数量
|
||||
*
|
||||
* @param updateDTO 更新入参
|
||||
* @return 更新数量
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public Integer updateDetailQuantity(StoreProdDemandDetailUpdateDTO updateDTO) {
|
||||
StoreProductDemandDetail demandDetail = Optional.ofNullable(this.demandDetailMapper.selectOne(new LambdaQueryWrapper<StoreProductDemandDetail>()
|
||||
.eq(StoreProductDemandDetail::getId, updateDTO.getStoreProdDemandDetailId()).eq(StoreProductDemandDetail::getDelFlag, Constants.UNDELETED)))
|
||||
.orElseThrow(() -> new ServiceException("商品需求单明细不存在!", HttpStatus.ERROR));
|
||||
// 如果数量为0,则设置为null
|
||||
demandDetail.setSize30(this.convertZeroToNull(updateDTO.getSize30()));
|
||||
demandDetail.setSize31(this.convertZeroToNull(updateDTO.getSize31()));
|
||||
demandDetail.setSize32(this.convertZeroToNull(updateDTO.getSize32()));
|
||||
demandDetail.setSize33(this.convertZeroToNull(updateDTO.getSize33()));
|
||||
demandDetail.setSize34(this.convertZeroToNull(updateDTO.getSize34()));
|
||||
demandDetail.setSize35(this.convertZeroToNull(updateDTO.getSize35()));
|
||||
demandDetail.setSize36(this.convertZeroToNull(updateDTO.getSize36()));
|
||||
demandDetail.setSize37(this.convertZeroToNull(updateDTO.getSize37()));
|
||||
demandDetail.setSize38(this.convertZeroToNull(updateDTO.getSize38()));
|
||||
demandDetail.setSize39(this.convertZeroToNull(updateDTO.getSize39()));
|
||||
demandDetail.setSize40(this.convertZeroToNull(updateDTO.getSize40()));
|
||||
demandDetail.setSize41(this.convertZeroToNull(updateDTO.getSize41()));
|
||||
demandDetail.setSize42(this.convertZeroToNull(updateDTO.getSize42()));
|
||||
demandDetail.setSize43(this.convertZeroToNull(updateDTO.getSize43()));
|
||||
return this.demandDetailMapper.updateById(demandDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将0值转换为null
|
||||
*/
|
||||
private Integer convertZeroToNull(Integer value) {
|
||||
return value == null || value == 0 ? null : value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class StoreProductDemandServiceImpl implements IStoreProductDemandService
|
|||
public StoreProdDemandStatusCountResDTO getStatusNum(Long storeId) {
|
||||
final Date now = java.sql.Date.valueOf(LocalDate.now().plusDays(1));
|
||||
final Date sixMonthAgo = java.sql.Date.valueOf(LocalDate.now().minusMonths(6));
|
||||
return this.storeProdDemandMapper.getStatusNum(storeId, sixMonthAgo, now);
|
||||
return this.storeProdDemandDetailMapper.getStatusNum(storeId, sixMonthAgo, now);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ import org.apache.commons.lang3.ObjectUtils;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -43,8 +46,23 @@ public class StoreProductStorageDetailServiceImpl implements IStoreProductStorag
|
|||
if (CollectionUtils.isNotEmpty(exportDTO.getStoreProdStorageIdList())) {
|
||||
return this.storageDetailMapper.selectExportList(exportDTO.getStoreProdStorageIdList());
|
||||
} else {
|
||||
// 没有传时间,则设置当前时间往前推半年
|
||||
if (ObjectUtils.isEmpty(exportDTO.getVoucherDateStart()) && ObjectUtils.isEmpty(exportDTO.getVoucherDateEnd())) {
|
||||
throw new ServiceException("全量导出时,开始时间和结束时间不能为空!", HttpStatus.ERROR);
|
||||
exportDTO.setVoucherDateEnd(java.sql.Date.valueOf(LocalDate.now()));
|
||||
exportDTO.setVoucherDateEnd(java.sql.Date.valueOf(LocalDate.now().minusMonths(6)));
|
||||
} else {
|
||||
LocalDate start = exportDTO.getVoucherDateStart().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
LocalDate end = exportDTO.getVoucherDateEnd().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
// 确保开始日期不大于结束日期
|
||||
if (start.isAfter(end)) {
|
||||
throw new ServiceException("开始时间不能晚于结束时间!", HttpStatus.ERROR);
|
||||
}
|
||||
// 计算两个日期之间的确切月数差异
|
||||
long monthsBetween = ChronoUnit.MONTHS.between(start, end);
|
||||
// 检查是否超过6个月(允许恰好6个月)
|
||||
if (monthsBetween > 6 || (monthsBetween == 6 && start.plusMonths(6).isBefore(end))) {
|
||||
throw new ServiceException("导出时间间隔不能超过6个月!", HttpStatus.ERROR);
|
||||
}
|
||||
}
|
||||
return this.storageDetailMapper.selectExportListVoucherDateBetween(exportDTO.getVoucherDateStart(), exportDTO.getVoucherDateEnd());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.Period;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -221,14 +221,16 @@ public class StoreSaleServiceImpl implements IStoreSaleService {
|
|||
exportDTO.setVoucherDateEnd(java.sql.Date.valueOf(LocalDate.now()));
|
||||
exportDTO.setVoucherDateEnd(java.sql.Date.valueOf(LocalDate.now().minusMonths(6)));
|
||||
} else {
|
||||
// 开始时间和结束时间,相间隔不能超过6个月
|
||||
LocalDate start = exportDTO.getVoucherDateStart().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
LocalDate end = exportDTO.getVoucherDateEnd().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
// 计算两个日期之间的年、月、日差值
|
||||
Period period = Period.between(start, end);
|
||||
// 如果总月数超过6个月,则返回 true
|
||||
int totalMonths = period.getYears() * 12 + period.getMonths();
|
||||
if (Math.abs(totalMonths) > 6) {
|
||||
// 确保开始日期不大于结束日期
|
||||
if (start.isAfter(end)) {
|
||||
throw new ServiceException("开始时间不能晚于结束时间!", HttpStatus.ERROR);
|
||||
}
|
||||
// 计算两个日期之间的确切月数差异
|
||||
long monthsBetween = ChronoUnit.MONTHS.between(start, end);
|
||||
// 检查是否超过6个月(允许恰好6个月)
|
||||
if (monthsBetween > 6 || (monthsBetween == 6 && start.plusMonths(6).isBefore(end))) {
|
||||
throw new ServiceException("导出时间间隔不能超过6个月!", HttpStatus.ERROR);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,4 +43,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getStatusNum" resultType="com.ruoyi.xkt.dto.storeProductDemand.StoreProdDemandStatusCountResDTO">
|
||||
SELECT
|
||||
COALESCE ( SUM( CASE WHEN spdd.detail_status = 1 THEN 1 ELSE 0 END ), 0 ) AS unProductionNum,
|
||||
COALESCE ( SUM( CASE WHEN spdd.detail_status = 2 THEN 1 ELSE 0 END ), 0 ) AS inProductionNum,
|
||||
COALESCE ( SUM( CASE WHEN spdd.detail_status = 3 THEN 1 ELSE 0 END ), 0 ) AS productionCompleteNum
|
||||
FROM
|
||||
store_product_demand_detail spdd
|
||||
WHERE
|
||||
spdd.del_flag = 0 AND spdd.store_id = #{storeId}
|
||||
AND spdd.create_time between #{sixMonthAgo} AND #{now}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -25,19 +25,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="getStatusNum" resultType="com.ruoyi.xkt.dto.storeProductDemand.StoreProdDemandStatusCountResDTO">
|
||||
SELECT
|
||||
COALESCE(SUM(CASE WHEN spd.demand_status = 1 THEN 1 ELSE 0 END),0) AS unProductionNum,
|
||||
COALESCE(SUM(CASE WHEN spd.demand_status = 2 THEN 1 ELSE 0 END),0) AS inProductionNum,
|
||||
COALESCE(SUM(CASE WHEN spd.demand_status = 3 THEN 1 ELSE 0 END),0) AS productionCompleteNum
|
||||
FROM
|
||||
store_product_demand spd
|
||||
WHERE
|
||||
spd.del_flag = 0 AND spd.store_id = #{storeId}
|
||||
AND spd.create_time between #{sixMonthAgo} AND #{now}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue