|
@@ -9,7 +9,6 @@ import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.SecurityUtils;
|
|
import com.zhongzheng.common.utils.SecurityUtils;
|
|
|
import com.zhongzheng.common.utils.SnowflakeIdUtils;
|
|
import com.zhongzheng.common.utils.SnowflakeIdUtils;
|
|
|
-import com.zhongzheng.modules.grade.domain.ClassGradeUser;
|
|
|
|
|
import com.zhongzheng.modules.top.mall.bo.TopActionLogAddBo;
|
|
import com.zhongzheng.modules.top.mall.bo.TopActionLogAddBo;
|
|
|
import com.zhongzheng.modules.top.mall.bo.TopStoreAddBo;
|
|
import com.zhongzheng.modules.top.mall.bo.TopStoreAddBo;
|
|
|
import com.zhongzheng.modules.top.mall.bo.TopStoreEditBo;
|
|
import com.zhongzheng.modules.top.mall.bo.TopStoreEditBo;
|
|
@@ -17,11 +16,10 @@ import com.zhongzheng.modules.top.mall.bo.TopStoreQueryBo;
|
|
|
import com.zhongzheng.modules.top.mall.domain.TopStore;
|
|
import com.zhongzheng.modules.top.mall.domain.TopStore;
|
|
|
import com.zhongzheng.modules.top.mall.mapper.TopStoreMapper;
|
|
import com.zhongzheng.modules.top.mall.mapper.TopStoreMapper;
|
|
|
import com.zhongzheng.modules.top.mall.service.ITopActionLogService;
|
|
import com.zhongzheng.modules.top.mall.service.ITopActionLogService;
|
|
|
|
|
+import com.zhongzheng.modules.top.mall.service.ITopMerchantService;
|
|
|
import com.zhongzheng.modules.top.mall.service.ITopStoreService;
|
|
import com.zhongzheng.modules.top.mall.service.ITopStoreService;
|
|
|
-import com.zhongzheng.modules.top.mall.vo.TopStoreExportVo;
|
|
|
|
|
|
|
+import com.zhongzheng.modules.top.mall.vo.TopMerchantVo;
|
|
|
import com.zhongzheng.modules.top.mall.vo.TopStoreVo;
|
|
import com.zhongzheng.modules.top.mall.vo.TopStoreVo;
|
|
|
-import com.zhongzheng.modules.top.order.domain.TopOrderRecNote;
|
|
|
|
|
-import com.zhongzheng.modules.top.order.vo.TopOldOrderCompanyExportVo;
|
|
|
|
|
import com.zhongzheng.modules.top.user.domain.TopSysConfig;
|
|
import com.zhongzheng.modules.top.user.domain.TopSysConfig;
|
|
|
import com.zhongzheng.modules.top.user.service.ITopSysConfigService;
|
|
import com.zhongzheng.modules.top.user.service.ITopSysConfigService;
|
|
|
import com.zhongzheng.modules.top.user.vo.TopSysPointsRuleVo;
|
|
import com.zhongzheng.modules.top.user.vo.TopSysPointsRuleVo;
|
|
@@ -32,7 +30,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.Page;
|
|
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
|
|
+
|
|
|
import java.util.Collection;
|
|
import java.util.Collection;
|
|
|
import java.util.Collections;
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -42,7 +40,7 @@ import java.util.stream.Collectors;
|
|
|
* 商户店铺管理Service业务层处理
|
|
* 商户店铺管理Service业务层处理
|
|
|
*
|
|
*
|
|
|
* @author hjl
|
|
* @author hjl
|
|
|
- * @date 2023-05-18
|
|
|
|
|
|
|
+ * @date 2023-05-25
|
|
|
*/
|
|
*/
|
|
|
@Service
|
|
@Service
|
|
|
public class TopStoreServiceImpl extends ServiceImpl<TopStoreMapper, TopStore> implements ITopStoreService {
|
|
public class TopStoreServiceImpl extends ServiceImpl<TopStoreMapper, TopStore> implements ITopStoreService {
|
|
@@ -53,11 +51,12 @@ public class TopStoreServiceImpl extends ServiceImpl<TopStoreMapper, TopStore> i
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ITopActionLogService iTopActionLogService;
|
|
private ITopActionLogService iTopActionLogService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ITopMerchantService iTopMerchantService;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public TopStoreVo queryById(Long storeId){
|
|
public TopStoreVo queryById(Long storeId){
|
|
|
TopStore db = this.baseMapper.selectById(storeId);
|
|
TopStore db = this.baseMapper.selectById(storeId);
|
|
|
- db.setPassword(null);
|
|
|
|
|
- db.setInitPwd(null);
|
|
|
|
|
return BeanUtil.toBean(db, TopStoreVo.class);
|
|
return BeanUtil.toBean(db, TopStoreVo.class);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -65,30 +64,15 @@ public class TopStoreServiceImpl extends ServiceImpl<TopStoreMapper, TopStore> i
|
|
|
public List<TopStoreVo> queryList(TopStoreQueryBo bo) {
|
|
public List<TopStoreVo> queryList(TopStoreQueryBo bo) {
|
|
|
LambdaQueryWrapper<TopStore> lqw = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<TopStore> lqw = Wrappers.lambdaQuery();
|
|
|
lqw.like(StrUtil.isNotBlank(bo.getStoreName()), TopStore::getStoreName, bo.getStoreName());
|
|
lqw.like(StrUtil.isNotBlank(bo.getStoreName()), TopStore::getStoreName, bo.getStoreName());
|
|
|
- lqw.eq(StrUtil.isNotBlank(bo.getTelphone()), TopStore::getTelphone, bo.getTelphone());
|
|
|
|
|
- lqw.like(StrUtil.isNotBlank(bo.getUserName()), TopStore::getUserName, bo.getUserName());
|
|
|
|
|
- lqw.eq(StrUtil.isNotBlank(bo.getPassword()), TopStore::getPassword, bo.getPassword());
|
|
|
|
|
- lqw.eq(StrUtil.isNotBlank(bo.getContacts()), TopStore::getContacts, bo.getContacts());
|
|
|
|
|
- lqw.eq(StrUtil.isNotBlank(bo.getInitPwd()), TopStore::getInitPwd, bo.getInitPwd());
|
|
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getAddress()), TopStore::getAddress, bo.getAddress());
|
|
|
lqw.in(bo.getStatus() != null, TopStore::getStatus, bo.getStatus());
|
|
lqw.in(bo.getStatus() != null, TopStore::getStatus, bo.getStatus());
|
|
|
- return entity2Vo(this.list(lqw));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- public List<TopStoreExportVo> listExport(TopStoreQueryBo bo) {
|
|
|
|
|
- List<TopStoreExportVo> exportVoList = new ArrayList<>();
|
|
|
|
|
- List<TopStoreVo> list = queryList(bo);
|
|
|
|
|
|
|
+ lqw.eq(bo.getMerId() != null, TopStore::getMerId, bo.getMerId());
|
|
|
|
|
+ List<TopStoreVo> list = entity2Vo(this.list(lqw));
|
|
|
for(TopStoreVo vo : list){
|
|
for(TopStoreVo vo : list){
|
|
|
- TopStoreExportVo exportVo = BeanUtil.toBean(vo, TopStoreExportVo.class);
|
|
|
|
|
- exportVo.setCreateTime(DateUtils.timestampToDate(vo.getCreateTime()));
|
|
|
|
|
- if(vo.getStatus()==1){
|
|
|
|
|
- exportVo.setStatus("启用");
|
|
|
|
|
- }
|
|
|
|
|
- if(vo.getStatus()==0){
|
|
|
|
|
- exportVo.setStatus("禁用");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ TopMerchantVo merchantVo = iTopMerchantService.queryById(vo.getMerId());
|
|
|
|
|
+ vo.setMerName(merchantVo.getMerName());
|
|
|
}
|
|
}
|
|
|
- return exportVoList;
|
|
|
|
|
|
|
+ return list;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -113,48 +97,31 @@ public class TopStoreServiceImpl extends ServiceImpl<TopStoreMapper, TopStore> i
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public Boolean insertByAddBo(TopStoreAddBo bo) {
|
|
public Boolean insertByAddBo(TopStoreAddBo bo) {
|
|
|
- if (getOne(new LambdaQueryWrapper<TopStore>().eq(TopStore::getStoreName, bo.getStoreName()).last("limit 1")) != null) {
|
|
|
|
|
- throw new CustomException("该商户名已被注册");
|
|
|
|
|
|
|
+ if(Validator.isEmpty(bo.getMerId())||Validator.isEmpty(bo.getStoreName())){
|
|
|
|
|
+ throw new CustomException("参数缺失");
|
|
|
}
|
|
}
|
|
|
- if (getOne(new LambdaQueryWrapper<TopStore>().eq(TopStore::getTelphone, bo.getTelphone()).last("limit 1")) != null) {
|
|
|
|
|
- throw new CustomException("该手机号已被注册");
|
|
|
|
|
|
|
+ if (getOne(new LambdaQueryWrapper<TopStore>().eq(TopStore::getStoreName, bo.getStoreName()).eq(TopStore::getMerId, bo.getMerId()).last("limit 1")) != null) {
|
|
|
|
|
+ throw new CustomException("该店铺名已被使用");
|
|
|
}
|
|
}
|
|
|
TopStore add = BeanUtil.toBean(bo, TopStore.class);
|
|
TopStore add = BeanUtil.toBean(bo, TopStore.class);
|
|
|
validEntityBeforeSave(add);
|
|
validEntityBeforeSave(add);
|
|
|
add.setCreateTime(DateUtils.getNowTime());
|
|
add.setCreateTime(DateUtils.getNowTime());
|
|
|
add.setUpdateTime(DateUtils.getNowTime());
|
|
add.setUpdateTime(DateUtils.getNowTime());
|
|
|
- String pwd = add.getTelphone().substring(add.getTelphone().length() - 6);
|
|
|
|
|
- add.setUserName("manager");
|
|
|
|
|
- add.setPassword(pwd);
|
|
|
|
|
- add.setInitPwd(add.getPassword());
|
|
|
|
|
- add.setPassword(SecurityUtils.encryptPassword(add.getPassword()));
|
|
|
|
|
add.setTenantId("867735392558919680");//初始按祥粤创建
|
|
add.setTenantId("867735392558919680");//初始按祥粤创建
|
|
|
SnowflakeIdUtils idWorker = new SnowflakeIdUtils(3, 1);
|
|
SnowflakeIdUtils idWorker = new SnowflakeIdUtils(3, 1);
|
|
|
- add.setStoreAccount(String.valueOf(idWorker.nextId()));
|
|
|
|
|
return this.save(add);
|
|
return this.save(add);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public Boolean updateByEditBo(TopStoreEditBo bo) {
|
|
public Boolean updateByEditBo(TopStoreEditBo bo) {
|
|
|
- if(Validator.isEmpty(bo.getStoreId())){
|
|
|
|
|
|
|
+ if(Validator.isEmpty(bo.getStoreId())||Validator.isEmpty(bo.getMerId())){
|
|
|
throw new CustomException("参数错误");
|
|
throw new CustomException("参数错误");
|
|
|
}
|
|
}
|
|
|
if(Validator.isNotEmpty(bo.getStoreName())){
|
|
if(Validator.isNotEmpty(bo.getStoreName())){
|
|
|
- if (getOne(new LambdaQueryWrapper<TopStore>().ne(TopStore::getStoreId, bo.getStoreId()).eq(TopStore::getStoreName, bo.getStoreName()).last("limit 1")) != null) {
|
|
|
|
|
- throw new CustomException("该商户名称已被注册");
|
|
|
|
|
|
|
+ if (getOne(new LambdaQueryWrapper<TopStore>().ne(TopStore::getStoreId, bo.getStoreId()).eq(TopStore::getMerId, bo.getMerId()).eq(TopStore::getStoreName, bo.getStoreName()).last("limit 1")) != null) {
|
|
|
|
|
+ throw new CustomException("该店铺名已被使用");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if(Validator.isNotEmpty(bo.getTelphone())){
|
|
|
|
|
- TopStore topStore = getOne(new LambdaQueryWrapper<TopStore>().eq(TopStore::getStoreId, bo.getStoreId()));
|
|
|
|
|
- if(!topStore.getTelphone().equals(bo.getTelphone())){
|
|
|
|
|
- if (getOne(new LambdaQueryWrapper<TopStore>().ne(TopStore::getStoreId, bo.getStoreId()).eq(TopStore::getTelphone, bo.getTelphone()).last("limit 1")) != null) {
|
|
|
|
|
- throw new CustomException("该手机号码已被注册");
|
|
|
|
|
- }
|
|
|
|
|
- String pwd = bo.getTelphone().substring(bo.getTelphone().length() - 6);
|
|
|
|
|
- bo.setInitPwd(pwd);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
TopStore update = BeanUtil.toBean(bo, TopStore.class);
|
|
TopStore update = BeanUtil.toBean(bo, TopStore.class);
|
|
|
validEntityBeforeSave(update);
|
|
validEntityBeforeSave(update);
|
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
@@ -178,32 +145,6 @@ public class TopStoreServiceImpl extends ServiceImpl<TopStoreMapper, TopStore> i
|
|
|
return this.removeByIds(ids);
|
|
return this.removeByIds(ids);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
|
- public Boolean restorePwd(TopStoreEditBo bo) {
|
|
|
|
|
- if(Validator.isEmpty(bo.getStoreId())){
|
|
|
|
|
- throw new CustomException("参数错误");
|
|
|
|
|
- }
|
|
|
|
|
- TopStore store = getOne(new LambdaQueryWrapper<TopStore>().eq(TopStore::getStoreId, bo.getStoreId()).last("limit 1"));
|
|
|
|
|
- LambdaUpdateWrapper<TopStore> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
|
|
|
|
- objectLambdaUpdateWrapper.eq(TopStore::getStoreId, bo.getStoreId());
|
|
|
|
|
- objectLambdaUpdateWrapper.set(TopStore::getPassword, SecurityUtils.encryptPassword(store.getInitPwd()));
|
|
|
|
|
- objectLambdaUpdateWrapper.set(TopStore::getUpdateTime, DateUtils.getNowTime());
|
|
|
|
|
- return this.update(null, objectLambdaUpdateWrapper);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- public Boolean updatePwd(TopStoreEditBo bo) {
|
|
|
|
|
- if(Validator.isEmpty(bo.getStoreId())||Validator.isEmpty(bo.getPassword())){
|
|
|
|
|
- throw new CustomException("参数错误");
|
|
|
|
|
- }
|
|
|
|
|
- TopStoreVo storeVo = queryById(bo.getStoreId());
|
|
|
|
|
- LambdaUpdateWrapper<TopStore> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
|
|
|
|
- objectLambdaUpdateWrapper.eq(TopStore::getStoreId, bo.getStoreId());
|
|
|
|
|
- objectLambdaUpdateWrapper.set(TopStore::getPassword, SecurityUtils.encryptPassword(bo.getPassword()));
|
|
|
|
|
- objectLambdaUpdateWrapper.set(TopStore::getUpdateTime, DateUtils.getNowTime());
|
|
|
|
|
- return this.update(null, objectLambdaUpdateWrapper);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public Boolean batchRemove(TopStoreEditBo bo) {
|
|
public Boolean batchRemove(TopStoreEditBo bo) {
|
|
|
if(Validator.isNotEmpty(bo.getStoreIds())){
|
|
if(Validator.isNotEmpty(bo.getStoreIds())){
|