Commit 99c3bb59 by 郑勇

feat: [1006977] 关键点副作用的通用记录方案

parent 1061ded9
......@@ -16,7 +16,6 @@ import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.data.domain.dto.BookScanCountParamDTO;
import com.pcloud.data.domain.vo.BookScanCountVO;
import com.pcloud.labelcenter.label.dto.LabelDto;
import com.pcloud.readercenter.userlabel.dto.UserGradeLabelIdDTO;
import java.util.Date;
......@@ -37,9 +36,10 @@ public interface BookAdviserBiz {
* 创建编辑管理书籍关系
*
* @param bookAdviser 图书编辑关联实体类
* @param token
* @throws BizException
*/
public void create(BookAdviser bookAdviser) throws BizException;
public void create(BookAdviser bookAdviser, String token) throws BizException;
/**
* 删除编辑和书籍的推广信息
......@@ -174,8 +174,9 @@ public interface BookAdviserBiz {
* @param bookId 图书标识
* @param adviserId 编辑标识
* @param channelId 渠道标识
* @param token
*/
public void deleteBook4Adviser(Long bookId, Long adviserId, Long channelId, String ipAddress, Long userId);
public void deleteBook4Adviser(Long bookId, Long adviserId, Long channelId, String ipAddress, Long userId, String token);
/**
* 恢复书籍-编辑
......@@ -184,9 +185,10 @@ public interface BookAdviserBiz {
* @param channelId 渠道标识
* @param templetId 模板标识
* @param secondTempletId 模板第二阶级标识
* @param token
*/
public void recoverBook4Adviser(Long bookId, Long adviserId, Long channelId, Long templetId,Long secondTempletId, Long graLabelId, Long subLabelId,
Long verLabelId, Long areaLabelId, Boolean recoverScene, Long thirdTempletId, String ipAddress, Long userId);
public void recoverBook4Adviser(Long bookId, Long adviserId, Long channelId, Long templetId, Long secondTempletId, Long graLabelId, Long subLabelId,
Long verLabelId, Long areaLabelId, Boolean recoverScene, Long thirdTempletId, String ipAddress, Long userId, String token);
/**
* 获取编辑的图书总数
......
......@@ -37,9 +37,10 @@ public interface BookBiz {
* 图书基本信息
* @param systemCode 当事人角色
* 角色
* @param token
* @throws BizException
*/
BookDto create(Book book, String systemCode) throws BizException;
BookDto create(Book book, String systemCode, String token) throws BizException;
/**
* 修改书籍
......@@ -54,9 +55,10 @@ public interface BookBiz {
* 修改书籍(编辑)
* @param book
* 图书基本信息
* @param token
* @throws BizException
*/
BookDto updateByAdviser(Book book) throws BizException;
BookDto updateByAdviser(Book book, String token) throws BizException;
/**
* 删除书籍
......@@ -268,9 +270,10 @@ public interface BookBiz {
*
* @param book
* 图书基本信息实体类
* @param token
* @return
*/
void setBookAdviserRelation(Book book);
void setBookAdviserRelation(Book book, String token);
/**
* 获取书籍基本信息
......@@ -463,9 +466,10 @@ public interface BookBiz {
* 编辑新增图书
* @param book
* 图书基本信息
* @param token
* @return
*/
BookDto create4Adviser(Book book);
BookDto create4Adviser(Book book, String token);
/**
* 修改图书类型与图书基本信息
......
package com.pcloud.book.book.biz.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
......@@ -14,7 +13,6 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.pcloud.analysisengine.browse.dto.BookBrowseAndScanStatsDTO;
import com.pcloud.analysisengine.browse.dto.BrowseCacheRecordDto;
import com.pcloud.analysisengine.qrcode.dto.BookScanCountDto;
import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.book.base.dto.CountDto;
import com.pcloud.book.base.exception.BookBizException;
......@@ -102,7 +100,6 @@ import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.data.domain.dto.BookScanCountParamDTO;
import com.pcloud.data.domain.vo.BookScanCountVO;
import com.pcloud.facade.tradecenter.dto.Amount4BookAdviserDto;
import com.pcloud.labelcenter.label.dto.LabelDto;
import com.pcloud.raystask.entity.AdviserDefault;
import com.pcloud.readercenter.common.enums.YesOrNoNumEnum;
import com.pcloud.readercenter.userlabel.dto.UserGradeLabelIdDTO;
......@@ -257,7 +254,7 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void create(BookAdviser bookAdviser) throws BizException {
public void create(BookAdviser bookAdviser, String token) throws BizException {
LOGGER.info("创建编辑与书籍关联关系【START】bookAdviser=" + bookAdviser);
checkParam(bookAdviser);
// 验证渠道编辑是否为一个出版社
......@@ -283,7 +280,7 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
recoverBook4Adviser(bookAdviser.getBookId(), bookAdviser.getAdviserId(), bookAdviser.getChannelId(),
bookAdviser.getTempletId(), bookAdviser.getSecondTempletId(),
bookAdviser.getGraLabelId(), bookAdviser.getSubLabelId(), bookAdviser.getVerLabelId(), bookAdviser.getAreaLabelId(),
false,bookAdviser.getThirdTempletId(),null, null);
false,bookAdviser.getThirdTempletId(),null, null, token);
bookAdviser.setBookAdviserId(bookAdviserDto.getBookAdviserId());
} else {
// 判断是否配置过该书籍推广信息
......@@ -818,7 +815,7 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteBook4Adviser(Long bookId, Long adviserId, Long channelId, String ipAddress, Long userId) {
public void deleteBook4Adviser(Long bookId, Long adviserId, Long channelId, String ipAddress, Long userId, String token) {
LOGGER.info("删除书籍(编辑端)<START>.[bookId]=" + bookId + ",[adviserId]=" + adviserId + ",channelId=" + channelId);
Map<String, Long> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
......@@ -839,7 +836,7 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
String adviserName = adviserConsr.getNameById(adviserId);
Long agentId = adviserConsr.getAgentIdByAdviser(adviserId);
String content = String.format("【编辑】『%s』删除书刊%s", adviserName, StringUtil.addBracket(book.getBookName()));
operationConsr.send(agentId, userId,content, ipAddress);
operationConsr.send(agentId, userId,content, ipAddress,token);
});
}
......@@ -895,9 +892,9 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void recoverBook4Adviser(Long bookId, Long adviserId, Long channelId, Long templetId,Long secondTempletId,
public void recoverBook4Adviser(Long bookId, Long adviserId, Long channelId, Long templetId, Long secondTempletId,
Long graLabelId, Long subLabelId, Long verLabelId, Long areaLabelId,
Boolean recoverScene, Long thirdTempletId, String ipAddress, Long userId) {
Boolean recoverScene, Long thirdTempletId, String ipAddress, Long userId, String token) {
LOGGER.info("恢复书籍-编辑 <START>.[bookId]=" + bookId + ",adviserId=" + adviserId + ",channelId=" + channelId + " templetId= " + templetId + "secondTempletId=" + secondTempletId);
checkIsHaveOtherAdviser(bookId, channelId, adviserId);
// 恢复书籍编辑的状态
......@@ -913,7 +910,7 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
String adviserName = adviserConsr.getNameById(adviserId);
Long agentId = adviserConsr.getAgentIdByAdviser(adviserId);
String content = String.format("【编辑】『%s』恢复书刊%s", adviserName, StringUtil.addBracket(book.getBookName()));
operationConsr.send(agentId, userId,content, ipAddress);
operationConsr.send(agentId, userId,content, ipAddress,token);
});
}
......
......@@ -387,7 +387,7 @@ public class BookBizImpl implements BookBiz {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public BookDto create(Book book, String systemCode) throws BizException {
public BookDto create(Book book, String systemCode, String token) throws BizException {
LOGGER.info("【书籍基础】创建书籍基础信息,<START>.[book]:{};systemCode:{}", book, systemCode);
this.checkAddParam(book);
// 判断书籍ISBN码是否存在,同时判断书籍ISBN码是否符合规范
......@@ -409,7 +409,7 @@ public class BookBizImpl implements BookBiz {
bookDto.setThirdTempletId(book.getThirdTempletId());
// 如果是编辑创建的书籍、默认建立编辑与书籍的推广关系
if (SystemCode.adviser.code.equalsIgnoreCase(systemCode)) {
setBookAdviserRelation(book);
setBookAdviserRelation(book, token);
}
// 书籍总数缓存加1
bookCache.incrObject(BookConstant.BOOK_CACHE + "PLATFORM_BOOK_COUNT");
......@@ -552,11 +552,11 @@ public class BookBizImpl implements BookBiz {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public BookDto updateByAdviser(Book book) throws BizException {
public BookDto updateByAdviser(Book book, String token) throws BizException {
LOGGER.info("【书籍基础】修改书籍基础信息,<PARAM>.[book]=" + book);
checkParam(book);
// 设置编辑书刊关联关系
setBookAdviserRelation(book);
setBookAdviserRelation(book, token);
if (BookConstant.DEFAULT_BOOK_ISBN.equals(book.getIsbn()) && StringUtils.isEmpty(book.getSerialNumber())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "默认图书不能修改!");
}
......@@ -1266,7 +1266,7 @@ public class BookBizImpl implements BookBiz {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void setBookAdviserRelation(Book book) throws BizException {
public void setBookAdviserRelation(Book book, String token) throws BizException {
BookAdviser bookAdviser = new BookAdviser();
bookAdviser.setBookId(book.getBookId());
bookAdviser.setAdviserId(book.getCreatedUser());
......@@ -1276,7 +1276,7 @@ public class BookBizImpl implements BookBiz {
bookAdviser.setTempletId(book.getTempletId());
bookAdviser.setSecondTempletId(book.getSecondTempletId());
bookAdviser.setThirdTempletId(book.getThirdTempletId());
bookAdviserBiz.create(bookAdviser);
bookAdviserBiz.create(bookAdviser, token);
}
/**
......@@ -1793,7 +1793,7 @@ public class BookBizImpl implements BookBiz {
@Override
@Transactional(rollbackFor = Exception.class)
public BookDto create4Adviser(Book book) {
public BookDto create4Adviser(Book book, String token) {
LOGGER.info("编辑新增图书book=" + book);
this.checkAddParam(book);
if (book.getChannelId() == null) {
......@@ -1825,7 +1825,7 @@ public class BookBizImpl implements BookBiz {
// 查看现代纸书是否存在
final BookGroupDTO dtoByBookId = bookGroupBiz.getDTOByBookId(book.getBookId(), book.getChannelId(), book.getCreatedUser());
// 新增图书与编辑关联关系
createBookAdviserRelation(book);
createBookAdviserRelation(book,token);
/*BookGroup bookGroup = null;
if (null != book.getIsBookGroup() && book.getIsBookGroup()) {
bookGroup = bookGroupBiz.createBookGroupAfterCreateBook(book.getBookId(), book.getChannelId(), book.getCreatedUser());
......@@ -1955,8 +1955,9 @@ public class BookBizImpl implements BookBiz {
/**
* 新增图书与编辑关联关系
* @param book
* @param token
*/
void createBookAdviserRelation(Book book) {
void createBookAdviserRelation(Book book, String token) {
BookAdviser bookAdviser = new BookAdviser();
bookAdviser.setBookId(book.getBookId());
bookAdviser.setAdviserId(book.getCreatedUser());
......@@ -1979,7 +1980,7 @@ public class BookBizImpl implements BookBiz {
}else{
bookAdviser.setIsOpenRobotProcess(0);
}
bookAdviserBiz.create(bookAdviser);
bookAdviserBiz.create(bookAdviser, token);
book.setBookAdviserId(bookAdviser.getBookAdviserId());
}
......@@ -3019,7 +3020,7 @@ public class BookBizImpl implements BookBiz {
book.setCreatedUser(relateAdviserVO.getRaysAdviserId().longValue());
book.setChannelId(relateAdviserVO.getRaysChannelId().longValue());
book.setIsBookGroup(bookAdviserErp.getIsOpenRobotProcess() == 1);
createBookAdviserRelation(book);
createBookAdviserRelation(book, null);
if(null != bookAdviserErp.getIsOpenRobotProcess() && bookAdviserErp.getIsOpenRobotProcess() == 1){
// 小睿书
......@@ -3185,7 +3186,7 @@ public class BookBizImpl implements BookBiz {
&& NumberUtil.isNumber(book.getCreatedUser()) && book.getCreatedUser() > 0){
dtoByBookId = bookGroupBiz.getDTOByBookId(book.getBookId(), book.getChannelId(), book.getCreatedUser());
// 新增图书与编辑关联关系
createBookAdviserRelation(book);
createBookAdviserRelation(book, null);
} else {
// 如果没有编辑id,暂时将数据存放到临时表,后续关联编辑时再建立关系
createBookAdviserErpRelation(book);
......@@ -4079,7 +4080,7 @@ public class BookBizImpl implements BookBiz {
@Override
@Transactional(rollbackFor = Exception.class)
public BookDto createBook4Erp(Book book) {
BookDto bookDto = this.create4Adviser(book);
BookDto bookDto = this.create4Adviser(book, null);
if (book.getIsBookGroup() != null && book.getIsBookGroup()) {
// 自动创建二维码
// 小睿二维码
......
......@@ -83,7 +83,7 @@ public class BookAdviserFacadeImpl implements BookAdviserFacade {
@RequestBody BookAdviser bookAdviser) throws BizException, PermissionException, JsonParseException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
bookAdviser.setAdviserId(adviserId);
bookAdviserBiz.create(bookAdviser);
bookAdviserBiz.create(bookAdviser,token);
BookAdviserDto bookAdviserDto = new BookAdviserDto();
bookAdviserDto.setBookAdviserId(bookAdviser.getBookAdviserId());
......@@ -173,7 +173,7 @@ public class BookAdviserFacadeImpl implements BookAdviserFacade {
throws BizException, PermissionException, JsonParseException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
Long userId = (Long) SessionUtil.getVlaue(token,SessionUtil.USER_ID);
bookAdviserBiz.deleteBook4Adviser(bookId, adviserId, channelId, NginxUtils.getClientIp(request), userId);
bookAdviserBiz.deleteBook4Adviser(bookId, adviserId, channelId, NginxUtils.getClientIp(request), userId,token);
return new ResponseDto<>();
}
......@@ -189,7 +189,7 @@ public class BookAdviserFacadeImpl implements BookAdviserFacade {
throws BizException, PermissionException, JsonParseException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
Long userId = (Long) SessionUtil.getVlaue(token,SessionUtil.USER_ID);
bookAdviserBiz.recoverBook4Adviser(bookId, adviserId, channelId, null,null, null, null, null, null, true, null, NginxUtils.getClientIp(request), userId);
bookAdviserBiz.recoverBook4Adviser(bookId, adviserId, channelId, null,null, null, null, null, null, true, null, NginxUtils.getClientIp(request), userId,token);
return new ResponseDto<>();
}
......
......@@ -77,7 +77,7 @@ public class BookFacadeImpl implements BookFacade {
// 实体赋值
book.setCreatedUser(adviserId);
book.setAgentId(agentId);
BookDto bookDto = bookBiz.create(book, systemCode);
BookDto bookDto = bookBiz.create(book, systemCode,token);
return new ResponseDto<>(bookDto);
}
......@@ -122,7 +122,7 @@ public class BookFacadeImpl implements BookFacade {
book.setLastModifiedUser(adviserId);
book.setCreatedUser(adviserId);
book.setAgentId(agentId);
BookDto bookDto = bookBiz.updateByAdviser(book);
BookDto bookDto = bookBiz.updateByAdviser(book,token);
return new ResponseDto<>(bookDto);
}
......@@ -383,7 +383,7 @@ public class BookFacadeImpl implements BookFacade {
throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
book.setCreatedUser(adviserId);
bookBiz.setBookAdviserRelation(book);
bookBiz.setBookAdviserRelation(book,token);
return new ResponseDto<>();
}
......@@ -456,7 +456,7 @@ public class BookFacadeImpl implements BookFacade {
@RequestBody Book book ) throws BizException {
Long adviserId = Cookie.getId(userInfo, Cookie._PARTY_ID);
book.setCreatedUser(adviserId);
bookBiz.setBookAdviserRelation(book);
bookBiz.setBookAdviserRelation(book, null);
return new ResponseDto<>();
}
......@@ -471,7 +471,7 @@ public class BookFacadeImpl implements BookFacade {
String systemCode = (String) Cookie.getUserInfo(userInfo).get(Cookie._SYSTEM_CODE);
// 实体赋值
book.setCreatedUser(adviserId);
bookBiz.create(book, systemCode);
bookBiz.create(book, systemCode, null);
BookDto bookDto = new BookDto();
bookDto.setBookId(book.getBookId());
return new ResponseDto<>(bookDto);
......@@ -488,7 +488,7 @@ public class BookFacadeImpl implements BookFacade {
// 实体赋值
book.setLastModifiedUser(adviserId);
book.setCreatedUser(adviserId);
bookBiz.updateByAdviser(book);
bookBiz.updateByAdviser(book, null);
return new ResponseDto<>();
}
......@@ -864,7 +864,7 @@ public class BookFacadeImpl implements BookFacade {
book.setCreatedUser(adviserId);
book.setAgentId(agentId);
book.setIpAddress(NginxUtils.getClientIp(request));
BookDto bookDto = bookBiz.create4Adviser(book);
BookDto bookDto = bookBiz.create4Adviser(book,token);
return new ResponseDto<>(bookDto);
}
......
......@@ -34,7 +34,7 @@ public class OperationConsr {
/**
* 发送操作日志记录topic消息
*/
public void send(Long agentId, Long editorId, String content, String ip) throws BizException {
public void send(Long agentId, Long editorId, String content, String ip,String token) throws BizException {
LOGGER.info("【操作日志(消)】发送操作日志记录topic消息,<START>.[agentId]=" + agentId + ",[editorId]=" + editorId + ",[content]="
+ content + ",[ip]=" + ip);
if (StringUtil.isEmpty(content) || null == editorId) {
......@@ -47,6 +47,7 @@ public class OperationConsr {
operationLogDto.setContent(content);
operationLogDto.setTime(DateUtils.nowTimeStamp());
operationLogDto.setIp(ip);
operationLogDto.setToken(token);
// 开发发送消息
try {
operationLogQueueBiz.send(operationLogDto);
......
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