|
@@ -1,12 +1,20 @@
|
|
package com.diagbot.facade;
|
|
package com.diagbot.facade;
|
|
|
|
|
|
|
|
+import com.diagbot.dto.OptDTO;
|
|
import com.diagbot.entity.OptInfo;
|
|
import com.diagbot.entity.OptInfo;
|
|
|
|
+import com.diagbot.exception.CommonErrorCode;
|
|
|
|
+import com.diagbot.exception.CommonException;
|
|
import com.diagbot.service.impl.OptInfoServiceImpl;
|
|
import com.diagbot.service.impl.OptInfoServiceImpl;
|
|
import com.diagbot.util.DateUtil;
|
|
import com.diagbot.util.DateUtil;
|
|
import com.diagbot.util.HttpUtils;
|
|
import com.diagbot.util.HttpUtils;
|
|
|
|
+import com.diagbot.vo.OptVO;
|
|
|
|
+import io.github.lvyahui8.spring.aggregate.facade.DataBeanAggregateQueryFacade;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description:
|
|
* @Description:
|
|
@@ -15,8 +23,10 @@ import java.util.Date;
|
|
*/
|
|
*/
|
|
@Component
|
|
@Component
|
|
public class OptInfoFacade extends OptInfoServiceImpl {
|
|
public class OptInfoFacade extends OptInfoServiceImpl {
|
|
|
|
+ @Autowired
|
|
|
|
+ DataBeanAggregateQueryFacade dataBeanAggregateQueryFacade;
|
|
|
|
|
|
- public Boolean saveOptOnfo(String optType){
|
|
|
|
|
|
+ public Boolean saveOptOnfo(String optType) {
|
|
OptInfo optInfo = new OptInfo();
|
|
OptInfo optInfo = new OptInfo();
|
|
Date now = DateUtil.now();
|
|
Date now = DateUtil.now();
|
|
optInfo.setGmtModified(now);
|
|
optInfo.setGmtModified(now);
|
|
@@ -26,4 +36,37 @@ public class OptInfoFacade extends OptInfoServiceImpl {
|
|
Boolean res = this.save(optInfo);
|
|
Boolean res = this.save(optInfo);
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public OptDTO getOptSum(OptVO optVO) {
|
|
|
|
+ if (null != optVO && null != optVO.getStartDate()) {
|
|
|
|
+ optVO.setStartDate(DateUtil.getFirstTimeOfDay(optVO.getStartDate()));
|
|
|
|
+ }
|
|
|
|
+ if (null != optVO && null != optVO.getEndDate()) {
|
|
|
|
+ optVO.setEndDate(DateUtil.getLastTimeOfDay(optVO.getEndDate()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (null != optVO && null != optVO.getStartDate() && null != optVO.getEndDate()) {
|
|
|
|
+ if (DateUtil.after(optVO.getStartDate(), optVO.getEndDate())) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间大于结束时间!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ OptDTO optDTO = new OptDTO();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ Map<String, Object> invokeParams = new HashMap<>();
|
|
|
|
+ invokeParams.put("optVO",optVO);
|
|
|
|
+ optDTO
|
|
|
|
+ = dataBeanAggregateQueryFacade.get("getAllOptSum", invokeParams, OptDTO.class);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR);
|
|
|
|
+ }
|
|
|
|
+// optDTO.setPvdto(this.getPV(optVO));
|
|
|
|
+// optDTO.setPvSum(this.getPVSum(optVO));
|
|
|
|
+// optDTO.setUvdto(this.getUV(optVO));
|
|
|
|
+// optDTO.setUvSum(this.getUVSum(optVO));
|
|
|
|
+// optDTO.setZzdto(this.getZZ(optVO));
|
|
|
|
+// optDTO.setZzSum(this.getZZSum(optVO));
|
|
|
|
+ return optDTO;
|
|
|
|
+ }
|
|
}
|
|
}
|