请求波司登获取数据·

master
yechenhao 6 years ago
parent 93b6c5de78
commit b14c17bfb9

@ -43,6 +43,7 @@ import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -101,6 +102,9 @@ public class StoreEmployeeService {
@Autowired @Autowired
private CustomerViewService customerViewService; private CustomerViewService customerViewService;
@Value("${bsd.qrCode}")
private String qrCodeBsdUrl;
/** /**
* *
* *
@ -190,7 +194,7 @@ public class StoreEmployeeService {
params.put("type", type); params.put("type", type);
params.put("state", state); params.put("state", state);
params.put("storeNo", storeNo); params.put("storeNo", storeNo);
String message = HttpClientUtil.httpPost("http://10.101.10.24:80/BSD_WXAPP/qyWechat/getShareQRcode?token=" + MD5FileUtil.getMD5String("BOSIDENG" + sdf.format(new Date())), JSONObject.toJSONString(params)).getMessage(); String message = HttpClientUtil.httpPost(qrCodeBsdUrl + MD5FileUtil.getMD5String("BOSIDENG" + sdf.format(new Date())), JSONObject.toJSONString(params)).getMessage();
JSONObject qrCodeJson = JSONObject.parseObject(message); JSONObject qrCodeJson = JSONObject.parseObject(message);
BsdShareCodeResponse bsdResponse = qrCodeJson.toJavaObject(BsdShareCodeResponse.class); BsdShareCodeResponse bsdResponse = qrCodeJson.toJavaObject(BsdShareCodeResponse.class);
if (bsdResponse.getSuccess()){ if (bsdResponse.getSuccess()){

@ -19,6 +19,7 @@ import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.api.WxCpService; import me.chanjar.weixin.cp.api.WxCpService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -51,6 +52,10 @@ public class StorePromotionDataService {
@Autowired @Autowired
private PrivilageDomainService privilageDomainService; private PrivilageDomainService privilageDomainService;
@Value("${bsd.userBehavior}")
private String userBehavior;
/** /**
* 广 * 广
* @param storeId * @param storeId
@ -292,7 +297,7 @@ public class StorePromotionDataService {
params.put("start_time",wxCusInfoReqDO.getStart_time()); params.put("start_time",wxCusInfoReqDO.getStart_time());
params.put("end_time",wxCusInfoReqDO.getEnd_time()); params.put("end_time",wxCusInfoReqDO.getEnd_time());
params.put("userid",wxCusInfoReqDO.getUserid()); params.put("userid",wxCusInfoReqDO.getUserid());
String result = HttpUtil.get("http://10.101.10.24:80/BSD_WXAPP/qyWechat/getUserBehaviorData?token==BOSIDENG" + MD5FileUtil.getMD5String(sdf.format(new Date())), params); String result = HttpUtil.get(userBehavior + MD5FileUtil.getMD5String("BOSIDENG"+sdf.format(new Date())), params);
JSONObject parseObject = JSON.parseObject(result); JSONObject parseObject = JSON.parseObject(result);
System.out.println(parseObject); System.out.println(parseObject);
String[] behavior_data = JSONObject.parseObject(parseObject.getString("behavior_data"), String[].class); String[] behavior_data = JSONObject.parseObject(parseObject.getString("behavior_data"), String[].class);

@ -21,12 +21,14 @@ import com.kiisoo.ic.store.mapper.PrivilageCpUserStoreDOMapper;
import com.kiisoo.ic.synchronous.entity.PromotionDO; import com.kiisoo.ic.synchronous.entity.PromotionDO;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import static com.kiisoo.ic.employee.constant.Constants.DATABASE_CP_USER_ID_KEY; import static com.kiisoo.ic.employee.constant.Constants.DATABASE_CP_USER_ID_KEY;
import static com.kiisoo.ic.store.constant.Constants.BSD_REQ_QRCODE_TYPE_SELLER;
import static com.kiisoo.ic.store.constant.Constants.BSD_REQ_QRCODE_TYPE_STORE; import static com.kiisoo.ic.store.constant.Constants.BSD_REQ_QRCODE_TYPE_STORE;
@Service @Service
@ -50,6 +52,9 @@ public class PromotionCodeService {
return MD5FileUtil.getMD5String(token+date); return MD5FileUtil.getMD5String(token+date);
} }
@Value("${bsd.qrCode}")
private String qrCodeBsdUrl;
/** /**
* *
*/ */
@ -101,7 +106,7 @@ public class PromotionCodeService {
params.put("type", type); params.put("type", type);
params.put("state", state); params.put("state", state);
params.put("storeNo", storeNo); params.put("storeNo", storeNo);
String message = HttpClientUtil.httpPost("http://10.101.10.24:80/BSD_WXAPP/qyWechat/getShareQRcode?token=" + MD5FileUtil.getMD5String("BOSIDENG" + sdf.format(new Date())), JSONObject.toJSONString(params)).getMessage(); String message = HttpClientUtil.httpPost(qrCodeBsdUrl + MD5FileUtil.getMD5String("BOSIDENG" + sdf.format(new Date())), JSONObject.toJSONString(params)).getMessage();
JSONObject qrCodeJson = JSONObject.parseObject(message); JSONObject qrCodeJson = JSONObject.parseObject(message);
BsdShareCodeResponse bsdResponse = qrCodeJson.toJavaObject(BsdShareCodeResponse.class); BsdShareCodeResponse bsdResponse = qrCodeJson.toJavaObject(BsdShareCodeResponse.class);
if (bsdResponse.getSuccess()){ if (bsdResponse.getSuccess()){
@ -118,22 +123,16 @@ public class PromotionCodeService {
List<PoiStoreStaff> sellers = poiStoreStaffDOMapper.selectList(null); List<PoiStoreStaff> sellers = poiStoreStaffDOMapper.selectList(null);
sellers.forEach(item ->{ sellers.forEach(item ->{
if(item.getEpWechatQrCode() == null){ if(item.getEpWechatQrCode() == null){
PromotionDO p = new PromotionDO(); String cpUserId = privilageCpUserStoreDOMapper.selectCpUserIdByStoreId(item.getStoreId());
p.setUserId(item.getCustomerUserId()+""); String url = null;
p.setType("1"); try {
p.setState(item.getStaffCode()); url = getQrCodeFromBSD(cpUserId, BSD_REQ_QRCODE_TYPE_SELLER, item.getStaffCode(), item.getStoreCode());
} catch (Exception e) {
//没有推广码则查询 e.printStackTrace();
HttpResult data = HttpClientUtil.httpPost("http://10.101.10.24:80/BSD_WXAPP/qyWechat/getShareQRcode?token=TOKEN", JSON.toJSONString(p),getToken());
//http返回参数
if((boolean) JSONObject.parseObject(data.getMessage()).get("success")){
String url = JSONObject.parseObject(data.getMessage()).get("data").toString();
//没有推广码则查询
item.setEpWechatQrCode(url);
poiStoreStaffDOMapper.updateById(item);
} }
//没有推广码则查询
item.setEpWechatQrCode(url);
poiStoreStaffDOMapper.updateById(item);
} }
}); });

@ -17,3 +17,5 @@ spring:
bsd: bsd:
vip: http://10.101.10.24:80/BSD_WXAPP/miniProgram/getMemberDtlByUnionId vip: http://10.101.10.24:80/BSD_WXAPP/miniProgram/getMemberDtlByUnionId
qrCode: http://10.101.10.24:80/BSD_WXAPP/qyWechat/getShareQRcode?token=
userBehavior: http://10.101.10.24:80/BSD_WXAPP/qyWechat/getUserBehaviorData?token=

Loading…
Cancel
Save