Commit f97ba27a by lili

合并代码(公众号二维码,版权保护)

parent 61e38a20
......@@ -136,6 +136,26 @@ public class BookAppealDto extends BaseEntity{
*/
private Boolean isBookGroup;
private Integer addType;
private Long secondTempletId;
public Long getSecondTempletId() {
return secondTempletId;
}
public void setSecondTempletId(Long secondTempletId) {
this.secondTempletId = secondTempletId;
}
public Integer getAddType() {
return addType;
}
public void setAddType(Integer addType) {
this.addType = addType;
}
public Long getBookAppealId() {
return bookAppealId;
}
......@@ -346,7 +366,9 @@ public class BookAppealDto extends BaseEntity{
", templetId=" + templetId +
", haveDiffChannel=" + haveDiffChannel +
", channelName='" + channelName + '\'' +
", isBookGroup=" + isBookGroup +
", isBookGroup=" + isBookGroup +
", addType=" + addType +
", secondTempletId=" + secondTempletId +
'}';
}
}
......@@ -40,7 +40,12 @@ public class BookAppeal extends BaseEntity{
* 图书类型标识
*/
private Long templetId;
/**
* 二级分类标识
*/
private Long secondTempletId;
/**
* 申诉理由
*/
......@@ -105,6 +110,11 @@ public class BookAppeal extends BaseEntity{
* 是否社群书
*/
private Boolean isBookGroup;
/**
* 新增类型
*/
private Integer addType;
public Long getBookAppealId() {
return bookAppealId;
......@@ -243,14 +253,44 @@ public class BookAppeal extends BaseEntity{
this.isBookGroup = isBookGroup;
}
@Override
public String toString() {
return "BookAppeal [bookAppealId=" + bookAppealId + ", bookId=" + bookId + ", channelId=" + channelId
+ ", templetId=" + templetId + ", reason=" + reason + ", declarant=" + declarant + ", phone=" + phone
+ ", appealSubmitDate=" + appealSubmitDate + ", appealState=" + appealState + ", auditReason="
+ auditReason + ", auditUser=" + auditUser + ", createdUser=" + createdUser + ", createdDate="
+ createdDate + ", lastModifiedUser=" + lastModifiedUser + ", lastModifiedDate=" + lastModifiedDate
+ ", defendant=" + defendant + ", isBookGroup=" + isBookGroup + "]";
public Integer getAddType() {
return addType;
}
public void setAddType(Integer addType) {
this.addType = addType;
}
public Long getSecondTempletId() {
return secondTempletId;
}
public void setSecondTempletId(Long secondTempletId) {
this.secondTempletId = secondTempletId;
}
@Override
public String toString() {
return "BookAppeal{" +
"bookAppealId=" + bookAppealId +
", bookId=" + bookId +
", channelId=" + channelId +
", templetId=" + templetId +
", secondTempletId=" + secondTempletId +
", reason='" + reason + '\'' +
", declarant=" + declarant +
", phone='" + phone + '\'' +
", appealSubmitDate=" + appealSubmitDate +
", appealState=" + appealState +
", auditReason='" + auditReason + '\'' +
", auditUser=" + auditUser +
", createdUser=" + createdUser +
", createdDate=" + createdDate +
", lastModifiedUser=" + lastModifiedUser +
", lastModifiedDate=" + lastModifiedDate +
", defendant=" + defendant +
", isBookGroup=" + isBookGroup +
", addType=" + addType +
'}';
}
}
......@@ -118,6 +118,16 @@ public class BookGroupDTO implements Serializable {
*/
private BookDto bookInfo;
private String url;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Long getId() {
return id;
}
......
......@@ -23,6 +23,11 @@ public class GroupQrcodeBaseDTO implements Serializable {
*/
private String bookName;
/**
* 分类
*/
private String classify;
public String getBookName() {
return bookName;
}
......@@ -47,11 +52,21 @@ public class GroupQrcodeBaseDTO implements Serializable {
this.groupName = groupName;
}
public String getClassify() {
return classify;
}
public void setClassify(String classify) {
this.classify = classify;
}
@Override
public String toString() {
return "GroupQrcodeBaseDTO{" +
"weixinGroupId='" + weixinGroupId + '\'' +
", groupName='" + groupName + '\'' +
", bookName='" + bookName + '\'' +
", classify='" + classify + '\'' +
'}';
}
}
package com.pcloud.book.group.service;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -22,4 +24,9 @@ public interface BookGroupService {
@ApiOperation("获取社群书基本信息")
@RequestMapping(value = "getBookGroupInfo",method = RequestMethod.GET)
ResponseEntity<ResponseDto<BookGroupDTO>> getBookGroupInfo(@RequestParam("bookGroupId")Long bookGroupId) throws BizException;
@ApiOperation("获取社群书基本信息")
@RequestMapping(value = "getBaseInfoBySceneId",method = RequestMethod.GET)
ResponseEntity<ResponseDto<BookGroupDTO>> getBaseInfoBySceneId(@RequestParam("sceneId")Long sceneId) throws BizException;
}
......@@ -178,7 +178,7 @@ public class BookAppealBizImpl implements BookAppealBiz {
List<BookAdviserDto> adviserBooks = bookAdviserDao.getAdvisers(bookAppealDto.getBookId());
//审核通过
if (AppealStateEnum.APPEAL_STATE_PASS.value.equals(bookAppeal.getAppealState())) {
setOnlyOneAdviser(bookAppealDto.getBookId(), bookAppealDto.getDeclarant(), bookAppealDto.getChannelId(), bookAppealDto.getTempletId(), adviserBooks);
setOnlyOneAdviser(bookAppealDto.getBookId(), bookAppealDto.getDeclarant(), bookAppealDto.getChannelId(), bookAppealDto.getTempletId(), bookAppealDto.getSecondTempletId(), adviserBooks);
}
// 设置被诉方
List<BookDefendant> defendants = bookSet.setDefendant(adviserBooks, bookAppeal.getBookAppealId());
......@@ -295,7 +295,7 @@ public class BookAppealBizImpl implements BookAppealBiz {
Long mainAdviserId = null;
Boolean isOnlyOneAdviser = bookMainAdviserDto.getBookAdviserList().size() == 1;
if (isOnlyOneAdviser) {//唯一拥有
setOnlyOneAdviser(bookId, appealAdviserId, bookAppealDto.getChannelId(), bookAppealDto.getTempletId(), adviserBooks);
setOnlyOneAdviser(bookId, appealAdviserId, bookAppealDto.getChannelId(), bookAppealDto.getTempletId(), bookAppealDto.getSecondTempletId(), adviserBooks);
mainAdviserId = bookMainAdviserDto.getBookAdviserList().get(0).getAdviserId();
} else {
for (BookAdviser bookAdviser : bookMainAdviserDto.getBookAdviserList()) {
......@@ -310,6 +310,7 @@ public class BookAppealBizImpl implements BookAppealBiz {
// 若为申诉编辑,设置申诉编辑图书类型
if (bookAdviser.getAdviserId().equals(appealAdviserId) && channelId.equals(bookAdviser.getChannelId())) {
bookAdviser.setTempletId(bookAppealDto.getTempletId());
bookAdviser.setSecondTempletId(bookAppealDto.getSecondTempletId());
}
}
// 批量修改图书编辑关联关系
......@@ -321,7 +322,8 @@ public class BookAppealBizImpl implements BookAppealBiz {
}
// 社群书申诉创建社群码
if (null != bookAppealDto && bookAppealDto.getIsBookGroup()) {
bookGroupBiz.getBookGroupInfoByBookId(bookId, channelId, appealAdviserId);
bookGroupBiz.recoverByBookId(bookId, channelId, appealAdviserId);
bookGroupBiz.getBookGroupInfoByBookId(bookId, channelId, appealAdviserId, bookAppealDto.getAddType(), null);
}
// 修改申诉状态
this.updateAppealState(auditUser, bookMainAdviserDto.getAppealState(), bookMainAdviserDto.getVersion(),
......@@ -344,7 +346,7 @@ public class BookAppealBizImpl implements BookAppealBiz {
* @param channelId 运营标识
* @param templetId 模板标识
*/
public void setOnlyOneAdviser(Long bookId, Long declarant, Long channelId, Long templetId, List<BookAdviserDto> adviserBooks) {
public void setOnlyOneAdviser(Long bookId, Long declarant, Long channelId, Long templetId, Long secondTempletId, List<BookAdviserDto> adviserBooks) {
//删除其余编辑与图书关联关系
bookAdviserBiz.deleteByBook(bookId);
EXECUTOR_SERVICE.execute(() -> {
......@@ -366,6 +368,7 @@ public class BookAppealBizImpl implements BookAppealBiz {
bookAdviser.setBookId(bookId);
bookAdviser.setTempletId(templetId);
bookAdviser.setIsMainEditor(true);
bookAdviser.setSecondTempletId(secondTempletId);
bookAdviserDao.insert(bookAdviser);
// 恢复申诉编辑图书与二维码关联关系
recoverBookQrcodeAssoc(bookId, channelId, declarant);
......
......@@ -4,6 +4,7 @@
package com.pcloud.book.consumer.channel;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.channelcenter.qrcode.dto.GroupQrcodeVO;
import com.pcloud.channelcenter.qrcode.dto.QrcodeSceneDto;
import com.pcloud.channelcenter.qrcode.service.QrcodeSceneService;
import com.pcloud.channelcenter.qrcode.vo.BookAssocLastQrAskVO;
......@@ -288,4 +289,27 @@ public class QrcodeSceneConsr {
return null;
}
@ParamLog(description = "将二维码替换为微信群二维码")
public GroupQrcodeVO setQrcodeToGroup(Long sceneId) throws BizException {
if (sceneId == null) return null;
try {
return ResponseHandleUtil.parseResponse(qrcodeSceneService.setQrcodeToGroup(sceneId), GroupQrcodeVO.class);
} catch (BizException e) {
LOGGER.error("【渠道(消)】 将二维码替换为微信群二维码,<ERROR>.[setQrcodeToGroup]:" + e.getMessage(), e);
}
return null;
}
@ParamLog(description = "公众号二维码生成微信群二维码")
public GroupQrcodeVO createWxGroupQrcode(Long bookId, Long channelId, Long adviserId) throws BizException {
if (bookId == null ||channelId == null || adviserId == null) return null;
try {
return ResponseHandleUtil.parseResponse(qrcodeSceneService.createWxGroupQrcode(channelId, adviserId, bookId), GroupQrcodeVO.class);
} catch (BizException e) {
LOGGER.error("【渠道(消)】 公众号二维码生成微信群二维码,<ERROR>.[createWxGroupQrcode]:" + e.getMessage(), e);
}
return null;
}
}
......@@ -3,6 +3,10 @@ package com.pcloud.book.copyright.biz;
import com.pcloud.book.copyright.entity.BookAuthCode;
import com.pcloud.book.copyright.vo.CheckCodeParam;
import com.pcloud.book.copyright.vo.CheckIsAuthServeParam;
import com.pcloud.book.copyright.vo.FileVO;
import com.pcloud.book.copyright.vo.ImportRecordVO;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;
import java.util.List;
......@@ -33,4 +37,18 @@ public interface BookAuthCodeBiz {
* @return
*/
Boolean checkServe(CheckIsAuthServeParam checkIsAuthServeParam, Long channelId, Long wechatUserId);
/**
* @Author:lili
* @Desr:授权码导入
* @Date:2019/5/20 15:12
*/
void importCode(FileVO fileVO, Long adviserId) throws BizException;
/**
* @Author:lili
* @Desr:获取导入记录
* @Date:2019/5/22 18:02
*/
PageBeanNew<ImportRecordVO> importCodeRecord(Long bookId, Long channelId, Long adviserId, Integer currentPage, Integer numPerPage);
}
package com.pcloud.book.copyright.biz.impl;
import com.alibaba.fastjson.JSONObject;
import com.pcloud.book.base.enums.BookStatusEnum;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.biz.BookBiz;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.reader.ReaderConsr;
import com.pcloud.book.copyright.biz.BookAuthCodeBiz;
import com.pcloud.book.copyright.biz.BookAuthInfoBiz;
import com.pcloud.book.copyright.biz.BookAuthServeBiz;
import com.pcloud.book.copyright.biz.BookAuthUserBiz;
import com.pcloud.book.copyright.constants.ImportAuthCodeStatus;
import com.pcloud.book.copyright.dao.BookAuthCodeDao;
import com.pcloud.book.copyright.dao.BookAuthCodeImportRecordDao;
import com.pcloud.book.copyright.entity.BookAuthCode;
import com.pcloud.book.copyright.entity.BookAuthCodeImportRecord;
import com.pcloud.book.copyright.entity.BookAuthUser;
import com.pcloud.book.copyright.tools.ExcelUtil;
import com.pcloud.book.copyright.vo.BookAuthInfoVO;
import com.pcloud.book.copyright.vo.CheckCodeParam;
import com.pcloud.book.copyright.vo.CheckIsAuthServeParam;
import com.pcloud.book.copyright.vo.FileVO;
import com.pcloud.book.copyright.vo.ImportRecordVO;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.biz.MessageBiz;
import com.pcloud.common.core.constant.SystemCode;
import com.pcloud.common.core.dto.SendNotifyDto;
import com.pcloud.common.core.enums.NotifyOriginTypeEnum;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.readercenter.wechat.entity.WechatUser;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* @author lily
......@@ -32,7 +55,8 @@ import java.util.Map;
*/
@Component("bookAuthCodeBiz")
public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
private static final Logger LOGGER = LoggerFactory.getLogger(BookAuthInfoBizImpl.class);
private static final ExecutorService EXECUTOR_SERVICE = Executors.newFixedThreadPool(2);
@Autowired
private BookAuthCodeDao bookAuthCodeDao;
......@@ -48,8 +72,15 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
private QrcodeSceneConsr qrcodeSceneConsr;
@Autowired
private ReaderConsr readerConsr;
@Autowired
private BookAuthCodeImportRecordDao bookAuthCodeImportRecordDao;
@Autowired
private BookBiz bookBiz;
@Autowired
private MessageBiz messageBiz;
@Override
@ParamLog(value = "批量插入授权码",isBefore = false)
@ParamLog(value = "批量插入授权码", isBefore = false)
public void insert(List<BookAuthCode> bookAuthCodes) {
int insertLength = bookAuthCodes.size();
int i = 0;
......@@ -105,12 +136,12 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
public Boolean checkServe(CheckIsAuthServeParam checkIsAuthServeParam, Long channelId, Long wechatUserId) {
Long serveId = checkIsAuthServeParam.getServeId();
String serveType = checkIsAuthServeParam.getServeType();
if(serveId == null || serveType == null){
if (serveId == null || serveType == null) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "请选择要进入的服务");
}
//校验图书是否开启保护
BookAuthInfoVO authBookInfo = bookAuthInfoBiz.getAuthBookInfo(checkIsAuthServeParam.getBookId(), channelId, checkIsAuthServeParam.getAdviserId(), checkIsAuthServeParam.getSceneId());
if(authBookInfo == null || BookStatusEnum.NO_SET.value.equals(authBookInfo.getBookStatus())){
if (authBookInfo == null || BookStatusEnum.NO_SET.value.equals(authBookInfo.getBookStatus())) {
return false;
}
Long bookId = authBookInfo.getBookId();
......@@ -118,22 +149,102 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
List<Long> serveIds = new ArrayList<>();
serveIds.add(serveId);
Map<String, Boolean> isHaveServe = qrcodeSceneConsr.listIsInBook(bookId, channelId, adviserId, serveIds);
if(isHaveServe == null) return false;
if (isHaveServe == null) return false;
//校验服务是否需要授权
Boolean isNeedAuth = bookAuthServeBiz.checkIsNeedAuth(bookId, channelId, adviserId, serveId, serveType);
if(!isNeedAuth){
if (!isNeedAuth) {
return false;
}
//校验用户是否已经授权过
Boolean isHaveAuth = bookAuthUserBiz.checkIsHaveAuth(bookId, channelId, adviserId, wechatUserId);
if(isHaveAuth){
if (isHaveAuth) {
return false;
}else{
} else {
return true;
}
}
@Override
@ParamLog("导入授权码")
public void importCode(FileVO fileVO, Long adviserId) throws BizException {
//新增导入记录
BookAuthCodeImportRecord bookAuthCodeImportRecord = new BookAuthCodeImportRecord();
bookAuthCodeImportRecord.setBookId(fileVO.getBookId());
bookAuthCodeImportRecord.setAdviserId(adviserId);
bookAuthCodeImportRecord.setChannelId(fileVO.getChannelId());
bookAuthCodeImportRecord.setCreateUser(adviserId);
bookAuthCodeImportRecord.setFileName(fileVO.getFileName());
bookAuthCodeImportRecord.setFileUrl(fileVO.getFileUrl());
bookAuthCodeImportRecordDao.insert(bookAuthCodeImportRecord);
EXECUTOR_SERVICE.execute(() -> {
Integer isFinish = 1;
try {
String[][] data = ExcelUtil.getData(fileVO.getFileUrl(), 3);
if (data != null) {
List<BookAuthCode> bookAuthCodes = new ArrayList<>();
for (int i = 0, size = data.length; i < size; i++) {
BookAuthCode bookAuthCode = new BookAuthCode();
bookAuthCode.setBookId(fileVO.getBookId());
bookAuthCode.setChannelId(fileVO.getChannelId());
bookAuthCode.setAdviserId(adviserId);
String fullCode = data[i][1];
bookAuthCode.setFullCode(fullCode);
if (fullCode == null || fullCode.length() < 15) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "授权码错误");
}
bookAuthCode.setBatchNum(fullCode.substring(0, 4));
bookAuthCode.setAuthCode(fullCode.substring(4, data[i][1].length()));
bookAuthCode.setUseCount(0);
bookAuthCode.setCreatedUser(adviserId);
bookAuthCodes.add(bookAuthCode);
}
insert(bookAuthCodes);
}else{
isFinish = ImportAuthCodeStatus.FAIL.value;
}
} catch (Exception e) {
isFinish = ImportAuthCodeStatus.FAIL.value;
LOGGER.error("导入失败" + e.getMessage(), e);
}finally {
bookAuthCodeImportRecordDao.updateState(bookAuthCodeImportRecord.getId(), isFinish);
//发送站内信
sendImportRecord(isFinish, fileVO.getBookId(),fileVO.getChannelId(), adviserId);
}
});
}
private void sendImportRecord(Integer isFinish, Long bookId, Long channelId, Long adviserId) {
BookDto bookDto = bookBiz.getBaseById(bookId);
SendNotifyDto sendNotifyDto = new SendNotifyDto();
sendNotifyDto.setCreatedTime(new Date());
JSONObject content = new JSONObject();
if (isFinish == ImportAuthCodeStatus.SUCCESS.value) {
content.put("result", "成功");
} else {
content.put("result", "失败");
}
content.put("bookName", "[" + bookDto.getBookName() + "]");
sendNotifyDto.setNotifyContent(content.toJSONString());
sendNotifyDto.setToId(adviserId);
sendNotifyDto.setFromId(adviserId);
sendNotifyDto.setResourceId(bookId + "-" + channelId);
sendNotifyDto.setOriginType(NotifyOriginTypeEnum.GENUINE.value);
sendNotifyDto.setSystemCode(SystemCode.adviser.code);
sendNotifyDto.setTypeCode("genuine_qrcord_import_result");
messageBiz.sendLetter(sendNotifyDto);
}
@Override
@ParamLog("导入记录")
public PageBeanNew<ImportRecordVO> importCodeRecord(Long bookId, Long channelId, Long adviserId, Integer currentPage, Integer numPerPage) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId", adviserId);
PageParam pageParam = new PageParam(currentPage, numPerPage);
return bookAuthCodeImportRecordDao.listPageNew(pageParam, paramMap, "importCodeRecord");
}
@ParamLog("新增一条授权成功记录")
private void addUserRecord(Long bookId, Long channelId, Long adviserId, Long wechatUserId) {
BookAuthUser bookAuthUser = new BookAuthUser();
......
......@@ -76,9 +76,6 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
private BookAuthServeBiz bookAuthServeBiz;
@Autowired
private AssistTempletConsr assistTempletConsr;
@Autowired
private BookAuthCodeBiz bookAuthCodeBiz;
@Autowired
......
package com.pcloud.book.copyright.biz.impl;
import com.pcloud.book.base.enums.BookStatusEnum;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.biz.BookBiz;
import com.pcloud.book.book.dto.BookInfoAndAuthStatusDTO;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
......@@ -9,10 +10,10 @@ import com.pcloud.book.copyright.dao.BookAuthServeDao;
import com.pcloud.book.copyright.dto.ServeDTO;
import com.pcloud.book.copyright.entity.BookAuthServe;
import com.pcloud.book.copyright.vo.ServeVO;
import com.pcloud.channelcenter.base.exceptions.ChannelBizException;
import com.pcloud.channelcenter.qrcode.dto.QrcodeSceneDto;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.utils.ListUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -38,14 +39,14 @@ public class BookAuthServeBizImpl implements BookAuthServeBiz {
@Override
@ParamLog("设置图书授权服务")
public void setBookAuthServes(List<ServeVO> serves, Long bookId, Long channelId, Long adviserId) {
if (bookId == null || channelId == null || adviserId == null) {
throw new ChannelBizException(ChannelBizException._ERROR, "图书不存在");
}
deleteServesByBook(bookId, channelId, adviserId);
if (!ListUtils.isEmpty(serves)) {
List<BookAuthServe> bookAuthServes = changeToBookAuthServe(serves, bookId, channelId, adviserId);
bookAuthServeDao.insert(bookAuthServes);
}
if(bookId == null || channelId == null || adviserId == null) {
throw new BookBizException(BookBizException.ERROR, "图书不存在");
}
deleteServesByBook(bookId, channelId, adviserId);
if(!ListUtils.isEmpty(serves)){
List<BookAuthServe> bookAuthServes = changeToBookAuthServe(serves, bookId, channelId, adviserId);
bookAuthServeDao.insert(bookAuthServes);
}
}
/**
......@@ -110,7 +111,7 @@ public class BookAuthServeBizImpl implements BookAuthServeBiz {
private List<BookAuthServe> changeToBookAuthServe(List<ServeVO> serves, Long bookId, Long channelId, Long adviserId) {
List<BookAuthServe> bookAuthServes = new ArrayList<>();
for (ServeVO serveVO : serves) {
for (ServeVO serveVO : serves){
BookAuthServe bookAuthServe = new BookAuthServe();
bookAuthServe.setBookId(bookId);
bookAuthServe.setChannelId(channelId);
......@@ -122,12 +123,12 @@ public class BookAuthServeBizImpl implements BookAuthServeBiz {
}
@ParamLog("删除图书授权服务")
private void deleteServesByBook(Long bookId, Long channelId, Long adviserId) {
private void deleteServesByBook(Long bookId, Long channelId, Long adviserId){
if (bookId == null || channelId == null || adviserId == null) {
throw new ChannelBizException(ChannelBizException._ERROR, "图书不存在");
throw new BookBizException(BookBizException.ERROR, "图书不存在");
}
List<Long> ids = bookAuthServeDao.selectNeedDelete(bookId, channelId, adviserId);
if (ListUtils.isEmpty(ids)) return;
if(ListUtils.isEmpty(ids)) return;
bookAuthServeDao.deleteServes(ids);
}
......
package com.pcloud.book.copyright.constants;
/**
* @author lily
* @date 2019/5/23 14:11
*/
public enum ImportAuthCodeStatus {
SUCCESS(1),
FAIL(2),
ON(0);
public final Integer value;
ImportAuthCodeStatus(Integer value) {
this.value = value;
}
public Integer getValue() {
return value;
}
}
package com.pcloud.book.copyright.dao;
import com.pcloud.book.copyright.entity.BookAuthCodeImportRecord;
import com.pcloud.common.core.dao.BaseDao;
/**
* @author lily
* @date 2019/5/21 20:14
*/
public interface BookAuthCodeImportRecordDao extends BaseDao<BookAuthCodeImportRecord> {
/**
* @Author:lili
* @Desr:设置导入状态
* @Date:2019/5/22 19:58
*/
void updateState(Long id, int state);
}
package com.pcloud.book.copyright.dao.impl;
import com.pcloud.book.copyright.dao.BookAuthCodeImportRecordDao;
import com.pcloud.book.copyright.entity.BookAuthCodeImportRecord;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* @author lily
* @date 2019/5/21 20:15
*/
@Component("bookAuthCodeImportRecordDao")
public class BookAuthCodeImportRecordDaoImpl extends BaseDaoImpl<BookAuthCodeImportRecord> implements BookAuthCodeImportRecordDao {
@Override
public void updateState(Long id, int state) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("id", id);
paramMap.put("state", state);
this.getSqlSession().update(this.getStatement("updateState"), paramMap);
}
}
package com.pcloud.book.copyright.entity;
import com.pcloud.common.entity.BaseEntity;
import org.springframework.stereotype.Component;
/**
* @author lily
* @date 2019/5/21 17:39
*/
public class BookAuthCodeImportRecord extends BaseEntity {
private Long id;
private Long bookId;
private Long channelId;
private Long adviserId;
private String fileName;
private String fileUrl;
private Long createUser;
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public Long getAdviserId() {
return adviserId;
}
public void setAdviserId(Long adviserId) {
this.adviserId = adviserId;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFileUrl() {
return fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
@Override
public Long getId() {
return id;
}
@Override
public void setId(Long id) {
this.id = id;
}
@Override
public String toString() {
return "BookAuthCodeImportRecord{" +
"id=" + id +
", bookId=" + bookId +
", channelId=" + channelId +
", adviserId=" + adviserId +
", fileName='" + fileName + '\'' +
", fileUrl='" + fileUrl + '\'' +
", createUser=" + createUser +
'}';
}
}
......@@ -3,15 +3,20 @@ package com.pcloud.book.copyright.facade;
import com.pcloud.book.copyright.vo.CheckCodeParam;
import com.pcloud.book.copyright.vo.CheckIsAuthServeParam;
import com.pcloud.book.copyright.vo.CodeUseStatusVO;
import com.pcloud.book.copyright.vo.FileVO;
import com.pcloud.book.copyright.vo.ImportRecordVO;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.permission.PermissionException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @author lily
......@@ -29,4 +34,14 @@ public interface BookAuthCodeFacade {
@RequestMapping(value = "checkServe", method = RequestMethod.POST)
ResponseDto<Boolean> checkServe(@CookieValue("userInfo") String userInfo, @RequestBody CheckIsAuthServeParam checkIsAuthServeParam)
throws PermissionException, BizException;
@ApiOperation(value = "校验服务是否需要验证", httpMethod = "POST")
@RequestMapping(value = "importCode", method = RequestMethod.POST)
ResponseDto<?> importCode(@RequestHeader("token") String token, @RequestBody FileVO fileVO)
throws PermissionException, BizException;
@ApiOperation(value = "授权码导入记录", httpMethod = "GET")
@RequestMapping(value = "importCodeRecord", method = RequestMethod.GET)
ResponseDto<PageBeanNew<ImportRecordVO>> importCodeRecord(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId, @RequestParam("currentPage") Integer currenPage, @RequestParam("numPerPage") Integer numPerPage)
throws PermissionException, BizException;
}
......@@ -5,16 +5,23 @@ import com.pcloud.book.copyright.facade.BookAuthCodeFacade;
import com.pcloud.book.copyright.vo.CheckCodeParam;
import com.pcloud.book.copyright.vo.CheckIsAuthServeParam;
import com.pcloud.book.copyright.vo.CodeUseStatusVO;
import com.pcloud.book.copyright.vo.FileVO;
import com.pcloud.book.copyright.vo.ImportRecordVO;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
......@@ -53,4 +60,20 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade {
Boolean code = bookAuthCodeBiz.checkServe(checkIsAuthServeParam, channelId, wechatUserId);
return new ResponseDto<>(code == null ? false : code);
}
@Override
@PostMapping("importCode")
public ResponseDto<?> importCode(@RequestHeader("token") String token, @RequestBody FileVO fileVO) throws PermissionException, BizException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
bookAuthCodeBiz.importCode(fileVO, adviserId);
return new ResponseDto<>();
}
@Override
@GetMapping("importCodeRecord")
public ResponseDto<PageBeanNew<ImportRecordVO>> importCodeRecord(@RequestHeader("token")String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId, @RequestParam("currentPage") Integer currenPage, @RequestParam("numPerPage") Integer numPerPage) throws PermissionException, BizException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
PageBeanNew<ImportRecordVO> pageBean = bookAuthCodeBiz.importCodeRecord(bookId, channelId, adviserId, currenPage, numPerPage);
return new ResponseDto<>(pageBean);
}
}
package com.pcloud.book.copyright.tools;
import com.pcloud.book.copyright.biz.impl.BookAuthInfoBizImpl;
import com.pcloud.common.constant.OSConstant;
import com.pcloud.common.utils.FileUtils;
import com.pcloud.common.utils.UUIDUitl;
import com.pcloud.common.utils.aliyun.OssUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* 表格处理
*
* @author lili
* @date 创建时间:2018年1月10日 下午2:42:39
*/
public class ExcelUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(ExcelUtil.class);
@SuppressWarnings({"resource", "deprecation"})
public static String[][] getData(String url, int ignoreRows)
throws IOException {
String outDirUrl = OSConstant.USERDIR + "/download/authcode/" + UUIDUitl.taskName();
FileUtils.isDir(outDirUrl);
String outPutUrl = outDirUrl + "/temp.xls";
OssUtils.downloadFile(url, outPutUrl);
List<String[]> result = new ArrayList<String[]>();
String[][] resultStr = null;
int rowSize = 0;
// 打开HSSFWorkbook
POIFSFileSystem fs = new POIFSFileSystem(new File(outPutUrl));
HSSFWorkbook wb = new HSSFWorkbook(fs);
try {
HSSFCell cell = null;
List<Integer> temp = new ArrayList<>();
for (int sheetIndex = 0; sheetIndex < wb.getNumberOfSheets(); sheetIndex++) {
HSSFSheet st = wb.getSheetAt(sheetIndex);
// 第一行为标题,不取
for (int rowIndex = ignoreRows; rowIndex <= st.getLastRowNum(); rowIndex++) {
HSSFRow row = st.getRow(rowIndex);
if (row == null) {
continue;
}
int tempRowSize = row.getLastCellNum() + 1;
if (tempRowSize > rowSize) {
rowSize = tempRowSize;
}
String[] values = new String[rowSize];
Arrays.fill(values, "");
boolean hasValue = false;
for (short columnIndex = 0; columnIndex <= row.getLastCellNum(); columnIndex++) {
String value = "";
cell = row.getCell(columnIndex);
if (cell != null) {
// 注意:一定要设成这个,否则可能会出现乱码
//cell.set.setEncoding(HSSFCell.ENCODING_UTF_16);
switch (cell.getCellType()) {
case HSSFCell.CELL_TYPE_STRING:
value = cell.getStringCellValue();
break;
case HSSFCell.CELL_TYPE_NUMERIC:
if (HSSFDateUtil.isCellDateFormatted(cell)) {
Date date = cell.getDateCellValue();
if (date != null) {
value = new SimpleDateFormat("yyyy-MM-dd")
.format(date);
} else {
value = "";
}
} else {
value = new DecimalFormat("0").format(cell
.getNumericCellValue());
}
break;
case HSSFCell.CELL_TYPE_FORMULA:
// 导入时如果为公式生成的数据则无值
if (!cell.getStringCellValue().equals("")) {
value = cell.getStringCellValue();
} else {
value = cell.getNumericCellValue() + "";
}
break;
case HSSFCell.CELL_TYPE_BLANK:
break;
case HSSFCell.CELL_TYPE_ERROR:
value = "";
break;
case HSSFCell.CELL_TYPE_BOOLEAN:
value = (cell.getBooleanCellValue() == true ? "Y"
: "N");
break;
default:
value = "";
}
if (!rightTrim(value).trim().equals("")) {
hasValue = true;
}
values[columnIndex] = rightTrim(value);
} else {
values[columnIndex] = null;
}
}
if (!hasValue) {
temp.add(rowIndex - 1);
}
result.add(values);
}
}
String[][] returnArray = new String[result.size()][rowSize + 1];
for (int i = 0; i < returnArray.length; i++) {
returnArray[i] = (String[]) result.get(i);
}
resultStr = new String[result.size() - temp.size()][rowSize + 1];
int j = 0;
HSSFSheet st = wb.getSheetAt(0);
for (int i = 0; i < resultStr.length; i++) {
if (temp.contains(i) || i >= returnArray.length) {
continue;
}
resultStr[j] = returnArray[i];
j++;
}
} catch (Exception e) {
LOGGER.error("读取表格失败" + e.getMessage(), e);
return null;
} finally {
if (fs != null) {
fs.close();
}
if (wb != null) {
wb.close();
}
FileUtils.deleteDirectory(outDirUrl);
}
return resultStr;
}
/**
* 去掉字符串右边的空格
*
* @param str 要处理的字符串
* @return 处理后的字符串
*/
public static String rightTrim(String str) {
if (str == null) {
return "";
}
int length = str.length();
for (int i = length - 1; i >= 0; i--) {
if (str.charAt(i) != 0x20) {
break;
}
length--;
}
return str.substring(0, length);
}
}
package com.pcloud.book.copyright.vo;
import java.io.Serializable;
/**
* @author lily
* @date 2019/5/20 15:04
*/
public class FileVO implements Serializable {
private String fileUrl;
private Long bookId;
private Long channelId;
private String fileName;
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public String getFileUrl() {
return fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
@Override
public String toString() {
return "FileVO{" +
"fileUrl='" + fileUrl + '\'' +
", bookId=" + bookId +
", channelId=" + channelId +
'}';
}
}
package com.pcloud.book.copyright.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import java.util.Date;
/**
* @author lily
* @date 2019/5/22 17:54
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ImportRecordVO implements Serializable {
private Long id;
private Long bookId;
private Long channelId;
private Long adviserId;
private String fileName;
private String fileUrl;
private Integer isFinish;
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date createTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public Long getAdviserId() {
return adviserId;
}
public void setAdviserId(Long adviserId) {
this.adviserId = adviserId;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFileUrl() {
return fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getIsFinish() {
return isFinish;
}
public void setIsFinish(Integer isFinish) {
this.isFinish = isFinish;
}
@Override
public String toString() {
return "ImportRecordVO{" +
"id=" + id +
", bookId=" + bookId +
", channelId=" + channelId +
", adviserId=" + adviserId +
", fileName='" + fileName + '\'' +
", fileUrl='" + fileUrl + '\'' +
", isFinish=" + isFinish +
", createTime=" + createTime +
'}';
}
}
......@@ -23,7 +23,7 @@ public interface BookGroupBiz {
* @param adviserId 编辑ID
* @throws BizException
*/
BookGroup createBookGroupAfterCreateBook(Long bookId, Long channelId, Long adviserId) throws BizException;
BookGroup createBookGroupAfterCreateBook(Long bookId, Long channelId, Long adviserId, Integer addType, Long sceneId) throws BizException;
/**
* 获取社群书群二维码信息
......@@ -49,7 +49,7 @@ public interface BookGroupBiz {
* @return
* @throws BizException
*/
BookGroupDTO getBookGroupInfoByBookId(Long bookId, Long channelId, Long adviserId) throws BizException;
BookGroupDTO getBookGroupInfoByBookId(Long bookId, Long channelId, Long adviserId, Integer addType, Long sceneId) throws BizException;
/**
* 更新群二维码信息
......@@ -147,4 +147,25 @@ public interface BookGroupBiz {
* @Date:2019/5/13 15:09
*/
String getSpareQr(Long bookGroupId);
/**
* @Author:lili
* @Desr:根据二维码获取社群码基本信息
* @Date:2019/5/27 17:59
*/
BookGroupDTO getBaseInfoBySceneId(Long sceneId);
/**
* @Author:lili
* @Desr:是否是特殊的出版社
* @Date:2019/5/28 11:14
*/
Boolean isSpecialAgent(Long agentId);
/**
* @Author:lili
* @Desr:是否有社群码
* @Date:2019/5/30 16:36
*/
Boolean isHaveQrcode(Long bookId, Long channelId, Long adviserId);
}
package com.pcloud.book.group.biz.impl;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.biz.BookBiz;
import com.pcloud.book.book.dao.BookDao;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.book.set.BookSet;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
......@@ -24,6 +14,7 @@ import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookGroupStatisticDTO;
import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.channelcenter.qrcode.dto.GroupQrcodeVO;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.constant.ProductTypeConstant;
import com.pcloud.common.dto.ResponseDto;
......@@ -42,6 +33,19 @@ import com.pcloud.resourcecenter.product.service.ProductService;
import com.pcloud.settlementcenter.record.service.SettlementService;
import com.pcloud.wechatgroup.group.service.GroupMemberService;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Description 社群书群二维码业务逻辑层接口实现类
* Created by PENG on 2019/4/17.
......@@ -74,6 +78,8 @@ public class BookGroupBizImpl implements BookGroupBiz {
private BookGroupClassifyBiz bookGroupClassifyBiz;
@Autowired
private GroupMemberService groupMemberService;
@Autowired
private QrcodeSceneConsr qrcodeSceneConsr;
/**
* 创建社群书时生成群二维码
......@@ -81,18 +87,35 @@ public class BookGroupBizImpl implements BookGroupBiz {
@Override
@ParamLog("创建社群书时生成群二维码")
@Transactional(rollbackFor = Exception.class)
public BookGroup createBookGroupAfterCreateBook(Long bookId, Long channelId, Long adviserId) throws BizException {
public BookGroup createBookGroupAfterCreateBook(Long bookId, Long channelId, Long adviserId, Integer addType, Long sceneId) throws BizException {
BookGroup bookGroup = new BookGroup();
bookGroup.setBookId(bookId);
bookGroup.setChannelId(channelId);
bookGroup.setCreateUser(adviserId);
bookGroupDao.insert(bookGroup);
String groupQrcodeUrl = QrcodeUtils.createWithMargin(bookGroupQrcodeDomain + "/" + bookGroup.getId(), 1);
BookGroup group = new BookGroup();
group.setId(bookGroup.getId());
group.setGroupQrcodeUrl(groupQrcodeUrl);
bookGroupDao.update(group);
bookGroup.setGroupQrcodeUrl(groupQrcodeUrl);
if (addType != null && addType == 1) {
GroupQrcodeVO groupQrcodeVO = null;
if (sceneId != null) {
//将图书下某个二维码替换成社群码
groupQrcodeVO = qrcodeSceneConsr.setQrcodeToGroup(sceneId);
} else {
//创建公众号二维码
groupQrcodeVO = qrcodeSceneConsr.createWxGroupQrcode(bookId, channelId, adviserId);
}
if (groupQrcodeVO == null) {
throw new BookBizException(BookBizException.ERROR, "二维码生成失败!");
}
bookGroup.setGroupQrcodeUrl(groupQrcodeVO.getQrcodeUrl());
bookGroup.setSceneId(groupQrcodeVO.getSceneId());
bookGroupDao.insert(bookGroup);
} else {
bookGroupDao.insert(bookGroup);
String groupQrcodeUrl = QrcodeUtils.createWithMargin(bookGroupQrcodeDomain + "/" + bookGroup.getId(), 1);
BookGroup group = new BookGroup();
group.setId(bookGroup.getId());
group.setGroupQrcodeUrl(groupQrcodeUrl);
bookGroupDao.update(group);
bookGroup.setGroupQrcodeUrl(groupQrcodeUrl);
}
return bookGroup;
}
......@@ -149,10 +172,13 @@ public class BookGroupBizImpl implements BookGroupBiz {
* 获取社群书群二维码信息
*/
@Override
public BookGroupDTO getBookGroupInfoByBookId(Long bookId, Long channelId, Long adviserId) throws BizException {
BookGroupDTO bookGroupDTO = bookGroupDao.getDTOByBookId(bookId, channelId, adviserId);
public BookGroupDTO getBookGroupInfoByBookId(Long bookId, Long channelId, Long adviserId, Integer addType, Long sceneId) throws BizException {
BookGroupDTO bookGroupDTO = null;
if (!bookId.equals(0L)) {
bookGroupDTO = bookGroupDao.getDTOByBookId(bookId, channelId, adviserId);
}
if (null == bookGroupDTO) {
BookGroup bookGroup = this.createBookGroupAfterCreateBook(bookId, channelId, adviserId);
BookGroup bookGroup = this.createBookGroupAfterCreateBook(bookId, channelId, adviserId, addType, sceneId);
bookGroupDTO = new BookGroupDTO();
bookGroupDTO.setId(bookGroup.getId());
bookGroupDTO.setBookId(bookId);
......@@ -372,4 +398,29 @@ public class BookGroupBizImpl implements BookGroupBiz {
public String getSpareQr(Long bookGroupId) {
return bookGroupDao.getSpareQr(bookGroupId);
}
@Override
public BookGroupDTO getBaseInfoBySceneId(Long sceneId) {
BookGroupDTO bookGroupDTO = bookGroupDao.getBaseInfoBySceneId(sceneId);
if (bookGroupDTO != null) {
bookGroupDTO.setUrl(bookGroupQrcodeDomain + "/" + bookGroupDTO.getId());
}
return bookGroupDTO;
}
@Override
@ParamLog("是否是特殊的出版社")
public Boolean isSpecialAgent(Long agentId) {
return bookGroupDao.isSpecialAgent(agentId);
}
@Override
public Boolean isHaveQrcode(Long bookId, Long channelId, Long adviserId) {
BookGroupDTO bookGroupDTO = bookGroupDao.getDTOByBookId(bookId, channelId, adviserId);
if (bookGroupDTO == null) {
return false;
} else {
return true;
}
}
}
......@@ -79,4 +79,18 @@ public interface BookGroupDao extends BaseDao<BookGroup> {
* @Date:2019/5/13 15:10
*/
String getSpareQr(Long bookGroupId);
/**
* @Author:lili
* @Desr:根据二维码获取社群码基本信息
* @Date:2019/5/27 18:00
*/
BookGroupDTO getBaseInfoBySceneId(Long sceneId);
/**
* @Author:lili
* @Desr:是否是特殊的出版社
* @Date:2019/5/28 11:15
*/
Boolean isSpecialAgent(Long agentId);
}
package com.pcloud.book.group.dao.impl;
import java.util.HashMap;
import java.util.Map;
import org.springframework.stereotype.Repository;
import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.Map;
/**
* Description 社群书群二维码数据访问层接口实现类
* Created by PENG on 2019/4/17.
......@@ -92,4 +92,14 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou
public String getSpareQr(Long bookGroupId) {
return this.getSqlSession().selectOne(this.getStatement("getSpareQr"), bookGroupId);
}
@Override
public BookGroupDTO getBaseInfoBySceneId(Long sceneId) {
return this.getSqlSession().selectOne(this.getStatement("getBaseInfoBySceneId"), sceneId);
}
@Override
public Boolean isSpecialAgent(Long agentId) {
return this.getSqlSession().selectOne(this.getStatement("isSpecialAgent"), agentId);
}
}
......@@ -116,6 +116,15 @@ public class BookGroupDTO extends BaseDto {
*/
private BookDto bookInfo;
private String url;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Long getId() {
return id;
}
......
......@@ -36,11 +36,21 @@ public class ClassifyDTO implements Serializable {
private Long bookGroupId;
/**
* 社群二维码标题
*/
private String bookGroupName;
/**
* 分类
*/
private String classify;
/**
* 书籍名称
*/
private String bookName;
/**
* 分类介绍
*/
private String classifyIntroduce;
......@@ -94,6 +104,14 @@ public class ClassifyDTO implements Serializable {
this.classify = classify;
}
public String getBookName() {
return bookName;
}
public void setBookName(String bookName) {
this.bookName = bookName;
}
public String getClassifyIntroduce() {
return classifyIntroduce;
}
......@@ -158,6 +176,14 @@ public class ClassifyDTO implements Serializable {
this.productSpecId = productSpecId;
}
public String getBookGroupName() {
return bookGroupName;
}
public void setBookGroupName(String bookGroupName) {
this.bookGroupName = bookGroupName;
}
@Override
public String toString() {
return "ClassifyDTO{" +
......@@ -165,7 +191,9 @@ public class ClassifyDTO implements Serializable {
", bookId=" + bookId +
", channelId=" + channelId +
", bookGroupId=" + bookGroupId +
", bookGroupName='" + bookGroupName + '\'' +
", classify='" + classify + '\'' +
", bookName='" + bookName + '\'' +
", classifyIntroduce='" + classifyIntroduce + '\'' +
", price=" + price +
", productId=" + productId +
......
......@@ -28,6 +28,11 @@ public class BookGroup extends BaseEntity {
private Long channelId;
/**
* 二维码标识
*/
private Long sceneId;
/**
* book_group.group_qrcode_url (群二维码图片)
*/
private String groupQrcodeUrl;
......@@ -220,12 +225,21 @@ public class BookGroup extends BaseEntity {
this.isDelete = isDelete;
}
public Long getSceneId() {
return sceneId;
}
public void setSceneId(Long sceneId) {
this.sceneId = sceneId;
}
@Override
public String toString() {
return "BookGroup{" +
"id=" + id +
", bookId=" + bookId +
", channelId=" + channelId +
", sceneId=" + sceneId +
", groupQrcodeUrl='" + groupQrcodeUrl + '\'' +
", groupQrcodeName='" + groupQrcodeName + '\'' +
", proLabelId=" + proLabelId +
......@@ -239,6 +253,6 @@ public class BookGroup extends BaseEntity {
", createTime=" + createTime +
", updateTime=" + updateTime +
", isDelete=" + isDelete +
"} " + super.toString();
'}';
}
}
\ No newline at end of file
......@@ -53,7 +53,21 @@ public interface BookGroupFacade {
})
@RequestMapping(value = "getBookGroupInfoByBookId", method = RequestMethod.GET)
ResponseDto<?> getBookGroupInfoByBookId(@RequestHeader("token") String token, @RequestParam(value = "bookId", required = false) Long bookId,
@RequestParam(value = "channelId", required = false) Long channelId) throws BizException, PermissionException, JsonParseException;
@RequestParam(value = "channelId", required = false) Long channelId,
@RequestParam(value = "addType", required = false) Integer addType, @RequestParam(value = "sceneId", required = false) Long sceneId) throws BizException, PermissionException, JsonParseException;
@ApiOperation(value = "是否有社群码", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "用户身份信息", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "bookId", value = "书刊ID", dataType = "long", paramType = "query"),
@ApiImplicitParam(name = "channelId", value = "运营ID", dataType = "long", paramType = "query")
})
@RequestMapping(value = "isHaveQrcode", method = RequestMethod.GET)
ResponseDto<Boolean> isHaveQrcode(@RequestHeader("token") String token, @RequestParam(value = "bookId", required = false) Long bookId,
@RequestParam(value = "channelId", required = false) Long channelId)
throws BizException, PermissionException, JsonParseException;
@ApiOperation(value = "更新群二维码信息", httpMethod = "POST")
@ApiImplicitParams({
......@@ -150,4 +164,11 @@ public interface BookGroupFacade {
})
@RequestMapping(value = "getTotalBookGroupCount", method = RequestMethod.GET)
ResponseDto<?> getTotalBookGroupCount(@RequestHeader("token") String token) throws BizException, PermissionException, JsonParseException;
@ApiOperation(value = "是否是特殊的出版社", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header")
})
@RequestMapping(value = "isSpecialAgent", method = RequestMethod.GET)
ResponseDto<Boolean> isSpecialAgent(@RequestHeader("token") String token) throws BizException, PermissionException, JsonParseException;
}
......@@ -69,15 +69,32 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@Override
@RequestMapping(value = "getBookGroupInfoByBookId", method = RequestMethod.GET)
public ResponseDto<?> getBookGroupInfoByBookId(@RequestHeader("token") String token, @RequestParam(value = "bookId", required = false) Long bookId,
@RequestParam(value = "channelId", required = false) Long channelId) throws BizException, PermissionException, JsonParseException {
@RequestParam(value = "channelId", required = false) Long channelId,
@RequestParam(value = "addType", required = false) Integer addType,
@RequestParam(value = "sceneId", required = false) Long sceneId) throws BizException, PermissionException, JsonParseException {
if (null == bookId || null == channelId) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
}
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(bookGroupBiz.getBookGroupInfoByBookId(bookId, channelId, adviserId));
return new ResponseDto<>(bookGroupBiz.getBookGroupInfoByBookId(bookId, channelId, adviserId, addType, sceneId));
}
/**
* 是否有社群码
*/
@Override
@RequestMapping(value = "isHaveQrcode", method = RequestMethod.GET)
public ResponseDto<Boolean> isHaveQrcode(@RequestHeader("token") String token, @RequestParam(value = "bookId", required = false) Long bookId,
@RequestParam(value = "channelId", required = false) Long channelId) throws BizException, PermissionException, JsonParseException {
if (null == bookId || null == channelId) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
}
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<Boolean>(bookGroupBiz.isHaveQrcode(bookId, channelId, adviserId));
}
/**
* 更新群二维码信息
*/
@Override
......@@ -204,4 +221,10 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(bookGroupBiz.getTotalBookGroupCount(adviserId));
}
@Override
@RequestMapping(value = "isSpecialAgent", method = RequestMethod.GET)
public ResponseDto<Boolean> isSpecialAgent(@RequestHeader("token") String token) throws BizException, PermissionException {
Long agentId = (Long) SessionUtil.getVlaue(token, SessionUtil.TENANT_ID);
return new ResponseDto<Boolean>(bookGroupBiz.isSpecialAgent(agentId));
}
}
package com.pcloud.book.group.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.service.BookGroupService;
......@@ -13,6 +7,13 @@ import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ResponseHandleUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* Description 社群书内部接口实现类
* Created by PENG on 2019/5/14.
......@@ -28,8 +29,17 @@ public class BookGroupServiceImpl implements BookGroupService {
* 获取社群书基本信息
*/
@Override
@RequestMapping(value = "getBookGroupInfo",method = RequestMethod.GET)
public ResponseEntity<ResponseDto<BookGroupDTO>> getBookGroupInfo(@RequestParam("bookGroupId") Long bookGroupId) throws BizException{
@RequestMapping(value = "getBookGroupInfo", method = RequestMethod.GET)
public ResponseEntity<ResponseDto<BookGroupDTO>> getBookGroupInfo(@RequestParam("bookGroupId") Long bookGroupId) throws BizException {
return ResponseHandleUtil.toResponse(bookGroupBiz.getBookGroupInfo(bookGroupId));
}
/**
* 获取社群书基本信息
*/
@Override
@RequestMapping(value = "getBaseInfoBySceneId", method = RequestMethod.GET)
public ResponseEntity<ResponseDto<BookGroupDTO>> getBaseInfoBySceneId(@RequestParam("sceneId") Long sceneId) throws BizException {
return ResponseHandleUtil.toResponse(bookGroupBiz.getBaseInfoBySceneId(sceneId));
}
}
......@@ -284,11 +284,21 @@ public class SendWeixinRequestTools {
String content = "";
for (int i = 0; i < keywords.size(); i++) {
KeywordDTO keywordDTO = keywords.get(i);
content = content + "关键词" + (i + 1) + ":" + keywordDTO.getKeywords() + "\n" + keywordDTO.getGuide();
String keyword = "关键词" + (i + 1) + ":" + keywordDTO.getKeywords() + "\n" + keywordDTO.getGuide();
if (content.length() + keyword.length() > 300) {
sendTextMessage(content, robotId, weixinGroupId);
content = keyword;
}else{
content = content + keyword;
}
if (i != keywords.size() - 1) {
content = content + "\n";
}
}
sendTextMessage(content, robotId, weixinGroupId);
}
public static void sendTextMessage(String content, String robotId, String weixinGroupId){
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setContent(content);
sendTextMessageVO.setAltId(robotId);
......@@ -297,50 +307,48 @@ public class SendWeixinRequestTools {
}
public static void main(String[] args) {
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setContent("关键词1:a" + "\n" + "换行换行换行" + "\n");
sendTextMessageVO.setAltId("wxid_qj200bf0key022");
sendTextMessageVO.setGroupId("14108963419@chatroom");
WxGroupSDK.sendTextMessage(sendTextMessageVO);
// SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
// sendTextMessageVO.setContent("关键词1:a" + "\n" + "换行换行换行" + "\n");
// sendTextMessageVO.setAltId("wxid_qj200bf0key022");
// sendTextMessageVO.setGroupId("14108963419@chatroom");
// WxGroupSDK.sendTextMessage(sendTextMessageVO);
}
public static void sendDefaultMessage(String groupName, String robotId, String weixinGroupId) {
public static void sendDefaultMessage(String groupName, String robotId, String weixinGroupId, Boolean isHaveKeywords) {
String content = getNickNameStr(weixinGroupId);
if (StringUtil.isEmpty(groupName)) {
content += " 欢迎加入本群,凭以下关键词领取任务或资源:";
content += " 欢迎加入本群!";
} else {
content += " 欢迎加入" + groupName + "!凭以下关键词领取任务或资源:";
content += " 欢迎加入" + groupName + "!";
}
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setContent(content);
sendTextMessageVO.setAltId(robotId);
sendTextMessageVO.setGroupId(weixinGroupId);
WxGroupSDK.sendTextMessage(sendTextMessageVO);
if(isHaveKeywords){
content = content + "凭以下关键词领取任务或资源:";
}
sendTextMessage(content, robotId, weixinGroupId);
}
private static String getNickNameStr(String weixinGroupId){
private static String getNickNameStr(String weixinGroupId) {
String nameStr = "";
Map<String,Integer> nickNames = JedisClusterUtils.getJson("BOOK:WEIXINGROUP:GUIDEUSER" + weixinGroupId, Map.class);
int i=0;
List<String>names = new ArrayList<>();
Map<String, Integer> nickNames = JedisClusterUtils.getJson("BOOK:WEIXINGROUP:GUIDEUSER" + weixinGroupId, Map.class);
int i = 0;
List<String> names = new ArrayList<>();
Set<Map.Entry<String, Integer>> entries = nickNames.entrySet();
for(Iterator<Map.Entry<String, Integer>> iterator = entries.iterator(); iterator.hasNext();){
if(i==5){
for (Iterator<Map.Entry<String, Integer>> iterator = entries.iterator(); iterator.hasNext(); ) {
if (i == 5) {
break;
}
Map.Entry<String, Integer> entry = iterator.next();
String key=entry.getKey();
Map.Entry<String, Integer> entry = iterator.next();
String key = entry.getKey();
names.add(key);
i++;
}
for (String nickName : names) {
nickNames.remove(nickName);
if(StringUtils.isNotEmpty(nickName)) {
if (StringUtils.isNotEmpty(nickName)) {
nameStr = nameStr + "@" + nickName + " ";
}
}
JedisClusterUtils.setJson("BOOK:WEIXINGROUP:GUIDEUSER" + weixinGroupId,nickNames,600);
JedisClusterUtils.setJson("BOOK:WEIXINGROUP:GUIDEUSER" + weixinGroupId, nickNames, 600);
return nameStr;
}
}
......@@ -60,7 +60,7 @@ public interface BookKeywordBiz {
/**
* @Author:lili
* @Desr: 获取关键词(5个)
* @Desr: 获取关键词(5个)(改成10个了)
* @Date:2019/5/5 15:11
*/
List<KeywordDTO> listFiveKeyword(Long classifyId, Long bookGroupId);
......
......@@ -199,19 +199,20 @@ public class BookGuideBizImpl implements BookGuideBiz {
}
//获取公众号基本信息
AccountSettingDto wechatInfo = qrcodeSceneConsr.getWechatInfo(classifyQrcodeInfo.getChannelId());
//获取关键词信息(改成10个了)
List<KeywordDTO> keywords = bookKeywordBiz.listFiveKeyword(classifyQrcodeInfo.getClassifyId(), classifyQrcodeInfo.getBookGroupId());
Boolean isHaveKeywords = ListUtils.isEmpty(keywords) ? false : true;
if (ListUtils.isEmpty(replyMessages)) {
//获取群名称
GroupQrcodeBaseInfoVO groupInfo = groupQrcodeBiz.getBaseById(classifyQrcodeInfo.getGroupQrcodeId());
//推送消息
SendWeixinRequestTools.sendDefaultMessage(groupInfo == null ? "":groupInfo.getGroupName(), robotId, weixinGroupId);
}else{
SendWeixinRequestTools.sendDefaultMessage(groupInfo == null ? "" : groupInfo.getGroupName(), robotId, weixinGroupId, isHaveKeywords);
} else {
//处理链接
handleUrl(replyMessages, wechatInfo, classifyQrcodeInfo);
//推送消息
SendWeixinRequestTools.sendGuideMessage(replyMessages, robotId, weixinGroupId);
}
//获取关键词信息
List<KeywordDTO> keywords = bookKeywordBiz.listFiveKeyword(classifyQrcodeInfo.getClassifyId(), classifyQrcodeInfo.getBookGroupId());
SendWeixinRequestTools.sendKeywordsInfo(keywords, robotId, weixinGroupId);
if (bookGuide != null && bookGuide.getIsRecommend() != null && bookGuide.getIsRecommend() == 1) {
//推送公众号消息
......
......@@ -182,7 +182,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
}
@Override
@ParamLog("获取5个关键词")
@ParamLog("获取5个关键词(改成10个了)")
public List<KeywordDTO> listFiveKeyword(Long classifyId, Long bookGroupId) {
//获取是否单独设置关键词
List<KeywordDTO> keywords = bookKeywordDao.listFiveKeyword(classifyId, bookGroupId);
......
......@@ -8,6 +8,7 @@
<result column="BOOK_ID" property="bookId" jdbcType="BIGINT" />
<result column="CHANNEL_ID" property="channelId" jdbcType="BIGINT" />
<result column="TEMPLET_ID" property="templetId" jdbcType="BIGINT" />
<result column="SECOND_TEMPLET_ID" property="secondTempletId" jdbcType="BIGINT" />
<result column="REASON" property="reason" jdbcType="VARCHAR" />
<result column="DECLARANT" property="declarant" jdbcType="BIGINT" />
<result column="PHONE" property="phone" jdbcType="VARCHAR" />
......@@ -24,6 +25,7 @@
<result column="ISBN" property="isbn" jdbcType="VARCHAR" />
<result column="SERIAL_NUMBER" property="serialNumber" jdbcType="VARCHAR" />
<result column="IS_BOOK_GROUP" property="isBookGroup" jdbcType="BIT" />
<result column="ADD_TYPE" property="addType" jdbcType="BIT" />
<collection property="defendants" column="BOOK_APPEAL_ID" ofType="bookDefendant"
select="com.pcloud.book.appeal.dao.impl.BookDefendantDaoImpl.list" />
</resultMap>
......@@ -31,13 +33,13 @@
<!-- 新增书籍信息-->
<insert id="insert" parameterType="bookAppeal" useGeneratedKeys="true" keyProperty="bookAppealId" flushCache="true">
INSERT INTO `BOOK_APPEAL` (
BOOK_ID, CHANNEL_ID, TEMPLET_ID,REASON,DECLARANT, PHONE, APPEAL_SUBMIT_DATE, APPEAL_STATE, AUDIT_REASON, AUDIT_USER,
BOOK_ID, CHANNEL_ID, TEMPLET_ID,SECOND_TEMPLET_ID,REASON,DECLARANT, PHONE, APPEAL_SUBMIT_DATE, APPEAL_STATE, AUDIT_REASON, AUDIT_USER,add_type,
CREATED_USER,CREATED_DATE,LAST_MODIFIED_USER, LAST_MODIFIED_DATE, IS_BOOK_GROUP
)
VALUES (
#{bookId, jdbcType=BIGINT}, #{channelId, jdbcType=BIGINT}, #{templetId, jdbcType=BIGINT}, #{reason, jdbcType=VARCHAR}, #{declarant, jdbcType=BIGINT},
#{bookId, jdbcType=BIGINT}, #{channelId, jdbcType=BIGINT}, #{templetId, jdbcType=BIGINT}, #{secondTempletId, jdbcType=BIGINT},#{reason, jdbcType=VARCHAR}, #{declarant, jdbcType=BIGINT},
#{phone, jdbcType=VARCHAR}, #{appealSubmitDate, jdbcType=TIMESTAMP}, #{appealState, jdbcType=BIGINT}, #{auditReason, jdbcType=VARCHAR},
#{auditUser, jdbcType=BIGINT}, #{createdUser, jdbcType=BIGINT}, NOW(),
#{auditUser, jdbcType=BIGINT},#{addType, jdbcType=BIT}, #{createdUser, jdbcType=BIGINT}, NOW(),
#{lastModifiedUser, jdbcType=BIGINT}, NOW(), #{isBookGroup, jdbcType=BIT}
)
</insert>
......@@ -62,7 +64,7 @@
<!-- 获取申诉列表 -->
<select id="list" resultMap="bookAppealMap" parameterType="map">
SELECT
BOOK_APPEAL_ID, PHONE, DECLARANT,B.ISBN, B.BOOK_NAME,B.SERIAL_NUMBER,A.APPEAL_STATE,A.TEMPLET_ID
BOOK_APPEAL_ID, PHONE, DECLARANT,B.ISBN, B.BOOK_NAME,B.SERIAL_NUMBER,A.APPEAL_STATE,A.TEMPLET_ID,A.SECOND_TEMPLET_ID
FROM
BOOK_APPEAL A
LEFT JOIN
......@@ -83,7 +85,7 @@
<!-- 获取申诉详情 -->
<select id="getById" resultMap="bookAppealMap" parameterType="long">
SELECT
BOOK_APPEAL_ID, PHONE,CHANNEL_ID, DECLARANT,REASON,BOOK_ID,VERSION,APPEAL_STATE,AUDIT_REASON,TEMPLET_ID,CREATED_USER,IS_BOOK_GROUP
BOOK_APPEAL_ID, PHONE,CHANNEL_ID, DECLARANT,REASON,BOOK_ID,VERSION,APPEAL_STATE,AUDIT_REASON,TEMPLET_ID,CREATED_USER,IS_BOOK_GROUP,ADD_TYPE,SECOND_TEMPLET_ID
FROM
BOOK_APPEAL A
WHERE
......
......@@ -523,7 +523,7 @@
SELECT
A.BOOK_ID, A.CHANNEL_ID, A.ADVISER_ID, A.IS_MAIN_EDITOR, B.ISBN, B.BOOK_NAME,
B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.ORIGIN_NAME, B.BOOK_PRICE, B.ISSN, B.BOOK_NUM, B.SERIAL_NUMBER,
A.TEMPLET_ID, A.LAST_MODIFIED_DATE, A.BOOK_ADVISER_ID, CONCAT('BK',A.BOOK_ID) uniqueNumber
A.TEMPLET_ID,A.SECOND_TEMPLET_ID, A.LAST_MODIFIED_DATE, A.BOOK_ADVISER_ID, CONCAT('BK',A.BOOK_ID) uniqueNumber
FROM
BOOK_ADVISER A
INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID AND B.IS_DELETE = 0
......@@ -1185,7 +1185,7 @@
<!-- 图书列表(平台端) -->
<select id="listBookClassify" resultMap="bookMap" parameterType="map">
SELECT
b.BOOK_ID, b.BOOK_NAME, b.COVER_IMG, b.ISBN, b.PUBLISH, b.SERIAL_NUMBER,
b.BOOK_ID, b.BOOK_NAME, b.COVER_IMG, b.ISBN,b.SERIAL_NUMBER, b.PUBLISH,
ba.ADVISER_ID, ba.TEMPLET_ID, ba.CHANNEL_ID, ba.CREATED_DATE,
bt.TYPE_NAME
FROM
......
......@@ -49,16 +49,19 @@
<insert id="batchInsert" parameterType="bookAdviser" useGeneratedKeys="true" keyProperty="bookAdviserId" flushCache="true">
<foreach collection="list" item="item" index="index" separator=";">
INSERT INTO BOOK_ADVISER (
BOOK_ID, ADVISER_ID, CHANNEL_ID, CREATED_USER, CREATED_DATE,IS_MAIN_EDITOR, TEMPLET_ID
BOOK_ID, ADVISER_ID, CHANNEL_ID, CREATED_USER, CREATED_DATE,IS_MAIN_EDITOR, TEMPLET_ID,SECOND_TEMPLET_ID
)
VALUES
(
#{item.bookId, jdbcType=VARCHAR}, #{item.adviserId, jdbcType=VARCHAR}, #{item.channelId, jdbcType=VARCHAR},
#{item.adviserId, jdbcType=BIGINT}, NOW(),#{item.isMainEditor, jdbcType=BIT},#{item.templetId, jdbcType=BIGINT}
#{item.adviserId, jdbcType=BIGINT}, NOW(),#{item.isMainEditor, jdbcType=BIT},#{item.templetId, jdbcType=BIGINT},#{item.secondTempletId, jdbcType=BIGINT}
) ON DUPLICATE KEY UPDATE IS_DELETE = 0,IS_MAIN_EDITOR=#{item.isMainEditor, jdbcType=BIT}
<if test="item.templetId!=null">
,TEMPLET_ID=#{item.templetId, jdbcType=BIGINT}
</if>
<if test="item.secondTempletId!=null">
,SECOND_TEMPLET_ID=#{item.secondTempletId, jdbcType=BIGINT}
</if>
</foreach>
</insert>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pcloud.book.copyright.dao.impl.BookAuthCodeImportRecordDaoImpl">
<insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="BookAuthCodeImportRecord">
INSERT INTO BOOK_AUTH_CODE_IMPORT_RECORD (
BOOK_ID, CHANNEL_ID,ADVISER_ID,FILE_NAME,FILE_URL,CREATE_USER, CREATE_TIME
)
VALUES
(#{bookId,jdbcType=BIGINT}, #{channelId,jdbcType=BIGINT}, #{adviserId,jdbcType=BIGINT},
#{fileName,jdbcType=VARCHAR},#{fileUrl,jdbcType=VARCHAR},#{createUser,jdbcType=BIGINT},
NOW())
</insert>
<select id="importCodeRecord" resultType="importRecordVO" parameterType="map">
SELECT
ID, BOOK_ID bookId, CHANNEL_ID channelId,ADVISER_ID adviserId,FILE_NAME fileName,FILE_URL fileUrl,CREATE_TIME createTime, is_finish isFinish
FROM
BOOK_AUTH_CODE_IMPORT_RECORD
WHERE
BOOK_ID = #{bookId, jdbcType=BIGINT}
AND
CHANNEL_ID = #{channelId, jdbcType=BIGINT}
AND
ADVISER_ID = #{adviserId, jdbcType=BIGINT}
</select>
<update id="updateState" parameterType="map">
UPDATE
BOOK_AUTH_CODE_IMPORT_RECORD
SET
is_finish = #{state},
update_time = now()
WHERE
ID = #{id}
</update>
</mapper>
\ No newline at end of file
......@@ -549,10 +549,11 @@
<id column="weixin_group_id" property="weixinGroupId" jdbcType="VARCHAR"/>
<result column="group_name" property="groupName" jdbcType="VARCHAR"/>
<result column="book_name" property="bookName" jdbcType="VARCHAR"/>
<result column="classify" property="classify" jdbcType="VARCHAR"/>
</resultMap>
<select id="listGroupQrcodeBaseInfo" resultMap="GroupQrcodeMap" parameterType="list">
SELECT
weixin_group_id, group_name, book_name
weixin_group_id, group_name, book_name, c.classify
FROM
book_group_qrcode q
JOIN
......
......@@ -126,6 +126,7 @@
<trim prefix="(" suffix=")" suffixOverrides=",">
book_id,
channel_id,
scene_id,
group_qrcode_url,
group_qrcode_name,
pro_label_id,
......@@ -142,6 +143,7 @@
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{bookId,jdbcType=BIGINT},
#{channelId,jdbcType=BIGINT},
#{sceneId,jdbcType=BIGINT},
#{groupQrcodeUrl,jdbcType=VARCHAR},
#{groupQrcodeName,jdbcType=VARCHAR},
#{proLabelId,jdbcType=BIGINT},
......@@ -228,4 +230,17 @@
from book_group
where id = #{_parameter,jdbcType=BIGINT}
</select>
<select id="getBaseInfoBySceneId" resultMap="BookGroupDTO" parameterType="map">
select
<include refid="Base_Column_List"/>
from book_group
where scene_id = #{_parameter}
</select>
<select id="isSpecialAgent" resultType="Boolean" parameterType="Long">
select
count(1)
from book_special_agent
where agent_id = #{_parameter}
</select>
</mapper>
\ No newline at end of file
......@@ -109,7 +109,7 @@
AND
k.is_delete = 0
AND classify_id = #{classifyId}
AND book_group_id = #{bookGroupId} order by bk.rank, bk.id desc limit 5
AND book_group_id = #{bookGroupId} order by bk.rank, bk.id desc limit 10
</select>
<select id="getKeywordId" resultType="ReplyKeywordDTO" parameterType="map">
......
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