|
|
@@ -14,6 +14,7 @@ import com.ydtech.modules.admin.model.vo.KztDataPermissionVo;
|
|
|
import com.ydtech.modules.admin.service.DxDataService;
|
|
|
import com.ydtech.modules.admin.service.KhglZgdDataService;
|
|
|
import com.ydtech.modules.admin.service.KhglZzbDataService;
|
|
|
+import com.ydtech.modules.admin.utils.SliceUpDateUtil;
|
|
|
import com.ydtech.modules.order.entity.BasePageResult;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
@@ -22,6 +23,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Api(tags = "电销统计数据")
|
|
|
@@ -124,6 +127,9 @@ public class KhglDataController {
|
|
|
@PostMapping("/queryDxDataPage")
|
|
|
@ApiOperation(value = "查询用户所有的数据分页")
|
|
|
public HttpResult<BasePageResult<DxReportDataDto>> queryDxDataPage(@RequestBody DxQueryVo dxQueryVo){
|
|
|
+ HashMap<String, String> map = getDateMapByType(dxQueryVo.getType(), dxQueryVo.getBeginDate(), dxQueryVo.getEndDate());
|
|
|
+ dxQueryVo.setBeginDate(map.get("startDate"));
|
|
|
+ dxQueryVo.setEndDate(map.get("endDate"));
|
|
|
return HttpResult.ok(dxDataService.queryPage(dxQueryVo));
|
|
|
}
|
|
|
|
|
|
@@ -139,9 +145,12 @@ public class KhglDataController {
|
|
|
if(StringUtils.isBlank(dxQueryVo.getUserId())){
|
|
|
return HttpResult.error("用户id不能为空!!!");
|
|
|
}
|
|
|
- if(StringUtils.isBlank(dxQueryVo.getBeginDate()) || StringUtils.isBlank(dxQueryVo.getEndDate())){
|
|
|
- return HttpResult.error("开始时间和结束时间不能为空!!!");
|
|
|
- }
|
|
|
+ //if(StringUtils.isBlank(dxQueryVo.getBeginDate()) || StringUtils.isBlank(dxQueryVo.getEndDate())){
|
|
|
+ // return HttpResult.error("开始时间和结束时间不能为空!!!");
|
|
|
+ //}
|
|
|
+ HashMap<String, String> map = getDateMapByType(dxQueryVo.getType(), dxQueryVo.getBeginDate(), dxQueryVo.getEndDate());
|
|
|
+ dxQueryVo.setBeginDate(map.get("startDate"));
|
|
|
+ dxQueryVo.setEndDate(map.get("endDate"));
|
|
|
return HttpResult.ok(dxDataService.queryDxDataDayPage(dxQueryVo));
|
|
|
}
|
|
|
|
|
|
@@ -159,4 +168,41 @@ public class KhglDataController {
|
|
|
}
|
|
|
return HttpResult.ok(dxDataService.queryGroupListByDeptId(deptId,"3"));
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/6/19 11:57
|
|
|
+ * @Description: 通过时间类型判断
|
|
|
+ */
|
|
|
+ private static HashMap<String,String> getDateMapByType(String type, String startDate, String endDate) {
|
|
|
+ HashMap<String,String> map =new HashMap<>();
|
|
|
+ String startDateStr="";
|
|
|
+ String endDateStr="";
|
|
|
+ if(org.apache.commons.lang3.StringUtils.isNotBlank(startDate) && org.apache.commons.lang3.StringUtils.isNotBlank(endDate)){
|
|
|
+ startDateStr= org.apache.commons.lang3.StringUtils.isNotBlank(startDate)?startDate+" 00:00:00":null;
|
|
|
+ endDateStr= org.apache.commons.lang3.StringUtils.isNotBlank(endDate)?endDate+" 23:59:59":null;
|
|
|
+ }else{
|
|
|
+ if(StringUtils.isBlank(type)){
|
|
|
+ startDateStr= SliceUpDateUtil.getBeforeDay(new Date(),0)+" 00:00:00";
|
|
|
+ endDateStr=SliceUpDateUtil.getBeforeDay(new Date(),0)+" 23:59:59";
|
|
|
+ }
|
|
|
+ if("1".equals(type)){
|
|
|
+ // 近1天
|
|
|
+ startDateStr= SliceUpDateUtil.getBeforeDay(new Date(),0)+" 00:00:00";
|
|
|
+ endDateStr=SliceUpDateUtil.getBeforeDay(new Date(),0)+" 23:59:59";
|
|
|
+ }else if("2".equals(type)){
|
|
|
+ // 近7天
|
|
|
+ startDateStr=SliceUpDateUtil.getBeforeDay(new Date(),1)+" 00:00:00";
|
|
|
+ endDateStr=SliceUpDateUtil.getBeforeDay(new Date(),0)+" 23:59:59";
|
|
|
+ }else if("3".equals(type)){
|
|
|
+ // 近30天
|
|
|
+ startDateStr=SliceUpDateUtil.getBeforeDay(new Date(),6)+" 00:00:00";
|
|
|
+ endDateStr=SliceUpDateUtil.getBeforeDay(new Date(),0)+" 23:59:59";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put("startDate",startDateStr);
|
|
|
+ map.put("endDate",endDateStr);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
}
|