Commit 285d80af by 桂前礼 Committed by 桂前礼

feat: [1004882] 小程序优化

parent c6d5d34c
......@@ -24,4 +24,7 @@ public class AppletNotifySendDTO {
@ApiModelProperty("问题id")
private Long fromId;
@ApiModelProperty("JSON形式额外信息")
private String extJson;
}
......@@ -42,4 +42,9 @@ public interface CultivateNotifyService {
@ApiOperation(value = "小睿互助创建站内信消息", httpMethod = "POST")
@RequestMapping(value = "createNotify4Question", method = RequestMethod.POST)
ResponseEntity<ResponseDto<Long>> createNotify4Question(@RequestBody AppletNotifySendDTO newSendDTO) throws BizException;
@ApiOperation(value = "应用创建站内信消息", httpMethod = "POST")
@RequestMapping(value = "createNotify4App", method = RequestMethod.POST)
ResponseEntity<ResponseDto<Long>> createNotify4App(@RequestBody AppletNotifySendDTO newSendDTO) throws BizException;
}
......@@ -40,4 +40,8 @@ public interface CultivateNotifyBiz {
Long createNotify4Question(AppletNotifySendDTO newSendDTO);
PageBeanNew<CultivateNotifyDTO> getLatestNotifyList(Long wechatUserId, Integer currentPage, Integer numPerPage);
Long createNotify4App(AppletNotifySendDTO newSendDTO);
void clearExpireNotifies();
}
......@@ -592,4 +592,30 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
fillAppOrProduct4Notify(cultivateNotifyItemList);
return pageBeanNew;
}
@Override
public Long createNotify4App(AppletNotifySendDTO newSendDTO) {
if (null == newSendDTO || null == newSendDTO.getSendType() || null == newSendDTO.getMessageType() || StringUtil.isEmpty(newSendDTO.getTitle())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"新建站内信消息参数为空");
}
CultivateNotify cultivateNotify=new CultivateNotify();
cultivateNotify.setMessageType(newSendDTO.getMessageType());
cultivateNotify.setTitle(newSendDTO.getTitle());
cultivateNotify.setSendType(newSendDTO.getSendType());
cultivateNotify.setAgentId(0L);
cultivateNotifyDao.insert(cultivateNotify);
CultivateNotifyItem cultivateNotifyItem = new CultivateNotifyItem();
cultivateNotifyItem.setMessageId(cultivateNotify.getMessageId());
cultivateNotifyItem.setContentType(4);
cultivateNotifyItem.setServeId(newSendDTO.getFromId());
cultivateNotifyItem.setServeType(AppletRecordTypeEnum.APP.value);
cultivateNotifyItem.setExtJson(newSendDTO.getExtJson());
cultivateNotifyItemDao.insert(Lists.newArrayList(cultivateNotifyItem));
return cultivateNotify.getMessageId();
}
@Override
public void clearExpireNotifies() {
cultivateNotifySendDao.clearExpireNotifies();
}
}
......@@ -24,4 +24,6 @@ public interface CultivateNotifySendDao extends BaseDao<CultivateNotifySend> {
List<Long> getSendUserIds(Long messageId,Integer currentPage,Integer numPerPage);
Integer getSendUserCount(Long messageId);
void clearExpireNotifies();
}
......@@ -71,4 +71,9 @@ public class CultivateNotifySendDaoImpl extends BaseDaoImpl<CultivateNotifySend>
map.put("messageId",messageId);
return super.getSessionTemplate().selectOne(getStatement("getSendUserCount"),map);
}
@Override
public void clearExpireNotifies() {
getSessionTemplate().delete(getStatement("clearExpireNotifies"));
}
}
package com.pcloud.book.cultivate.entity;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.pcloud.book.applet.dto.AppletBannerDTO;
import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.dto.ServeItemInfoDTO;
......@@ -13,6 +16,7 @@ import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@Data
......@@ -88,8 +92,16 @@ public class CultivateNotifyItem extends BaseEntity {
@ApiModelProperty("小睿互助问题")
private AppletQuestion appletQuestion;
@ApiModelProperty("JSON格式的额外信息")
private String extJson;
@ApiModelProperty("extJson转map")
private Map<String, Object> extMap;
public Map<String, Object> getExtMap() {
if (StrUtil.isNotBlank(extJson)) {
return JSONObject.parseObject(extJson);
}
return MapUtil.empty();
}
}
package com.pcloud.book.cultivate.schedules;
import com.pcloud.book.cultivate.biz.CultivateNotifyBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
public class ClearExpireNotifies {
@Autowired
private CultivateNotifyBiz cultivateNotifyBiz;
@Scheduled(cron = "0 0 1 * * ?")
public void doJob(){
cultivateNotifyBiz.clearExpireNotifies();
}
}
......@@ -9,8 +9,6 @@ import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.common.utils.bean.ResponesUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -49,4 +47,9 @@ public class CultivateNotifyServiceImpl implements CultivateNotifyService {
public ResponseEntity<ResponseDto<Long>> createNotify4Question(@RequestBody AppletNotifySendDTO newSendDTO) throws BizException{
return ResponseHandleUtil.toResponse(cultivateNotifyBiz.createNotify4Question(newSendDTO));
}
@RequestMapping(value = "createNotify4App", method = RequestMethod.POST)
public ResponseEntity<ResponseDto<Long>> createNotify4App(@RequestBody AppletNotifySendDTO newSendDTO) throws BizException{
return ResponseHandleUtil.toResponse(cultivateNotifyBiz.createNotify4App(newSendDTO));
}
}
......@@ -14,6 +14,7 @@
<result column="serve_type" jdbcType="TINYINT" property="serveType"/>
<result column="jump_type" jdbcType="INTEGER" property="jumpType"/>
<result column="jump_url" jdbcType="VARCHAR" property="jumpUrl"/>
<result column="ext_json" jdbcType="LONGVARCHAR" property="extJson"/>
</resultMap>
<sql id="Base_Column_List" >
......@@ -21,7 +22,8 @@
jump_type,
jump_url,
serve_id,
serve_type
serve_type,
ext_json
</sql>
<insert id="batchInsert" parameterType="com.pcloud.book.cultivate.entity.CultivateNotifyItem" useGeneratedKeys="true" keyProperty="id">
......@@ -37,7 +39,8 @@
jump_type,
jump_url,
serve_id,
serve_type
serve_type,
ext_json
)
values
<foreach collection="list" item="item" index="index" separator=",">
......@@ -52,7 +55,8 @@
#{item.jumpType},
#{item.jumpUrl},
#{item.serveId},
#{item.serveType}
#{item.serveType},
#{item.extJson}
)
</foreach>
</insert>
......
......@@ -157,4 +157,13 @@
where message_id=#{messageId}
</select>
<delete id="clearExpireNotifies">
DELETE
FROM
`cultivate_notify_send`
WHERE
message_type = 6
AND DATE( create_time ) &lt; DATE(SUBDATE( NOW(), INTERVAL 1 MONTH ))
</delete>
</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