平安银行
This commit is contained in:
parent
ae544dca00
commit
e6e93f2d54
@ -7,7 +7,7 @@ import java.util.*;
|
||||
|
||||
public enum ActivityEnum {
|
||||
|
||||
A("A", "2022-05-09 00:00:00","2022-05-13 22:00:00"),
|
||||
A("A", "2022-05-06 00:00:00","2022-05-13 22:00:00"),
|
||||
|
||||
B("B", "2022-12-01 00:00:00","2022-12-01 23:59:59"),
|
||||
|
||||
|
||||
@ -5,13 +5,18 @@ package com.xgl.lottery.controller;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyun.oss.OSSClient;
|
||||
import com.aliyun.oss.OSSClientBuilder;
|
||||
import com.aliyun.oss.ServiceException;
|
||||
import com.xgl.lottery.ReturnCodeEnum;
|
||||
import com.xgl.lottery.config.AccessToken;
|
||||
import com.xgl.lottery.service.dto.ResultResp;
|
||||
import com.xgl.lottery.utils.DateUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.text.MessageFormat;
|
||||
@ -28,10 +33,9 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/oss"})
|
||||
@ -45,6 +49,54 @@ public class FileController {
|
||||
RedisTemplate redisTemplate;
|
||||
|
||||
|
||||
@PostMapping("/file")
|
||||
public ResultResp SingleFileUpLoad(@RequestParam("file") MultipartFile file) throws IOException {
|
||||
|
||||
//创建输入输出流
|
||||
InputStream inputStream = null;
|
||||
OutputStream outputStream = null;
|
||||
|
||||
|
||||
|
||||
//获取文件的输入流
|
||||
inputStream = file.getInputStream();
|
||||
//获取上传时的文件名
|
||||
String fileName = file.getOriginalFilename();
|
||||
String url = null;
|
||||
OSSClient ossClient = null;
|
||||
try {
|
||||
|
||||
String endpoint = "oss-cn-shenzhen.aliyuncs.com";
|
||||
String accessKeyId = "sSJ5t0yC1CaKhPJ4";
|
||||
String accessKeySecret = "PsbdUTexU95BkiqO4ADELXpIaYdWGk";
|
||||
String bucketName = "szxgl";
|
||||
OSSClientBuilder builder = new OSSClientBuilder();
|
||||
|
||||
ossClient = (OSSClient) builder.build(endpoint, accessKeyId, accessKeySecret);
|
||||
|
||||
String datePath = DateUtil.format(new Date(), "yyyy/MM/dd");
|
||||
String fileNa = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
String key = "user/clock/" + datePath + "/" + fileNa + ".jpg";
|
||||
|
||||
ossClient.putObject(bucketName, key, inputStream);
|
||||
url = "https://" + bucketName + "." + endpoint + "/" + key;
|
||||
} catch (RuntimeException e) {
|
||||
log.error("阿里云OSS上传文件出错", e);
|
||||
throw new ServiceException("网络异常,请稍候再试!");
|
||||
} finally {
|
||||
if (ossClient != null) {
|
||||
// 关闭OSSClient。
|
||||
ossClient.shutdown();
|
||||
}
|
||||
}
|
||||
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(),url);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@GetMapping({"/get/file"})
|
||||
public ResultResp getUpload(ServletRequest servletRequest, ServletResponse servletResponse) throws IOException {
|
||||
HttpServletRequest request = (HttpServletRequest)servletRequest;
|
||||
@ -72,7 +124,7 @@ public class FileController {
|
||||
assert wxOAuth2AccessToken != null;
|
||||
|
||||
access_token = wxOAuth2AccessToken.getAccessToken();
|
||||
this.redisTemplate.opsForValue().set("wx_token", access_token, (long)(wxOAuth2AccessToken.getExpires_in() - 2000), TimeUnit.SECONDS);
|
||||
this.redisTemplate.opsForValue().set("wx_token", access_token, (long)(wxOAuth2AccessToken.getExpires_in() - 3000), TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,7 +161,8 @@ public class BusinessService {
|
||||
|
||||
|
||||
public ResultResp<HashMap<String, String>> userInfo(UserInfoDTO userInfoDTO) throws ParseException {
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag","false");
|
||||
UserInfo userInfo = new UserInfo();
|
||||
// BeanUtils.copyProperties(userInfoDTO, userInfo);
|
||||
String shareid="";
|
||||
@ -197,6 +198,7 @@ public class BusinessService {
|
||||
SimpleDateFormat dateFormat3 = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String format3 = dateFormat3.format(date3);
|
||||
clockRecordMapper.insertHelp(userInfo2.getOpenid(),userInfoDTO.getOpenid(),format3);
|
||||
map.put("flag","true");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -216,7 +218,7 @@ public class BusinessService {
|
||||
log.info("新增加的用户为:"+JSONObject.toJSONString(userInfo));
|
||||
userInfoMapper.insert(userInfo);
|
||||
}
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
|
||||
map.put("shareId", userInfo.getShareId());
|
||||
return ResultResp.success(ReturnCodeEnum.SUCCESS.getCode(), ReturnCodeEnum.SUCCESS.getMsg(), map);
|
||||
}
|
||||
@ -264,7 +266,10 @@ public class BusinessService {
|
||||
if ((parse2.isAfter(startTime2) && parse2.isBefore(endTime2))) {
|
||||
ClockRecord clockRecord = clockRecords.get(0);
|
||||
if (null != clockRecord) {
|
||||
SportCard sportCard = sportCardMapper.selectByCardType(clockRecord.getCardType());
|
||||
userInfo.setClockUrl(clockRecord.getPhoto());
|
||||
userInfo.setCardType(clockRecord.getCardType());
|
||||
userInfo.setUrl(sportCard.getContent());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -65,10 +65,7 @@ public class LotteryServiceImpl extends ServiceImpl<LotteryMapper, Lottery> impl
|
||||
context.setKey(key);
|
||||
AbstractRewardProcessor.rewardProcessorMap.get(prizeType).doReward(context);
|
||||
} catch (UnRewardException u) {
|
||||
context.setKey(RedisKeyManager.getDefaultLotteryPrizeRedisKey(lotteryItem.getLotteryId()));
|
||||
lotteryItem = (LotteryItem) redisTemplate.opsForValue().get(RedisKeyManager.getDefaultLotteryItemRedisKey(lotteryItem.getLotteryId()));
|
||||
context.setLotteryItem(lotteryItem);
|
||||
AbstractRewardProcessor.rewardProcessorMap.get(LotteryConstants.PrizeTypeEnum.THANK.getValue()).doReward(context);
|
||||
|
||||
}
|
||||
drawDto.setLevel(lotteryItem.getLevel());
|
||||
drawDto.setPrizeName(context.getPrizeName());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user