...
|
...
|
@@ -26,6 +26,7 @@ import com.yoho.unions.server.service.IUnionShareService; |
|
|
import com.yoho.unions.utils.DateUtils;
|
|
|
import com.yoho.unions.utils.ImagesHelper;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
...
|
...
|
@@ -40,6 +41,7 @@ import java.text.DecimalFormat; |
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -289,7 +291,6 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
List<UnionShareUserApplyListBo> applys=this.unionShareUserApplyMapper.selectByCondition(parm);
|
|
|
for(UnionShareUserApplyListBo bo:applys){
|
|
|
bo.setSocialMediaType(null==bo.getSocialMediaType()?null:SocialMediaTypeEnum.getNameByType(Integer.parseInt(bo.getSocialMediaType())));
|
|
|
bo.setSocialMediaFans(null==bo.getSocialMediaFans()?null: SocialMediaSectionEnum.getSectionByNo(Integer.parseInt(bo.getSocialMediaFans()),"-"));
|
|
|
}
|
|
|
PageResponseBO<UnionShareUserApplyListBo> result=new PageResponseBO<>();
|
|
|
result.setList(applys);
|
...
|
...
|
@@ -305,35 +306,17 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
*/
|
|
|
@Override
|
|
|
public int refuseApply(IdOrIdsBo req){
|
|
|
if (req.getId() != null) {
|
|
|
//单个操作
|
|
|
UnionShareUserApply unionShareUserApply = unionShareUserApplyMapper.selectByPrimaryKey(req.getId());
|
|
|
if (unionShareUserApply == null || unionShareUserApply.getStatus() > 1) {
|
|
|
return 0;
|
|
|
}
|
|
|
UnionShareUserApply updateReq = new UnionShareUserApply();
|
|
|
updateReq.setId(req.getId());
|
|
|
updateReq.setStatus((byte) 3);//状态:1-申请中,2-通过,3-拒绝
|
|
|
updateReq.setCheckTime(DateUtil.getCurrentTimeSecond());
|
|
|
int result=unionShareUserApplyMapper.updateByPrimaryKeySelective(updateReq);
|
|
|
redisHashCache.delete(ShareOrdersKeyEnum.UNION_TYPE.getPreKey(),unionShareUserApply.getUid());
|
|
|
return result;
|
|
|
} else {
|
|
|
//批量操作
|
|
|
List<UnionShareUserApply> unionShareUserApplies = unionShareUserApplyMapper.selectByIds(Arrays.asList(req.getIdArray()));
|
|
|
if (CollectionUtils.isEmpty(unionShareUserApplies)) {
|
|
|
return 0;
|
|
|
}
|
|
|
List<Integer> ids = new ArrayList<>();
|
|
|
unionShareUserApplies.forEach(u->{
|
|
|
ids.add(u.getId());
|
|
|
});
|
|
|
int result=unionShareUserApplyMapper.updateStatus(ids,1,3,DateUtil.getCurrentTimeSecond());
|
|
|
unionShareUserApplies.forEach(u->{
|
|
|
redisHashCache.delete(ShareOrdersKeyEnum.UNION_TYPE.getPreKey(),u.getUid());
|
|
|
});
|
|
|
return result;
|
|
|
UnionShareUserApply unionShareUserApply = unionShareUserApplyMapper.selectByPrimaryKey(req.getId());
|
|
|
if (unionShareUserApply == null || unionShareUserApply.getStatus() > 1) {
|
|
|
return 0;
|
|
|
}
|
|
|
UnionShareUserApply updateReq = new UnionShareUserApply();
|
|
|
updateReq.setId(req.getId());
|
|
|
updateReq.setStatus((byte) 3);//状态:1-申请中,2-通过,3-拒绝
|
|
|
updateReq.setCheckTime(DateUtil.getCurrentTimeSecond());
|
|
|
int result=unionShareUserApplyMapper.updateByPrimaryKeySelective(updateReq);
|
|
|
redisHashCache.delete(ShareOrdersKeyEnum.UNION_TYPE.getPreKey(),unionShareUserApply.getUid());
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
/**
|
...
|
...
|
@@ -356,23 +339,35 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
updateReq.setCheckTime(DateUtil.getCurrentTimeSecond());
|
|
|
int result=unionShareUserApplyMapper.updateByPrimaryKeySelective(updateReq);
|
|
|
if (result > 0) {
|
|
|
//todo 绑定unionType
|
|
|
// 绑定unionType
|
|
|
relateUnionType(unionShareUserApply.getUid());
|
|
|
}
|
|
|
redisHashCache.delete(ShareOrdersKeyEnum.UNION_TYPE.getPreKey(),unionShareUserApply.getUid());
|
|
|
return result;
|
|
|
} else {
|
|
|
//批量操作
|
|
|
List<UnionShareUserApply> unionShareUserApplies = unionShareUserApplyMapper.selectByIds(Arrays.asList(req.getIdArray()));
|
|
|
Set<Integer> idSet = Arrays.stream(req.getIds().split(",")).map(s->{
|
|
|
Integer skn = null;
|
|
|
try {
|
|
|
skn = Integer.valueOf(s);
|
|
|
} catch (NumberFormatException e) {
|
|
|
}
|
|
|
return skn;
|
|
|
}).collect(Collectors.toSet());
|
|
|
|
|
|
int currentTimeSecond = DateUtil.getCurrentTimeSecond();
|
|
|
int result=unionShareUserApplyMapper.updateStatus(idSet,1,2, currentTimeSecond);
|
|
|
if (result == 0) {
|
|
|
return 0;
|
|
|
}
|
|
|
List<UnionShareUserApply> unionShareUserApplies = unionShareUserApplyMapper.selectByIds(idSet);
|
|
|
if (CollectionUtils.isEmpty(unionShareUserApplies)) {
|
|
|
return 0;
|
|
|
}
|
|
|
List<Integer> ids = new ArrayList<>();
|
|
|
unionShareUserApplies.forEach(u->{
|
|
|
ids.add(u.getId());
|
|
|
});
|
|
|
int result=unionShareUserApplyMapper.updateStatus(ids,1,2,DateUtil.getCurrentTimeSecond());
|
|
|
unionShareUserApplies.forEach(u->{
|
|
|
if (u.getCheckTime() != currentTimeSecond) {
|
|
|
return;
|
|
|
}
|
|
|
relateUnionType(u.getUid());
|
|
|
redisHashCache.delete(ShareOrdersKeyEnum.UNION_TYPE.getPreKey(),u.getUid());
|
|
|
});
|
...
|
...
|
@@ -485,7 +480,6 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
public Map<String,JSONArray> getSocialMediaBasicParams(){
|
|
|
logger.info("getBankList");
|
|
|
Map<String, JSONArray> result = new HashMap<>();
|
|
|
result.put("section", SocialMediaSectionEnum.getAllSectionArray("-"));
|
|
|
result.put("mediaType", SocialMediaTypeEnum.getAllTypeArray());
|
|
|
return result;
|
|
|
}
|
...
|
...
|
|