Commit 7fdc5be6 by 田超

Merge branch 'feature/1004027' into 'master'

feat: [1004027] 书刊权益列表

See merge request rays/pcloud-book!1105
parents 8346af1e 451e7d99
...@@ -2402,7 +2402,6 @@ public class BookBizImpl implements BookBiz { ...@@ -2402,7 +2402,6 @@ public class BookBizImpl implements BookBiz {
} }
} }
}); });
} }
@Override @Override
...@@ -2508,6 +2507,8 @@ public class BookBizImpl implements BookBiz { ...@@ -2508,6 +2507,8 @@ public class BookBizImpl implements BookBiz {
} }
PageBeanNew<BookDto> page = bookDao.listPageNew(new PageParam(currentPage, numPerPage), map, "getAdviserBooks4Rights"); PageBeanNew<BookDto> page = bookDao.listPageNew(new PageParam(currentPage, numPerPage), map, "getAdviserBooks4Rights");
fillBookInfo(page.getRecordList()); fillBookInfo(page.getRecordList());
bookSet.setProDepPurLabelNames(page.getRecordList());
bookSet.setLabelNames(page.getRecordList());
return page; return page;
} }
......
...@@ -43,6 +43,7 @@ import com.pcloud.book.consumer.erp.ErpConsr; ...@@ -43,6 +43,7 @@ import com.pcloud.book.consumer.erp.ErpConsr;
import com.pcloud.book.consumer.reader.ReaderConsr; import com.pcloud.book.consumer.reader.ReaderConsr;
import com.pcloud.book.consumer.resource.ProductConsr; import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.consumer.user.AdviserConsr; import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.book.consumer.user.PartyConsr;
import com.pcloud.book.cultivate.enums.ReadTypeEnum; import com.pcloud.book.cultivate.enums.ReadTypeEnum;
import com.pcloud.book.custom.biz.CustomPlanBiz; import com.pcloud.book.custom.biz.CustomPlanBiz;
import com.pcloud.book.custom.entity.CustomPlan; import com.pcloud.book.custom.entity.CustomPlan;
...@@ -107,18 +108,22 @@ import com.pcloud.book.skill.dto.GroupActivity4AppletDTO; ...@@ -107,18 +108,22 @@ import com.pcloud.book.skill.dto.GroupActivity4AppletDTO;
import com.pcloud.book.util.common.YesOrNoEnums; import com.pcloud.book.util.common.YesOrNoEnums;
import com.pcloud.channelcenter.qrcode.dto.QrcodeSceneDto; import com.pcloud.channelcenter.qrcode.dto.QrcodeSceneDto;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto; import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
import com.pcloud.comment.base.enums.SysCodeEnum;
import com.pcloud.common.constant.CacheConstant; import com.pcloud.common.constant.CacheConstant;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.constant.ProductTypeConstant; import com.pcloud.common.core.constant.ProductTypeConstant;
import com.pcloud.common.core.constant.SystemCode;
import com.pcloud.common.enums.AppTypeEnum; import com.pcloud.common.enums.AppTypeEnum;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.BeanUtils; import com.pcloud.common.utils.BeanUtils;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.NumberUtil; import com.pcloud.common.utils.NumberUtil;
import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils; import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.common.utils.string.StringUtilParent; import com.pcloud.common.utils.string.StringUtilParent;
import com.pcloud.labelcenter.label.service.LabelService;
import com.pcloud.resourcecenter.product.dto.ProductDto; import com.pcloud.resourcecenter.product.dto.ProductDto;
import com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto; import com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -241,6 +246,10 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -241,6 +246,10 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
private AppletThirdResourcesDao appletThirdResourcesDao; private AppletThirdResourcesDao appletThirdResourcesDao;
@Autowired @Autowired
private BookGroupDao bookGroupDao; private BookGroupDao bookGroupDao;
@Autowired
private LabelService labelService;
@Autowired
private PartyConsr partyConsr;
@Override @Override
@ParamLog("新增权益设置") @ParamLog("新增权益设置")
...@@ -363,15 +372,19 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -363,15 +372,19 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
} else if (Objects.equals(RightsTypeEnum.NOW.code, rightsSetting.getStepType())) { } else if (Objects.equals(RightsTypeEnum.NOW.code, rightsSetting.getStepType())) {
//更新即享权益 //更新即享权益
updateRightNowItemByRightId(rightsSetting); updateRightNowItemByRightId(rightsSetting);
rightsSettingDAO.updateUser(rightsSetting);
} else if (Objects.equals(RightsTypeEnum.WEEK.code, rightsSetting.getStepType())) { } else if (Objects.equals(RightsTypeEnum.WEEK.code, rightsSetting.getStepType())) {
// 更新每周、长期权益 // 更新每周、长期权益
updateRightsWeek(rightsSetting); updateRightsWeek(rightsSetting);
rightsSettingDAO.updateUser(rightsSetting);
} else if (Objects.equals(RightsTypeEnum.LONG_TERM.code, rightsSetting.getStepType())) { } else if (Objects.equals(RightsTypeEnum.LONG_TERM.code, rightsSetting.getStepType())) {
// 更新每周、长期权益 // 更新每周、长期权益
updateRightsLongTerm(rightsSetting); updateRightsLongTerm(rightsSetting);
rightsSettingDAO.updateUser(rightsSetting);
}else if (Objects.equals(RightsTypeEnum.UP_NUMBER.code, rightsSetting.getStepType())) { }else if (Objects.equals(RightsTypeEnum.UP_NUMBER.code, rightsSetting.getStepType())) {
// 更新每周、长期权益 // 更新每周、长期权益
updateNumber(rightsSetting); updateNumber(rightsSetting);
rightsSettingDAO.updateUser(rightsSetting);
} }
} }
...@@ -816,10 +829,112 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -816,10 +829,112 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
setReadType(rightsSetting); setReadType(rightsSetting);
//设置阅读指引 //设置阅读指引
fillReadGuide(rightsSetting); fillReadGuide(rightsSetting);
//填充分类及标签
fillLabelNames(Lists.newArrayList(rightsSetting));
return rightsSetting; return rightsSetting;
} }
private void fillLabelNames(List<RightsSetting> rightsSettingList) {
if (ListUtils.isEmpty(rightsSettingList)) {
return;
}
List<Long> classifyIds = new ArrayList<>();
List<Long> bookLabelIds = new ArrayList<>();
List<Long> labelIds = new ArrayList<>();
rightsSettingList.stream().forEach(rightsSetting -> {
if (null == rightsSetting || ListUtils.isEmpty(rightsSetting.getRightsSettingBookRelations())) {
return;
}
List<RightsSettingBookRelation> rightsSettingBookRelations = rightsSetting.getRightsSettingBookRelations();
rightsSettingBookRelations.stream().forEach(rightsSettingBookRelation -> {
if (null != rightsSettingBookRelation.getTempletId()) {
classifyIds.add(rightsSettingBookRelation.getTempletId());
}
if (null != rightsSettingBookRelation.getSecondTempletId()) {
classifyIds.add(rightsSettingBookRelation.getSecondTempletId());
}
if (null != rightsSettingBookRelation.getGraLabelId()) {
bookLabelIds.add(rightsSettingBookRelation.getGraLabelId());
}
if (null != rightsSettingBookRelation.getSubLabelId()) {
bookLabelIds.add(rightsSettingBookRelation.getSubLabelId());
}
if (null != rightsSettingBookRelation.getVolLabelId()) {
bookLabelIds.add(rightsSettingBookRelation.getVolLabelId());
}
if (null != rightsSettingBookRelation.getVerLabelId()){
bookLabelIds.add(rightsSettingBookRelation.getVerLabelId());
}
if (null != rightsSettingBookRelation.getAreaLabelId()) {
bookLabelIds.add(rightsSettingBookRelation.getAreaLabelId());
}
if (rightsSettingBookRelation.getProLabelId() != null) {
labelIds.add(rightsSettingBookRelation.getProLabelId());
}
if (rightsSettingBookRelation.getPurLabelId() != null) {
labelIds.add(rightsSettingBookRelation.getPurLabelId());
}
if (rightsSettingBookRelation.getDepLabelId() != null) {
labelIds.add(rightsSettingBookRelation.getDepLabelId());
}
});
});
Map<Long, AssistTempletDTO> classifyMap = new HashMap<>();
Map<Long, BookLabel> bookLabelMap = new HashMap<>();
Map<Long, String> labelMap = new HashMap<>();
if (!ListUtils.isEmpty(classifyIds)) {
classifyMap = assistTempletConsr.mapByIds4Classify(classifyIds);
}
if (!ListUtils.isEmpty(bookLabelIds)) {
bookLabelMap = bookLabelDao.getMapByIds(bookLabelIds);
}
if (!ListUtils.isEmpty(labelIds)) {
labelMap = ResponseHandleUtil.parseMap(labelService.getLabelName(labelIds), Long.class, String.class);
}
for (RightsSetting rightsSetting : rightsSettingList) {
if (null == rightsSetting || ListUtils.isEmpty(rightsSetting.getRightsSettingBookRelations())) {
continue;
}
List<RightsSettingBookRelation> rightsSettingBookRelations = rightsSetting.getRightsSettingBookRelations();
for (RightsSettingBookRelation rightsSettingBookRelation : rightsSettingBookRelations) {
if (!MapUtils.isEmpty(classifyMap) && classifyMap.containsKey(rightsSettingBookRelation.getTempletId())) {
rightsSettingBookRelation.setTempletName(classifyMap.get(rightsSettingBookRelation.getTempletId()).getTempletName());
}
if (!MapUtils.isEmpty(classifyMap) && classifyMap.containsKey(rightsSettingBookRelation.getSecondTempletId())) {
rightsSettingBookRelation.setSecondTempletName(classifyMap.get(rightsSettingBookRelation.getSecondTempletId()).getTempletName());
}
if (!MapUtils.isEmpty(bookLabelMap) && bookLabelMap.containsKey(rightsSettingBookRelation.getGraLabelId())) {
rightsSettingBookRelation.setGraLabelName(bookLabelMap.get(rightsSettingBookRelation.getGraLabelId()).getName());
}
if (!MapUtils.isEmpty(bookLabelMap) && bookLabelMap.containsKey(rightsSettingBookRelation.getSubLabelId())) {
rightsSettingBookRelation.setSubLabelName(bookLabelMap.get(rightsSettingBookRelation.getSubLabelId()).getName());
}
if (!MapUtils.isEmpty(bookLabelMap) && bookLabelMap.containsKey(rightsSettingBookRelation.getVolLabelId())) {
rightsSettingBookRelation.setVolLabelName(bookLabelMap.get(rightsSettingBookRelation.getVolLabelId()).getName());
}
if (!MapUtils.isEmpty(bookLabelMap) && bookLabelMap.containsKey(rightsSettingBookRelation.getVerLabelId())) {
rightsSettingBookRelation.setVerLabelName(bookLabelMap.get(rightsSettingBookRelation.getVerLabelId()).getName());
}
if (!MapUtils.isEmpty(bookLabelMap) && bookLabelMap.containsKey(rightsSettingBookRelation.getAreaLabelId())) {
rightsSettingBookRelation.setAreaLabelName(bookLabelMap.get(rightsSettingBookRelation.getAreaLabelId()).getName());
}
//设置深度标签
if (!MapUtils.isEmpty(labelMap) && labelMap.containsKey(rightsSettingBookRelation.getDepLabelId())) {
rightsSettingBookRelation.setDepLabelName(labelMap.get(rightsSettingBookRelation.getDepLabelId()));
}
if (!MapUtils.isEmpty(labelMap) && labelMap.containsKey(rightsSettingBookRelation.getPurLabelId())) {
rightsSettingBookRelation.setPurLabelName(labelMap.get(rightsSettingBookRelation.getPurLabelId()));
}
if (!MapUtils.isEmpty(labelMap) && labelMap.containsKey(rightsSettingBookRelation.getProLabelId())) {
rightsSettingBookRelation.setProLabelName(labelMap.get(rightsSettingBookRelation.getProLabelId()));
}
}
}
}
private void fillReadGuide(RightsSetting rightsSetting){ private void fillReadGuide(RightsSetting rightsSetting){
RightsNowItem rightsNowItem = new RightsNowItem(); RightsNowItem rightsNowItem = new RightsNowItem();
...@@ -925,9 +1040,9 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -925,9 +1040,9 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
} }
List<Long> bookIds = rightsSettingBookRelations.stream().map(e -> e.getBookId()).collect(Collectors.toList()); List<Long> bookIds = rightsSettingBookRelations.stream().map(e -> e.getBookId()).collect(Collectors.toList());
List<Long> adviserIds = rightsSettingBookRelations.stream().map(e -> e.getAdviserId()).collect(Collectors.toList()); List<Long> adviserIds = rightsSettingBookRelations.stream().map(e -> e.getAdviserId()).collect(Collectors.toList());
Map<Long, String> adviserNameMap = new HashMap<>(); Map<Long, AdviserBaseInfoDto> infoDtoMap = adviserConsr.getAdviserId2AdviserInfoDtoMap(adviserIds);
if (!ListUtils.isEmpty(adviserIds)) { if (MapUtils.isEmpty(infoDtoMap)) {
adviserNameMap = adviserConsr.getNames(adviserIds); return;
} }
Map<Long, BookDto> bookDtoMap = bookBiz.getListByIds(bookIds); Map<Long, BookDto> bookDtoMap = bookBiz.getListByIds(bookIds);
if (MapUtils.isEmpty(bookDtoMap)) { if (MapUtils.isEmpty(bookDtoMap)) {
...@@ -939,8 +1054,9 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -939,8 +1054,9 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
rightsSettingBookRelation.setBookName(bookDtoMap.get(rightsSettingBookRelation.getBookId()).getBookName()); rightsSettingBookRelation.setBookName(bookDtoMap.get(rightsSettingBookRelation.getBookId()).getBookName());
rightsSettingBookRelation.setIsbn(bookDtoMap.get(rightsSettingBookRelation.getBookId()).getIsbn()); rightsSettingBookRelation.setIsbn(bookDtoMap.get(rightsSettingBookRelation.getBookId()).getIsbn());
} }
if (MapUtils.isNotEmpty(adviserNameMap) && null != adviserNameMap.get(rightsSettingBookRelation.getAdviserId())) { if (MapUtils.isNotEmpty(infoDtoMap) && null != infoDtoMap.get(rightsSettingBookRelation.getAdviserId())) {
rightsSettingBookRelation.setAdviserName(adviserNameMap.get(rightsSettingBookRelation.getAdviserId())); rightsSettingBookRelation.setAdviserName(infoDtoMap.get(rightsSettingBookRelation.getAdviserId()).getPartyName());
rightsSettingBookRelation.setAgentName(infoDtoMap.get(rightsSettingBookRelation.getAdviserId()).getAgentName());
} }
} }
rightsSetting.setRightsSettingBookRelations(rightsSettingBookRelations); rightsSetting.setRightsSettingBookRelations(rightsSettingBookRelations);
...@@ -1809,10 +1925,18 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1809,10 +1925,18 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
paramMap.put("adviserIds", adviserIds); paramMap.put("adviserIds", adviserIds);
} }
} }
paramMap.put("firstClassify", rightsSetting.getFirstClassify());
paramMap.put("secondClassify", rightsSetting.getSecondClassify());
paramMap.put("gradeLabelId", rightsSetting.getGradeLabelId());
paramMap.put("subjectLabelId", rightsSetting.getSubjectLabelId());
paramMap.put("volLabelId", rightsSetting.getVolLabelId());
paramMap.put("verLabelId", rightsSetting.getVerLabelId());
rightsSettingDtoPageBeanNew = rightsSettingDAO rightsSettingDtoPageBeanNew = rightsSettingDAO
.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "listBookRightsSettingPage"); .listPageNew(new PageParam(currentPage, numPerPage), paramMap, "listBookRightsSettingPage");
//填充编辑名称 //填充编辑名称
fillAdviserName(rightsSettingDtoPageBeanNew.getRecordList()); fillAdviserName(rightsSettingDtoPageBeanNew.getRecordList());
fillPartyName(rightsSettingDtoPageBeanNew.getRecordList());
fillLabelNames4DTO(rightsSettingDtoPageBeanNew.getRecordList());
} else { } else {
paramMap.put("firstClassify", rightsSetting.getFirstClassify()); paramMap.put("firstClassify", rightsSetting.getFirstClassify());
paramMap.put("secondClassify", rightsSetting.getSecondClassify()); paramMap.put("secondClassify", rightsSetting.getSecondClassify());
...@@ -1827,9 +1951,144 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1827,9 +1951,144 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
List<RightsSettingDto> rightsSettingDtos = rightsSettingDtoPageBeanNew.getRecordList(); List<RightsSettingDto> rightsSettingDtos = rightsSettingDtoPageBeanNew.getRecordList();
setLabelContent(rightsSettingDtos); setLabelContent(rightsSettingDtos);
} }
return rightsSettingDtoPageBeanNew; return rightsSettingDtoPageBeanNew;
} }
private void fillLabelNames4DTO(List<RightsSettingDto> rightsSettingList) {
if (ListUtils.isEmpty(rightsSettingList)) {
return;
}
List<Long> classifyIds = new ArrayList<>();
List<Long> bookLabelIds = new ArrayList<>();
List<Long> labelIds = new ArrayList<>();
rightsSettingList.stream().forEach(rightsSetting -> {
if (null == rightsSetting || ListUtils.isEmpty(rightsSetting.getRightsSettingBookRelations())) {
return;
}
List<RightsSettingBookRelation> rightsSettingBookRelations = rightsSetting.getRightsSettingBookRelations();
rightsSettingBookRelations.stream().forEach(rightsSettingBookRelation -> {
if (null != rightsSettingBookRelation.getTempletId()) {
classifyIds.add(rightsSettingBookRelation.getTempletId());
}
if (null != rightsSettingBookRelation.getSecondTempletId()) {
classifyIds.add(rightsSettingBookRelation.getSecondTempletId());
}
if (null != rightsSettingBookRelation.getGraLabelId()) {
bookLabelIds.add(rightsSettingBookRelation.getGraLabelId());
}
if (null != rightsSettingBookRelation.getSubLabelId()) {
bookLabelIds.add(rightsSettingBookRelation.getSubLabelId());
}
if (null != rightsSettingBookRelation.getVolLabelId()) {
bookLabelIds.add(rightsSettingBookRelation.getVolLabelId());
}
if (null != rightsSettingBookRelation.getVerLabelId()){
bookLabelIds.add(rightsSettingBookRelation.getVerLabelId());
}
if (null != rightsSettingBookRelation.getAreaLabelId()) {
bookLabelIds.add(rightsSettingBookRelation.getAreaLabelId());
}
if (rightsSettingBookRelation.getProLabelId() != null) {
labelIds.add(rightsSettingBookRelation.getProLabelId());
}
if (rightsSettingBookRelation.getPurLabelId() != null) {
labelIds.add(rightsSettingBookRelation.getPurLabelId());
}
if (rightsSettingBookRelation.getDepLabelId() != null) {
labelIds.add(rightsSettingBookRelation.getDepLabelId());
}
});
});
Map<Long, AssistTempletDTO> classifyMap = new HashMap<>();
Map<Long, BookLabel> bookLabelMap = new HashMap<>();
Map<Long, String> labelMap = new HashMap<>();
if (!ListUtils.isEmpty(classifyIds)) {
classifyMap = assistTempletConsr.mapByIds4Classify(classifyIds);
}
if (!ListUtils.isEmpty(bookLabelIds)) {
bookLabelMap = bookLabelDao.getMapByIds(bookLabelIds);
}
if (!ListUtils.isEmpty(labelIds)) {
labelMap = ResponseHandleUtil.parseMap(labelService.getLabelName(labelIds), Long.class, String.class);
}
for (RightsSettingDto rightsSetting : rightsSettingList) {
if (null == rightsSetting || ListUtils.isEmpty(rightsSetting.getRightsSettingBookRelations())) {
continue;
}
List<RightsSettingBookRelation> rightsSettingBookRelations = rightsSetting.getRightsSettingBookRelations();
for (RightsSettingBookRelation rightsSettingBookRelation : rightsSettingBookRelations) {
if (!MapUtils.isEmpty(classifyMap) && classifyMap.containsKey(rightsSettingBookRelation.getTempletId())) {
rightsSettingBookRelation.setTempletName(classifyMap.get(rightsSettingBookRelation.getTempletId()).getTempletName());
}
if (!MapUtils.isEmpty(classifyMap) && classifyMap.containsKey(rightsSettingBookRelation.getSecondTempletId())) {
rightsSettingBookRelation.setSecondTempletName(classifyMap.get(rightsSettingBookRelation.getSecondTempletId()).getTempletName());
}
if (!MapUtils.isEmpty(bookLabelMap) && bookLabelMap.containsKey(rightsSettingBookRelation.getGraLabelId())) {
rightsSettingBookRelation.setGraLabelName(bookLabelMap.get(rightsSettingBookRelation.getGraLabelId()).getName());
}
if (!MapUtils.isEmpty(bookLabelMap) && bookLabelMap.containsKey(rightsSettingBookRelation.getSubLabelId())) {
rightsSettingBookRelation.setSubLabelName(bookLabelMap.get(rightsSettingBookRelation.getSubLabelId()).getName());
}
if (!MapUtils.isEmpty(bookLabelMap) && bookLabelMap.containsKey(rightsSettingBookRelation.getVolLabelId())) {
rightsSettingBookRelation.setVolLabelName(bookLabelMap.get(rightsSettingBookRelation.getVolLabelId()).getName());
}
if (!MapUtils.isEmpty(bookLabelMap) && bookLabelMap.containsKey(rightsSettingBookRelation.getVerLabelId())) {
rightsSettingBookRelation.setVerLabelName(bookLabelMap.get(rightsSettingBookRelation.getVerLabelId()).getName());
}
if (!MapUtils.isEmpty(bookLabelMap) && bookLabelMap.containsKey(rightsSettingBookRelation.getAreaLabelId())) {
rightsSettingBookRelation.setAreaLabelName(bookLabelMap.get(rightsSettingBookRelation.getAreaLabelId()).getName());
}
//设置深度标签
if (!MapUtils.isEmpty(labelMap) && labelMap.containsKey(rightsSettingBookRelation.getDepLabelId())) {
rightsSettingBookRelation.setDepLabelName(labelMap.get(rightsSettingBookRelation.getDepLabelId()));
}
if (!MapUtils.isEmpty(labelMap) && labelMap.containsKey(rightsSettingBookRelation.getPurLabelId())) {
rightsSettingBookRelation.setPurLabelName(labelMap.get(rightsSettingBookRelation.getPurLabelId()));
}
if (!MapUtils.isEmpty(labelMap) && labelMap.containsKey(rightsSettingBookRelation.getProLabelId())) {
rightsSettingBookRelation.setProLabelName(labelMap.get(rightsSettingBookRelation.getProLabelId()));
}
}
}
}
private void fillPartyName(List<RightsSettingDto> recordList) {
if (ListUtils.isEmpty(recordList) ) {
return;
}
List<Long> userIds = new ArrayList<>();
recordList.stream().forEach(rightsSettingDto -> {
if (null != rightsSettingDto.getCreateUserId()) {
userIds.add(rightsSettingDto.getCreateUserId());
}
if (null != rightsSettingDto.getUpdateUserId()) {
userIds.add(rightsSettingDto.getUpdateUserId());
}
});
if (ListUtils.isEmpty(userIds)) {
return;
}
Map<Long, String> userNamesMap = partyConsr.getAllUserLoginName(0L, SystemCode.pcloud.code);
if (MapUtils.isEmpty(userNamesMap)) {
return;
}
recordList.stream().forEach(rightsSettingDto -> {
if (null != rightsSettingDto.getCreateUserId()) {
rightsSettingDto.setCreateUserName(userNamesMap.get(rightsSettingDto.getCreateUserId()));
}
if (null != rightsSettingDto.getUpdateUserId()) {
rightsSettingDto.setUpdateUserName(userNamesMap.get(rightsSettingDto.getUpdateUserId()));
}
});
}
private void fillAdviserName(List<RightsSettingDto> recordList) { private void fillAdviserName(List<RightsSettingDto> recordList) {
if (ListUtils.isEmpty(recordList) ) { if (ListUtils.isEmpty(recordList) ) {
return; return;
...@@ -1845,8 +2104,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1845,8 +2104,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (ListUtils.isEmpty(adviserIds)) { if (ListUtils.isEmpty(adviserIds)) {
return; return;
} }
Map<Long, String> adviserNameMap = adviserConsr.getNames(adviserIds); Map<Long, AdviserBaseInfoDto> infoDtoMap = adviserConsr.getAdviserId2AdviserInfoDtoMap(adviserIds);
if (MapUtils.isEmpty(adviserNameMap)) { if (MapUtils.isEmpty(infoDtoMap)) {
return; return;
} }
recordList.forEach(rightsSettingDto -> { recordList.forEach(rightsSettingDto -> {
...@@ -1854,8 +2113,10 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1854,8 +2113,10 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (ListUtils.isEmpty(rightsSettingBookRelations)) { if (ListUtils.isEmpty(rightsSettingBookRelations)) {
return; return;
} }
rightsSettingBookRelations.stream().forEach(rightsSettingBookRelation -> rightsSettingBookRelations.stream().forEach(rightsSettingBookRelation -> {
rightsSettingBookRelation.setAdviserName(adviserNameMap.get(rightsSettingBookRelation.getAdviserId()))); rightsSettingBookRelation.setAdviserName(infoDtoMap.get(rightsSettingBookRelation.getAdviserId()).getPartyName());
rightsSettingBookRelation.setAgentName(infoDtoMap.get(rightsSettingBookRelation.getAdviserId()).getAgentName());
});
}); });
} }
...@@ -1897,6 +2158,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1897,6 +2158,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
return; return;
} }
List<Long> classifyIds = new ArrayList<>(); List<Long> classifyIds = new ArrayList<>();
List<Long> bookLabelIds = new ArrayList<>();
List<Long> labelIds = new ArrayList<>(); List<Long> labelIds = new ArrayList<>();
for (RightsSettingDto rightsSettingDto : rightsSettingDtos) { for (RightsSettingDto rightsSettingDto : rightsSettingDtos) {
if (null != rightsSettingDto.getFirstClassify()) { if (null != rightsSettingDto.getFirstClassify()) {
...@@ -1906,25 +2168,42 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1906,25 +2168,42 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
classifyIds.add(rightsSettingDto.getSecondClassify()); classifyIds.add(rightsSettingDto.getSecondClassify());
} }
if (null != rightsSettingDto.getGradeLabelId()) { if (null != rightsSettingDto.getGradeLabelId()) {
labelIds.add(rightsSettingDto.getGradeLabelId()); bookLabelIds.add(rightsSettingDto.getGradeLabelId());
} }
if (null != rightsSettingDto.getSubjectLabelId()) { if (null != rightsSettingDto.getSubjectLabelId()) {
labelIds.add(rightsSettingDto.getSubjectLabelId()); bookLabelIds.add(rightsSettingDto.getSubjectLabelId());
} }
if (null != rightsSettingDto.getVolLabelId()) { if (null != rightsSettingDto.getVolLabelId()) {
labelIds.add(rightsSettingDto.getVolLabelId()); bookLabelIds.add(rightsSettingDto.getVolLabelId());
} }
if (null != rightsSettingDto.getVerLabelId()){ if (null != rightsSettingDto.getVerLabelId()){
labelIds.add(rightsSettingDto.getVerLabelId()); bookLabelIds.add(rightsSettingDto.getVerLabelId());
}
if (null != rightsSettingDto.getAreaLabelId()){
bookLabelIds.add(rightsSettingDto.getAreaLabelId());
}
if (rightsSettingDto.getProLabelId() != null) {
labelIds.add(rightsSettingDto.getProLabelId());
}
if (rightsSettingDto.getPurLabelId() != null) {
labelIds.add(rightsSettingDto.getPurLabelId());
}
if (rightsSettingDto.getDepLabelId() != null) {
labelIds.add(rightsSettingDto.getDepLabelId());
} }
} }
Map<Long, AssistTempletDTO> classifyMap = new HashMap<>(); Map<Long, AssistTempletDTO> classifyMap = new HashMap<>();
Map<Long, BookLabel> labelMap = new HashMap<>(); Map<Long, BookLabel> bookLabelMap = new HashMap<>();
Map<Long, String> labelMap = new HashMap<>();
if (!ListUtils.isEmpty(classifyIds)) { if (!ListUtils.isEmpty(classifyIds)) {
classifyMap = assistTempletConsr.mapByIds4Classify(classifyIds); classifyMap = assistTempletConsr.mapByIds4Classify(classifyIds);
} }
if (!ListUtils.isEmpty(bookLabelIds)) {
bookLabelMap = bookLabelDao.getMapByIds(bookLabelIds);
}
if (!ListUtils.isEmpty(labelIds)) { if (!ListUtils.isEmpty(labelIds)) {
labelMap = bookLabelDao.getMapByIds(labelIds); labelMap = ResponseHandleUtil.parseMap(labelService.getLabelName(labelIds), Long.class, String.class);
} }
for (RightsSettingDto rightsSettingDto : rightsSettingDtos) { for (RightsSettingDto rightsSettingDto : rightsSettingDtos) {
if (!MapUtils.isEmpty(classifyMap) && classifyMap.containsKey(rightsSettingDto.getFirstClassify())) { if (!MapUtils.isEmpty(classifyMap) && classifyMap.containsKey(rightsSettingDto.getFirstClassify())) {
...@@ -1933,17 +2212,30 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1933,17 +2212,30 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (!MapUtils.isEmpty(classifyMap) && classifyMap.containsKey(rightsSettingDto.getSecondClassify())) { if (!MapUtils.isEmpty(classifyMap) && classifyMap.containsKey(rightsSettingDto.getSecondClassify())) {
rightsSettingDto.setSecondClassifyContent(classifyMap.get(rightsSettingDto.getSecondClassify()).getTempletName()); rightsSettingDto.setSecondClassifyContent(classifyMap.get(rightsSettingDto.getSecondClassify()).getTempletName());
} }
if (!MapUtils.isEmpty(labelMap) && labelMap.containsKey(rightsSettingDto.getGradeLabelId())) { if (!MapUtils.isEmpty(bookLabelMap) && bookLabelMap.containsKey(rightsSettingDto.getGradeLabelId())) {
rightsSettingDto.setGradeLabelIdContent(labelMap.get(rightsSettingDto.getGradeLabelId()).getName()); rightsSettingDto.setGradeLabelIdContent(bookLabelMap.get(rightsSettingDto.getGradeLabelId()).getName());
}
if (!MapUtils.isEmpty(bookLabelMap) && bookLabelMap.containsKey(rightsSettingDto.getSubjectLabelId())) {
rightsSettingDto.setSubjectLabelIdContent(bookLabelMap.get(rightsSettingDto.getSubjectLabelId()).getName());
}
if (!MapUtils.isEmpty(bookLabelMap) && bookLabelMap.containsKey(rightsSettingDto.getVolLabelId())) {
rightsSettingDto.setVolLabelContent(bookLabelMap.get(rightsSettingDto.getVolLabelId()).getName());
}
if (!MapUtils.isEmpty(bookLabelMap) && bookLabelMap.containsKey(rightsSettingDto.getVerLabelId())){
rightsSettingDto.setVerLabelContent(bookLabelMap.get(rightsSettingDto.getVerLabelId()).getName());
}
if (!MapUtils.isEmpty(bookLabelMap) && bookLabelMap.containsKey(rightsSettingDto.getAreaLabelId())){
rightsSettingDto.setAreaLabelContent(bookLabelMap.get(rightsSettingDto.getAreaLabelId()).getName());
} }
if (!MapUtils.isEmpty(labelMap) && labelMap.containsKey(rightsSettingDto.getSubjectLabelId())) { //设置深度标签
rightsSettingDto.setSubjectLabelIdContent(labelMap.get(rightsSettingDto.getSubjectLabelId()).getName()); if (!MapUtils.isEmpty(labelMap) && labelMap.containsKey(rightsSettingDto.getDepLabelId())){
rightsSettingDto.setDepLabelName(labelMap.get(rightsSettingDto.getDepLabelId()));
} }
if (!MapUtils.isEmpty(labelMap) && labelMap.containsKey(rightsSettingDto.getVolLabelId())) { if (!MapUtils.isEmpty(labelMap) && labelMap.containsKey(rightsSettingDto.getPurLabelId())){
rightsSettingDto.setVolLabelContent(labelMap.get(rightsSettingDto.getVolLabelId()).getName()); rightsSettingDto.setPurLabelName(labelMap.get(rightsSettingDto.getPurLabelId()));
} }
if (!MapUtils.isEmpty(labelMap) && labelMap.containsKey(rightsSettingDto.getVerLabelId())){ if (!MapUtils.isEmpty(labelMap) && labelMap.containsKey(rightsSettingDto.getProLabelId())){
rightsSettingDto.setVerLabelContent(labelMap.get(rightsSettingDto.getVerLabelId()).getName()); rightsSettingDto.setProLabelName(labelMap.get(rightsSettingDto.getProLabelId()));
} }
} }
} }
......
...@@ -33,4 +33,6 @@ public interface RightsSettingDAO extends BaseDao<RightsSetting> { ...@@ -33,4 +33,6 @@ public interface RightsSettingDAO extends BaseDao<RightsSetting> {
void batchUpdateShowState(RightsSettingShowStateDTO rightsSettingShowStateDTO); void batchUpdateShowState(RightsSettingShowStateDTO rightsSettingShowStateDTO);
Map<Long, RightsSettingDto> listByBookIds(List<Long> bookIds); Map<Long, RightsSettingDto> listByBookIds(List<Long> bookIds);
void updateUser(RightsSetting rightsSetting);
} }
...@@ -86,4 +86,9 @@ public class RightsSettingDAOImpl extends BaseDaoImpl<RightsSetting> implement ...@@ -86,4 +86,9 @@ public class RightsSettingDAOImpl extends BaseDaoImpl<RightsSetting> implement
public Map<Long, RightsSettingDto> listByBookIds(List<Long> bookIds) { public Map<Long, RightsSettingDto> listByBookIds(List<Long> bookIds) {
return getSessionTemplate().selectMap(getStatement("listByBookIds"), bookIds, "bookId"); return getSessionTemplate().selectMap(getStatement("listByBookIds"), bookIds, "bookId");
} }
@Override
public void updateUser(RightsSetting rightsSetting) {
getSessionTemplate().update(getStatement("updateUser"), rightsSetting);
}
} }
...@@ -9,13 +9,6 @@ public class RightsSettingDto extends RightsSetting { ...@@ -9,13 +9,6 @@ public class RightsSettingDto extends RightsSetting {
@ApiModelProperty("权益编号") @ApiModelProperty("权益编号")
private String rightsNumber; private String rightsNumber;
private String firstClassifyContent;
private String secondClassifyContent;
private String gradeLabelIdContent;
private String subjectLabelIdContent;
/** /**
* 权益分类 * 权益分类
...@@ -31,9 +24,8 @@ public class RightsSettingDto extends RightsSetting { ...@@ -31,9 +24,8 @@ public class RightsSettingDto extends RightsSetting {
*/ */
private Integer chooseReadType; private Integer chooseReadType;
private String volLabelContent;
private String verLabelContent;
private Long agentId; private Long agentId;
private String groupQrcodeUrl;
} }
...@@ -159,6 +159,75 @@ public class RightsSetting extends BaseTempletClassify { ...@@ -159,6 +159,75 @@ public class RightsSetting extends BaseTempletClassify {
@ApiModelProperty("应用或作品跳转地址") @ApiModelProperty("应用或作品跳转地址")
private String guideLinkUrl; private String guideLinkUrl;
@ApiModelProperty("专业标签ID")
private Long proLabelId;
@ApiModelProperty("深度标签ID")
private Long depLabelId;
@ApiModelProperty("目的标签ID")
private Long purLabelId;
@ApiModelProperty("专业标签名称")
private String proLabelName;
@ApiModelProperty("深度标签名称")
private String depLabelName;
@ApiModelProperty("目的标签名称")
private String purLabelName;
/**
* 年级标签
*/
private String graLabelName;
/**
* 科目标签
*/
private String subLabelName;
/**
* 版本标签
*/
private String verLabelName;
/**
* 地域标签
*/
private String areaLabelName;
/**
* 上下册标签
*/
private String volLabelName;
/**
* 地域标签id
*/
private Long areaLabelId;
private String firstClassifyContent;
private String secondClassifyContent;
private String gradeLabelIdContent;
private String subjectLabelIdContent;
private String volLabelContent;
private String verLabelContent;
private String areaLabelContent;
private Long createUserId;
private Long updateUserId;
private String createUserName;
private String updateUserName;
public RightsSetting() { public RightsSetting() {
} }
......
package com.pcloud.book.rightsSetting.entity; package com.pcloud.book.rightsSetting.entity;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@Data @Data
...@@ -9,10 +12,20 @@ public class RightsSettingBookRelation { ...@@ -9,10 +12,20 @@ public class RightsSettingBookRelation {
private Long rightsSettingId; private Long rightsSettingId;
private Long bookAdviserId;
private Long bookId; private Long bookId;
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date createTime; private Date createTime;
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date updateTime; private Date updateTime;
private String bookName; private String bookName;
...@@ -22,4 +35,101 @@ public class RightsSettingBookRelation { ...@@ -22,4 +35,101 @@ public class RightsSettingBookRelation {
private String adviserName; private String adviserName;
private String isbn; private String isbn;
private Long channelId;
private Long agentId;
private String agentName;
private String coverImg;
/**
* 模板标识
*/
private Long templetId;
/**
* 模板名称
*/
private String templetName;
/**
* 第二级类型
*/
private Long secondTempletId;
/**
* 第二类型名称
*/
private String secondTempletName;
/**
* 年级标签id
*/
private Long graLabelId;
/**
* 科目标签id
*/
private Long subLabelId;
/**
* 版本标签id
*/
private Long verLabelId;
/**
* 地域标签id
*/
private Long areaLabelId;
/**
* 上下册标签id
*/
private Long volLabelId;
/**
* 年级标签
*/
private String graLabelName;
/**
* 科目标签
*/
private String subLabelName;
/**
* 版本标签
*/
private String verLabelName;
/**
* 地域标签
*/
private String areaLabelName;
/**
* 上下册标签
*/
private String volLabelName;
@ApiModelProperty("专业标签ID")
private Long proLabelId;
@ApiModelProperty("深度标签ID")
private Long depLabelId;
@ApiModelProperty("目的标签ID")
private Long purLabelId;
@ApiModelProperty("专业标签名称")
private String proLabelName;
@ApiModelProperty("深度标签名称")
private String depLabelName;
@ApiModelProperty("目的标签名称")
private String purLabelName;
private String groupQrcodeUrl;
} }
\ No newline at end of file
...@@ -51,6 +51,8 @@ public class RightsSettingFacede { ...@@ -51,6 +51,8 @@ public class RightsSettingFacede {
Map<String,Object> map = SessionUtil.getToken4Redis(token); Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID); Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
rightsSetting.setAgentId(agentId==null?0L:agentId); rightsSetting.setAgentId(agentId==null?0L:agentId);
Long userId = (Long) map.get(SessionUtil.USER_ID);
rightsSetting.setCreateUserId(userId);
return new ResponseDto<Long>(rightsSettingBiz.addRightsSetting(rightsSetting)); return new ResponseDto<Long>(rightsSettingBiz.addRightsSetting(rightsSetting));
} }
...@@ -64,7 +66,9 @@ public class RightsSettingFacede { ...@@ -64,7 +66,9 @@ public class RightsSettingFacede {
@PostMapping("updateRightsSetting") @PostMapping("updateRightsSetting")
public ResponseDto<?> updateRightsSetting( @RequestHeader("token") String token, public ResponseDto<?> updateRightsSetting( @RequestHeader("token") String token,
@RequestBody @Validated RightsSetting rightsSetting ) throws PermissionException { @RequestBody @Validated RightsSetting rightsSetting ) throws PermissionException {
SessionUtil.getToken4Redis(token); Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long userId = (Long) map.get(SessionUtil.USER_ID);
rightsSetting.setUpdateUserId(userId);
rightsSettingBiz.updateRightsSetting(rightsSetting); rightsSettingBiz.updateRightsSetting(rightsSetting);
return new ResponseDto<>(); return new ResponseDto<>();
} }
...@@ -87,11 +91,14 @@ public class RightsSettingFacede { ...@@ -87,11 +91,14 @@ public class RightsSettingFacede {
@RequestParam(value = "subjectLabelId", required = false) Long subjectLabelId, @RequestParam(value = "rightsSettingType", required = false, defaultValue = "1") Integer rightsSettingType, @RequestParam(value = "subjectLabelId", required = false) Long subjectLabelId, @RequestParam(value = "rightsSettingType", required = false, defaultValue = "1") Integer rightsSettingType,
@RequestParam(value = "bookQuery", required = false) String bookQuery, @RequestParam(value = "bookQuery", required = false) String bookQuery,
@RequestParam(value = "volLabelId", required = false) Long volLabelId, @RequestParam(value = "volLabelId", required = false) Long volLabelId,
@RequestParam(value = "verLabelId", required = false) Long verLabelId @RequestParam(value = "verLabelId", required = false) Long verLabelId,
@RequestParam(value = "agentId", required = false) Long agentId
) throws PermissionException { ) throws PermissionException {
Map<String,Object> map = SessionUtil.getToken4Redis(token); Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID); if (null == agentId) {
agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
}
RightsSetting rightsSetting = new RightsSetting(); RightsSetting rightsSetting = new RightsSetting();
rightsSetting.setFirstClassify(firstClassify); rightsSetting.setFirstClassify(firstClassify);
rightsSetting.setSecondClassify(secondClassify); rightsSetting.setSecondClassify(secondClassify);
......
...@@ -2461,7 +2461,15 @@ ...@@ -2461,7 +2461,15 @@
SELECT SELECT
A.BOOK_ID, A.CHANNEL_ID, A.ADVISER_ID, A.IS_MAIN_EDITOR, T.TYPE_CODE, T.TYPE_NAME, B.ISBN, B.BOOK_NAME, B.REMARK, A.BOOK_ID, A.CHANNEL_ID, A.ADVISER_ID, A.IS_MAIN_EDITOR, T.TYPE_CODE, T.TYPE_NAME, B.ISBN, B.BOOK_NAME, B.REMARK,
B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.ORIGIN_NAME, B.BOOK_PRICE, B.ISSN, B.BOOK_NUM, B.SERIAL_NUMBER, 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.SECOND_TEMPLET_ID,A.LAST_MODIFIED_DATE LAST_MODIFIED_DATE,A.BOOK_ADVISER_ID,CONCAT('BK',A.BOOK_ID) uniqueNumber A.TEMPLET_ID,A.SECOND_TEMPLET_ID,A.LAST_MODIFIED_DATE LAST_MODIFIED_DATE,A.BOOK_ADVISER_ID,CONCAT('BK',A.BOOK_ID) uniqueNumber,
A.GRA_LABEL_ID,
A.SUB_LABEL_ID,
A.VER_LABEL_ID,
A.AREA_LABEL_ID,
A.pro_label_id,
A.dep_label_id,
A.pur_label_id,
A.vol_label_id
FROM FROM
BOOK_ADVISER A BOOK_ADVISER A
INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID AND A.IS_DELETE = 0 AND B.IS_DELETE = 0 INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID AND A.IS_DELETE = 0 AND B.IS_DELETE = 0
......
<?xml version="1.0" encoding="UTF-8" ?> <?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" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.rightsSetting.mapper.RightsSettingBookRelationMapper" > <mapper namespace="com.pcloud.book.rightsSetting.mapper.RightsSettingBookRelationMapper" >
<resultMap id="BaseResultMap" type="com.pcloud.book.rightsSetting.entity.RightsSettingBookRelation" >
<id column="id" property="id" jdbcType="BIGINT" /> <resultMap id="BaseResultMap" type="com.pcloud.book.rightsSetting.entity.RightsSettingBookRelation">
<result column="rights_setting_id" property="rightsSettingId" jdbcType="BIGINT" /> <id column="id" property="id" jdbcType="BIGINT"/>
<result column="book_id" property="bookId" jdbcType="BIGINT" /> <result column="rights_setting_id" property="rightsSettingId" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> <result column="book_adviser_id" property="bookAdviserId" jdbcType="BIGINT"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="book_id" property="bookId" jdbcType="BIGINT"/>
<result column="book_name" property="bookName" jdbcType="VARCHAR" /> <result column="adviser_id" property="adviserId" jdbcType="BIGINT"/>
<result column="adviser_id" property="adviserId" jdbcType="BIGINT" /> <result column="channel_id" property="channelId" jdbcType="BIGINT"/>
<result column="agent_id" property="agentId" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="book_name" property="bookName" jdbcType="VARCHAR"/>
<result column="TEMPLET_ID" property="templetId" jdbcType="BIGINT"/>
<result column="SECOND_TEMPLET_ID" property="secondTempletId" jdbcType="BIGINT"/>
<result column="GRA_LABEL_ID" property="graLabelId" jdbcType="BIGINT"/>
<result column="SUB_LABEL_ID" property="subLabelId" jdbcType="BIGINT"/>
<result column="VER_LABEL_ID" property="verLabelId" jdbcType="BIGINT"/>
<result column="AREA_LABEL_ID" property="areaLabelId" jdbcType="BIGINT"/>
<result column="vol_label_id" property="volLabelId" jdbcType="INTEGER"/>
<result column="group_qrcode_url" property="groupQrcodeUrl" jdbcType="VARCHAR"/>
<result column="COVER_IMG" property="coverImg" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<sql id="Base_Column_List" >
id, rights_setting_id, book_id, create_time, update_time, adviser_id <sql id="Base_Column_List">
</sql> id, rights_setting_id, book_adviser_id, book_id, adviser_id, channel_id, agent_id, create_time, update_time
</sql>
<sql id="Base_Column_List_owm" > <sql id="Base_Column_List_owm" >
r.id, r.rights_setting_id, r.book_id, r.create_time, r.update_time r.id,
r.rights_setting_id,
r.book_adviser_id,
r.book_id,
r.channel_id,
r.agent_id,
r.create_time,
r.update_time
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from rights_setting_book_relation from rights_setting_book_relation
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</select> </select>
<select id="selectByRithsSettingId" resultMap="BaseResultMap"> <select id="selectByRithsSettingId" resultMap="BaseResultMap">
select select
r.id, r.rights_setting_id, r.book_id, r.create_time, r.update_time, ifnull(r.adviser_id, b.adviser_id) adviser_id <include refid="Base_Column_List_owm" />,b.book_name, b.isbn, ifnull(r.adviser_id,a.adviser_id) adviser_id,
c.group_qrcode_url,
a.TEMPLET_ID,
a.SECOND_TEMPLET_ID,
a.GRA_LABEL_ID,
a.SUB_LABEL_ID,
a.VER_LABEL_ID,
a.AREA_LABEL_ID,
a.vol_label_id,
c.group_qrcode_url,
b.isbn,
b.COVER_IMG
from rights_setting_book_relation r from rights_setting_book_relation r
left join book_adviser b on r.book_id = b.book_id AND b.IS_DELETE=0 left join book b on r.book_id = b.book_Id
where rights_setting_id = #{rightsSettingId,jdbcType=BIGINT} INNER JOIN book_adviser a ON b.BOOK_ID=a.BOOK_ID AND a.IS_DELETE=0
left join book_group c on a.book_id = c.book_id and a.channel_id = c.channel_id and c.is_delete = 0
where rights_setting_id = #{rightsSettingId}
group by r.book_id group by r.book_id
</select> </select>
<select id="getAllBookIds" resultType="java.lang.Long"> <select id="getAllBookIds" resultType="java.lang.Long">
select book_id select book_id
from from
rights_setting_book_relation rights_setting_book_relation
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" > <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from rights_setting_book_relation delete from rights_setting_book_relation
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</delete> </delete>
<delete id="deleteByRightsSettingId" parameterType="long"> <delete id="deleteByRightsSettingId" parameterType="long">
delete from rights_setting_book_relation delete from rights_setting_book_relation
where rights_setting_id = #{rightsSettingId,jdbcType=BIGINT} where rights_setting_id = #{rightsSettingId,jdbcType=BIGINT}
</delete> </delete>
<insert id="insert" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingBookRelation" > <insert id="insert" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingBookRelation" >
insert into rights_setting_book_relation (id, rights_setting_id, book_id, insert into rights_setting_book_relation (id, rights_setting_id, book_id,
create_time, update_time) create_time, update_time)
values (#{id,jdbcType=BIGINT}, #{rightsSettingId,jdbcType=BIGINT}, #{bookId,jdbcType=BIGINT}, values (#{id,jdbcType=BIGINT}, #{rightsSettingId,jdbcType=BIGINT}, #{bookId,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert> </insert>
<insert id="insertSelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingBookRelation" > <insert id="insertSelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingBookRelation" >
insert into rights_setting_book_relation insert into rights_setting_book_relation
<trim prefix="(" suffix=")" suffixOverrides="," > <trim prefix="(" suffix=")" suffixOverrides="," >
...@@ -86,15 +134,33 @@ ...@@ -86,15 +134,33 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<insert id="batchInsert" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingBookRelation"> <insert id="batchInsert" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingBookRelation">
insert into rights_setting_book_relation (rights_setting_id, book_id, insert into rights_setting_book_relation (
create_time, update_time, adviser_id) `rights_setting_id`,
`book_adviser_id`,
`book_id`,
`adviser_id`,
`channel_id`,
`agent_id`,
`create_time`,
`update_time`
)
values values
<foreach collection="list" index="index" item="item" separator=","> <foreach collection="list" index="index" item="item" separator=",">
(#{item.rightsSettingId,jdbcType=BIGINT}, #{item.bookId,jdbcType=BIGINT}, (#{item.rightsSettingId,jdbcType=BIGINT},
now(),now(), #{item.adviserId}) #{item.bookAdviserId,jdbcType=BIGINT},
#{item.bookId,jdbcType=BIGINT},
#{item.adviserId,jdbcType=BIGINT},
#{item.channelId,jdbcType=BIGINT},
#{item.agentId,jdbcType=BIGINT},
now(),
now()
)
</foreach> </foreach>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingBookRelation" > <update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingBookRelation" >
update rights_setting_book_relation update rights_setting_book_relation
<set > <set >
...@@ -113,6 +179,8 @@ ...@@ -113,6 +179,8 @@
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingBookRelation" > <update id="updateByPrimaryKey" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingBookRelation" >
update rights_setting_book_relation update rights_setting_book_relation
set rights_setting_id = #{rightsSettingId,jdbcType=BIGINT}, set rights_setting_id = #{rightsSettingId,jdbcType=BIGINT},
...@@ -121,12 +189,25 @@ ...@@ -121,12 +189,25 @@
update_time = #{updateTime,jdbcType=TIMESTAMP} update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<select id="selectBookByRithsSettingId" resultMap="BaseResultMap"> <select id="selectBookByRithsSettingId" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List_owm" />,b.book_name, b.isbn, ifnull(r.adviser_id,a.adviser_id) adviser_id <include refid="Base_Column_List_owm" />,b.book_name, b.isbn, ifnull(r.adviser_id,a.adviser_id) adviser_id,
c.group_qrcode_url,
a.TEMPLET_ID,
a.SECOND_TEMPLET_ID,
a.GRA_LABEL_ID,
a.SUB_LABEL_ID,
a.VER_LABEL_ID,
a.AREA_LABEL_ID,
a.vol_label_id,
c.group_qrcode_url,
b.isbn,
b.COVER_IMG
from rights_setting_book_relation r from rights_setting_book_relation r
left join book b on r.book_id = b.book_Id left join book b on r.book_id = b.book_Id
INNER JOIN book_adviser a ON b.BOOK_ID=a.BOOK_ID AND a.IS_DELETE=0 INNER JOIN book_adviser a ON b.BOOK_ID=a.BOOK_ID AND a.IS_DELETE=0
left join book_group c on a.book_id = c.book_id and a.channel_id = c.channel_id and c.is_delete = 0
where rights_setting_id = #{_parameter} where rights_setting_id = #{_parameter}
group by r.book_id group by r.book_id
</select> </select>
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
<result column="show_state" property="showState" jdbcType="BOOLEAN"/> <result column="show_state" property="showState" jdbcType="BOOLEAN"/>
<result column="agent_id" property="agentId" jdbcType="BIGINT" /> <result column="agent_id" property="agentId" jdbcType="BIGINT" />
<result column="guide_link_url" property="guideLinkUrl" jdbcType="VARCHAR" /> <result column="guide_link_url" property="guideLinkUrl" jdbcType="VARCHAR" />
<result column="create_user_id" property="createUserId" jdbcType="BIGINT" />
<result column="update_user_id" property="updateUserId" jdbcType="BIGINT" />
</resultMap> </resultMap>
<resultMap id="DtoResultMap" type="com.pcloud.book.rightsSetting.dto.RightsSettingDto"> <resultMap id="DtoResultMap" type="com.pcloud.book.rightsSetting.dto.RightsSettingDto">
...@@ -56,6 +58,9 @@ ...@@ -56,6 +58,9 @@
<result column="ver_label_id" property="verLabelId" jdbcType="BIGINT" /> <result column="ver_label_id" property="verLabelId" jdbcType="BIGINT" />
<result column="show_state" property="showState" jdbcType="BOOLEAN" /> <result column="show_state" property="showState" jdbcType="BOOLEAN" />
<result column="agent_id" property="agentId" jdbcType="BIGINT" /> <result column="agent_id" property="agentId" jdbcType="BIGINT" />
<result column="create_user_id" property="createUserId" jdbcType="BIGINT" />
<result column="update_user_id" property="updateUserId" jdbcType="BIGINT" />
<result column="group_qrcode_url" property="groupQrcodeUrl" jdbcType="VARCHAR" />
</resultMap> </resultMap>
<resultMap id="DtoResultMap4Book" type="com.pcloud.book.rightsSetting.dto.RightsSettingDto" extends="DtoResultMap"> <resultMap id="DtoResultMap4Book" type="com.pcloud.book.rightsSetting.dto.RightsSettingDto" extends="DtoResultMap">
...@@ -67,19 +72,21 @@ ...@@ -67,19 +72,21 @@
id,rights_number, introduce, detail, count, first_classify, second_classify, grade_label_id, subject_label_id, id,rights_number, introduce, detail, count, first_classify, second_classify, grade_label_id, subject_label_id,
create_time, update_time, enable_group_service, rights_setting_type, book_id create_time, update_time, enable_group_service, rights_setting_type, book_id
,online_course_open,learning_tool_open,draw_open,read_type_title, vol_label_id, ,online_course_open,learning_tool_open,draw_open,read_type_title, vol_label_id,
reading_guide,guide_title,guide_type,guide_id,guide_pic,ver_label_id, show_state, agent_id, guide_link_url reading_guide,guide_title,guide_type,guide_id,guide_pic,ver_label_id, show_state, agent_id, guide_link_url,
create_user_id, update_user_id
</sql> </sql>
<sql id="Base_Column_List_own" > <sql id="Base_Column_List_own" >
r.id,r.rights_number, r.introduce, r.detail, r.count, r.first_classify, r.second_classify, r.grade_label_id, r.subject_label_id, r.id,r.rights_number, r.introduce, r.detail, r.count, r.first_classify, r.second_classify, r.grade_label_id, r.subject_label_id,
r.create_time, r.update_time, r.enable_group_service, r.rights_setting_type, r.book_id r.create_time, r.update_time, r.enable_group_service, r.rights_setting_type, r.book_id
,r.online_course_open,r.learning_tool_open,r.draw_open,r.read_type_title,r.vol_label_id,r.ver_label_id, r.show_state ,r.online_course_open,r.learning_tool_open,r.draw_open,r.read_type_title,r.vol_label_id,r.ver_label_id, r.show_state,
r.update_user_id, r.update_user_id
</sql> </sql>
<sql id="Base_Column_List_1" > <sql id="Base_Column_List_1" >
r.id,r.rights_number, r.introduce, r.detail, r.count, r.first_classify, r.second_classify, r.grade_label_id, r.subject_label_id, r.id,r.rights_number, r.introduce, r.detail, r.count, r.first_classify, r.second_classify, r.grade_label_id, r.subject_label_id,
r.create_time, r.update_time, r.enable_group_service, r.rights_setting_type, b.book_id r.create_time, r.update_time, r.enable_group_service, r.rights_setting_type, b.book_id
,r.online_course_open,r.learning_tool_open,r.draw_open,r.read_type_title,r.vol_label_id,r.ver_label_id ,r.online_course_open,r.learning_tool_open,r.draw_open,r.read_type_title,r.vol_label_id,r.ver_label_id, r.update_user_id, r.update_user_id
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
...@@ -98,13 +105,13 @@ ...@@ -98,13 +105,13 @@
grade_label_id, subject_label_id, create_time, grade_label_id, subject_label_id, create_time,
update_time, enable_group_service, rights_setting_type, book_id, update_time, enable_group_service, rights_setting_type, book_id,
online_course_open,learning_tool_open,draw_open,read_type_title, vol_label_id, online_course_open,learning_tool_open,draw_open,read_type_title, vol_label_id,
reading_guide,guide_title,guide_type,guide_id,guide_pic,ver_label_id, agent_id, guide_link_url) reading_guide,guide_title,guide_type,guide_id,guide_pic,ver_label_id, agent_id, guide_link_url,create_user_id)
values ( #{rightsNumber,jdbcType=VARCHAR}, #{introduce,jdbcType=VARCHAR}, #{detail,jdbcType=VARCHAR}, values ( #{rightsNumber,jdbcType=VARCHAR}, #{introduce,jdbcType=VARCHAR}, #{detail,jdbcType=VARCHAR},
#{count,jdbcType=INTEGER}, #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT}, #{count,jdbcType=INTEGER}, #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT},
#{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}, now(), #{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}, now(),
#{updateTime,jdbcType=TIMESTAMP}, #{enableGroupService}, #{rightsSettingType}, #{bookId}, now(), #{enableGroupService}, #{rightsSettingType}, #{bookId},
#{onlineCourseOpen},#{learningToolOpen},#{drawNowOpen},#{readTypeTitle}, #{volLabelId}, #{onlineCourseOpen},#{learningToolOpen},#{drawNowOpen},#{readTypeTitle}, #{volLabelId},
#{guideIsOpen},#{guideTitle},#{guideType},#{guideId},#{guidePic}, #{verLabelId}, #{agentId}, #{guideLinkUrl}) #{guideIsOpen},#{guideTitle},#{guideType},#{guideId},#{guidePic}, #{verLabelId}, #{agentId}, #{guideLinkUrl}, #{createUserId})
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsSetting" > <update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsSetting" >
update rights_setting update rights_setting
...@@ -199,7 +206,7 @@ ...@@ -199,7 +206,7 @@
second_classify = #{secondClassify,jdbcType=BIGINT}, second_classify = #{secondClassify,jdbcType=BIGINT},
grade_label_id = #{gradeLabelId,jdbcType=BIGINT}, grade_label_id = #{gradeLabelId,jdbcType=BIGINT},
subject_label_id = #{subjectLabelId,jdbcType=BIGINT}, subject_label_id = #{subjectLabelId,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = now(),
enable_group_service = #{enableGroupService}, enable_group_service = #{enableGroupService},
book_id = #{bookId}, book_id = #{bookId},
online_course_open = #{onlineCourseOpen}, online_course_open = #{onlineCourseOpen},
...@@ -213,7 +220,8 @@ ...@@ -213,7 +220,8 @@
guide_id = #{guideId,jdbcType=BIGINT}, guide_id = #{guideId,jdbcType=BIGINT},
guide_pic = #{guidePic,jdbcType=VARCHAR}, guide_pic = #{guidePic,jdbcType=VARCHAR},
ver_label_id = #{verLabelId,jdbcType=BIGINT}, ver_label_id = #{verLabelId,jdbcType=BIGINT},
guide_link_url = #{guideLinkUrl} guide_link_url = #{guideLinkUrl},
update_user_id = #{updateUserId}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
...@@ -264,7 +272,9 @@ ...@@ -264,7 +272,9 @@
r.create_time, r.update_time, r.enable_group_service, r.rights_setting_type, r.book_id, b.BOOK_NAME, r.vol_label_id, r.create_time, r.update_time, r.enable_group_service, r.rights_setting_type, r.book_id, b.BOOK_NAME, r.vol_label_id,
r.ver_label_id, r.show_state, r.ver_label_id, r.show_state,
b.isbn, b.isbn,
ifnull(s.adviser_id,a.adviser_id) adviser_id ifnull(s.adviser_id,a.adviser_id) adviser_id,
r.create_user_id,
r.update_user_id
from from
rights_setting r rights_setting r
left join rights_setting_book_relation s on r.id = s.rights_setting_id left join rights_setting_book_relation s on r.id = s.rights_setting_id
...@@ -281,6 +291,24 @@ ...@@ -281,6 +291,24 @@
${item} ${item}
</foreach> </foreach>
</if> </if>
<if test="firstClassify != null">
and a.TEMPLET_ID = #{firstClassify}
</if>
<if test="secondClassify != null">
and a.SECOND_TEMPLET_ID = #{secondClassify}
</if>
<if test="gradeLabelId != null">
and a.GRA_LABEL_ID = #{gradeLabelId}
</if>
<if test="subjectLabelId != null">
and a.SUB_LABEL_ID = #{subjectLabelId}
</if>
<if test="volLabelId != null">
and a.vol_label_id = #{volLabelId}
</if>
<if test="verLabelId != null">
and a.VER_LABEL_ID = #{verLabelId}
</if>
group by r.id group by r.id
order by r.create_time desc order by r.create_time desc
</select> </select>
...@@ -370,4 +398,13 @@ ...@@ -370,4 +398,13 @@
</foreach> </foreach>
</update> </update>
<update id="updateUser" parameterType="com.pcloud.book.rightsSetting.entity.RightsSetting">
update
rights_setting
set
update_time = now(),
update_user_id = #{updateUserId}
where id = #{id,jdbcType=BIGINT}
</update>
</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