From 19fe5a3d816184549e8ffa011c39f218734da8d5 Mon Sep 17 00:00:00 2001 From: fei.wang <wf18701153496@163.com> Date: 星期一, 13 五月 2024 17:49:50 +0800 Subject: [PATCH] 更改 --- src/main/java/com/flow/controller/LoginController.java | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 160 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/flow/controller/LoginController.java b/src/main/java/com/flow/controller/LoginController.java new file mode 100644 index 0000000..27e0a52 --- /dev/null +++ b/src/main/java/com/flow/controller/LoginController.java @@ -0,0 +1,160 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package com.flow.controller; + +import com.flow.pojo.Company; +import com.flow.pojo.Loginjilu; +import com.flow.service.CompanyService; +import com.flow.service.LoginJiLuService; +import com.flow.util.DESUtil; +import com.flow.util.IpUtil; +import com.flow.util.result; +import com.flow.util.resultutil; +import com.github.pagehelper.PageInfo; +import com.tencentcloudapi.common.Credential; +import com.tencentcloudapi.common.exception.TencentCloudSDKException; +import com.tencentcloudapi.common.profile.ClientProfile; +import com.tencentcloudapi.common.profile.HttpProfile; +import com.tencentcloudapi.sms.v20210111.SmsClient; +import com.tencentcloudapi.sms.v20210111.models.SendSmsRequest; +import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse; + +import java.io.IOException; +import java.util.List; +import java.util.Random; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.servlet.ModelAndView; + +@RequestMapping({"/hxzk"}) +@RestController +public class LoginController { + private String SecretId = "AKIDrjZOI4e6KLZu9FAsSRN8eOwSt52lbMBz"; + private String SecretKey = "xnRtHUL3YqdMyOLVSBjKkz1pQoxujS4d"; + @Autowired + LoginJiLuService loginJiLuService; + @Autowired + CompanyService companyService; + + public LoginController() { + } + + @GetMapping({"FindLoginJiLu"}) + public result<List<Loginjilu>> FindCard(Integer page, Integer limit) throws Exception { + PageInfo<Loginjilu> cz = this.loginJiLuService.FindLoginJiLu(page, limit); + + for (int i = 0; i < cz.getSize(); ++i) { + ((Loginjilu) cz.getList().get(i)).setLoginphone(DESUtil.decrypt(((Loginjilu) cz.getList().get(i)).getLoginphone(), DESUtil.key)); + } + + return resultutil.returnSuccess(cz.getTotal(), cz.getList()); + } + + @PostMapping({"FindLoginJiLuZi"}) + public result<List<Loginjilu>> FindCardZi(Loginjilu loginjilu, Integer page, Integer limit) throws Exception { + PageInfo<Loginjilu> cz = this.loginJiLuService.FindLoginJiLuZi(loginjilu, page, limit); + + for (int i = 0; i < cz.getSize(); ++i) { + ((Loginjilu) cz.getList().get(i)).setLoginphone(DESUtil.decrypt(((Loginjilu) cz.getList().get(i)).getLoginphone(), DESUtil.key)); + } + + return resultutil.returnSuccess(cz.getTotal(), cz.getList()); + } + + @PostMapping({"Login"}) + @ResponseBody + public Company Login(Company company, HttpSession session) throws Exception { + company.setCompanyabbname(company.getCompanyabbname()); + company.setLoginphone(DESUtil.encrypt(company.getLoginphone(), DESUtil.key)); + if (company.getPassword() != null) { + company.setPassword(DESUtil.encrypt(company.getPassword(), DESUtil.key)); + } + Company company1 = this.companyService.findUser(company); + if (company1 != null) { + session.setAttribute("admin", company.getCompanyabbname()); + } + + return company1; + } + + @PostMapping({"LoginIp"}) + @ResponseBody + public int Login(Loginjilu loginjilu, HttpServletRequest request) throws Exception { + String ip = IpUtil.getIpAddress(request); + loginjilu.setIp(ip); + return this.loginJiLuService.LoginIp(loginjilu); + } + + @GetMapping({"fwl"}) + public List fwl() { + return this.loginJiLuService.fwl(); + } + + @GetMapping({"huiLogin"}) + public void hui(HttpServletResponse response) throws IOException { + response.sendRedirect("../Login.jsp"); + } + + @PostMapping({"upUser"}) + public ModelAndView UpUser(Company company, HttpServletResponse response) throws Exception { + this.companyService.upUser(company); + ModelAndView modelAndView = new ModelAndView(); + modelAndView.setViewName("/page/setting.jsp"); + return modelAndView; + } + + @ResponseBody + @PostMapping({"lophone"}) + public Company lophone(Company company) throws Exception { + return this.companyService.HuoPhone(company); + } + + @PostMapping({"userdate"}) + public int userdate(String Zong) { + String userdate = this.loginJiLuService.userdate(Zong); + return this.loginJiLuService.upuserdate(Zong, userdate); + } + + @GetMapping({"Login11"}) + @ResponseBody + public int sms(String phone) throws TencentCloudSDKException { + int randomNumber = 0; + + try { + Random random = new Random(); + randomNumber = random.nextInt(10000) + 10000; + System.out.println("鐢熸垚鐨勯殢鏈烘暣鏁版槸锛�" + randomNumber); + Credential cred = new Credential(this.SecretId, this.SecretKey); + HttpProfile httpProfile = new HttpProfile(); + httpProfile.setEndpoint("sms.tencentcloudapi.com"); + ClientProfile clientProfile = new ClientProfile(); + clientProfile.setHttpProfile(httpProfile); + SmsClient client = new SmsClient(cred, "ap-beijing", clientProfile); + SendSmsRequest req = new SendSmsRequest(); + String[] phoneNumberSet1 = new String[]{phone}; + req.setPhoneNumberSet(phoneNumberSet1); + req.setSmsSdkAppId("1400838975"); + req.setSignName("鍖椾含鍗庢槦鍖楁枟鏅烘帶"); + req.setTemplateId("1878379"); + String[] templateParamSet1 = new String[]{String.valueOf(randomNumber)}; + req.setTemplateParamSet(templateParamSet1); + SendSmsResponse resp = client.SendSms(req); + System.out.println(SendSmsResponse.toJsonString(resp)); + } catch (TencentCloudSDKException var12) { + System.out.println(var12.toString()); + } + + return randomNumber; + } +} -- Gitblit v1.9.3