测试问题修复
This commit is contained in:
		
							parent
							
								
									842390d66f
								
							
						
					
					
						commit
						7fb8c4fb77
					
				| 
						 | 
				
			
			@ -8,6 +8,7 @@ import cn.hutool.core.collection.CollUtil;
 | 
			
		|||
import cn.hutool.core.util.ObjectUtil;
 | 
			
		||||
import com.bonus.canteen.core.ims.domain.ImsIntoInventory;
 | 
			
		||||
import com.bonus.canteen.core.ims.domain.ImsIntoInventoryDetail;
 | 
			
		||||
import com.bonus.canteen.core.ims.domain.ImsSetting;
 | 
			
		||||
import com.bonus.canteen.core.ims.domain.param.ImsInventoryAdd;
 | 
			
		||||
import com.bonus.canteen.core.ims.domain.param.ImsInventoryQuery;
 | 
			
		||||
import com.bonus.canteen.core.ims.domain.param.ImsInventoryUpdate;
 | 
			
		||||
| 
						 | 
				
			
			@ -17,6 +18,7 @@ import com.bonus.canteen.core.ims.domain.vo.ImsInventoryVO;
 | 
			
		|||
import com.bonus.canteen.core.ims.dto.ExpireWarningDTO;
 | 
			
		||||
import com.bonus.canteen.core.ims.dto.InventoryWarningDTO;
 | 
			
		||||
import com.bonus.canteen.core.ims.mapper.ImsIntoInventoryMapper;
 | 
			
		||||
import com.bonus.canteen.core.ims.service.IImsSettingService;
 | 
			
		||||
import com.bonus.canteen.core.ims.vo.ExpireWarningVO;
 | 
			
		||||
import com.bonus.canteen.core.ims.vo.InventoryWarningVO;
 | 
			
		||||
import com.bonus.canteen.core.ims.vo.PriceAndNumDVO;
 | 
			
		||||
| 
						 | 
				
			
			@ -29,6 +31,8 @@ import com.bonus.canteen.core.ims.mapper.ImsInventoryMapper;
 | 
			
		|||
import com.bonus.canteen.core.ims.domain.ImsInventory;
 | 
			
		||||
import com.bonus.canteen.core.ims.service.IImsInventoryService;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 库存Service业务层处理
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			@ -43,6 +47,9 @@ public class ImsInventoryServiceImpl implements IImsInventoryService
 | 
			
		|||
    @Autowired
 | 
			
		||||
    private ImsIntoInventoryMapper imsIntoInventoryMapper;
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private IImsSettingService imsSettingService;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询库存
 | 
			
		||||
     *
 | 
			
		||||
