Authored by mingdan.ge

cps6期

... ... @@ -16,6 +16,8 @@ public class UnionShareMessage extends BaseBO {
private String url;
private int shareFlag;
private int priority;
private Integer startTime;
... ... @@ -98,6 +100,14 @@ public class UnionShareMessage extends BaseBO {
this.updateTime = updateTime;
}
public int getShareFlag() {
return shareFlag;
}
public void setShareFlag(int shareFlag) {
this.shareFlag = shareFlag;
}
@Override
public String toString() {
return "UnionShareMessage{" +
... ... @@ -105,6 +115,7 @@ public class UnionShareMessage extends BaseBO {
", content='" + content + '\'' +
", image='" + image + '\'' +
", url=" + url +
", shareFlag=" + shareFlag +
", priority=" + priority +
", startTime='" + startTime + '\'' +
", endTime=" + endTime +
... ...
... ... @@ -6,6 +6,7 @@
<result column="content" property="content" jdbcType="VARCHAR" />
<result column="image" property="image" jdbcType="VARCHAR" />
<result column="url" property="url" jdbcType="VARCHAR" />
<result column="share_flag" property="shareFlag" jdbcType="INTEGER" />
<result column="priority" property="priority" jdbcType="INTEGER" />
<result column="start_time" property="startTime" jdbcType="INTEGER" />
<result column="end_time" property="endTime" jdbcType="INTEGER" />
... ... @@ -13,7 +14,7 @@
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, content, image, url, priority, start_time, end_time,
id, content, image, url, share_flag,priority, start_time, end_time,
create_time, update_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
... ... @@ -27,9 +28,9 @@
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.unions.dal.model.UnionShareMessage" >
insert into union_share_message (content, image, url, priority, start_time, end_time,
insert into union_share_message (content, image, url, share_flag,priority, start_time, end_time,
create_time, update_time)
values (#{content,jdbcType=VARCHAR}, #{image,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{priority,jdbcType=INTEGER},
values (#{content,jdbcType=VARCHAR}, #{image,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{shareFlag,jdbcType=INTEGER}, #{priority,jdbcType=INTEGER},
#{startTime,jdbcType=INTEGER}, #{endTime,jdbcType=INTEGER}, #{createTime,jdbcType=INTEGER},
#{updateTime,jdbcType=INTEGER}
)
... ... @@ -47,6 +48,9 @@
<if test="url != null" >
url = #{url,jdbcType=VARCHAR},
</if>
<if test="shareFlag != null" >
share_flag = #{shareFlag,jdbcType=INTEGER},
</if>
<if test="priority != null" >
priority = #{priority,jdbcType=INTEGER},
</if>
... ...
... ... @@ -48,7 +48,7 @@
limit #{start},#{size}
</select>
<select id="selectTotalRankList" resultType="com.yoho.service.model.union.bo.UninoShareIncomeBo" >
select sum(amount) as amount ,uid,alias,nickname,image,order_num as orderNum
select sum(amount) as amount ,uid,alias,nickname,max(image) as image,order_num as orderNum
from union_share_orders_month
group by alias
order by sum(amount) desc
... ...
... ... @@ -73,6 +73,8 @@ public interface IUnionShareService {
*/
int userApply(UnionShareUserApplyReqBo req);
void passUserApply(Integer startTime, Integer endTime);
/**
* 申请状态
* @param uid
... ...
... ... @@ -499,7 +499,11 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
} else {
//批量拒绝
logger.info("refuseApply,ids opt,req is {}", req);
Set<Integer> idSet =getSetFromIds(req.getIds());
Set<Integer> idSet =getSetFromIds(req);
if (idSet == null) {
logger.info("refuseApply,idSet null,req is {}", req);
return 0;
}
//状态:1-申请中,2-通过,3-拒绝
int result=unionShareUserApplyMapper.updateStatus(idSet,1,3, DateUtil.getCurrentTimeSecond());
if (result == 0) {
... ... @@ -522,8 +526,17 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
}
}
private Set<Integer> getSetFromIds(String ids) {
Set<Integer> idSet = Arrays.stream(ids.split(",")).map(s->{
private Set<Integer> getSetFromIds(IdOrIdsBo idsBo) {
if (idsBo == null) {
return null;
}
if (CollectionUtils.isNotEmpty(idsBo.getIdSet())) {
return idsBo.getIdSet();
}
if (StringUtils.isBlank(idsBo.getIds())) {
return null;
}
Set<Integer> idSet = Arrays.stream(idsBo.getIds().split(",")).map(s->{
Integer skn = null;
try {
skn = Integer.valueOf(s);
... ... @@ -561,7 +574,11 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
} else {
//批量通过
logger.info("agreeApply,ids opt,req is {}", req);
Set<Integer> idSet =getSetFromIds(req.getIds());
Set<Integer> idSet =getSetFromIds(req);
if (idSet == null) {
logger.info("agreeApply,idSet null,req is {}", req);
return 0;
}
int currentTimeSecond = DateUtil.getCurrentTimeSecond();
//状态:1-申请中,2-通过,3-拒绝
int result=unionShareUserApplyMapper.updateStatus(idSet,1,2, currentTimeSecond);
... ... @@ -790,6 +807,27 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
return result;
}
/**
* 自动通过某时间段的申请
* */
@Override
public void passUserApply(Integer startTime, Integer endTime){
logger.info("passUserApply.startTime is {},endTime is {}.",startTime,endTime);
UnionShareUserApplyListReqBo req = new UnionShareUserApplyListReqBo();
req.setBeginTime(startTime);
req.setEndTime(endTime);
req.setQueryAll(true);
req.setStatus(1);
List<UnionShareUserApplyListBo> applyListBos = unionShareUserApplyMapper.selectByCondition(req);
if (CollectionUtils.isEmpty(applyListBos)) {
return;
}
IdOrIdsBo idOrIdsBo = new IdOrIdsBo();
Set<Integer> idSet = applyListBos.stream().map(a -> a.getId()).collect(Collectors.toSet());
idOrIdsBo.setIdSet(idSet);
agreeApply(idOrIdsBo);
}
private List<SocialMediaBo> filterSocialMedia(List<SocialMediaBo> bos) {
if (CollectionUtils.isEmpty(bos)) {
return null;
... ...
package com.yoho.unions.server.task;
import com.yoho.unions.common.utils.DateUtil;
import com.yoho.unions.server.service.IUnionShareService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* cps用户申请自动通过task
* Created by mingdan.ge on 2018/9/17.
*/
@Component
public class CpsApplyPassTask {
private Logger logger = LoggerFactory.getLogger(CpsApplyPassTask.class);
@Autowired
IUnionShareService unionShareService;
// 每天08:40执行
@Scheduled(cron = "0 0/1 * * * ?")
public void run() {
logger.info("start pass new apply ");
//某时间段申请中的用户自动通过
unionShareService.passUserApply(null, DateUtil.getCurrentTimeSecond()-120);
}
}
... ...