|
|
@@ -0,0 +1,63 @@
|
|
|
+package com.poteviohealth.cgp.statistics.controller;
|
|
|
+
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import com.poteviohealth.cgp.common.controller.BaseController;
|
|
|
+import com.poteviohealth.cgp.common.integrated.statistics.model.FingerParams;
|
|
|
+import com.poteviohealth.cgp.common.model.VaultsResponse;
|
|
|
+import com.poteviohealth.cgp.statistics.mapstruct.DistinctionConverter;
|
|
|
+import com.poteviohealth.cgp.statistics.model.Distinction;
|
|
|
+import com.poteviohealth.cgp.statistics.service.IDistinctionService;
|
|
|
+import com.poteviohealth.cgp.statistics.utils.OssUtils;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 统计回调类
|
|
|
+ * @author Qin
|
|
|
+ */
|
|
|
+@Controller
|
|
|
+@RequestMapping("/statistics/receive")
|
|
|
+@Slf4j
|
|
|
+public class ReceiveController extends BaseController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IDistinctionService distinctionService;
|
|
|
+ @Resource
|
|
|
+ private OssUtils ossUtils;
|
|
|
+
|
|
|
+ @RequestMapping(value = "/jumpImage", method = {RequestMethod.POST})
|
|
|
+ @ResponseBody
|
|
|
+ public VaultsResponse jumpImage(){
|
|
|
+ List<Distinction> list = Lists.newArrayList();
|
|
|
+ List<FingerParams> orderList = distinctionService.getFinishOrderList();
|
|
|
+ for (FingerParams params : orderList) {
|
|
|
+ List<String> urlList = Lists.newArrayList();
|
|
|
+ if(StringUtils.isNotEmpty(params.getStartUrl())){
|
|
|
+ urlList.addAll(Arrays.asList(params.getStartUrl().split(",")));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(params.getEndUrl())){
|
|
|
+ urlList.addAll(Arrays.asList(params.getEndUrl().split(",")));
|
|
|
+ }
|
|
|
+ params.setUrlList(urlList);
|
|
|
+ for (String s : params.getUrlList()) {
|
|
|
+ Distinction distinction = DistinctionConverter.INSTANCE.model2WebDTO(params);
|
|
|
+ String uid = ossUtils.getFileFinger(s);
|
|
|
+ distinction.setUid(uid);
|
|
|
+ distinction.setUrl(s);
|
|
|
+ list.add(distinction);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ distinctionService.insertBatch(list);
|
|
|
+ return VaultsResponse.success();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|