|
|
@ -31,9 +31,6 @@ import java.util.List; |
|
|
|
@RestController("com.yxt.supervise.report.biz.projectdaily.ProjectDailyRest") |
|
|
|
@RequestMapping("/projectdaily") |
|
|
|
public class ProjectDailyRest { |
|
|
|
String APP_ID = "wx05604ce2a8bede05"; |
|
|
|
String SECRET = "3d36e8a61212cf773a2fa4e6c9a83334"; |
|
|
|
private static final String WX_URL_LOGIN = "https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code "; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private FileUploadComponent fileUploadComponent; |
|
|
@ -102,7 +99,7 @@ public class ProjectDailyRest { |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (StringUtils.isNoneBlank(ProjectDailys.getWxCode())) { |
|
|
|
ResultBean<JSONObject> rbJsonObject = wxLogin(ProjectDailys.getWxCode(), APP_ID, SECRET); |
|
|
|
ResultBean<JSONObject> rbJsonObject = projectDailyService.wxLogin(ProjectDailys.getWxCode(), "", ""); |
|
|
|
JSONObject jsonObject = rbJsonObject.getData(); |
|
|
|
String openid = jsonObject.get("openid").toString(); |
|
|
|
String userSid = systemMapper.getUserSidByOpenid(openid); |
|
|
@ -129,7 +126,7 @@ public class ProjectDailyRest { |
|
|
|
return rb.success().setData(pv); |
|
|
|
} |
|
|
|
public boolean changState(String wxCode,String sid){ |
|
|
|
ResultBean<JSONObject> rbJsonObject = wxLogin(wxCode, APP_ID, SECRET); |
|
|
|
ResultBean<JSONObject> rbJsonObject = projectDailyService.wxLogin(wxCode,"",""); |
|
|
|
JSONObject jsonObject = rbJsonObject.getData(); |
|
|
|
String openid = jsonObject.get("openid").toString(); |
|
|
|
//String userSid = systemMapper.getUserSidByOpenid(openid);
|
|
|
@ -162,13 +159,4 @@ public class ProjectDailyRest { |
|
|
|
return rb.success().setData(projectDailyVoPagerVo); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<JSONObject> wxLogin(String jsCode, String appid, String secret) { |
|
|
|
ResultBean rb = new ResultBean(); |
|
|
|
String url = WX_URL_LOGIN.replace("APPID", APP_ID).replace("SECRET", SECRET).replace("JSCODE", jsCode).replace("authorization_code", "authorization_code"); |
|
|
|
RestTemplate restTemplate = new RestTemplate(); |
|
|
|
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(forEntity.getBody()); |
|
|
|
System.out.println(jsonObject); |
|
|
|
return rb.success().setData(jsonObject); |
|
|
|
} |
|
|
|
} |
|
|
|