|
@@ -1,10 +1,12 @@
|
|
|
package com.mokamrp.privates.controller.pangu;
|
|
package com.mokamrp.privates.controller.pangu;
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.mokamrp.privates.constant.HttpStatus;
|
|
import com.mokamrp.privates.constant.HttpStatus;
|
|
|
import com.mokamrp.privates.controller.BaseController;
|
|
import com.mokamrp.privates.controller.BaseController;
|
|
|
import com.mokamrp.privates.entity.EditHandle;
|
|
import com.mokamrp.privates.entity.EditHandle;
|
|
|
import com.mokamrp.privates.entity.pangu.FosterwxMobilePoolHandle;
|
|
import com.mokamrp.privates.entity.pangu.FosterwxMobilePoolHandle;
|
|
|
|
|
+import com.mokamrp.privates.entity.pangu.TyperBean;
|
|
|
import com.mokamrp.privates.help.AjaxResult;
|
|
import com.mokamrp.privates.help.AjaxResult;
|
|
|
import com.mokamrp.privates.interceptor.AuthUser;
|
|
import com.mokamrp.privates.interceptor.AuthUser;
|
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxFlowList;
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxFlowList;
|
|
@@ -13,17 +15,19 @@ import com.mokamrp.privates.mapper.pojo.User;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxFlowListService;
|
|
import com.mokamrp.privates.service.pangu.FosterwxFlowListService;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxMobilePoolService;
|
|
import com.mokamrp.privates.service.pangu.FosterwxMobilePoolService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
+import org.springframework.http.HttpEntity;
|
|
|
|
|
+import org.springframework.http.HttpMethod;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
-import java.util.Arrays;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -44,6 +48,12 @@ public class FosterwxMobilePoolController extends BaseController<FosterwxMobileP
|
|
|
@Autowired
|
|
@Autowired
|
|
|
public FosterwxFlowListService fosterwxFlowListService;
|
|
public FosterwxFlowListService fosterwxFlowListService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private RestTemplate restTemplate;
|
|
|
|
|
+
|
|
|
|
|
+ @Value("${typer.url}")
|
|
|
|
|
+ private String domain;
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* @fast
|
|
* @fast
|
|
|
* 默认生成的控制器所继承的父类中有index/add/edit/del四个基础方法,均为post json请求
|
|
* 默认生成的控制器所继承的父类中有index/add/edit/del四个基础方法,均为post json请求
|
|
@@ -78,6 +88,23 @@ public class FosterwxMobilePoolController extends BaseController<FosterwxMobileP
|
|
|
}
|
|
}
|
|
|
fosterwxMobilePoolService.updateById(editHandle.getRaw());
|
|
fosterwxMobilePoolService.updateById(editHandle.getRaw());
|
|
|
|
|
|
|
|
|
|
+ // 判断专挑或阈值是否有更改
|
|
|
|
|
+ Map<String, Object> body = new HashMap<>(1);
|
|
|
|
|
+ body.put("ids", id);
|
|
|
|
|
+ boolean ischange = false;
|
|
|
|
|
+ if (!Objects.equals(oldVO.getStatus(), editHandle.getRaw().getStatus())) {
|
|
|
|
|
+ ischange = true;
|
|
|
|
|
+ body.put("status", editHandle.getRaw().getStatus() == 0 ? 2 : 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!Objects.equals(oldVO.getMaxFans(), editHandle.getRaw().getMaxFans())) {
|
|
|
|
|
+ ischange = true;
|
|
|
|
|
+ body.put("threshold", editHandle.getRaw().getMaxFans());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (ischange) {
|
|
|
|
|
+ HttpEntity<Map<String, Object>> httpEntity = new HttpEntity<>(body, null);
|
|
|
|
|
+ JSONObject result = restTemplate.exchange(domain + "/poster/qrcode/update", HttpMethod.POST, httpEntity, JSONObject.class).getBody();
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
return AjaxResult.success("新增成功!");
|
|
return AjaxResult.success("新增成功!");
|
|
|
}
|
|
}
|
|
@@ -101,6 +128,40 @@ public class FosterwxMobilePoolController extends BaseController<FosterwxMobileP
|
|
|
return AjaxResult.success(res);
|
|
return AjaxResult.success(res);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @PostMapping("/loadInTyper")
|
|
|
|
|
+ public Object loadInTyper(@Valid @RequestBody EditHandle<FosterwxMobilePool> editHandle) {
|
|
|
|
|
+ List<FosterwxMobilePool> fosterwxMobilePoolList = fosterwxMobilePoolService.list(new LambdaQueryWrapper<FosterwxMobilePool>().in(FosterwxMobilePool::getId, editHandle.getIds().split(",")));
|
|
|
|
|
+ List<TyperBean> typerBeans = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
+ fosterwxMobilePoolList.forEach(fosterwxMobilePool -> {
|
|
|
|
|
+ TyperBean typerBean = new TyperBean();
|
|
|
|
|
+ typerBean.setHera_id(fosterwxMobilePool.getId());
|
|
|
|
|
+ typerBean.setQrcode_id(fosterwxMobilePool.getPoolIndex());
|
|
|
|
|
+ typerBean.setSite_id(String.valueOf(fosterwxMobilePool.getStationId()));
|
|
|
|
|
+ typerBean.setQw_appid(fosterwxMobilePool.getWxAppid());
|
|
|
|
|
+ typerBean.setSite_tel(fosterwxMobilePool.getMobileNo());
|
|
|
|
|
+ typerBean.setCode_url(fosterwxMobilePool.getCodeUrl());
|
|
|
|
|
+ typerBean.setThreshold(Integer.valueOf(fosterwxMobilePool.getMaxFans()));
|
|
|
|
|
+ typerBean.setCustomer_tel(fosterwxMobilePool.getBusMobileNo());
|
|
|
|
|
+ typerBean.setStatus(0 == fosterwxMobilePool.getStatus() ? 2 : 1);
|
|
|
|
|
+
|
|
|
|
|
+ typerBeans.add(typerBean);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> body = new HashMap<>(1);
|
|
|
|
|
+ body.put("data", typerBeans);
|
|
|
|
|
+ HttpEntity<Map<String, Object>> httpEntity = new HttpEntity<>(body, null);
|
|
|
|
|
+ JSONObject result = restTemplate.exchange(domain + "/poster/qrcode", HttpMethod.POST, httpEntity, JSONObject.class).getBody();
|
|
|
|
|
+
|
|
|
|
|
+ if (null != result) {
|
|
|
|
|
+ if ("200".equals(result.get("code"))) {
|
|
|
|
|
+ return AjaxResult.success(result.get("data").toString());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return AjaxResult.error(result.get("data").toString());
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return AjaxResult.error("划入失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|