Commit 9c387ba8 by 裴大威

Merge branch 'zyj-youhua' into 'master'

接口优化/book/v1.0/selfPushFacade/listSelfPushRecord

See merge request rays/pcloud-book!592
parents f8c2fae6 b4bea1c1
......@@ -148,11 +148,13 @@ public class SelfPushBizImpl implements SelfPushBiz {
selfPush.setSendNow(sendNow);
if (sendNow) {
selfPush.setSendTime(new Date());
selfPush.setPushStatus(PushStatusEnum.PUSHING.value);
} else {
selfPush.setPushSendTime(addParamDTO.getSendTime());
selfPush.setStartTime(DateUtils.getDateByStr(addParamDTO.getStartTime()));
selfPush.setEndTime(DateUtils.getDateByStr(addParamDTO.getEndTime()));
selfPush.setPushType(addParamDTO.getPushType());
selfPush.setPushStatus(PushStatusEnum.WAIT.value);
if(addParamDTO.getPushType()==2){
selfPush.setWeekDays(addParamDTO.getWeekDays());
}
......@@ -336,7 +338,7 @@ public class SelfPushBizImpl implements SelfPushBiz {
}
}
}
selfPushItemDao.updatePushStatusByPushId(PushStatusEnum.SUCCESS.value, pushId);
this.updatePushStatusByPushId(PushStatusEnum.SUCCESS.value, pushId);
});
}else if ( null != selfPush.getBookGroupId()){//编辑端群发
Long bookGroupId = selfPush.getBookGroupId();
......@@ -362,7 +364,7 @@ public class SelfPushBizImpl implements SelfPushBiz {
}
}
}
selfPushItemDao.updatePushStatusByPushId(PushStatusEnum.SUCCESS.value, pushId);
this.updatePushStatusByPushId(PushStatusEnum.SUCCESS.value, pushId);
});
}
......@@ -663,7 +665,7 @@ public class SelfPushBizImpl implements SelfPushBiz {
map.put("endTime", endTime);
map.put("pushStatus", status);
map.put("partyId", partyId);
PageBeanNew<SelfPushRecordDTO> pageBeanNew = selfPushItemDao.listPageNew(new PageParam(currentPage, numPerPage), map, "listSelfPushRecord");
PageBeanNew<SelfPushRecordDTO> pageBeanNew = selfPushDao.listPageNew(new PageParam(currentPage, numPerPage), map, "listSelfPush");
if (null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())) {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
}
......@@ -750,7 +752,9 @@ public class SelfPushBizImpl implements SelfPushBiz {
realSendTime=realSendTime+weekDays+";"+dto.getPushSendTime();
dto.setRealSendTime(realSendTime);
}else{
dto.setRealSendTime(DateUtils.formatDate(dto.getSendTime(),"yyyy-MM-dd HH:mm:ss"));
if (null!=dto.getSendTime()){
dto.setRealSendTime(DateUtils.formatDate(dto.getSendTime(),"yyyy-MM-dd HH:mm:ss"));
}
}
}
}
......@@ -874,7 +878,7 @@ public class SelfPushBizImpl implements SelfPushBiz {
if (ListUtils.isEmpty(userIdList) || ListUtils.isEmpty(itemList)) {
return;
}
selfPushItemDao.updatePushStatusByPushId(PushStatusEnum.PUSHING.value, pushId);
this.updatePushStatusByPushId(PushStatusEnum.PUSHING.value, pushId);
msgPush(userIdList, itemList, pushId);
}
......@@ -1090,4 +1094,15 @@ public class SelfPushBizImpl implements SelfPushBiz {
public PersonalApplets getAppletsById(Long id) {
return personalAppletsDao.getById(id);
}
/**
* 更新发送状态
* @param pushStatus
* @param pushId
*/
public void updatePushStatusByPushId(Integer pushStatus, Long pushId){
selfPushItemDao.updatePushStatusByPushId(pushStatus, pushId);
selfPushDao.updatePushStatusById(pushStatus, pushId);
}
}
......@@ -14,4 +14,11 @@ import java.util.List;
public interface SelfPushDao extends BaseDao<SelfPush>{
List<SelfPush> getUnclosedByRobot(String altId);
/**
* 更新发送状态
* @param pushStatus
* @param id
*/
void updatePushStatusById(Integer pushStatus, Long id);
}
......@@ -6,7 +6,9 @@ import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @描述:个人号群发
......@@ -20,4 +22,12 @@ public class SelfPushDaoImpl extends BaseDaoImpl<SelfPush> implements SelfPushDa
public List<SelfPush> getUnclosedByRobot(String altId) {
return getSessionTemplate().selectList(getStatement("getUnclosedByRobot"), altId);
}
@Override
public void updatePushStatusById(Integer pushStatus, Long id) {
Map<String, Object> map = new HashMap<>();
map.put("pushStatus", pushStatus);
map.put("id", id);
getSessionTemplate().update(getStatement("updatePushStatusById"), map);
}
}
......@@ -72,4 +72,6 @@ public class SelfPush extends BaseEntity{
@ApiModelProperty("个人号类型(1微信2QQ)")
private Integer altType;
@ApiModelProperty("发送状态(0发送中1发送成功2发送失败)")
private Integer pushStatus;
}
\ No newline at end of file
......@@ -18,22 +18,23 @@
<result column="week_days" property="weekDays" jdbcType="VARCHAR" />
<result column="push_send_time" property="pushSendTime" jdbcType="VARCHAR" />
<result column="alt_type" property="altType" jdbcType="INTEGER" />
<result column="push_status" property="pushStatus" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, alt_id, create_user, create_time, update_user, update_time, send_now, send_time, book_group_id, send_all,start_time,end_time,
push_type,week_days,push_send_time,alt_type
push_type,week_days,push_send_time,alt_type, push_status
</sql>
<insert id="insert" parameterType="com.pcloud.book.push.entity.SelfPush" useGeneratedKeys="true" keyProperty="id">
insert into self_push (id, alt_id, create_user,
create_time, update_user, update_time, send_now, send_time, book_group_id, send_all,start_time,end_time,
push_type,week_days,push_send_time,alt_type
push_type,week_days,push_send_time,alt_type,push_status
)
values (#{id,jdbcType=BIGINT}, #{altId,jdbcType=VARCHAR}, #{createUser,jdbcType=BIGINT},
now(), #{updateUser,jdbcType=BIGINT}, now(), #{sendNow}, #{sendTime}, #{bookGroupId}, #{sendAll},#{startTime},
#{endTime},#{pushType},#{weekDays},#{pushSendTime}, #{altType}
#{endTime},#{pushType},#{weekDays},#{pushSendTime}, #{altType},#{pushStatus,jdbcType=INTEGER}
)
</insert>
......@@ -65,4 +66,52 @@
)
AND alt_id = #{altId}
</select>
<update id="updatePushStatusById" parameterType="map">
UPDATE self_push
SET push_status = #{pushStatus}
WHERE id= #{id}
</update>
<select id="listSelfPush" parameterType="map" resultType="com.pcloud.book.push.dto.SelfPushRecordDTO">
SELECT
p.alt_id altId,
p.book_group_id bookGroupId,
p.id pushId,
p.send_all sendAll,
p.create_user createUser,
p.start_time startTime,
p.end_time endTime,
p.push_send_time pushSendTime,
p.week_days weekDays,
p.push_type pushType,
p.alt_type groupRobotType,
p.push_status pushStatus,
p.create_time createTime,
p.send_time sendTime
FROM
self_push p
WHERE
1 = 1
<if test="startTime != null and endTime != null">
AND (
(p.send_time BETWEEN #{startTime} AND #{endTime} )
OR (p.start_time >= #{startTime} AND p.end_time &lt;= #{endTime})
)
</if>
<if test="pushStatus != null">
AND p.push_status = #{pushStatus}
</if>
<choose>
<when test="partyId == 0">
AND p.alt_id IS NOT NULL AND p.alt_id !=""
</when>
<otherwise>
AND p.create_user = #{partyId}
</otherwise>
</choose>
ORDER BY
p.create_time DESC
</select>
</mapper>
\ No newline at end of file
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