收银点更改
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
package cn.pluss.platform.merchant;
|
||||
|
||||
import cn.pluss.platform.entity.MerchantCashPayCode;
|
||||
import cn.pluss.platform.entity.MerchantCashPlace;
|
||||
import cn.pluss.platform.entity.MerchantOrder;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.entity.*;
|
||||
import cn.pluss.platform.vo.MerchantCashPlaceStaffVO;
|
||||
import cn.pluss.platform.vo.MerchantCashPlaceVO;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -27,12 +24,20 @@ public interface MerchantCashPlaceService extends IService<MerchantCashPlace> {
|
||||
*/
|
||||
void createDefaultCashPlace(Long userId);
|
||||
|
||||
List<MerchantChannel> merchantChannel(String merchantCode,List<MerchantChannel> merchantChannels);
|
||||
|
||||
/**
|
||||
* 通过收银点编码删除
|
||||
* @param code 收银台编码code
|
||||
*/
|
||||
void delByCodeForApp(String code);
|
||||
|
||||
/**
|
||||
* (新)新增收银点
|
||||
* @param merchantBaseInfo
|
||||
*/
|
||||
Boolean addCashPlace(MerchantBaseInfo merchantBaseInfo);
|
||||
|
||||
/**
|
||||
* 查看收银点列表
|
||||
* @param merchantCashPlace 收银点查询条件
|
||||
@@ -40,6 +45,12 @@ public interface MerchantCashPlaceService extends IService<MerchantCashPlace> {
|
||||
*/
|
||||
List<MerchantCashPlaceVO> getListForApp(Page<MerchantCashPlace> page, MerchantCashPlace merchantCashPlace);
|
||||
|
||||
/**
|
||||
* 最新查看收银点
|
||||
* @return
|
||||
*/
|
||||
List<MerchantCashPlaceVO> getListForBase(Integer current, Integer size,String merchantCode,String name);
|
||||
|
||||
/**
|
||||
* 收银点绑定收款码
|
||||
* @param merchantCashPayCode
|
||||
|
||||
@@ -44,6 +44,8 @@ public interface MerchantCashPlaceStaffService extends IService<MerchantCashPlac
|
||||
*/
|
||||
void offLineCashPlace(MerchantCashPlace cashPlace);
|
||||
|
||||
void cutChannel(String merchantCode,String code);
|
||||
|
||||
/**
|
||||
* 员工收银点签退
|
||||
* @param cashPlaceCode
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package cn.pluss.platform.merchant.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.jiguang.common.utils.StringUtils;
|
||||
import cn.pluss.platform.converter.Converter;
|
||||
import cn.pluss.platform.converter.MerchantCashPlaceConverter;
|
||||
import cn.pluss.platform.deviceStock.DeviceStockService;
|
||||
import cn.pluss.platform.entity.*;
|
||||
import cn.pluss.platform.exception.MsgException;
|
||||
import cn.pluss.platform.mapper.MerchantCashPayCodeMapper;
|
||||
import cn.pluss.platform.mapper.MerchantCashPlaceMapper;
|
||||
import cn.pluss.platform.mapper.MerchantCashPlaceStaffMapper;
|
||||
import cn.pluss.platform.mapper.UserAppMapper;
|
||||
import cn.pluss.platform.mapper.*;
|
||||
import cn.pluss.platform.merchant.MerchantCashPayCodeService;
|
||||
import cn.pluss.platform.merchant.MerchantCashPlaceService;
|
||||
import cn.pluss.platform.merchant.MerchantCashPlaceStaffService;
|
||||
@@ -30,10 +28,8 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -73,6 +69,14 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private UserAppMapper userAppMapper;
|
||||
|
||||
@Resource
|
||||
private MerchantBaseInfoMapper merchantBaseInfoMapper;
|
||||
|
||||
@Resource
|
||||
private MerchantChannelStatusService merchantChannelStatusService;
|
||||
@Resource
|
||||
private MerchantChannelStatusMapper channelStatusMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean saveOrUpdate(MerchantCashPlace entity) {
|
||||
@@ -202,6 +206,19 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
|
||||
cashPayCodeService.save(cashPayCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MerchantChannel> merchantChannel(String merchantCode,List<MerchantChannel> merchantChannels) {
|
||||
List<Integer> channelByMerchantCode = channelStatusMapper.getChannelByMerchantCode(merchantCode);
|
||||
for (MerchantChannel data : merchantChannels) {
|
||||
for (Integer i :channelByMerchantCode) {
|
||||
if (data.getId().equals(i)){
|
||||
data.setStatus("1");
|
||||
}
|
||||
}
|
||||
}
|
||||
return merchantChannels;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delByCodeForApp(String code) {
|
||||
@@ -235,6 +252,35 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* (新)增加新的收银点
|
||||
* @param merchantBaseInfo
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean addCashPlace(MerchantBaseInfo merchantBaseInfo) {
|
||||
//判断能不能新加收银点
|
||||
MerchantBaseInfo merchantBaseInfoByMerchantCode = merchantBaseInfoService.getMerchantBaseInfoByMerchantCode(merchantBaseInfo.getMerchantCode());
|
||||
if (merchantBaseInfoByMerchantCode == null){
|
||||
throw new MsgException("不能添加收银点");
|
||||
}
|
||||
//增加基本子账号
|
||||
String subMerchantCode = "M800" + DateUtil.format(new Date(), "yyyyMMdd") + StringUtil.random6V2();
|
||||
merchantBaseInfo.setMasterMerchantCode(merchantBaseInfo.getMerchantCode());
|
||||
merchantBaseInfo.setMerchantCode(subMerchantCode);
|
||||
merchantBaseInfoMapper.saveMerchantBaseInfo(merchantBaseInfo);
|
||||
//增加商户通道
|
||||
MerchantChannelStatus merchantChannelStatus = new MerchantChannelStatus();
|
||||
merchantChannelStatus.setMerchantCode(subMerchantCode);
|
||||
merchantChannelStatus.setChannel(merchantBaseInfo.getChannel());
|
||||
merchantChannelStatus.setStatus("0");
|
||||
merchantChannelStatus.setThirdStatus("-100");
|
||||
merchantChannelStatus.setCreateTime(new Date());
|
||||
merchantChannelStatus.setUpdateTime(new Date());
|
||||
boolean save = merchantChannelStatusService.save(merchantChannelStatus);
|
||||
return save;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MerchantCashPlaceVO> getListForApp(Page<MerchantCashPlace> page, MerchantCashPlace merchantCashPlace) {
|
||||
UserApp userApp = userAppService.queryUserAppByToken();
|
||||
@@ -313,6 +359,56 @@ public class MerchantCashPlaceServiceImpl extends ServiceImpl<MerchantCashPlaceM
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MerchantCashPlaceVO> getListForBase(Integer current, Integer size,String merchantCodes,String name) {
|
||||
//分页
|
||||
Page<MerchantBaseInfo> page = new Page<>();
|
||||
page.setCurrent(current);
|
||||
page.setSize(size);
|
||||
//查询
|
||||
MerchantBaseInfo merchantBaseInfo = merchantBaseInfoService.getMerchantBaseInfoByMerchantCode(merchantCodes);
|
||||
String merchantCode = merchantBaseInfo.getMerchantCode();
|
||||
QueryWrapper<MerchantBaseInfo> qW = new QueryWrapper<>();
|
||||
qW.eq("masterMerchantCode",merchantCode);
|
||||
qW.like(StringUtils.isNotEmpty(name), "name", merchantBaseInfo.getAlias());
|
||||
qW.orderByDesc("id");
|
||||
Page<MerchantBaseInfo> merchantBaseInfoPage = merchantBaseInfoMapper.selectPage(page, qW);
|
||||
//组装
|
||||
List<MerchantCashPlaceVO> cashPlaceVOList = new ArrayList<>();
|
||||
for (MerchantBaseInfo data :merchantBaseInfoPage.getRecords()) {
|
||||
MerchantCashPlaceVO cashPlaceVO = new MerchantCashPlaceVO();
|
||||
cashPlaceVO.setName(data.getAlias());
|
||||
cashPlaceVO.setCode(data.getMerchantCode());
|
||||
cashPlaceVO.setAddress(data.getAddress());
|
||||
cashPlaceVO.setCreateTime(data.getCreateDt());
|
||||
cashPlaceVO.setMerchantBaseInfo(data);
|
||||
cashPlaceVO.setTab(data.getTab());
|
||||
cashPlaceVOList.add(cashPlaceVO);
|
||||
}
|
||||
//放入自己
|
||||
MerchantCashPlaceVO cashPlaceVOMy = new MerchantCashPlaceVO();
|
||||
cashPlaceVOMy.setName(merchantBaseInfo.getAlias());
|
||||
cashPlaceVOMy.setCode(merchantBaseInfo.getMerchantCode());
|
||||
cashPlaceVOMy.setAddress(merchantBaseInfo.getAddress());
|
||||
cashPlaceVOMy.setCreateTime(merchantBaseInfo.getCreateDt());
|
||||
cashPlaceVOMy.setMerchantBaseInfo(merchantBaseInfo);
|
||||
cashPlaceVOMy.setTab(merchantBaseInfo.getTab());
|
||||
cashPlaceVOList.add(cashPlaceVOMy);
|
||||
//如果全为0,默认是用户号
|
||||
boolean allZero = true;
|
||||
for (MerchantCashPlaceVO vo : cashPlaceVOList) {
|
||||
if (vo.getTab() != 0) {
|
||||
allZero = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (allZero && !cashPlaceVOList.isEmpty()) {
|
||||
cashPlaceVOList.get(cashPlaceVOList.size() - 1).setTab(1);
|
||||
}
|
||||
return cashPlaceVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void bindPayCode(MerchantCashPayCode merchantCashPayCode) {
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package cn.pluss.platform.merchant.impl;
|
||||
|
||||
import cn.pluss.platform.entity.MerchantBaseInfo;
|
||||
import cn.pluss.platform.entity.MerchantCashPlace;
|
||||
import cn.pluss.platform.entity.MerchantCashPlaceStaff;
|
||||
import cn.pluss.platform.entity.UserApp;
|
||||
import cn.pluss.platform.exception.MsgException;
|
||||
import cn.pluss.platform.mapper.MerchantBaseInfoMapper;
|
||||
import cn.pluss.platform.mapper.MerchantCashPlaceStaffMapper;
|
||||
import cn.pluss.platform.merchant.MerchantBaseInfoService;
|
||||
import cn.pluss.platform.merchant.MerchantCashPlaceService;
|
||||
import cn.pluss.platform.merchant.MerchantCashPlaceStaffService;
|
||||
import cn.pluss.platform.userApp.UserAppService;
|
||||
@@ -19,7 +22,9 @@ import lombok.val;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -40,6 +45,10 @@ public class MerchantCashPlaceStaffServiceImpl extends ServiceImpl<MerchantCashP
|
||||
|
||||
@Setter(onMethod_ = {@Autowired})
|
||||
private MerchantCashPlaceService cashPlaceService;
|
||||
@Resource
|
||||
private MerchantBaseInfoMapper merchantBaseInfoMapper;
|
||||
@Resource
|
||||
private MerchantBaseInfoService merchantBaseInfoService;
|
||||
|
||||
@Override
|
||||
public void bindCashPlace(Long userId, MerchantCashPlace cashPlace) {
|
||||
@@ -141,6 +150,23 @@ public class MerchantCashPlaceStaffServiceImpl extends ServiceImpl<MerchantCashP
|
||||
update(cashPlaceStaff, uW);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cutChannel(String merchantCode,String code) {
|
||||
MerchantBaseInfo baseInfo = merchantBaseInfoService.getMerchantBaseInfoByMerchantCode(code);
|
||||
if (baseInfo == null){
|
||||
throw new MsgException("不能切换到该通道");
|
||||
}
|
||||
//切换
|
||||
UpdateWrapper<MerchantBaseInfo> updateWrapper1 = new UpdateWrapper<MerchantBaseInfo>()
|
||||
.set("tab", 0).eq("masterMerchantCode", merchantCode).or().eq("merchantCode",merchantCode);
|
||||
merchantBaseInfoService.update(updateWrapper1);
|
||||
|
||||
UpdateWrapper<MerchantBaseInfo> updateWrapper = new UpdateWrapper<MerchantBaseInfo>()
|
||||
.set("tab", 1).eq("merchantCode", code);
|
||||
merchantBaseInfoService.update(updateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void offLineCashPlace(String cashPlaceCode) {
|
||||
MerchantCashPlace merchantCashPlace = new MerchantCashPlace().setCode(cashPlaceCode);
|
||||
|
||||
Reference in New Issue
Block a user