|
@@ -0,0 +1,90 @@
|
|
|
|
|
+package com.ydtech.modules.admin.service.impl;
|
|
|
|
|
+
|
|
|
|
|
+import com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisDto;
|
|
|
|
|
+import com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisQueryDto;
|
|
|
|
|
+import com.ydtech.modules.admin.service.ProfitAnalysisService;
|
|
|
|
|
+import com.ydtech.modules.admin.utils.SliceUpDateUtil;
|
|
|
|
|
+import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.Calendar;
|
|
|
|
|
+import java.util.Date;
|
|
|
|
|
+import java.util.HashMap;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * @version
|
|
|
|
|
+ * @author: hxl
|
|
|
|
|
+ * @Date: 2024/7/1 11:36
|
|
|
|
|
+ * @Description: 控制台-运营数据
|
|
|
|
|
+ */
|
|
|
|
|
+@Service
|
|
|
|
|
+public class ProfitAnalysisServiceImpl implements ProfitAnalysisService {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private InsPlyIncomeMapper insPlyIncomeMapper;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @version
|
|
|
|
|
+ * @author: hxl
|
|
|
|
|
+ * @Date: 2024/7/31 17:42
|
|
|
|
|
+ * @Description: 查询利润数据
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<ProfitAnalysisDto> queryPage(ProfitAnalysisQueryDto profitAnalysisQueryDto) {
|
|
|
|
|
+ HashMap<String, String> dateMapByType = getDateMapByType(profitAnalysisQueryDto.getDateType(), profitAnalysisQueryDto.getYear());
|
|
|
|
|
+ profitAnalysisQueryDto.setBeginDate(dateMapByType.get("startDate"));
|
|
|
|
|
+ profitAnalysisQueryDto.setEndDate(dateMapByType.get("endDate"));
|
|
|
|
|
+ List<ProfitAnalysisDto> list = insPlyIncomeMapper.queryPage(profitAnalysisQueryDto);
|
|
|
|
|
+ return list;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @version
|
|
|
|
|
+ * @author: hxl
|
|
|
|
|
+ * @Date: 2024/6/19 11:57
|
|
|
|
|
+ * @Description: 通过时间类型判断
|
|
|
|
|
+ */
|
|
|
|
|
+ private static HashMap<String,String> getDateMapByType(String type, String year) {
|
|
|
|
|
+ HashMap<String,String> map =new HashMap<>();
|
|
|
|
|
+ String startDateStr="";
|
|
|
|
|
+ String endDateStr="";
|
|
|
|
|
+ if(StringUtils.isBlank(year) && StringUtils.isBlank(type)){
|
|
|
|
|
+ Calendar cale = Calendar.getInstance();
|
|
|
|
|
+ int yearNow = cale.get(Calendar.YEAR);
|
|
|
|
|
+ startDateStr= SliceUpDateUtil.getYearBeginDateStr(yearNow)+" 00:00:00";
|
|
|
|
|
+ endDateStr= SliceUpDateUtil.getYearEndDateStr(yearNow)+" 23:59:59";
|
|
|
|
|
+ }else{
|
|
|
|
|
+ if(StringUtils.isNotBlank(year)){
|
|
|
|
|
+ startDateStr= SliceUpDateUtil.getYearBeginDateStr(Integer.parseInt(year))+" 00:00:00";
|
|
|
|
|
+ endDateStr= SliceUpDateUtil.getYearEndDateStr(Integer.parseInt(year))+" 23:59:59";
|
|
|
|
|
+ }else{
|
|
|
|
|
+ if(StringUtils.isNotBlank(type)){
|
|
|
|
|
+ if("1".equals(type)){
|
|
|
|
|
+ // 一月内
|
|
|
|
|
+ startDateStr=SliceUpDateUtil.getBeforeDay(new Date(),2)+" 00:00:00";
|
|
|
|
|
+ endDateStr=SliceUpDateUtil.getBeforeDay(new Date(),0)+" 23:59:59";
|
|
|
|
|
+ }else if("2".equals(type)){
|
|
|
|
|
+ // 三月内
|
|
|
|
|
+ startDateStr=SliceUpDateUtil.getBeforeDay(new Date(),3)+" 00:00:00";
|
|
|
|
|
+ endDateStr=SliceUpDateUtil.getBeforeDay(new Date(),0)+" 23:59:59";
|
|
|
|
|
+ }else if("3".equals(type)){
|
|
|
|
|
+ // 近半年
|
|
|
|
|
+ startDateStr=SliceUpDateUtil.getBeforeDay(new Date(),4)+" 00:00:00";
|
|
|
|
|
+ endDateStr=SliceUpDateUtil.getBeforeDay(new Date(),0)+" 23:59:59";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ map.put("startDate",startDateStr);
|
|
|
|
|
+ map.put("endDate",endDateStr);
|
|
|
|
|
+ return map;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|