|
@@ -8,6 +8,7 @@ import com.caimei.components.RedisService;
|
|
|
import com.caimei.config.FastDfsClient;
|
|
|
import com.caimei.mapper.cmMapper.AuthMapper;
|
|
|
import com.caimei.mapper.cmMapper.AuthProductMapper;
|
|
|
+import com.caimei.mapper.cmMapper.ClubMapper;
|
|
|
import com.caimei.mapper.ldmMapper.LdmMapper;
|
|
|
import com.caimei.model.ResponseJson;
|
|
|
import com.caimei.model.po.*;
|
|
@@ -38,6 +39,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
import org.apache.http.impl.client.HttpClients;
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
|
import org.apache.http.util.EntityUtils;
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
import org.apache.poi.xssf.usermodel.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -123,6 +125,9 @@ public class AuthServiceImpl implements AuthService {
|
|
|
@Resource
|
|
|
private RedisService redisService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private ClubMapper clubMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public ResponseJson<PageInfo<AuthVo>> getAuthList(Integer listType, Integer authUserId, String authParty,
|
|
|
String mobile, Integer status, Integer starFlag, Integer auditStatus,
|
|
@@ -529,6 +534,12 @@ public class AuthServiceImpl implements AuthService {
|
|
|
} else {
|
|
|
// 审核通过,上线授权
|
|
|
status = 1;
|
|
|
+ //更新authid到V1.7.7ross挑战赛机构信息表
|
|
|
+ //获取clubruserid
|
|
|
+ Integer clubUserId = authMapper.getClubUserIdByAuthId(authId);
|
|
|
+ //1.7.7ross挑战赛新加逻辑:更新机构信息到挑战赛表
|
|
|
+ clubMapper.upAuthByid(clubUserId,authId);
|
|
|
+ clubMapper.upVideoAuthByid(clubUserId,authId);
|
|
|
}
|
|
|
if (1 == source) {
|
|
|
authMapper.updateAuthAuditStatus(authId, status, auditStatus, invalidReason, auditBy, auditTime);
|
|
@@ -550,7 +561,7 @@ public class AuthServiceImpl implements AuthService {
|
|
|
String extName = originalFilename.substring(index);
|
|
|
String filePath = "/mnt/newdatadrive/data/runtime/jar-instance/zplma/tempFile/";
|
|
|
if ("dev".equals(active)) {
|
|
|
- filePath = "D:\\WorkSpace\\file\\tempImport\\";
|
|
|
+ filePath = "D:\\WorkSpace\\file\\tempImport\\";
|
|
|
}
|
|
|
filePath += randomStr + extName;
|
|
|
try {
|
|
@@ -695,6 +706,7 @@ public class AuthServiceImpl implements AuthService {
|
|
|
// if (2 != split.length) {
|
|
|
// return ResponseJson.error("第" + i + 1 + "行经纬度格式错误");
|
|
|
// }
|
|
|
+
|
|
|
// 校验联系电话
|
|
|
cell = authPartyRow.getCell(4);
|
|
|
cell.setCellType(CellType.STRING);
|
|
@@ -1264,6 +1276,20 @@ public class AuthServiceImpl implements AuthService {
|
|
|
authMapper.saveVideoInfo(cr.getUserName(),cr.getCover(),cr.getOssUrl(),cr.getOssName(),cr.getTitle(),releaseTime,cr.getAuthId(),cr.getAuthUserId());
|
|
|
return ResponseJson.success("保存成功",null);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 1.7.7保存视频信息
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson saveVideo(RossChallengeVideo ross){
|
|
|
+ Date date=new Date();
|
|
|
+ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String releaseTime = sf.format(date).replace("T", "");
|
|
|
+ //根据手机号获取clubuserid
|
|
|
+ Integer clubUserId = authMapper.getClubUserId(ross.getUserName());
|
|
|
+ authMapper.saveVideo(ross.getUserName(),ross.getCover(),ross.getOssUrl(),ross.getOssName(),ross.getTitle(),releaseTime,ross.getAuthId(),ross.getLinked(),ross.getAuthUserId(),clubUserId);
|
|
|
+ return ResponseJson.success("保存成功",null);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 根据authid获取authUserId
|
|
@@ -1550,8 +1576,18 @@ public class AuthServiceImpl implements AuthService {
|
|
|
}
|
|
|
if(challengeList.size()<0||!authUserIdList.contains(authUserId)){
|
|
|
authMapper.saveActivityInfo(startTime,endTime,status,authUserId);
|
|
|
+ //1.7.7ross挑战赛新加逻辑
|
|
|
+ //活动开启后给供应商下所有机构手机号码发送短信
|
|
|
+// if(status==1){
|
|
|
+// smsSend(authUserId);
|
|
|
+// }
|
|
|
}else {
|
|
|
authMapper.upActivityInfo(startTime,endTime,status,authUserId);
|
|
|
+ //1.7.7ross挑战赛新加逻辑
|
|
|
+ //活动开启后给供应商下所有机构手机号码发送短信
|
|
|
+// if(status==1){
|
|
|
+// smsSend(authUserId);
|
|
|
+// }
|
|
|
}
|
|
|
return ResponseJson.success();
|
|
|
}
|
|
@@ -1605,7 +1641,7 @@ public class AuthServiceImpl implements AuthService {
|
|
|
if(activityTime!=null){
|
|
|
//当按钮关闭时,状态皆为已结束,开始时根据时间判断
|
|
|
if(activityTime.getStatus()==0){
|
|
|
- activityTime.setActivityState(2);
|
|
|
+ activityTime.setActivityState(0);
|
|
|
}else{
|
|
|
if(activityTime.getStartTime().compareTo(releaseTime)>0){
|
|
|
activityTime.setActivityState(0);
|
|
@@ -1682,9 +1718,9 @@ public class AuthServiceImpl implements AuthService {
|
|
|
public ResponseJson downLoadChoseZip(String fileId,HttpServletResponse response){
|
|
|
if (fileId.contains(",")) {
|
|
|
String[] split = fileId.split(",");
|
|
|
- ArrayList<ChallengeRoundVo> fileTreeVos = new ArrayList<>();
|
|
|
+ ArrayList<RossChallengeVideo> fileTreeVos = new ArrayList<>();
|
|
|
for (String s : split) {
|
|
|
- ChallengeRoundVo file = authMapper.getChallengeRoundInfo(Integer.valueOf(s));
|
|
|
+ RossChallengeVideo file = authMapper.getChallengeVideoInfo(Integer.valueOf(s));
|
|
|
fileTreeVos.add(file);
|
|
|
}
|
|
|
//有package则在服务器固定路径new file.mkdir
|
|
@@ -1697,7 +1733,7 @@ public class AuthServiceImpl implements AuthService {
|
|
|
}
|
|
|
boolean mkdirs = new File(filePath).mkdirs();
|
|
|
Assert.isTrue(mkdirs, "文件夹创建失败");
|
|
|
- for (ChallengeRoundVo challengeRoundVo : fileTreeVos) {
|
|
|
+ for (RossChallengeVideo challengeRoundVo : fileTreeVos) {
|
|
|
//普通文件直接下载到临时文件夹uuid下
|
|
|
String fileName = "";
|
|
|
String ossurl = challengeRoundVo.getOssUrl();
|
|
@@ -1759,8 +1795,8 @@ public class AuthServiceImpl implements AuthService {
|
|
|
file.delete();
|
|
|
FileZipUtils.deleteFile(new File(zipPath));
|
|
|
}else {
|
|
|
- ArrayList<ChallengeRoundVo> fileTreeVos = new ArrayList<>();
|
|
|
- ChallengeRoundVo f = authMapper.getChallengeRoundInfo(Integer.valueOf(fileId));
|
|
|
+ ArrayList<RossChallengeVideo> fileTreeVos = new ArrayList<>();
|
|
|
+ RossChallengeVideo f = authMapper.getChallengeVideoInfo(Integer.valueOf(fileId));
|
|
|
fileTreeVos.add(f);
|
|
|
//有package则在服务器固定路径new file.mkdir
|
|
|
UUID uuid = UUID.randomUUID();
|
|
@@ -1772,7 +1808,7 @@ public class AuthServiceImpl implements AuthService {
|
|
|
}
|
|
|
boolean mkdirs = new File(filePath).mkdirs();
|
|
|
Assert.isTrue(mkdirs, "文件夹创建失败");
|
|
|
- for (ChallengeRoundVo challengeRoundVo : fileTreeVos) {
|
|
|
+ for (RossChallengeVideo challengeRoundVo : fileTreeVos) {
|
|
|
//普通文件直接下载到临时文件夹uuid下
|
|
|
String fileName = "";
|
|
|
String ossurl = challengeRoundVo.getOssUrl();
|
|
@@ -1878,4 +1914,263 @@ public class AuthServiceImpl implements AuthService {
|
|
|
}
|
|
|
return ResponseJson.success();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增参赛机构信息
|
|
|
+ * @param rossChallengeRoundVo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson saveRossInfo(RossChallengeRoundVo rossChallengeRoundVo){
|
|
|
+ //根据手机号获取clubuserid
|
|
|
+ Integer clubUserId = authMapper.getClubUserId(rossChallengeRoundVo.getUserName());
|
|
|
+ rossChallengeRoundVo.setClubUserId(clubUserId);
|
|
|
+ authMapper.saveRossInfo(rossChallengeRoundVo);
|
|
|
+ return ResponseJson.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据手机号码获取信息
|
|
|
+ * @param userName
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<RossChallengeRoundVo> getInfoByUserName(String userName){
|
|
|
+ return authMapper.getInfoByUserName(userName);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 验证用户是否已经报名
|
|
|
+ * @param mobile
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public ResponseJson<RossChallengeRoundVo> checkContestedInfo(String mobile,Integer authUserId){
|
|
|
+ //获取活动时间
|
|
|
+ ChallengeActivityVo activityTime = authMapper.getActivityTime(authUserId);
|
|
|
+ //活动时间内用户是否参与比赛
|
|
|
+ RossChallengeRoundVo ross=new RossChallengeRoundVo();
|
|
|
+ if(null!=activityTime&&StringUtils.isNotEmpty(activityTime.getStartTime())&&StringUtils.isNotEmpty(activityTime.getEndTime())){
|
|
|
+ RossChallengeRoundVo rossChallengeRoundVo = authMapper.getcontestedInfoByUserName(mobile,activityTime.getStartTime(),activityTime.getEndTime());
|
|
|
+ if(null!=rossChallengeRoundVo&&null!=rossChallengeRoundVo.getContestStatus()){
|
|
|
+ ross.setContestStatus(rossChallengeRoundVo.getContestStatus());
|
|
|
+ }else{
|
|
|
+ ross.setContestStatus(0);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ ross.setContestStatus(0);
|
|
|
+ }
|
|
|
+ return ResponseJson.success(ross);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 获取已报名信息列表
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson<List<RossChallengeRoundVo>> getcontestedInfo(Integer authUserId){
|
|
|
+ List<RossChallengeRoundVo> rossChallengeRoundVos = authMapper.getcontestedInfo(authUserId);
|
|
|
+ return ResponseJson.success(rossChallengeRoundVos);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询视频列表
|
|
|
+ * @param mobileOrAuthpart 电话号码或者机构名称
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson<PageInfo<RossChallengeVideo>> getVideoAll(String mobileOrAuthpart,Integer clubUserId,Integer authUserId,Integer pageNum,Integer pageSize){
|
|
|
+ ChallengeActivityVo activityTime = authMapper.getActivityTime(authUserId);
|
|
|
+ if(null==activityTime&&StringUtils.isEmpty(activityTime.getStartTime())&&StringUtils.isEmpty(activityTime.getEndTime())){
|
|
|
+ return ResponseJson.success();
|
|
|
+ }
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
+ List<RossChallengeVideo> videoAll = authMapper.getVideoAll(mobileOrAuthpart,authUserId,activityTime.getStartTime(),activityTime.getEndTime());
|
|
|
+ PageInfo<RossChallengeVideo> pageData = new PageInfo<>(videoAll);
|
|
|
+ //获取该用户点赞过的视频
|
|
|
+ //如果clubUserId为空,用户不能点赞,直接返回所有视频
|
|
|
+ if(null!=clubUserId){
|
|
|
+ if(null!=videoAll&& videoAll.size()>0){
|
|
|
+ for(RossChallengeVideo video:videoAll){
|
|
|
+ if (StringUtils.isNotEmpty(video.getClubUserIds())) {
|
|
|
+ if (video.getClubUserIds().contains(clubUserId.toString())) {
|
|
|
+ video.setDiggStatus(1);
|
|
|
+ } else {
|
|
|
+ video.setDiggStatus(0);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ video.setDiggStatus(0);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResponseJson.success(pageData);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据手机号码查询该机构视频列表
|
|
|
+ * @param mobile 登录账号
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson<List<RossChallengeVideo>> getVideoByUsername(String mobile,Integer clubUserId,Integer authUserId){
|
|
|
+ //获取活动时间内的机构列表信息
|
|
|
+ ChallengeActivityVo activityTime = authMapper.getActivityTime(authUserId);
|
|
|
+ if(null==activityTime&&StringUtils.isEmpty(activityTime.getStartTime())&&StringUtils.isEmpty(activityTime.getEndTime())){
|
|
|
+ return ResponseJson.success();
|
|
|
+ }
|
|
|
+ List<RossChallengeVideo> videoByUsername = authMapper.getVideoByUsername(mobile,activityTime.getStartTime(),activityTime.getEndTime());
|
|
|
+ //获取该用户点赞过的视频
|
|
|
+ if(null!=clubUserId){
|
|
|
+ if(null!=videoByUsername&& videoByUsername.size()>0){
|
|
|
+ for(RossChallengeVideo video:videoByUsername){
|
|
|
+ if (StringUtils.isNotEmpty(video.getClubUserIds())) {
|
|
|
+ if (video.getClubUserIds().contains(clubUserId.toString())) {
|
|
|
+ video.setDiggStatus(1);
|
|
|
+ } else {
|
|
|
+ video.setDiggStatus(0);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ video.setDiggStatus(0);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return ResponseJson.success(videoByUsername);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 验证机构是否已经上传了3个视频
|
|
|
+ * @param mobile 登录账号
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson<List<RossChallengeVideo>> checkVideoByUsername(String mobile,Integer authUserId){
|
|
|
+ //获取活动时间
|
|
|
+ ChallengeActivityVo activityTime = authMapper.getActivityTime(authUserId);
|
|
|
+ if(null!=activityTime&&StringUtils.isNotEmpty(activityTime.getStartTime())&&StringUtils.isNotEmpty(activityTime.getEndTime())){
|
|
|
+ //活动时间内用户是否参与比赛
|
|
|
+ List<RossChallengeVideo> rossChallengeVideos = authMapper.checkVideoByUsername(mobile,activityTime.getStartTime(),activityTime.getEndTime());
|
|
|
+ if(null!=rossChallengeVideos&&rossChallengeVideos.size()>=3){
|
|
|
+ return ResponseJson.success(-1,"抱歉,最多只能上传3个视频!!!",null);
|
|
|
+ }else{
|
|
|
+ return ResponseJson.success();
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ return ResponseJson.success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 点赞与取消点赞
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson upVideoDiggCount(Integer id,Integer diggFlag,Integer clubUserId,String clubUserIds){
|
|
|
+ if(diggFlag==0){
|
|
|
+ //取消点赞
|
|
|
+ if(StringUtils.isNotEmpty(clubUserIds)){
|
|
|
+ if(clubUserIds.contains(clubUserId.toString())){
|
|
|
+ clubUserIds=clubUserIds.replace(clubUserId.toString(),"");
|
|
|
+ clubUserIds=clubUserIds.replace(",,",",");
|
|
|
+ if(clubUserIds.lastIndexOf(",")==clubUserIds.length()-1){
|
|
|
+ clubUserIds=clubUserIds.substring(0,clubUserIds.length()-1);
|
|
|
+ }
|
|
|
+ if(clubUserIds.indexOf(",")==0){
|
|
|
+ clubUserIds=clubUserIds.substring(1,clubUserIds.length());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if(diggFlag==1){
|
|
|
+ //点赞
|
|
|
+ if(StringUtils.isEmpty(clubUserIds)){
|
|
|
+ clubUserIds=clubUserIds+clubUserId;
|
|
|
+ }else{
|
|
|
+ clubUserIds=clubUserIds+","+clubUserId;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ authMapper.upVideoDiggCount(id,diggFlag,clubUserIds);
|
|
|
+ return ResponseJson.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询机构信息(后端)
|
|
|
+ * @param mobile
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson<PageInfo<RossChallengeRoundVo>> getAuthInfo(String mobile,Integer pageNum,Integer pageSize,Integer authUserId){
|
|
|
+ //获取活动时间内的机构列表信息
|
|
|
+ ChallengeActivityVo activityTime = authMapper.getActivityTime(authUserId);
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
+ List<RossChallengeRoundVo> authInfo = authMapper.getAuthInfo(mobile,authUserId,activityTime.getStartTime(),activityTime.getEndTime());
|
|
|
+ PageInfo<RossChallengeRoundVo> pageData = new PageInfo<>(authInfo);
|
|
|
+ if(null!=authInfo&&authInfo.size()>0){
|
|
|
+ for (RossChallengeRoundVo search:authInfo) {
|
|
|
+ if(null != search.getContestTime()){
|
|
|
+ SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ Date da=new Date(search.getContestTime().getTime());
|
|
|
+ String date = fmt.format(da);
|
|
|
+ search.setContestDate(date);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResponseJson.success(pageData);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据id删除机构信息
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson delAuthInfoById(Integer id){
|
|
|
+ //先删除机构对应的视频信息
|
|
|
+ RossChallengeRoundVo round = authMapper.getRoundById(id);
|
|
|
+ if(null!=round && StringUtils.isNotEmpty(round.getUserName())){
|
|
|
+ authMapper.delVideoInfoByUserName(round.getUserName());
|
|
|
+ }
|
|
|
+ //再删除机构信息
|
|
|
+ authMapper.delAuthInfoById(id);
|
|
|
+ return ResponseJson.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据id删除视频信息
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson delVideoInfoById(Integer id){
|
|
|
+ authMapper.delVideoInfoById(id);
|
|
|
+ return ResponseJson.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void smsSend(Integer authUserId){
|
|
|
+ //获取手机号码
|
|
|
+// List<RossChallengeRoundVo> roundByAuthUserID = authMapper.getRoundByAuthUserID(authUserId);
|
|
|
+ List<ClubUserVo> clubUserList = clubMapper.getmobile(authUserId);
|
|
|
+ //获取供应商名称
|
|
|
+ String authParty=authMapper.getAuthparty(authUserId);
|
|
|
+ if(authUserId==12){
|
|
|
+ authParty="西班牙ROSS";
|
|
|
+ }
|
|
|
+ //短信类型:1通知短信,2验证码短信,3营销短信
|
|
|
+ Integer type=3;
|
|
|
+ //[s{20}]尊敬的会员,ROSS视频挑战赛报名通道已开启,点此【http://f6d.cn/Fgp6r】进入ROSS认证通,了解详情。
|
|
|
+ String conn="[" + authParty + "]尊敬的会员,ROSS视频挑战赛报名通道已开启,点此https://zp.caimei365.com/12/ross/activity/challenge进入ROSS认证通,了解详情。";
|
|
|
+ if(null!=clubUserList&& clubUserList.size()>0){
|
|
|
+ clubUserList.stream().forEach(round ->{
|
|
|
+ if(StringUtils.isNotEmpty(round.getMobile())){
|
|
|
+ Boolean aBoolean = SmsUtils.sendSms(type, round.getMobile(), conn);
|
|
|
+ if(aBoolean){
|
|
|
+ log.info("挑战赛短信发送成功"+round.getMobile());
|
|
|
+ }else{
|
|
|
+ log.info("挑战赛短信发送失败"+round.getMobile());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|