Commit cc750eb7 by zx1234zxcv2022

feat[1009521] 版权保护新增时间段搜索&&导出筛选的全部数据

parent 304d71a1
...@@ -59,14 +59,18 @@ public interface BookAuthCodeBiz { ...@@ -59,14 +59,18 @@ public interface BookAuthCodeBiz {
/** /**
* 获取正版授权码 * 获取正版授权码
*
* @param dateList
* @param bookId * @param bookId
* @param channelId * @param channelId
* @param keyword * @param keyword
* @param state * @param state
* @param pageParam * @param pageParam
* @param startDate
* @param endDate
* @return * @return
*/ */
PageBeanNew<BookAuthCodeDTO> getCodeList(Long bookId, Long channelId, Long adviserId, String keyword, Integer state, Integer authBookType, PageParam pageParam); PageBeanNew<BookAuthCodeDTO> getCodeList(Long bookId, Long channelId, Long adviserId, String keyword, Integer state, Integer authBookType, PageParam pageParam, String startDate, String endDate);
/** /**
* 批量删除正版授权码 * 批量删除正版授权码
...@@ -102,4 +106,9 @@ public interface BookAuthCodeBiz { ...@@ -102,4 +106,9 @@ public interface BookAuthCodeBiz {
* @Date 16:27 2021/12/13 * @Date 16:27 2021/12/13
**/ **/
void clearAuthCodeUser(Long adviserId, String fullCode, Long bookId); void clearAuthCodeUser(Long adviserId, String fullCode, Long bookId);
/**
* 导出筛选后的全部数据
*/
Map<String, Object> getQueryCodeExcel(Long bookId, Long channelId, Long adviserId, String keyword, Integer state, Integer authBookType, String startDate, String endDate, String systemCode);
} }
...@@ -343,22 +343,28 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz { ...@@ -343,22 +343,28 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
/** /**
* 获取正版授权码 * 获取正版授权码
*
* @param dateList
* @param bookId * @param bookId
* @param channelId * @param channelId
* @param keyword * @param keyword
* @param state * @param state
* @param pageParam * @param pageParam
* @param startDate
* @param endDate
* @return * @return
*/ */
@Override @Override
@ParamLog("获取正版授权码") @ParamLog("获取正版授权码")
public PageBeanNew<BookAuthCodeDTO> getCodeList(Long bookId, Long channelId, Long adviserId, String keyword, Integer state, Integer authBookType, PageParam pageParam) { public PageBeanNew<BookAuthCodeDTO> getCodeList(Long bookId, Long channelId, Long adviserId, String keyword, Integer state, Integer authBookType, PageParam pageParam, String startDate, String endDate) {
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("bookId",bookId); paramMap.put("bookId",bookId);
paramMap.put("channelId",channelId); paramMap.put("channelId",channelId);
paramMap.put("adviserId",adviserId); paramMap.put("adviserId",adviserId);
paramMap.put("keyword",StringUtil.isEmpty(keyword)?null:keyword); paramMap.put("keyword",StringUtil.isEmpty(keyword)?null:keyword);
paramMap.put("state",state); paramMap.put("state",state);
paramMap.put("startDate",StringUtil.isEmpty(startDate)?null:startDate);
paramMap.put("endDate",StringUtil.isEmpty(endDate)?null:endDate);
if(null == authBookType || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)){ if(null == authBookType || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)){
paramMap.put("isPaperBook", 1); paramMap.put("isPaperBook", 1);
} else { } else {
...@@ -690,4 +696,15 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz { ...@@ -690,4 +696,15 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
} }
bookAuthCodeDao.clearUseCount(bookAuthCode.getId()); bookAuthCodeDao.clearUseCount(bookAuthCode.getId());
} }
@Override
public Map<String, Object> getQueryCodeExcel(Long bookId, Long channelId, Long adviserId, String keyword, Integer state, Integer authBookType, String startDate, String endDate, String systemCode) {
List<Long> idList = bookAuthCodeDao.getQueryCodeIdList(bookId, channelId, adviserId, keyword, authBookType, startDate, endDate, state);
if (CollUtil.isEmpty(idList)) {
throw new BookBizException(BookBizException.ID_NOT_EXIST, "没有需要导出的授权码!");
}
String ids = idList.stream().map(String::valueOf).collect(Collectors.joining(","));
Map<String, Object> map = getCodeExcel(bookId, ids, channelId, 1L, systemCode, adviserId, authBookType);
return map;
}
} }
...@@ -69,4 +69,6 @@ public interface BookAuthCodeDao extends BaseDao<BookAuthCode> { ...@@ -69,4 +69,6 @@ public interface BookAuthCodeDao extends BaseDao<BookAuthCode> {
void deleteCode(Long id); void deleteCode(Long id);
Integer updateUseCountById(Long authCodeId, Integer codeUseCount, Long adviserId); Integer updateUseCountById(Long authCodeId, Integer codeUseCount, Long adviserId);
List<Long> getQueryCodeIdList(Long bookId, Long channelId, Long adviserId, String keyWord, Integer authBookType, String startDate, String endDate, Integer state);
} }
...@@ -6,8 +6,10 @@ import com.pcloud.book.copyright.dao.BookAuthCodeDao; ...@@ -6,8 +6,10 @@ import com.pcloud.book.copyright.dao.BookAuthCodeDao;
import com.pcloud.book.copyright.dto.BookAuthCodeDTO; import com.pcloud.book.copyright.dto.BookAuthCodeDTO;
import com.pcloud.book.copyright.entity.BookAuthCode; import com.pcloud.book.copyright.entity.BookAuthCode;
import com.pcloud.book.copyright.dto.HaveUsedAuthCode; import com.pcloud.book.copyright.dto.HaveUsedAuthCode;
import com.pcloud.book.copyright.enums.AuthBookTypeEnum;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
import com.pcloud.common.utils.string.StringUtil;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.HashMap; import java.util.HashMap;
...@@ -144,4 +146,23 @@ public class BookAuthCodeDaoImpl extends BaseDaoImpl<BookAuthCode> implements Bo ...@@ -144,4 +146,23 @@ public class BookAuthCodeDaoImpl extends BaseDaoImpl<BookAuthCode> implements Bo
paramMap.put("adviserId", Optional.ofNullable(adviserId).orElse(0L)); paramMap.put("adviserId", Optional.ofNullable(adviserId).orElse(0L));
return getSqlSession().update(getStatement("updateUseCountById"), paramMap); return getSqlSession().update(getStatement("updateUseCountById"), paramMap);
} }
@Override
public List<Long> getQueryCodeIdList(Long bookId, Long channelId, Long adviserId, String keyWord, Integer authBookType, String startDate, String endDate, Integer state) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("bookId",bookId);
paramMap.put("channelId",channelId);
paramMap.put("adviserId",adviserId);
paramMap.put("keyword", StringUtil.isEmpty(keyWord)?null:keyWord);
paramMap.put("state",state);
paramMap.put("startDate",StringUtil.isEmpty(startDate)?null:startDate);
paramMap.put("endDate",StringUtil.isEmpty(endDate)?null:endDate);
if(null == authBookType || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)){
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
return this.getSqlSession().selectList(this.getStatement("getQueryCodeIdList"), paramMap);
}
} }
...@@ -62,6 +62,8 @@ public interface BookAuthCodeFacade { ...@@ -62,6 +62,8 @@ public interface BookAuthCodeFacade {
@RequestParam(required = false,value = "keyword")String keyword, @RequestParam(required = false,value = "keyword")String keyword,
@RequestParam(required = false,value = "state")Integer state, @RequestParam(required = false,value = "state")Integer state,
@RequestParam(required = false,value = "authBookType")Integer authBookType, @RequestParam(required = false,value = "authBookType")Integer authBookType,
@RequestParam(required = false, value = "startDate")String startDate,
@RequestParam(required = false, value = "endDate")String endDate,
@RequestParam("currentPage") Integer currentPage, @RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage) @RequestParam("numPerPage") Integer numPerPage)
throws PermissionException, BizException; throws PermissionException, BizException;
...@@ -102,4 +104,16 @@ public interface BookAuthCodeFacade { ...@@ -102,4 +104,16 @@ public interface BookAuthCodeFacade {
@RequestParam(required = false,value = "authBookType")Integer authBookType) @RequestParam(required = false,value = "authBookType")Integer authBookType)
throws PermissionException, JsonParseException,BizException; throws PermissionException, JsonParseException,BizException;
@ApiOperation(value = "导出筛选后的全部数据", httpMethod = "GET")
@RequestMapping(value = "/exportQueryCode",method = RequestMethod.GET)
ResponseDto<?> exportQueryCode(@RequestHeader("token") String token,
@RequestParam("bookId") Long bookId,
@RequestParam("channelId") Long channelId,
@RequestParam(required = false,value = "keyword")String keyword,
@RequestParam(required = false,value = "state")Integer state,
@RequestParam(required = false,value = "authBookType")Integer authBookType,
@RequestParam(required = false, value = "startDate")String startDate,
@RequestParam(required = false, value = "endDate")String endDate)
throws PermissionException, JsonParseException,BizException;
} }
...@@ -41,6 +41,7 @@ import org.springframework.web.bind.annotation.RequestMethod; ...@@ -41,6 +41,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -118,6 +119,8 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade { ...@@ -118,6 +119,8 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade {
@RequestParam(required = false,value = "keyword")String keyword, @RequestParam(required = false,value = "keyword")String keyword,
@RequestParam(required = false,value = "state")Integer state, @RequestParam(required = false,value = "state")Integer state,
@RequestParam(required = false,value = "authBookType")Integer authBookType, @RequestParam(required = false,value = "authBookType")Integer authBookType,
@RequestParam(required = false, value = "startDate")String startDate,
@RequestParam(required = false, value = "endDate")String endDate,
@RequestParam(required = false,value = "currentPage")Integer currentPage, @RequestParam(required = false,value = "currentPage")Integer currentPage,
@RequestParam(required = false,value = "numPerPage")Integer numPerPage) throws PermissionException, BizException { @RequestParam(required = false,value = "numPerPage")Integer numPerPage) throws PermissionException, BizException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID); Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
...@@ -128,7 +131,7 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade { ...@@ -128,7 +131,7 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数有误!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数有误!");
} }
PageParam pageParam = new PageParam(currentPage,numPerPage); PageParam pageParam = new PageParam(currentPage,numPerPage);
return new ResponseDto<>(bookAuthCodeBiz.getCodeList(bookId,channelId,adviserId,keyword,state, authBookType, pageParam)); return new ResponseDto<>(bookAuthCodeBiz.getCodeList(bookId,channelId,adviserId,keyword,state, authBookType, pageParam, startDate, endDate));
} }
/** /**
...@@ -168,6 +171,25 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade { ...@@ -168,6 +171,25 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade {
return new ResponseDto<>(map); return new ResponseDto<>(map);
} }
@Override
@RequestMapping(value = "/exportQueryCode", method = RequestMethod.GET)
public ResponseDto<?> exportQueryCode(@RequestHeader("token")String token,
@RequestParam(required = false,value = "bookId") Long bookId,
@RequestParam(required = false,value = "channelId")Long channelId,
@RequestParam(required = false,value = "keyword")String keyword,
@RequestParam(required = false,value = "state")Integer state,
@RequestParam(required = false,value = "authBookType")Integer authBookType,
@RequestParam(required = false, value = "startDate")String startDate,
@RequestParam(required = false, value = "endDate")String endDate) throws PermissionException, JsonParseException, BizException {
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if(null == bookId || null == channelId){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数有误!");
}
Map<String, Object> map = bookAuthCodeBiz.getQueryCodeExcel(bookId, channelId, adviserId, keyword, state, authBookType, startDate, endDate, systemCode);
return new ResponseDto<>(map);
}
/** /**
*一键删除未使用的授权码 *一键删除未使用的授权码
*/ */
......
...@@ -149,6 +149,12 @@ ...@@ -149,6 +149,12 @@
AND AND
is_group_book = #{isGroupBook} is_group_book = #{isGroupBook}
</if> </if>
<if test="startDate != null">
AND created_date &gt;= #{startDate}
</if>
<if test="endDate != null">
AND created_date &lt;= #{endDate}
</if>
order by created_date desc order by created_date desc
</select> </select>
...@@ -284,4 +290,43 @@ ...@@ -284,4 +290,43 @@
id = #{id, jdbcType=BIGINT} id = #{id, jdbcType=BIGINT}
AND use_count <![CDATA[ < ]]> #{codeUseCount} AND use_count <![CDATA[ < ]]> #{codeUseCount}
</update> </update>
<select id="getQueryCodeIdList" parameterType="map" resultType="java.lang.Long">
SELECT
id
FROM
book_auth_code
WHERE
book_id = #{bookId}
AND channel_id = #{channelId}
AND adviser_id = #{adviserId}
<if test="keyword != null">
AND full_code LIKE CONCAT('%', #{keyword}, '%')
</if>
<if test="state != null">
<choose>
<when test="state == 0">
and use_count = 0
</when>
<otherwise>
and use_count > 0
</otherwise>
</choose>
</if>
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
<if test="startDate != null">
AND created_date &gt;= #{startDate}
</if>
<if test="endDate != null">
AND created_date &lt;= #{endDate}
</if>
order by created_date desc
</select>
</mapper> </mapper>
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