|
@@ -6,10 +6,7 @@ import com.github.pagehelper.PageInfo;
|
|
|
|
|
|
import com.ruoyi.demo.entity.*;
|
|
|
import com.ruoyi.demo.entity.bo.*;
|
|
|
-import com.ruoyi.demo.entity.vo.BrandEvolveVo;
|
|
|
-import com.ruoyi.demo.entity.vo.BrandOpcloseVo;
|
|
|
-import com.ruoyi.demo.entity.vo.ListQueryBody;
|
|
|
-import com.ruoyi.demo.entity.vo.OpcloseTimeVo;
|
|
|
+import com.ruoyi.demo.entity.vo.*;
|
|
|
import com.ruoyi.demo.mapper.*;
|
|
|
import com.ruoyi.demo.service.BrandService;
|
|
|
import com.ruoyi.demo.utils.CategoryUtil;
|
|
@@ -566,6 +563,68 @@ public class BrandServiceImpl implements BrandService {
|
|
|
return vos;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<String, List<BrandEvolveVo>> searchEvolveByMulti2Map(List<String> addrCodes, List<String> typeCodes, List<String> brandIds) {
|
|
|
+ List<String> addrs = new ArrayList<>();
|
|
|
+ if (addrCodes != null){
|
|
|
+ for (String code : addrCodes){
|
|
|
+ addrs.add(code);
|
|
|
+ List<String> otherAddrCode = categoryUtil.getAllOtherAddrCode(code);
|
|
|
+ addrs.addAll(otherAddrCode);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ addrs = null;
|
|
|
+ }
|
|
|
+ List<String> types = new ArrayList<>();
|
|
|
+ if (typeCodes != null){
|
|
|
+ for (String code : typeCodes){
|
|
|
+ types.add(code);
|
|
|
+ List<String> otherTypeBy = categoryUtil.getAllOtherTypeBy(code);
|
|
|
+ types.addAll(otherTypeBy);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ types = null;
|
|
|
+ }
|
|
|
+ List<BrandEvolveVo> vos = new ArrayList<>();
|
|
|
+ for (String brandId : brandIds){
|
|
|
+ List<BrandEvolveVo> evolveVos = brandEvolveDao.selectByMulti(addrs, types, brandId);
|
|
|
+ for (int i=0; i<evolveVos.size(); i++){
|
|
|
+ if (i == 0)
|
|
|
+ continue;
|
|
|
+ evolveVos.get(i).setTotal(evolveVos.get(i-1).getTotal()+evolveVos.get(i).getTotal());
|
|
|
+ }
|
|
|
+ vos.addAll(evolveVos);
|
|
|
+ }
|
|
|
+ Map<String,List<BrandEvolveVo>> times = new HashMap<>();
|
|
|
+ for (BrandEvolveVo vo : vos){
|
|
|
+ if (times.get(vo.getTime()) == null){
|
|
|
+ List<BrandEvolveVo> evos = new ArrayList<>();
|
|
|
+ evos.add(vo);
|
|
|
+ times.put(vo.getTime(),evos);
|
|
|
+ }else{
|
|
|
+ List<BrandEvolveVo> brandEvolveVos = times.get(vo.getTime());
|
|
|
+ brandEvolveVos.add(vo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return times;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Integer timeUtil(String time){
|
|
|
+ String[] split = time.split(":");
|
|
|
+ int hour = Integer.parseInt(split[0]);
|
|
|
+ int min = Integer.parseInt(split[1]);
|
|
|
+ return hour*100+min;
|
|
|
+ }
|
|
|
+ public int compareTime(String time1, String time2){
|
|
|
+ int result = timeUtil(time1).compareTo(timeUtil(time2));
|
|
|
+// if (result > 0)
|
|
|
+// System.out.println(time1 + " > " + time2);
|
|
|
+// if (result == 0)
|
|
|
+// System.out.println(time1 + " = " + time2);
|
|
|
+// if (result < 0)
|
|
|
+// System.out.println(time1 + " < " + time2);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
@Override
|
|
|
public List<OpcloseTimeVo> searchOpenTims(List<String> brandIds, List<String> addrCodes, List<String> typeCodeBys) {
|
|
|
List<String> addrs = new ArrayList<>();
|
|
@@ -591,7 +650,22 @@ public class BrandServiceImpl implements BrandService {
|
|
|
}else
|
|
|
types = null;
|
|
|
List<OpcloseTimeVo> vos = storeWdOpcloseDao.selectBrandOpenTimes(brandIds, addrs, types);
|
|
|
- return vos;
|
|
|
+ List<OpcloseTimeVo> rvos = new ArrayList<>();
|
|
|
+ for (int i = 0;i < 24; i+=2){
|
|
|
+ OpcloseTimeVo vo = new OpcloseTimeVo();
|
|
|
+ vo.setTime(i+":00~"+(i+2)+":00");
|
|
|
+ vo.setCount(0);
|
|
|
+ rvos.add(vo);
|
|
|
+ }
|
|
|
+ for (OpcloseTimeVo vo : vos){
|
|
|
+ for (OpcloseTimeVo rvo : rvos){
|
|
|
+ String[] times = rvo.getTime().split("~");
|
|
|
+ if (compareTime(vo.getTime(),times[0]) < 0 || compareTime(times[1],vo.getTime()) < 0)
|
|
|
+ continue;
|
|
|
+ rvo.setCount(rvo.getCount() + vo.getCount());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return rvos;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -619,6 +693,21 @@ public class BrandServiceImpl implements BrandService {
|
|
|
}else
|
|
|
types = null;
|
|
|
List<OpcloseTimeVo> vos = storeWdOpcloseDao.selectBrandCloseTimes(brandIds, addrs, types);
|
|
|
- return vos;
|
|
|
+ List<OpcloseTimeVo> rvos = new ArrayList<>();
|
|
|
+ for (int i = 0;i < 24; i+=2){
|
|
|
+ OpcloseTimeVo vo = new OpcloseTimeVo();
|
|
|
+ vo.setTime(i+":00~"+(i+2)+":00");
|
|
|
+ vo.setCount(0);
|
|
|
+ rvos.add(vo);
|
|
|
+ }
|
|
|
+ for (OpcloseTimeVo vo : vos){
|
|
|
+ for (OpcloseTimeVo rvo : rvos){
|
|
|
+ String[] times = rvo.getTime().split("~");
|
|
|
+ if (compareTime(vo.getTime(),times[0]) < 0 || compareTime(times[1],vo.getTime()) < 0)
|
|
|
+ continue;
|
|
|
+ rvo.setCount(rvo.getCount() + vo.getCount());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return rvos;
|
|
|
}
|
|
|
}
|