| 
						 | 
				
			
			@ -85,6 +92,23 @@ public class ImsInventoryServiceImpl implements IImsInventoryService
 | 
			
		|||
                inventory.setTotalPrice(totalPrice == null ? BigDecimal.ZERO : totalPrice);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        ImsSetting  setting = new ImsSetting();
 | 
			
		||||
        setting.setItemName("goods_lacking_number_reminder");
 | 
			
		||||
        List<ImsSetting> settingList = imsSettingService.selectImsSettingList(setting);
 | 
			
		||||
        Integer dayNum;
 | 
			
		||||
        if(settingList !=null && !settingList.isEmpty()){
 | 
			
		||||
            dayNum = Integer.parseInt(settingList.get(0).getItemValue());
 | 
			
		||||
        } else {
 | 
			
		||||
            dayNum = -1;
 | 
			
		||||
        }
 | 
			
		||||
        imsInventoryList.stream().filter(i -> i.getMaterialNum() != null && dayNum > 0)
 | 
			
		||||
                .forEach(i -> {
 | 
			
		||||
                    if(i.getMaterialNum().compareTo(BigDecimal.valueOf(dayNum)) <= 0){
 | 
			
		||||
                        i.setInventoryStatus(2L);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        i.setInventoryStatus(1L);
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
        return imsInventoryList;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -175,7 +199,38 @@ public class ImsInventoryServiceImpl implements IImsInventoryService
 | 
			
		|||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<ExpireWarningVO> expireWarning(ExpireWarningDTO content) {
 | 
			
		||||
        return imsInventoryMapper.expireWarning(content);
 | 
			
		||||
        List<ExpireWarningVO> list = imsInventoryMapper.expireWarning(content);
 | 
			
		||||
        ImsSetting  setting = new ImsSetting();
 | 
			
		||||
        setting.setItemName("goods_expireing_day_reminder");
 | 
			
		||||
        List<ImsSetting> settingList = imsSettingService.selectImsSettingList(setting);
 | 
			
		||||
        Integer dayNum;
 | 
			
		||||
        if(settingList !=null && !settingList.isEmpty()){
 | 
			
		||||
            dayNum = Integer.parseInt(settingList.get(0).getItemValue());
 | 
			
		||||
        } else {
 | 
			
		||||
            dayNum = -1;
 | 
			
		||||
        }
 | 
			
		||||
        if(dayNum >0 && content.getExpireState() !=null){
 | 
			
		||||
            list.stream().filter(l -> l.getExpireState() != null)
 | 
			
		||||
                    .forEach(l -> {
 | 
			
		||||
                        if(l.getExpireDay() !=null){
 | 
			
		||||
                            Integer betweenDay = l.getExpireDay();
 | 
			
		||||
                            if(betweenDay<=0){
 | 
			
		||||
                                l.setExpireState(1);
 | 
			
		||||
                            } else if (betweenDay >0 && betweenDay <= dayNum) {
 | 
			
		||||
                                l.setExpireState(3);
 | 
			
		||||
                            }else{
 | 
			
		||||
                                l.setExpireState(2);
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
                        }
 | 
			
		||||
                    });
 | 
			
		||||
 | 
			
		||||
            List<ExpireWarningVO> warningList = list.stream().filter(l -> Objects.equals(l.getExpireState(), content.getExpireState())).collect(Collectors.toList());
 | 
			
		||||
            System.out.println("warningList = " + warningList);
 | 
			
		||||
            System.out.println("warningList.size = " + warningList.size());
 | 
			
		||||
            return warningList;
 | 
			
		||||
        }
 | 
			
		||||
        return list;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,6 +38,7 @@ import java.util.ArrayList;
 | 
			
		|||
import java.util.Collections;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
@Service
 | 
			
		||||
public class SupplierScoreRuleServiceImpl extends ServiceImpl<SupplierScoreRuleMapper, SupplierScoreRule> implements SupplierScoreRuleService {
 | 
			
		||||
| 
						 | 
				
			
			@ -98,48 +99,67 @@ public class SupplierScoreRuleServiceImpl extends ServiceImpl<SupplierScoreRuleM
 | 
			
		|||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                var6 = supplierScoreRuleList.iterator();
 | 
			
		||||
                label55:
 | 
			
		||||
                while (var6.hasNext()) {
 | 
			
		||||
                    SupplierScoreRule supplierScoreRule = var6.next();
 | 
			
		||||
                    Long ruleId = supplierScoreRule.getRuleId();
 | 
			
		||||
                    boolean ifNeedDeal = true;
 | 
			
		||||
                    var7 = content.iterator();
 | 
			
		||||
 | 
			
		||||
                    while (true) {
 | 
			
		||||
                        SupplierScoreRuleAddDTO supplierScoreRuleAddDTO;
 | 
			
		||||
                        do {
 | 
			
		||||
                            do {
 | 
			
		||||
                                if (!var7.hasNext()) {
 | 
			
		||||
                                    if (ifNeedDeal) {
 | 
			
		||||
                                        this.supplierScoreRuleSectionMapper.delete(Wrappers.lambdaQuery(SupplierScoreRuleSection.class).eq(SupplierScoreRuleSection::getRuleId, ruleId));
 | 
			
		||||
                                        this.baseMapper.update(null, Wrappers.lambdaUpdate(SupplierScoreRule.class)
 | 
			
		||||
                                                .eq(SupplierScoreRule::getRuleId, ruleId));
 | 
			
		||||
                                    }
 | 
			
		||||
                                    continue label55;
 | 
			
		||||
                                }
 | 
			
		||||
 | 
			
		||||
                                supplierScoreRuleAddDTO = var7.next();
 | 
			
		||||
                            } while (!ObjectUtil.equal(supplierScoreRule.getRuleType(), supplierScoreRuleAddDTO.getRuleType()));
 | 
			
		||||
 | 
			
		||||
                            ifNeedDeal = false;
 | 
			
		||||
                            SupplierScoreRule updateRule = new SupplierScoreRule();
 | 
			
		||||
                            BeanUtil.copyProperties(supplierScoreRuleAddDTO, updateRule);
 | 
			
		||||
                            this.baseMapper.update(updateRule, Wrappers.lambdaQuery(SupplierScoreRule.class).eq(SupplierScoreRule::getRuleId, ruleId));
 | 
			
		||||
                        } while (CollUtil.isEmpty(supplierScoreRuleAddDTO.getSectionVOList()));
 | 
			
		||||
 | 
			
		||||
                        this.supplierScoreRuleSectionMapper.delete(Wrappers.lambdaQuery(SupplierScoreRuleSection.class).eq(SupplierScoreRuleSection::getRuleId, ruleId));
 | 
			
		||||
                        Iterator<SupplierScoreRuleSectionAddDTO> var12 = supplierScoreRuleAddDTO.getSectionVOList().iterator();
 | 
			
		||||
 | 
			
		||||
                        while (var12.hasNext()) {
 | 
			
		||||
                            SupplierScoreRuleSectionAddDTO supplierScoreRuleSectionAddDTO = var12.next();
 | 
			
		||||
                            SupplierScoreRuleSection supplierScoreRuleSection = new SupplierScoreRuleSection();
 | 
			
		||||
                            BeanUtil.copyProperties(supplierScoreRuleSectionAddDTO, supplierScoreRuleSection);
 | 
			
		||||
                            supplierScoreRuleSection.setRuleId(ruleId);
 | 
			
		||||
                            this.supplierScoreRuleSectionMapper.insert(supplierScoreRuleSection);
 | 
			
		||||
                        }
 | 
			
		||||
                this.supplierScoreRuleSectionMapper.delete(Wrappers.lambdaQuery(SupplierScoreRuleSection.class));
 | 
			
		||||
                this.baseMapper.delete( Wrappers.lambdaUpdate(SupplierScoreRule.class));
 | 
			
		||||
                for (SupplierScoreRuleAddDTO supplierScoreRuleAddDTO : content) {
 | 
			
		||||
                    SupplierScoreRule supplierScoreRule = new SupplierScoreRule();
 | 
			
		||||
                    BeanUtil.copyProperties(supplierScoreRuleAddDTO, supplierScoreRule);
 | 
			
		||||
                    Long ruleId = Id.next();
 | 
			
		||||
                    supplierScoreRule.setRuleId(ruleId);
 | 
			
		||||
                    this.baseMapper.insert(supplierScoreRule);
 | 
			
		||||
                    if (CollUtil.isEmpty(supplierScoreRuleAddDTO.getSectionVOList())) {
 | 
			
		||||
                        continue;
 | 
			
		||||
                    }
 | 
			
		||||
                    for (SupplierScoreRuleSectionAddDTO supplierScoreRuleSectionAddDTO : supplierScoreRuleAddDTO.getSectionVOList()) {
 | 
			
		||||
                        SupplierScoreRuleSection supplierScoreRuleSection = new SupplierScoreRuleSection();
 | 
			
		||||
                        BeanUtil.copyProperties(supplierScoreRuleSectionAddDTO, supplierScoreRuleSection);
 | 
			
		||||
                        supplierScoreRuleSection.setRuleId(ruleId);
 | 
			
		||||
                        this.supplierScoreRuleSectionMapper.insert(supplierScoreRuleSection);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
//                var6 = supplierScoreRuleList.iterator();
 | 
			
		||||
//                label55:
 | 
			
		||||
//                while (var6.hasNext()) {
 | 
			
		||||
//                    SupplierScoreRule supplierScoreRule = var6.next();
 | 
			
		||||
//                    Long ruleId = supplierScoreRule.getRuleId();
 | 
			
		||||
//                    boolean ifNeedDeal = true;
 | 
			
		||||
//                    var7 = content.iterator();
 | 
			
		||||
//
 | 
			
		||||
//                    while (true) {
 | 
			
		||||
//                        SupplierScoreRuleAddDTO supplierScoreRuleAddDTO;
 | 
			
		||||
//                        do {
 | 
			
		||||
//                            do {
 | 
			
		||||
//                                if (!var7.hasNext()) {
 | 
			
		||||
//                                    if (ifNeedDeal) {
 | 
			
		||||
//                                        this.supplierScoreRuleSectionMapper.delete(Wrappers.lambdaQuery(SupplierScoreRuleSection.class).eq(SupplierScoreRuleSection::getRuleId, ruleId));
 | 
			
		||||
//                                        this.baseMapper.delete( Wrappers.lambdaUpdate(SupplierScoreRule.class)
 | 
			
		||||
//                                                .eq(SupplierScoreRule::getRuleId, ruleId));
 | 
			
		||||
//                                    }
 | 
			
		||||
//                                    continue label55;
 | 
			
		||||
//                                }
 | 
			
		||||
//
 | 
			
		||||
//                                supplierScoreRuleAddDTO = var7.next();
 | 
			
		||||
//                            } while (!ObjectUtil.equal(supplierScoreRule.getRuleType(), supplierScoreRuleAddDTO.getRuleType()));
 | 
			
		||||
//
 | 
			
		||||
//                            ifNeedDeal = false;
 | 
			
		||||
//                            SupplierScoreRule updateRule = new SupplierScoreRule();
 | 
			
		||||
//                            BeanUtil.copyProperties(supplierScoreRuleAddDTO, updateRule);
 | 
			
		||||
//                            this.baseMapper.update(updateRule, Wrappers.lambdaQuery(SupplierScoreRule.class).eq(SupplierScoreRule::getRuleId, ruleId));
 | 
			
		||||
//                        } while (CollUtil.isEmpty(supplierScoreRuleAddDTO.getSectionVOList()));
 | 
			
		||||
//
 | 
			
		||||
//                        this.supplierScoreRuleSectionMapper.delete(Wrappers.lambdaQuery(SupplierScoreRuleSection.class).eq(SupplierScoreRuleSection::getRuleId, ruleId));
 | 
			
		||||
//                        Iterator<SupplierScoreRuleSectionAddDTO> var12 = supplierScoreRuleAddDTO.getSectionVOList().iterator();
 | 
			
		||||
//
 | 
			
		||||
//                        while (var12.hasNext()) {
 | 
			
		||||
//                            SupplierScoreRuleSectionAddDTO supplierScoreRuleSectionAddDTO = var12.next();
 | 
			
		||||
//                            SupplierScoreRuleSection supplierScoreRuleSection = new SupplierScoreRuleSection();
 | 
			
		||||
//                            BeanUtil.copyProperties(supplierScoreRuleSectionAddDTO, supplierScoreRuleSection);
 | 
			
		||||
//                            supplierScoreRuleSection.setRuleId(ruleId);
 | 
			
		||||
//                            this.supplierScoreRuleSectionMapper.insert(supplierScoreRuleSection);
 | 
			
		||||
//                        }
 | 
			
		||||
//                    }
 | 
			
		||||
//                }
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -292,10 +292,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
            <where>
 | 
			
		||||
                did.expire_time is not null
 | 
			
		||||
                and did.inventory_num > 0
 | 
			
		||||
                and  (
 | 
			
		||||
                did.expire_time <![CDATA[ <]]>  NOW()  -- 已过期
 | 
			
		||||
                OR TIMESTAMPDIFF(DAY, NOW(), did.expire_time) <![CDATA[ <= ]]> mm.shelf_life_days  -- 临期
 | 
			
		||||
                )
 | 
			
		||||
<!--                and  (-->
 | 
			
		||||
<!--                did.expire_time <![CDATA[ <]]>  NOW()  -- 已过期-->
 | 
			
		||||
<!--                OR TIMESTAMPDIFF(DAY, NOW(), did.expire_time) <![CDATA[ <= ]]> mm.shelf_life_days  -- 临期-->
 | 
			
		||||
<!--                )-->
 | 
			
		||||
                <if test="content.areaIdList != null and content.areaIdList.size() > 0">
 | 
			
		||||
                    AND dw.area_id in
 | 
			
		||||
                    <foreach collection="content.areaIdList" item="item" separator="," open="(" close=")">
 | 
			
		||||
| 
						 | 
				
			
			@ -318,12 +318,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
                <if test="content.materialName != null and content.materialName != ''">
 | 
			
		||||
                    and mm.material_name like concat('%',#{content.materialName},'%')
 | 
			
		||||
                </if>
 | 
			
		||||
                <if test="content.expireState != null and content.expireState == 1">
 | 
			
		||||
                    and TIMESTAMPDIFF(DAY,NOW(),did.expire_time) <![CDATA[ < ]]> 0
 | 
			
		||||
                </if>
 | 
			
		||||
                <if test="content.expireState != null and content.expireState == 2">
 | 
			
		||||
                    and TIMESTAMPDIFF(DAY,NOW(),did.expire_time) <![CDATA[ >= ]]> 0
 | 
			
		||||
                </if>
 | 
			
		||||
                <if test="content.warningDay != null ">
 | 
			
		||||
                    and (TIMESTAMPDIFF(DAY,NOW(),did.expire_time) between 0 and #{content.warningDay})
 | 
			
		||||
                </if>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue