diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/expectations/service/impl/ExpectationsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/expectations/service/impl/ExpectationsServiceImpl.java index 93116460..540913ac 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/expectations/service/impl/ExpectationsServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/expectations/service/impl/ExpectationsServiceImpl.java @@ -10,10 +10,7 @@ import org.apache.commons.lang3.ObjectUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; @Slf4j @Service @@ -69,7 +66,12 @@ public class ExpectationsServiceImpl implements ExpectationsService { //在用设备量 countExpectations = mapper.getUseCountExpectations(entity); } - return ObjectUtils.isNotEmpty(countExpectations) ? AjaxResult.success(countExpectations) : AjaxResult.error(); + Map map=new HashMap<>(); + if(!ObjectUtils.isNotEmpty(countExpectations)){ + map.put("expired","0"); + map.put("aboutToExpire","0"); + } + return ObjectUtils.isNotEmpty(countExpectations) ? AjaxResult.success(countExpectations) : AjaxResult.success(map); }catch (Exception e) { log.error(e.getMessage()); return AjaxResult.error(); diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/expectations/ExpectationsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/expectations/ExpectationsMapper.xml index 7421de14..fcc2984e 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/expectations/ExpectationsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/expectations/ExpectationsMapper.xml @@ -124,6 +124,9 @@ AND sai.`status` = '0' AND mm.next_check_time < DATE_ADD(CURDATE(), INTERVAL 30 DAY) AND mt2.type_id not in (6032,6008,6270) + + AND mt.company_id=#{companyId} + GROUP BY name;