|
|
|
@ -28,19 +28,24 @@ import org.jeecg.modules.demo.zyorders.entity.ZyOrders; |
|
|
|
|
import org.jeecg.modules.demo.zyorders.entity.ZyOrdersJk; |
|
|
|
|
import org.jeecg.modules.demo.zyorders.mapper.ZyOrdersMapper; |
|
|
|
|
import org.jeecg.modules.demo.zyorders.service.IZyOrdersService; |
|
|
|
|
import org.jeecg.modules.demo.zyorders.vo.ZyNameAndPayMoney; |
|
|
|
|
import org.jeecg.modules.demo.zyorders.vo.ZyOrderPayAndTime; |
|
|
|
|
import org.jeecg.modules.largeScreen.vo.Type; |
|
|
|
|
import org.jeecg.modules.largeScreen.vo.ZyShopSales; |
|
|
|
|
import org.jeecg.modules.message.entity.ZySpeechMessage; |
|
|
|
|
import org.jeecg.modules.message.mapper.ZySpeechMessageMapper; |
|
|
|
|
import org.jeecg.modules.orderbymakeclothplan.vo.TodayOrderAndQIriVo; |
|
|
|
|
import org.jeecg.modules.shop.utils.GetTime; |
|
|
|
|
import org.jeecg.modules.shop.utils.mapSort; |
|
|
|
|
import org.jeecg.modules.system.entity.SysDepart; |
|
|
|
|
import org.jeecg.modules.system.service.ISysDepartService; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Calendar; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -105,6 +110,10 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i |
|
|
|
|
@Autowired |
|
|
|
|
private IZyClothsTypeService zyClothsTypeService; |
|
|
|
|
|
|
|
|
|
//店铺/部门
|
|
|
|
|
@Autowired |
|
|
|
|
private ISysDepartService sysDepartService; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 大屏数据-获取订单的状态 |
|
|
|
|
* |
|
|
|
@ -343,6 +352,98 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i |
|
|
|
|
return ids; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<Map.Entry<String, Integer>> selectAllShopSalesVolumeByLastM(String org_code) { |
|
|
|
|
Map<String, Integer> map = new HashMap<>(); |
|
|
|
|
String beginOfMonth = GetTime.beginOfMonth(); |
|
|
|
|
String endOfMonth = GetTime.endOfMonth(); |
|
|
|
|
List<ZyNameAndPayMoney> list = baseMapper.selectAllShopSalesVolumeByLastM(beginOfMonth, endOfMonth,org_code); |
|
|
|
|
//将list转换成map,同时将所有相同店铺名称的销售额相加
|
|
|
|
|
if (list.isEmpty()) { |
|
|
|
|
return null; |
|
|
|
|
} else { |
|
|
|
|
map.put(list.get(0).getName(), list.get(0).getTotalMoney()); |
|
|
|
|
} |
|
|
|
|
for (int i = 1; i < list.size(); i++) { |
|
|
|
|
if (map.containsKey(list.get(i).getName())) { |
|
|
|
|
int y = map.get(list.get(i).getName()) + list.get(i).getTotalMoney(); |
|
|
|
|
map.put(list.get(i).getName(), y); |
|
|
|
|
} else { |
|
|
|
|
map.put(list.get(i).getName(), list.get(i).getTotalMoney()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
List<Map.Entry<String, Integer>> list1 = mapSort.sortMapByValue(map); |
|
|
|
|
return list1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查询所有店铺前十二个月的月销售额 |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<Type> getsales12Month() { |
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
String start_time = GetTime.getLastTwelveMonths(); |
|
|
|
|
String end_time = GetTime.getLastMonthEnd(); |
|
|
|
|
QueryWrapper<SysDepart> depWra=new QueryWrapper(); |
|
|
|
|
String[] a3 = {"4","5"}; |
|
|
|
|
depWra.in("org_category",a3); |
|
|
|
|
List<SysDepart> depList = sysDepartService.list(depWra); |
|
|
|
|
List<Type> ls = new ArrayList<>(); |
|
|
|
|
for (int i = 0; i < depList.size(); i++) { |
|
|
|
|
SysDepart item = depList.get(i); |
|
|
|
|
Type type = new Type(); |
|
|
|
|
List<ZyOrderPayAndTime> list = baseMapper.selectCurrentSales(item.getId(), start_time, end_time); |
|
|
|
|
HashMap<Integer, Integer> map1 = new HashMap<>(); |
|
|
|
|
List<ZyShopSales> salesList = new ArrayList<>(); |
|
|
|
|
int lastmonths = calendar.get(Calendar.MONTH); |
|
|
|
|
int lastTwelveMonths = 12 - (12 - lastmonths) + 1; |
|
|
|
|
for (int sw = lastTwelveMonths; sw <= 12; sw++) { |
|
|
|
|
ZyShopSales zyShopSales = new ZyShopSales(); |
|
|
|
|
zyShopSales.setMonthDay(sw); |
|
|
|
|
zyShopSales.setMoney(0); |
|
|
|
|
salesList.add(zyShopSales); |
|
|
|
|
} |
|
|
|
|
for (int ws = 1; ws <= lastmonths; ws++) { |
|
|
|
|
ZyShopSales zyShopSales = new ZyShopSales(); |
|
|
|
|
zyShopSales.setMonthDay(ws); |
|
|
|
|
zyShopSales.setMoney(0); |
|
|
|
|
salesList.add(zyShopSales); |
|
|
|
|
} |
|
|
|
|
if (!list.isEmpty()) { |
|
|
|
|
Integer totalMoney = list.get(0).getTotalMoney(); |
|
|
|
|
Date payTime1 = list.get(0).getPayTime(); |
|
|
|
|
String format1 = String.format("%tm", payTime1); |
|
|
|
|
int b = Integer.parseInt(format1); |
|
|
|
|
map1.put(b, totalMoney); |
|
|
|
|
} |
|
|
|
|
for (int j = 1; j < list.size(); j++) { |
|
|
|
|
Date payTime = list.get(j).getPayTime(); |
|
|
|
|
String format = String.format("%tm", payTime); |
|
|
|
|
int a = Integer.parseInt(format); |
|
|
|
|
if (map1.containsKey(a)) { |
|
|
|
|
int money = map1.get(a) + list.get(j).getTotalMoney(); |
|
|
|
|
map1.put(a, money); |
|
|
|
|
} else { |
|
|
|
|
map1.put(a, list.get(j).getTotalMoney()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for (Integer key : map1.keySet()) { |
|
|
|
|
for (int w = 0; w < salesList.size(); w++) { |
|
|
|
|
Integer monthDay = salesList.get(w).getMonthDay(); |
|
|
|
|
if (monthDay.equals(key)) { |
|
|
|
|
salesList.get(w).setMoney(map1.get(key)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type.setName(item.getDepartName()); |
|
|
|
|
type.setLs(salesList); |
|
|
|
|
ls.add(type); |
|
|
|
|
} |
|
|
|
|
return ls; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 生成订单编号 |
|
|
|
|