Commit ca5aa2de by 裴大威

add updateNoISBNBookGeneratorQrcode

parent 53475176
......@@ -60,6 +60,9 @@ import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
......@@ -69,7 +72,7 @@ import java.util.Map;
*/
public interface BookGroupBiz {
String updateNoISBNBookGeneratorQrcode( MultipartFile file );
/**
* 查询编辑是否有此社群书
* @param bookId
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -11,6 +11,10 @@ import java.util.concurrent.ConcurrentHashMap;
public class BookBusinessConstants {
/**
* 生成无书号二维码路由
**/
public static final String NO_ISBN_QRCODE_URI = "/group/info?rayBookId=";
/**
* 需更新微信群信息
*/
public static final Map<String, AutoUpdateGroupNumDTO> GROUP_NUM_DTO_MAP = new ConcurrentHashMap<>(128);
......
......@@ -309,6 +309,10 @@ public interface BookGroupDao extends BaseDao<BookGroup> {
void updateSubjectByProLabel(Long proLebelId, Long subjectId);
void updateGradeByDepLabel(Long depLabelId, Long graLabelId);
Long getOldDataMax();
void insertOldData(Long id);
public Long getBookGroupId4OldData(Long raysBookId);
Long getIdByBookNameAndJoinGroupType(String bookName, Integer joinGroupType);
......
......@@ -367,6 +367,14 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou
public Long getBookGroupId4OldData(Long raysBookId) {
return getSessionTemplate().selectOne(getStatement("getBookGroupId4OldData"), raysBookId);
}
@Override
public Long getOldDataMax() {
return getSessionTemplate().selectOne(getStatement("getOldDataMax"));
}
@Override
public void insertOldData(Long id) {
getSessionTemplate().insert(getStatement("insertOldData"), id);
}
@Override
public Long getIdByBookNameAndJoinGroupType(String bookName, Integer joinGroupType) {
......
......@@ -3,15 +3,23 @@ package com.pcloud.book.group.facade.impl;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.constant.BookBusinessConstants;
import com.pcloud.book.group.dto.BookAppletSceneDTO;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.ChangeQrCodeTypeDto;
import com.pcloud.book.group.dto.GroupStoreMyPayDto;
import com.pcloud.book.group.dto.SelfBookGroupStParamDTO;
import com.pcloud.book.group.dto.UserSelectParamDTO;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.entity.BookGroupClassify;
import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.book.group.entity.WxWechatUserCorrelation;
import com.pcloud.book.group.enums.JoinGroupTypeEnum;
import com.pcloud.book.group.facade.BookGroupFacade;
import com.pcloud.book.group.tools.BookExcelReader;
import com.pcloud.book.group.vo.BookGroupAnalysisParam;
import com.pcloud.book.group.vo.BookGroupAnalysisVO;
import com.pcloud.book.group.vo.ExcelDataVO;
import com.pcloud.book.group.vo.FriendsVO;
import com.pcloud.book.group.vo.GroupIncomeStaticParamVO;
import com.pcloud.book.group.vo.GroupScanTrendParamVO;
......@@ -26,19 +34,25 @@ import com.pcloud.book.group.vo.WxGroupStatisticVO;
import com.pcloud.book.keywords.vo.ListKeywordVO;
import com.pcloud.common.core.constant.SystemCode;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.entity.UploadResultInfo;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.QrcodeUtils;
import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.aliyun.OssUtils;
import com.pcloud.common.utils.cookie.Cookie;
import com.pcloud.common.utils.httpclient.UrlUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.wechatgroup.base.exception.WechatGroupBizException;
import com.pcloud.wechatgroup.message.enums.IsSystem;
import org.codehaus.jackson.JsonParseException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -49,19 +63,23 @@ 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 org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cn.hutool.core.util.ZipUtil;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
/**
* Description 社群书群二维码接口实现类
* Created by PENG on 2019/4/17.
* Description 社群书群二维码接口实现类 Created by PENG on 2019/4/17.
*/
@Slf4j
@RestController("bookGroupFacade")
......@@ -73,12 +91,18 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@Autowired
private BookGroupClassifyBiz bookGroupClassifyBiz;
@SneakyThrows
@PostMapping("updateNoISBNBookGeneratorQrcode")
public ResponseDto<String> updateNoISBNBookGeneratorQrcode(@RequestParam("file") MultipartFile file ) {
return new ResponseDto<>(bookGroupBiz.updateNoISBNBookGeneratorQrcode(file));
}
/**
* 获取社群书群二维码信息
*/
@Override
@RequestMapping(value = "getBookGroupInfo", method = RequestMethod.GET)
public ResponseDto<?> getBookGroupInfo(@RequestHeader("token") String token, @RequestParam(value = "bookGroupId", required = false) Long bookGroupId)
public ResponseDto<?> getBookGroupInfo( @RequestHeader("token") String token, @RequestParam(value = "bookGroupId", required = false) Long bookGroupId )
throws BizException, PermissionException, JsonParseException {
if (null == bookGroupId) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
......@@ -92,7 +116,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
*/
@Override
@RequestMapping(value = "getBookInfo", method = RequestMethod.GET)
public ResponseDto<?> getBookInfo(@CookieValue("userInfo")String userInfo,@RequestParam(value = "bookGroupId", required = false) Long bookGroupId)
public ResponseDto<?> getBookInfo( @CookieValue("userInfo") String userInfo, @RequestParam(value = "bookGroupId", required = false) Long bookGroupId )
throws BizException, PermissionException, JsonParseException {
if (null == bookGroupId) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
......@@ -106,7 +130,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
*/
@Override
@RequestMapping(value = "getBookGroupInfo4Wechat", method = RequestMethod.GET)
public ResponseDto<?> getBookGroupInfo4Wechat(@RequestParam(value = "bookGroupId", required = false) Long bookGroupId)
public ResponseDto<?> getBookGroupInfo4Wechat( @RequestParam(value = "bookGroupId", required = false) Long bookGroupId )
throws BizException, PermissionException, JsonParseException {
if (null == bookGroupId) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
......@@ -119,7 +143,7 @@ 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,
public ResponseDto<?> getBookGroupInfoByBookId( @RequestHeader("token") String token, @RequestParam(value = "bookId", required = false) Long bookId,
@RequestParam(value = "channelId", required = false) Long channelId,
@RequestParam(value = "addType", required = false) Integer addType,
@RequestParam(value = "sceneId", required = false) Long sceneId,
......@@ -137,8 +161,8 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
*/
@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 {
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, "参数有误!");
}
......@@ -152,7 +176,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
*/
@Override
@RequestMapping(value = "updateBookGroup", method = RequestMethod.POST)
public ResponseDto<?> updateBookGroup(@RequestHeader("token") String token, @RequestBody BookGroup bookGroup)
public ResponseDto<?> updateBookGroup( @RequestHeader("token") String token, @RequestBody BookGroup bookGroup )
throws BizException, PermissionException, JsonParseException {
if (null == bookGroup) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
......@@ -166,7 +190,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
*/
@Override
@RequestMapping(value = "getBookNameByBookGroupId", method = RequestMethod.GET)
public ResponseDto<?> getBookNameByBookGroupId(@RequestParam(value = "bookGroupId", required = false) Long bookGroupId)
public ResponseDto<?> getBookNameByBookGroupId( @RequestParam(value = "bookGroupId", required = false) Long bookGroupId )
throws BizException, PermissionException, JsonParseException {
if (null == bookGroupId) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
......@@ -179,7 +203,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
*/
@Override
@RequestMapping(value = "listBookGroup4Adviser", method = RequestMethod.GET)
public ResponseDto<PageBean> listBookGroup4Adviser(@RequestHeader("token") String token,
public ResponseDto<PageBean> listBookGroup4Adviser( @RequestHeader("token") String token,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "bookName", required = false) String bookName,
@RequestParam(value = "isbn", required = false) String isbn,
......@@ -194,7 +218,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate,
@RequestParam(value = "hasServe", required = false) Boolean hasServe,
@RequestParam(value = "isPrint", required = false) Boolean isPrint)
@RequestParam(value = "isPrint", required = false) Boolean isPrint )
throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
......@@ -232,8 +256,8 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@Override
@RequestMapping(value = "listBookGroup4Channel", method = RequestMethod.POST)
public ResponseDto<PageBean> listBookGroup4Channel(@RequestHeader("token") String token,
@RequestBody ListBookGroup4ChannelParamVO listBookGroup4ChannelParamVO) throws BizException, PermissionException {
public ResponseDto<PageBean> listBookGroup4Channel( @RequestHeader("token") String token,
@RequestBody ListBookGroup4ChannelParamVO listBookGroup4ChannelParamVO ) throws BizException, PermissionException {
Long channelId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
PageBean pageBean = bookGroupBiz.listBookGroup4Channel(channelId, listBookGroup4ChannelParamVO);
return new ResponseDto<>(pageBean);
......@@ -241,12 +265,12 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@Override
@RequestMapping(value = "getUserBrowseGroup4KnowLedgeMall", method = RequestMethod.GET)
public ResponseDto<?> getUserBrowseGroup4KnowLedgeMall(@CookieValue("userInfo")String userInfo,
public ResponseDto<?> getUserBrowseGroup4KnowLedgeMall( @CookieValue("userInfo") String userInfo,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage) throws BizException, PermissionException {
@RequestParam(value = "numPerPage", required = false) Integer numPerPage ) throws BizException, PermissionException {
Long channelId = Cookie.getId(userInfo, Cookie._CHANNEL_ID);
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
PageBeanNew<GroupStoreMyPayDto> resultInfos= bookGroupBiz.getUserBrowseGroup4KnowLedgeMall(channelId, wechatUserId, currentPage, numPerPage);
PageBeanNew<GroupStoreMyPayDto> resultInfos = bookGroupBiz.getUserBrowseGroup4KnowLedgeMall(channelId, wechatUserId, currentPage, numPerPage);
return new ResponseDto<>(resultInfos);
}
......@@ -255,10 +279,10 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
*/
@Override
@RequestMapping(value = "listSimpleBookGroup4Adviser", method = RequestMethod.GET)
public ResponseDto<?> listSimpleBookGroup4Adviser(@RequestHeader("token") String token,
public ResponseDto<?> listSimpleBookGroup4Adviser( @RequestHeader("token") String token,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage)
@RequestParam(value = "numPerPage", required = false) Integer numPerPage )
throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
Map<String, Object> paramMap = new HashMap<>();
......@@ -279,10 +303,10 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
*/
@Override
@RequestMapping(value = "listBook4CreateBookGroup", method = RequestMethod.GET)
public ResponseDto<?> listBook4CreateBookGroup(@RequestHeader("token") String token,
public ResponseDto<?> listBook4CreateBookGroup( @RequestHeader("token") String token,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage)
@RequestParam(value = "numPerPage", required = false) Integer numPerPage )
throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
......@@ -297,14 +321,14 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@Override
@PostMapping("updateRankType")
public ResponseDto<?> updateRankType(@RequestHeader("token") String token, @RequestBody UpdateRankTypeVO updateRankTypeVO) throws BizException {
public ResponseDto<?> updateRankType( @RequestHeader("token") String token, @RequestBody UpdateRankTypeVO updateRankTypeVO ) throws BizException {
bookGroupBiz.updateRankType(updateRankTypeVO.getBookGroupId(), updateRankTypeVO.getRankType());
return new ResponseDto<>();
}
@Override
@GetMapping("getRankType")
public ResponseDto<Integer> getRankType(@RequestHeader("token") String token, @RequestParam("bookGroupId") Long bookGroupId) throws BizException {
public ResponseDto<Integer> getRankType( @RequestHeader("token") String token, @RequestParam("bookGroupId") Long bookGroupId ) throws BizException {
Integer rankType = bookGroupBiz.getRankType(bookGroupId);
return new ResponseDto<>(rankType == null ? 0 : rankType);
}
......@@ -314,7 +338,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
*/
@Override
@RequestMapping(value = "getTotalBookGroupCount", method = RequestMethod.GET)
public ResponseDto<?> getTotalBookGroupCount(@RequestHeader("token") String token) throws BizException, PermissionException, JsonParseException {
public ResponseDto<?> getTotalBookGroupCount( @RequestHeader("token") String token ) throws BizException, PermissionException, JsonParseException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(bookGroupBiz.getTotalBookGroupCount(adviserId));
}
......@@ -324,8 +348,8 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
*/
@Override
@RequestMapping(value = "listSimpleBookGroupClassify4Adviser", method = RequestMethod.POST)
public ResponseDto<?> listSimpleBookGroupClassify4Adviser(@RequestHeader("token") String token,
@RequestBody BookGroupClassify bookGroupClassify)
public ResponseDto<?> listSimpleBookGroupClassify4Adviser( @RequestHeader("token") String token,
@RequestBody BookGroupClassify bookGroupClassify )
throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (null == bookGroupClassify) {
......@@ -340,7 +364,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@Override
@RequestMapping(value = "isSpecialAgent", method = RequestMethod.GET)
public ResponseDto<Boolean> isSpecialAgent(@RequestHeader("token") String token) throws BizException, PermissionException {
public ResponseDto<Boolean> isSpecialAgent( @RequestHeader("token") String token ) throws BizException, PermissionException {
Long agentId = (Long) SessionUtil.getVlaue(token, SessionUtil.TENANT_ID);
return new ResponseDto<>(bookGroupBiz.isSpecialAgent(agentId));
}
......@@ -353,22 +377,22 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage,
@RequestParam("bookGroupId") Long bookGroupId,
@RequestParam(value = "qrcodeId",required = false) Long qrcodeId
@RequestParam(value = "qrcodeId", required = false) Long qrcodeId
) throws BizException, PermissionException {
Long partyId=(Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (currentPage==null||currentPage<0||numPerPage==null||numPerPage<=0){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"分页参数错误!");
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (currentPage == null || currentPage < 0 || numPerPage == null || numPerPage <= 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "分页参数错误!");
}
if (bookGroupId==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"社群码id不能为空!");
if (bookGroupId == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "社群码id不能为空!");
}
return new ResponseDto<>(bookGroupBiz.getAppStatistics(currentPage,numPerPage,bookGroupId,qrcodeId,partyId));
return new ResponseDto<>(bookGroupBiz.getAppStatistics(currentPage, numPerPage, bookGroupId, qrcodeId, partyId));
}
@Override
@ApiOperation(value = "导出社群码(编辑)", httpMethod = "GET")
@RequestMapping(value = "exportGroupQrcode4Adviser", method = RequestMethod.GET)
public ResponseDto<?> exportGroupQrcode4Adviser(@RequestHeader("token") String token,
public ResponseDto<?> exportGroupQrcode4Adviser( @RequestHeader("token") String token,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "bookName", required = false) String bookName,
@RequestParam(value = "isbn", required = false) String isbn,
......@@ -379,7 +403,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@RequestParam(value = "bookId", required = false) Integer bookId,
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate,
@RequestParam(value = "joinGroupType", required = false) Integer joinGroupType)
@RequestParam(value = "joinGroupType", required = false) Integer joinGroupType )
throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
Map<String, Object> paramMap = new HashMap<>();
......@@ -409,8 +433,8 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@RequestParam("bookId") Long bookId
) throws BizException, PermissionException, JsonParseException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if(bookId==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"bookId不能为空!");
if (bookId == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "bookId不能为空!");
}
return new ResponseDto<>(bookGroupBiz.getBookGroupStatistics(bookId));
}
......@@ -423,8 +447,8 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@RequestParam("bookId") Long bookId
) throws BizException, PermissionException, JsonParseException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if(bookId==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"bookId不能为空!");
if (bookId == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "bookId不能为空!");
}
return new ResponseDto<>(bookGroupBiz.getBookGroupKeywordStatistics(bookId));
}
......@@ -532,15 +556,15 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
}
@Override
@RequestMapping(value = "getBookGroupStatisByBookGroupId",method = RequestMethod.GET)
public ResponseDto<?> getBookGroupStatisByBookGroupId(@RequestParam("bookGroupId")Long bookGroupId) throws BizException {
@RequestMapping(value = "getBookGroupStatisByBookGroupId", method = RequestMethod.GET)
public ResponseDto<?> getBookGroupStatisByBookGroupId( @RequestParam("bookGroupId") Long bookGroupId ) throws BizException {
return new ResponseDto<>(bookGroupBiz.getBookGroupStatisByBookGroupId(bookGroupId));
}
@Override
@RequestMapping(value ="getGroupIncomeStatic",method = RequestMethod.POST)
public ResponseDto<PageBeanNew<ResourcesStatisticVO>> getGroupIncomeStatic(@RequestHeader("token") String token,
@RequestBody GroupIncomeStaticParamVO groupIncomeStaticParamVO) throws BizException, PermissionException {
@RequestMapping(value = "getGroupIncomeStatic", method = RequestMethod.POST)
public ResponseDto<PageBeanNew<ResourcesStatisticVO>> getGroupIncomeStatic( @RequestHeader("token") String token,
@RequestBody GroupIncomeStaticParamVO groupIncomeStaticParamVO ) throws BizException, PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long adviserId = (Long) map.get(SessionUtil.PARTY_ID);
PageBeanNew<ResourcesStatisticVO> groupIncomeStatic = bookGroupBiz.getGroupIncomeStatic(groupIncomeStaticParamVO, adviserId);
......@@ -548,9 +572,9 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
}
@Override
@RequestMapping(value ="getGroupScanTrend",method = RequestMethod.POST)
public ResponseDto<List<GroupScanTrendVO>> getGroupScanTrend(@RequestHeader("token") String token,
@RequestBody GroupScanTrendParamVO groupScanTrendParamVO) throws BizException, PermissionException {
@RequestMapping(value = "getGroupScanTrend", method = RequestMethod.POST)
public ResponseDto<List<GroupScanTrendVO>> getGroupScanTrend( @RequestHeader("token") String token,
@RequestBody GroupScanTrendParamVO groupScanTrendParamVO ) throws BizException, PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long adviserId = (Long) map.get(SessionUtil.PARTY_ID);
List<GroupScanTrendVO> groupScanTrend = bookGroupBiz.getGroupScanTrend(groupScanTrendParamVO, adviserId);
......@@ -558,22 +582,22 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
}
@Override
@RequestMapping(value ="getClassifyStatistic",method = RequestMethod.GET)
public ResponseDto<?> getClassifyStatistic(@RequestHeader("token") String token,
@RequestParam(value = "bookGroupId",required = true) Long bookGroupId,
@RequestParam(value = "currentPage",required = true) Integer currentPage,
@RequestParam(value = "numPerPage",required = true) Integer numPerPage) throws BizException, PermissionException {
@RequestMapping(value = "getClassifyStatistic", method = RequestMethod.GET)
public ResponseDto<?> getClassifyStatistic( @RequestHeader("token") String token,
@RequestParam(value = "bookGroupId", required = true) Long bookGroupId,
@RequestParam(value = "currentPage", required = true) Integer currentPage,
@RequestParam(value = "numPerPage", required = true) Integer numPerPage ) throws BizException, PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long adviserId = (Long) map.get(SessionUtil.PARTY_ID);
PageBeanNew<GroupStatisticVO> groupQrcodeStatistic = bookGroupBiz.getClassifyStatistic(bookGroupId, adviserId,currentPage,numPerPage);
PageBeanNew<GroupStatisticVO> groupQrcodeStatistic = bookGroupBiz.getClassifyStatistic(bookGroupId, adviserId, currentPage, numPerPage);
return new ResponseDto<>(groupQrcodeStatistic);
}
@Override
@RequestMapping(value ="getQrcodeStatistic",method = RequestMethod.GET)
public ResponseDto<?> getQrcodeStatistic(@RequestHeader("token") String token,
@RequestParam(value = "bookGroupId",required = true) Long bookGroupId,
@RequestParam("classifyId") Long classifyId) throws BizException, PermissionException {
@RequestMapping(value = "getQrcodeStatistic", method = RequestMethod.GET)
public ResponseDto<?> getQrcodeStatistic( @RequestHeader("token") String token,
@RequestParam(value = "bookGroupId", required = true) Long bookGroupId,
@RequestParam("classifyId") Long classifyId ) throws BizException, PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long adviserId = (Long) map.get(SessionUtil.PARTY_ID);
List<WxGroupStatisticVO> qrcodeStatistic = bookGroupBiz.getQrcodeStatistic(bookGroupId, classifyId, adviserId);
......@@ -581,10 +605,10 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
}
@Override
@RequestMapping(value ="getTotalRescourceData",method = RequestMethod.GET)
public ResponseDto<?> getTotalRescourceData(@RequestHeader("token") String token, @RequestParam(value = "bookGroupId",required = true) Long bookGroupId,
@RequestParam(value = "classifyId",required = false) Long classifyId, @RequestParam(value = "qrcodeId",required = false) Long qrcodeId,
@RequestParam("type") String type) throws BizException, PermissionException {
@RequestMapping(value = "getTotalRescourceData", method = RequestMethod.GET)
public ResponseDto<?> getTotalRescourceData( @RequestHeader("token") String token, @RequestParam(value = "bookGroupId", required = true) Long bookGroupId,
@RequestParam(value = "classifyId", required = false) Long classifyId, @RequestParam(value = "qrcodeId", required = false) Long qrcodeId,
@RequestParam("type") String type ) throws BizException, PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long adviserId = (Long) map.get(SessionUtil.PARTY_ID);
TotalRescourceDataVO totalRescourceData = bookGroupBiz.getTotalRescourceData(bookGroupId, adviserId, classifyId, qrcodeId, type);
......@@ -592,9 +616,9 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
}
@Override
@RequestMapping(value ="exportRescourceIncomeData",method = RequestMethod.GET)
public ResponseDto<?> exportRescourceIncomeData(@RequestHeader("token") String token,
@RequestParam(value = "bookGroupId",required = true) Long bookGroupId) throws BizException, PermissionException {
@RequestMapping(value = "exportRescourceIncomeData", method = RequestMethod.GET)
public ResponseDto<?> exportRescourceIncomeData( @RequestHeader("token") String token,
@RequestParam(value = "bookGroupId", required = true) Long bookGroupId ) throws BizException, PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long adviserId = (Long) map.get(SessionUtil.PARTY_ID);
Map<String, String> resultMap = bookGroupBiz.exportRescourceIncomeData(bookGroupId, adviserId);
......@@ -606,7 +630,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
public ResponseDto<PageBeanNew<FriendsVO>> listPageFriendsStatistic(
@RequestHeader("token") String token, @RequestParam(value = "bookGroupId", required = true) Long bookGroupId,
@RequestParam(value = "currentPage", required = true) Integer currentPage,
@RequestParam(value = "numPerPage", required = true) Integer numPerPage) throws BizException, PermissionException {
@RequestParam(value = "numPerPage", required = true) Integer numPerPage ) throws BizException, PermissionException {
SessionUtil.getToken4Redis(token);
PageBeanNew<FriendsVO> pageBeanNew = bookGroupBiz.listPageFriendsStatistic(bookGroupId, currentPage, numPerPage);
return new ResponseDto<>(pageBeanNew);
......@@ -669,7 +693,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@RequestParam("numPerPage") Integer numPerPage
) throws BizException, PermissionException, JsonParseException {
Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
return new ResponseDto<>(bookGroupBiz.getBookGroupServeList4Wechat(bookGroupId,currentPage,numPerPage));
return new ResponseDto<>(bookGroupBiz.getBookGroupServeList4Wechat(bookGroupId, currentPage, numPerPage));
}
@ApiOperation("获取资源配置集合(特殊二维码用)")
......@@ -694,7 +718,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@Override
@PostMapping("listPageBookGroupAnalysis")
public ResponseDto<PageBeanNew<BookGroupAnalysisVO>> listPageBookGroupAnalysis(
@RequestHeader("token") String token, @RequestBody @ApiParam BookGroupAnalysisParam bookGroupAnalysisParam) throws PermissionException {
@RequestHeader("token") String token, @RequestBody @ApiParam BookGroupAnalysisParam bookGroupAnalysisParam ) throws PermissionException {
SessionUtil.getToken4Redis(token);
if (null == bookGroupAnalysisParam) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数为空");
......@@ -709,7 +733,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@Override
@PostMapping("exportBookGroupAnalysis")
public ResponseDto<?> exportBookGroupAnalysis(
@RequestHeader("token") String token, @RequestBody @ApiParam BookGroupAnalysisParam bookGroupAnalysisParam) throws PermissionException {
@RequestHeader("token") String token, @RequestBody @ApiParam BookGroupAnalysisParam bookGroupAnalysisParam ) throws PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
String isSystem = (String) map.get(SessionUtil.IS_SYSTEM);
Long partyId = (Long) map.get(SessionUtil.PARTY_ID);
......@@ -776,7 +800,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@RequestParam("channelId") Long channelId
) throws PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(bookGroupBiz.getDTOByBookId(bookId,channelId,partyId));
return new ResponseDto<>(bookGroupBiz.getDTOByBookId(bookId, channelId, partyId));
}
@ApiOperation("根据类型获取社群书数量")
......@@ -819,7 +843,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new PermissionException(PermissionException.PERMISSION_NOT_FOUND);
}
return new ResponseDto<>(bookGroupBiz.getAddFriendCountByTime(timeType,startTime,endTime));
return new ResponseDto<>(bookGroupBiz.getAddFriendCountByTime(timeType, startTime, endTime));
}
@ApiOperation("获取出版社创建社群书数量排行")
......@@ -861,7 +885,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@RequestParam(value = "agentId", required = false) Long agentId,
@RequestParam(value = "isSpecial", required = false) Boolean isSpecial,
@RequestParam(value = "currentPage") Integer currentPage,
@RequestParam(value = "numPerPage") Integer numPerPage) throws PermissionException {
@RequestParam(value = "numPerPage") Integer numPerPage ) throws PermissionException {
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new PermissionException(PermissionException.PERMISSION_NOT_FOUND);
......@@ -875,15 +899,15 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
public ResponseDto<?> exportAgentStatisticsInfo(
@RequestHeader("token") String token,
@RequestParam(value = "agentId", required = false) Long agentId,
@RequestParam(value = "isSpecial", required = false) Boolean isSpecial) throws PermissionException {
Map<String,Object> map = SessionUtil.getToken4Redis(token);
String isSystem = (String)map.get(SessionUtil.IS_SYSTEM);
String systemCode = (String)map.get(SessionUtil.SYSTEM_CODE);
@RequestParam(value = "isSpecial", required = false) Boolean isSpecial ) throws PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
String isSystem = (String) map.get(SessionUtil.IS_SYSTEM);
String systemCode = (String) map.get(SessionUtil.SYSTEM_CODE);
Long partyId = (Long) map.get(SessionUtil.PARTY_ID);
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new PermissionException(PermissionException.PERMISSION_NOT_FOUND);
}
if (IsSystem.NOT_SYSTEM.code.equals(isSystem)){
if (IsSystem.NOT_SYSTEM.code.equals(isSystem)) {
partyId = (Long) map.get(SessionUtil.MEMBER_ID);
}
bookGroupBiz.exportAgentStatisticsInfo(partyId, agentId, isSpecial);
......@@ -930,10 +954,10 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new PermissionException(PermissionException.PERMISSION_NOT_FOUND);
}
Map<String,Object> map = SessionUtil.getToken4Redis(token);
String isSystem = (String)map.get(SessionUtil.IS_SYSTEM);
Map<String, Object> map = SessionUtil.getToken4Redis(token);
String isSystem = (String) map.get(SessionUtil.IS_SYSTEM);
Long partyId = (Long) map.get(SessionUtil.PARTY_ID);
if (IsSystem.NOT_SYSTEM.code.equals(isSystem)){
if (IsSystem.NOT_SYSTEM.code.equals(isSystem)) {
partyId = (Long) map.get(SessionUtil.MEMBER_ID);
}
bookGroupBiz.exportSelfBookGroupStatistics(selfBookGroupStParamDTO, systemCode, partyId);
......@@ -945,40 +969,40 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@PostMapping("listUser4SelfPush")
@Override
public ResponseDto<PageBeanNew<UserBookInfoVO>> listUser4SelfPush(
@RequestHeader("token") String token, @RequestBody @ApiParam UserSelectParamDTO userSelectParamDTO) throws PermissionException {
@RequestHeader("token") String token, @RequestBody @ApiParam UserSelectParamDTO userSelectParamDTO ) throws PermissionException {
SessionUtil.getToken4Redis(token);
if (null == userSelectParamDTO || null == userSelectParamDTO.getCurrentPage() || null == userSelectParamDTO.getNumPerPage()) {
throw new WechatGroupBizException(WechatGroupBizException.PARAM_IS_NULL, "缺少参数");
}
if (StringUtil.isEmpty(userSelectParamDTO.getRobotId())){
if (StringUtil.isEmpty(userSelectParamDTO.getRobotId())) {
throw new WechatGroupBizException(WechatGroupBizException.PARAM_IS_NULL, "请选择个人号");
}
PageBeanNew<UserBookInfoVO> pageBeanNew = bookGroupBiz.listUser4SelfPush(userSelectParamDTO);
return new ResponseDto<>(pageBeanNew);
}
@ApiOperation(value = "编辑端,个人号群发-用户列表查询",httpMethod = "GET")
@ApiOperation(value = "编辑端,个人号群发-用户列表查询", httpMethod = "GET")
@GetMapping("listUser4SelfPushByAdvise")
@Override
public ResponseDto<PageBeanNew<UserBookInfoVO>> listUser4SelfPushByAdvise(@RequestHeader("token") String token,
public ResponseDto<PageBeanNew<UserBookInfoVO>> listUser4SelfPushByAdvise( @RequestHeader("token") String token,
@RequestParam(value = "userQuery", required = false) String userQuery,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage,
@RequestParam("bookId") Long bookId) throws PermissionException {
@RequestParam("bookId") Long bookId ) throws PermissionException {
SessionUtil.getToken4Redis(token);
if ( null == currentPage || null == numPerPage) {
if (null == currentPage || null == numPerPage) {
throw new WechatGroupBizException(WechatGroupBizException.PARAM_IS_NULL, "缺少参数");
}
if (null == bookId){
throw new WechatGroupBizException(WechatGroupBizException.PARAM_IS_NULL,"缺少图书Id");
if (null == bookId) {
throw new WechatGroupBizException(WechatGroupBizException.PARAM_IS_NULL, "缺少图书Id");
}
Map<String,Object> userSelectParam = new HashMap<>();
userSelectParam.put("currentPage",currentPage);
userSelectParam.put("numPerPage",numPerPage);
userSelectParam.put("bookId",bookId);
if (!StringUtil.isEmpty(userQuery)){
userSelectParam.put("userQuery",userQuery);
Map<String, Object> userSelectParam = new HashMap<>();
userSelectParam.put("currentPage", currentPage);
userSelectParam.put("numPerPage", numPerPage);
userSelectParam.put("bookId", bookId);
if (!StringUtil.isEmpty(userQuery)) {
userSelectParam.put("userQuery", userQuery);
}
PageBeanNew<UserBookInfoVO> pageBeanNew = bookGroupBiz.listUser4SelfPushByAdvise(userSelectParam);
......@@ -990,7 +1014,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@GetMapping("getRandomCode")
@Override
public ResponseDto<?> getRandomCode(
@CookieValue("userInfo")String userInfo
@CookieValue("userInfo") String userInfo
) throws PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
return new ResponseDto<>(bookGroupBiz.getRandomCode(wechatUserId));
......@@ -998,14 +1022,14 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@Override
@PostMapping("changeQrCodeType")
public ResponseDto<?> changeQrCodeType(@RequestHeader("token") String token, @RequestBody @Validated ChangeQrCodeTypeDto changeQrCodeTypeDto) throws PermissionException {
public ResponseDto<?> changeQrCodeType( @RequestHeader("token") String token, @RequestBody @Validated ChangeQrCodeTypeDto changeQrCodeTypeDto ) throws PermissionException {
Map<String, Object> token4Redis = SessionUtil.getToken4Redis(token);
return new ResponseDto<>(bookGroupBiz.changeQrCodeType(changeQrCodeTypeDto));
}
@Override
@GetMapping("getChangeQrChangeTarget")
public ResponseDto<?> getChangeQrChangeTarget(@RequestParam("id") Long id, @RequestParam("type") String type) {
public ResponseDto<?> getChangeQrChangeTarget( @RequestParam("id") Long id, @RequestParam("type") String type ) {
Long newBookGroupId = bookGroupBiz.getChangeQrChangeTarget(id, type);
return new ResponseDto<>(newBookGroupId);
}
......@@ -1020,7 +1044,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@RequestParam("numPerPage") Integer numPerPage,
@RequestParam("channelId") Long channelId,
@RequestParam("serveId") Long serveId,
@RequestParam("serveType") String serveType)
@RequestParam("serveType") String serveType )
throws BizException, PermissionException {
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage <= 0) {
throw BookBizException.PAGE_PARAM_DELETION;
......@@ -1045,8 +1069,8 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@RequestParam("serveId") Long serveId,
@RequestParam("serveType") String serveType,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage)
throws BizException, PermissionException{
@RequestParam("numPerPage") Integer numPerPage )
throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("channelId", channelId);
......@@ -1059,7 +1083,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@Override
@GetMapping("updateSpecialState")
public ResponseDto<?> updateSpecialState(@RequestParam("id") Long id, @RequestParam("belongSpecialAgent") Boolean belongSpecialAgent) {
public ResponseDto<?> updateSpecialState( @RequestParam("id") Long id, @RequestParam("belongSpecialAgent") Boolean belongSpecialAgent ) {
bookGroupBiz.updateSpecialState(id, belongSpecialAgent);
return new ResponseDto<>();
}
......@@ -1081,7 +1105,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@Override
@GetMapping("getClassifyKeywordStatistic")
public ResponseDto<List<ListKeywordVO>> getClassifyKeywordStatistic(
@RequestHeader("token") String token, @RequestParam("classifyId") Long classifyId) throws PermissionException {
@RequestHeader("token") String token, @RequestParam("classifyId") Long classifyId ) throws PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (classifyId == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "classifyId不能为空!");
......@@ -1098,14 +1122,14 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@RequestBody WxWechatUserCorrelation wxWechatUserCorrelation
) throws BizException, PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
bookGroupBiz.createWxWechatUserCorrelation(wechatUserId,wxWechatUserCorrelation);
bookGroupBiz.createWxWechatUserCorrelation(wechatUserId, wxWechatUserCorrelation);
return new ResponseDto<>();
}
@ApiOperation(value = "共读活动-用户列表查询", httpMethod = "POST")
@PostMapping("listUser4ReadingActivity")
@Override
public ResponseDto<PageBeanNew<UserBookInfoVO>> listUser4ReadingActivity(@RequestHeader("token") String token, @RequestBody @ApiParam UserSelectParamDTO userSelectParamDTO) throws PermissionException {
public ResponseDto<PageBeanNew<UserBookInfoVO>> listUser4ReadingActivity( @RequestHeader("token") String token, @RequestBody @ApiParam UserSelectParamDTO userSelectParamDTO ) throws PermissionException {
SessionUtil.getToken4Redis(token);
if (null == userSelectParamDTO || null == userSelectParamDTO.getCurrentPage() || null == userSelectParamDTO.getNumPerPage()) {
throw new WechatGroupBizException(WechatGroupBizException.PARAM_IS_NULL, "缺少参数");
......@@ -1116,8 +1140,8 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@Override
@GetMapping("getBookGroupAppletByBookGroupId")
public ResponseDto<BookAppletSceneDTO> getBookGroupAppletByBookGroupId(@RequestParam("bookGroupId") Long bookGroupId){
if (null==bookGroupId){
public ResponseDto<BookAppletSceneDTO> getBookGroupAppletByBookGroupId( @RequestParam("bookGroupId") Long bookGroupId ) {
if (null == bookGroupId) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "bookGroupId不能为空!");
}
return new ResponseDto<>(bookGroupBiz.getBookGroupAppletByBookGroupId(bookGroupId));
......@@ -1125,8 +1149,8 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@Override
@GetMapping("getBookGroupId4OldData")
public ResponseDto<Long> getBookGroupId4OldData(@RequestParam("raysBookId") Long raysBookId){
if (null==raysBookId){
public ResponseDto<Long> getBookGroupId4OldData( @RequestParam("raysBookId") Long raysBookId ) {
if (null == raysBookId) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "raysBookId不能为空!");
}
return new ResponseDto<>(bookGroupBiz.getBookGroupId4OldData(raysBookId));
......@@ -1134,33 +1158,33 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@Override
@GetMapping("getByAppletScene")
public ResponseDto<?> getByAppletScene(@CookieValue("userInfo") String userInfo,@RequestParam("scene") String scene){
if (StringUtil.isEmpty(scene)){
public ResponseDto<?> getByAppletScene( @CookieValue("userInfo") String userInfo, @RequestParam("scene") String scene ) {
if (StringUtil.isEmpty(scene)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "scene不能为空!");
}
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
bookGroupBiz.getByAppletScene(wechatUserId,scene);
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
bookGroupBiz.getByAppletScene(wechatUserId, scene);
return new ResponseDto<>();
}
@Override
@GetMapping("getBookAndBookGroupServeList")
public ResponseDto<?> getBookAndBookGroupServeList(
@RequestParam("adviserId") Long adviserId, @RequestParam("bookId")Long bookId, @RequestParam("channelId")Long channelId){
if (null==adviserId||null==bookId||null==channelId){
@RequestParam("adviserId") Long adviserId, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId ) {
if (null == adviserId || null == bookId || null == channelId) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数缺失!");
}
return new ResponseDto<>(bookGroupBiz.getBookAndBookGroupServeList(adviserId,bookId,channelId));
return new ResponseDto<>(bookGroupBiz.getBookAndBookGroupServeList(adviserId, bookId, channelId));
}
@Override
@GetMapping("getBookBaseInfo4Applet")
public ResponseDto<?> getBookBaseInfo4Applet(
@RequestParam("adviserId") Long adviserId, @RequestParam("bookId")Long bookId, @RequestParam("channelId")Long channelId){
if (null==adviserId||null==bookId||null==channelId){
@RequestParam("adviserId") Long adviserId, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId ) {
if (null == adviserId || null == bookId || null == channelId) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数缺失!");
}
return new ResponseDto<>(bookGroupBiz.getBookBaseInfo4Applet(adviserId,channelId,bookId));
return new ResponseDto<>(bookGroupBiz.getBookBaseInfo4Applet(adviserId, channelId, bookId));
}
}
package com.pcloud.book.group.tools;
import com.pcloud.book.group.vo.ExcelDataVO;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class BookExcelReader {
public static List<ExcelDataVO> readExcel( MultipartFile file ) throws IOException {
//获取文件名称
try (InputStream in = file.getInputStream()) {
// 读取excel中的数据
Workbook workbook = judegExcelEdition(file.getOriginalFilename()) ? new XSSFWorkbook(in) : new HSSFWorkbook(in);
return parseExcel(workbook);
}
}
private static boolean judegExcelEdition( String fileName ) {
return !fileName.matches("^.+\\.(?i)(xls)$");
}
private static List<ExcelDataVO> parseExcel( Workbook workbook ) {
List<ExcelDataVO> resultDataList = new ArrayList<>();
// 解析sheet
for (int sheetNum = 0; sheetNum < workbook.getNumberOfSheets(); sheetNum++) {
Sheet sheet = workbook.getSheetAt(sheetNum);
// 校验sheet是否合法
if (sheet == null) {
continue;
}
// 获取第一行数据
int firstRowNum = sheet.getFirstRowNum();
Row firstRow = sheet.getRow(firstRowNum);
if (null == firstRow) {
log.warn("解析Excel失败,在第一行没有读取到任何数据!");
}
// 解析每一行的数据,构造数据对象
int rowStart = firstRowNum + 1;
int rowEnd = sheet.getPhysicalNumberOfRows();
for (int rowNum = rowStart; rowNum < rowEnd; rowNum++) {
Row row = sheet.getRow(rowNum);
if (null == row) {
continue;
}
ExcelDataVO resultData = convertRowToData(row);
resultDataList.add(resultData);
}
}
return resultDataList;
}
private static String convertCellValueToString( Cell cell ) {
if (cell == null) {
return null;
}
String returnValue = null;
switch (cell.getCellType()) {
case Cell.CELL_TYPE_NUMERIC: //数字
Double doubleValue = cell.getNumericCellValue();
// 格式化科学计数法,取一位整数
DecimalFormat df = new DecimalFormat("0");
returnValue = df.format(doubleValue);
break;
case Cell.CELL_TYPE_STRING: //字符串
returnValue = cell.getStringCellValue();
break;
case Cell.CELL_TYPE_BOOLEAN: //布尔
boolean booleanValue = cell.getBooleanCellValue();
returnValue = Boolean.toString(booleanValue);
break;
case Cell.CELL_TYPE_BLANK: // 空值
break;
case Cell.CELL_TYPE_FORMULA: // 公式
returnValue = cell.getCellFormula();
break;
case Cell.CELL_TYPE_ERROR: // 故障
break;
default:
break;
}
return returnValue;
}
private static ExcelDataVO convertRowToData( Row row ) {
ExcelDataVO resultData = new ExcelDataVO();
Cell cell;
int cellNum = 0;
// 序号
cell = row.getCell(cellNum++);
String num = convertCellValueToString(cell);
resultData.setNum(Integer.parseInt(num));
// 出版社名称
cell = row.getCell(cellNum++);
String agentName = convertCellValueToString(cell);
resultData.setAgentName(agentName);
// 书名
cell = row.getCell(cellNum++);
String bookName = convertCellValueToString(cell);
resultData.setBookName(bookName);
// isbn
cell = row.getCell(cellNum++);
String isbn = convertCellValueToString(cell);
resultData.setIsbn(isbn);
// 分类
cell = row.getCell(cellNum++);
String type = convertCellValueToString(cell);
resultData.setType(type);
// 二维码数量
cell = row.getCell(cellNum++);
String qrcodeNum = convertCellValueToString(cell);
resultData.setQrcodeNum(Objects.isNull(qrcodeNum) ? 0 : Integer.parseInt(qrcodeNum));
return resultData;
}
}
\ No newline at end of file
package com.pcloud.book.group.vo;
import lombok.Data;
@Data
public class ExcelDataVO {
/**
* 序号
*/
private Integer num;
/**
* 出版社名称
*/
private String agentName;
/**
* 书名
*/
private String bookName;
/**
* isbn
*/
private String isbn;
/**
* 分类
*/
private String type;
/**
* 二维码数量
*/
private Integer qrcodeNum;
}
......@@ -36,6 +36,8 @@ public class BookProps {
private static String systemEnv;
private static String wechatDomain;
public static String getJisuAppKey() {
return jisuAppKey;
}
......@@ -81,4 +83,13 @@ public class BookProps {
public void setSystemEnv(String systemEnv) {
BookProps.systemEnv = systemEnv;
}
public static String getWechatDomain() {
return wechatDomain;
}
@Value("${wechat.group.link.prefix}")
public void setWechatDomain( String wechatDomain ) {
BookProps.wechatDomain = wechatDomain;
}
}
......@@ -948,6 +948,14 @@
SELECT book_group_id FROM book_group_old_data WHERE rays_book_id = #{raysBookId}
</select>
<select id="getOldDataMax" resultType="Long">
SELECT max(rays_book_id) FROM book_group_old_data
</select>
<insert id="insertOldData" parameterType="Long">
insert into book_group_old_data (rays_book_id) value (#{id})
</insert>
<select id="getIdByBookNameAndJoinGroupType" resultType="long" parameterType="map">
select
t.id
......
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