| | |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.project.domain.BaseAnnextype; |
| | | import com.ruoyi.project.domain.GiLink; |
| | | import com.ruoyi.project.service.IBaseAnnextypeService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import com.ruoyi.project.service.IGiLinkService; |
| | | import io.swagger.annotations.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Random; |
| | | |
| | | @Slf4j |
| | |
| | | @RequestMapping("/GiLink") |
| | | public class GiLinkController { |
| | | @Autowired |
| | | private IBaseAnnextypeService baseAnnextypeService; |
| | | private IGiLinkService giLinkService; |
| | | |
| | | @ApiOperation("æ°å¢") |
| | | @ApiOperation("å¤é¾æ°å¢") |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody BaseAnnextype baseAnnextype) { |
| | | Random rand = new Random(4); |
| | | String hexString = String.format("%x", rand.nextInt()); |
| | | boolean save = baseAnnextypeService.save(baseAnnextype); |
| | | return AjaxResult.success(baseAnnextype); |
| | | public AjaxResult add(@RequestBody GiLink model) { |
| | | |
| | | return AjaxResult.success(giLinkService.Add(model)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("代ç è·åä¿¡æ¯") |
| | | @ApiOperation("å¤é¾ä»£ç è·åä¿¡æ¯") |
| | | @GetMapping(value = "/getCode") |
| | | public AjaxResult getCode(Long id) { |
| | | public AjaxResult getCode(String code) { |
| | | Map<String, Object> columnMap = new HashMap<>(); |
| | | columnMap.put("code", code); |
| | | List<GiLink> links = giLinkService.listByMap(columnMap); |
| | | if (links.size() > 0) |
| | | return AjaxResult.success(links.get(0)); |
| | | else |
| | | return AjaxResult.success(""); |
| | | } |
| | | |
| | | return AjaxResult.success(baseAnnextypeService.getById(id)); |
| | | @ApiOperation("䏿¥åéçä¿¡") |
| | | @GetMapping("/sendReport") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "䏿¥id", dataType = "Long", required = true), |
| | | @ApiImplicitParam(name = "coordinatorNo", value = "åè°åç¼å·", dataType = "String", required = true), |
| | | @ApiImplicitParam(name = "toHospital", value = "䏿¥å»é¢", dataType = "String", required = true) |
| | | }) |
| | | public AjaxResult SendReport(Long id,String coordinatorNo,String toHospital) { |
| | | |
| | | return AjaxResult.success(giLinkService.SendReport(id,coordinatorNo,toHospital)); |
| | | } |
| | | |
| | | @ApiOperation("ä¸å®¶åéçä¿¡") |
| | | @GetMapping("/sendExpert") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "ä¸å®¶æè§id", dataType = "Long", required = true), |
| | | @ApiImplicitParam(name = "expertNo", value = "ä¸å®¶ç¼å·", dataType = "String", required = true), |
| | | @ApiImplicitParam(name = "infoId", value = "æ¡ä¾id", dataType = "String", required = true) |
| | | }) |
| | | public AjaxResult SendExpert(String id,String expertNo,String infoId) { |
| | | |
| | | return AjaxResult.success(giLinkService.SendExpert(id,expertNo,infoId)); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.web.controller.common; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.utils.http.HttpUtils; |
| | | import com.ruoyi.common.utils.sign.Md5Utils; |
| | | import com.ruoyi.project.domain.GiApi; |
| | | import com.ruoyi.project.domain.dto.ApiDTO; |
| | | import com.ruoyi.project.domain.dto.SmsDTO; |
| | | import com.ruoyi.project.service.IApiService; |
| | | import com.ruoyi.common.utils.SmsUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.util.ArrayList; |
| | | import java.util.Base64; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @Api(description = "çä¿¡æå¡") |
| | | @RestController |
| | | @RequestMapping("/sms") |
| | | public class SmsController { |
| | | @Value("${sms.url}") |
| | | private String url="http://103.21.119.249:3131/http/send.aspx"; |
| | | @Value("${sms.loginName}") |
| | | private String loginName="qddxfsyy"; |
| | | @Value("${sms.passWord}") |
| | | private String passWord="Qyfy_0718"; |
| | | |
| | | @ApiOperation("çä¿¡æå¡->åéçä¿¡") |
| | | @PostMapping("/send") |
| | | public AjaxResult getApiList(@RequestBody SmsDTO DTO) { |
| | | public AjaxResult Send(@RequestBody SmsDTO DTO) { |
| | | if (ObjectUtils.isNotEmpty(DTO.getTel())&&ObjectUtils.isNotEmpty(DTO.getMessageContent())) { |
| | | String key= keyForMd5(loginName,passWord); |
| | | String content="{\"LoginName\":\""+loginName+"\",\"PassWord\":\""+passWord+"\"," + |
| | | "\"Key\":\""+key+"\"," + |
| | | "\"Tel\":\""+DTO.getTel()+"\",\"MessageContent\":\""+DTO.getMessageContent()+"\"}"; |
| | | String result=""; |
| | | result= HttpUtils.sendPost(url, Base64.getEncoder().encodeToString(content.getBytes()) ); |
| | | return AjaxResult.success(result); |
| | | SmsUtils sms=new SmsUtils(); |
| | | return AjaxResult.success(sms.send(DTO.getTel(),DTO.getMessageContent())); |
| | | } else { |
| | | return AjaxResult.error("çµè¯åæ¶æ¯ä¸è½ä¸ºç©º"); |
| | | } |
| | | } |
| | | public String keyForMd5(String name, String pass) |
| | | { |
| | | return md5(md5(pass) + pass + md5(name)); |
| | | } |
| | | |
| | | |
| | | |
| | | public static String md5(String str) { |
| | | try { |
| | | // 1. è·å MD5 æ¶æ¯æè¦å®ä¾ |
| | | MessageDigest md = MessageDigest.getInstance("MD5"); |
| | | // 2. ä½¿ç¨ UTF-8 ç¼ç å°å符串转æ¢ä¸ºåèæ°ç»å¹¶è®¡ç®åå¸ |
| | | byte[] hashBytes = md.digest(str.getBytes(StandardCharsets.UTF_8)); |
| | | // 3. å°åèæ°ç»è½¬æ¢ä¸ºåå
è¿å¶å符串ï¼å°åï¼ |
| | | return bytesToHex(hashBytes).toLowerCase(); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | // MD5 æ¯æ åç®æ³ï¼æ£å¸¸æ
åµä¸ä¸ä¼æåºæ¤å¼å¸¸ |
| | | throw new RuntimeException("ç³»ç»ä¸æ¯æ MD5 ç®æ³", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å°åèæ°ç»è½¬æ¢ä¸ºåå
è¿å¶å符串 |
| | | * |
| | | * @param bytes åèæ°ç» |
| | | * @return åå
è¿å¶å符串 |
| | | */ |
| | | private static String bytesToHex(byte[] bytes) { |
| | | StringBuilder sb = new StringBuilder(bytes.length * 2); |
| | | for (byte b : bytes) { |
| | | // å°æ¯ä¸ªåèçé«4ä½åä½4ä½åå«è½¬æ¢ä¸ºåå
è¿å¶å符 |
| | | sb.append(String.format("%02x", b)); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.annotation.RepeatSubmit; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.project.common.IdGeneratorUtils; |
| | | import com.ruoyi.project.domain.ServiceDonatebaseinfoReport; |
| | | import com.ruoyi.project.domain.ServiceDonatebaseinfoReportFile; |
| | | import com.ruoyi.project.domain.ServiceTransport; |
| | | import com.ruoyi.project.domain.VUserOrg; |
| | | import com.ruoyi.project.service.IServiceDonatebaseinfoReportFileService; |
| | | import com.ruoyi.project.service.IServiceDonatebaseinfoReportService; |
| | | import com.ruoyi.project.service.IServiceTransportService; |
| | | import com.ruoyi.project.service.IVUserOrgService; |
| | | import com.ruoyi.project.domain.*; |
| | | import com.ruoyi.project.service.*; |
| | | import com.ruoyi.system.domain.SysConfig; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashMap; |
| | |
| | | private IVUserOrgService vUserOrgService; |
| | | @Autowired |
| | | private IServiceTransportService serviceTransport; |
| | | @Autowired |
| | | private IGiLinkService linkService; |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | boolean save = serviceDonatebaseinfoReportService.save(serviceDonatebaseinfoReport); |
| | | //å°çæçæä»¶å°ååå¨å°æ°æ®åºä¸ |
| | | if (save) |
| | | serviceDonatebaseinfoReportFileService.addList(serviceDonatebaseinfoReport.getAnnexfilesList(), serviceDonatebaseinfoReport.getCaseNo(), getNickName(), serviceDonatebaseinfoReport.getId()); |
| | | if (save) { |
| | | boolean res= serviceDonatebaseinfoReportFileService.addList(serviceDonatebaseinfoReport.getAnnexfilesList(), serviceDonatebaseinfoReport.getCaseNo(), getNickName(), serviceDonatebaseinfoReport.getId()); |
| | | if(res){ |
| | | linkService.SendReport(serviceDonatebaseinfoReport.getId(),serviceDonatebaseinfoReport.getCoordinatorNo(),serviceDonatebaseinfoReport.getToHospital()); |
| | | } |
| | | } |
| | | return toAjax(save); |
| | | } |
| | | |
| | |
| | | url: http://103.21.119.249:3131/http/send.aspx |
| | | loginName: qddxfsyy |
| | | passWord: Qyfy_0718 |
| | | |
| | | link: |
| | | report_url: http://localhost:8095/pages/case/transferinfo |
| | | expert_url: http://localhost:8095/pages/ethicalReview/ethicalInfo |
| | |
| | | # æ¯å¦å¼å¯swagger |
| | | enabled: false |
| | | # 请æ±åç¼ |
| | | pathMapping: / |
| | | pathMapping: / |
| | | |
| | | link: |
| | | report_url: http://localhost:8095/pages/case/transferinfo |
| | | expert_url: http://localhost:8095/pages/ethicalReview/ethicalInfo |
| | |
| | | # æ¯å¦å¼å¯swagger |
| | | enabled: false |
| | | # 请æ±åç¼ |
| | | pathMapping: / |
| | | pathMapping: / |
| | | |
| | | link: |
| | | report_url: http://localhost:8095/pages/case/transferinfo |
| | | expert_url: http://localhost:8095/pages/ethicalReview/ethicalInfo |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import com.ruoyi.common.utils.http.HttpUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.util.Base64; |
| | | |
| | | public class SmsUtils { |
| | | @Value("${sms.url}") |
| | | private String url="http://103.21.119.249:3131/http/send.aspx"; |
| | | @Value("${sms.loginName}") |
| | | private String loginName="qddxfsyy"; |
| | | @Value("${sms.passWord}") |
| | | private String passWord="Qyfy_0718"; |
| | | |
| | | public String send(String tel,String messageContent){ |
| | | |
| | | String key= keyForMd5(loginName,passWord); |
| | | String content="{\"LoginName\":\""+loginName+"\",\"PassWord\":\""+passWord+"\"," + |
| | | "\"Key\":\""+key+"\"," + |
| | | "\"Tel\":\""+tel+"\",\"MessageContent\":\""+messageContent+"\"}"; |
| | | String result=""; |
| | | result= HttpUtils.sendPost(url, Base64.getEncoder().encodeToString(content.getBytes()) ); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public String keyForMd5(String name, String pass) |
| | | { |
| | | return md5(md5(pass) + pass + md5(name)); |
| | | } |
| | | |
| | | |
| | | |
| | | public static String md5(String str) { |
| | | try { |
| | | // 1. è·å MD5 æ¶æ¯æè¦å®ä¾ |
| | | MessageDigest md = MessageDigest.getInstance("MD5"); |
| | | // 2. ä½¿ç¨ UTF-8 ç¼ç å°å符串转æ¢ä¸ºåèæ°ç»å¹¶è®¡ç®åå¸ |
| | | byte[] hashBytes = md.digest(str.getBytes(StandardCharsets.UTF_8)); |
| | | // 3. å°åèæ°ç»è½¬æ¢ä¸ºåå
è¿å¶å符串ï¼å°åï¼ |
| | | return bytesToHex(hashBytes).toLowerCase(); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | // MD5 æ¯æ åç®æ³ï¼æ£å¸¸æ
åµä¸ä¸ä¼æåºæ¤å¼å¸¸ |
| | | throw new RuntimeException("ç³»ç»ä¸æ¯æ MD5 ç®æ³", e); |
| | | } |
| | | } |
| | | /** |
| | | * å°åèæ°ç»è½¬æ¢ä¸ºåå
è¿å¶å符串 |
| | | * |
| | | * @param bytes åèæ°ç» |
| | | * @return åå
è¿å¶å符串 |
| | | */ |
| | | private static String bytesToHex(byte[] bytes) { |
| | | StringBuilder sb = new StringBuilder(bytes.length * 2); |
| | | for (byte b : bytes) { |
| | | // å°æ¯ä¸ªåèçé«4ä½åä½4ä½åå«è½¬æ¢ä¸ºåå
è¿å¶å符 |
| | | sb.append(String.format("%02x", b)); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | } |
| | |
| | | // è¿æ»¤è¯·æ± |
| | | .authorizeRequests() |
| | | // 对äºç»å½login 注åregister éªè¯ç captchaImage å
许å¿åè®¿é® |
| | | .antMatchers("/login", "/openidlogin", "/register", "/captchaImage", "/getToken").anonymous() |
| | | .antMatchers("/login", "/openidlogin", "/register", "/captchaImage", "/getToken","/getCode").anonymous() |
| | | .antMatchers( |
| | | HttpMethod.GET, |
| | | "/", |
| | |
| | | package com.ruoyi.project.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | private Integer isDel; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(exist = false) |
| | | private String createTime; |
| | | } |
| | |
| | | package com.ruoyi.project.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.core.domain.entity.BasePrcaddressDict; |
| | | import com.ruoyi.project.domain.BaseAnnextype; |
| | | import com.ruoyi.project.domain.GiLink; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface GiLinkMapper extends BaseMapper<GiLink> { |
| | | |
| | | Integer getMaxID(); |
| | | |
| | | } |
| | |
| | | |
| | | public interface IGiLinkService extends IService<GiLink>{ |
| | | |
| | | Long Add(GiLink model); |
| | | String Add(GiLink model); |
| | | |
| | | String SendReport(Long id,String coordinatorNo,String toHospital); |
| | | |
| | | String SendExpert(String id,String expertNo,String infoId); |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.project.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.SmsUtils; |
| | | import com.ruoyi.project.domain.GiLink; |
| | | import com.ruoyi.project.mapper.ApiMapper; |
| | | import com.ruoyi.project.mapper.GiLinkMapper; |
| | | import com.ruoyi.project.service.IGiLinkService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Random; |
| | | |
| | | @Service |
| | | public class GiLinkService extends ServiceImpl<GiLinkMapper, GiLink> implements IGiLinkService { |
| | | @Autowired |
| | | GiLinkMapper mapper; |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | @Autowired |
| | | private IGiLinkService linkService; |
| | | @Value("${link.report_url}") |
| | | private String reportUrl; |
| | | @Value("${link.expert_url}") |
| | | private String expertUrl; |
| | | public String Add(GiLink model) { |
| | | Integer maxid = mapper.getMaxID(); |
| | | Random rand = new Random(); |
| | | String code = maxid + String.format("%x", rand.nextInt(100)); |
| | | model.setCode(code); |
| | | Integer res = mapper.insert(model); |
| | | if (res == 1) |
| | | return code; |
| | | else |
| | | return ""; |
| | | } |
| | | /** |
| | | * 䏿¥åéçä¿¡ |
| | | * @param id 䏿¥id |
| | | * @param coordinatorNo åè°åç¼å· |
| | | * @param toHospital 䏿¥å»é¢ |
| | | */ |
| | | public String SendReport(Long id,String coordinatorNo,String toHospital){ |
| | | String res=""; |
| | | SysUser user= userService.selectUserByUserName(coordinatorNo); |
| | | if(user!=null&& ObjectUtils.isNotEmpty(user.getPhonenumber())) { |
| | | GiLink link=new GiLink(); |
| | | link.setUserName(user.getUserName()); |
| | | link.setUserPhone(user.getPhonenumber()); |
| | | link.setExtContent("{\"id\":\""+id+"\"}"); |
| | | String code=linkService.Add(link); |
| | | reportUrl += "?code=" + code; |
| | | String content = "æ¡ä¾ä¸æ¥éç¥ï¼ãéå²å¤§å¦éå±å»é¢ã" + toHospital |
| | | + "䏿¥æ½å¨æç®æ¡ä¾ï¼è¯·ç»å½OPOç³»ç»æ¥ç详ç»ä¿¡æ¯ï¼åæ¶è¿è¡å¯¹æ¥ãç»å½é¾æ¥ï¼" + reportUrl + " ã"; |
| | | SmsUtils sms=new SmsUtils(); |
| | | res=sms.send(user.getPhonenumber(),content); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | public Long Add(GiLink model){ |
| | | |
| | | return 1L; |
| | | /** |
| | | * ä¸å®¶åéçä¿¡ |
| | | * @param id ä¸å®¶æè§id |
| | | * @param expertNo ä¸å®¶ç¼å· |
| | | * @param infoId æ¡ä¾id |
| | | */ |
| | | public String SendExpert(String id,String expertNo,String infoId){ |
| | | String res=""; |
| | | SysUser user= userService.selectUserByUserName(expertNo); |
| | | if(user!=null&& ObjectUtils.isNotEmpty(user.getPhonenumber())) { |
| | | GiLink link=new GiLink(); |
| | | link.setUserName(user.getUserName()); |
| | | link.setUserPhone(user.getPhonenumber()); |
| | | link.setExtContent("{\"id\":\""+id+"\",\"type\": \"review\",\"status\": \"1\",\"infoId\": \""+infoId+"\"}"); |
| | | String code=linkService.Add(link); |
| | | expertUrl += "?code=" + code; |
| | | String content = "伦çä¸å®¶å®¡æ¥éç¥ï¼ãéå²å¤§å¦éå±å»é¢ãå°æ¬çä¸å®¶æ¨å¥½ï¼æ¨æç´§æ¥äººä½å¨å®ç§»æ¤ä¼¦ç审æ¥ç³è¯·å¾
å¤çï¼" + |
| | | "请å¡å¿
äº1å°æ¶å
ç»å½å»é¢OPOç³»ç»è¿è¡å®¡æ¹ãç»å½é¾æ¥ï¼ " + expertUrl + "ã谢谢 ã"; |
| | | SmsUtils sms=new SmsUtils(); |
| | | res=sms.send(user.getPhonenumber(),content); |
| | | } |
| | | return res; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.project.mapper.GiLinkMapper"> |
| | | |
| | | <select id="getMaxID" resultType="java.lang.Integer"> |
| | | select ifnull(max(id),0) from gi_link |
| | | |
| | | </select> |
| | | </mapper> |