Commit 96a2210b by 吴博

feat-wb-1002904

parent f2eac8cf
...@@ -54,4 +54,8 @@ public interface CustomPlanBiz { ...@@ -54,4 +54,8 @@ public interface CustomPlanBiz {
List<CustomPlan> listByCustomPlanIds(List<Long> customPlanIds); List<CustomPlan> listByCustomPlanIds(List<Long> customPlanIds);
Map<Long, CustomPlan> getByIds(List<Long> planIds); Map<Long, CustomPlan> getByIds(List<Long> planIds);
void editCustomRightsSetting(EditCustomRightsSettingVO editCustomRightsSettingVO);
EditCustomRightsSettingVO getCustomRightsSettingModule(Integer planId);
} }
...@@ -20,11 +20,18 @@ import com.pcloud.book.custom.dto.PlanReadTypeDto; ...@@ -20,11 +20,18 @@ import com.pcloud.book.custom.dto.PlanReadTypeDto;
import com.pcloud.book.custom.entity.CustomPlan; import com.pcloud.book.custom.entity.CustomPlan;
import com.pcloud.book.custom.entity.CustomPlanModule; import com.pcloud.book.custom.entity.CustomPlanModule;
import com.pcloud.book.custom.entity.CustomPlanModuleSuggestion; import com.pcloud.book.custom.entity.CustomPlanModuleSuggestion;
import com.pcloud.book.custom.entity.CustomPlanRightsSetting;
import com.pcloud.book.custom.entity.CustomRightsItemDescription;
import com.pcloud.book.custom.entity.CustomRightsSettingItem;
import com.pcloud.book.custom.enums.PlanModuleTypeEnum; import com.pcloud.book.custom.enums.PlanModuleTypeEnum;
import com.pcloud.book.custom.enums.PlanRightsEnum;
import com.pcloud.book.custom.enums.PlanUseStateEnum; import com.pcloud.book.custom.enums.PlanUseStateEnum;
import com.pcloud.book.custom.mapper.CustomPlanMapper; import com.pcloud.book.custom.mapper.CustomPlanMapper;
import com.pcloud.book.custom.mapper.CustomPlanModuleMapper; import com.pcloud.book.custom.mapper.CustomPlanModuleMapper;
import com.pcloud.book.custom.mapper.CustomPlanModuleSuggestionMapper; import com.pcloud.book.custom.mapper.CustomPlanModuleSuggestionMapper;
import com.pcloud.book.custom.mapper.CustomPlanRightsSettingMapper;
import com.pcloud.book.custom.mapper.CustomRightsItemDescriptionMapper;
import com.pcloud.book.custom.mapper.CustomRightsSettingItemMapper;
import com.pcloud.book.custom.vo.AddBookNameVO; import com.pcloud.book.custom.vo.AddBookNameVO;
import com.pcloud.book.custom.vo.AddCustomPlan4UserVO; import com.pcloud.book.custom.vo.AddCustomPlan4UserVO;
import com.pcloud.book.custom.vo.AddSuggestionListVO; import com.pcloud.book.custom.vo.AddSuggestionListVO;
...@@ -32,6 +39,7 @@ import com.pcloud.book.custom.vo.AddSuggestionVO; ...@@ -32,6 +39,7 @@ import com.pcloud.book.custom.vo.AddSuggestionVO;
import com.pcloud.book.custom.vo.CustomPlanModuleVO; import com.pcloud.book.custom.vo.CustomPlanModuleVO;
import com.pcloud.book.custom.vo.CustomPlanPaperVO; import com.pcloud.book.custom.vo.CustomPlanPaperVO;
import com.pcloud.book.custom.vo.EditCustomPlanModuleVO; import com.pcloud.book.custom.vo.EditCustomPlanModuleVO;
import com.pcloud.book.custom.vo.EditCustomRightsSettingVO;
import com.pcloud.book.custom.vo.ModuleSuggestionVO; import com.pcloud.book.custom.vo.ModuleSuggestionVO;
import com.pcloud.book.custom.vo.SuggestionListVO; import com.pcloud.book.custom.vo.SuggestionListVO;
import com.pcloud.book.custom.vo.ToPdfVO; import com.pcloud.book.custom.vo.ToPdfVO;
...@@ -40,11 +48,14 @@ import com.pcloud.book.group.biz.WeixinQrcodeBiz; ...@@ -40,11 +48,14 @@ import com.pcloud.book.group.biz.WeixinQrcodeBiz;
import com.pcloud.book.group.tools.Kit; import com.pcloud.book.group.tools.Kit;
import com.pcloud.book.group.tools.SendWeixinRequestTools; import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.pcloudkeyword.enums.PcloudGroupRobotTypeEnum; import com.pcloud.book.pcloudkeyword.enums.PcloudGroupRobotTypeEnum;
import com.pcloud.book.rightsSetting.dao.RightsSettingItemDao;
import com.pcloud.book.rightsSetting.entity.RightsSettingClassify;
import com.pcloud.book.timecontrol.entity.TimeControlTask; import com.pcloud.book.timecontrol.entity.TimeControlTask;
import com.pcloud.book.timecontrol.mapper.TimeControlTaskMapper; import com.pcloud.book.timecontrol.mapper.TimeControlTaskMapper;
import com.pcloud.book.util.common.ThreadPoolUtils; import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto; import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.utils.BeanUtils; import com.pcloud.common.utils.BeanUtils;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
...@@ -58,6 +69,7 @@ import com.pcloud.wechatgroup.group.dto.GroupRobotDTO; ...@@ -58,6 +69,7 @@ import com.pcloud.wechatgroup.group.dto.GroupRobotDTO;
import com.pcloud.wechatgroup.group.dto.GroupUserDTO; import com.pcloud.wechatgroup.group.dto.GroupUserDTO;
import com.sdk.wxgroup.SendMessageTypeEnum; import com.sdk.wxgroup.SendMessageTypeEnum;
import com.sdk.wxgroup.SendTextMessageVO; import com.sdk.wxgroup.SendTextMessageVO;
import java.util.Set;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -110,6 +122,14 @@ public class CustomPlanBizImpl implements CustomPlanBiz { ...@@ -110,6 +122,14 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
private CustomTimeControlDao customTimeControlDao; private CustomTimeControlDao customTimeControlDao;
@Autowired @Autowired
private TimeControlTaskMapper timeControlTaskMapper; private TimeControlTaskMapper timeControlTaskMapper;
@Autowired
private CustomPlanRightsSettingMapper customPlanRightsSettingMapper;
@Autowired
private CustomRightsSettingItemMapper customRightsSettingItemMapper;
@Autowired
private CustomRightsItemDescriptionMapper customRightsItemDescriptionMapper;
@Autowired
private RightsSettingItemDao rightsSettingItemDao;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -142,8 +162,11 @@ public class CustomPlanBizImpl implements CustomPlanBiz { ...@@ -142,8 +162,11 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
Integer copyPlanId = newCustomPlan.getId(); Integer copyPlanId = newCustomPlan.getId();
List<CustomPlanModuleVO> planModuleVOList = this.getCustomPlanModule(planId); List<CustomPlanModuleVO> planModuleVOList = this.getCustomPlanModule(planId);
this.addPlanModule(copyPlanId, planModuleVOList); this.addPlanModule(copyPlanId, planModuleVOList);
//复制权益
EditCustomRightsSettingVO editCustomRightsSettingVO = this.getCustomRightsSettingModule(planId);
editCustomRightsSettingVO.setPlanId(copyPlanId);
editCustomRightsSetting(editCustomRightsSettingVO);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateCustomPlan(CustomPlan customPlan) { public void updateCustomPlan(CustomPlan customPlan) {
...@@ -552,4 +575,120 @@ public class CustomPlanBizImpl implements CustomPlanBiz { ...@@ -552,4 +575,120 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
} }
return customPlan.stream().collect(Collectors.toMap(x -> x.getId().longValue(), Function.identity())); return customPlan.stream().collect(Collectors.toMap(x -> x.getId().longValue(), Function.identity()));
} }
@Override
@ParamLog("编辑定制计划权益")
@Transactional(rollbackFor = Exception.class)
public void editCustomRightsSetting(EditCustomRightsSettingVO editCustomRightsSettingVO) {
Integer planId = editCustomRightsSettingVO.getPlanId();
CustomPlan plan = customPlanMapper.getById(planId);
if (plan == null) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "方案不存在!");
}
customRightsItemDescriptionMapper.deleteByPlanId(planId);
customRightsSettingItemMapper.deleteByPlanId(planId);
customPlanRightsSettingMapper.deleteByPlanId(planId);
List<CustomPlanRightsSetting> customPlanRightsSettings = editCustomRightsSettingVO.getCustomPlanRightsSettings();
if (ListUtils.isEmpty(customPlanRightsSettings)) {
return;
}
if (customPlanRightsSettings.size() > 5) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "列表数量最多5条");
}
//描述列表
List<CustomRightsItemDescription> customRightsItemDescriptionList = new ArrayList<>();
customPlanRightsSettings.forEach(customPlanRightsSetting -> {
customPlanRightsSetting.setCustomPlanId(Long.valueOf(planId.toString()));
customPlanRightsSettingMapper.insert(customPlanRightsSetting);
List<CustomRightsSettingItem> customRightsSettingItemVOS = customPlanRightsSetting.getCustomRightsSettingItems();
if (ListUtils.isEmpty(customRightsSettingItemVOS)) {
return;
}
customRightsSettingItemVOS.forEach(customRightsSettingItem -> {
customRightsSettingItem.setCustomRightsSettingId(customPlanRightsSetting.getId());
customRightsSettingItemMapper.insert(customRightsSettingItem);
List<CustomRightsItemDescription> customRightsItemDescriptions = customRightsSettingItem.getCustomRightsItemDescriptions();
if (ListUtils.isEmpty(customRightsItemDescriptions)) {
return;
}
if (customRightsItemDescriptions.size() > 5) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "描述最多有5条");
}
customRightsItemDescriptions.forEach(customRightsItemDescription -> {
customRightsItemDescription.setCustomRightsSettingItemId(customRightsSettingItem.getId());
customRightsItemDescriptionList.add((customRightsItemDescription));
});
});
});
if (ListUtils.isEmpty(customRightsItemDescriptionList)) {
return;
}
customRightsItemDescriptionMapper.batchInsert(customRightsItemDescriptionList);
}
@Override
@ParamLog("编辑定制服务权益")
public EditCustomRightsSettingVO getCustomRightsSettingModule(Integer planId) {
CustomPlan customPlan = customPlanMapper.getById(planId);
if (null == customPlan) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "定制方案不存在");
}
EditCustomRightsSettingVO editCustomRightsSettingVO = customPlanRightsSettingMapper.getCustomRightsSettingModule(planId);
if (null == editCustomRightsSettingVO) {
return new EditCustomRightsSettingVO();
}
List<CustomPlanRightsSetting> customPlanRightsSettings = editCustomRightsSettingVO.getCustomPlanRightsSettings();
if (ListUtils.isEmpty(customPlanRightsSettings)) {
return editCustomRightsSettingVO;
}
List<CustomRightsSettingItem> customRightsSettingItems = new ArrayList<>();
for (CustomPlanRightsSetting customPlanRightsSetting : customPlanRightsSettings) {
if (!PlanRightsEnum.TOP.value.equals(customPlanRightsSetting.getModuleType()) || !PlanRightsEnum.BOTTOM.value.equals(customPlanRightsSetting.getModuleType())) {
List<CustomRightsSettingItem> customRightsSettingItemList = customPlanRightsSetting.getCustomRightsSettingItems();
if (!ListUtils.isEmpty(customRightsSettingItemList)){
customRightsSettingItems.addAll(customRightsSettingItemList);
}
continue;
}
if (null != customPlan && null != customPlan.getBookId()) {
Map<Long, String> bookNames = erpConsr.getBookNames(Arrays.asList(customPlan.getBookId()));
if (MapUtils.isNotEmpty(bookNames) && bookNames.containsKey(customPlan.getBookId())) {
customPlanRightsSetting.setBookName(bookNames.get(customPlan.getBookId()));
}
}
customPlanRightsSetting.setReadType(customPlan.getReadType());
}
//填充每个权益分类的图片
fillItemPicUrl(customPlanRightsSettings, customRightsSettingItems);
return editCustomRightsSettingVO;
}
//填充项目图片
private void fillItemPicUrl(List<CustomPlanRightsSetting> customPlanRightsSettings,
List<CustomRightsSettingItem> customRightsSettingItems) {
if (ListUtils.isEmpty(customRightsSettingItems)){
return;
}
Set<Long> rightsSettingClassifyIdSet =
customRightsSettingItems.stream().map(e -> e.getRightsSettingClassifyId()).collect(Collectors.toSet());
Map<Long, RightsSettingClassify> rightsSettingClassifyMap =
rightsSettingItemDao.getRightsClassifyMap(new ArrayList<>(rightsSettingClassifyIdSet));
if (MapUtils.isEmpty(rightsSettingClassifyMap)) {
return;
}
customPlanRightsSettings.forEach(customPlanRightsSetting -> {
if (ListUtils.isEmpty(customPlanRightsSetting.getCustomRightsSettingItems())) {
return;
}
customPlanRightsSetting.getCustomRightsSettingItems().forEach(customRightsSettingItem -> {
if (!rightsSettingClassifyMap.containsKey(customRightsSettingItem.getRightsSettingClassifyId())) {
return;
}
customRightsSettingItem
.setPicUrl(rightsSettingClassifyMap.get(customRightsSettingItem.getRightsSettingClassifyId()).getPicUrl());
});
});
}
} }
package com.pcloud.book.custom.entity;
import java.util.Date;
import java.util.List;
import lombok.Data;
@Data
public class CustomPlanRightsSetting {
private Long id;
private Long customPlanId;
private Integer moduleType;
private String moduleTitle;
private String buttonName;
private String defaultUrl;
private Integer readType;
private String bookName;
private Date createTime;
private Date updateTime;
private List<CustomRightsSettingItem> customRightsSettingItems;
}
\ No newline at end of file
package com.pcloud.book.custom.entity;
import java.util.Date;
import lombok.Data;
@Data
public class CustomRightsItemDescription {
private Long id;
private Long customRightsSettingItemId;
private String descripiton;
private Date createTime;
private Date updateTime;
}
\ No newline at end of file
package com.pcloud.book.custom.entity;
import java.util.Date;
import java.util.List;
import lombok.Data;
@Data
public class CustomRightsSettingItem {
private Long id;
private Long customRightsSettingId;
private Long rightsSettingClassifyId;
private String picUrl;
private String itemTitle;
private List<CustomRightsItemDescription> customRightsItemDescriptions;
private Date createTime;
private Date updateTime;
}
\ No newline at end of file
package com.pcloud.book.custom.enums;
public enum PlanRightsEnum {
/**
* 立享
*/
RIGHT_NOW(1),
/**
* 周
*/
WEEK(2),
/**
* 长期
*/
LONG(3),
/**
* 头部
*/
TOP(4),
/**
* 底部
*/
BOTTOM(5);
public final Integer value;
PlanRightsEnum(Integer value) {
this.value = value;
}
}
...@@ -10,6 +10,7 @@ import com.pcloud.book.custom.vo.AddBookNameVO; ...@@ -10,6 +10,7 @@ import com.pcloud.book.custom.vo.AddBookNameVO;
import com.pcloud.book.custom.vo.AddCustomPlan4UserVO; import com.pcloud.book.custom.vo.AddCustomPlan4UserVO;
import com.pcloud.book.custom.vo.AddSuggestionVO; import com.pcloud.book.custom.vo.AddSuggestionVO;
import com.pcloud.book.custom.vo.EditCustomPlanModuleVO; import com.pcloud.book.custom.vo.EditCustomPlanModuleVO;
import com.pcloud.book.custom.vo.EditCustomRightsSettingVO;
import com.pcloud.book.custom.vo.ModuleSuggestionVO; import com.pcloud.book.custom.vo.ModuleSuggestionVO;
import com.pcloud.book.custom.vo.SuggestionListVO; import com.pcloud.book.custom.vo.SuggestionListVO;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
...@@ -17,9 +18,11 @@ import com.pcloud.common.exceptions.BizException; ...@@ -17,9 +18,11 @@ import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.permission.PermissionException; import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil; import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -275,4 +278,30 @@ public class CustomPlanFacade { ...@@ -275,4 +278,30 @@ public class CustomPlanFacade {
} }
@ApiOperation("编辑定制服务权益")
@PostMapping("editCustomRightsSetting")
ResponseDto<?> editCustomRightsSetting(
@RequestHeader("token") String token,
@RequestBody EditCustomRightsSettingVO editCustomRightsSettingVO
)throws BizException, PermissionException{
customPlanBiz.editCustomRightsSetting(editCustomRightsSettingVO);
return new ResponseDto<>();
}
@ApiOperation("获取定制服务权益")
@GetMapping("getCustomRightsSettingModule")
ResponseDto<EditCustomRightsSettingVO> getCustomRightsSettingModule(
@RequestHeader String token, @RequestParam Integer planId
)throws BizException, PermissionException{
return new ResponseDto<EditCustomRightsSettingVO>(customPlanBiz.getCustomRightsSettingModule(planId));
}
@ApiOperation("客户端获取定制服务权益")
@GetMapping("getCustomRightsSettingModule4Wechat")
ResponseDto<EditCustomRightsSettingVO> getCustomRightsSettingModule4Wechat(
@CookieValue("userInfo") String userInfo, @RequestParam Integer planId
)throws BizException, PermissionException{
return new ResponseDto<EditCustomRightsSettingVO>(customPlanBiz.getCustomRightsSettingModule(planId));
}
} }
package com.pcloud.book.custom.mapper;
import com.pcloud.book.custom.entity.CustomPlanRightsSetting;
import com.pcloud.book.custom.vo.EditCustomRightsSettingVO;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CustomPlanRightsSettingMapper {
int deleteByPrimaryKey(Long id);
int insert(CustomPlanRightsSetting record);
int insertSelective(CustomPlanRightsSetting record);
CustomPlanRightsSetting selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(CustomPlanRightsSetting record);
int updateByPrimaryKey(CustomPlanRightsSetting record);
void deleteByPlanId(Integer planId);
EditCustomRightsSettingVO getCustomRightsSettingModule(Integer planId);
}
\ No newline at end of file
package com.pcloud.book.custom.mapper;
import com.pcloud.book.custom.entity.CustomRightsItemDescription;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CustomRightsItemDescriptionMapper {
int deleteByPrimaryKey(Long id);
int insert(CustomRightsItemDescription record);
int insertSelective(CustomRightsItemDescription record);
CustomRightsItemDescription selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(CustomRightsItemDescription record);
int updateByPrimaryKey(CustomRightsItemDescription record);
void batchInsert(List<CustomRightsItemDescription> customRightsItemDescriptionList);
void deleteByPlanId(Integer planId);
}
\ No newline at end of file
package com.pcloud.book.custom.mapper;
import com.pcloud.book.custom.entity.CustomPlan;
import com.pcloud.book.custom.entity.CustomRightsSettingItem;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CustomRightsSettingItemMapper {
int deleteByPrimaryKey(Long id);
int insert(CustomRightsSettingItem record);
int insertSelective(CustomRightsSettingItem record);
CustomRightsSettingItem selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(CustomRightsSettingItem record);
int updateByPrimaryKey(CustomRightsSettingItem record);
void deleteByPlanId(Integer planId);
}
\ No newline at end of file
package com.pcloud.book.custom.vo;
import com.pcloud.book.custom.entity.CustomPlanRightsSetting;
import java.util.List;
import lombok.Data;
/**
* @ClassName com.pcloud.book.custom.vo.CustomRightsSettingVO
* @Author 吴博
* @Description 定制服务权益
* @Date 2020/5/19 15:11
* @Version 1.0
**/
@Data
public class EditCustomRightsSettingVO {
private Integer planId;
private List<CustomPlanRightsSetting> customPlanRightsSettings;
}
\ No newline at end of file
...@@ -5,6 +5,8 @@ import com.pcloud.book.rightsSetting.entity.RightsSettingClassify; ...@@ -5,6 +5,8 @@ import com.pcloud.book.rightsSetting.entity.RightsSettingClassify;
import com.pcloud.book.rightsSetting.entity.RightsSettingItem; import com.pcloud.book.rightsSetting.entity.RightsSettingItem;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
import java.util.ArrayList;
import java.util.Map;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -45,4 +47,6 @@ public interface RightsSettingItemDao extends BaseDao<RightsSettingItem>{ ...@@ -45,4 +47,6 @@ public interface RightsSettingItemDao extends BaseDao<RightsSettingItem>{
List<RightsSettingItem> getItemsByRightsSettingId4Read(Long rightsSettingId, String rightsType); List<RightsSettingItem> getItemsByRightsSettingId4Read(Long rightsSettingId, String rightsType);
ReadTypeCountDTO getCount4Item(Long rightsSettingId); ReadTypeCountDTO getCount4Item(Long rightsSettingId);
Map<Long, RightsSettingClassify> getRightsClassifyMap(ArrayList<Long> longs);
} }
\ No newline at end of file
...@@ -6,6 +6,8 @@ import com.pcloud.book.rightsSetting.entity.RightsSettingClassify; ...@@ -6,6 +6,8 @@ import com.pcloud.book.rightsSetting.entity.RightsSettingClassify;
import com.pcloud.book.rightsSetting.entity.RightsSettingItem; import com.pcloud.book.rightsSetting.entity.RightsSettingItem;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
import com.pcloud.common.utils.ListUtils;
import java.util.ArrayList;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.HashMap; import java.util.HashMap;
...@@ -60,4 +62,12 @@ public class RightsSettingItemDaoImpl extends BaseDaoImpl<RightsSettingItem> imp ...@@ -60,4 +62,12 @@ public class RightsSettingItemDaoImpl extends BaseDaoImpl<RightsSettingItem> imp
public ReadTypeCountDTO getCount4Item(Long rightsSettingId) { public ReadTypeCountDTO getCount4Item(Long rightsSettingId) {
return getSessionTemplate().selectOne(getStatement("getCount4Item"),rightsSettingId); return getSessionTemplate().selectOne(getStatement("getCount4Item"),rightsSettingId);
} }
@Override
public Map<Long, RightsSettingClassify> getRightsClassifyMap(ArrayList<Long> ids) {
if (ListUtils.isEmpty(ids)){
return new HashMap<>();
}
return getSessionTemplate().selectMap(getStatement("getRightsClassifyMap"),ids,"id");
}
} }
...@@ -26,7 +26,6 @@ public class RightsSettingClassify extends BaseEntity { ...@@ -26,7 +26,6 @@ public class RightsSettingClassify extends BaseEntity {
*/ */
private String rightsType; private String rightsType;
private String picUrl;
} }
\ No newline at end of file
...@@ -5,8 +5,8 @@ server: ...@@ -5,8 +5,8 @@ server:
eureka: eureka:
instance: instance:
status-page-url-path: /book/v1.0/swagger-ui.html status-page-url-path: /book/v1.0/swagger-ui.html
#client: client:
#register-with-eureka: false #禁止自己当做服务注册 register-with-eureka: false #禁止自己当做服务注册
spring: spring:
application: application:
......
...@@ -16,18 +16,18 @@ ...@@ -16,18 +16,18 @@
connectionURL="jdbc:mysql://192.168.92.41:3306/book" userId="root" connectionURL="jdbc:mysql://192.168.92.41:3306/book" userId="root"
password="LGSC2016.lgsc"/> password="LGSC2016.lgsc"/>
<javaModelGenerator targetPackage="com.pcloud.book.rightsSetting.entity" <javaModelGenerator targetPackage="com.pcloud.book.custom.entity"
targetProject="src\main\java"> targetProject="src\main\java">
<property name="enableSubPackages" value="true"/> <property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/> <property name="trimStrings" value="true"/>
</javaModelGenerator> </javaModelGenerator>
<sqlMapGenerator targetPackage="mapper.rightssetting" <sqlMapGenerator targetPackage="mapper.custom"
targetProject="src\main\resources"> targetProject="src\main\resources">
<property name="enableSubPackages" value="true"/> <property name="enableSubPackages" value="true"/>
</sqlMapGenerator> </sqlMapGenerator>
<javaClientGenerator targetPackage="com.pcloud.book.rightsSetting.dao" <javaClientGenerator targetPackage="com.pcloud.book.custom.mapper"
targetProject="src\main\java" type="XMLMAPPER"> targetProject="src\main\java" type="XMLMAPPER">
<property name="enableSubPackages" value="true"/> <property name="enableSubPackages" value="true"/>
</javaClientGenerator> </javaClientGenerator>
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
selectByExampleQueryId="false"> selectByExampleQueryId="false">
</table>--> </table>-->
<table tableName="rights_read_type" domainObjectName="RightsReadType" <table tableName="custom_rights_item_description" domainObjectName="CustomRightsItemDescription"
enableCountByExample="false" enableUpdateByExample="false" enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false" enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false"> selectByExampleQueryId="false">
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.custom.mapper.CustomPlanRightsSettingMapper" >
<resultMap id="BaseResultMap" type="com.pcloud.book.custom.entity.CustomPlanRightsSetting" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="custom_plan_id" property="customPlanId" jdbcType="BIGINT" />
<result column="module_type" property="moduleType" jdbcType="INTEGER" />
<result column="module_title" property="moduleTitle" jdbcType="VARCHAR" />
<result column="button_name" property="buttonName" jdbcType="VARCHAR" />
<result column="default_url" property="defaultUrl" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap>
<resultMap id="VOMap" type="com.pcloud.book.custom.vo.EditCustomRightsSettingVO">
<id column="custom_plan_id" property="planId"/>
<collection property="customPlanRightsSettings" ofType="com.pcloud.book.custom.entity.CustomPlanRightsSetting"
resultMap="RightsSettingMap"/>
</resultMap>
<resultMap id="RightsSettingMap" type="com.pcloud.book.custom.entity.CustomPlanRightsSetting">
<id column="csid" property="id"/>
<result column="custom_plan_id" property="customPlanId"/>
<result column="module_type" property="moduleType"/>
<result column="module_title" property="moduleTitle"/>
<result column="button_name" property="buttonName"/>
<result column="default_url" property="defaultUrl"/>
<collection property="customRightsSettingItems" ofType="com.pcloud.book.custom.entity.CustomRightsSettingItem" resultMap="ItemMap"/>
</resultMap>
<resultMap id="ItemMap" type="com.pcloud.book.custom.entity.CustomRightsSettingItem">
<id column="crid" property="id"/>
<result column="custom_rights_setting_id" property="customRightsSettingId"/>
<result column="rights_setting_classify_id" property="rightsSettingClassifyId"/>
<result column="item_title" property="itemTitle"/>
<collection property="customRightsItemDescriptions" ofType="com.pcloud.book.custom.entity.CustomRightsItemDescription"
resultMap="descriptionMap"/>
</resultMap>
<resultMap id="descriptionMap" type="com.pcloud.book.custom.entity.CustomRightsItemDescription">
<id column="cdid" property="id"/>
<result column="custom_rights_setting_item_id" property="customRightsSettingItemId"/>
<result column="descripiton" property="descripiton"/>
</resultMap>
<sql id="Base_Column_List" >
id, custom_plan_id, module_type, module_title, button_name, default_url, create_time,
update_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
</select>
<select id="getCustomRightsSettingModule" resultMap="VOMap" parameterType="integer">
SELECT
cs.id csid,
custom_plan_id,
module_type,
module_title,
button_name,
default_url,
cr.id crid,
cr.custom_rights_setting_id,
cr.rights_setting_classify_id,
cr.item_title,
cd.id cdid,
cd.custom_rights_setting_item_id ,
cd.descripiton
FROM
`custom_plan_rights_setting` cs
LEFT JOIN custom_rights_setting_item cr ON cs.id = cr.custom_rights_setting_id
left join custom_rights_item_description cd on cr.id = cd.custom_rights_setting_item_id
where cs.custom_plan_id = #{planId}
order by cs.id, cr.id, cd.id;
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from custom_plan_rights_setting
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByPlanId" parameterType="integer">
delete from
custom_plan_rights_setting
where custom_plan_id = #{planId,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.pcloud.book.custom.entity.CustomPlanRightsSetting" useGeneratedKeys="true" keyProperty="id">
insert into custom_plan_rights_setting (custom_plan_id, module_type,
module_title, button_name, default_url,
create_time, update_time)
values (#{customPlanId,jdbcType=BIGINT}, #{moduleType,jdbcType=INTEGER},
#{moduleTitle,jdbcType=VARCHAR}, #{buttonName,jdbcType=VARCHAR}, #{defaultUrl,jdbcType=VARCHAR},
now(),now())
</insert>
<insert id="insertSelective" parameterType="com.pcloud.book.custom.entity.CustomPlanRightsSetting" >
insert into custom_plan_rights_setting
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="customPlanId != null" >
custom_plan_id,
</if>
<if test="moduleType != null" >
module_type,
</if>
<if test="moduleTitle != null" >
module_title,
</if>
<if test="buttonName != null" >
button_name,
</if>
<if test="defaultUrl != null" >
default_url,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="updateTime != null" >
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="customPlanId != null" >
#{customPlanId,jdbcType=BIGINT},
</if>
<if test="moduleType != null" >
#{moduleType,jdbcType=INTEGER},
</if>
<if test="moduleTitle != null" >
#{moduleTitle,jdbcType=VARCHAR},
</if>
<if test="buttonName != null" >
#{buttonName,jdbcType=VARCHAR},
</if>
<if test="defaultUrl != null" >
#{defaultUrl,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.custom.entity.CustomPlanRightsSetting" >
update custom_plan_rights_setting
<set >
<if test="customPlanId != null" >
custom_plan_id = #{customPlanId,jdbcType=BIGINT},
</if>
<if test="moduleType != null" >
module_type = #{moduleType,jdbcType=INTEGER},
</if>
<if test="moduleTitle != null" >
module_title = #{moduleTitle,jdbcType=VARCHAR},
</if>
<if test="buttonName != null" >
button_name = #{buttonName,jdbcType=VARCHAR},
</if>
<if test="defaultUrl != null" >
default_url = #{defaultUrl,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.pcloud.book.custom.entity.CustomPlanRightsSetting" >
update custom_plan_rights_setting
set custom_plan_id = #{customPlanId,jdbcType=BIGINT},
module_type = #{moduleType,jdbcType=INTEGER},
module_title = #{moduleTitle,jdbcType=VARCHAR},
button_name = #{buttonName,jdbcType=VARCHAR},
default_url = #{defaultUrl,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.custom.mapper.CustomRightsItemDescriptionMapper" >
<resultMap id="BaseResultMap" type="com.pcloud.book.custom.entity.CustomRightsItemDescription" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="custom_rights_setting_item_id" property="customRightsSettingItemId" jdbcType="BIGINT" />
<result column="descripiton" property="descripiton" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, custom_rights_setting_item_id, descripiton, create_time, update_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from custom_rights_item_description
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from custom_rights_item_description
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByPlanId">
DELETE custom_rights_item_description
FROM
custom_rights_item_description cd
RIGHT JOIN (
SELECT
crid.id
FROM
custom_rights_item_description crid
left join
custom_rights_setting_item cr on crid.custom_rights_setting_item_id = cr.id
LEFT JOIN custom_plan_rights_setting cp ON cr.custom_rights_setting_id = cp.id
WHERE
cp.custom_plan_id = #{planId}
) m ON cd.id = m.id
</delete>
<insert id="insert" parameterType="com.pcloud.book.custom.entity.CustomRightsItemDescription" >
insert into custom_rights_item_description (id, custom_rights_setting_item_id, descripiton,
create_time, update_time)
values (#{id,jdbcType=BIGINT}, #{customRightsSettingItemId,jdbcType=BIGINT}, #{descripiton,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.pcloud.book.custom.entity.CustomRightsItemDescription" >
insert into custom_rights_item_description
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="customRightsSettingItemId != null" >
custom_rights_setting_item_id,
</if>
<if test="descripiton != null" >
descripiton,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="updateTime != null" >
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="customRightsSettingItemId != null" >
#{customRightsSettingItemId,jdbcType=BIGINT},
</if>
<if test="descripiton != null" >
#{descripiton,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<insert id="batchInsert" parameterType="com.pcloud.book.custom.entity.CustomRightsItemDescription">
insert into custom_rights_item_description (custom_rights_setting_item_id, descripiton,
create_time, update_time)
values
<foreach collection="list" index="index" item="item" separator=",">
(#{item.customRightsSettingItemId,jdbcType=BIGINT}, #{item.descripiton,jdbcType=VARCHAR},
now(), now())
</foreach>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.custom.entity.CustomRightsItemDescription" >
update custom_rights_item_description
<set >
<if test="customRightsSettingItemId != null" >
custom_rights_setting_item_id = #{customRightsSettingItemId,jdbcType=BIGINT},
</if>
<if test="descripiton != null" >
descripiton = #{descripiton,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.pcloud.book.custom.entity.CustomRightsItemDescription" >
update custom_rights_item_description
set custom_rights_setting_item_id = #{customRightsSettingItemId,jdbcType=BIGINT},
descripiton = #{descripiton,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.custom.mapper.CustomRightsSettingItemMapper" >
<resultMap id="BaseResultMap" type="com.pcloud.book.custom.entity.CustomRightsSettingItem" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="custom_rights_setting_id" property="customRightsSettingId" jdbcType="BIGINT" />
<result column="rights_setting_classify_id" property="rightsSettingClassifyId" jdbcType="BIGINT" />
<result column="item_title" property="itemTitle" jdbcType="VARCHAR" />
<result column="description" property="description" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, custom_rights_setting_id, rights_setting_classify_id, item_title, description,
create_time, update_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from custom_rights_setting_item
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from custom_rights_setting_item
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByPlanId" parameterType="integer">
DELETE custom_rights_setting_item
FROM
custom_rights_setting_item cs
RIGHT JOIN (
SELECT
cr.id
FROM
custom_rights_setting_item cr
LEFT JOIN custom_plan_rights_setting cp ON cr.custom_rights_setting_id = cp.id
WHERE
cp.custom_plan_id = #{planId}
) m ON cs.id = m.id
</delete>
<insert id="insert" parameterType="com.pcloud.book.custom.entity.CustomRightsSettingItem" useGeneratedKeys="true" keyProperty="id" >
insert into custom_rights_setting_item (custom_rights_setting_id, rights_setting_classify_id,
item_title, create_time,
update_time)
values (#{customRightsSettingId,jdbcType=BIGINT}, #{rightsSettingClassifyId,jdbcType=BIGINT},
#{itemTitle,jdbcType=VARCHAR}, now(), now())
</insert>
<insert id="insertSelective" parameterType="com.pcloud.book.custom.entity.CustomRightsSettingItem" >
insert into custom_rights_setting_item
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="customRightsSettingId != null" >
custom_rights_setting_id,
</if>
<if test="rightsSettingClassifyId != null" >
rights_setting_classify_id,
</if>
<if test="itemTitle != null" >
item_title,
</if>
<if test="description != null" >
description,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="updateTime != null" >
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="customRightsSettingId != null" >
#{customRightsSettingId,jdbcType=BIGINT},
</if>
<if test="rightsSettingClassifyId != null" >
#{rightsSettingClassifyId,jdbcType=BIGINT},
</if>
<if test="itemTitle != null" >
#{itemTitle,jdbcType=VARCHAR},
</if>
<if test="description != null" >
#{description,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.custom.entity.CustomRightsSettingItem" >
update custom_rights_setting_item
<set >
<if test="customRightsSettingId != null" >
custom_rights_setting_id = #{customRightsSettingId,jdbcType=BIGINT},
</if>
<if test="rightsSettingClassifyId != null" >
rights_setting_classify_id = #{rightsSettingClassifyId,jdbcType=BIGINT},
</if>
<if test="itemTitle != null" >
item_title = #{itemTitle,jdbcType=VARCHAR},
</if>
<if test="description != null" >
description = #{description,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.pcloud.book.custom.entity.CustomRightsSettingItem" >
update custom_rights_setting_item
set custom_rights_setting_id = #{customRightsSettingId,jdbcType=BIGINT},
rights_setting_classify_id = #{rightsSettingClassifyId,jdbcType=BIGINT},
item_title = #{itemTitle,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
</insert> </insert>
<select id="getAllRightsClassify" parameterType="map" resultType="com.pcloud.book.rightsSetting.entity.RightsSettingClassify"> <select id="getAllRightsClassify" parameterType="map" resultType="com.pcloud.book.rightsSetting.entity.RightsSettingClassify">
SELECT id, classify, rights_type rightsType SELECT id, classify, rights_type rightsType,pic_url picUrl
FROM rights_setting_classify FROM rights_setting_classify
WHERE 1=1 WHERE 1=1
<if test="rightsType!=null"> <if test="rightsType!=null">
...@@ -140,4 +140,17 @@ ...@@ -140,4 +140,17 @@
rights_setting_id = #{rightsSettingId}; rights_setting_id = #{rightsSettingId};
</select> </select>
<select id="getRightsClassifyMap" parameterType="list" resultType="com.pcloud.book.rightsSetting.entity.RightsSettingClassify">
SELECT id, classify, rights_type rightsType, pic_url picUrl
FROM rights_setting_classify
<where>
<if test="list != null">
id in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
</mapper> </mapper>
\ No newline at end of file
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