|
|
@ -28,8 +28,7 @@ import org.jeecg.modules.demo.zyorders.entity.ZyOrders; |
|
|
|
import org.jeecg.modules.demo.zyorders.entity.ZyOrdersJk; |
|
|
|
import org.jeecg.modules.demo.zyorders.entity.ZyOrdersJk; |
|
|
|
import org.jeecg.modules.demo.zyorders.mapper.ZyOrdersMapper; |
|
|
|
import org.jeecg.modules.demo.zyorders.mapper.ZyOrdersMapper; |
|
|
|
import org.jeecg.modules.demo.zyorders.service.IZyOrdersService; |
|
|
|
import org.jeecg.modules.demo.zyorders.service.IZyOrdersService; |
|
|
|
import org.jeecg.modules.demo.zyorders.vo.ZyNameAndPayMoney; |
|
|
|
import org.jeecg.modules.demo.zyorders.vo.*; |
|
|
|
import org.jeecg.modules.demo.zyorders.vo.ZyOrderPayAndTime; |
|
|
|
|
|
|
|
import org.jeecg.modules.largeScreen.vo.Type; |
|
|
|
import org.jeecg.modules.largeScreen.vo.Type; |
|
|
|
import org.jeecg.modules.largeScreen.vo.ZyShopSales; |
|
|
|
import org.jeecg.modules.largeScreen.vo.ZyShopSales; |
|
|
|
import org.jeecg.modules.message.entity.ZySpeechMessage; |
|
|
|
import org.jeecg.modules.message.entity.ZySpeechMessage; |
|
|
@ -37,6 +36,8 @@ import org.jeecg.modules.message.mapper.ZySpeechMessageMapper; |
|
|
|
import org.jeecg.modules.orderbymakeclothplan.vo.TodayOrderAndQIriVo; |
|
|
|
import org.jeecg.modules.orderbymakeclothplan.vo.TodayOrderAndQIriVo; |
|
|
|
import org.jeecg.modules.shop.utils.GetTime; |
|
|
|
import org.jeecg.modules.shop.utils.GetTime; |
|
|
|
import org.jeecg.modules.shop.utils.mapSort; |
|
|
|
import org.jeecg.modules.shop.utils.mapSort; |
|
|
|
|
|
|
|
import org.jeecg.modules.shop.vo.OrderSales; |
|
|
|
|
|
|
|
import org.jeecg.modules.shop.vo.OrderSalesH; |
|
|
|
import org.jeecg.modules.system.entity.SysDepart; |
|
|
|
import org.jeecg.modules.system.entity.SysDepart; |
|
|
|
import org.jeecg.modules.system.service.ISysDepartService; |
|
|
|
import org.jeecg.modules.system.service.ISysDepartService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -444,6 +445,172 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i |
|
|
|
return ls; |
|
|
|
return ls; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 订单来源 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public List<OrderSource> selectSourceType() { |
|
|
|
|
|
|
|
List<OrderSource> orderSources = new ArrayList<>(); |
|
|
|
|
|
|
|
List<String> sourceTypeArr=new ArrayList<>(); |
|
|
|
|
|
|
|
sourceTypeArr.add("4"); |
|
|
|
|
|
|
|
sourceTypeArr.add("5"); |
|
|
|
|
|
|
|
int i=1; |
|
|
|
|
|
|
|
for (String code:sourceTypeArr){ |
|
|
|
|
|
|
|
List<Date> list = baseMapper.selectSourceType(code); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OrderSource orderSource = new OrderSource(); |
|
|
|
|
|
|
|
List<SourceType> sourceTypeList = new ArrayList<>(); |
|
|
|
|
|
|
|
for (int l = 7; l>=1; l--){ |
|
|
|
|
|
|
|
String lastSevenDay = GetTime.getLastSevenDay(l); |
|
|
|
|
|
|
|
SourceType sourceType = new SourceType(); |
|
|
|
|
|
|
|
sourceType.setPayTime(lastSevenDay); |
|
|
|
|
|
|
|
sourceType.setNumber(0); |
|
|
|
|
|
|
|
sourceTypeList.add(sourceType); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Map<String,Integer> map = new HashMap<>(); |
|
|
|
|
|
|
|
for (int j = 1;j<=7;j++){ |
|
|
|
|
|
|
|
String lastSevenDay = GetTime.getLastSevenDay(j); |
|
|
|
|
|
|
|
map.put(lastSevenDay,0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (int k = 0;k<list.size();k++){ |
|
|
|
|
|
|
|
Date date = list.get(k); |
|
|
|
|
|
|
|
String format = String.format("%tF", date); |
|
|
|
|
|
|
|
if (map.containsKey(format)){ |
|
|
|
|
|
|
|
Integer integer = map.get(format); |
|
|
|
|
|
|
|
integer = integer + 1; |
|
|
|
|
|
|
|
map.put(format,integer); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (String key:map.keySet()){ |
|
|
|
|
|
|
|
for (int m = 0;m<sourceTypeList.size();m++){ |
|
|
|
|
|
|
|
String payTime = sourceTypeList.get(m).getPayTime(); |
|
|
|
|
|
|
|
if (payTime.equals(key)){ |
|
|
|
|
|
|
|
sourceTypeList.get(m).setNumber(map.get(key)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
orderSource.setSourceType(i); |
|
|
|
|
|
|
|
orderSource.setLs(sourceTypeList); |
|
|
|
|
|
|
|
orderSources.add(orderSource); |
|
|
|
|
|
|
|
i++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return orderSources; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 订单消费群体 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public List<Groups> consumerGroups() { |
|
|
|
|
|
|
|
int one = 0, two = 0, three = 0, four = 0, five = 0; |
|
|
|
|
|
|
|
String[] s = {"18-24", "24-30", "30-36", "36-42", "其他"}; |
|
|
|
|
|
|
|
List<UserAge> userAges = baseMapper.consumerGroups(); |
|
|
|
|
|
|
|
List<Integer> ages = new ArrayList<>(); |
|
|
|
|
|
|
|
List<Groups> groups = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < userAges.size(); i++) { |
|
|
|
|
|
|
|
Integer age = userAges.get(i).getAge(); |
|
|
|
|
|
|
|
int n = age / 6; |
|
|
|
|
|
|
|
switch (n) { |
|
|
|
|
|
|
|
case 3: |
|
|
|
|
|
|
|
one++; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 4: |
|
|
|
|
|
|
|
two++; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 5: |
|
|
|
|
|
|
|
three++; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 6: |
|
|
|
|
|
|
|
four++; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
five++; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ages.add(0, one); |
|
|
|
|
|
|
|
ages.add(1, two); |
|
|
|
|
|
|
|
ages.add(2, three); |
|
|
|
|
|
|
|
ages.add(3, four); |
|
|
|
|
|
|
|
ages.add(4, five); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 5; i++) { |
|
|
|
|
|
|
|
Groups groups1 = new Groups(); |
|
|
|
|
|
|
|
groups1.setGroup(s[i]); |
|
|
|
|
|
|
|
groups1.setNum(ages.get(i)); |
|
|
|
|
|
|
|
groups.add(i, groups1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return groups; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 订单销售分析 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public List<OrderSales> selectOrderSale() { |
|
|
|
|
|
|
|
String lastSevenDay = GetTime.getLastSevenDay(1); |
|
|
|
|
|
|
|
//查找所有店铺
|
|
|
|
|
|
|
|
QueryWrapper<SysDepart> depWra=new QueryWrapper(); |
|
|
|
|
|
|
|
String[] a3 = {"4","5"}; |
|
|
|
|
|
|
|
depWra.in("org_category",a3); |
|
|
|
|
|
|
|
List<SysDepart> depList = sysDepartService.list(depWra); |
|
|
|
|
|
|
|
List<ShopNameAndPayTime> shopNameAndPayTimes = baseMapper.selectOrderSale(lastSevenDay); |
|
|
|
|
|
|
|
List<OrderSales> ls = new ArrayList<>(); |
|
|
|
|
|
|
|
for(SysDepart item:depList){ |
|
|
|
|
|
|
|
//for (int j = 0;j<list.size();j++){
|
|
|
|
|
|
|
|
// String s = list.get(j);
|
|
|
|
|
|
|
|
Map<Integer,Integer> map = new HashMap<>(); |
|
|
|
|
|
|
|
List<OrderSalesH> orderSalesHList = new ArrayList<>(); |
|
|
|
|
|
|
|
for (int l = 0;l<=18;l=l+6){ |
|
|
|
|
|
|
|
OrderSalesH orderSalesH = new OrderSalesH(); |
|
|
|
|
|
|
|
orderSalesH.setTime(l); |
|
|
|
|
|
|
|
orderSalesH.setNumber(0); |
|
|
|
|
|
|
|
orderSalesHList.add(orderSalesH); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (int i = 0;i<=18;i=i+6){ |
|
|
|
|
|
|
|
map.put(i,0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (int k = 0;k<shopNameAndPayTimes.size();k++){ |
|
|
|
|
|
|
|
String name = shopNameAndPayTimes.get(k).getName(); |
|
|
|
|
|
|
|
if (name.equals(item.getDepartName())){ |
|
|
|
|
|
|
|
Date payTime = shopNameAndPayTimes.get(k).getPayTime(); |
|
|
|
|
|
|
|
String format = String.format("%tH", payTime); |
|
|
|
|
|
|
|
int i = Integer.parseInt(format); |
|
|
|
|
|
|
|
for (int z = 0;z<=18;z=z+6){ |
|
|
|
|
|
|
|
if (i>=z && i<=z+6){ |
|
|
|
|
|
|
|
i = z; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (map.containsKey(i)){ |
|
|
|
|
|
|
|
Integer integer = map.get(i); |
|
|
|
|
|
|
|
map.put(i,integer+1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(Integer key:map.keySet()) { |
|
|
|
|
|
|
|
for (int m = 0;m<orderSalesHList.size();m++){ |
|
|
|
|
|
|
|
Integer time = orderSalesHList.get(m).getTime(); |
|
|
|
|
|
|
|
if (key == time){ |
|
|
|
|
|
|
|
orderSalesHList.get(m).setNumber(map.get(key)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
OrderSales orderSales = new OrderSales(); |
|
|
|
|
|
|
|
orderSales.setName(item.getDepartName()); |
|
|
|
|
|
|
|
orderSales.setLs(orderSalesHList); |
|
|
|
|
|
|
|
ls.add(orderSales); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ls; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 生成订单编号 |
|
|
|
* 生成订单编号 |
|
|
|