|
@@ -10,11 +10,13 @@ import com.fs.common.utils.poi.ExcelUtil;
|
|
import com.fs.company.domain.CompanyUser;
|
|
import com.fs.company.domain.CompanyUser;
|
|
import com.fs.company.service.ICompanyUserService;
|
|
import com.fs.company.service.ICompanyUserService;
|
|
import com.fs.core.web.service.TokenService;
|
|
import com.fs.core.web.service.TokenService;
|
|
|
|
+import com.fs.store.vo.FsStoreOrderCountsVO;
|
|
import com.fs.store.vo.FsStoreOrderStatisticsVO;
|
|
import com.fs.store.vo.FsStoreOrderStatisticsVO;
|
|
import com.fs.store.param.FsStoreStatisticsParam;
|
|
import com.fs.store.param.FsStoreStatisticsParam;
|
|
import com.fs.store.service.IFsStoreOrderService;
|
|
import com.fs.store.service.IFsStoreOrderService;
|
|
import com.fs.store.service.IFsStorePaymentService;
|
|
import com.fs.store.service.IFsStorePaymentService;
|
|
import com.fs.store.vo.FsStorePaymentStatisticsVO;
|
|
import com.fs.store.vo.FsStorePaymentStatisticsVO;
|
|
|
|
+import com.fs.store.vo.FsStoreProductCountsVO;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -23,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -66,9 +69,54 @@ public class FsStoreStatisticsController extends BaseController
|
|
param.setUsers(userIds.toArray(new Long[userIds.size()]));
|
|
param.setUsers(userIds.toArray(new Long[userIds.size()]));
|
|
}
|
|
}
|
|
if(param.getUsers()!=null&¶m.getUsers().length>0){
|
|
if(param.getUsers()!=null&¶m.getUsers().length>0){
|
|
- List<FsStoreOrderStatisticsVO> list= storeOrderService.selectFsStoreOrderStatisticsList(param);
|
|
|
|
|
|
+ TimeUtils.TimeEntity timeEntity=TimeUtils.parseTime(param.getType()==null?null:param.getType().toString(),param.getStartTime(),param.getEndTime());
|
|
|
|
+ timeEntity.setUserIds(param.getUsers());
|
|
|
|
+ Integer cycleNum = timeEntity.getCycleNum();
|
|
|
|
+ Integer beginTime = timeEntity.getBeginTime();
|
|
|
|
+ List<Integer> timeList = new ArrayList<>();
|
|
|
|
+ for (int i = 1; i <= cycleNum; i++) {
|
|
|
|
+ timeList.add(beginTime);
|
|
|
|
+ beginTime = TimeUtils.formatTime(beginTime);
|
|
|
|
+ }
|
|
|
|
+ Map<String, Object> map = timeEntity.toMap();
|
|
|
|
+ map.put("orderType",param.getOrderType());
|
|
|
|
+ map.put("orderMedium",param.getOrderMedium());
|
|
|
|
+ List<JSONObject> jsonObjectList = storeOrderService.selectFsStoreOrderCounts(map);
|
|
|
|
+ List<String> dates = jsonObjectList.stream().map(jsonObject -> jsonObject.getString("type")).collect(Collectors.toList());
|
|
|
|
+ List<Integer> orderCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("orderCount")).collect(Collectors.toList());
|
|
|
|
+ List<Integer> payPrice = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("payPrice")).collect(Collectors.toList());
|
|
|
|
+ //表格数据
|
|
|
|
+ List<FsStoreOrderCountsVO> tableData = storeOrderService.selectFsStoreOrderCountsByDept(map,param.getDeptId());
|
|
|
|
+ return R.ok().put("dates",dates).put("orderCount",orderCount).put("payPrice",payPrice).put("tableData",tableData);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ return R.ok("未查找到数据");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- TimeUtils.TimeEntity timeEntity=TimeUtils.parseTime(param.getType().toString(),param.getStartTime(),param.getEndTime());
|
|
|
|
|
|
+
|
|
|
|
+ @PreAuthorize("@ss.hasPermi('store:statistics:storeProduct')")
|
|
|
|
+ @GetMapping("/storeProduct")
|
|
|
|
+ public R storeProduct(FsStoreStatisticsParam param)
|
|
|
|
+ {
|
|
|
|
+ if(StringUtils.isNotEmpty(param.getUserIds())){
|
|
|
|
+ String[] userIds=param.getUserIds().split(",");
|
|
|
|
+ Long[] ids=new Long[userIds.length];
|
|
|
|
+ for(int i=0;i<ids.length; i++){
|
|
|
|
+ ids[i]=Long.parseLong(userIds[i]);
|
|
|
|
+ }
|
|
|
|
+ param.setUsers(ids);
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ //获取部门下的所有用户
|
|
|
|
+ CompanyUser usermap=new CompanyUser();
|
|
|
|
+ usermap.setDeptId(param.getDeptId());
|
|
|
|
+ List<CompanyUser> users = userService.getUserListByDeptId(usermap);
|
|
|
|
+ List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
|
|
|
|
+ param.setUsers(userIds.toArray(new Long[userIds.size()]));
|
|
|
|
+ }
|
|
|
|
+ if(param.getUsers()!=null&¶m.getUsers().length>0){
|
|
|
|
+ TimeUtils.TimeEntity timeEntity=TimeUtils.parseTime(param.getType()==null?null:param.getType().toString(),param.getStartTime(),param.getEndTime());
|
|
timeEntity.setUserIds(param.getUsers());
|
|
timeEntity.setUserIds(param.getUsers());
|
|
Integer cycleNum = timeEntity.getCycleNum();
|
|
Integer cycleNum = timeEntity.getCycleNum();
|
|
Integer beginTime = timeEntity.getBeginTime();
|
|
Integer beginTime = timeEntity.getBeginTime();
|
|
@@ -81,12 +129,16 @@ public class FsStoreStatisticsController extends BaseController
|
|
List<String> dates = jsonObjectList.stream().map(jsonObject -> jsonObject.getString("type")).collect(Collectors.toList());
|
|
List<String> dates = jsonObjectList.stream().map(jsonObject -> jsonObject.getString("type")).collect(Collectors.toList());
|
|
List<Integer> orderCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("orderCount")).collect(Collectors.toList());
|
|
List<Integer> orderCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("orderCount")).collect(Collectors.toList());
|
|
List<Integer> payPrice = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("payPrice")).collect(Collectors.toList());
|
|
List<Integer> payPrice = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("payPrice")).collect(Collectors.toList());
|
|
- return R.ok().put("list",list).put("dates",dates).put("orderCount",orderCount).put("payPrice",payPrice);
|
|
|
|
|
|
+ //表格数据
|
|
|
|
+ List<FsStoreProductCountsVO> tableData = storeOrderService.selectFsStoreProductCountsByDept(timeEntity.toMap(),param.getDeptId());
|
|
|
|
+ return R.ok().put("dates",dates).put("orderCount",orderCount).put("payPrice",payPrice).put("tableData",tableData);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
return R.ok("未查找到数据");
|
|
return R.ok("未查找到数据");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
@PreAuthorize("@ss.hasPermi('store:statistics:exportStoreOrder')")
|
|
@PreAuthorize("@ss.hasPermi('store:statistics:exportStoreOrder')")
|
|
@GetMapping("/exportStoreOrder")
|
|
@GetMapping("/exportStoreOrder")
|
|
public AjaxResult exportStoreOrder(FsStoreStatisticsParam param)
|
|
public AjaxResult exportStoreOrder(FsStoreStatisticsParam param)
|