| | |
| | | import com.ruoyi.system.api.domain.poji.config.SysTag; |
| | | import com.ruoyi.system.api.domain.poji.member.Member; |
| | | import com.ruoyi.system.api.domain.poji.shop.Shop; |
| | | import com.ruoyi.system.api.domain.poji.sys.SysFile; |
| | | import com.ruoyi.system.api.domain.poji.sys.SysUser; |
| | | import com.ruoyi.system.api.domain.vo.*; |
| | | import com.ruoyi.system.api.model.AppMiniLoginDto; |
| | | import com.ruoyi.system.api.model.AppMiniLoginVo; |
| | | import com.ruoyi.system.api.service.RemoteConfigService; |
| | | import com.ruoyi.system.api.service.RemoteOrderService; |
| | | import com.ruoyi.system.api.service.RemoteShopService; |
| | | import com.ruoyi.system.api.service.RemoteUserService; |
| | | import com.ruoyi.system.api.service.*; |
| | | import io.jsonwebtoken.lang.Assert; |
| | | import lombok.extern.log4j.Log4j2; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.apache.http.HttpResponse; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.FileCopyUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Nullable; |
| | | import javax.annotation.Resource; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @Resource |
| | | private RemoteFileService remoteFileService; |
| | | |
| | | |
| | | /** |
| | |
| | | memberTotalService.saveOrUpdate(memberTotal); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String getWeiXinQrCode(String scene, String path) { |
| | | try { |
| | | File file = wxMaService.getQrcodeService().createWxaCodeUnlimit(scene, path); |
| | | FileInputStream input = new FileInputStream(file); |
| | | MultipartFile multipartFile = new MyMultipartFile("file", file.getName(), "text/plain", IOUtils.toByteArray(input)); |
| | | |
| | | SysFile sysFile = remoteFileService.upload(multipartFile).getData(); |
| | | return sysFile.getUrl(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public class MyMultipartFile implements MultipartFile { |
| | | private final String name; |
| | | private final byte[] content; |
| | | private String originalFilename; |
| | | @Nullable |
| | | private String contentType; |
| | | |
| | | |
| | | public MyMultipartFile(String name, @Nullable String originalFilename, @Nullable String contentType, @Nullable byte[] content) { |
| | | Assert.hasLength(name, "Name must not be null"); |
| | | this.name = name; |
| | | this.originalFilename = originalFilename != null ? originalFilename : ""; |
| | | this.contentType = contentType; |
| | | this.content = content != null ? content : new byte[0]; |
| | | } |
| | | |
| | | public String getName() { |
| | | return this.name; |
| | | } |
| | | |
| | | public String getOriginalFilename() { |
| | | return this.originalFilename; |
| | | } |
| | | |
| | | @Nullable |
| | | public String getContentType() { |
| | | return this.contentType; |
| | | } |
| | | |
| | | public boolean isEmpty() { |
| | | return this.content.length == 0; |
| | | } |
| | | |
| | | public long getSize() { |
| | | return (long) this.content.length; |
| | | } |
| | | |
| | | public byte[] getBytes() throws IOException { |
| | | return this.content; |
| | | } |
| | | |
| | | public InputStream getInputStream() throws IOException { |
| | | return new ByteArrayInputStream(this.content); |
| | | } |
| | | |
| | | public void transferTo(File dest) throws IOException, IllegalStateException { |
| | | FileCopyUtils.copy(this.content, dest); |
| | | } |
| | | } |
| | | |
| | | } |