|
|
@@ -1,87 +1,103 @@
|
|
|
-/* */ package com.picc.grab.controller.grab;
|
|
|
-/* */ import com.alibaba.fastjson.JSONObject;
|
|
|
-/* */ import com.picc.grab.config.PiccGrabConfig;
|
|
|
-/* */ import com.picc.grab.domain.Piccgrabaccount;
|
|
|
-/* */ import com.picc.grab.entity.common.dto.piccLoginResult;
|
|
|
-/* */ import com.picc.grab.entity.common.vo.ResultVO;
|
|
|
-/* */ import com.picc.grab.service.IPiccgrabaccountService;
|
|
|
-/* */ import com.picc.grab.util.GrabUtil;
|
|
|
-/* */ import com.picc.grab.util.StringUtil;
|
|
|
-/* */ import java.io.ByteArrayOutputStream;
|
|
|
-/* */ import java.io.IOException;
|
|
|
-/* */ import java.io.InputStream;
|
|
|
-/* */ import java.io.UnsupportedEncodingException;
|
|
|
-/* */ import java.util.HashMap;
|
|
|
-/* */ import java.util.Map;
|
|
|
-/* */ import javax.servlet.ServletOutputStream;
|
|
|
-/* */ import javax.servlet.http.HttpServletResponse;
|
|
|
-/* */ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-/* */ import org.springframework.transaction.annotation.Transactional;
|
|
|
-/* */ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-/* */ import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
-/* */ import org.springframework.web.bind.annotation.RestController;
|
|
|
-/* */
|
|
|
-/* */ @RestController
|
|
|
-/* */ @RequestMapping({"/grabLogin"})
|
|
|
-/* */ @Transactional
|
|
|
-/* */ public class GrabLoginController {
|
|
|
-/* */ @Autowired
|
|
|
-/* */ private IPiccgrabaccountService piccgrabaccount;
|
|
|
-/* */
|
|
|
-/* */ @RequestMapping({"/getCode"})
|
|
|
-/* */ public void getCode(Integer id, HttpServletResponse httpServletResponse) throws IOException {
|
|
|
-/* 33 */ GrabUtil httpsGet = new GrabUtil();
|
|
|
-/* 34 */ InputStream input = httpsGet.getHttpsConn(this.piccGrabConfig.getImgurl() + System.currentTimeMillis(), "GET", null, null);
|
|
|
-/* 35 */ String cookieStore = httpsGet.cookieStore;
|
|
|
-/* 36 */ ByteArrayOutputStream bitstream = httpsGet.cloneInputStream(input);
|
|
|
-/* 37 */ byte[] img = bitstream.toByteArray();
|
|
|
-/* 38 */ httpServletResponse.setContentType("image/png");
|
|
|
-/* 39 */ ServletOutputStream servletOutputStream = httpServletResponse.getOutputStream();
|
|
|
-/* 40 */ Piccgrabaccount model = (Piccgrabaccount)this.piccgrabaccount.selectById(id);
|
|
|
-/* 41 */ model.setCookie(cookieStore);
|
|
|
-/* 42 */ this.piccgrabaccount.updateAllColumnById(model);
|
|
|
-/* 43 */ servletOutputStream.write(img);
|
|
|
-/* 44 */ servletOutputStream.flush();
|
|
|
-/* 45 */ servletOutputStream.close();
|
|
|
-/* */ } @Autowired
|
|
|
-/* */ private PiccGrabConfig piccGrabConfig;
|
|
|
-/* */ @RequestMapping({"/getToken"})
|
|
|
-/* */ @ResponseBody
|
|
|
-/* */ public ResultVO getToken(String code, Integer id) throws UnsupportedEncodingException {
|
|
|
-/* 51 */ GrabUtil httpsUtil = new GrabUtil();
|
|
|
-/* 52 */ Piccgrabaccount model = (Piccgrabaccount)this.piccgrabaccount.selectById(id);
|
|
|
-/* 53 */ Map<String, String> param = new HashMap<>();
|
|
|
-/* 54 */ param.put("password", model.getPassword());
|
|
|
-/* 55 */ param.put("username", model.getAccount());
|
|
|
-/* 56 */ param.put("validCode", code);
|
|
|
-/* 57 */ String str = httpsUtil.getHttpsByCookieConn(this.piccGrabConfig.getLoginurl(), param, model.getCookie(), "");
|
|
|
-/* 58 */ piccLoginResult result = (piccLoginResult)JSONObject.parseObject(str, piccLoginResult.class);
|
|
|
-/* 59 */ if (result.getCode().equals("200") && StringUtil.isAllNotBlank(new CharSequence[] { result.getToken() })) {
|
|
|
-/* 60 */ model.setToken(result.getToken());
|
|
|
-/* 61 */ model.setYzm(code);
|
|
|
-/* 62 */ model.setLogIn(Integer.valueOf(1));
|
|
|
-/* 63 */ this.piccgrabaccount.updateAllColumnById(model);
|
|
|
-/* 64 */ return ResultVO.success();
|
|
|
-/* */ }
|
|
|
-/* 66 */ return ResultVO.error("登录失败");
|
|
|
-/* */ }
|
|
|
-/* */
|
|
|
-/* */
|
|
|
-/* */ @RequestMapping({"/getList"})
|
|
|
-/* */ public String getList(int id) {
|
|
|
-/* 72 */ return "";
|
|
|
-/* */ }
|
|
|
-/* */
|
|
|
-/* */
|
|
|
-/* */ @RequestMapping({"/bidPrice"})
|
|
|
-/* */ public String bidPrice(int id) {
|
|
|
-/* 78 */ this.piccgrabaccount.sendBidPrice(id);
|
|
|
-/* 79 */ return "";
|
|
|
-/* */ }
|
|
|
-/* */ }
|
|
|
+package com.picc.grab.controller.grab;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.picc.grab.config.PiccGrabConfig;
|
|
|
+import com.picc.grab.domain.Piccgrabaccount;
|
|
|
+import com.picc.grab.entity.common.dto.piccLoginResult;
|
|
|
+import com.picc.grab.entity.common.vo.ResultVO;
|
|
|
+import com.picc.grab.service.IPiccgrabaccountService;
|
|
|
+import com.picc.grab.util.GrabUtil;
|
|
|
+import com.picc.grab.util.StringUtil;
|
|
|
+import java.io.ByteArrayOutputStream;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.InputStream;
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+import javax.servlet.ServletOutputStream;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+@RestController
|
|
|
+@RequestMapping({"/grabLogin"})
|
|
|
+@Transactional
|
|
|
+public class GrabLoginController {
|
|
|
+ @Autowired
|
|
|
+ private IPiccgrabaccountService piccgrabaccount;
|
|
|
|
|
|
-/* Location: C:\Users\Administrator\Desktop\ROOT\WEB-INF\classes\!\com\picc\grab\controller\grab\GrabLoginController.class
|
|
|
- * Java compiler version: 8 (52.0)
|
|
|
- * JD-Core Version: 1.1.3
|
|
|
- */
|
|
|
+ @RequestMapping({"/getCode"})
|
|
|
+ public void getCode(Integer id, HttpServletResponse httpServletResponse) throws IOException {
|
|
|
+ GrabUtil httpsGet = new GrabUtil();
|
|
|
+ InputStream input = httpsGet.getHttpsConn(this.piccGrabConfig.getImgurl() + System.currentTimeMillis(), "GET", null, null);
|
|
|
+ String cookieStore = httpsGet.cookieStore;
|
|
|
+ ByteArrayOutputStream bitstream = httpsGet.cloneInputStream(input);
|
|
|
+ byte[] img = bitstream.toByteArray();
|
|
|
+ httpServletResponse.setContentType("image/png");
|
|
|
+ ServletOutputStream servletOutputStream = httpServletResponse.getOutputStream();
|
|
|
+ Piccgrabaccount model = this.piccgrabaccount.selectById(id);
|
|
|
+ model.setCookie(cookieStore);
|
|
|
+ this.piccgrabaccount.updateAllColumnById(model);
|
|
|
+ servletOutputStream.write(img);
|
|
|
+ servletOutputStream.flush();
|
|
|
+ servletOutputStream.close();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PiccGrabConfig piccGrabConfig;
|
|
|
+
|
|
|
+ @RequestMapping({"/getToken"})
|
|
|
+ @ResponseBody
|
|
|
+ public ResultVO getToken(String code, Integer id) {
|
|
|
+ GrabUtil httpsUtil = new GrabUtil();
|
|
|
+ Piccgrabaccount model = this.piccgrabaccount.selectById(id);
|
|
|
+ Map<String, String> param = new HashMap<>();
|
|
|
+ param.put("password", model.getPassword());
|
|
|
+ param.put("username", model.getAccount());
|
|
|
+ param.put("validCode", code);
|
|
|
+ String str = httpsUtil.getHttpsByCookieConn(this.piccGrabConfig.getLoginurl(), param, model.getCookie(), "");
|
|
|
+ piccLoginResult result = JSONObject.parseObject(str, piccLoginResult.class);
|
|
|
+ System.err.println(result.getCode());
|
|
|
+ System.err.println(result.getToken());
|
|
|
+ System.err.println(result.getMsg());
|
|
|
+ System.err.println(result.getState());
|
|
|
+ if (result.getCode().equals("200") && StringUtil.isAllNotBlank(new CharSequence[] { result.getToken() })) {
|
|
|
+ model.setToken(result.getToken());
|
|
|
+ model.setYzm(code);
|
|
|
+ model.setLogIn(Integer.valueOf(1));
|
|
|
+ this.piccgrabaccount.updateAllColumnById(model);
|
|
|
+ return ResultVO.success();
|
|
|
+ }
|
|
|
+ return ResultVO.error("登录失败,"+result.getMsg());
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping({"/RBlogin"})
|
|
|
+ @ResponseBody
|
|
|
+ public ResultVO RBlogin(String cookie,String token, Integer id) {
|
|
|
+ Piccgrabaccount model = this.piccgrabaccount.selectById(id);
|
|
|
+ model.setCookie(cookie);
|
|
|
+ model.setToken(token);
|
|
|
+ model.setLogIn(Integer.valueOf(1));
|
|
|
+ boolean b = this.piccgrabaccount.updateAllColumnById(model);
|
|
|
+ if (b){
|
|
|
+ return ResultVO.success();
|
|
|
+ }else{
|
|
|
+ return ResultVO.error("登录失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping({"/getList"})
|
|
|
+ public String getList(int id) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping({"/bidPrice"})
|
|
|
+ public String bidPrice(int id) {
|
|
|
+ this.piccgrabaccount.sendBidPrice(id);
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+}
|