记得上下班打卡 | git大法好,push需谨慎

Commit 500fd410 authored by 胡佳晨's avatar 胡佳晨

Merge remote-tracking branch 'origin/dev_goblin' into dev_goblin

parents 207dd82d 33065d14
...@@ -25,6 +25,8 @@ public class UploadVo implements Serializable { ...@@ -25,6 +25,8 @@ public class UploadVo implements Serializable {
private String fileName; private String fileName;
@ApiModelProperty(value = "上传后的地址") @ApiModelProperty(value = "上传后的地址")
private String ossPath; private String ossPath;
@ApiModelProperty(value = "视频截帧图片文件地址")
private String videoImg;
@ApiModelProperty(value = "文件类型") @ApiModelProperty(value = "文件类型")
private String contentType; private String contentType;
@ApiModelProperty(value = "文件大小") @ApiModelProperty(value = "文件大小")
......
...@@ -111,20 +111,20 @@ public class AdminUpushServiceImpl extends ServiceImpl<AdminUpushMapper, AdminUp ...@@ -111,20 +111,20 @@ public class AdminUpushServiceImpl extends ServiceImpl<AdminUpushMapper, AdminUp
if (upushParam.getPushRange() == 1) { if (upushParam.getPushRange() == 1) {
if (!CollectionUtil.isEmpty(pushList)) { if (!CollectionUtil.isEmpty(pushList)) {
if (pushList.size() >= 20) { if (pushList.size() >= 20) {
pushList.remove(0); pushList.remove(pushList.size()-1);
} }
} }
pushList.addFirst(adminUpushVo); pushList.addFirst(adminUpushVo);
if (!CollectionUtil.isEmpty(pushList2)) { if (!CollectionUtil.isEmpty(pushList2)) {
if (pushList2.size() >= 20) { if (pushList2.size() >= 20) {
pushList2.remove(0); pushList2.remove(pushList.size()-1);
} }
} }
pushList2.addFirst(adminUpushVo); pushList2.addFirst(adminUpushVo);
} else { } else {
if (!CollectionUtil.isEmpty(pushList)) { if (!CollectionUtil.isEmpty(pushList)) {
if (pushList.size() >= 20) { if (pushList.size() >= 20) {
pushList.remove(0); pushList.remove(pushList.size()-1);
} }
} }
pushList.addFirst(adminUpushVo); pushList.addFirst(adminUpushVo);
......
...@@ -8,9 +8,12 @@ import java.math.BigInteger; ...@@ -8,9 +8,12 @@ import java.math.BigInteger;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.time.LocalDateTime;
import java.util.UUID;
/** /**
* aloss 上传MultipartFile to File * aloss 上传MultipartFile to File
*
* @author jiangxiulong * @author jiangxiulong
* @since 2021-06-10 * @since 2021-06-10
*/ */
...@@ -22,19 +25,21 @@ public class FilesUtils { ...@@ -22,19 +25,21 @@ public class FilesUtils {
* @param file * @param file
* @throws Exception * @throws Exception
*/ */
public static File multipartFileToFile(MultipartFile file) throws Exception { public static File multipartFileToFile(MultipartFile file) {
try {
File toFile = null; File toFile = null;
if (file.equals("") || file.getSize() <= 0) { if (!file.equals("") && file.getSize() > 0) {
file = null; InputStream ins = null;
} else { ins = file.getInputStream();
InputStream ins = null; toFile = new File(file.getOriginalFilename());
ins = file.getInputStream(); inputStreamToFile(ins, toFile);
toFile = new File(file.getOriginalFilename()); ins.close();
inputStreamToFile(ins, toFile); }
ins.close(); return toFile;
} catch (Exception e) {
log.error("multipartFileToFileError", e);
return null;
} }
return toFile;
} }
//获取流文件 //获取流文件
...@@ -55,20 +60,22 @@ public class FilesUtils { ...@@ -55,20 +60,22 @@ public class FilesUtils {
/** /**
* 删除本地临时文件 * 删除本地临时文件
*
* @param file * @param file
*/ */
public static void delteTempFile(File file) { public static void deleteTempFile(File file) {
try { try {
if (file != null) { if (file != null) {
file.delete(); file.delete();
} }
} catch (Exception e) { } catch (Exception e) {
log.error("delteTempFileError", e); log.error("deleteTempFileError", e);
} }
} }
/** /**
* 获取文件的md5值 * 获取文件的md5值
*
* @param file 文件 * @param file 文件
* @return 返回文件的md5值字符串 * @return 返回文件的md5值字符串
*/ */
...@@ -100,7 +107,14 @@ public class FilesUtils { ...@@ -100,7 +107,14 @@ public class FilesUtils {
} }
} }
public static File inputStreamToFile(String url, String name){ /**
* 大美 通过URL上传
*
* @param url
* @param name
* @return
*/
public static File inputStreamToFile(String url, String name) {
try { try {
HttpURLConnection httpUrl = (HttpURLConnection) new URL(url).openConnection(); HttpURLConnection httpUrl = (HttpURLConnection) new URL(url).openConnection();
httpUrl.connect(); httpUrl.connect();
...@@ -119,9 +133,43 @@ public class FilesUtils { ...@@ -119,9 +133,43 @@ public class FilesUtils {
os.close(); os.close();
ins.close(); ins.close();
return file; return file;
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); log.error("inputStreamToFileUrlError", e);
return null; return null;
} }
} }
/**
* 获取上传含文件名的完整路径 这里文件名用了uuid 防止重复,可以根据自己的需要来写
*
* @param pathName banner
* @param filename time.jpeg
* @return
*/
public static String getUploadPath(String pathName, String filename) {
// 078a77e0-cf80-481b-824c-5935247cff15.jpeg
String uploadName = UUID.randomUUID() + filename.substring(filename.lastIndexOf("."));
// 078a77e0cf80481b824c5935247cff15.jpeg
uploadName = uploadName.replace("-", "");
return pathName + "/" + DateUtil.format(LocalDateTime.now(), DateUtil.Formatter.yyyy_MM_dd2) + "/" + uploadName;
}
/**
* 获取 bucketName
*
* @param buckType
* @return
*/
public static String getBucketName(int buckType) {
String bucketName = "img-zhengzai-tv";
switch (buckType) {
case 1:
bucketName = "img-zhengzai-tv";
break;
case 2:
bucketName = "app-zhengzai-tv";
break;
}
return bucketName;
}
} }
...@@ -27,6 +27,7 @@ public class PlatformOssFiles implements Serializable ,Cloneable { ...@@ -27,6 +27,7 @@ public class PlatformOssFiles implements Serializable ,Cloneable {
private String ossFilesId; private String ossFilesId;
private String fileName; private String fileName;
private String ossPath; private String ossPath;
private String videoImg;
private String contentType; private String contentType;
private Integer size; private Integer size;
private String md5str; private String md5str;
......
...@@ -4,6 +4,7 @@ import com.liquidnet.service.base.ResponseDto; ...@@ -4,6 +4,7 @@ import com.liquidnet.service.base.ResponseDto;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
@Component @Component
...@@ -27,4 +28,7 @@ public interface FeignPlatformCandyTaskClient { ...@@ -27,4 +28,7 @@ public interface FeignPlatformCandyTaskClient {
@PutMapping("ccoupon/task/due/user") @PutMapping("ccoupon/task/due/user")
ResponseDto<String> dueProcessForUser(); ResponseDto<String> dueProcessForUser();
@GetMapping("followDoTask/doTask")
ResponseDto doTask();
} }
...@@ -110,4 +110,22 @@ public class PlatformTaskHandler { ...@@ -110,4 +110,22 @@ public class PlatformTaskHandler {
return fail; return fail;
} }
} }
// 关注任务加积分脚本
@XxlJob(value = "sev-platform:followDoTask")
public ReturnT<String> followDoTask() {
try {
ResponseDto<String> dto = feignPlatformCandyTaskClient.doTask();
String dtoStr = JsonUtils.toJson(dto);
log.info("result of handler:{}", dtoStr);
ReturnT<String> success = ReturnT.SUCCESS;
success.setMsg(dtoStr);
return success;
} catch (Exception e) {
log.error("exception of handler:{}", e.getMessage(), e);
ReturnT<String> fail = ReturnT.FAIL;
fail.setMsg(e.getLocalizedMessage());
return fail;
}
}
} }
...@@ -969,27 +969,6 @@ CREATE TABLE `kylin_zhengzai_app_versions` ...@@ -969,27 +969,6 @@ CREATE TABLE `kylin_zhengzai_app_versions`
DEFAULT CHARSET utf8mb4 DEFAULT CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci COMMENT '正在现场app版本控制'; COLLATE utf8mb4_unicode_ci COMMENT '正在现场app版本控制';
drop TABLE if exists `platform_oss_files`;
create table platform_oss_files
(
`mid` int(11) unsigned NOT NULL AUTO_INCREMENT,
`oss_files_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'oss_files_id',
`file_name` varchar(255) NOT NULL DEFAULT '' COMMENT '源文件名称',
`content_type` varchar(255) NOT NULL DEFAULT '' COMMENT '文件类型',
`size` int NOT NULL DEFAULT 0 COMMENT '文件大小',
`md5str` varchar(255) NOT NULL DEFAULT '' COMMENT 'md5值判断文件是否相同',
`oss_path` varchar(255) NOT NULL DEFAULT '' COMMENT '文件地址(阿里oss)',
`buck_type` tinyint NOT NULL DEFAULT '0' COMMENT 'buck_type',
`uploader_uid` varchar(255) NOT NULL DEFAULT '' COMMENT '上传人id',
`uploader_name` varchar(255) NOT NULL DEFAULT '' COMMENT '上传人姓名',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
KEY `kylin_oss_files_id_index` (`oss_files_id`),
PRIMARY KEY (`mid`)
) ENGINE = InnoDB
DEFAULT CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci COMMENT '阿里云OSS上传记录';
drop TABLE if exists `admin_upush`; drop TABLE if exists `admin_upush`;
CREATE TABLE `admin_upush` CREATE TABLE `admin_upush`
( (
......
drop TABLE if exists `platform_oss_files`;
create table platform_oss_files
(
`mid` int(11) unsigned NOT NULL AUTO_INCREMENT,
`oss_files_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'oss_files_id',
`file_name` varchar(255) NOT NULL DEFAULT '' COMMENT '源文件名称',
`content_type` varchar(255) NOT NULL DEFAULT '' COMMENT '文件类型',
`size` int NOT NULL DEFAULT 0 COMMENT '文件大小',
`md5str` varchar(255) NOT NULL DEFAULT '' COMMENT 'md5值判断文件是否相同',
`oss_path` varchar(255) NOT NULL DEFAULT '' COMMENT '文件地址(阿里oss)',
`buck_type` tinyint NOT NULL DEFAULT '0' COMMENT 'buck_type',
`uploader_uid` varchar(255) NOT NULL DEFAULT '' COMMENT '上传人id',
`uploader_name` varchar(255) NOT NULL DEFAULT '' COMMENT '上传人姓名',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
KEY `kylin_oss_files_id_index` (`oss_files_id`),
PRIMARY KEY (`mid`)
) ENGINE = InnoDB
DEFAULT CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci COMMENT '阿里云OSS上传记录';
alter table platform_oss_files add video_img varchar(255) NOT NULL DEFAULT '' COMMENT '视频截帧图片文件地址(阿里oss)' after oss_path;
\ No newline at end of file
package com.liquidnet.service.platform.controller.sweet;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.feign.stone.api.FeignStoneIntegralClient;
import com.liquidnet.service.platform.utils.DataUtils;
import com.liquidnet.service.sweet.entity.SweetWechatUsers;
import com.liquidnet.service.sweet.mapper.SweetWechatUsersMapper;
import com.liquidnet.service.sweet.vo.SweetAppletUsersVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
/**
* <p>
* 关注任务加积分脚本
* </p>
*
* @author jiangxiulong
* @since 2021-12-28
*/
@Api(tags = "关注任务加积分脚本")
@Slf4j
@RestController
@RequestMapping("followDoTask")
public class TaskController {
@Autowired
private SweetWechatUsersMapper usersMapper;
@Autowired
private FeignStoneIntegralClient feignStoneIntegralClient;
@Autowired
private DataUtils dataUtils;
@GetMapping("doTask")
@ApiOperation("退款回调")
public ResponseDto doTask() {
int size = 1000;
LocalDateTime localDateTime = LocalDateTime.now();
LocalDateTime newTime = localDateTime.minusMinutes(10);
// String timeStr = "2021-12-28 00:00:00";
// DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// LocalDateTime dateTime = LocalDateTime.parse(timeStr, df);
// 获取总记录数
Integer count = usersMapper.selectCount(
Wrappers.lambdaQuery(SweetWechatUsers.class)
.gt(SweetWechatUsers::getCreatedAt, newTime)
.eq(SweetWechatUsers::getType, 2)
);
// 总page
int countPage = (int) Math.ceil(count / size);
countPage = countPage + 1;
for (int page = 0; page < countPage; page++) {
List<SweetWechatUsers> sweetWechatUsers = usersMapper.selectList(
Wrappers.lambdaQuery(SweetWechatUsers.class)
.gt(SweetWechatUsers::getCreatedAt, newTime)
.last("limit " + (page * size) + "," + ((page + 1) * size))
);
for (SweetWechatUsers info : sweetWechatUsers) {
try {
SweetAppletUsersVo sweetAppletUsers = dataUtils.getSweetAppletUsersOfUnionId(info.getUnionId());
if (sweetAppletUsers != null) {
if (sweetAppletUsers.getUserId() != null && !sweetAppletUsers.getUserId().isEmpty()) {
log.info("followDoTask userId:{}", sweetAppletUsers.getUserId());
ResponseDto<HashMap<String, Object>> hashMapResponseDto = feignStoneIntegralClient.doTask(4, sweetAppletUsers.getUserId());
//log.info("followDoTask res:{}", hashMapResponseDto);
}
}
} catch (Exception e) {
}
}
}
return ResponseDto.success();
}
}
...@@ -13,6 +13,8 @@ import com.liquidnet.service.kylin.dto.vo.returns.KylinOrderListVo; ...@@ -13,6 +13,8 @@ import com.liquidnet.service.kylin.dto.vo.returns.KylinOrderListVo;
import com.liquidnet.service.kylin.entity.KylinBuyNotice; import com.liquidnet.service.kylin.entity.KylinBuyNotice;
import com.liquidnet.service.kylin.entity.KylinOrderCoupons; import com.liquidnet.service.kylin.entity.KylinOrderCoupons;
import com.liquidnet.service.kylin.mapper.KylinBuyNoticeMapper; import com.liquidnet.service.kylin.mapper.KylinBuyNoticeMapper;
import com.liquidnet.service.sweet.constant.SweetConstant;
import com.liquidnet.service.sweet.vo.SweetAppletUsersVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
...@@ -400,4 +402,15 @@ public class DataUtils { ...@@ -400,4 +402,15 @@ public class DataUtils {
return (ArrayList<KylinOrderCoupons>) obj; return (ArrayList<KylinOrderCoupons>) obj;
} }
} }
public SweetAppletUsersVo getSweetAppletUsersOfUnionId(String unionId) {
String redisKey = SweetConstant.REDIS_KEY_SWEET_APPLET_USERS_UNIONID.concat(unionId);
Object obj = redisDataSourceUtil.getRedisSweetUtil().get(redisKey);
if (null == obj) {
return null;
} else {
SweetAppletUsersVo sweetAppletUsersVo = (SweetAppletUsersVo) obj;
return sweetAppletUsersVo;
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment