proj_name
stringclasses 131
values | relative_path
stringlengths 30
228
| class_name
stringlengths 1
68
| func_name
stringlengths 1
48
| masked_class
stringlengths 78
9.82k
| func_body
stringlengths 46
9.61k
| len_input
int64 29
2.01k
| len_output
int64 14
1.94k
| total
int64 55
2.05k
| relevant_context
stringlengths 0
38.4k
|
|---|---|---|---|---|---|---|---|---|---|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/member/serviceimpl/StoreMenuRoleServiceImpl.java
|
StoreMenuRoleServiceImpl
|
findAllMenu
|
class StoreMenuRoleServiceImpl extends ServiceImpl<StoreMenuRoleMapper, StoreMenuRole> implements StoreMenuRoleService {
/**
* 菜单
*/
@Autowired
private StoreMenuService storeMenuService;
@Autowired
private Cache<Object> cache;
@Override
public List<StoreMenuRole> findByRoleId(String roleId) {
LambdaQueryWrapper<StoreMenuRole> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StoreMenuRole::getRoleId, roleId);
return this.baseMapper.selectList(queryWrapper);
}
@Override
public List<StoreUserMenuVO> findAllMenu(String clerkId, String memberId) {<FILL_FUNCTION_BODY>}
@Override
public void updateRoleMenu(String roleId, List<StoreMenuRole> roleMenus) {
try {
roleMenus.forEach(role -> role.setStoreId(UserContext.getCurrentUser().getStoreId()));
//删除角色已经绑定的菜单
this.delete(roleId);
//重新保存角色菜单关系
this.saveBatch(roleMenus);
cache.vagueDel(CachePrefix.PERMISSION_LIST.getPrefix(UserEnums.STORE));
cache.vagueDel(CachePrefix.STORE_USER_MENU.getPrefix());
} catch (Exception e) {
log.error("修改用户权限错误", e);
}
}
@Override
public void delete(String roleId) {
//删除
QueryWrapper<StoreMenuRole> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("role_id", roleId);
this.remove(queryWrapper);
cache.vagueDel(CachePrefix.PERMISSION_LIST.getPrefix(UserEnums.STORE));
cache.vagueDel(CachePrefix.STORE_USER_MENU.getPrefix());
}
@Override
public void delete(List<String> roleId) {
//删除
QueryWrapper<StoreMenuRole> queryWrapper = new QueryWrapper<>();
queryWrapper.in("role_id", roleId);
this.remove(queryWrapper);
cache.vagueDel(CachePrefix.PERMISSION_LIST.getPrefix(UserEnums.STORE));
cache.vagueDel(CachePrefix.STORE_USER_MENU.getPrefix());
}
}
|
String cacheKey = CachePrefix.STORE_USER_MENU.getPrefix() + memberId;
List<StoreUserMenuVO> menuList = (List<StoreUserMenuVO>) cache.get(cacheKey);
if (menuList == null || menuList.isEmpty()) {
menuList = storeMenuService.getUserRoleMenu(clerkId);
cache.put(cacheKey, menuList);
}
return menuList;
| 614
| 111
| 725
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/member/serviceimpl/StoreMenuServiceImpl.java
|
StoreMenuServiceImpl
|
findUserList
|
class StoreMenuServiceImpl extends ServiceImpl<StoreMenuMapper, StoreMenu> implements StoreMenuService {
/**
* 菜单角色
*/
@Autowired
private StoreMenuRoleService storeMenuRoleService;
@Autowired
private Cache cache;
/**
* 店员
*/
@Autowired
private ClerkService clerkService;
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteIds(List<String> ids) {
QueryWrapper<StoreMenuRole> queryWrapper = new QueryWrapper<>();
queryWrapper.in("menu_id", ids);
//如果已有角色绑定菜单,则不能直接删除
if (storeMenuRoleService.count(queryWrapper) > 0) {
throw new ServiceException(ResultCode.PERMISSION_MENU_ROLE_ERROR);
}
cache.vagueDel(CachePrefix.PERMISSION_LIST.getPrefix(UserEnums.STORE));
cache.vagueDel(CachePrefix.STORE_USER_MENU.getPrefix());
this.removeByIds(ids);
}
@Override
public List<StoreMenuVO> findUserTree() {
AuthUser authUser = Objects.requireNonNull(UserContext.getCurrentUser());
if (Boolean.TRUE.equals(authUser.getIsSuper())) {
return this.tree();
}
//获取当前登录用户的店员信息
Clerk clerk = clerkService.getOne(new LambdaQueryWrapper<Clerk>().eq(Clerk::getMemberId, authUser.getId()));
//获取当前店员角色的菜单列表
List<StoreMenu> userMenus = this.findUserList(authUser.getId(), clerk.getId());
return this.tree(userMenus);
}
@Override
public List<StoreMenu> findUserList(String userId, String clerkId) {<FILL_FUNCTION_BODY>}
/**
* 添加更新菜单
*
* @param storeMenu 菜单数据
* @return 是否成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public boolean saveOrUpdateMenu(StoreMenu storeMenu) {
if (CharSequenceUtil.isNotEmpty(storeMenu.getId())) {
cache.vagueDel(CachePrefix.PERMISSION_LIST.getPrefix(UserEnums.STORE));
cache.vagueDel(CachePrefix.STORE_USER_MENU.getPrefix());
}
return this.saveOrUpdate(storeMenu);
}
@Override
public List<StoreUserMenuVO> getUserRoleMenu(String clerkId) {
return this.baseMapper.getUserRoleMenu(clerkId);
}
@Override
public List<StoreMenu> findByRoleIds(String roleId) {
QueryWrapper<StoreMenu> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("role_id", roleId);
return this.list(queryWrapper);
}
@Override
public List<StoreMenu> searchList(MenuSearchParams menuSearchParams) {
//title 需要特殊处理
String title = null;
if (CharSequenceUtil.isNotEmpty(menuSearchParams.getTitle())) {
title = menuSearchParams.getTitle();
menuSearchParams.setTitle(null);
}
QueryWrapper<StoreMenu> queryWrapper = PageUtil.initWrapper(menuSearchParams, new SearchVO());
if (CharSequenceUtil.isNotEmpty(title)) {
queryWrapper.like("title", title);
}
queryWrapper.orderByDesc("sort_order");
return this.baseMapper.selectList(queryWrapper);
}
@Override
public List<StoreMenuVO> tree() {
try {
List<StoreMenu> menus = this.list();
return tree(menus);
} catch (Exception e) {
log.error("菜单树错误", e);
}
return Collections.emptyList();
}
/**
* 传入自定义菜单集合
*
* @param menus 自定义菜单集合
* @return 修改后的自定义菜单集合
*/
private List<StoreMenuVO> tree(List<StoreMenu> menus) {
List<StoreMenuVO> tree = new ArrayList<>();
menus.forEach(item -> {
if (item.getLevel() == 0) {
StoreMenuVO treeItem = new StoreMenuVO(item);
initChild(treeItem, menus);
tree.add(treeItem);
}
});
//对一级菜单排序
tree.sort(Comparator.comparing(StoreMenu::getSortOrder));
return tree;
}
/**
* 递归初始化子树
*
* @param tree 树结构
* @param menus 数据库对象集合
*/
private void initChild(StoreMenuVO tree, List<StoreMenu> menus) {
if (menus == null) {
return;
}
menus.stream()
.filter(item -> (item.getParentId().equals(tree.getId())))
.forEach(child -> {
StoreMenuVO childTree = new StoreMenuVO(child);
initChild(childTree, menus);
tree.getChildren().add(childTree);
});
}
}
|
String cacheKey = CachePrefix.STORE_USER_MENU.getPrefix() + userId;
List<StoreMenu> menuList = (List<StoreMenu>) cache.get(cacheKey);
if (menuList == null || menuList.isEmpty()) {
menuList = this.baseMapper.findByUserId(clerkId);
cache.put(cacheKey, menuList);
}
return menuList;
| 1,372
| 108
| 1,480
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/member/serviceimpl/StoreRoleServiceImpl.java
|
StoreRoleServiceImpl
|
findByDefaultRole
|
class StoreRoleServiceImpl extends ServiceImpl<StoreRoleMapper, StoreRole> implements StoreRoleService {
/**
* 部门角色
*/
@Autowired
private StoreDepartmentRoleService storeDepartmentRoleService;
/**
* 用户权限
*/
@Autowired
private StoreClerkRoleService storeClerkRoleService;
@Autowired
private StoreMenuRoleService storeMenuRoleService;
@Autowired
private Cache cache;
@Override
public List<StoreRole> findByDefaultRole(Boolean defaultRole) {<FILL_FUNCTION_BODY>}
@Override
public void deleteRoles(List<String> roleIds) {
//校验是否为当前店铺
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.in("id", roleIds);
List<StoreRole> roles = this.baseMapper.selectList(queryWrapper);
roles.forEach(role -> {
if (!role.getStoreId().equals(UserContext.getCurrentUser().getStoreId())) {
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
}
});
queryWrapper = new QueryWrapper<>();
queryWrapper.in("role_id", roleIds);
//校验是否绑定店铺部门
if (storeDepartmentRoleService.count(queryWrapper) > 0) {
throw new ServiceException(ResultCode.PERMISSION_DEPARTMENT_ROLE_ERROR);
}
//校验是否绑定店员
if (storeClerkRoleService.count(queryWrapper) > 0) {
throw new ServiceException(ResultCode.PERMISSION_USER_ROLE_ERROR);
}
//删除角色
this.removeByIds(roleIds);
//删除角色与菜单关联
storeMenuRoleService.remove(queryWrapper);
cache.vagueDel(CachePrefix.PERMISSION_LIST.getPrefix(UserEnums.STORE));
cache.vagueDel(CachePrefix.STORE_USER_MENU.getPrefix());
}
@Override
public Boolean update(StoreRole storeRole) {
StoreRole storeRoleTemp = this.getById(storeRole.getId());
//校验店铺角色是否存在
if (storeRoleTemp == null) {
throw new ServiceException(ResultCode.PERMISSION_ROLE_NOT_FOUND_ERROR);
}
//校验店铺角色是否属于当前店铺
if (!storeRoleTemp.getStoreId().equals(UserContext.getCurrentUser().getStoreId())) {
throw new ServiceException(ResultCode.PERMISSION_ROLE_NOT_FOUND_ERROR);
}
cache.vagueDel(CachePrefix.PERMISSION_LIST.getPrefix(UserEnums.STORE));
cache.vagueDel(CachePrefix.STORE_USER_MENU.getPrefix());
return updateById(storeRole);
}
@Override
public Boolean saveStoreRole(StoreRole storeRole) {
storeRole.setStoreId(UserContext.getCurrentUser().getStoreId());
return save(storeRole);
}
@Override
public List<StoreRole> list(List<String> ids) {
QueryWrapper<StoreRole> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("store_id", UserContext.getCurrentUser().getStoreId());
queryWrapper.in("id", ids);
return this.baseMapper.selectList(queryWrapper);
}
}
|
QueryWrapper<StoreRole> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("default_role", true);
return baseMapper.selectList(queryWrapper);
| 875
| 44
| 919
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/member/token/MemberTokenGenerate.java
|
MemberTokenGenerate
|
createToken
|
class MemberTokenGenerate extends AbstractTokenGenerate<Member> {
@Autowired
private TokenUtil tokenUtil;
@Autowired
private RocketmqCustomProperties rocketmqCustomProperties;
@Autowired
private RocketMQTemplate rocketMQTemplate;
@Override
public Token createToken(Member member, Boolean longTerm) {<FILL_FUNCTION_BODY>}
@Override
public Token refreshToken(String refreshToken) {
return tokenUtil.refreshToken(refreshToken);
}
}
|
ClientTypeEnum clientTypeEnum;
try {
//获取客户端类型
String clientType = ThreadContextHolder.getHttpRequest().getHeader("clientType");
//如果客户端为空,则缺省值为PC,pc第三方登录时不会传递此参数
if (clientType == null) {
clientTypeEnum = ClientTypeEnum.PC;
} else {
clientTypeEnum = ClientTypeEnum.valueOf(clientType);
}
} catch (Exception e) {
clientTypeEnum = ClientTypeEnum.UNKNOWN;
}
//记录最后登录时间,客户端类型
member.setLastLoginDate(new Date());
member.setClientEnum(clientTypeEnum.name());
String destination = rocketmqCustomProperties.getMemberTopic() + ":" + MemberTagsEnum.MEMBER_LOGIN.name();
rocketMQTemplate.asyncSend(destination, member, RocketmqSendCallbackBuilder.commonCallback());
AuthUser authUser = AuthUser.builder()
.username(member.getUsername())
.face(member.getFace())
.id(member.getId())
.role(UserEnums.MEMBER)
.nickName(member.getNickName())
.longTerm(longTerm)
.build();
//登陆成功生成token
return tokenUtil.createToken(authUser);
| 144
| 347
| 491
|
<methods>public non-sealed void <init>() ,public abstract cn.lili.common.security.token.Token createToken(cn.lili.modules.member.entity.dos.Member, java.lang.Boolean) ,public abstract cn.lili.common.security.token.Token refreshToken(java.lang.String) <variables>public cn.lili.common.security.enums.UserEnums role
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/member/token/StoreTokenGenerate.java
|
StoreTokenGenerate
|
permissionList
|
class StoreTokenGenerate extends AbstractTokenGenerate<Member> {
@Autowired
private StoreService storeService;
@Autowired
private TokenUtil tokenUtil;
@Autowired
private StoreMenuRoleService storeMenuRoleService;
@Autowired
private Cache cache;
@Autowired
private ClerkService clerkService;
@Override
public Token createToken(Member member, Boolean longTerm) {
if (Boolean.FALSE.equals(member.getHaveStore())) {
throw new ServiceException(ResultCode.STORE_NOT_OPEN);
}
//根据会员id查询店员信息
Clerk clerk = clerkService.getClerkByMemberId(member.getId());
if (clerk == null) {
throw new ServiceException(ResultCode.CLERK_NOT_FOUND_ERROR);
}
if (Boolean.FALSE.equals(clerk.getStatus())) {
throw new ServiceException(ResultCode.CLERK_DISABLED_ERROR);
}
//获取当前用户权限
List<StoreUserMenuVO> storeUserMenuVOS = storeMenuRoleService.findAllMenu(clerk.getId(), member.getId());
//缓存权限列表
cache.put(CachePrefix.PERMISSION_LIST.getPrefix(UserEnums.STORE) + member.getId(), this.permissionList(storeUserMenuVOS));
//查询店铺信息
Store store = storeService.getById(clerk.getStoreId());
if (store == null) {
throw new ServiceException(ResultCode.STORE_NOT_OPEN);
}
//构建对象
AuthUser authUser = AuthUser.builder()
.username(member.getUsername())
.id(member.getId())
.role(UserEnums.STORE)
.nickName(member.getNickName())
.isSuper(clerk.getIsSuper())
.clerkId(clerk.getId())
.face(store.getStoreLogo())
.storeId(store.getId())
.storeName(store.getStoreName())
.longTerm(longTerm)
.build();
return tokenUtil.createToken(authUser);
}
@Override
public Token refreshToken(String refreshToken) {
return tokenUtil.refreshToken(refreshToken);
}
/**
* 获取用户权限
*
* @param userMenuVOList
* @return
*/
public Map<String, List<String>> permissionList(List<StoreUserMenuVO> userMenuVOList) {<FILL_FUNCTION_BODY>}
/**
* 初始赋予的权限,查看权限包含首页流量统计权限,
* 超级权限包含个人信息维护,密码修改权限
*
* @param superPermissions 超级权限
* @param queryPermissions 查询权限
*/
void initPermission(List<String> superPermissions, List<String> queryPermissions) {
//菜单管理
superPermissions.add("/store/menu*");
//退出权限
superPermissions.add("/store/passport/login/logout*");
//修改
superPermissions.add("/store/passport/login*");
//店铺设置
queryPermissions.add("/store/settings/storeSettings*");
//文章接口
queryPermissions.add("/store/other/article*");
//首页统计
queryPermissions.add("/store/statistics/index*");
}
}
|
Map<String, List<String>> permission = new HashMap<>(2);
List<String> superPermissions = new ArrayList<>();
List<String> queryPermissions = new ArrayList<>();
initPermission(superPermissions, queryPermissions);
//循环权限菜单
if (userMenuVOList != null && !userMenuVOList.isEmpty()) {
userMenuVOList.forEach(menu -> {
//循环菜单,赋予用户权限
if (CharSequenceUtil.isNotEmpty(menu.getPermission())) {
//获取路径集合
String[] permissionUrl = menu.getPermission().split(",");
//for循环路径集合
for (String url : permissionUrl) {
//如果是超级权限 则计入超级权限
if (Boolean.TRUE.equals(menu.getSuper())) {
//如果已有超级权限,则这里就不做权限的累加
if (!superPermissions.contains(url)) {
superPermissions.add(url);
}
}
//否则计入浏览权限
else {
//没有权限,则累加。
if (!queryPermissions.contains(url)) {
queryPermissions.add(url);
}
}
}
}
//去除重复的权限
queryPermissions.removeAll(superPermissions);
});
}
permission.put(PermissionEnum.SUPER.name(), superPermissions);
permission.put(PermissionEnum.QUERY.name(), queryPermissions);
return permission;
| 902
| 391
| 1,293
|
<methods>public non-sealed void <init>() ,public abstract cn.lili.common.security.token.Token createToken(cn.lili.modules.member.entity.dos.Member, java.lang.Boolean) ,public abstract cn.lili.common.security.token.Token refreshToken(java.lang.String) <variables>public cn.lili.common.security.enums.UserEnums role
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/message/entity/vos/MessageVO.java
|
MessageVO
|
lambdaQueryWrapper
|
class MessageVO {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "内容")
private String content;
public LambdaQueryWrapper<Message> lambdaQueryWrapper() {<FILL_FUNCTION_BODY>}
}
|
LambdaQueryWrapper<Message> queryWrapper = new LambdaQueryWrapper<>();
if (StrUtil.isNotEmpty(title)) {
queryWrapper.like(Message::getTitle, title);
}
if (StrUtil.isNotEmpty(content)) {
queryWrapper.like(Message::getContent, content);
}
queryWrapper.orderByDesc(Message::getCreateTime);
return queryWrapper;
| 89
| 105
| 194
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/message/serviceimpl/MemberMessageServiceImpl.java
|
MemberMessageServiceImpl
|
getPage
|
class MemberMessageServiceImpl extends ServiceImpl<MemberMessageMapper, MemberMessage> implements MemberMessageService {
@Override
public IPage<MemberMessage> getPage(MemberMessageQueryVO memberMessageQueryVO, PageVO pageVO) {<FILL_FUNCTION_BODY>}
@Override
public Boolean editStatus(String status, String messageId) {
//查询消息是否存在
MemberMessage memberMessage = this.getById(messageId);
if (memberMessage != null) {
memberMessage.setStatus(status);
//执行修改
return this.updateById(memberMessage);
}
return false;
}
@Override
public Boolean deleteMessage(String messageId) {
//查询消息是否存在
MemberMessage memberMessage = this.getById(messageId);
if (memberMessage != null) {
//执行删除
return this.removeById(memberMessage);
}
return false;
}
@Override
public boolean save(List<MemberMessage> messages) {
return saveBatch(messages);
}
}
|
QueryWrapper<MemberMessage> queryWrapper = new QueryWrapper<>();
//消息id
queryWrapper.eq(StringUtils.isNotEmpty(memberMessageQueryVO.getMessageId()), "message_id", memberMessageQueryVO.getMessageId());
//消息标题
queryWrapper.like(StringUtils.isNotEmpty(memberMessageQueryVO.getTitle()), "title", memberMessageQueryVO.getTitle());
//会员id
queryWrapper.eq(StringUtils.isNotEmpty(memberMessageQueryVO.getMemberId()), "member_id", memberMessageQueryVO.getMemberId());
//消息状态
queryWrapper.eq(StringUtils.isNotEmpty(memberMessageQueryVO.getStatus()), "status", memberMessageQueryVO.getStatus());
//倒序
queryWrapper.orderByDesc("create_time");
//构建查询
return this.page(PageUtil.initPage(pageVO), queryWrapper);
| 271
| 221
| 492
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/message/serviceimpl/MessageServiceImpl.java
|
MessageServiceImpl
|
deleteMessage
|
class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> implements MessageService {
@Autowired
private RocketMQTemplate rocketMQTemplate;
@Autowired
private RocketmqCustomProperties rocketmqCustomProperties;
@Override
public IPage<Message> getPage(MessageVO messageVO, PageVO pageVO) {
return this.page(PageUtil.initPage(pageVO), messageVO.lambdaQueryWrapper());
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean sendMessage(Message message) {
//保存站内信信息
this.save(message);
//发送站内信消息提醒
String noticeSendDestination = rocketmqCustomProperties.getNoticeSendTopic() + ":" + OtherTagsEnum.MESSAGE.name();
rocketMQTemplate.asyncSend(noticeSendDestination, message, RocketmqSendCallbackBuilder.commonCallback());
return true;
}
@Override
public Boolean deleteMessage(String id) {<FILL_FUNCTION_BODY>}
}
|
//只有查询到此记录才真实删除,未找到记录则直接返回true即可
Message message = this.getById(id);
if (message != null) {
return this.removeById(id);
}
return true;
| 276
| 66
| 342
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/message/serviceimpl/StoreMessageServiceImpl.java
|
StoreMessageServiceImpl
|
editStatus
|
class StoreMessageServiceImpl extends ServiceImpl<StoreMessageMapper, StoreMessage> implements StoreMessageService {
@Override
public boolean deleteByMessageId(String messageId) {
StoreMessage storeMessage = this.getById(messageId);
if (storeMessage != null) {
return this.removeById(messageId);
}
return false;
}
@Override
public IPage<StoreMessage> getPage(StoreMessageQueryVO storeMessageQueryVO, PageVO pageVO) {
QueryWrapper<StoreMessage> queryWrapper = new QueryWrapper<>();
//消息id查询
if (CharSequenceUtil.isNotEmpty(storeMessageQueryVO.getMessageId())) {
queryWrapper.eq("message_id", storeMessageQueryVO.getMessageId());
}
//商家id
if (CharSequenceUtil.isNotEmpty(storeMessageQueryVO.getStoreId())) {
queryWrapper.eq("store_id", storeMessageQueryVO.getStoreId());
}
//状态查询
if (storeMessageQueryVO.getStatus() != null) {
queryWrapper.eq("status", storeMessageQueryVO.getStatus());
}
queryWrapper.orderByDesc("status");
return this.baseMapper.queryByParams(PageUtil.initPage(pageVO), queryWrapper);
}
@Override
public boolean save(List<StoreMessage> messages) {
return saveBatch(messages);
}
@Override
public boolean editStatus(String status, String id) {<FILL_FUNCTION_BODY>}
}
|
StoreMessage storeMessage = this.getById(id);
if (storeMessage != null) {
//校验权限
if (!storeMessage.getStoreId().equals(UserContext.getCurrentUser().getStoreId())) {
throw new ResourceNotFoundException(ResultCode.USER_AUTHORITY_ERROR.message());
}
storeMessage.setStatus(status);
return this.updateById(storeMessage);
}
return false;
| 385
| 114
| 499
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/aftersale/aop/AfterSaleOperationLogAspect.java
|
AfterSaleOperationLogAspect
|
spelFormat
|
class AfterSaleOperationLogAspect {
@Autowired
private AfterSaleLogService afterSaleLogService;
@AfterReturning(returning = "rvt", pointcut = "@annotation(cn.lili.modules.order.aftersale.aop.AfterSaleLogPoint)")
public void afterReturning(JoinPoint joinPoint, Object rvt) {
try {
AuthUser auth = UserContext.getCurrentUser();
//日志对象拼接
//默认操作人员,系统操作
String userName = "系统操作", id = "-1", role = UserEnums.SYSTEM.getRole();
if (auth != null) {
//日志对象拼接
userName = UserContext.getCurrentUser().getUsername();
id = UserContext.getCurrentUser().getId();
role = UserContext.getCurrentUser().getRole().getRole();
}
Map<String, String> afterSaleLogPoints = spelFormat(joinPoint, rvt);
AfterSaleLog afterSaleLog = new AfterSaleLog(afterSaleLogPoints.get("sn"), id, role, userName, afterSaleLogPoints.get("description"));
//调用线程保存
ThreadPoolUtil.getPool().execute(new SaveAfterSaleLogThread(afterSaleLog, afterSaleLogService));
} catch (Exception e) {
log.error("售后日志错误",e);
}
}
/**
* 获取注解中对方法的描述信息 用于Controller层注解
*
* @param joinPoint 切点
* @return 方法描述
*/
public static Map<String, String> spelFormat(JoinPoint joinPoint, Object rvt) {<FILL_FUNCTION_BODY>}
/**
* 保存日志
*/
private static class SaveAfterSaleLogThread implements Runnable {
private final AfterSaleLog afterSaleLog;
private final AfterSaleLogService afterSaleLogService;
public SaveAfterSaleLogThread(AfterSaleLog afterSaleLog, AfterSaleLogService afterSaleLogService) {
this.afterSaleLog = afterSaleLog;
this.afterSaleLogService = afterSaleLogService;
}
@Override
public void run() {
afterSaleLogService.save(afterSaleLog);
}
}
}
|
Map<String, String> result = new HashMap<>(2);
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
AfterSaleLogPoint afterSaleLogPoint = signature.getMethod().getAnnotation(AfterSaleLogPoint.class);
String description = SpelUtil.compileParams(joinPoint, rvt, afterSaleLogPoint.description());
String sn = SpelUtil.compileParams(joinPoint, rvt, afterSaleLogPoint.sn());
if (CharSequenceUtil.isNotEmpty(afterSaleLogPoint.serviceStatus())) {
description += AfterSaleStatusEnum.valueOf(SpelUtil.compileParams(joinPoint, rvt, afterSaleLogPoint.serviceStatus())).description();
}
result.put("description", description);
result.put("sn", sn);
return result;
| 605
| 207
| 812
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/aftersale/entity/vo/AfterSaleSearchParams.java
|
AfterSaleSearchParams
|
betweenWrapper
|
class AfterSaleSearchParams extends PageVO {
private static final long serialVersionUID = 28604026820923515L;
@ApiModelProperty(value = "关键字")
private String keywords;
@ApiModelProperty(value = "售后服务单号")
private String sn;
@ApiModelProperty(value = "订单编号")
private String orderSn;
@ApiModelProperty(value = "会员名称")
private String memberName;
@ApiModelProperty(value = "商家名称")
private String storeName;
@ApiModelProperty(value = "商家ID")
private String storeId;
@ApiModelProperty(value = "商品名称")
private String goodsName;
@ApiModelProperty(value = "申请退款金额,可以为范围,如10_1000")
private String applyRefundPrice;
@ApiModelProperty(value = "实际退款金额,可以为范围,如10_1000")
private String actualRefundPrice;
@ApiModelProperty(value = "总价格,可以为范围,如10_1000")
private String flowPrice;
/**
* @see cn.lili.modules.order.trade.entity.enums.AfterSaleTypeEnum
*/
@ApiModelProperty(value = "售后类型", allowableValues = "CANCEL,RETURN_GOODS,EXCHANGE_GOODS,REISSUE_GOODS")
private String serviceType;
/**
* @see cn.lili.modules.order.trade.entity.enums.AfterSaleStatusEnum
*/
@ApiModelProperty(value = "售后单状态", allowableValues = "APPLY,PASS,REFUSE,BUYER_RETURN,SELLER_RE_DELIVERY,BUYER_CONFIRM,SELLER_CONFIRM,COMPLETE")
private String serviceStatus;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "开始时间")
private Date startDate;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "结束时间")
private Date endDate;
public <T> QueryWrapper<T> queryWrapper() {
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
if (CharSequenceUtil.isNotEmpty(keywords)) {
queryWrapper.and(wrapper -> wrapper.like("sn", keywords).or().like("order_sn", keywords).or().like("goods_name", keywords));
}
if (CharSequenceUtil.isNotEmpty(sn)) {
queryWrapper.like("sn", sn);
}
if (CharSequenceUtil.isNotEmpty(orderSn)) {
queryWrapper.like("order_sn", orderSn);
}
//按买家查询
if (CharSequenceUtil.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.MEMBER.name())) {
queryWrapper.eq("member_id", UserContext.getCurrentUser().getId());
}
//按卖家查询
if (CharSequenceUtil.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.STORE.name())) {
queryWrapper.eq("store_id", UserContext.getCurrentUser().getStoreId());
}
if (CharSequenceUtil.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.MANAGER.name())
&& CharSequenceUtil.isNotEmpty(storeId)
) {
queryWrapper.eq("store_id", storeId);
}
if (CharSequenceUtil.isNotEmpty(memberName)) {
queryWrapper.like("member_name", memberName);
}
if (CharSequenceUtil.isNotEmpty(storeName)) {
queryWrapper.like("store_name", storeName);
}
if (CharSequenceUtil.isNotEmpty(goodsName)) {
queryWrapper.like("goods_name", goodsName);
}
//按时间查询
if (startDate != null) {
queryWrapper.ge("create_time", startDate);
}
if (endDate != null) {
queryWrapper.le("create_time", endDate);
}
if (CharSequenceUtil.isNotEmpty(serviceStatus)) {
queryWrapper.eq("service_status", serviceStatus);
}
if (CharSequenceUtil.isNotEmpty(serviceType)) {
queryWrapper.eq("service_type", serviceType);
}
this.betweenWrapper(queryWrapper);
queryWrapper.eq("delete_flag", false);
return queryWrapper;
}
private <T> void betweenWrapper(QueryWrapper<T> queryWrapper) {<FILL_FUNCTION_BODY>}
}
|
if (CharSequenceUtil.isNotEmpty(applyRefundPrice)) {
String[] s = applyRefundPrice.split("_");
if (s.length > 1) {
queryWrapper.between("apply_refund_price", s[0], s[1]);
} else {
queryWrapper.ge("apply_refund_price", s[0]);
}
}
if (CharSequenceUtil.isNotEmpty(actualRefundPrice)) {
String[] s = actualRefundPrice.split("_");
if (s.length > 1) {
queryWrapper.between("actual_refund_price", s[0], s[1]);
} else {
queryWrapper.ge("actual_refund_price", s[0]);
}
}
if (CharSequenceUtil.isNotEmpty(flowPrice)) {
String[] s = flowPrice.split("_");
if (s.length > 1) {
queryWrapper.between("flow_price", s[0], s[1]);
} else {
queryWrapper.ge("flow_price", s[0]);
}
}
| 1,238
| 278
| 1,516
|
<methods>public non-sealed void <init>() ,public java.lang.String getSort() <variables>private java.lang.Boolean notConvert,private java.lang.String order,private java.lang.Integer pageNumber,private java.lang.Integer pageSize,private static final long serialVersionUID,private java.lang.String sort
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/cart/entity/dto/TradeDTO.java
|
TradeDTO
|
getCheckedSkuList
|
class TradeDTO implements Serializable {
private static final long serialVersionUID = -3137165707807057810L;
@ApiModelProperty(value = "sn")
private String sn;
@ApiModelProperty(value = "是否为其他订单下的订单,如果是则为依赖订单的sn,否则为空")
private String parentOrderSn;
@ApiModelProperty(value = "购物车列表")
private List<CartVO> cartList;
@ApiModelProperty(value = "整笔交易中所有的规格商品")
private List<CartSkuVO> skuList;
@ApiModelProperty(value = "购物车车计算后的总价")
private PriceDetailVO priceDetailVO;
@ApiModelProperty(value = "购物车车计算后的总价")
private PriceDetailDTO priceDetailDTO;
@ApiModelProperty(value = "发票信息")
private ReceiptVO receiptVO;
@ApiModelProperty(value = "是否需要发票")
private Boolean needReceipt;
@ApiModelProperty(value = "不支持配送方式")
private List<CartSkuVO> notSupportFreight;
/**
* 购物车类型
*/
private CartTypeEnum cartTypeEnum;
/**
* 店铺备注
*/
private List<StoreRemarkDTO> storeRemark;
/**
* sku促销连线 包含满优惠
* <p>
* KEY值为 sku_id+"_"+SuperpositionPromotionEnum
* VALUE值为 对应的活动ID
*
* @see SuperpositionPromotionEnum
*/
private Map<String, String> skuPromotionDetail;
/**
* 使用平台优惠券,一笔订单只能使用一个平台优惠券
*/
private MemberCouponDTO platformCoupon;
/**
* key 为商家id
* value 为商家优惠券
* 店铺优惠券
*/
private Map<String, MemberCouponDTO> storeCoupons;
/**
* 可用优惠券列表
*/
private List<MemberCoupon> canUseCoupons;
/**
* 无法使用优惠券无法使用的原因
*/
private List<MemberCouponVO> cantUseCoupons;
/**
* 收货地址
*/
private MemberAddress memberAddress;
/**
* 自提地址
*/
private StoreAddress storeAddress;
/**
* 客户端类型
*/
private String clientType;
/**
* 买家名称
*/
private String memberName;
/**
* 买家id
*/
private String memberId;
/**
* 分销商id
*/
private String distributionId;
/**
* 订单vo
*/
private List<OrderVO> orderVO;
public TradeDTO(CartTypeEnum cartTypeEnum) {
this.cartTypeEnum = cartTypeEnum;
this.skuList = new ArrayList<>();
this.cartList = new ArrayList<>();
this.skuPromotionDetail = new HashMap<>();
this.storeCoupons = new HashMap<>();
this.priceDetailDTO = new PriceDetailDTO();
this.cantUseCoupons = new ArrayList<>();
this.canUseCoupons = new ArrayList<>();
this.needReceipt = false;
}
public TradeDTO() {
this(CartTypeEnum.CART);
}
/**
* 过滤购物车中已选择的sku
*
* @return
*/
public List<CartSkuVO> getCheckedSkuList() {<FILL_FUNCTION_BODY>}
public void removeCoupon() {
this.canUseCoupons = new ArrayList<>();
this.cantUseCoupons = new ArrayList<>();
}
}
|
if (skuList != null && !skuList.isEmpty()) {
return skuList.stream().filter(CartSkuVO::getChecked).collect(Collectors.toList());
}
return skuList;
| 1,027
| 60
| 1,087
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/cart/entity/vo/CartBase.java
|
CartBase
|
getPriceDetailVO
|
class CartBase implements Serializable {
private static final long serialVersionUID = -5172752506920017597L;
@ApiModelProperty(value = "卖家id")
private String storeId;
@ApiModelProperty(value = "卖家姓名")
private String storeName;
@ApiModelProperty(value = "此商品价格流水计算")
private PriceDetailDTO priceDetailDTO;
@ApiModelProperty(value = "此商品价格展示")
private PriceDetailVO priceDetailVO;
public CartBase() {
priceDetailDTO = new PriceDetailDTO();
}
public PriceDetailVO getPriceDetailVO() {<FILL_FUNCTION_BODY>}
}
|
if (this.priceDetailDTO != null) {
return new PriceDetailVO(priceDetailDTO);
}
return new PriceDetailVO();
| 193
| 42
| 235
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/cart/entity/vo/CartSkuVO.java
|
CartSkuVO
|
rebuildBySku
|
class CartSkuVO extends CartBase implements Serializable {
private static final long serialVersionUID = -894598033321906974L;
private String sn;
/**
* 对应的sku DO
*/
private GoodsSku goodsSku;
/**
* 分销描述
*/
private DistributionGoods distributionGoods;
@ApiModelProperty(value = "购买数量")
private Integer num;
@ApiModelProperty(value = "购买时的成交价")
private Double purchasePrice;
@ApiModelProperty(value = "小记")
private Double subTotal;
@ApiModelProperty(value = "小记")
private Double utilPrice;
/**
* 是否选中,要去结算 0:未选中 1:已选中,默认
*/
@ApiModelProperty(value = "是否选中,要去结算")
private Boolean checked;
@ApiModelProperty(value = "是否免运费")
private Boolean isFreeFreight;
@ApiModelProperty(value = "是否失效 ")
private Boolean invalid;
@ApiModelProperty(value = "购物车商品错误消息")
private String errorMessage;
@ApiModelProperty(value = "是否可配送")
private Boolean isShip;
@ApiModelProperty(value = "拼团id 如果是拼团购买 此值为拼团活动id," +
"当pintuanId为空,则表示普通购买(或者拼团商品,单独购买)")
private String pintuanId;
@ApiModelProperty(value = "砍价ID")
private String kanjiaId;
@ApiModelProperty(value = "积分兑换ID")
private String pointsId;
@ApiModelProperty(value = "积分购买 积分数量")
private Long point;
@ApiModelProperty("商品促销活动集合,key 为 促销活动类型,value 为 促销活动实体信息 ")
private Map<String, Object> promotionMap;
/**
* @see CartTypeEnum
*/
@ApiModelProperty(value = "购物车类型")
private CartTypeEnum cartType;
/**
* @see DeliveryMethodEnum
*/
@ApiModelProperty(value = "配送方式")
private String deliveryMethod;
/**
* 在构造器里初始化促销列表,规格列表
*/
public CartSkuVO(GoodsSku goodsSku) {
this.goodsSku = goodsSku;
if (goodsSku.getUpdateTime() == null) {
this.goodsSku.setUpdateTime(goodsSku.getCreateTime());
}
this.checked = true;
this.invalid = false;
//默认时间为0,让系统为此商品更新缓存
this.errorMessage = "";
this.isShip = true;
this.purchasePrice = goodsSku.getPromotionFlag() != null && goodsSku.getPromotionFlag() ? goodsSku.getPromotionPrice() : goodsSku.getPrice();
this.isFreeFreight = false;
this.utilPrice = goodsSku.getPromotionFlag() != null && goodsSku.getPromotionFlag() ? goodsSku.getPromotionPrice() : goodsSku.getPrice();
this.setStoreId(goodsSku.getStoreId());
this.setStoreName(goodsSku.getStoreName());
}
/**
* 在构造器里初始化促销列表,规格列表
*/
public CartSkuVO(GoodsSku goodsSku, Map<String, Object> promotionMap) {
this(goodsSku);
if (promotionMap != null && !promotionMap.isEmpty()) {
this.promotionMap = promotionMap;
}
}
public void rebuildBySku(GoodsSku goodsSku) {<FILL_FUNCTION_BODY>}
public Map<String, Object> getPromotionMap() {
return PromotionTools.filterInvalidPromotionsMap(this.promotionMap);
}
public Map<String, Object> getNotFilterPromotionMap() {
return this.promotionMap;
}
}
|
this.goodsSku = goodsSku;
this.purchasePrice = goodsSku.getPromotionFlag() != null && goodsSku.getPromotionFlag() ? goodsSku.getPromotionPrice() : goodsSku.getPrice();
this.utilPrice = goodsSku.getPromotionFlag() != null && goodsSku.getPromotionFlag() ? goodsSku.getPromotionPrice() : goodsSku.getPrice();
//计算购物车小计
this.subTotal = CurrencyUtil.mul(this.getPurchasePrice(), this.getNum());
this.setStoreId(goodsSku.getStoreId());
this.setStoreName(goodsSku.getStoreName());
| 1,103
| 181
| 1,284
|
<methods>public void <init>() ,public cn.lili.modules.order.cart.entity.vo.PriceDetailVO getPriceDetailVO() <variables>private cn.lili.modules.order.order.entity.dto.PriceDetailDTO priceDetailDTO,private cn.lili.modules.order.cart.entity.vo.PriceDetailVO priceDetailVO,private static final long serialVersionUID,private java.lang.String storeId,private java.lang.String storeName
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/cart/entity/vo/CartVO.java
|
CartVO
|
getCheckedSkuList
|
class CartVO extends CartBase implements Serializable {
private static final long serialVersionUID = -5651775413457562422L;
@ApiModelProperty(value = "购物车中的产品列表")
private List<CartSkuVO> skuList;
@ApiModelProperty(value = "sn")
private String sn;
@ApiModelProperty(value = "购物车页展示时,店铺内的商品是否全选状态.1为店铺商品全选状态,0位非全选")
private Boolean checked;
@ApiModelProperty(value = "满优惠活动")
private FullDiscountVO fullDiscount;
@ApiModelProperty(value = "满优惠促销的商品")
private List<String> fullDiscountSkuIds;
@ApiModelProperty(value = "是否满优惠")
private Boolean isFull;
@ApiModelProperty(value = "使用的优惠券列表")
private List<MemberCoupon> couponList;
@ApiModelProperty(value = "使用的优惠券列表")
private List<CouponVO> canReceiveCoupon;
@ApiModelProperty(value = "赠品列表")
private List<String> giftList;
@ApiModelProperty(value = "赠送优惠券列表")
private List<String> giftCouponList;
@ApiModelProperty(value = "赠送积分")
private Integer giftPoint;
@ApiModelProperty(value = "重量")
private Double weight;
@ApiModelProperty(value = "购物车商品数量")
private Integer goodsNum;
@ApiModelProperty(value = "购物车商品数量")
private String remark;
/**
* @see DeliveryMethodEnum
*/
@ApiModelProperty(value = "配送方式")
private String deliveryMethod;
@ApiModelProperty(value = "已参与的的促销活动提示,直接展示给客户")
private String promotionNotice;
public CartVO(CartSkuVO cartSkuVO) {
this.setStoreId(cartSkuVO.getStoreId());
this.setStoreName(cartSkuVO.getStoreName());
this.setDeliveryMethod(cartSkuVO.getDeliveryMethod());
this.setSkuList(new ArrayList<>());
this.setCouponList(new ArrayList<>());
this.setGiftList(new ArrayList<>());
this.setGiftCouponList(new ArrayList<>());
this.setCanReceiveCoupon(new ArrayList<>());
this.setChecked(false);
this.isFull = false;
this.weight = 0d;
this.giftPoint = 0;
this.remark = "";
}
public void addGoodsNum(Integer goodsNum) {
if (this.goodsNum == null) {
this.goodsNum = goodsNum;
} else {
this.goodsNum += goodsNum;
}
}
/**
* 过滤购物车中已选择的sku
*
* @return
*/
public List<CartSkuVO> getCheckedSkuList() {<FILL_FUNCTION_BODY>}
}
|
if (skuList != null && !skuList.isEmpty()) {
return skuList.stream().filter(CartSkuVO::getChecked).collect(Collectors.toList());
}
return skuList;
| 816
| 60
| 876
|
<methods>public void <init>() ,public cn.lili.modules.order.cart.entity.vo.PriceDetailVO getPriceDetailVO() <variables>private cn.lili.modules.order.order.entity.dto.PriceDetailDTO priceDetailDTO,private cn.lili.modules.order.cart.entity.vo.PriceDetailVO priceDetailVO,private static final long serialVersionUID,private java.lang.String storeId,private java.lang.String storeName
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/cart/entity/vo/FullDiscountVO.java
|
FullDiscountVO
|
notice
|
class FullDiscountVO extends FullDiscount {
private static final long serialVersionUID = -2330552735874105354L;
/**
* 促销关联的商品
*/
private List<PromotionGoods> promotionGoodsList;
/**
* 赠品skuId
*/
private String giftSkuId;
/**
* 赠品名称
*/
private String giftSkuName;
/**
* 赠品路径
*/
private String giftSkuThumbnail;
public FullDiscountVO(FullDiscount fullDiscount) {
BeanUtils.copyProperties(fullDiscount, this);
}
public String notice() {<FILL_FUNCTION_BODY>}
}
|
StringBuilder stringBuffer = new StringBuilder();
if (Boolean.TRUE.equals(this.getFullMinusFlag())) {
stringBuffer.append(" 减").append(this.getFullMinus()).append("元 ");
}
if (Boolean.TRUE.equals(this.getFullRateFlag())) {
stringBuffer.append(" 打").append(this.getFullRate()).append("折 ");
}
if (Boolean.TRUE.equals(this.getFreeFreightFlag())) {
stringBuffer.append(" 免运费 ");
}
if (Boolean.TRUE.equals(this.getPointFlag())) {
stringBuffer.append(" 赠").append(this.getPoint()).append("积分 ");
}
if (Boolean.TRUE.equals(this.getCouponFlag())) {
stringBuffer.append(" 赠").append("优惠券 ");
}
if (Boolean.TRUE.equals(this.getGiftFlag() && CharSequenceUtil.isNotEmpty(giftSkuName))) {
stringBuffer.append(" 赠品[").append(giftSkuName).append("]");
}
return stringBuffer.toString();
| 210
| 287
| 497
|
<methods>public non-sealed void <init>() ,public java.lang.Boolean getCouponFlag() ,public java.lang.Boolean getFreeFreightFlag() ,public java.lang.Boolean getFullMinusFlag() ,public java.lang.Boolean getFullRateFlag() ,public java.lang.Boolean getGiftFlag() ,public java.lang.Boolean getPointFlag() <variables>private java.lang.Boolean couponFlag,private java.lang.String couponId,private java.lang.String description,private java.lang.Boolean freeFreightFlag,private java.lang.Double fullMinus,private java.lang.Boolean fullMinusFlag,private java.lang.Double fullMoney,private java.lang.Double fullRate,private java.lang.Boolean fullRateFlag,private java.lang.Boolean giftFlag,private java.lang.String giftId,private java.lang.Integer point,private java.lang.Boolean pointFlag,private static final long serialVersionUID,private java.lang.String title
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/cart/render/TradeBuilder.java
|
TradeBuilder
|
buildChecked
|
class TradeBuilder {
/**
* 购物车渲染步骤
*/
@Autowired
private List<CartRenderStep> cartRenderSteps;
/**
* 交易
*/
@Autowired
private TradeService tradeService;
/**
* 购物车业务
*/
@Autowired
private CartService cartService;
/**
* 构造购物车
* 购物车与结算信息不一致的地方主要是优惠券计算和运费计算,其他规则都是一致都
*
* @param checkedWay 购物车类型
* @return 购物车展示信息
*/
public TradeDTO buildCart(CartTypeEnum checkedWay) {
//读取对应购物车的商品信息
TradeDTO tradeDTO = cartService.readDTO(checkedWay);
//购物车需要将交易中的优惠券取消掉
if (checkedWay.equals(CartTypeEnum.CART)) {
tradeDTO.setStoreCoupons(null);
tradeDTO.setPlatformCoupon(null);
}
//按照计划进行渲染
renderCartBySteps(tradeDTO, RenderStepStatement.cartRender);
return tradeDTO;
}
/**
* 构造结算页面
*/
public TradeDTO buildChecked(CartTypeEnum checkedWay) {<FILL_FUNCTION_BODY>}
/**
* 创建一笔交易
* 1.构造交易
* 2.创建交易
*
* @param tradeDTO 交易模型
* @return 交易信息
*/
public Trade createTrade(TradeDTO tradeDTO) {
//需要对购物车渲染
if (isSingle(tradeDTO.getCartTypeEnum())) {
renderCartBySteps(tradeDTO, RenderStepStatement.singleTradeRender);
} else if (tradeDTO.getCartTypeEnum().equals(CartTypeEnum.PINTUAN)) {
renderCartBySteps(tradeDTO, RenderStepStatement.pintuanTradeRender);
} else {
renderCartBySteps(tradeDTO, RenderStepStatement.tradeRender);
}
//添加order订单及order_item子订单并返回
return tradeService.createTrade(tradeDTO);
}
/**
* 是否为单品渲染
*
* @param checkedWay 购物车类型
* @return 返回是否单品
*/
private boolean isSingle(CartTypeEnum checkedWay) {
//拼团 积分 砍价商品
return (checkedWay.equals(CartTypeEnum.POINTS) || checkedWay.equals(CartTypeEnum.KANJIA));
}
/**
* 根据渲染步骤,渲染购物车信息
*
* @param tradeDTO 交易DTO
* @param defaultRender 渲染枚举
*/
private void renderCartBySteps(TradeDTO tradeDTO, RenderStepEnums[] defaultRender) {
for (RenderStepEnums step : defaultRender) {
for (CartRenderStep render : cartRenderSteps) {
try {
if (render.step().equals(step)) {
render.render(tradeDTO);
}
} catch (ServiceException e) {
throw e;
} catch (Exception e) {
log.error("购物车{}渲染异常:", render.getClass(), e);
}
}
}
}
}
|
//读取对应购物车的商品信息
TradeDTO tradeDTO = cartService.readDTO(checkedWay);
//需要对购物车渲染
if (isSingle(checkedWay)) {
renderCartBySteps(tradeDTO, RenderStepStatement.checkedSingleRender);
} else if (checkedWay.equals(CartTypeEnum.PINTUAN)) {
renderCartBySteps(tradeDTO, RenderStepStatement.pintuanTradeRender);
} else {
renderCartBySteps(tradeDTO, RenderStepStatement.checkedRender);
}
return tradeDTO;
| 920
| 162
| 1,082
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/cart/render/impl/CartPriceRender.java
|
CartPriceRender
|
buildCartPrice
|
class CartPriceRender implements CartRenderStep {
@Override
public RenderStepEnums step() {
return RenderStepEnums.CART_PRICE;
}
@Override
public void render(TradeDTO tradeDTO) {
//价格过滤 在购物车商品失效时,需要对价格进行初始化操作
initPriceDTO(tradeDTO);
//构造cartVO
buildCartPrice(tradeDTO);
buildTradePrice(tradeDTO);
}
/**
* 特殊情况下对购物车金额进行护理
*
* @param tradeDTO
*/
private void initPriceDTO(TradeDTO tradeDTO) {
tradeDTO.getCartList().forEach(cartVO -> cartVO.setPriceDetailDTO(new PriceDetailDTO()));
tradeDTO.setPriceDetailDTO(new PriceDetailDTO());
}
/**
* 购物车价格
*
* @param tradeDTO 购物车展示信息
*/
void buildCartPrice(TradeDTO tradeDTO) {<FILL_FUNCTION_BODY>}
/**
* 初始化购物车
*
* @param tradeDTO 购物车展示信息
*/
void buildTradePrice(TradeDTO tradeDTO) {
tradeDTO.getPriceDetailDTO().accumulationPriceDTO(
tradeDTO.getCartList().stream().map(CartVO::getPriceDetailDTO).collect(Collectors.toList()));
}
}
|
//购物车列表
List<CartVO> cartVOS = tradeDTO.getCartList();
cartVOS.forEach(cartVO -> {
cartVO.getPriceDetailDTO().accumulationPriceDTO(
cartVO.getCheckedSkuList().stream().filter(CartSkuVO::getChecked)
.map(CartSkuVO::getPriceDetailDTO).collect(Collectors.toList())
);
List<Integer> skuNum = cartVO.getSkuList().stream().filter(CartSkuVO::getChecked)
.map(CartSkuVO::getNum).collect(Collectors.toList());
for (Integer num : skuNum) {
cartVO.addGoodsNum(num);
}
});
| 400
| 196
| 596
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/cart/render/impl/CartSnRender.java
|
CartSnRender
|
render
|
class CartSnRender implements CartRenderStep {
@Override
public RenderStepEnums step() {
return RenderStepEnums.CART_SN;
}
@Override
public void render(TradeDTO tradeDTO) {<FILL_FUNCTION_BODY>}
}
|
//生成各个sn
tradeDTO.setSn(SnowFlake.createStr("T"));
tradeDTO.getCartList().forEach(item -> {
//写入备注
if (tradeDTO.getStoreRemark() != null) {
for (StoreRemarkDTO remark : tradeDTO.getStoreRemark()) {
if (item.getStoreId().equals(remark.getStoreId())) {
item.setRemark(remark.getRemark());
}
}
}
item.setSn(SnowFlake.createStr("O"));
});
| 77
| 156
| 233
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/cart/render/impl/CheckedFilterRender.java
|
CheckedFilterRender
|
render
|
class CheckedFilterRender implements CartRenderStep {
@Override
public RenderStepEnums step() {
return RenderStepEnums.CHECKED_FILTER;
}
@Override
public void render(TradeDTO tradeDTO) {<FILL_FUNCTION_BODY>}
}
|
//将购物车到sku未选择信息过滤
List<CartSkuVO> collect = tradeDTO.getSkuList().stream().filter(i -> Boolean.TRUE.equals(i.getChecked())).collect(Collectors.toList());
tradeDTO.setSkuList(collect);
//购物车信息过滤
List<CartVO> cartVOList = new ArrayList<>();
//循环购物车信息
for (CartVO cartVO : tradeDTO.getCartList()) {
//如果商品选中,则加入到对应购物车
cartVO.setSkuList(cartVO.getCheckedSkuList());
cartVOList.add(cartVO);
}
tradeDTO.setCartList(cartVOList);
| 82
| 190
| 272
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/cart/render/impl/CommissionRender.java
|
CommissionRender
|
buildCartPrice
|
class CommissionRender implements CartRenderStep {
/**
* 商品分类
*/
@Autowired
private CategoryService categoryService;
@Override
public RenderStepEnums step() {
return RenderStepEnums.PLATFORM_COMMISSION;
}
@Override
public void render(TradeDTO tradeDTO) {
buildCartPrice(tradeDTO);
}
/**
* 购物车佣金计算
*
* @param tradeDTO 购物车展示信息
*/
void buildCartPrice(TradeDTO tradeDTO) {<FILL_FUNCTION_BODY>}
}
|
//购物车列表
List<CartVO> cartVOS = tradeDTO.getCartList();
//计算购物车价格
for (CartVO cart : cartVOS) {
//累加价格
for (CartSkuVO cartSkuVO : cart.getCheckedSkuList()) {
PriceDetailDTO priceDetailDTO = cartSkuVO.getPriceDetailDTO();
//平台佣金根据分类计算
String categoryId = cartSkuVO.getGoodsSku().getCategoryPath()
.substring(cartSkuVO.getGoodsSku().getCategoryPath().lastIndexOf(",") + 1);
if (CharSequenceUtil.isNotEmpty(categoryId)) {
Double commissionRate = categoryService.getCategoryById(categoryId).getCommissionRate();
priceDetailDTO.setPlatFormCommissionPoint(commissionRate);
}
//如果积分订单 积分订单,单独操作订单结算金额和商家结算字段
if (tradeDTO.getCartTypeEnum().equals(CartTypeEnum.POINTS) && tradeDTO.getSkuList().get(0).getPromotionMap() != null && !tradeDTO.getSkuList().get(0).getPromotionMap().isEmpty()) {
Optional<Map.Entry<String, Object>> pointsPromotions = tradeDTO.getSkuList().get(0).getPromotionMap().entrySet().stream().filter(i -> i.getKey().contains(PromotionTypeEnum.POINTS_GOODS.name())).findFirst();
if (pointsPromotions.isPresent()) {
JSONObject promotionsObj = JSONUtil.parseObj(pointsPromotions.get().getValue());
PointsGoods pointsGoods = JSONUtil.toBean(promotionsObj, PointsGoods.class);
priceDetailDTO.setSettlementPrice(pointsGoods.getSettlementPrice());
}
}
//如果砍价订单 计算金额,单独操作订单结算金额和商家结算字段
else if (tradeDTO.getCartTypeEnum().equals(CartTypeEnum.KANJIA) && tradeDTO.getSkuList().get(0).getPromotionMap() != null && !tradeDTO.getSkuList().get(0).getPromotionMap().isEmpty()) {
Optional<Map.Entry<String, Object>> kanjiaPromotions = tradeDTO.getSkuList().get(0).getPromotionMap().entrySet().stream().filter(i -> i.getKey().contains(PromotionTypeEnum.KANJIA.name())).findFirst();
if (kanjiaPromotions.isPresent()) {
JSONObject promotionsObj = JSONUtil.parseObj(kanjiaPromotions.get().getValue());
KanjiaActivityGoods kanjiaActivityGoods = JSONUtil.toBean(promotionsObj, KanjiaActivityGoods.class);
priceDetailDTO.setSettlementPrice(CurrencyUtil.add(kanjiaActivityGoods.getSettlementPrice(),priceDetailDTO.getBillPrice()));
}
}
}
}
| 172
| 789
| 961
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/cart/render/impl/DistributionPriceRender.java
|
DistributionPriceRender
|
renderDistribution
|
class DistributionPriceRender implements CartRenderStep {
/**
* 缓存
*/
@Autowired
private Cache cache;
@Autowired
private DistributionGoodsService distributionGoodsService;
@Override
public RenderStepEnums step() {
return RenderStepEnums.DISTRIBUTION;
}
@Override
public void render(TradeDTO tradeDTO) {
this.renderDistribution(tradeDTO);
}
/**
* 渲染分销佣金
*
* @param tradeDTO
*/
private void renderDistribution(TradeDTO tradeDTO) {<FILL_FUNCTION_BODY>}
}
|
//如果存在分销员
String distributionId = (String) cache.get(CachePrefix.DISTRIBUTION.getPrefix() + "_" + tradeDTO.getMemberId());
if (StringUtil.isEmpty(distributionId)) {
return;
}
//循环订单商品列表,如果是分销商品则计算商品佣金
tradeDTO.setDistributionId(distributionId);
List<String> skuIds = tradeDTO.getCheckedSkuList().stream().map(cartSkuVO -> {
return cartSkuVO.getGoodsSku().getId();
}).collect(Collectors.toList());
//是否包含分销商品
List<DistributionGoods> distributionGoods = distributionGoodsService.distributionGoods(skuIds);
if (distributionGoods != null && !distributionGoods.isEmpty()) {
distributionGoods.forEach(dg -> tradeDTO.getCheckedSkuList().forEach(cartSkuVO -> {
if (cartSkuVO.getGoodsSku().getId().equals(dg.getSkuId())) {
cartSkuVO.setDistributionGoods(dg);
}
}));
}
for (CartSkuVO cartSkuVO : tradeDTO.getCheckedSkuList()) {
if (cartSkuVO.getDistributionGoods() != null) {
cartSkuVO.getPriceDetailDTO().setDistributionCommission(CurrencyUtil.mul(cartSkuVO.getNum(), cartSkuVO.getDistributionGoods().getCommission()));
}
}
| 187
| 406
| 593
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/cart/render/impl/FullDiscountRender.java
|
FullDiscountRender
|
render
|
class FullDiscountRender implements CartRenderStep {
@Autowired
private GoodsSkuService goodsSkuService;
@Override
public RenderStepEnums step() {
return RenderStepEnums.FULL_DISCOUNT;
}
@Override
public void render(TradeDTO tradeDTO) {<FILL_FUNCTION_BODY>}
/**
* 渲染满折
*
* @param cart
* @param skuPriceDetail
*/
private void renderFullRate(CartVO cart, Map<String, Double> skuPriceDetail, Double rate, String activityId) {
List<CartSkuVO> cartSkuVOS = cart.getCheckedSkuList().stream().filter(cartSkuVO -> skuPriceDetail.containsKey(cartSkuVO.getGoodsSku().getId())).collect(Collectors.toList());
// 循环计算扣减金额
cartSkuVOS.forEach(cartSkuVO -> {
PriceDetailDTO priceDetailDTO = cartSkuVO.getPriceDetailDTO();
Double discountPrice = CurrencyUtil.mul(priceDetailDTO.getGoodsPrice(),
CurrencyUtil.sub(1, rate)
);
//优惠金额=旧的优惠金额+商品金额*商品折扣比例
priceDetailDTO.setDiscountPrice(
CurrencyUtil.add(priceDetailDTO.getDiscountPrice(), discountPrice
)
);
//优惠金额=旧的优惠金额+商品金额*商品折扣比例
priceDetailDTO.addDiscountPriceItem(DiscountPriceItem
.builder()
.discountPrice(discountPrice)
.promotionTypeEnum(PromotionTypeEnum.FULL_DISCOUNT)
.promotionId(activityId)
.skuId(cartSkuVO.getGoodsSku().getId())
.goodsId(cartSkuVO.getGoodsSku().getGoodsId())
.build());
});
}
/**
* 渲染满减优惠
*
* @param cartVO 购物车满优惠渲染
*/
private void renderFullMinus(CartVO cartVO) {
//获取参与活动的商品总价
FullDiscountVO fullDiscount = cartVO.getFullDiscount();
if (Boolean.TRUE.equals(fullDiscount.getCouponFlag())) {
cartVO.getGiftCouponList().add(fullDiscount.getCouponId());
}
if (Boolean.TRUE.equals(fullDiscount.getGiftFlag())) {
cartVO.setGiftList(Arrays.asList(fullDiscount.getGiftId().split(",")));
}
if (Boolean.TRUE.equals(fullDiscount.getPointFlag())) {
cartVO.setGiftPoint(fullDiscount.getPoint());
}
//如果满足,判定是否免邮,免邮的话需要渲染一边sku
if (Boolean.TRUE.equals(fullDiscount.getFreeFreightFlag())) {
for (CartSkuVO skuVO : cartVO.getCheckedSkuList()) {
skuVO.setIsFreeFreight(true);
}
}
}
/**
* 是否满足满优惠
*
* @param cart 购物车展示信息
* @return 是否满足满优惠
*/
private boolean isFull(Double price, CartVO cart) {
if (cart.getFullDiscount().getFullMoney() <= price) {
cart.setPromotionNotice("正在参与满优惠活动[" + cart.getFullDiscount().getPromotionName() + "]" + cart.getFullDiscount().notice());
return true;
} else {
cart.setPromotionNotice("还差" + CurrencyUtil.sub(cart.getFullDiscount().getFullMoney(), price) + " 即可参与活动(" + cart.getFullDiscount().getPromotionName() + ")" + cart.getFullDiscount().notice());
return false;
}
}
/**
* 统计参与满减商品价格
*
* @param skuPriceMap sku价格
* @return 总价
*/
private Double countPrice(Map<String, Double> skuPriceMap) {
double count = 0d;
for (Double price : skuPriceMap.values()) {
count = CurrencyUtil.add(count, price);
}
return count;
}
}
|
//店铺集合
List<CartVO> cartList = tradeDTO.getCartList();
//循环店铺购物车
for (CartVO cart : cartList) {
List<CartSkuVO> fullDiscountSkuList = cart.getSkuList().stream()
.filter(i -> i.getPromotionMap() != null && !i.getPromotionMap().isEmpty() && i.getPromotionMap().keySet().stream().anyMatch(j -> j.contains(PromotionTypeEnum.FULL_DISCOUNT.name())))
.collect(Collectors.toList());
if (!fullDiscountSkuList.isEmpty()) {
Optional<Map.Entry<String, Object>> fullDiscountOptional = fullDiscountSkuList.get(0).getPromotionMap().entrySet().stream().filter(i -> i.getKey().contains(PromotionTypeEnum.FULL_DISCOUNT.name())).findFirst();
if (fullDiscountOptional.isPresent()) {
JSONObject promotionsObj = JSONUtil.parseObj(fullDiscountOptional.get().getValue());
FullDiscount fullDiscount = promotionsObj.toBean(FullDiscount.class);
FullDiscountVO fullDiscountVO = new FullDiscountVO(fullDiscount);
//如果有赠品,则将赠品信息写入
if (Boolean.TRUE.equals(fullDiscount.getGiftFlag())) {
GoodsSku goodsSku = goodsSkuService.getGoodsSkuByIdFromCache(fullDiscount.getGiftId());
fullDiscountVO.setGiftSkuId(fullDiscount.getGiftId());
fullDiscountVO.setGiftSkuName(goodsSku.getGoodsName());
}
//写入满减活动
cart.setFullDiscount(fullDiscountVO);
Map<String, Double> skuPriceDetail = new HashMap<>(16);
for (CartSkuVO cartSkuVO : cart.getSkuList()) {
if (PromotionsScopeTypeEnum.PORTION_GOODS.name().equals(fullDiscountVO.getScopeType()) && fullDiscountVO.getScopeId() != null && !fullDiscountVO.getScopeId().contains(cartSkuVO.getGoodsSku().getId())) {
continue;
}
skuPriceDetail.put(cartSkuVO.getGoodsSku().getId(), cartSkuVO.getPriceDetailDTO().getGoodsPrice());
}
if (!skuPriceDetail.isEmpty()) {
//记录参与满减活动的sku
cart.setFullDiscountSkuIds(new ArrayList<>(skuPriceDetail.keySet()));
Double countPrice = countPrice(skuPriceDetail);
if (isFull(countPrice, cart)) {
//如果减现金
if (Boolean.TRUE.equals(fullDiscount.getFullMinusFlag())) {
PromotionPriceUtil.recountPrice(tradeDTO, skuPriceDetail, fullDiscount.getFullMinus(), PromotionTypeEnum.FULL_DISCOUNT, fullDiscountVO.getId());
}
//打折
else if (Boolean.TRUE.equals(fullDiscount.getFullRateFlag())) {
this.renderFullRate(cart, skuPriceDetail, CurrencyUtil.div(fullDiscount.getFullRate(), 10), fullDiscountVO.getId());
}
//渲染满优惠
renderFullMinus(cart);
}
}
}
}
}
| 1,139
| 875
| 2,014
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/order/aop/OrderOperationLogAspect.java
|
OrderOperationLogAspect
|
doAfter
|
class OrderOperationLogAspect {
@Autowired
private OrderLogService orderLogService;
@After("@annotation(cn.lili.modules.order.order.aop.OrderLogPoint)")
public void doAfter(JoinPoint joinPoint) {<FILL_FUNCTION_BODY>}
/**
* 获取注解中对方法的描述信息 用于Controller层注解
*
* @param joinPoint 切点
* @return 方法描述
* @throws Exception
*/
private static Map<String, String> spelFormat(JoinPoint joinPoint) throws Exception {
Map<String, String> result = new HashMap<>(2);
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
OrderLogPoint orderLogPoint = signature.getMethod().getAnnotation(OrderLogPoint.class);
String description = SpelUtil.compileParams(joinPoint, orderLogPoint.description());
String orderSn = SpelUtil.compileParams(joinPoint, orderLogPoint.orderSn());
result.put("description", description);
result.put("orderSn", orderSn);
return result;
}
/**
* 保存日志
*/
private static class SaveOrderLogThread implements Runnable {
private final OrderLog orderLog;
private final OrderLogService orderLogService;
public SaveOrderLogThread(OrderLog orderLog, OrderLogService orderLogService) {
this.orderLog = orderLog;
this.orderLogService = orderLogService;
}
@Override
public void run() {
orderLogService.save(orderLog);
}
}
}
|
try {
//日志对象拼接
//默认操作人员,系统操作
String userName = "系统操作", id = "-1", role = UserEnums.SYSTEM.getRole();
if (UserContext.getCurrentUser() != null) {
//日志对象拼接
userName = UserContext.getCurrentUser().getUsername();
id = UserContext.getCurrentUser().getId();
role = UserContext.getCurrentUser().getRole().getRole();
}
Map<String, String> orderLogPoints = spelFormat(joinPoint);
OrderLog orderLog = new OrderLog(orderLogPoints.get("orderSn"), id, role, userName, orderLogPoints.get("description"));
//调用线程保存
ThreadPoolUtil.getPool().execute(new SaveOrderLogThread(orderLog, orderLogService));
} catch (Exception e) {
log.error("订单日志错误",e);
}
| 416
| 239
| 655
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/order/entity/dos/OrderItem.java
|
OrderItem
|
getIsRefund
|
class OrderItem extends BaseEntity {
private static final long serialVersionUID = 2108971190191410182L;
@ApiModelProperty(value = "订单编号")
private String orderSn;
@ApiModelProperty(value = "子订单编号")
private String sn;
@ApiModelProperty(value = "单价")
private Double unitPrice;
@ApiModelProperty(value = "小记")
private Double subTotal;
@ApiModelProperty(value = "商品ID")
private String goodsId;
@ApiModelProperty(value = "货品ID")
private String skuId;
@ApiModelProperty(value = "销售量")
private Integer num;
@ApiModelProperty(value = "交易编号")
private String tradeSn;
@ApiModelProperty(value = "图片")
private String image;
@ApiModelProperty(value = "商品名称")
private String goodsName;
@ApiModelProperty(value = "分类ID")
private String categoryId;
@ApiModelProperty(value = "快照id")
private String snapshotId;
@ApiModelProperty(value = "规格json")
private String specs;
@ApiModelProperty(value = "促销类型")
private String promotionType;
@ApiModelProperty(value = "促销id")
private String promotionId;
@ApiModelProperty(value = "销售金额")
private Double goodsPrice;
@ApiModelProperty(value = "实际金额")
private Double flowPrice;
/**
* @see CommentStatusEnum
*/
@ApiModelProperty(value = "评论状态:未评论(UNFINISHED),待追评(WAIT_CHASE),评论完成(FINISHED),")
private String commentStatus;
/**
* @see OrderItemAfterSaleStatusEnum
*/
@ApiModelProperty(value = "售后状态")
private String afterSaleStatus;
@ApiModelProperty(value = "价格详情")
private String priceDetail;
/**
* @see OrderComplaintStatusEnum
*/
@ApiModelProperty(value = "投诉状态")
private String complainStatus;
@ApiModelProperty(value = "交易投诉id")
private String complainId;
@ApiModelProperty(value = "退货商品数量")
private Integer returnGoodsNumber;
/**
* @see cn.lili.modules.order.order.entity.enums.RefundStatusEnum
*/
@ApiModelProperty(value = "退款状态")
private String isRefund;
@ApiModelProperty(value = "退款金额")
private Double refundPrice;
@ApiModelProperty(value = "已发货数量")
private Integer deliverNumber;
public Integer getDeliverNumber() {
if(deliverNumber == null){
return 0;
}
return deliverNumber;
}
public OrderItem(CartSkuVO cartSkuVO, CartVO cartVO, TradeDTO tradeDTO) {
String oldId = this.getId();
BeanUtil.copyProperties(cartSkuVO.getGoodsSku(), this);
BeanUtil.copyProperties(cartSkuVO.getPriceDetailDTO(), this);
BeanUtil.copyProperties(cartSkuVO, this);
this.setId(oldId);
if (cartSkuVO.getPriceDetailDTO().getJoinPromotion() != null && !cartSkuVO.getPriceDetailDTO().getJoinPromotion().isEmpty()) {
this.setPromotionType(CollUtil.join(cartSkuVO.getPriceDetailDTO().getJoinPromotion().stream().map(PromotionSkuVO::getPromotionType).collect(Collectors.toList()), ","));
this.setPromotionId(CollUtil.join(cartSkuVO.getPriceDetailDTO().getJoinPromotion().stream().map(PromotionSkuVO::getActivityId).collect(Collectors.toList()), ","));
}
this.setAfterSaleStatus(OrderItemAfterSaleStatusEnum.NEW.name());
this.setCommentStatus(CommentStatusEnum.NEW.name());
this.setComplainStatus(OrderComplaintStatusEnum.NEW.name());
this.setPriceDetailDTO(cartSkuVO.getPriceDetailDTO());
this.setOrderSn(cartVO.getSn());
this.setTradeSn(tradeDTO.getSn());
this.setImage(cartSkuVO.getGoodsSku().getThumbnail());
this.setGoodsName(cartSkuVO.getGoodsSku().getGoodsName());
this.setSkuId(cartSkuVO.getGoodsSku().getId());
this.setCategoryId(cartSkuVO.getGoodsSku().getCategoryPath().substring(
cartSkuVO.getGoodsSku().getCategoryPath().lastIndexOf(",") + 1
));
this.setGoodsPrice(cartSkuVO.getGoodsSku().getPrice());
this.setUnitPrice(cartSkuVO.getPurchasePrice());
this.setSubTotal(cartSkuVO.getSubTotal());
this.setSn(SnowFlake.createStr("OI"));
}
public String getIsRefund() {<FILL_FUNCTION_BODY>}
public double getRefundPrice() {
if (refundPrice == null) {
return 0;
}
return refundPrice;
}
public PriceDetailDTO getPriceDetailDTO() {
return JSONUtil.toBean(priceDetail, PriceDetailDTO.class);
}
public void setPriceDetailDTO(PriceDetailDTO priceDetail) {
this.priceDetail = JSONUtil.toJsonStr(priceDetail);
}
}
|
if (isRefund == null) {
return RefundStatusEnum.NO_REFUND.name();
}
return isRefund;
| 1,484
| 39
| 1,523
|
<methods>public non-sealed void <init>() <variables>private java.lang.String createBy,private java.util.Date createTime,private java.lang.Boolean deleteFlag,private java.lang.String id,private static final long serialVersionUID,private java.lang.String updateBy,private java.util.Date updateTime
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/order/entity/vo/OrderComplaintCommunicationSearchParams.java
|
OrderComplaintCommunicationSearchParams
|
lambdaQueryWrapper
|
class OrderComplaintCommunicationSearchParams {
/**
* 投诉id
*/
@ApiModelProperty(value = "投诉id")
private String complainId;
/**
* 所属,买家/卖家
*/
@ApiModelProperty(value = "所属,买家/卖家")
private String owner;
/**
* 对话所属名称
*/
@ApiModelProperty(value = "对话所属名称")
private String ownerName;
/**
* 对话所属id,卖家id/买家id
*/
@ApiModelProperty(value = "对话所属id,卖家id/买家id")
private String ownerId;
public LambdaQueryWrapper<OrderComplaintCommunication> lambdaQueryWrapper() {<FILL_FUNCTION_BODY>}
}
|
LambdaQueryWrapper<OrderComplaintCommunication> queryWrapper = new LambdaQueryWrapper<>();
if (StrUtil.isNotEmpty(complainId)) {
queryWrapper.eq(OrderComplaintCommunication::getComplainId, complainId);
}
if (StrUtil.isNotEmpty(owner)) {
queryWrapper.eq(OrderComplaintCommunication::getOwner, owner);
}
if (StrUtil.isNotEmpty(ownerName)) {
queryWrapper.eq(OrderComplaintCommunication::getOwnerName, ownerName);
}
if (StrUtil.isNotEmpty(ownerId)) {
queryWrapper.eq(OrderComplaintCommunication::getOwnerId, ownerId);
}
return queryWrapper;
| 223
| 193
| 416
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/order/entity/vo/OrderComplaintSearchParams.java
|
OrderComplaintSearchParams
|
lambdaQueryWrapper
|
class OrderComplaintSearchParams {
/**
* @see ComplaintStatusEnum
*/
@ApiModelProperty(value = "交易投诉状态")
private String status;
@ApiModelProperty(value = "订单号")
private String orderSn;
@ApiModelProperty(value = "会员id")
private String memberId;
@ApiModelProperty(value = "会员名称")
private String memberName;
@ApiModelProperty(value = "商家id")
private String storeId;
@ApiModelProperty(value = "商家名称")
private String storeName;
public LambdaQueryWrapper<OrderComplaint> lambdaQueryWrapper() {<FILL_FUNCTION_BODY>}
}
|
LambdaQueryWrapper<OrderComplaint> queryWrapper = new LambdaQueryWrapper<>();
if (CharSequenceUtil.isNotEmpty(status)) {
queryWrapper.eq(OrderComplaint::getComplainStatus, status);
}
if (CharSequenceUtil.isNotEmpty(orderSn)) {
queryWrapper.like(OrderComplaint::getOrderSn, orderSn);
}
if (CharSequenceUtil.isNotEmpty(storeName)) {
queryWrapper.like(OrderComplaint::getStoreName, storeName);
}
if (CharSequenceUtil.isNotEmpty(storeId)) {
queryWrapper.eq(OrderComplaint::getStoreId, storeId);
}
if (CharSequenceUtil.isNotEmpty(memberName)) {
queryWrapper.like(OrderComplaint::getMemberName, memberName);
}
if (CharSequenceUtil.isNotEmpty(memberId)) {
queryWrapper.eq(OrderComplaint::getMemberId, memberId);
}
queryWrapper.eq(OrderComplaint::getDeleteFlag, false);
queryWrapper.orderByDesc(OrderComplaint::getCreateTime);
return queryWrapper;
| 192
| 294
| 486
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/order/entity/vo/OrderDetailVO.java
|
OrderDetailVO
|
getDeliverStatusValue
|
class OrderDetailVO implements Serializable {
private static final long serialVersionUID = -6293102172184734928L;
/**
* 订单
*/
private Order order;
/**
* 子订单信息
*/
private List<OrderItem> orderItems;
/**
* 订单状态
*/
private String orderStatusValue;
/**
* 付款状态
*/
private String payStatusValue;
/**
* 物流状态
*/
private String deliverStatusValue;
/**
* 物流类型
*/
private String deliveryMethodValue;
/**
* 支付类型
*/
private String paymentMethodValue;
/**
* 发票
*/
private Receipt receipt;
/**
* 获取订单日志
*/
private List<OrderLog> orderLogs;
@ApiModelProperty(value = "价格详情")
private String priceDetail;
public OrderDetailVO(Order order, List<OrderItem> orderItems, List<OrderLog> orderLogs,Receipt receipt) {
this.order = order;
this.orderItems = orderItems;
this.orderLogs = orderLogs;
this.receipt = receipt;
}
/**
* 可操作类型
*/
public AllowOperation getAllowOperationVO() {
return new AllowOperation(this.order);
}
public String getOrderStatusValue() {
try {
return OrderStatusEnum.valueOf(order.getOrderStatus()).description();
} catch (Exception e) {
return "";
}
}
public String getPayStatusValue() {
try {
return PayStatusEnum.valueOf(order.getPayStatus()).description();
} catch (Exception e) {
return "";
}
}
public String getDeliverStatusValue() {<FILL_FUNCTION_BODY>}
public String getDeliveryMethodValue() {
try {
return DeliveryMethodEnum.valueOf(order.getDeliveryMethod()).getDescription();
} catch (Exception e) {
return "";
}
}
public String getPaymentMethodValue() {
try {
return PaymentMethodEnum.valueOf(order.getPaymentMethod()).paymentName();
} catch (Exception e) {
return "";
}
}
}
|
try {
return DeliverStatusEnum.valueOf(order.getDeliverStatus()).getDescription();
} catch (Exception e) {
return "";
}
| 625
| 44
| 669
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/order/entity/vo/OrderSimpleVO.java
|
OrderSimpleVO
|
getOrderItemVO
|
class OrderSimpleVO {
@ApiModelProperty("sn")
private String sn;
@ApiModelProperty(value = "总价格")
private Double flowPrice;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* @see cn.lili.modules.order.order.entity.enums.OrderStatusEnum
*/
@ApiModelProperty(value = "订单状态")
private String orderStatus;
/**
* @see cn.lili.modules.order.order.entity.enums.PayStatusEnum
*/
@ApiModelProperty(value = "付款状态")
private String payStatus;
@ApiModelProperty(value = "支付方式")
private String paymentMethod;
@ApiModelProperty(value = "支付时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date paymentTime;
@ApiModelProperty(value = "用户名")
@Sensitive(strategy = SensitiveStrategy.PHONE)
private String memberName;
@ApiModelProperty(value = "店铺名称")
private String storeName;
@ApiModelProperty(value = "店铺ID")
private String storeId;
/**
* @see ClientTypeEnum
*/
@ApiModelProperty(value = "订单来源")
private String clientType;
/**
* 子订单信息
*/
private List<OrderItemVO> orderItems;
@ApiModelProperty(hidden = true, value = "item goods_id")
@Setter
private String groupGoodsId;
@ApiModelProperty(hidden = true, value = "item sku id")
@Setter
private String groupSkuId;
@ApiModelProperty(hidden = true, value = "item 数量")
@Setter
private String groupNum;
@ApiModelProperty(hidden = true, value = "item 图片")
@Setter
private String groupImages;
@ApiModelProperty(hidden = true, value = "item 名字")
@Setter
private String groupName;
@ApiModelProperty(hidden = true, value = "item 编号")
@Setter
private String groupOrderItemsSn;
@ApiModelProperty(hidden = true, value = "item 商品价格")
@Setter
private String groupGoodsPrice;
/**
* @see cn.lili.modules.order.order.entity.enums.OrderItemAfterSaleStatusEnum
*/
@ApiModelProperty(hidden = true, value = "item 售后状态", allowableValues = "NOT_APPLIED(未申请),ALREADY_APPLIED(已申请),EXPIRED(已失效不允许申请售后)")
@Setter
private String groupAfterSaleStatus;
/**
* @see cn.lili.modules.order.order.entity.enums.OrderComplaintStatusEnum
*/
@ApiModelProperty(hidden = true, value = "item 投诉状态")
@Setter
private String groupComplainStatus;
/**
* @see cn.lili.modules.order.order.entity.enums.CommentStatusEnum
*/
@ApiModelProperty(hidden = true, value = "item 评价状态")
@Setter
private String groupCommentStatus;
/**
* @see cn.lili.modules.order.order.entity.enums.OrderTypeEnum
*/
@ApiModelProperty(value = "订单类型")
private String orderType;
/**
* @see cn.lili.modules.order.order.entity.enums.DeliverStatusEnum
*/
@ApiModelProperty(value = "货运状态")
private String deliverStatus;
/**
* @see cn.lili.modules.order.order.entity.enums.OrderPromotionTypeEnum
*/
@ApiModelProperty(value = "订单促销类型")
private String orderPromotionType;
@ApiModelProperty(value = "是否退款")
private String groupIsRefund;
@ApiModelProperty(value = "退款金额")
private String groupRefundPrice;
public List<OrderItemVO> getOrderItems() {
if (CharSequenceUtil.isEmpty(groupGoodsId)) {
return new ArrayList<>();
}
List<OrderItemVO> orderItemVOS = new ArrayList<>();
String[] goodsId = groupGoodsId.split(",");
for (int i = 0; i < goodsId.length; i++) {
orderItemVOS.add(this.getOrderItemVO(i));
}
return orderItemVOS;
}
private OrderItemVO getOrderItemVO(int i) {<FILL_FUNCTION_BODY>}
/**
* 初始化自身状态
*/
public AllowOperation getAllowOperationVO() {
//设置订单的可操作状态
return new AllowOperation(this);
}
}
|
OrderItemVO orderItemVO = new OrderItemVO();
orderItemVO.setGoodsId(groupGoodsId.split(",")[i]);
if (CharSequenceUtil.isNotEmpty(groupOrderItemsSn)) {
orderItemVO.setSn(groupOrderItemsSn.split(",")[i]);
}
if (CharSequenceUtil.isNotEmpty(groupSkuId)) {
orderItemVO.setSkuId(groupSkuId.split(",")[i]);
}
if (CharSequenceUtil.isNotEmpty(groupName)) {
orderItemVO.setName(groupName.split(",")[i]);
}
if (CharSequenceUtil.isNotEmpty(groupNum) && groupNum.split(",").length == groupGoodsId.split(",").length) {
orderItemVO.setNum(groupNum.split(",")[i]);
}
if (CharSequenceUtil.isNotEmpty(groupImages) && groupImages.split(",").length == groupGoodsId.split(",").length) {
orderItemVO.setImage(groupImages.split(",")[i]);
}
if (CharSequenceUtil.isNotEmpty(groupAfterSaleStatus) && groupAfterSaleStatus.split(",").length == groupGoodsId.split(",").length) {
orderItemVO.setAfterSaleStatus(groupAfterSaleStatus.split(",")[i]);
}
if (CharSequenceUtil.isNotEmpty(groupComplainStatus) && groupComplainStatus.split(",").length == groupGoodsId.split(",").length) {
orderItemVO.setComplainStatus(groupComplainStatus.split(",")[i]);
}
if (CharSequenceUtil.isNotEmpty(groupCommentStatus) && groupCommentStatus.split(",").length == groupGoodsId.split(",").length) {
orderItemVO.setCommentStatus(groupCommentStatus.split(",")[i]);
}
if (CharSequenceUtil.isNotEmpty(groupGoodsPrice) && groupGoodsPrice.split(",").length == groupGoodsId.split(",").length) {
orderItemVO.setGoodsPrice(Double.parseDouble(groupGoodsPrice.split(",")[i]));
}
if (CharSequenceUtil.isNotEmpty(groupIsRefund) && groupIsRefund.split(",").length == groupGoodsId.split(",").length) {
orderItemVO.setIsRefund(groupIsRefund.split(",")[i]);
}
if (CharSequenceUtil.isNotEmpty(groupRefundPrice) && groupRefundPrice.split(",").length == groupGoodsId.split(",").length) {
orderItemVO.setRefundPrice(groupRefundPrice.split(",")[i]);
}
return orderItemVO;
| 1,340
| 697
| 2,037
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderPackageServiceImpl.java
|
OrderPackageServiceImpl
|
getOrderPackageVOList
|
class OrderPackageServiceImpl extends ServiceImpl<OrderPackageMapper, OrderPackage> implements OrderPackageService {
@Autowired
private OrderPackageItemService orderpackageItemService;
@Autowired
private LogisticsService logisticsService;
@Override
public List<OrderPackage> orderPackageList(String orderSn) {
return this.list(new LambdaQueryWrapper<OrderPackage>().eq(OrderPackage::getOrderSn, orderSn));
}
@Override
public List<OrderPackageVO> getOrderPackageVOList(String orderSn) {<FILL_FUNCTION_BODY>}
}
|
List<OrderPackage> orderPackages = this.orderPackageList(orderSn);
if (orderPackages == null){
throw new ServiceException(ResultCode.ORDER_PACKAGE_NOT_EXIST);
}
List<OrderPackageVO> orderPackageVOS = new ArrayList<>();
orderPackages.forEach(orderPackage -> {
OrderPackageVO orderPackageVO = new OrderPackageVO(orderPackage);
// 获取子订单包裹详情
List<OrderPackageItem> orderPackageItemList = orderpackageItemService.getOrderPackageItemListByPno(orderPackage.getPackageNo());
orderPackageVO.setOrderPackageItemList(orderPackageItemList);
String str = orderPackage.getConsigneeMobile();
str = str.substring(str.length() - 4);
// Traces traces = logisticsService.getLogisticTrack(orderPackage.getLogisticsCode(), orderPackage.getLogisticsNo(), str);
// orderPackageVO.setTraces(traces);
orderPackageVOS.add(orderPackageVO);
});
return orderPackageVOS;
| 151
| 272
| 423
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderPriceServiceImpl.java
|
OrderPriceServiceImpl
|
updateOrderItemPrice
|
class OrderPriceServiceImpl implements OrderPriceService {
/**
* 线下收款
*/
@Autowired
private BankTransferPlugin bankTransferPlugin;
/**
* 订单货物
*/
@Autowired
private OrderItemService orderItemService;
/**
* 交易数据层
*/
@Autowired
private TradeService tradeService;
/**
* 订单
*/
@Autowired
private OrderService orderService;
@Override
@SystemLogPoint(description = "修改订单价格", customerLog = "'订单编号:'+#orderSn +',价格修改为:'+#orderPrice")
@OrderLogPoint(description = "'订单['+#orderSn+']修改价格,修改后价格为['+#orderPrice+']'", orderSn = "#orderSn")
public Order updatePrice(String orderSn, Double orderPrice) {
//修改订单金额
Order order = updateOrderPrice(orderSn, orderPrice);
//修改交易金额
tradeService.updateTradePrice(order.getTradeSn());
return order;
}
@Override
@OrderLogPoint(description = "'管理员操作订单['+#orderSn+']付款'", orderSn = "#orderSn")
public void adminPayOrder(String orderSn) {
Order order = OperationalJudgment.judgment(orderService.getBySn(orderSn));
//如果订单已付款,则抛出异常
if (order.getPayStatus().equals(PayStatusEnum.PAID.name())) {
throw new ServiceException(ResultCode.PAY_DOUBLE_ERROR);
}
bankTransferPlugin.callBack(order);
}
/**
* 修改订单价格
* 1.判定订单是否支付
* 2.记录订单原始价格信息
* 3.计算修改的订单金额
* 4.修改订单价格
* 5.保存订单信息
*
* @param orderSn 订单编号
* @param orderPrice 修改订单金额
*/
private Order updateOrderPrice(String orderSn, Double orderPrice) {
Order order = OperationalJudgment.judgment(orderService.getBySn(orderSn));
//判定是否支付
if (order.getPayStatus().equals(PayStatusEnum.PAID.name())) {
throw new ServiceException(ResultCode.ORDER_UPDATE_PRICE_ERROR);
}
//获取订单价格信息
PriceDetailDTO orderPriceDetailDTO = order.getPriceDetailDTO();
//修改订单价格
order.setUpdatePrice(CurrencyUtil.sub(orderPrice, orderPriceDetailDTO.getOriginalPrice()));
//订单修改金额=使用订单原始金额-修改后金额
orderPriceDetailDTO.setUpdatePrice(CurrencyUtil.sub(orderPrice, orderPriceDetailDTO.getOriginalPrice()));
order.setFlowPrice(orderPriceDetailDTO.getFlowPrice());
//修改订单
order.setPriceDetailDTO(orderPriceDetailDTO);
orderService.updateById(order);
//修改子订单
updateOrderItemPrice(order);
return order;
}
/**
* 修改订单货物金额
* 1.计算订单货物金额在订单金额中的百分比
* 2.订单货物金额=订单修改后金额*订单货物百分比
* 3.订单货物修改价格=订单货物原始价格-订单货物修改后金额
* 4.修改平台佣金
* 5.订单实际金额=修改后订单金额-平台佣金-分销提佣
*
* @param order 订单
*/
private void updateOrderItemPrice(Order order) {<FILL_FUNCTION_BODY>}
}
|
List<OrderItem> orderItems = orderItemService.getByOrderSn(order.getSn());
//获取总数,入欧最后一个则将其他orderitem的修改金额累加,然后进行扣减
Integer index = orderItems.size();
Double countUpdatePrice = 0D;
for (OrderItem orderItem : orderItems) {
//获取订单货物价格信息
PriceDetailDTO priceDetailDTO = orderItem.getPriceDetailDTO();
index--;
//如果是最后一个
if (index == 0) {
//记录修改金额
priceDetailDTO.setUpdatePrice(CurrencyUtil.sub(order.getUpdatePrice(), countUpdatePrice));
//修改订单货物金额
orderItem.setFlowPrice(priceDetailDTO.getFlowPrice());
orderItem.setUnitPrice(CurrencyUtil.div(priceDetailDTO.getFlowPrice(), orderItem.getNum()));
orderItem.setPriceDetail(JSONUtil.toJsonStr(priceDetailDTO));
} else {
//SKU占总订单 金额的百分比
Double priceFluctuationRatio = CurrencyUtil.div(priceDetailDTO.getOriginalPrice(), order.getPriceDetailDTO().getOriginalPrice(), 4);
//记录修改金额
priceDetailDTO.setUpdatePrice(CurrencyUtil.mul(order.getUpdatePrice(), priceFluctuationRatio));
//修改订单货物金额
orderItem.setFlowPrice(priceDetailDTO.getFlowPrice());
orderItem.setUnitPrice(CurrencyUtil.div(priceDetailDTO.getFlowPrice(), orderItem.getNum()));
orderItem.setPriceDetail(JSONUtil.toJsonStr(priceDetailDTO));
countUpdatePrice = CurrencyUtil.add(countUpdatePrice, priceDetailDTO.getUpdatePrice());
}
}
orderItemService.updateBatchById(orderItems);
| 1,010
| 480
| 1,490
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/ReceiptServiceImpl.java
|
ReceiptServiceImpl
|
saveReceipt
|
class ReceiptServiceImpl extends ServiceImpl<ReceiptMapper, Receipt> implements ReceiptService {
@Override
public IPage<OrderReceiptDTO> getReceiptData(ReceiptSearchParams searchParams, PageVO pageVO) {
return this.baseMapper.getReceipt(PageUtil.initPage(pageVO), searchParams.wrapper());
}
@Override
public Receipt getByOrderSn(String orderSn) {
LambdaQueryWrapper<Receipt> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(Receipt::getOrderSn, orderSn);
return this.getOne(lambdaQueryWrapper);
}
@Override
public Receipt getDetail(String id) {
return this.getById(id);
}
@Override
public Receipt saveReceipt(Receipt receipt) {<FILL_FUNCTION_BODY>}
@Override
public Receipt invoicing(String receiptId) {
//根据id查询发票信息
Receipt receipt = this.getById(receiptId);
if (receipt != null) {
receipt.setReceiptStatus(1);
this.saveOrUpdate(receipt);
return receipt;
}
throw new ServiceException(ResultCode.USER_RECEIPT_NOT_EXIST);
}
}
|
LambdaQueryWrapper<Receipt> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Receipt::getReceiptTitle, receipt.getReceiptTitle());
queryWrapper.eq(Receipt::getMemberId, receipt.getMemberId());
if (receipt.getId() != null) {
queryWrapper.ne(Receipt::getId, receipt.getId());
}
if (this.getOne(queryWrapper) == null) {
this.save(receipt);
return receipt;
}
return null;
| 355
| 144
| 499
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/page/entity/dos/ArticleCategory.java
|
ArticleCategory
|
getSort
|
class ArticleCategory extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "分类名称")
@NotEmpty(message = "分类名称不能为空")
private String articleCategoryName;
@ApiModelProperty(value = "父分类ID")
private String parentId;
@ApiModelProperty(value = "排序")
@Min(value = 0,message = "排序值最小0,最大9999999999")
@Max(value = 999999999,message = "排序值最小0,最大9999999999")
@NotNull(message = "排序值不能为空")
private Integer sort;
@ApiModelProperty(value = "层级")
@Min(value = 0,message = "层级最小为0")
@Max(value = 3,message = "层级最大为3")
private Integer level;
/**
* @see ArticleCategoryEnum
*/
@ApiModelProperty(value = "类型")
private String type;
public Integer getSort() {<FILL_FUNCTION_BODY>}
public Integer getLevel() {
if (level == null) {
return 1;
}
return level;
}
}
|
if (sort == null) {
return 0;
}
return sort;
| 337
| 26
| 363
|
<methods>public non-sealed void <init>() <variables>private java.lang.String createBy,private java.util.Date createTime,private java.lang.Boolean deleteFlag,private java.lang.String id,private static final long serialVersionUID,private java.lang.String updateBy,private java.util.Date updateTime
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/page/entity/vos/ArticleCategoryVO.java
|
ArticleCategoryVO
|
getChildren
|
class ArticleCategoryVO extends ArticleCategory {
@ApiModelProperty(value = "子菜单")
private List<ArticleCategoryVO> children = new ArrayList<>();
public ArticleCategoryVO() {
}
public ArticleCategoryVO(ArticleCategory articleCategory) {
BeanUtil.copyProperties(articleCategory, this);
}
public List<ArticleCategoryVO> getChildren() {<FILL_FUNCTION_BODY>}
}
|
if (children != null) {
children.sort(new Comparator<ArticleCategoryVO>() {
@Override
public int compare(ArticleCategoryVO o1, ArticleCategoryVO o2) {
return o1.getSort().compareTo(o2.getSort());
}
});
return children;
}
return null;
| 114
| 92
| 206
|
<methods>public non-sealed void <init>() ,public java.lang.Integer getLevel() ,public java.lang.Integer getSort() <variables>private java.lang.String articleCategoryName,private java.lang.Integer level,private java.lang.String parentId,private static final long serialVersionUID,private java.lang.Integer sort,private java.lang.String type
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/page/serviceimpl/ArticleServiceImpl.java
|
ArticleServiceImpl
|
updateArticleType
|
class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService {
@Override
public IPage<ArticleVO> managerArticlePage(ArticleSearchParams articleSearchParams) {
articleSearchParams.setSort("a.sort");
return this.baseMapper.getArticleList(PageUtil.initPage(articleSearchParams), articleSearchParams.queryWrapper());
}
@Override
public IPage<ArticleVO> articlePage(ArticleSearchParams articleSearchParams) {
articleSearchParams.setSort("a.sort");
QueryWrapper queryWrapper = articleSearchParams.queryWrapper();
queryWrapper.eq("open_status", true);
return this.baseMapper.getArticleList(PageUtil.initPage(articleSearchParams), queryWrapper);
}
@Override
public List<Article> list(String categoryId) {
QueryWrapper<Article> queryWrapper = Wrappers.query();
queryWrapper.eq(StringUtils.isNotBlank(categoryId), "category_id", categoryId);
return this.list(queryWrapper);
}
@Override
public Article updateArticle(Article article) {
Article oldArticle = this.getById(article.getId());
BeanUtil.copyProperties(article, oldArticle);
this.updateById(oldArticle);
return oldArticle;
}
@Override
public void customRemove(String id) {
//判断是否为默认文章
if (this.getById(id).getType().equals(ArticleEnum.OTHER.name())) {
this.removeById(id);
} else {
throw new ServiceException(ResultCode.ARTICLE_NO_DELETION);
}
}
@Override
public Article customGet(String id) {
return this.getById(id);
}
@Override
public Article customGetByType(String type) {
if (!CharSequenceUtil.equals(type, ArticleEnum.OTHER.name())) {
return this.getOne(new LambdaUpdateWrapper<Article>().eq(Article::getType, type));
}
return null;
}
@Override
public Boolean updateArticleStatus(String id, boolean status) {
Article article = this.getById(id);
article.setOpenStatus(status);
return this.updateById(article);
}
@Override
public Article updateArticleType(Article article) {<FILL_FUNCTION_BODY>}
}
|
Article oldArticle = this.getById(article.getId());
BeanUtil.copyProperties(article, oldArticle);
this.updateById(oldArticle);
return oldArticle;
| 625
| 52
| 677
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/page/serviceimpl/SpecialServiceImpl.java
|
SpecialServiceImpl
|
addSpecial
|
class SpecialServiceImpl extends ServiceImpl<SpecialMapper, Special> implements SpecialService {
/**
* 页面数据
*/
@Autowired
private PageDataService pageDataService;
@Override
@Transactional(rollbackFor = Exception.class)
public Special addSpecial(Special special) {<FILL_FUNCTION_BODY>}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean removeSpecial(String id) {
//删除页面内容
Special special = this.getById(id);
pageDataService.removeById(special.getPageDataId());
//删除专题
return this.removeById(id);
}
}
|
//新建页面
PageData pageData = new PageData();
pageDataService.save(pageData);
//设置专题页面
special.setPageDataId(pageData.getId());
this.save(special);
return special;
| 180
| 68
| 248
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/payment/kit/RefundSupport.java
|
RefundSupport
|
refund
|
class RefundSupport {
/**
* 店铺流水
*/
@Autowired
private StoreFlowService storeFlowService;
/**
* 订单
*/
@Autowired
private OrderService orderService;
/**
* 售后退款
*
* @param afterSale
*/
public void refund(AfterSale afterSale) {<FILL_FUNCTION_BODY>}
/**
* 退款通知
*
* @param paymentMethodEnum 支付渠道
*/
public void notify(PaymentMethodEnum paymentMethodEnum,
HttpServletRequest request) {
//获取支付插件
Payment payment = (Payment) SpringContextUtil.getBean(paymentMethodEnum.getPlugin());
payment.refundNotify(request);
}
}
|
Order order = orderService.getBySn(afterSale.getOrderSn());
RefundLog refundLog = RefundLog.builder()
.isRefund(false)
.totalAmount(afterSale.getActualRefundPrice())
.payPrice(afterSale.getActualRefundPrice())
.memberId(afterSale.getMemberId())
.paymentName(order.getPaymentMethod())
.afterSaleNo(afterSale.getSn())
.paymentReceivableNo(order.getReceivableNo())
.outOrderNo("AF" + SnowFlake.getIdStr())
.orderSn(afterSale.getOrderSn())
.refundReason(afterSale.getReason())
.build();
PaymentMethodEnum paymentMethodEnum = PaymentMethodEnum.paymentNameOf(order.getPaymentMethod());
Payment payment = (Payment) SpringContextUtil.getBean(paymentMethodEnum.getPlugin());
payment.refund(refundLog);
//记录退款流水
storeFlowService.refundOrder(afterSale);
| 214
| 277
| 491
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/payment/kit/core/PaymentHttpResponse.java
|
PaymentHttpResponse
|
toString
|
class PaymentHttpResponse implements Serializable {
private static final long serialVersionUID = 6089103955998013402L;
private String body;
private int status;
private Map<String, List<String>> headers;
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public Map<String, List<String>> getHeaders() {
return headers;
}
public void setHeaders(Map<String, List<String>> headers) {
this.headers = headers;
}
public String getHeader(String name) {
List<String> values = this.headerList(name);
return CollectionUtil.isEmpty(values) ? null : values.get(0);
}
private List<String> headerList(String name) {
if (StrUtil.isBlank(name)) {
return null;
} else {
CaseInsensitiveMap<String, List<String>> headersIgnoreCase = new CaseInsensitiveMap<>(getHeaders());
return headersIgnoreCase.get(name.trim());
}
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
}
|
return "IJPayHttpResponse{" +
"body='" + body + '\'' +
", status=" + status +
", headers=" + headers +
'}';
| 361
| 49
| 410
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/payment/kit/core/XmlHelper.java
|
XmlHelper
|
evalXpath
|
class XmlHelper {
private final XPath path;
private final Document doc;
private XmlHelper(InputSource inputSource) throws ParserConfigurationException, SAXException, IOException {
DocumentBuilderFactory dbf = getDocumentBuilderFactory();
//This is the PRIMARY defense. If DTDs (doctypes) are disallowed, almost all
//XML entity attacks are prevented
//Xerces 2 only -
//http://xerces.apache.org/xerces2-j/features.html#disallow-doctype-decl
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
//If you can't completely disable DTDs, then at least do the following:
//Xerces 1 -
//http://xerces.apache.org/xerces-j/features.html#external-general-entities
//Xerces 2 -
//http://xerces.apache.org/xerces2-j/features.html#external-general-entities
//JDK7+ - http://xml.org/sax/features/external-general-entities
dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
//Xerces 1 -
//http://xerces.apache.org/xerces-j/features.html#external-parameter-entities
//Xerces 2 -
//http://xerces.apache.org/xerces2-j/features.html#external-parameter-entities
//JDK7+ - http://xml.org/sax/features/external-parameter-entities
dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
//Disable external DTDs as well
dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
//and these as well, per Timothy Morgan's 2014 paper: "XML Schema, DTD, and
//Entity Attacks"
dbf.setXIncludeAware(false);
dbf.setExpandEntityReferences(false);
DocumentBuilder db = dbf.newDocumentBuilder();
doc = db.parse(inputSource);
path = getXpathFactory().newXPath();
}
private static XmlHelper create(InputSource inputSource) {
try {
return new XmlHelper(inputSource);
} catch (ParserConfigurationException | SAXException | IOException e) {
throw new RuntimeException(e);
}
}
public static XmlHelper of(InputStream is) {
InputSource inputSource = new InputSource(is);
return create(inputSource);
}
public static XmlHelper of(File file) {
InputSource inputSource = new InputSource(file.toURI().toASCIIString());
return create(inputSource);
}
public static XmlHelper of(String xmlStr) {
StringReader sr = new StringReader(xmlStr.trim());
InputSource inputSource = new InputSource(sr);
XmlHelper xmlHelper = create(inputSource);
sr.close();
return xmlHelper;
}
private Object evalXpath(String expression, Object item, QName returnType) {<FILL_FUNCTION_BODY>}
/**
* 获取String
*
* @param expression 路径
* @return String
*/
public String getString(String expression) {
return (String) evalXpath(expression, null, XPathConstants.STRING);
}
/**
* 获取Boolean
*
* @param expression 路径
* @return String
*/
public Boolean getBoolean(String expression) {
return (Boolean) evalXpath(expression, null, XPathConstants.BOOLEAN);
}
/**
* 获取Number
*
* @param expression 路径
* @return {Number}
*/
public Number getNumber(String expression) {
return (Number) evalXpath(expression, null, XPathConstants.NUMBER);
}
/**
* 获取某个节点
*
* @param expression 路径
* @return {Node}
*/
public Node getNode(String expression) {
return (Node) evalXpath(expression, null, XPathConstants.NODE);
}
/**
* 获取子节点
*
* @param expression 路径
* @return NodeList
*/
public NodeList getNodeList(String expression) {
return (NodeList) evalXpath(expression, null, XPathConstants.NODESET);
}
/**
* 获取String
*
* @param node 节点
* @param expression 相对于node的路径
* @return String
*/
public String getString(Object node, String expression) {
return (String) evalXpath(expression, node, XPathConstants.STRING);
}
/**
* 获取
*
* @param node 节点
* @param expression 相对于node的路径
* @return String
*/
public Boolean getBoolean(Object node, String expression) {
return (Boolean) evalXpath(expression, node, XPathConstants.BOOLEAN);
}
/**
* 获取
*
* @param node 节点
* @param expression 相对于node的路径
* @return {Number}
*/
public Number getNumber(Object node, String expression) {
return (Number) evalXpath(expression, node, XPathConstants.NUMBER);
}
/**
* 获取某个节点
*
* @param node 节点
* @param expression 路径
* @return {Node}
*/
public Node getNode(Object node, String expression) {
return (Node) evalXpath(expression, node, XPathConstants.NODE);
}
/**
* 获取子节点
*
* @param node 节点
* @param expression 相对于node的路径
* @return NodeList
*/
public NodeList getNodeList(Object node, String expression) {
return (NodeList) evalXpath(expression, node, XPathConstants.NODESET);
}
/**
* 针对没有嵌套节点的简单处理
*
* @return map集合
*/
public Map<String, String> toMap() {
Element root = doc.getDocumentElement();
//将节点封装成map形式
NodeList list = root.getChildNodes();
Map<String, String> params = new HashMap<String, String>(list.getLength());
for (int i = 0; i < list.getLength(); i++) {
Node node = list.item(i);
params.put(node.getNodeName(), node.getTextContent());
}
//含有空白符会生成一个#text参数
params.remove("#text");
return params;
}
private static DocumentBuilderFactory getDocumentBuilderFactory() {
return XmlHelperHolder.documentBuilderFactory;
}
private static XPathFactory getXpathFactory() {
return XmlHelperHolder.xPathFactory;
}
/**
* 内部类单例
*/
private static class XmlHelperHolder {
private static DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
private static XPathFactory xPathFactory = XPathFactory.newInstance();
}
}
|
item = null == item ? doc : item;
try {
return path.evaluate(expression, item, returnType);
} catch (XPathExpressionException e) {
throw new RuntimeException(e);
}
| 1,934
| 58
| 1,992
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/payment/kit/core/kit/AesUtil.java
|
AesUtil
|
decryptToString
|
class AesUtil {
static final int KEY_LENGTH_BYTE = 32;
static final int TAG_LENGTH_BIT = 128;
private final byte[] aesKey;
/**
* @param key APIv3 密钥
*/
public AesUtil(byte[] key) {
if (key.length != KEY_LENGTH_BYTE) {
throw new IllegalArgumentException("无效的ApiV3Key,长度必须为32个字节");
}
this.aesKey = key;
}
/**
* 证书和回调报文解密
*
* @param associatedData associated_data
* @param nonce nonce
* @param cipherText ciphertext
* @return {String} 平台证书明文
* @throws GeneralSecurityException 异常
*/
public String decryptToString(byte[] associatedData, byte[] nonce, String cipherText) throws GeneralSecurityException {<FILL_FUNCTION_BODY>}
}
|
try {
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
SecretKeySpec key = new SecretKeySpec(aesKey, "AES");
GCMParameterSpec spec = new GCMParameterSpec(TAG_LENGTH_BIT, nonce);
cipher.init(Cipher.DECRYPT_MODE, key, spec);
cipher.updateAAD(associatedData);
return new String(cipher.doFinal(Base64.decode(cipherText)), StandardCharsets.UTF_8);
} catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
throw new IllegalStateException(e);
} catch (InvalidKeyException | InvalidAlgorithmParameterException e) {
throw new IllegalArgumentException(e);
}
| 260
| 198
| 458
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/payment/kit/core/kit/HttpKit.java
|
HttpKit
|
readData
|
class HttpKit {
private static AbstractHttpDelegate delegate = new DefaultHttpKit();
public static AbstractHttpDelegate getDelegate() {
return delegate;
}
public static void setDelegate(AbstractHttpDelegate delegate) {
HttpKit.delegate = delegate;
}
public static String readData(HttpServletRequest request) {<FILL_FUNCTION_BODY>}
/**
* 将同步通知的参数转化为Map
*
* @param request {@link HttpServletRequest}
* @return 转化后的 Map
*/
public static Map<String, String> toMap(HttpServletRequest request) {
Map<String, String> params = new HashMap<>(16);
Map<String, String[]> requestParams = request.getParameterMap();
for (String name : requestParams.keySet()) {
String[] values = requestParams.get(name);
String valueStr = "";
for (int i = 0; i < values.length; i++) {
valueStr = (i == values.length - 1) ? valueStr + values[i] : valueStr + values[i] + ",";
}
params.put(name, valueStr);
}
return params;
}
}
|
BufferedReader br = null;
try {
StringBuilder result = new StringBuilder();
br = request.getReader();
for (String line; (line = br.readLine()) != null; ) {
if (result.length() > 0) {
result.append("\n");
}
result.append(line);
}
return result.toString();
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
log.error("readData错误",e);
}
}
}
| 310
| 170
| 480
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/payment/kit/core/kit/QrCodeKit.java
|
QrCodeKit
|
decode
|
class QrCodeKit {
/**
* 图形码生成工具
*
* @param contents 内容
* @param barcodeFormat BarcodeFormat对象
* @param format 图片格式,可选[png,jpg,bmp]
* @param width 宽
* @param height 高
* @param margin 边框间距px
* @param saveImgFilePath 存储图片的完整位置,包含文件名
* @return {boolean}
*/
public static boolean encode(String contents, BarcodeFormat barcodeFormat, Integer margin,
ErrorCorrectionLevel errorLevel, String format, int width, int height, String saveImgFilePath) {
boolean bool = false;
BufferedImage bufImg;
Map<EncodeHintType, Object> hints = new HashMap<EncodeHintType, Object>(3);
//指定纠错等级
hints.put(EncodeHintType.ERROR_CORRECTION, errorLevel);
hints.put(EncodeHintType.MARGIN, margin);
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
try {
BitMatrix bitMatrix = new MultiFormatWriter().encode(contents, barcodeFormat, width, height, hints);
MatrixToImageConfig config = new MatrixToImageConfig(0xFF000001, 0xFFFFFFFF);
bufImg = MatrixToImageWriter.toBufferedImage(bitMatrix, config);
bool = writeToFile(bufImg, format, saveImgFilePath);
} catch (Exception e) {
log.error("图形码生成工具生成错误",e);
}
return bool;
}
/**
* @param srcImgFilePath 要解码的图片地址
* @return {Result}
*/
public static Result decode(String srcImgFilePath) {<FILL_FUNCTION_BODY>}
/**
* 将BufferedImage对象写入文件
*
* @param bufImg BufferedImage对象
* @param format 图片格式,可选[png,jpg,bmp]
* @param saveImgFilePath 存储图片的完整位置,包含文件名
* @return {boolean}
*/
public static boolean writeToFile(BufferedImage bufImg, String format, String saveImgFilePath) {
boolean bool = false;
try {
bool = ImageIO.write(bufImg, format, new File(saveImgFilePath));
} catch (Exception e) {
log.error("将BufferedImage对象写入文件错误",e);
}
return bool;
}
}
|
Result result = null;
BufferedImage image;
try {
File srcFile = new File(srcImgFilePath);
image = ImageIO.read(srcFile);
if (null != image) {
LuminanceSource source = new BufferedImageLuminanceSource(image);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Hashtable<DecodeHintType, String> hints = new Hashtable<DecodeHintType, String>();
hints.put(DecodeHintType.CHARACTER_SET, "UTF-8");
result = new MultiFormatReader().decode(bitmap, hints);
} else {
throw new IllegalArgumentException("Could not decode image.");
}
} catch (Exception e) {
log.error("图片解码错误",e);
}
return result;
| 684
| 222
| 906
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/payment/kit/params/dto/CashierParam.java
|
CashierParam
|
getDetail
|
class CashierParam {
static final Long MAX_DETAIL_LENGTH = 30L;
@ApiModelProperty(value = "价格")
private Double price;
@ApiModelProperty(value = "支付title")
private String title;
@ApiModelProperty(value = "支付详细描述")
private String detail;
@ApiModelProperty(value = "订单sn集合")
private String orderSns;
@ApiModelProperty(value = "支持支付方式")
private List<String> support;
@ApiModelProperty(value = "订单创建时间")
private Date createTime;
@ApiModelProperty(value = "支付自动结束时间")
private Long autoCancel;
@ApiModelProperty(value = "剩余余额")
private Double walletValue;
public String getDetail() {<FILL_FUNCTION_BODY>}
}
|
if (CharSequenceUtil.isEmpty(detail)) {
return "清单详细";
}
return StringUtils.filterSpecialChart(StringUtils.sub(detail, 30));
| 228
| 48
| 276
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/payment/kit/params/impl/OrderCashier.java
|
OrderCashier
|
getPaymentParams
|
class OrderCashier implements CashierExecute {
/**
* 订单
*/
@Autowired
private OrderService orderService;
/**
* 设置
*/
@Autowired
private SettingService settingService;
@Override
public CashierEnum cashierEnum() {
return CashierEnum.ORDER;
}
@Override
public CashierParam getPaymentParams(PayParam payParam) {<FILL_FUNCTION_BODY>}
@Override
public void paymentSuccess(PaymentSuccessParams paymentSuccessParams) {
PayParam payParam = paymentSuccessParams.getPayParam();
if (payParam.getOrderType().equals(CashierEnum.ORDER.name())) {
orderService.payOrder(payParam.getSn(),
paymentSuccessParams.getPaymentMethod(),
paymentSuccessParams.getReceivableNo());
log.info("订单{}支付成功,金额{},方式{}", payParam.getSn(),
paymentSuccessParams.getPaymentMethod(),
paymentSuccessParams.getReceivableNo());
}
}
@Override
public Boolean paymentResult(PayParam payParam) {
if (payParam.getOrderType().equals(CashierEnum.ORDER.name())) {
Order order = orderService.getBySn(payParam.getSn());
if (order != null) {
return PayStatusEnum.PAID.name().equals(order.getPayStatus());
} else {
throw new ServiceException(ResultCode.PAY_NOT_EXIST_ORDER);
}
}
return false;
}
}
|
if (payParam.getOrderType().equals(CashierEnum.ORDER.name())) {
//准备返回的数据
CashierParam cashierParam = new CashierParam();
//订单信息获取
OrderDetailVO order = orderService.queryDetail(payParam.getSn());
//如果订单已支付,则不能发器支付
if (order.getOrder().getPayStatus().equals(PayStatusEnum.PAID.name())) {
throw new ServiceException(ResultCode.PAY_DOUBLE_ERROR);
}
//如果订单状态不是待付款,则抛出异常
if (!order.getOrder().getOrderStatus().equals(OrderStatusEnum.UNPAID.name())) {
throw new ServiceException(ResultCode.PAY_BAN);
}
cashierParam.setPrice(order.getOrder().getFlowPrice());
try {
BaseSetting baseSetting = JSONUtil.toBean(settingService.get(SettingEnum.BASE_SETTING.name()).getSettingValue(), BaseSetting.class);
cashierParam.setTitle(baseSetting.getSiteName());
} catch (Exception e) {
cashierParam.setTitle("多用户商城,在线支付");
}
List<OrderItem> orderItemList = order.getOrderItems();
StringBuilder subject = new StringBuilder();
for (OrderItem orderItem : orderItemList) {
subject.append(orderItem.getGoodsName()).append(";");
}
cashierParam.setDetail(subject.toString());
cashierParam.setOrderSns(payParam.getSn());
cashierParam.setCreateTime(order.getOrder().getCreateTime());
return cashierParam;
}
return null;
| 406
| 434
| 840
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/payment/kit/params/impl/RechargeCashier.java
|
RechargeCashier
|
paymentSuccess
|
class RechargeCashier implements CashierExecute {
/**
* 余额
*/
@Autowired
private RechargeService rechargeService;
/**
* 设置
*/
@Autowired
private SettingService settingService;
@Override
public CashierEnum cashierEnum() {
return CashierEnum.RECHARGE;
}
@Override
public void paymentSuccess(PaymentSuccessParams paymentSuccessParams) {<FILL_FUNCTION_BODY>}
@Override
public CashierParam getPaymentParams(PayParam payParam) {
if (payParam.getOrderType().equals(CashierEnum.RECHARGE.name())) {
//准备返回的数据
CashierParam cashierParam = new CashierParam();
//订单信息获取
Recharge recharge = rechargeService.getRecharge(payParam.getSn());
//如果订单已支付,则不能发器支付
if (recharge.getPayStatus().equals(PayStatusEnum.PAID.name())) {
throw new ServiceException(ResultCode.PAY_DOUBLE_ERROR);
}
cashierParam.setPrice(recharge.getRechargeMoney());
try {
BaseSetting baseSetting = JSONUtil.toBean(settingService.get(SettingEnum.BASE_SETTING.name()).getSettingValue(), BaseSetting.class);
cashierParam.setTitle(baseSetting.getSiteName());
} catch (Exception e) {
cashierParam.setTitle("多用户商城,在线充值");
}
cashierParam.setDetail("余额充值");
cashierParam.setCreateTime(recharge.getCreateTime());
return cashierParam;
}
return null;
}
@Override
public Boolean paymentResult(PayParam payParam) {
if (payParam.getOrderType().equals(CashierEnum.RECHARGE.name())) {
Recharge recharge = rechargeService.getRecharge(payParam.getSn());
if (recharge != null) {
return recharge.getPayStatus().equals(PayStatusEnum.PAID.name());
} else {
throw new ServiceException(ResultCode.PAY_NOT_EXIST_ORDER);
}
}
return false;
}
}
|
PayParam payParam = paymentSuccessParams.getPayParam();
if (payParam.getOrderType().equals(CashierEnum.RECHARGE.name())) {
rechargeService.paySuccess(payParam.getSn(), paymentSuccessParams.getReceivableNo(),paymentSuccessParams.getPaymentMethod());
log.info("会员充值-订单号{},第三方流水:{}", payParam.getSn(), paymentSuccessParams.getReceivableNo());
}
| 583
| 122
| 705
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/payment/kit/params/impl/TradeCashier.java
|
TradeCashier
|
getPaymentParams
|
class TradeCashier implements CashierExecute {
/**
* 交易
*/
@Autowired
private TradeService tradeService;
/**
* 订单
*/
@Autowired
private OrderService orderService;
/**
* 设置
*/
@Autowired
private SettingService settingService;
@Override
public CashierEnum cashierEnum() {
return CashierEnum.TRADE;
}
@Override
public CashierParam getPaymentParams(PayParam payParam) {<FILL_FUNCTION_BODY>}
@Override
public void paymentSuccess(PaymentSuccessParams paymentSuccessParams) {
if (paymentSuccessParams.getPayParam().getOrderType().equals(CashierEnum.TRADE.name())) {
tradeService.payTrade(paymentSuccessParams.getPayParam().getSn(),
paymentSuccessParams.getPaymentMethod(),
paymentSuccessParams.getReceivableNo());
log.info("交易{}支付成功,方式{},流水号{},", paymentSuccessParams.getPayParam().getSn(),
paymentSuccessParams.getPaymentMethod(),
paymentSuccessParams.getReceivableNo());
}
}
@Override
public Boolean paymentResult(PayParam payParam) {
if (payParam.getOrderType().equals(CashierEnum.TRADE.name())) {
Trade trade = tradeService.getBySn(payParam.getSn());
if (trade != null) {
return PayStatusEnum.PAID.name().equals(trade.getPayStatus());
} else {
throw new ServiceException(ResultCode.PAY_NOT_EXIST_ORDER);
}
}
return false;
}
}
|
if (payParam.getOrderType().equals(CashierEnum.TRADE.name())) {
//准备返回的数据
CashierParam cashierParam = new CashierParam();
//订单信息获取
Trade trade = tradeService.getBySn(payParam.getSn());
List<Order> orders = orderService.getByTradeSn(payParam.getSn());
String orderSns = orders.stream().map(Order::getSn).collect(Collectors.joining(", "));
cashierParam.setOrderSns(orderSns);
for (Order order : orders) {
//如果订单已支付,则不能发器支付
if (order.getPayStatus().equals(PayStatusEnum.PAID.name())) {
throw new ServiceException(ResultCode.PAY_PARTIAL_ERROR);
}
//如果订单状态不是待付款,则抛出异常
if (!order.getOrderStatus().equals(OrderStatusEnum.UNPAID.name())) {
throw new ServiceException(ResultCode.PAY_BAN);
}
}
cashierParam.setPrice(trade.getFlowPrice());
try {
BaseSetting baseSetting = JSONUtil.toBean(settingService.get(SettingEnum.BASE_SETTING.name()).getSettingValue(), BaseSetting.class);
cashierParam.setTitle(baseSetting.getSiteName());
} catch (Exception e) {
cashierParam.setTitle("多用户商城,在线支付");
}
String subject = "在线支付";
cashierParam.setDetail(subject);
cashierParam.setCreateTime(trade.getCreateTime());
return cashierParam;
}
return null;
| 447
| 434
| 881
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/payment/kit/plugin/alipay/AliPayApiConfigKit.java
|
AliPayApiConfigKit
|
rebuild
|
class AliPayApiConfigKit {
/**
* 支付配置
*/
static DefaultAlipayClient defaultAlipayClient;
/**
* 下次刷新时间
*/
static Date nextRebuildDate;
/**
* 间隔时间
*/
static Long refreshInterval = 1000 * 60 * 3L;
/**
* 获取支付宝支付参数
*
* @return
* @throws AlipayApiException
*/
public static synchronized DefaultAlipayClient getAliPayApiConfig() throws AlipayApiException {
Date date = new Date();
//如果过期,则重新构建
if (nextRebuildDate == null || date.after(nextRebuildDate)) {
return rebuild();
}
return defaultAlipayClient;
}
static DefaultAlipayClient rebuild() throws AlipayApiException {<FILL_FUNCTION_BODY>}
}
|
AlipayPaymentSetting setting;
try {
SettingService settingService = (SettingService) SpringContextUtil.getBean("settingServiceImpl");
Setting systemSetting = settingService.get(SettingEnum.ALIPAY_PAYMENT.name());
setting = JSONUtil.toBean(systemSetting.getSettingValue(), AlipayPaymentSetting.class);
} catch (Exception e) {
throw new ServiceException(ResultCode.PAY_NOT_SUPPORT);
}
CertAlipayRequest certAlipayRequest = new CertAlipayRequest();
certAlipayRequest.setServerUrl("https://openapi.alipay.com/gateway.do");
certAlipayRequest.setFormat("json");
certAlipayRequest.setCharset("utf-8");
certAlipayRequest.setSignType("RSA2");
certAlipayRequest.setAppId(setting.getAppId());
certAlipayRequest.setPrivateKey(setting.getPrivateKey());
certAlipayRequest.setCertPath(setting.getCertPath());
certAlipayRequest.setAlipayPublicCertPath(setting.getAlipayPublicCertPath());
certAlipayRequest.setRootCertPath(setting.getRootCertPath());
defaultAlipayClient = new DefaultAlipayClient(certAlipayRequest);
nextRebuildDate = DateUtil.date(System.currentTimeMillis()+ refreshInterval);
return defaultAlipayClient;
| 243
| 366
| 609
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/payment/kit/plugin/alipay/AliPayRequest.java
|
AliPayRequest
|
wapPay
|
class AliPayRequest {
/**
* WAP支付
*
* @param response {@link HttpServletResponse}
* @param model {@link AlipayTradeWapPayModel}
* @param returnUrl 异步通知URL
* @param notifyUrl 同步通知URL
* @throws AlipayApiException 支付宝 Api 异常
* @throws IOException IO 异常
*/
public static void wapPay(HttpServletResponse response, AlipayTradeWapPayModel model, String returnUrl, String notifyUrl) throws AlipayApiException, IOException {<FILL_FUNCTION_BODY>}
/**
* APP支付
*
* @param model {@link AlipayTradeAppPayModel}
* @param notifyUrl 异步通知 URL
* @return {@link AlipayTradeAppPayResponse}
* @throws AlipayApiException 支付宝 Api 异常
*/
public static AlipayTradeAppPayResponse appPayToResponse(AlipayTradeAppPayModel model, String notifyUrl) throws AlipayApiException {
AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
request.setBizModel(model);
request.setNotifyUrl(notifyUrl);
return sdkExecute(request);
}
/**
* 电脑网站支付(PC支付)
*
* @param response {@link HttpServletResponse}
* @param model {@link AlipayTradePagePayModel}
* @param notifyUrl 异步通知URL
* @param returnUrl 同步通知URL
* @throws AlipayApiException 支付宝 Api 异常
* @throws IOException IO 异常
*/
public static void tradePage(HttpServletResponse response, AlipayTradePagePayModel model, String notifyUrl, String returnUrl) throws AlipayApiException, IOException {
AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
request.setBizModel(model);
request.setNotifyUrl(notifyUrl);
request.setReturnUrl(returnUrl);
String form = pageExecute(request).getBody();
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.write(form);
out.flush();
out.close();
}
/**
* 统一收单线下交易预创建 <br>
* 适用于:扫码支付等 <br>
*
* @param model {@link AlipayTradePrecreateModel}
* @param notifyUrl 异步通知URL
* @return {@link AlipayTradePrecreateResponse}
* @throws AlipayApiException 支付宝 Api 异常
*/
public static AlipayTradePrecreateResponse tradePrecreatePayToResponse(AlipayTradePrecreateModel model, String notifyUrl) throws AlipayApiException {
AlipayTradePrecreateRequest request = new AlipayTradePrecreateRequest();
request.setBizModel(model);
request.setNotifyUrl(notifyUrl);
return doExecute(request);
}
/**
* WAP支付
*
* @param model {@link AlipayTradeWapPayModel}
* @param returnUrl 异步通知URL
* @param notifyUrl 同步通知URL
* @return {String}
* @throws AlipayApiException 支付宝 Api 异常
*/
public static String wapPayStr(AlipayTradeWapPayModel model, String returnUrl, String notifyUrl) throws AlipayApiException {
AlipayTradeWapPayRequest aliPayRequest = new AlipayTradeWapPayRequest();
aliPayRequest.setReturnUrl(returnUrl);
aliPayRequest.setNotifyUrl(notifyUrl);
aliPayRequest.setBizModel(model);
return pageExecute(aliPayRequest).getBody();
}
public static <T extends AlipayResponse> T doExecute(AlipayRequest<T> request) throws AlipayApiException {
return certificateExecute(request);
}
public static <T extends AlipayResponse> T certificateExecute(AlipayRequest<T> request) throws AlipayApiException {
return AliPayApiConfigKit.getAliPayApiConfig().certificateExecute(request);
}
public static <T extends AlipayResponse> T pageExecute(AlipayRequest<T> request) throws AlipayApiException {
return AliPayApiConfigKit.getAliPayApiConfig().pageExecute(request);
}
public static <T extends AlipayResponse> T sdkExecute(AlipayRequest<T> request) throws AlipayApiException {
return AliPayApiConfigKit.getAliPayApiConfig().sdkExecute(request);
}
}
|
String form = wapPayStr(model, returnUrl, notifyUrl);
response.setContentType("text/html;charset=UTF-8");
log.info("支付表单{}", form);
PrintWriter out = response.getWriter();
out.write(form);
out.flush();
out.close();
| 1,218
| 84
| 1,302
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/payment/kit/plugin/bank/BankTransferPlugin.java
|
BankTransferPlugin
|
callBack
|
class BankTransferPlugin implements Payment {
/**
* 退款日志
*/
@Autowired
private RefundLogService refundLogService;
/**
* 支付日志
*/
@Autowired
private PaymentService paymentService;
@Override
public void refund(RefundLog refundLog) {
try {
refundLog.setIsRefund(true);
refundLogService.save(refundLog);
} catch (Exception e) {
log.error("线下收款错误",e);
}
}
/**
* 支付订单
*
* @param order 订单
*/
public void callBack(Order order) {<FILL_FUNCTION_BODY>}
}
|
//收银参数
CashierParam cashierParam = new CashierParam();
cashierParam.setPrice(order.getFlowPrice());
//支付参数
PayParam payParam = new PayParam();
payParam.setOrderType("ORDER");
payParam.setSn(order.getSn());
payParam.setClientType(ClientTypeEnum.PC.name());
PaymentSuccessParams paymentSuccessParams = new PaymentSuccessParams(
PaymentMethodEnum.BANK_TRANSFER.name(),
"",
order.getFlowPrice(),
payParam
);
//记录支付日志
paymentService.adminPaySuccess(paymentSuccessParams);
log.info("支付回调通知:线上支付:{}", payParam);
| 195
| 191
| 386
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/payment/kit/plugin/unionpay/UnionPayApiConfigKit.java
|
UnionPayApiConfigKit
|
getMchId
|
class UnionPayApiConfigKit {
private static final ThreadLocal<String> TL = new ThreadLocal<String>();
private static final Map<String, UnionPayApiConfig> CFG_MAP = new ConcurrentHashMap<String, UnionPayApiConfig>();
private static final String DEFAULT_CFG_KEY = "_default_key_";
/**
* 添加云闪付配置,每个 mchId 只需添加一次,相同 mchId 将被覆盖
*
* @param UnionPayApiConfig 云闪付配置
* @return {@link UnionPayApiConfig} 云闪付配置
*/
public static UnionPayApiConfig putApiConfig(UnionPayApiConfig UnionPayApiConfig) {
if (CFG_MAP.size() == 0) {
CFG_MAP.put(DEFAULT_CFG_KEY, UnionPayApiConfig);
}
return CFG_MAP.put(UnionPayApiConfig.getMchId(), UnionPayApiConfig);
}
public static UnionPayApiConfig setThreadLocalApiConfig(UnionPayApiConfig UnionPayApiConfig) {
if (StrUtil.isNotEmpty(UnionPayApiConfig.getMchId())) {
setThreadLocalMchId(UnionPayApiConfig.getMchId());
}
return putApiConfig(UnionPayApiConfig);
}
public static UnionPayApiConfig removeApiConfig(UnionPayApiConfig UnionPayApiConfig) {
return removeApiConfig(UnionPayApiConfig.getMchId());
}
public static UnionPayApiConfig removeApiConfig(String mchId) {
return CFG_MAP.remove(mchId);
}
public static void setThreadLocalMchId(String mchId) {
if (StrUtil.isEmpty(mchId)) {
mchId = CFG_MAP.get(DEFAULT_CFG_KEY).getMchId();
}
TL.set(mchId);
}
public static void removeThreadLocalMchId() {
TL.remove();
}
public static String getMchId() {<FILL_FUNCTION_BODY>}
public static UnionPayApiConfig getApiConfig() {
String appId = getMchId();
return getApiConfig(appId);
}
public static UnionPayApiConfig getApiConfig(String appId) {
UnionPayApiConfig cfg = CFG_MAP.get(appId);
if (cfg == null) {
throw new IllegalStateException("需事先调用 UnionPayApiConfigKit.putApiConfig(UnionPayApiConfig) 将 mchId 对应的 UnionPayApiConfig 对象存入,才可以使用 UnionPayApiConfigKit.getUnionPayApiConfig() 的系列方法");
}
return cfg;
}
}
|
String appId = TL.get();
if (StrUtil.isEmpty(appId)) {
appId = CFG_MAP.get(DEFAULT_CFG_KEY).getMchId();
}
return appId;
| 699
| 60
| 759
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/payment/kit/plugin/unionpay/model/BaseModel.java
|
BaseModel
|
getFieldValueByName
|
class BaseModel {
/**
* 将建构的 builder 转为 Map
*
* @return 转化后的 Map
*/
public Map<String, String> toMap() {
String[] fieldNames = getFiledNames(this);
HashMap<String, String> map = new HashMap<String, String>(fieldNames.length);
for (String name : fieldNames) {
String value = (String) getFieldValueByName(name, this);
if (StrUtil.isNotEmpty(value)) {
map.put(name, value);
}
}
return map;
}
/**
* 构建签名 Map
*
* @param partnerKey API KEY
* @param signType {@link SignType} 签名类型
* @return 构建签名后的 Map
*/
public Map<String, String> createSign(String partnerKey, SignType signType) {
return createSign(partnerKey, signType, true);
}
/**
* 构建签名 Map
*
* @param partnerKey API KEY
* @param signType {@link SignType} 签名类型
* @param haveSignType 签名是否包含 sign_type 字段
* @return 构建签名后的 Map
*/
public Map<String, String> createSign(String partnerKey, SignType signType, boolean haveSignType) {
return WxPayKit.buildSign(toMap(), partnerKey, signType, haveSignType);
}
/**
* 获取属性名数组
*
* @param obj 对象
* @return 返回对象属性名数组
*/
public String[] getFiledNames(Object obj) {
Field[] fields = obj.getClass().getDeclaredFields();
String[] fieldNames = new String[fields.length];
for (int i = 0; i < fields.length; i++) {
fieldNames[i] = fields[i].getName();
}
return fieldNames;
}
/**
* 根据属性名获取属性值
*
* @param fieldName 属性名称
* @param obj 对象
* @return 返回对应属性的值
*/
public Object getFieldValueByName(String fieldName, Object obj) {<FILL_FUNCTION_BODY>}
}
|
try {
String firstLetter = fieldName.substring(0, 1).toUpperCase();
String getter = new StringBuffer().append("get")
.append(firstLetter)
.append(fieldName.substring(1))
.toString();
Method method = obj.getClass().getMethod(getter);
return method.invoke(obj);
} catch (Exception e) {
return null;
}
| 602
| 113
| 715
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wallet/WalletPlugin.java
|
WalletPlugin
|
refund
|
class WalletPlugin implements Payment {
/**
* 支付日志
*/
@Autowired
private PaymentService paymentService;
/**
* 退款日志
*/
@Autowired
private RefundLogService refundLogService;
/**
* 会员余额
*/
@Autowired
private MemberWalletService memberWalletService;
/**
* 收银台
*/
@Autowired
private CashierSupport cashierSupport;
@Autowired
private RedissonClient redisson;
@Override
public ResultMessage<Object> h5pay(HttpServletRequest request, HttpServletResponse response, PayParam payParam) {
savePaymentLog(payParam);
return ResultUtil.success(ResultCode.PAY_SUCCESS);
}
@Override
public ResultMessage<Object> jsApiPay(HttpServletRequest request, PayParam payParam) {
savePaymentLog(payParam);
return ResultUtil.success(ResultCode.PAY_SUCCESS);
}
@Override
public ResultMessage<Object> appPay(HttpServletRequest request, PayParam payParam) {
savePaymentLog(payParam);
return ResultUtil.success(ResultCode.PAY_SUCCESS);
}
@Override
public ResultMessage<Object> nativePay(HttpServletRequest request, PayParam payParam) {
if (payParam.getOrderType().equals(CashierEnum.RECHARGE.name())) {
throw new ServiceException(ResultCode.CAN_NOT_RECHARGE_WALLET);
}
savePaymentLog(payParam);
return ResultUtil.success(ResultCode.PAY_SUCCESS);
}
@Override
public ResultMessage<Object> mpPay(HttpServletRequest request, PayParam payParam) {
savePaymentLog(payParam);
return ResultUtil.success(ResultCode.PAY_SUCCESS);
}
/**
* 保存支付日志
*
* @param payParam 支付参数
*/
private void savePaymentLog(PayParam payParam) {
//同一个会员如果在不同的客户端使用预存款支付,会存在同时支付,无法保证预存款的正确性,所以对会员加锁
RLock lock = redisson.getLock(UserContext.getCurrentUser().getId() + "");
lock.lock();
try {
//获取支付收银参数
CashierParam cashierParam = cashierSupport.cashierParam(payParam);
this.callBack(payParam, cashierParam);
} finally {
lock.unlock();
}
}
@Override
public void refund(RefundLog refundLog) {<FILL_FUNCTION_BODY>}
/**
* 支付订单
*
* @param payParam 支付参数
* @param cashierParam 收银台参数
*/
public void callBack(PayParam payParam, CashierParam cashierParam) {
//支付信息
try {
if (UserContext.getCurrentUser() == null) {
throw new ServiceException(ResultCode.USER_NOT_LOGIN);
}
boolean result = memberWalletService.reduce(new MemberWalletUpdateDTO(
cashierParam.getPrice(),
UserContext.getCurrentUser().getId(),
"订单[" + cashierParam.getOrderSns() + "]支付金额[" + cashierParam.getPrice() + "]",
DepositServiceTypeEnum.WALLET_PAY.name()
)
);
if (result) {
try {
PaymentSuccessParams paymentSuccessParams = new PaymentSuccessParams(
PaymentMethodEnum.WALLET.name(),
"",
cashierParam.getPrice(),
payParam
);
paymentService.success(paymentSuccessParams);
log.info("支付回调通知:余额支付:{}", payParam);
} catch (ServiceException e) {
//业务异常,则支付手动回滚
memberWalletService.increase(new MemberWalletUpdateDTO(
cashierParam.getPrice(),
UserContext.getCurrentUser().getId(),
"订单[" + cashierParam.getOrderSns() + "]支付异常,余额返还[" + cashierParam.getPrice() + "]",
DepositServiceTypeEnum.WALLET_REFUND.name())
);
throw e;
}
} else {
throw new ServiceException(ResultCode.WALLET_INSUFFICIENT);
}
} catch (ServiceException e) {
throw e;
} catch (Exception e) {
log.info("余额支付异常", e);
throw new ServiceException(ResultCode.WALLET_INSUFFICIENT);
}
}
}
|
try {
memberWalletService.increase(new MemberWalletUpdateDTO(refundLog.getTotalAmount(),
refundLog.getMemberId(),
"订单[" + refundLog.getOrderSn() + "],售后单[" + refundLog.getAfterSaleNo() + "],退还金额[" + refundLog.getTotalAmount() + "]",
DepositServiceTypeEnum.WALLET_REFUND.name()));
refundLog.setIsRefund(true);
refundLogService.save(refundLog);
} catch (Exception e) {
log.error("退款失败", e);
}
| 1,214
| 158
| 1,372
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/payment/serviceimpl/PaymentServiceImpl.java
|
PaymentServiceImpl
|
success
|
class PaymentServiceImpl implements PaymentService {
@Autowired
private List<CashierExecute> cashierExecutes;
@Autowired
private CashierSupport cashierSupport;
@Override
public void success(PaymentSuccessParams paymentSuccessParams) {<FILL_FUNCTION_BODY>}
@Override
public void adminPaySuccess(PaymentSuccessParams paymentSuccessParams) {
log.debug("支付状态修改成功->银行转账");
//支付结果处理
for (CashierExecute cashierExecute : cashierExecutes) {
cashierExecute.paymentSuccess(paymentSuccessParams);
}
}
}
|
//支付状态
boolean paymentResult = cashierSupport.paymentResult(paymentSuccessParams.getPayParam());
//已支付则返回
if (paymentResult) {
log.warn("收银台重复收款,流水号:{}", paymentSuccessParams.getReceivableNo());
return;
}
log.debug("支付成功,第三方流水:{}", paymentSuccessParams.getReceivableNo());
//支付结果处理
for (CashierExecute cashierExecute : cashierExecutes) {
cashierExecute.paymentSuccess(paymentSuccessParams);
}
| 168
| 160
| 328
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/permission/entity/vo/MenuVO.java
|
MenuVO
|
getChildren
|
class MenuVO extends Menu {
@ApiModelProperty(value = "子菜单")
private List<MenuVO> children = new ArrayList<>();
public MenuVO() {
}
public MenuVO(Menu menu) {
BeanUtil.copyProperties(menu, this);
}
public List<MenuVO> getChildren() {<FILL_FUNCTION_BODY>}
}
|
if (children != null) {
children.sort(new Comparator<MenuVO>() {
@Override
public int compare(MenuVO o1, MenuVO o2) {
return o1.getSortOrder().compareTo(o2.getSortOrder());
}
});
return children;
}
return null;
| 102
| 89
| 191
|
<methods>public non-sealed void <init>() <variables>private java.lang.String frontRoute,private java.lang.Integer level,private java.lang.String name,private java.lang.String parentId,private java.lang.String path,private java.lang.String permission,private static final long serialVersionUID,private java.lang.Double sortOrder,private java.lang.String title
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/permission/serviceimpl/RoleMenuServiceImpl.java
|
RoleMenuServiceImpl
|
deleteRoleMenu
|
class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenu> implements RoleMenuService {
@Autowired
private Cache<Object> cache;
@Override
public List<RoleMenu> findByRoleId(String roleId) {
LambdaQueryWrapper<RoleMenu> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(RoleMenu::getRoleId, roleId);
return this.baseMapper.selectList(queryWrapper);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateRoleMenu(String roleId, List<RoleMenu> roleMenus) {
try {
//删除角色已经绑定的菜单
this.deleteRoleMenu(roleId);
//重新保存角色菜单关系
this.saveBatch(roleMenus);
cache.vagueDel(CachePrefix.USER_MENU.getPrefix(UserEnums.MANAGER));
cache.vagueDel(CachePrefix.PERMISSION_LIST.getPrefix(UserEnums.MANAGER));
} catch (Exception e) {
log.error("修改用户权限错误", e);
}
}
@Override
public void deleteRoleMenu(String roleId) {
//删除
QueryWrapper<RoleMenu> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("role_id", roleId);
cache.vagueDel(CachePrefix.USER_MENU.getPrefix(UserEnums.MANAGER));
cache.vagueDel(CachePrefix.PERMISSION_LIST.getPrefix(UserEnums.MANAGER));
this.remove(queryWrapper);
}
@Override
public void deleteRoleMenu(List<String> roleId) {<FILL_FUNCTION_BODY>}
}
|
//删除
QueryWrapper<RoleMenu> queryWrapper = new QueryWrapper<>();
queryWrapper.in("role_id", roleId);
cache.vagueDel(CachePrefix.USER_MENU.getPrefix(UserEnums.MANAGER));
cache.vagueDel(CachePrefix.PERMISSION_LIST.getPrefix(UserEnums.MANAGER));
this.remove(queryWrapper);
| 453
| 105
| 558
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/permission/serviceimpl/RoleServiceImpl.java
|
RoleServiceImpl
|
findByDefaultRole
|
class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {
/**
* 部门角色
*/
@Autowired
private DepartmentRoleService departmentRoleService;
/**
* 用户权限
*/
@Autowired
private UserRoleService userRoleService;
@Autowired
private RoleMenuService roleMenuService;
@Autowired
private Cache cache;
@Override
public List<Role> findByDefaultRole(Boolean defaultRole) {<FILL_FUNCTION_BODY>}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteRoles(List<String> roleIds) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.in("role_id", roleIds);
if (departmentRoleService.count(queryWrapper) > 0) {
throw new ServiceException(ResultCode.PERMISSION_DEPARTMENT_ROLE_ERROR);
}
if (userRoleService.count(queryWrapper) > 0) {
throw new ServiceException(ResultCode.PERMISSION_USER_ROLE_ERROR);
}
//删除角色
this.removeByIds(roleIds);
//删除角色与菜单关联
roleMenuService.remove(queryWrapper);
cache.vagueDel(CachePrefix.USER_MENU.getPrefix(UserEnums.MANAGER));
cache.vagueDel(CachePrefix.PERMISSION_LIST.getPrefix(UserEnums.MANAGER));
}
}
|
QueryWrapper<Role> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("default_role", true);
return baseMapper.selectList(queryWrapper);
| 390
| 43
| 433
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/permission/serviceimpl/SystemLogServiceImpl.java
|
SystemLogServiceImpl
|
queryLog
|
class SystemLogServiceImpl implements SystemLogService {
@Autowired
private SystemLogRepository systemLogRepository;
/**
* ES
*/
@Autowired
private ElasticsearchOperations restTemplate;
@Override
public void saveLog(SystemLogVO systemLogVO) {
systemLogRepository.save(systemLogVO);
}
@Override
public void deleteLog(List<String> id) {
for (String s : id) {
systemLogRepository.deleteById(s);
}
}
@Override
public void flushAll() {
systemLogRepository.deleteAll();
}
@Override
public IPage<SystemLogVO> queryLog(String storeId, String operatorName, String key, SearchVO searchVo, PageVO pageVO) {<FILL_FUNCTION_BODY>}
}
|
pageVO.setNotConvert(true);
IPage<SystemLogVO> iPage = new Page<>();
NativeSearchQueryBuilder nativeSearchQueryBuilder = new NativeSearchQueryBuilder();
if (pageVO.getPageNumber() != null && pageVO.getPageSize() != null) {
int pageNumber = pageVO.getPageNumber() - 1;
if (pageNumber < 0) {
pageNumber = 0;
}
Pageable pageable = PageRequest.of(pageNumber, pageVO.getPageSize());
//分页
nativeSearchQueryBuilder.withPageable(pageable);
iPage.setCurrent(pageVO.getPageNumber());
iPage.setSize(pageVO.getPageSize());
}
if (CharSequenceUtil.isNotEmpty(storeId)) {
nativeSearchQueryBuilder.withFilter(QueryBuilders.matchQuery("storeId", storeId));
}
if (CharSequenceUtil.isNotEmpty(operatorName)) {
nativeSearchQueryBuilder.withQuery(QueryBuilders.matchQuery("username", operatorName));
}
if (CharSequenceUtil.isNotEmpty(key)) {
MultiMatchQueryBuilder multiMatchQueryBuilder = QueryBuilders.multiMatchQuery(key, "requestUrl", "requestParam", "responseBody", "name");
multiMatchQueryBuilder.fuzziness(Fuzziness.AUTO);
nativeSearchQueryBuilder.withFilter(multiMatchQueryBuilder);
}
//时间有效性判定
if (searchVo.getConvertStartDate() != null && searchVo.getConvertEndDate() != null) {
BoolQueryBuilder filterBuilder = new BoolQueryBuilder();
//大于方法
filterBuilder.filter(
QueryBuilders.rangeQuery("createTime")
.gte(searchVo.getConvertStartDate().getTime())
.lte(searchVo.getConvertEndDate().getTime()));
nativeSearchQueryBuilder.withFilter(filterBuilder);
}
if (CharSequenceUtil.isNotEmpty(pageVO.getOrder()) && CharSequenceUtil.isNotEmpty(pageVO.getSort())) {
nativeSearchQueryBuilder.withSort(SortBuilders.fieldSort(pageVO.getSort()).order(SortOrder.valueOf(pageVO.getOrder().toUpperCase())));
} else {
nativeSearchQueryBuilder.withSort(SortBuilders.fieldSort("createTime").order(SortOrder.DESC));
}
SearchHits<SystemLogVO> searchResult = restTemplate.search(nativeSearchQueryBuilder.build(), SystemLogVO.class);
iPage.setTotal(searchResult.getTotalHits());
iPage.setRecords(searchResult.getSearchHits().stream().map(SearchHit::getContent).collect(Collectors.toList()));
return iPage;
| 218
| 695
| 913
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/permission/serviceimpl/UserRoleServiceImpl.java
|
UserRoleServiceImpl
|
listId
|
class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> implements UserRoleService {
@Autowired
private Cache cache;
@Override
public List<UserRole> listByUserId(String userId) {
QueryWrapper<UserRole> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", userId);
return this.baseMapper.selectList(queryWrapper);
}
@Override
public List<String> listId(String userId) {<FILL_FUNCTION_BODY>}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateUserRole(String userId, List<UserRole> userRoles) {
//删除
QueryWrapper<UserRole> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", userId);
this.remove(queryWrapper);
//保存
this.saveBatch(userRoles);
cache.vagueDel(CachePrefix.USER_MENU.getPrefix(UserEnums.MANAGER));
cache.vagueDel(CachePrefix.PERMISSION_LIST.getPrefix(UserEnums.MANAGER));
}
}
|
List<UserRole> userRoleList = this.listByUserId(userId);
List<String> strings = new ArrayList<>();
userRoleList.forEach(item -> strings.add(item.getRoleId()));
return strings;
| 302
| 62
| 364
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/promotion/entity/dos/BasePromotions.java
|
BasePromotions
|
getPromotionStatus
|
class BasePromotions extends BaseEntity {
private static final long serialVersionUID = 7814832369110695758L;
@ApiModelProperty(value = "商家名称,如果是平台,这个值为 platform")
private String storeName;
@ApiModelProperty(value = "商家id,如果是平台,这个值为 0")
private String storeId;
@NotEmpty(message = "活动名称不能为空")
@ApiModelProperty(value = "活动名称", required = true)
private String promotionName;
@ApiModelProperty(value = "活动开始时间", required = true)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss || yyyy-MM-dd || yyyy/MM/dd HH:mm:ss|| yyyy/MM/dd ||epoch_millis")
private Date startTime;
@ApiModelProperty(value = "活动结束时间", required = true)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss || yyyy-MM-dd || yyyy/MM/dd HH:mm:ss|| yyyy/MM/dd ||epoch_millis")
private Date endTime;
/**
* @see PromotionsScopeTypeEnum
*/
@ApiModelProperty(value = "关联范围类型")
private String scopeType = PromotionsScopeTypeEnum.PORTION_GOODS.name();
@ApiModelProperty(value = "范围关联的id")
private String scopeId;
/**
* @return 促销状态
* @see PromotionsStatusEnum
*/
public String getPromotionStatus() {<FILL_FUNCTION_BODY>}
}
|
if (endTime == null) {
return startTime != null ? PromotionsStatusEnum.START.name() : PromotionsStatusEnum.CLOSE.name();
}
Date now = new Date();
if (now.before(startTime)) {
return PromotionsStatusEnum.NEW.name();
} else if (endTime.before(now)) {
return PromotionsStatusEnum.END.name();
} else if (now.before(endTime)) {
return PromotionsStatusEnum.START.name();
}
return PromotionsStatusEnum.CLOSE.name();
| 534
| 153
| 687
|
<methods>public non-sealed void <init>() <variables>private java.lang.String createBy,private java.util.Date createTime,private java.lang.Boolean deleteFlag,private java.lang.String id,private static final long serialVersionUID,private java.lang.String updateBy,private java.util.Date updateTime
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/promotion/entity/dos/Coupon.java
|
Coupon
|
getPromotionStatus
|
class Coupon extends BasePromotions {
private static final long serialVersionUID = 8372820376262437018L;
@ApiModelProperty(value = "优惠券名称")
private String couponName;
/**
* POINT("打折"), PRICE("减免现金");
*
* @see cn.lili.modules.promotion.entity.enums.CouponTypeEnum
*/
@ApiModelProperty(value = "优惠券类型")
private String couponType;
@ApiModelProperty(value = "面额")
private Double price;
@ApiModelProperty(value = "折扣")
private Double couponDiscount;
/**
* @see cn.lili.modules.promotion.entity.enums.CouponGetEnum
*/
@ApiModelProperty(value = "优惠券类型,分为免费领取和活动赠送")
private String getType;
@ApiModelProperty(value = "店铺承担比例,平台发布时可以提供一定返点")
private Double storeCommission;
@ApiModelProperty(value = "活动描述")
private String description;
@ApiModelProperty(value = "发行数量,如果是0则是不限制")
private Integer publishNum;
@ApiModelProperty(value = "领取限制")
private Integer couponLimitNum;
@ApiModelProperty(value = "已被使用的数量")
private Integer usedNum;
@ApiModelProperty(value = "已被领取的数量")
private Integer receivedNum;
@ApiModelProperty(value = "消费门槛")
private Double consumeThreshold;
/**
* @see cn.lili.modules.promotion.entity.enums.CouponRangeDayEnum
*/
@ApiModelProperty(value = "时间范围类型")
private String rangeDayType;
@ApiModelProperty(value = "有效期")
private Integer effectiveDays;
public Coupon(CouponVO couponVO) {
BeanUtils.copyProperties(couponVO, this);
}
/**
* @return 促销状态
* @see cn.lili.modules.promotion.entity.enums.PromotionsStatusEnum
*/
@Override
public String getPromotionStatus() {<FILL_FUNCTION_BODY>}
}
|
if (this.rangeDayType != null && this.rangeDayType.equals(CouponRangeDayEnum.DYNAMICTIME.name())
&& (this.effectiveDays != null && this.effectiveDays > 0 && this.effectiveDays <= 365)) {
return PromotionsStatusEnum.START.name();
}
return super.getPromotionStatus();
| 602
| 99
| 701
|
<methods>public non-sealed void <init>() ,public java.lang.String getPromotionStatus() <variables>private java.util.Date endTime,private java.lang.String promotionName,private java.lang.String scopeId,private java.lang.String scopeType,private static final long serialVersionUID,private java.util.Date startTime,private java.lang.String storeId,private java.lang.String storeName
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/promotion/entity/dto/search/BasePromotionsSearchParams.java
|
BasePromotionsSearchParams
|
baseQueryWrapper
|
class BasePromotionsSearchParams {
@ApiModelProperty(value = "活动id")
private String id;
@ApiModelProperty(value = "活动开始时间")
private Long startTime;
@ApiModelProperty(value = "活动结束时间")
private Long endTime;
/**
* @see PromotionsStatusEnum
*/
@ApiModelProperty(value = "活动状态 如需同时判断多个活动状态','分割")
private String promotionStatus;
/**
* @see PromotionsScopeTypeEnum
*/
@ApiModelProperty(value = "关联范围类型")
private String scopeType;
@ApiModelProperty(value = "店铺编号 如有多个','分割")
private String storeId;
public <T> QueryWrapper<T> queryWrapper() {
QueryWrapper<T> queryWrapper = this.baseQueryWrapper();
if (CharSequenceUtil.isNotEmpty(promotionStatus)) {
queryWrapper.and(i -> {
for (String status : promotionStatus.split(",")) {
i.or(PromotionTools.queryPromotionStatus(PromotionsStatusEnum.valueOf(status)));
}
});
}
return queryWrapper;
}
public <T> QueryWrapper<T> baseQueryWrapper() {<FILL_FUNCTION_BODY>}
}
|
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
if (CharSequenceUtil.isNotEmpty(id)) {
queryWrapper.eq("id", id);
}
if (startTime != null) {
queryWrapper.ge("start_time", new Date(startTime));
}
if (endTime != null) {
queryWrapper.le("end_time", new Date(endTime));
}
if (CharSequenceUtil.isNotEmpty(scopeType)) {
queryWrapper.eq("scope_type", scopeType);
}
if (CharSequenceUtil.isNotEmpty(storeId)) {
if ("store".equals(storeId)) {
queryWrapper.ne("store_id", PromotionTools.PLATFORM_ID);
} else {
queryWrapper.in("store_id", Arrays.asList(storeId.split(",")));
}
}
queryWrapper.eq("delete_flag", false);
return queryWrapper;
| 343
| 246
| 589
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/promotion/entity/dto/search/CouponSearchParams.java
|
CouponSearchParams
|
queryWrapper
|
class CouponSearchParams extends BasePromotionsSearchParams implements Serializable {
private static final long serialVersionUID = 4566880169478260409L;
private static final String PRICE_COLUMN = "price";
private static final String RANGE_DAY_TYPE_COLUMN = "range_day_type";
@ApiModelProperty(value = "会员id")
private String memberId;
@ApiModelProperty(value = "优惠券名称")
private String couponName;
/**
* POINT("打折"), PRICE("减免现金");
*
* @see cn.lili.modules.promotion.entity.enums.CouponTypeEnum
*/
@ApiModelProperty(value = "活动类型")
private String couponType;
/**
* @see PromotionsScopeTypeEnum
*/
@ApiModelProperty(value = "关联范围类型")
private String scopeType;
@ApiModelProperty(value = "范围关联的id")
private String scopeId;
@ApiModelProperty(value = "面额,可以为范围,如10_1000")
private String price;
@ApiModelProperty(value = "发行数量,可以为范围,如10_1000")
private String publishNum;
@ApiModelProperty(value = "已被领取的数量,可以为范围,如10_1000")
private String receivedNum;
/**
* @see cn.lili.modules.promotion.entity.enums.CouponGetEnum
*/
@ApiModelProperty(value = "优惠券类型,分为免费领取和活动赠送")
private String getType;
@Override
public <T> QueryWrapper<T> queryWrapper() {<FILL_FUNCTION_BODY>}
private <T> void betweenWrapper(QueryWrapper<T> queryWrapper) {
if (CharSequenceUtil.isNotEmpty(publishNum)) {
String[] s = publishNum.split("_");
if (s.length > 1) {
queryWrapper.between("publish_num", s[0], s[1]);
} else {
queryWrapper.ge("publish_num", s[0]);
}
}
if (CharSequenceUtil.isNotEmpty(price)) {
String[] s = price.split("_");
if (s.length > 1) {
queryWrapper.between(PRICE_COLUMN, s[0], s[1]);
} else {
queryWrapper.ge(PRICE_COLUMN, s[0]);
}
}
if (CharSequenceUtil.isNotEmpty(receivedNum)) {
String[] s = receivedNum.split("_");
if (s.length > 1) {
queryWrapper.between("received_num", s[0], s[1]);
} else {
queryWrapper.ge("received_num", s[0]);
}
}
}
}
|
QueryWrapper<T> queryWrapper = super.baseQueryWrapper();
if (CharSequenceUtil.isNotEmpty(couponName)) {
queryWrapper.like("coupon_name", couponName);
}
if (memberId != null) {
queryWrapper.eq("member_id", memberId);
}
if (CharSequenceUtil.isNotEmpty(couponType)) {
queryWrapper.eq("coupon_type", CouponTypeEnum.valueOf(couponType).name());
}
if (CharSequenceUtil.isNotEmpty(scopeType)) {
queryWrapper.eq("scope_type", PromotionsScopeTypeEnum.valueOf(scopeType).name());
}
if (CharSequenceUtil.isNotEmpty(scopeId)) {
queryWrapper.eq("scope_id", scopeId);
}
if (CharSequenceUtil.isNotEmpty(getType)) {
queryWrapper.eq("get_type", CouponGetEnum.valueOf(getType).name());
}
if (CharSequenceUtil.isNotEmpty(this.getPromotionStatus())) {
queryWrapper.and(p -> {
switch (PromotionsStatusEnum.valueOf(this.getPromotionStatus())) {
case NEW:
p.nested(i -> i.gt(PromotionTools.START_TIME_COLUMN, new Date()).gt(PromotionTools.END_TIME_COLUMN, new Date()));
break;
case START:
p.nested(i -> i.le(PromotionTools.START_TIME_COLUMN, new Date()).ge(PromotionTools.END_TIME_COLUMN, new Date()))
.or(i -> i.gt("effective_days", 0).eq(RANGE_DAY_TYPE_COLUMN, CouponRangeDayEnum.DYNAMICTIME.name()));
break;
case END:
p.nested(i -> i.lt(PromotionTools.START_TIME_COLUMN, new Date()).lt(PromotionTools.END_TIME_COLUMN, new Date()));
break;
case CLOSE:
p.nested(n -> n.nested(i -> i.isNull(PromotionTools.START_TIME_COLUMN).isNull(PromotionTools.END_TIME_COLUMN)
.eq(RANGE_DAY_TYPE_COLUMN, CouponRangeDayEnum.FIXEDTIME.name())).
or(i -> i.le("effective_days", 0).eq(RANGE_DAY_TYPE_COLUMN, CouponRangeDayEnum.DYNAMICTIME.name())));
break;
default:
}
});
}
if (this.getStartTime() != null) {
queryWrapper.ge("start_time", new Date(this.getStartTime()));
}
if (this.getEndTime() != null) {
queryWrapper.le("end_time", new Date(this.getEndTime()));
}
this.betweenWrapper(queryWrapper);
queryWrapper.orderByDesc("create_time");
return queryWrapper;
| 753
| 774
| 1,527
|
<methods>public non-sealed void <init>() ,public QueryWrapper<T> baseQueryWrapper() ,public QueryWrapper<T> queryWrapper() <variables>private java.lang.Long endTime,private java.lang.String id,private java.lang.String promotionStatus,private java.lang.String scopeType,private java.lang.Long startTime,private java.lang.String storeId
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/promotion/entity/dto/search/FullDiscountSearchParams.java
|
FullDiscountSearchParams
|
queryWrapper
|
class FullDiscountSearchParams extends BasePromotionsSearchParams implements Serializable {
private static final long serialVersionUID = -4052716630253333681L;
@ApiModelProperty(value = "活动名称")
private String promotionName;
@ApiModelProperty(value = "是否赠优惠券")
private Boolean couponFlag;
@ApiModelProperty(value = "优惠券id")
private String couponId;
@Override
public <T> QueryWrapper<T> queryWrapper() {<FILL_FUNCTION_BODY>}
}
|
QueryWrapper<T> queryWrapper = super.queryWrapper();
if (CharSequenceUtil.isNotEmpty(promotionName)) {
queryWrapper.like("promotion_name", promotionName);
}
if (couponFlag != null) {
queryWrapper.eq("coupon_flag", couponFlag);
}
if (CharSequenceUtil.isNotEmpty(couponId)) {
queryWrapper.eq("coupon_id", couponId);
}
return queryWrapper;
| 154
| 124
| 278
|
<methods>public non-sealed void <init>() ,public QueryWrapper<T> baseQueryWrapper() ,public QueryWrapper<T> queryWrapper() <variables>private java.lang.Long endTime,private java.lang.String id,private java.lang.String promotionStatus,private java.lang.String scopeType,private java.lang.Long startTime,private java.lang.String storeId
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/promotion/entity/dto/search/KanJiaActivityLogQuery.java
|
KanJiaActivityLogQuery
|
wrapper
|
class KanJiaActivityLogQuery {
private static final long serialVersionUID = -1583030890805926292L;
@ApiModelProperty(value = "砍价发起活动id")
private String kanJiaActivityId;
public <T> QueryWrapper<T> wrapper() {<FILL_FUNCTION_BODY>}
}
|
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
if (CharSequenceUtil.isNotEmpty(kanJiaActivityId)) {
queryWrapper.like("kanjia_activity_id", kanJiaActivityId);
}
queryWrapper.eq("delete_flag", false);
queryWrapper.orderByDesc("create_time");
return queryWrapper;
| 104
| 95
| 199
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/promotion/entity/dto/search/KanjiaActivityGoodsParams.java
|
KanjiaActivityGoodsParams
|
queryWrapper
|
class KanjiaActivityGoodsParams extends BasePromotionsSearchParams implements Serializable {
private static final long serialVersionUID = 1344104067705714289L;
@ApiModelProperty(value = "活动商品")
private String goodsName;
@ApiModelProperty(value = "skuId")
private String skuId;
@Override
public <T> QueryWrapper<T> queryWrapper() {<FILL_FUNCTION_BODY>}
}
|
QueryWrapper<T> queryWrapper = super.queryWrapper();
if (CharSequenceUtil.isNotEmpty(goodsName)) {
queryWrapper.like("goods_name", goodsName);
}
if (UserContext.getCurrentUser() != null && UserContext.getCurrentUser().getRole().equals(UserEnums.MEMBER)) {
queryWrapper.gt("stock", 0);
}
queryWrapper.eq("delete_flag", false);
return queryWrapper;
| 132
| 123
| 255
|
<methods>public non-sealed void <init>() ,public QueryWrapper<T> baseQueryWrapper() ,public QueryWrapper<T> queryWrapper() <variables>private java.lang.Long endTime,private java.lang.String id,private java.lang.String promotionStatus,private java.lang.String scopeType,private java.lang.Long startTime,private java.lang.String storeId
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/promotion/entity/dto/search/KanjiaActivityQuery.java
|
KanjiaActivityQuery
|
wrapper
|
class KanjiaActivityQuery {
private static final long serialVersionUID = -1583030890805926292L;
@ApiModelProperty(value = "货品名称")
private String goodsName;
@ApiModelProperty(value = "会员id", hidden = true)
private String memberId;
public <T> QueryWrapper<T> wrapper() {<FILL_FUNCTION_BODY>}
}
|
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
if (CharSequenceUtil.isNotEmpty(goodsName)) {
queryWrapper.like("goods_name", goodsName);
}
if (memberId != null) {
queryWrapper.eq("member_id", memberId);
}
queryWrapper.eq("delete_flag", false);
queryWrapper.orderByDesc("create_time");
return queryWrapper;
| 120
| 114
| 234
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/promotion/entity/dto/search/KanjiaActivitySearchParams.java
|
KanjiaActivitySearchParams
|
wrapper
|
class KanjiaActivitySearchParams extends BasePromotionsSearchParams {
@ApiModelProperty(value = "砍价活动ID")
private String id;
@ApiModelProperty(value = "砍价商品SkuID")
private String kanjiaActivityGoodsId;
@ApiModelProperty(value = "会员ID" ,hidden = true)
private String memberId;
@ApiModelProperty(value = "状态")
private String status;
@ApiModelProperty(value = "邀请活动ID,有值说明是被邀请人")
private String kanjiaActivityId;
@ApiModelProperty(value = "规格商品ID" ,hidden = true)
private String goodsSkuId;
public <T> QueryWrapper<T> wrapper() {<FILL_FUNCTION_BODY>}
}
|
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(StrUtil.isNotEmpty(kanjiaActivityId), "id", kanjiaActivityId);
queryWrapper.eq(StrUtil.isNotEmpty(kanjiaActivityGoodsId), "kanjia_activity_goods_id", kanjiaActivityGoodsId);
queryWrapper.eq(StrUtil.isNotEmpty(goodsSkuId), "sku_id", goodsSkuId);
queryWrapper.eq(StrUtil.isNotEmpty(memberId), "member_id", memberId);
queryWrapper.eq(StrUtil.isNotEmpty(status), "status", status);
return queryWrapper;
| 211
| 175
| 386
|
<methods>public non-sealed void <init>() ,public QueryWrapper<T> baseQueryWrapper() ,public QueryWrapper<T> queryWrapper() <variables>private java.lang.Long endTime,private java.lang.String id,private java.lang.String promotionStatus,private java.lang.String scopeType,private java.lang.Long startTime,private java.lang.String storeId
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/promotion/entity/dto/search/MemberCouponSearchParams.java
|
MemberCouponSearchParams
|
queryWrapper
|
class MemberCouponSearchParams extends BasePromotionsSearchParams implements Serializable {
private static final long serialVersionUID = 4566880169478260409L;
private static final String PRICE_COLUMN = "price";
@ApiModelProperty(value = "优惠券id")
private String couponId;
@ApiModelProperty(value = "优惠券名称")
private String couponName;
@ApiModelProperty(value = "会员id")
private String memberId;
@ApiModelProperty(value = "会员名称")
private String memberName;
/**
* POINT("打折"), PRICE("减免现金");
*
* @see CouponTypeEnum
*/
@ApiModelProperty(value = "活动类型")
private String couponType;
/**
* @see PromotionsScopeTypeEnum
*/
@ApiModelProperty(value = "关联范围类型")
private String scopeType;
@ApiModelProperty(value = "范围关联的id")
private String scopeId;
@ApiModelProperty(value = "面额,可以为范围,如10_1000")
private String price;
/**
* @see CouponGetEnum
*/
@ApiModelProperty(value = "优惠券类型,分为免费领取和活动赠送")
private String getType;
/**
* @see MemberCouponStatusEnum
*/
@ApiModelProperty(value = "会员优惠券状态")
private String memberCouponStatus;
@ApiModelProperty(value = "消费门槛")
private Double consumeThreshold;
@Override
public <T> QueryWrapper<T> queryWrapper() {<FILL_FUNCTION_BODY>}
}
|
QueryWrapper<T> queryWrapper = super.queryWrapper();
queryWrapper.eq(CharSequenceUtil.isNotEmpty(couponId), "coupon_id", couponId);
queryWrapper.like(CharSequenceUtil.isNotEmpty(couponName), "coupon_name", couponName);
queryWrapper.like(CharSequenceUtil.isNotEmpty(memberName), "member_name", memberName);
if (CharSequenceUtil.isNotEmpty(couponType)) {
queryWrapper.eq("coupon_type", CouponTypeEnum.valueOf(couponType).name());
}
if (memberId != null) {
queryWrapper.eq("member_id", memberId);
}
if (CharSequenceUtil.isNotEmpty(scopeId)) {
queryWrapper.eq("scope_id", scopeId);
}
if (CharSequenceUtil.isNotEmpty(scopeType)) {
queryWrapper.eq("scope_type", PromotionsScopeTypeEnum.valueOf(scopeType).name());
}
if (CharSequenceUtil.isNotEmpty(getType)) {
queryWrapper.eq("get_type", CouponGetEnum.valueOf(getType).name());
}
if (CharSequenceUtil.isNotEmpty(memberCouponStatus)) {
queryWrapper.eq("member_coupon_status", MemberCouponStatusEnum.valueOf(memberCouponStatus).name());
}
if (CharSequenceUtil.isNotEmpty(price)) {
String[] s = price.split("_");
if (s.length > 1) {
queryWrapper.between(PRICE_COLUMN, s[0], s[1]);
} else {
queryWrapper.ge(PRICE_COLUMN, s[0]);
}
}
if (this.getStartTime() != null) {
queryWrapper.ge("start_time", new Date(this.getEndTime()));
}
if (this.getEndTime() != null) {
queryWrapper.le("end_time", new Date(this.getEndTime()));
}
queryWrapper.eq("delete_flag", false);
queryWrapper.orderByDesc("create_time");
return queryWrapper;
| 452
| 546
| 998
|
<methods>public non-sealed void <init>() ,public QueryWrapper<T> baseQueryWrapper() ,public QueryWrapper<T> queryWrapper() <variables>private java.lang.Long endTime,private java.lang.String id,private java.lang.String promotionStatus,private java.lang.String scopeType,private java.lang.Long startTime,private java.lang.String storeId
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/promotion/entity/dto/search/PintuanSearchParams.java
|
PintuanSearchParams
|
queryWrapper
|
class PintuanSearchParams extends BasePromotionsSearchParams {
@ApiModelProperty(value = "商家名称,如果是平台,这个值为 platform")
private String storeName;
@NotEmpty(message = "活动名称不能为空")
@ApiModelProperty(value = "活动名称", required = true)
private String promotionName;
@Override
public <T> QueryWrapper<T> queryWrapper() {<FILL_FUNCTION_BODY>}
}
|
QueryWrapper<T> queryWrapper = super.queryWrapper();
if (CharSequenceUtil.isNotEmpty(promotionName)) {
queryWrapper.like("promotion_name", promotionName);
}
if (CharSequenceUtil.isNotEmpty(storeName)) {
queryWrapper.like("store_name", storeName);
}
return queryWrapper;
| 124
| 92
| 216
|
<methods>public non-sealed void <init>() ,public QueryWrapper<T> baseQueryWrapper() ,public QueryWrapper<T> queryWrapper() <variables>private java.lang.Long endTime,private java.lang.String id,private java.lang.String promotionStatus,private java.lang.String scopeType,private java.lang.Long startTime,private java.lang.String storeId
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/promotion/entity/dto/search/PointsGoodsSearchParams.java
|
PointsGoodsSearchParams
|
queryWrapper
|
class PointsGoodsSearchParams extends BasePromotionsSearchParams {
@ApiModelProperty(value = "商品名称")
private String goodsName;
@ApiModelProperty(value = "商品skuId")
private String skuId;
@ApiModelProperty(value = "积分商品分类编号")
private String pointsGoodsCategoryId;
@ApiModelProperty(value = "积分,可以为范围,如10_1000")
private String points;
@Override
public <T> QueryWrapper<T> queryWrapper() {<FILL_FUNCTION_BODY>}
}
|
QueryWrapper<T> queryWrapper = super.queryWrapper();
if (CharSequenceUtil.isNotEmpty(goodsName)) {
queryWrapper.like("goods_name", goodsName);
}
if (CharSequenceUtil.isNotEmpty(skuId)) {
queryWrapper.eq("sku_id", skuId);
}
if (CharSequenceUtil.isNotEmpty(pointsGoodsCategoryId)) {
queryWrapper.eq("points_goods_category_id", pointsGoodsCategoryId);
}
if (CharSequenceUtil.isNotEmpty(points)) {
String[] s = points.split("_");
if (s.length > 1) {
queryWrapper.between("points", s[0], s[1]);
} else {
queryWrapper.eq("points", s[0]);
}
}
return queryWrapper;
| 159
| 218
| 377
|
<methods>public non-sealed void <init>() ,public QueryWrapper<T> baseQueryWrapper() ,public QueryWrapper<T> queryWrapper() <variables>private java.lang.Long endTime,private java.lang.String id,private java.lang.String promotionStatus,private java.lang.String scopeType,private java.lang.Long startTime,private java.lang.String storeId
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/promotion/entity/dto/search/PromotionGoodsSearchParams.java
|
PromotionGoodsSearchParams
|
queryWrapper
|
class PromotionGoodsSearchParams extends BasePromotionsSearchParams {
@ApiModelProperty(value = "促销活动id")
private String promotionId;
@ApiModelProperty(value = "促销类型")
private String promotionType;
@ApiModelProperty(value = "商品名称")
private String goodsName;
@ApiModelProperty(value = "商品分类路径")
private String categoryPath;
@ApiModelProperty(value = "商品SkuId")
private String skuId;
@ApiModelProperty(value = "商品SkuIds")
private List<String> skuIds;
@ApiModelProperty(value = "促销活动id")
private List<String> promotionIds;
@Override
public <T> QueryWrapper<T> queryWrapper() {<FILL_FUNCTION_BODY>}
}
|
if (CharSequenceUtil.isEmpty(this.getScopeType())){
this.setScopeType(PromotionsScopeTypeEnum.PORTION_GOODS.name());
}
QueryWrapper<T> queryWrapper = super.queryWrapper();
if (CharSequenceUtil.isNotEmpty(promotionId)) {
queryWrapper.eq("promotion_id", promotionId);
}
if (CharSequenceUtil.isNotEmpty(goodsName)) {
queryWrapper.like("goods_name", goodsName);
}
if (CharSequenceUtil.isNotEmpty(promotionType)) {
queryWrapper.eq("promotion_type", promotionType);
}
if (CharSequenceUtil.isNotEmpty(categoryPath)) {
queryWrapper.like("category_path", categoryPath);
}
if (CharSequenceUtil.isNotEmpty(skuId)) {
queryWrapper.in("sku_id", Arrays.asList(skuId.split(",")));
}
if (skuIds != null && !skuIds.isEmpty()) {
queryWrapper.in("sku_id", skuIds);
}
if (promotionIds != null && promotionIds.isEmpty()) {
queryWrapper.in("promotion_id", promotionIds);
}
return queryWrapper;
| 219
| 325
| 544
|
<methods>public non-sealed void <init>() ,public QueryWrapper<T> baseQueryWrapper() ,public QueryWrapper<T> queryWrapper() <variables>private java.lang.Long endTime,private java.lang.String id,private java.lang.String promotionStatus,private java.lang.String scopeType,private java.lang.Long startTime,private java.lang.String storeId
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/promotion/entity/vos/kanjia/KanjiaActivityGoodsVO.java
|
KanjiaActivityGoodsVO
|
getPurchasePrice
|
class KanjiaActivityGoodsVO {
@ApiModelProperty(value = "商品规格详细信息")
private GoodsSku goodsSku;
@ApiModelProperty(value = "最低购买金额")
private Double purchasePrice;
public Double getPurchasePrice() {<FILL_FUNCTION_BODY>}
@ApiModelProperty(value = "活动库存")
private Integer stock;
}
|
if (purchasePrice < 0) {
return 0D;
}
return purchasePrice;
| 108
| 30
| 138
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponActivityItemServiceImpl.java
|
CouponActivityItemServiceImpl
|
getCouponActivityList
|
class CouponActivityItemServiceImpl extends ServiceImpl<CouponActivityItemMapper, CouponActivityItem> implements CouponActivityItemService {
@Override
public List<CouponActivityItem> getCouponActivityList(String activityId) {<FILL_FUNCTION_BODY>}
@Override
public List<CouponActivityItemVO> getCouponActivityItemListVO(String activityId) {
return this.baseMapper.getCouponActivityItemListVO(activityId);
}
/**
* 根据优惠券id删除优惠活动关联信息项
*
* @param couponIds 优惠券id集合
*/
@Override
public void removeByCouponId(List<String> couponIds) {
this.remove(new LambdaQueryWrapper<CouponActivityItem>()
.in(CouponActivityItem::getCouponId, couponIds));
}
}
|
LambdaQueryWrapper<CouponActivityItem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(CouponActivityItem::getActivityId, activityId);
return this.list(lambdaQueryWrapper);
| 231
| 61
| 292
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/KanjiaActivityLogServiceImpl.java
|
KanjiaActivityLogServiceImpl
|
addKanJiaActivityLog
|
class KanjiaActivityLogServiceImpl extends ServiceImpl<KanJiaActivityLogMapper, KanjiaActivityLog> implements KanjiaActivityLogService {
@Autowired
private KanjiaActivityGoodsService kanJiaActivityGoodsService;
@Autowired
private KanjiaActivityService kanJiaActivityService;
@Override
public IPage<KanjiaActivityLog> getForPage(KanJiaActivityLogQuery kanJiaActivityLogQuery, PageVO pageVO) {
QueryWrapper<KanjiaActivityLog> queryWrapper = kanJiaActivityLogQuery.wrapper();
return this.page(PageUtil.initPage(pageVO), queryWrapper);
}
@Override
public KanjiaActivityLog addKanJiaActivityLog(KanjiaActivityDTO kanjiaActivityDTO) {<FILL_FUNCTION_BODY>}
}
|
//校验当前会员是否已经参与过此次砍价
LambdaQueryWrapper<KanjiaActivityLog> queryWrapper = new LambdaQueryWrapper<KanjiaActivityLog>();
queryWrapper.eq(kanjiaActivityDTO.getKanjiaActivityId() != null, KanjiaActivityLog::getKanjiaActivityId, kanjiaActivityDTO.getKanjiaActivityId());
queryWrapper.eq( KanjiaActivityLog::getKanjiaMemberId, UserContext.getCurrentUser().getId());
long count = this.baseMapper.selectCount(queryWrapper);
if (count > 0) {
throw new ServiceException(ResultCode.KANJIA_ACTIVITY_LOG_MEMBER_ERROR);
}
//校验当前砍价商品是否有效
KanjiaActivityGoods kanjiaActivityGoods = kanJiaActivityGoodsService.getById(kanjiaActivityDTO.getKanjiaActivityGoodsId());
//如果当前活动不为空且还在活动时间内 才可以参与砍价活动
if (kanjiaActivityGoods != null && kanjiaActivityGoods.getPromotionStatus().equals(PromotionsStatusEnum.START.name())) {
//获取砍价参与者记录
KanjiaActivity kanjiaActivity = kanJiaActivityService.getById(kanjiaActivityDTO.getKanjiaActivityId());
if (kanjiaActivity != null) {
KanjiaActivityLog kanJiaActivityLog = new KanjiaActivityLog();
kanJiaActivityLog.setKanjiaActivityId(kanjiaActivity.getId());
BeanUtil.copyProperties(kanjiaActivityDTO, kanJiaActivityLog);
boolean result = this.save(kanJiaActivityLog);
if (result) {
return kanJiaActivityLog;
}
}
throw new ServiceException(ResultCode.KANJIA_ACTIVITY_NOT_FOUND_ERROR);
}
throw new ServiceException(ResultCode.PROMOTION_STATUS_END);
| 231
| 529
| 760
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PromotionServiceImpl.java
|
PromotionServiceImpl
|
getCurrentPromotion
|
class PromotionServiceImpl implements PromotionService {
/**
* 秒杀
*/
@Autowired
private SeckillService seckillService;
/**
* 秒杀申请
*/
@Autowired
private SeckillApplyService seckillApplyService;
/**
* 满额活动
*/
@Autowired
private FullDiscountService fullDiscountService;
/**
* 拼团
*/
@Autowired
private PintuanService pintuanService;
/**
* 优惠券
*/
@Autowired
private CouponService couponService;
/**
* 促销商品
*/
@Autowired
private PromotionGoodsService promotionGoodsService;
/**
* 积分商品
*/
@Autowired
private PointsGoodsService pointsGoodsService;
@Autowired
private KanjiaActivityGoodsService kanjiaActivityGoodsService;
/**
* 获取当前进行的所有促销活动信息
*
* @return 当前促销活动集合
*/
@Override
public Map<String, List<PromotionGoods>> getCurrentPromotion() {<FILL_FUNCTION_BODY>}
/**
* 根据商品索引获取当前商品索引的所有促销活动信息
*
* @param storeId 店铺id
* @param goodsSkuId 商品skuId
* @return 当前促销活动集合
*/
public Map<String, Object> getGoodsSkuPromotionMap(String storeId, String goodsSkuId) {
String storeIds = storeId + "," + PromotionTools.PLATFORM_ID;
List<PromotionGoods> promotionGoodsList = promotionGoodsService.findSkuValidPromotion(goodsSkuId, storeIds);
return wrapperPromotionMapList(promotionGoodsList);
}
@Override
public void removeByGoodsIds(String goodsIdsJsonStr) {
List<String> goodsIds = JSONUtil.toList(goodsIdsJsonStr, String.class);
promotionGoodsService.deletePromotionGoodsByGoods(goodsIds);
kanjiaActivityGoodsService.deleteByGoodsIds(goodsIds);
}
public Map<String, Object> wrapperPromotionMapList(List<PromotionGoods> promotionGoodsList) {
Map<String, Object> promotionMap = new HashMap<>();
for (PromotionGoods promotionGoods : promotionGoodsList) {
String esPromotionKey = promotionGoods.getPromotionType() + "-" + promotionGoods.getPromotionId();
switch (PromotionTypeEnum.valueOf(promotionGoods.getPromotionType())) {
case COUPON:
Coupon coupon = couponService.getById(promotionGoods.getPromotionId());
promotionMap.put(esPromotionKey, coupon);
break;
case PINTUAN:
Pintuan pintuan = pintuanService.getById(promotionGoods.getPromotionId());
promotionMap.put(esPromotionKey, pintuan);
break;
case FULL_DISCOUNT:
FullDiscount fullDiscount = fullDiscountService.getById(promotionGoods.getPromotionId());
promotionMap.put(esPromotionKey, fullDiscount);
break;
case SECKILL:
this.getGoodsCurrentSeckill(esPromotionKey, promotionGoods, promotionMap);
break;
case POINTS_GOODS:
PointsGoods pointsGoods = pointsGoodsService.getById(promotionGoods.getPromotionId());
promotionMap.put(esPromotionKey, pointsGoods);
break;
default:
break;
}
}
return promotionMap;
}
private void getGoodsCurrentSeckill(String esPromotionKey, PromotionGoods promotionGoods, Map<String, Object> promotionMap) {
Seckill seckill = seckillService.getById(promotionGoods.getPromotionId());
SeckillSearchParams searchParams = new SeckillSearchParams();
searchParams.setSeckillId(promotionGoods.getPromotionId());
searchParams.setSkuId(promotionGoods.getSkuId());
List<SeckillApply> seckillApplyList = seckillApplyService.getSeckillApplyList(searchParams);
if (seckillApplyList != null && !seckillApplyList.isEmpty()) {
String[] split = seckill.getHours().split(",");
int[] hoursSored = Arrays.stream(split).mapToInt(Integer::parseInt).toArray();
Arrays.sort(hoursSored);
seckill.setStartTime(promotionGoods.getStartTime());
seckill.setEndTime(promotionGoods.getEndTime());
promotionMap.put(esPromotionKey, seckill);
}
}
}
|
PromotionGoodsSearchParams searchParams = new PromotionGoodsSearchParams();
searchParams.setPromotionStatus(PromotionsStatusEnum.START.name());
List<PromotionGoods> promotionGoods = promotionGoodsService.listFindAll(searchParams);
return promotionGoods.stream().collect(Collectors.groupingBy(PromotionGoods::getPromotionType));
| 1,269
| 95
| 1,364
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/purchase/serviceimpl/PurchaseOrderItemServiceImpl.java
|
PurchaseOrderItemServiceImpl
|
addPurchaseOrderItem
|
class PurchaseOrderItemServiceImpl extends ServiceImpl<PurchaseOrderItemMapper, PurchaseOrderItem> implements PurchaseOrderItemService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean addPurchaseOrderItem(String purchaseOrderId, List<PurchaseOrderItem> purchaseOrderItemList) {<FILL_FUNCTION_BODY>}
}
|
//添加采购单子内容
for (PurchaseOrderItem purchaseOrderItem : purchaseOrderItemList) {
purchaseOrderItem.setPurchaseOrderId(purchaseOrderId);
this.save(purchaseOrderItem);
}
return true;
| 91
| 65
| 156
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/purchase/serviceimpl/PurchaseOrderServiceImpl.java
|
PurchaseOrderServiceImpl
|
page
|
class PurchaseOrderServiceImpl extends ServiceImpl<PurchaseOrderMapper, PurchaseOrder> implements PurchaseOrderService {
@Autowired
private PurchaseOrderItemService purchaseOrderItemService;
@Override
@Transactional(rollbackFor = Exception.class)
public PurchaseOrderVO addPurchaseOrder(PurchaseOrderVO purchaseOrderVO) {
PurchaseOrder purchaseOrder = new PurchaseOrder();
BeanUtil.copyProperties(purchaseOrderVO, purchaseOrder);
//添加采购单
purchaseOrder.setStatus("OPEN");
purchaseOrder.setMemberId(UserContext.getCurrentUser().getId());
this.save(purchaseOrder);
//添加采购单子内容
purchaseOrderItemService.addPurchaseOrderItem(purchaseOrder.getId(), purchaseOrderVO.getPurchaseOrderItems());
return purchaseOrderVO;
}
@Override
public PurchaseOrderVO getPurchaseOrder(String id) {
PurchaseOrderVO purchaseOrderVO = new PurchaseOrderVO();
//获取采购单内容
PurchaseOrder purchaseOrder = this.getById(id);
BeanUtil.copyProperties(purchaseOrder, purchaseOrderVO);
//获取采购单子内容
purchaseOrderVO.setPurchaseOrderItems(purchaseOrderItemService.list(
new LambdaQueryWrapper<PurchaseOrderItem>().eq(PurchaseOrderItem::getPurchaseOrderId,id)));
return purchaseOrderVO;
}
@Override
public IPage<PurchaseOrder> page(PurchaseOrderSearchParams purchaseOrderSearchParams) {<FILL_FUNCTION_BODY>}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean close(String id) {
PurchaseOrder purchaseOrder = this.getById(id);
purchaseOrder.setStatus("CLOSE");
UpdateWrapper<PurchaseOrder> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", id);
updateWrapper.set("status", "CLOSE");
return this.update(updateWrapper);
}
}
|
LambdaQueryWrapper<PurchaseOrder> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(purchaseOrderSearchParams.getMemberId() != null,
PurchaseOrder::getMemberId, purchaseOrderSearchParams.getMemberId());
lambdaQueryWrapper.eq(purchaseOrderSearchParams.getCategoryId() != null,
PurchaseOrder::getCategoryId, purchaseOrderSearchParams.getCategoryId());
lambdaQueryWrapper.eq(purchaseOrderSearchParams.getStatus() != null,
PurchaseOrder::getStatus, purchaseOrderSearchParams.getStatus());
lambdaQueryWrapper.orderByDesc(PurchaseOrder::getCreateTime);
return this.page(PageUtil.initPage(purchaseOrderSearchParams), lambdaQueryWrapper);
| 506
| 194
| 700
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/purchase/serviceimpl/PurchaseQuotedItemServiceImpl.java
|
PurchaseQuotedItemServiceImpl
|
addPurchaseQuotedItem
|
class PurchaseQuotedItemServiceImpl extends ServiceImpl<PurchaseQuotedItemMapper, PurchaseQuotedItem> implements PurchaseQuotedItemService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean addPurchaseQuotedItem(String purchaseQuotedId, List<PurchaseQuotedItem> purchaseQuotedItemList) {<FILL_FUNCTION_BODY>}
@Override
public List<PurchaseQuotedItem> purchaseQuotedItemList(String purchaseQuotedId) {
return this.list(new LambdaQueryWrapper<PurchaseQuotedItem>().eq(PurchaseQuotedItem::getPurchaseQuotedId,purchaseQuotedId));
}
}
|
for (PurchaseQuotedItem purchaseQuotedItem : purchaseQuotedItemList) {
purchaseQuotedItem.setPurchaseQuotedId(purchaseQuotedId);
}
return this.saveBatch(purchaseQuotedItemList);
| 172
| 63
| 235
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/purchase/serviceimpl/PurchaseQuotedServiceImpl.java
|
PurchaseQuotedServiceImpl
|
addPurchaseQuoted
|
class PurchaseQuotedServiceImpl extends ServiceImpl<PurchaseQuotedMapper, PurchaseQuoted> implements PurchaseQuotedService {
@Autowired
private PurchaseQuotedItemService purchaseQuotedItemService;
@Override
@Transactional(rollbackFor = Exception.class)
public PurchaseQuotedVO addPurchaseQuoted(PurchaseQuotedVO purchaseQuotedVO) {<FILL_FUNCTION_BODY>}
@Override
public List<PurchaseQuoted> getByPurchaseOrderId(String purchaseOrderId) {
LambdaQueryWrapper<PurchaseQuoted> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(PurchaseQuoted::getPurchaseOrderId, purchaseOrderId);
lambdaQueryWrapper.orderByDesc(PurchaseQuoted::getCreateTime);
return this.list(lambdaQueryWrapper);
}
@Override
public PurchaseQuotedVO getById(String id) {
//获取报价单
PurchaseQuotedVO purchaseQuotedVO = new PurchaseQuotedVO();
PurchaseQuoted purchaseQuoted=this.baseMapper.selectById(id);
BeanUtil.copyProperties(purchaseQuoted, purchaseQuotedVO);
//获取报价单子内容
purchaseQuotedVO.setPurchaseQuotedItems(purchaseQuotedItemService.purchaseQuotedItemList(id));
return purchaseQuotedVO;
}
}
|
PurchaseQuoted purchaseQuoted = new PurchaseQuoted();
BeanUtil.copyProperties(purchaseQuotedVO, purchaseQuoted);
//添加报价单
this.save(purchaseQuoted);
//添加采购单子内容
purchaseQuotedItemService.addPurchaseQuotedItem(purchaseQuoted.getId(), purchaseQuotedVO.getPurchaseQuotedItems());
return purchaseQuotedVO;
| 353
| 108
| 461
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/search/entity/dto/HotWordsSearchParams.java
|
HotWordsSearchParams
|
queryWrapper
|
class HotWordsSearchParams extends PageVO {
private static final long serialVersionUID = 2544015852728566887L;
@NotNull(message = "搜索热词不能为空")
@ApiModelProperty(value = "热词")
private String keywords;
@ApiModelProperty(value = "快捷搜索", allowableValues = "TODAY, YESTERDAY, LAST_SEVEN, LAST_THIRTY")
private String searchType;
@ApiModelProperty(value = "类型:年(YEAR)、月(MONTH)")
private String timeType;
@ApiModelProperty(value = "年份")
private Integer year;
@ApiModelProperty(value = "月份")
private Integer month;
//临时参数 不作为前端传递
private Date startTIme;
private Date endTime;
//搜索热词数量
private Integer top = 50;
public <T> QueryWrapper<T> queryWrapper() {<FILL_FUNCTION_BODY>}
}
|
//组织查询时间
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
StatisticsQueryParam statisticsQueryParam = new StatisticsQueryParam();
BeanUtils.copyProperties(this, statisticsQueryParam);
Date[] dates = StatisticsDateUtil.getDateArray(statisticsQueryParam);
//获取当前时间
Calendar calendar = Calendar.getInstance();
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
calendar.set(Calendar.MILLISECOND, 0);
if (StringUtils.isNotEmpty(keywords)) {
queryWrapper.like("keywords", keywords);
}
queryWrapper.between("create_time", dates[0], dates[1]);
startTIme = dates[0];
endTime = dates[1];
return queryWrapper;
| 284
| 236
| 520
|
<methods>public non-sealed void <init>() ,public java.lang.String getSort() <variables>private java.lang.Boolean notConvert,private java.lang.String order,private java.lang.Integer pageNumber,private java.lang.Integer pageSize,private static final long serialVersionUID,private java.lang.String sort
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/search/serviceimpl/CustomWordsServiceImpl.java
|
CustomWordsServiceImpl
|
addCustomWords
|
class CustomWordsServiceImpl extends ServiceImpl<CustomWordsMapper, CustomWords> implements CustomWordsService {
@Override
public String deploy() {
LambdaQueryWrapper<CustomWords> queryWrapper = new LambdaQueryWrapper<CustomWords>().eq(CustomWords::getDisabled, 1);
List<CustomWords> list = list(queryWrapper);
HttpServletResponse response = ThreadContextHolder.getHttpResponse();
StringBuilder builder = new StringBuilder();
if (list != null && !list.isEmpty()) {
boolean flag = true;
for (CustomWords customWords : list) {
if (flag) {
try {
response.setHeader("Last-Modified", customWords.getCreateTime().toString());
response.setHeader("ETag", Integer.toString(list.size()));
} catch (Exception e) {
log.error("自定义分词错误",e);
}
builder.append(customWords.getName());
flag = false;
} else {
builder.append("\n");
builder.append(customWords.getName());
}
}
}
return new String(builder.toString().getBytes(StandardCharsets.UTF_8));
}
/**
* 添加自定义分词
*
* @param customWordsVO 自定义分词信息
* @return 是否添加成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public boolean addCustomWords(CustomWordsVO customWordsVO) {<FILL_FUNCTION_BODY>}
/**
* 删除自定义分词
*
* @param id 自定义分词id
* @return 是否删除成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public boolean deleteCustomWords(String id) {
if (this.getById(id) == null) {
throw new ServiceException(ResultCode.CUSTOM_WORDS_NOT_EXIST_ERROR);
}
return this.removeById(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean deleteBathByName(List<String> names) {
LambdaQueryWrapper<CustomWords> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(CustomWords::getName, names);
return this.remove(queryWrapper);
}
@Override
@Transactional(rollbackFor = Exception.class)
public long insertBatchCustomWords(List<CustomWords> customWordsList) {
return this.baseMapper.insertIgnoreBatchAllColumn(customWordsList);
}
/**
* 修改自定义分词
*
* @param customWordsVO 自定义分词信息
* @return 是否修改成功
*/
@Override
public boolean updateCustomWords(CustomWordsVO customWordsVO) {
if (this.getById(customWordsVO.getId()) == null) {
throw new ServiceException(ResultCode.CUSTOM_WORDS_NOT_EXIST_ERROR);
}
return this.updateById(customWordsVO);
}
/**
* 分页查询自定义分词
*
* @param words 分词
* @param pageVo 分页信息
* @return 自定义分词分页信息
*/
@Override
public IPage<CustomWords> getCustomWordsByPage(String words, PageVO pageVo) {
LambdaQueryWrapper<CustomWords> queryWrapper = new LambdaQueryWrapper<CustomWords>().like(CustomWords::getName, words);
return this.page(PageUtil.initPage(pageVo), queryWrapper);
}
@Override
public boolean existWords(String words) {
LambdaQueryWrapper<CustomWords> queryWrapper = new LambdaQueryWrapper<CustomWords>().eq(CustomWords::getName, words);
long count = count(queryWrapper);
return count > 0;
}
}
|
LambdaQueryWrapper<CustomWords> queryWrapper = new LambdaQueryWrapper<CustomWords>().eq(CustomWords::getName, customWordsVO.getName());
CustomWords one = this.getOne(queryWrapper, false);
if (one != null && one.getDisabled().equals(1)) {
return false;
} else if (one != null && !one.getDisabled().equals(1)) {
this.remove(queryWrapper);
}
customWordsVO.setDisabled(1);
return this.save(customWordsVO);
| 1,035
| 145
| 1,180
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/search/serviceimpl/HotWordsHistoryServiceImpl.java
|
HotWordsHistoryServiceImpl
|
queryByDay
|
class HotWordsHistoryServiceImpl extends ServiceImpl<HotWordsHistoryMapper, HotWordsHistory> implements HotWordsHistoryService {
@Autowired
private HotWordsService hotWordsService;
@Override
public List<HotWordsHistory> statistics(HotWordsSearchParams hotWordsSearchParams) {
if (hotWordsSearchParams.getSearchType().equals(SearchTypeEnum.TODAY.name())) {
return hotWordsService.getHotWordsVO(hotWordsSearchParams.getTop());
}
QueryWrapper queryWrapper = hotWordsSearchParams.queryWrapper();
queryWrapper.groupBy("keywords");
queryWrapper.orderByDesc("score");
queryWrapper.last("limit " + hotWordsSearchParams.getTop());
List<HotWordsHistory> list = baseMapper.statistics(queryWrapper);
return list;
}
@Override
public List<HotWordsHistory> queryByDay(Date queryTime) {<FILL_FUNCTION_BODY>}
}
|
QueryWrapper queryWrapper = new QueryWrapper();
Date[] dates = StatisticsDateUtil.getDateArray(queryTime);
queryWrapper.between("create_time", dates[0], dates[1]);
return list(queryWrapper);
| 256
| 60
| 316
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/search/serviceimpl/HotWordsServiceImpl.java
|
HotWordsServiceImpl
|
getHotWordsVO
|
class HotWordsServiceImpl implements HotWordsService {
/**
* 缓存
*/
@Autowired
private Cache<Object> cache;
@Override
public List<String> getHotWords(Integer count) {
if (count == null) {
count = 0;
}
List<String> hotWords = new ArrayList<>();
// redis 排序中,下标从0开始,所以这里需要 -1 处理
count = count - 1;
Set<ZSetOperations.TypedTuple<Object>> set = cache.reverseRangeWithScores(CachePrefix.HOT_WORD.getPrefix(), count);
if (set == null || set.isEmpty()) {
return new ArrayList<>();
}
for (ZSetOperations.TypedTuple<Object> defaultTypedTuple : set) {
hotWords.add(Objects.requireNonNull(defaultTypedTuple.getValue()).toString());
}
return hotWords;
}
@Override
public List<HotWordsHistory> getHotWordsVO(Integer count) {<FILL_FUNCTION_BODY>}
@Override
public void setHotWords(HotWordsDTO hotWords) {
cache.incrementScore(CachePrefix.HOT_WORD.getPrefix(), hotWords.getKeywords(), hotWords.getPoint());
}
/**
* 删除热门关键词
*
* @param keywords 热词
*/
@Override
public void deleteHotWords(String keywords) {
cache.zRemove(CachePrefix.HOT_WORD.getPrefix(), keywords);
}
}
|
if (count == null) {
count = 50;
}
List<HotWordsHistory> hotWords = new ArrayList<>();
// redis 排序中,下标从0开始,所以这里需要 -1 处理
count = count - 1;
Set<ZSetOperations.TypedTuple<Object>> set = cache.reverseRangeWithScores(CachePrefix.HOT_WORD.getPrefix(), count);
if (set == null || set.isEmpty()) {
return new ArrayList<>();
}
for (ZSetOperations.TypedTuple<Object> defaultTypedTuple : set) {
try {
hotWords.add(new HotWordsHistory(defaultTypedTuple.getValue().toString(),
defaultTypedTuple.getScore().intValue()));
} catch (Exception e) {
log.error("读取热词错误", e);
}
}
Collections.sort(hotWords);
return hotWords;
| 422
| 252
| 674
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/search/utils/EsIndexUtil.java
|
EsIndexUtil
|
getUpdateIndexFieldsMap
|
class EsIndexUtil {
private static final String IGNORE_FIELD = "serialVersionUID,promotionMap,id,goodsId";
public static Map<String, Object> getUpdateIndexFieldsMap(EsGoodsIndex queryGoodsIndex, EsGoodsIndex updateGoodsIndex) {<FILL_FUNCTION_BODY>}
public static Map<String, Object> getUpdateIndexFieldsMap(Map<String, Object> queryFieldsMap, Map<String, Object> updateFieldsMap) {
Map<String, Object> updateIndexMap = new HashMap<>();
updateIndexMap.put("queryFields", queryFieldsMap);
updateIndexMap.put("updateFields", updateFieldsMap);
return updateIndexMap;
}
}
|
Map<String, Object> queryFieldsMap = new HashMap<>();
Map<String, Object> updateFieldsMap = new HashMap<>();
for (Map.Entry<String, Field> entry : ReflectUtil.getFieldMap(EsGoodsIndex.class).entrySet()) {
Object queryFieldValue = ReflectUtil.getFieldValue(queryGoodsIndex, entry.getValue());
Object updateFieldValue = ReflectUtil.getFieldValue(updateGoodsIndex, entry.getValue());
if (queryFieldValue != null && !IGNORE_FIELD.contains(entry.getKey())) {
ReflectUtil.setFieldValue(queryFieldsMap, entry.getValue(), queryFieldValue);
}
if (updateFieldValue != null && !IGNORE_FIELD.contains(entry.getKey())) {
ReflectUtil.setFieldValue(updateFieldsMap, entry.getValue(), updateFieldValue);
}
}
return getUpdateIndexFieldsMap(queryFieldsMap, updateFieldsMap);
| 183
| 242
| 425
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/search/utils/SqlFilter.java
|
SqlFilter
|
hit
|
class SqlFilter {
// SQL注入过滤
static final String SQL_KEYWORDS_PATTERN =
"(?i)(SELECT|FROM|WHERE|CONCAT|AND|NOT|INSERT|UPDATE|DELETE" +
"|TABLE|INDEX|VIEW|DROP|ALTER|COLUMN|ADD|SET|GROUP|BY" +
"|HAVING|ORDER|ASC|DESC|LIKE|IN|BETWEEN|IS|NULL|TRUE|FALSE" +
"|JOIN|LEFT|RIGHT|INNER|OUTER|FULL|ON|AS|DISTINCT|COUNT" +
"|MAX|MIN|SUM|AVG|IF|RAND|UPDATEXML|EXTRACTVALUE|LOAD_FILE|SLEEP|OFFSET)";
// OR 影响排序字段 sort,所以暂时不过滤
// CREATE 影响常用排序字段, CREATE_TIME,所以暂时不过滤
static final Pattern keywordPattern = Pattern.compile(SQL_KEYWORDS_PATTERN, Pattern.CASE_INSENSITIVE);
/**
* 关键字命中
*
* @param sql
* @return
*/
public static Boolean hit(String sql) {<FILL_FUNCTION_BODY>}
}
|
if (StringUtils.isEmpty(sql)) {
return false;
}
Matcher matcher = keywordPattern.matcher(sql);
return matcher.find();
| 328
| 46
| 374
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/sms/plugin/SmsPluginFactory.java
|
SmsPluginFactory
|
smsPlugin
|
class SmsPluginFactory {
@Autowired
private SettingService settingService;
/**
* 获取oss client
*
* @return
*/
public SmsPlugin smsPlugin() {<FILL_FUNCTION_BODY>}
}
|
SmsSetting smsSetting = null;
try {
Setting setting = settingService.get(SettingEnum.SMS_SETTING.name());
smsSetting = JSONUtil.toBean(setting.getSettingValue(), SmsSetting.class);
switch (SmsEnum.valueOf(smsSetting.getType())) {
case ALI:
return new AliSmsPlugin(smsSetting);
case TENCENT:
return new TencentSmsPlugin(smsSetting);
case HUAWEI:
return new HuaweiSmsPlugin(smsSetting);
default:
throw new ServiceException();
}
} catch (Exception e) {
throw new ServiceException();
}
| 70
| 186
| 256
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/sms/serviceimpl/SmsSignServiceImpl.java
|
SmsSignServiceImpl
|
addSmsSign
|
class SmsSignServiceImpl extends ServiceImpl<SmsSignMapper, SmsSign> implements SmsSignService {
@Autowired
private SmsPluginFactory smsPluginFactory;
@Override
@Transactional(rollbackFor = Exception.class)
public void addSmsSign(SmsSign smsSign) {<FILL_FUNCTION_BODY>}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteSmsSign(String id) {
try {
SmsSign smsSign = this.getById(id);
if (smsSign != null) {
smsPluginFactory.smsPlugin().deleteSmsSign(smsSign.getSignName());
this.removeById(id);
}
} catch (Exception e) {
log.error("删除短信签名错误", e);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void querySmsSign() {
try {
Map<String, Object> map = new HashMap<>(16);
//获取未审核通过的签名列表
List<SmsSign> list = list(new LambdaQueryWrapper<SmsSign>().ne(SmsSign::getSignStatus, 1));
//查询签名状态
for (SmsSign smsSign : list) {
map = smsPluginFactory.smsPlugin().querySmsSign(smsSign.getSignName());
smsSign.setSignStatus((Integer) map.get("SignStatus"));
smsSign.setReason(map.get("Reason").toString());
this.updateById(smsSign);
}
} catch (Exception e) {
log.error("查询短信签名错误", e);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void modifySmsSign(SmsSign smsSign) {
try {
smsPluginFactory.smsPlugin().modifySmsSign(smsSign);
this.updateById(smsSign);
} catch (Exception e) {
log.error("更新短信签名错误", e);
}
}
@Override
public IPage<SmsSign> page(PageVO pageVO, Integer signStatus) {
return this.page(PageUtil.initPage(pageVO), new QueryWrapper<SmsSign>()
.eq(signStatus != null, "sign_status", signStatus));
}
}
|
try {
//如果短信签名已存在,不能重复申请
if (this.getOne(new QueryWrapper<SmsSign>().eq("sign_name", smsSign.getSignName())) != null) {
throw new ServiceException(ResultCode.SMS_SIGN_EXIST_ERROR);
}
smsPluginFactory.smsPlugin().addSmsSign(smsSign);
smsSign.setSignStatus(0);
this.save(smsSign);
} catch (Exception e) {
log.error("添加短信签名错误", e);
}
| 631
| 152
| 783
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/sms/serviceimpl/SmsTemplateServiceImpl.java
|
SmsTemplateServiceImpl
|
querySmsTemplate
|
class SmsTemplateServiceImpl extends ServiceImpl<SmsTemplateMapper, SmsTemplate> implements SmsTemplateService {
@Autowired
private SmsPluginFactory smsPluginFactory;
@Override
public void addSmsTemplate(SmsTemplate smsTemplate) {
try {
smsTemplate.setTemplateCode(smsPluginFactory.smsPlugin().addSmsTemplate(smsTemplate));
smsTemplate.setTemplateStatus(0);
smsTemplate.setTemplateType(1);
this.save(smsTemplate);
} catch (Exception e) {
log.error("添加短信模板错误", e);
}
}
@Override
public void deleteSmsTemplate(String id) {
try {
SmsTemplate smsTemplate = this.getById(id);
if (smsTemplate.getTemplateCode() != null) {
smsPluginFactory.smsPlugin().deleteSmsTemplate(smsTemplate.getTemplateCode());
}
this.removeById(id);
} catch (Exception e) {
log.error("删除短信模板错误", e);
}
}
@Override
public void querySmsTemplate() {<FILL_FUNCTION_BODY>}
@Override
public void modifySmsTemplate(SmsTemplate smsTemplate) {
try {
smsPluginFactory.smsPlugin().modifySmsTemplate(smsTemplate);
smsTemplate.setTemplateStatus(0);
this.updateById(smsTemplate);
} catch (Exception e) {
log.error("重新提交短信模板错误", e);
}
}
@Override
public IPage<SmsTemplate> page(PageVO pageVO, Integer templateStatus) {
return this.page(PageUtil.initPage(pageVO), new QueryWrapper<SmsTemplate>()
.eq(templateStatus != null, "template_status", templateStatus));
}
}
|
try {
Map<String, Object> map;
//获取未审核通过的签名列表
List<SmsTemplate> list = list(new LambdaQueryWrapper<SmsTemplate>().eq(SmsTemplate::getTemplateStatus, 0));
//查询签名状态
for (SmsTemplate smsTemplate : list) {
map = smsPluginFactory.smsPlugin().querySmsTemplate(smsTemplate.getTemplateCode());
smsTemplate.setTemplateStatus((Integer) map.get("TemplateStatus"));
smsTemplate.setReason(map.get("Reason").toString());
smsTemplate.setTemplateCode(map.get("TemplateCode").toString());
this.updateById(smsTemplate);
}
} catch (Exception e) {
log.error("查询短信模板错误", e);
}
| 492
| 211
| 703
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/statistics/aop/aspect/PageViewInterceptor.java
|
PageViewInterceptor
|
interceptor
|
class PageViewInterceptor {
@Autowired
private Cache cache;
@AfterReturning(returning = "rvt", pointcut = "@annotation(cn.lili.modules.statistics.aop.PageViewPoint)")
public void interceptor(JoinPoint point, Object rvt) {<FILL_FUNCTION_BODY>}
/**
* 获取注解中对方法的描述信息 用于Controller层注解
*
* @param joinPoint 切点
* @return 方法描述
* @throws Exception
*/
private static Map<String, String> spelFormat(JoinPoint joinPoint) {
Map<String, String> result = new HashMap<>(2);
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
PageViewPoint pageViewPoint = signature.getMethod().getAnnotation(PageViewPoint.class);
String id = SpelUtil.compileParams(joinPoint, pageViewPoint.id());
result.put("id", id);
return result;
}
}
|
MethodSignature signature = (MethodSignature) point.getSignature();
Method method = signature.getMethod();
PageViewPoint pageViewPoint = method.getAnnotation(PageViewPoint.class);
PageViewEnum pageViewEnum = pageViewPoint.type();
//store id 为-1 代表平台访问
String storeId;
//商品访问
String goodsId = null;
switch (pageViewEnum) {
case SKU:
ResultMessage<Map<String, Object>> skuRvt = (ResultMessage<Map<String, Object>>) rvt;
if (skuRvt != null && skuRvt.getResult() != null && skuRvt.getResult().containsKey("data")) {
GoodsSkuVO goodsSkuDetail = (GoodsSkuVO) skuRvt.getResult().get("data");
storeId = goodsSkuDetail.getStoreId();
goodsId = goodsSkuDetail.getGoodsId();
break;
}
case STORE:
Map<String, String> map = null;
try {
map = spelFormat(point);
} catch (Exception e) {
return;
}
storeId = map.get("id");
break;
default:
storeId = "-1";
}
String ip = IpUtils.getIpAddress(ThreadContextHolder.getHttpRequest());
try {
//PV 统计48小时过期 留下一定时间予以统计累计数据库
cache.incr(CachePrefix.PV.getPrefix() + StatisticsSuffix.suffix(), 60 * 60 * 48);
//平台UV统计
cache.cumulative(CachePrefix.UV.getPrefix() + StatisticsSuffix.suffix(), ip);
//PV 统计48小时过期 留下一定时间予以统计累计数据库
cache.incr(CachePrefix.STORE_PV.getPrefix() + StatisticsSuffix.suffix(storeId), 60 * 60 * 48);
//店铺UV 统计,则需要对id去重复,所以如下处理
cache.cumulative(CachePrefix.STORE_UV.getPrefix() + StatisticsSuffix.suffix(storeId), ip);
} catch (Exception e) {
log.error("页面出错", e);
}
| 265
| 596
| 861
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/AfterSaleStatisticsServiceImpl.java
|
AfterSaleStatisticsServiceImpl
|
applyNum
|
class AfterSaleStatisticsServiceImpl extends ServiceImpl<AfterSaleStatisticsMapper, AfterSale> implements AfterSaleStatisticsService {
@Override
public long applyNum(String serviceType) {<FILL_FUNCTION_BODY>}
@Override
public IPage<AfterSale> getStatistics(StatisticsQueryParam statisticsQueryParam, PageVO pageVO) {
LambdaQueryWrapper<AfterSale> queryWrapper = new LambdaQueryWrapper<>();
Date[] dates = StatisticsDateUtil.getDateArray(statisticsQueryParam);
queryWrapper.between(AfterSale::getCreateTime, dates[0], dates[1]);
queryWrapper.eq(CharSequenceUtil.isNotEmpty(statisticsQueryParam.getStoreId()), AfterSale::getStoreId, statisticsQueryParam.getStoreId());
return this.page(PageUtil.initPage(pageVO), queryWrapper);
}
}
|
AuthUser authUser = Objects.requireNonNull(UserContext.getCurrentUser());
LambdaQueryWrapper<AfterSale> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(AfterSale::getServiceStatus, AfterSaleStatusEnum.APPLY.name());
queryWrapper.eq(CharSequenceUtil.isNotEmpty(serviceType), AfterSale::getServiceType, serviceType);
queryWrapper.eq(CharSequenceUtil.equals(authUser.getRole().name(), UserEnums.STORE.name()),
AfterSale::getStoreId, authUser.getStoreId());
return this.count(queryWrapper);
| 227
| 159
| 386
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/BillStatisticsServiceImpl.java
|
BillStatisticsServiceImpl
|
billNum
|
class BillStatisticsServiceImpl extends ServiceImpl<BillStatisticsMapper, Bill> implements BillStatisticsService {
@Override
public long billNum(BillStatusEnum billStatusEnum) {<FILL_FUNCTION_BODY>}
}
|
LambdaUpdateWrapper<Bill> lambdaUpdateWrapper = Wrappers.lambdaUpdate();
lambdaUpdateWrapper.eq(Bill::getBillStatus, billStatusEnum.name());
lambdaUpdateWrapper.eq(CharSequenceUtil.equals(Objects.requireNonNull(UserContext.getCurrentUser()).getRole().name(), UserEnums.STORE.name()),
Bill::getStoreId, UserContext.getCurrentUser().getStoreId());
return this.count(lambdaUpdateWrapper);
| 63
| 121
| 184
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/GoodsStatisticsServiceImpl.java
|
GoodsStatisticsServiceImpl
|
goodsNum
|
class GoodsStatisticsServiceImpl extends ServiceImpl<GoodsStatisticsMapper, Goods> implements GoodsStatisticsService {
@Autowired
private GoodsSkuService goodsSkuService;
@Override
public long goodsNum(GoodsStatusEnum goodsStatusEnum, GoodsAuthEnum goodsAuthEnum) {<FILL_FUNCTION_BODY>}
@Override
public long todayUpperNum() {
LambdaQueryWrapper<Goods> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(Goods::getMarketEnable, GoodsStatusEnum.UPPER.name());
queryWrapper.ge(Goods::getCreateTime, DateUtil.beginOfDay(new DateTime()));
return this.count(queryWrapper);
}
@Override
public long alertQuantityNum() {
QueryWrapper queryWrapper = new QueryWrapper();
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
queryWrapper.eq(CharSequenceUtil.equals(currentUser.getRole().name(), UserEnums.STORE.name()),
"store_id", currentUser.getStoreId());
queryWrapper.eq("market_enable",GoodsStatusEnum.UPPER.name());
queryWrapper.apply("quantity < alert_quantity");
queryWrapper.gt("alert_quantity",0);
return goodsSkuService.count(queryWrapper);
}
}
|
LambdaQueryWrapper<Goods> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(Goods::getDeleteFlag, false);
if (goodsStatusEnum != null) {
queryWrapper.eq(Goods::getMarketEnable, goodsStatusEnum.name());
}
if (goodsAuthEnum != null) {
queryWrapper.eq(Goods::getAuthFlag, goodsAuthEnum.name());
}
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
queryWrapper.eq(CharSequenceUtil.equals(currentUser.getRole().name(), UserEnums.STORE.name()),
Goods::getStoreId, currentUser.getStoreId());
return this.count(queryWrapper);
| 346
| 193
| 539
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/MemberEvaluationStatisticsServiceImpl.java
|
MemberEvaluationStatisticsServiceImpl
|
getWaitReplyNum
|
class MemberEvaluationStatisticsServiceImpl extends ServiceImpl<MemberEvaluationStatisticsMapper, MemberEvaluation> implements MemberEvaluationStatisticsService {
@Override
public long todayMemberEvaluation() {
return this.count(new LambdaQueryWrapper<MemberEvaluation>().ge(MemberEvaluation::getCreateTime, DateUtil.beginOfDay(new DateTime())));
}
@Override
public long getWaitReplyNum() {<FILL_FUNCTION_BODY>}
}
|
QueryWrapper<MemberEvaluation> queryWrapper = Wrappers.query();
queryWrapper.eq(CharSequenceUtil.equals(Objects.requireNonNull(UserContext.getCurrentUser()).getRole().name(), UserEnums.STORE.name()),
"store_id", UserContext.getCurrentUser().getStoreId());
queryWrapper.eq("reply_status", false);
return this.count(queryWrapper);
| 121
| 104
| 225
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/MemberStatisticsServiceImpl.java
|
MemberStatisticsServiceImpl
|
statistics
|
class MemberStatisticsServiceImpl extends ServiceImpl<MemberStatisticsMapper, MemberStatisticsData> implements MemberStatisticsService {
@Override
public long getMemberCount() {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("disabled", true);
return this.baseMapper.customSqlQuery(queryWrapper);
}
@Override
public long todayMemberNum() {
QueryWrapper queryWrapper = Wrappers.query();
queryWrapper.ge("create_time", DateUtil.beginOfDay(new Date()));
return this.baseMapper.customSqlQuery(queryWrapper);
}
@Override
public long memberCount(Date endTime) {
QueryWrapper queryWrapper = Wrappers.query();
queryWrapper.le("create_time", endTime);
return this.baseMapper.customSqlQuery(queryWrapper);
}
@Override
public long activeQuantity(Date startTime) {
QueryWrapper queryWrapper = Wrappers.query();
queryWrapper.ge("last_login_date", startTime);
return this.baseMapper.customSqlQuery(queryWrapper);
}
@Override
public long newlyAdded(Date startTime, Date endTime) {
QueryWrapper queryWrapper = Wrappers.query();
queryWrapper.between("create_time", startTime, endTime);
return this.baseMapper.customSqlQuery(queryWrapper);
}
@Override
public List<MemberStatisticsData> statistics(StatisticsQueryParam statisticsQueryParam) {<FILL_FUNCTION_BODY>}
@Override
public List<MemberDistributionVO> distribution() {
return this.baseMapper.distribution();
}
}
|
Date[] dates = StatisticsDateUtil.getDateArray(statisticsQueryParam);
Date startTime = dates[0];
Date endTime = dates[1];
//如果统计今天,则自行构造数据
if (statisticsQueryParam.getSearchType().equals(SearchTypeEnum.TODAY.name())) {
//构建数据,然后返回集合,提供给前端展示
MemberStatisticsData memberStatisticsData = new MemberStatisticsData();
memberStatisticsData.setMemberCount(this.memberCount(endTime));
memberStatisticsData.setCreateDate(startTime);
memberStatisticsData.setActiveQuantity(this.activeQuantity(startTime));
memberStatisticsData.setNewlyAdded(this.newlyAdded(startTime, endTime));
List result = new ArrayList<MemberStatisticsData>();
result.add(memberStatisticsData);
return result;
}
QueryWrapper queryWrapper = Wrappers.query();
queryWrapper.between("create_date", startTime, endTime);
return list(queryWrapper);
| 417
| 268
| 685
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/SeckillStatisticsServiceImpl.java
|
SeckillStatisticsServiceImpl
|
getApplyNum
|
class SeckillStatisticsServiceImpl extends ServiceImpl<SeckillStatisticsMapper, Seckill> implements SeckillStatisticsService {
@Override
public long getApplyNum() {<FILL_FUNCTION_BODY>}
}
|
QueryWrapper<Seckill> queryWrapper = Wrappers.query();
//秒杀申请时间未超过当前时间
queryWrapper.ge("apply_end_time", cn.hutool.core.date.DateUtil.date());
queryWrapper.and(PromotionTools.queryPromotionStatus(PromotionsStatusEnum.START));
return this.count(queryWrapper);
| 62
| 95
| 157
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/statistics/serviceimpl/StoreStatisticsServiceImpl.java
|
StoreStatisticsServiceImpl
|
todayStoreNum
|
class StoreStatisticsServiceImpl extends ServiceImpl<StoreStatisticsMapper, Store> implements StoreStatisticsService {
@Override
public long auditNum() {
LambdaQueryWrapper<Store> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(Store::getStoreDisable, StoreStatusEnum.APPLYING.name());
return this.count(queryWrapper);
}
@Override
public long storeNum() {
LambdaQueryWrapper<Store> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(Store::getStoreDisable, StoreStatusEnum.OPEN.name());
return this.count(queryWrapper);
}
@Override
public long todayStoreNum() {<FILL_FUNCTION_BODY>}
}
|
LambdaQueryWrapper<Store> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(Store::getStoreDisable, StoreStatusEnum.OPEN.name());
queryWrapper.ge(Store::getCreateTime, DateUtil.beginOfDay(new DateTime()));
return this.count(queryWrapper);
| 192
| 78
| 270
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/statistics/util/StatisticsDateUtil.java
|
StatisticsDateUtil
|
getDateArray
|
class StatisticsDateUtil {
/**
* 快捷搜索,得到开始时间和结束时间
*
* @param searchTypeEnum
* @return
*/
public static Date[] getDateArray(SearchTypeEnum searchTypeEnum) {
Date[] dateArray = new Date[2];
Calendar calendar = Calendar.getInstance();
//时间归到今天凌晨0点
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
switch (searchTypeEnum) {
case TODAY:
dateArray[0] = calendar.getTime();
calendar.set(Calendar.HOUR_OF_DAY, +24);
calendar.set(Calendar.MILLISECOND, -1);
dateArray[1] = calendar.getTime();
break;
case YESTERDAY:
//获取昨天
calendar.set(Calendar.HOUR_OF_DAY, -24);
dateArray[0] = calendar.getTime();
//昨天结束时间
calendar.set(Calendar.HOUR_OF_DAY, +24);
calendar.set(Calendar.MILLISECOND, -1);
dateArray[1] = calendar.getTime();
break;
case LAST_SEVEN:
calendar.set(Calendar.HOUR_OF_DAY, -24 * 7);
dateArray[0] = calendar.getTime();
calendar.set(Calendar.HOUR_OF_DAY, +24 * 7);
calendar.set(Calendar.MILLISECOND, -1);
//获取过去七天
dateArray[1] = calendar.getTime();
break;
case LAST_THIRTY:
//获取最近三十天
calendar.set(Calendar.HOUR_OF_DAY, -24 * 30);
dateArray[0] = calendar.getTime();
calendar.set(Calendar.HOUR_OF_DAY, +24 * 30);
calendar.set(Calendar.MILLISECOND, -1);
//获取过去七天
dateArray[1] = calendar.getTime();
break;
default:
throw new ServiceException(ResultCode.ERROR);
}
return dateArray;
}
/**
* 获取年月获取开始结束时间
*
* @param year 年
* @param month 月
* @return 返回时间
*/
public static Date[] getDateArray(Integer year, Integer month) {<FILL_FUNCTION_BODY>}
/**
* 根据搜索参数获取搜索开始结束时间
*
* @param statisticsQueryParam
* @return
*/
public static Date[] getDateArray(StatisticsQueryParam statisticsQueryParam) {
//如果快捷搜搜哦
if (StringUtils.isNotEmpty(statisticsQueryParam.getSearchType())) {
return getDateArray(SearchTypeEnum.valueOf(statisticsQueryParam.getSearchType()));
}
//按照年月查询
else if (statisticsQueryParam.getMonth() != null && statisticsQueryParam.getYear() != null) {
return getDateArray(statisticsQueryParam.getYear(), statisticsQueryParam.getMonth());
}
//默认查询当前月份
else {
Calendar calendar = Calendar.getInstance();
return getDateArray(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1);
}
}
/**
* 根据一个日期,获取这一天的开始时间和结束时间
*
* @param queryDate
* @return
*/
public static Date[] getDateArray(Date queryDate) {
Date[] dateArray = new Date[2];
Calendar calendar = Calendar.getInstance();
calendar.setTime(queryDate);
//时间归到今天凌晨0点
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
dateArray[0] = calendar.getTime();
calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) + 1);
calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) - 1);
dateArray[1] = calendar.getTime();
return dateArray;
}
}
|
Date[] dateArray = new Date[2];
Calendar calendar = Calendar.getInstance();
//时间归到今天凌晨0点
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(year, month, 1);
dateArray[1] = calendar.getTime();
calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1);
dateArray[0] = calendar.getTime();
return dateArray;
| 1,186
| 172
| 1,358
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/statistics/util/StatisticsSuffix.java
|
StatisticsSuffix
|
suffix
|
class StatisticsSuffix {
/**
* 平台统计后缀
*
* @return
*/
public static String suffix() { //取得系统当前时间
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
int day = calendar.get(Calendar.DAY_OF_MONTH);
return year + "-" + month + "-" + day;
}
/**
* 平台统计后缀(制定日期)
*
* @return
*/
public static String suffix(Calendar calendar) { //取得系统当前时间
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
int day = calendar.get(Calendar.DAY_OF_MONTH);
return year + "-" + month + "-" + day;
}
/**
* 获取商家统计后缀
*
* @param storeId
* @return
*/
public static String suffix(String storeId) {<FILL_FUNCTION_BODY>}
/**
* 获取商家统计后缀(指定日)
*
* @param storeId
* @return
*/
public static String suffix(Calendar calendar, String storeId) {
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
int day = calendar.get(Calendar.DAY_OF_MONTH);
return year + "-" + month + "-" + day + "-" + storeId;
}
}
|
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
int day = calendar.get(Calendar.DAY_OF_MONTH);
return year + "-" + month + "-" + day + "-" + storeId;
| 433
| 85
| 518
|
<no_super_class>
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/store/entity/dto/BillSearchParams.java
|
BillSearchParams
|
queryWrapper
|
class BillSearchParams extends PageVO {
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "起始日期")
private String startDate;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "结束日期")
private String endDate;
@ApiModelProperty(value = "账单号")
private String sn;
/**
* @see BillStatusEnum
*/
@ApiModelProperty(value = "状态:OUT(已出账),CHECK(已对账),EXAMINE(已审核),PAY(已付款)")
private String billStatus;
@ApiModelProperty(value = "店铺名称")
private String storeName;
@ApiModelProperty(value = "店铺ID", hidden = true)
private String storeId;
public <T> QueryWrapper<T> queryWrapper() {<FILL_FUNCTION_BODY>}
}
|
QueryWrapper<T> wrapper = new QueryWrapper<>();
//创建时间
if (StringUtils.isNotEmpty(startDate) && StringUtils.isNotEmpty(endDate)) {
wrapper.between("create_time", startDate, endDate);
} else if (StringUtils.isNotEmpty(startDate)) {
wrapper.ge("create_time", startDate);
} else if (StringUtils.isNotEmpty(endDate)) {
wrapper.le("create_time", endDate);
}
//账单号
wrapper.eq(StringUtils.isNotEmpty(sn), "sn", sn);
//结算状态
wrapper.eq(StringUtils.isNotEmpty(billStatus), "bill_status", billStatus);
//店铺名称
wrapper.eq(StringUtils.isNotEmpty(storeName), "store_name", storeName);
//按卖家查询
wrapper.eq(StringUtils.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.STORE.name()),
"store_id", UserContext.getCurrentUser().getStoreId());
return wrapper;
| 324
| 281
| 605
|
<methods>public non-sealed void <init>() ,public java.lang.String getSort() <variables>private java.lang.Boolean notConvert,private java.lang.String order,private java.lang.Integer pageNumber,private java.lang.Integer pageSize,private static final long serialVersionUID,private java.lang.String sort
|
lilishop_lilishop
|
lilishop/framework/src/main/java/cn/lili/modules/store/entity/vos/StoreSearchParams.java
|
StoreSearchParams
|
queryWrapper
|
class StoreSearchParams extends PageVO implements Serializable {
private static final long serialVersionUID = 6916054310764833369L;
@ApiModelProperty(value = "会员名称")
private String memberName;
@ApiModelProperty(value = "店铺名称")
private String storeName;
/**
* @see StoreStatusEnum
*/
@ApiModelProperty(value = "店铺状态")
private String storeDisable;
@ApiModelProperty(value = "开始时间")
private String startDate;
@ApiModelProperty(value = "结束时间")
private String endDate;
public <T> QueryWrapper<T> queryWrapper() {<FILL_FUNCTION_BODY>}
}
|
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
if (StringUtils.isNotEmpty(storeName)) {
queryWrapper.like("store_name", storeName);
}
if (StringUtils.isNotEmpty(memberName)) {
queryWrapper.like("member_name", memberName);
}
if (StringUtils.isNotEmpty(storeDisable)) {
queryWrapper.eq("store_disable", storeDisable);
} else {
queryWrapper.and(Wrapper -> Wrapper.eq("store_disable", StoreStatusEnum.OPEN.name()).or().eq("store_disable", StoreStatusEnum.CLOSED.name()));
}
//按时间查询
if (StringUtils.isNotEmpty(startDate)) {
queryWrapper.ge("create_time", DateUtil.parse(startDate));
}
if (StringUtils.isNotEmpty(endDate)) {
queryWrapper.le("create_time", DateUtil.parse(endDate));
}
return queryWrapper;
| 197
| 255
| 452
|
<methods>public non-sealed void <init>() ,public java.lang.String getSort() <variables>private java.lang.Boolean notConvert,private java.lang.String order,private java.lang.Integer pageNumber,private java.lang.Integer pageSize,private static final long serialVersionUID,private java.lang.String sort
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.