bug
This commit is contained in:
parent
a61a99cde7
commit
2a81b49f14
@ -779,9 +779,17 @@ export default {
|
||||
this.form.naturalGasRule = JSON.stringify(this.naturalGasPreferential)
|
||||
if (this.form.id) {
|
||||
updateUserGrade(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
if (response.data==1) {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}else if (response.data==2) {
|
||||
this.$modal.msgError("修改失败,已存在当前等级的会员等级信息");
|
||||
}else if (response.data==3) {
|
||||
this.$modal.msgError("修改失败,会员等级名称已存在");
|
||||
}else {
|
||||
this.$modal.msgError("修改失败,已存在当前成长值的会员等级");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
queryUserGrade({name:this.form.name}).then( response => {
|
||||
|
@ -8,7 +8,7 @@
|
||||
<select id="selectUserGradeList" resultType="com.fuint.business.userManager.entity.LJUserGrade">
|
||||
<include refid="selectUserGrade"></include>
|
||||
<where>
|
||||
store_id = #{userGrade.storeId}
|
||||
chain_store_id = #{userGrade.chainStoreId}
|
||||
</where>
|
||||
order by grade
|
||||
</select>
|
||||
|
@ -95,6 +95,8 @@ public interface LJUserGradeService extends IService<LJUserGrade> {
|
||||
*/
|
||||
public int insertUserGrade(LJUserGrade userGrade,Integer storeId);
|
||||
|
||||
List<LJUserGrade> selectUserGradeByChainStoreId(Integer chainStoreId);
|
||||
|
||||
/**
|
||||
* 修改会员等级信息
|
||||
* @param userGrade
|
||||
|
@ -34,11 +34,15 @@ import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class LJUserGradeServiceImpl extends ServiceImpl<LJUserGradeMapper, LJUserGrade> implements LJUserGradeService {
|
||||
@Autowired
|
||||
private ILJStoreService storeService;
|
||||
|
||||
@Override
|
||||
public IPage<LJUserGrade> selectUserGradeList(Page page, LJUserGrade userGrade) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
userGrade.setStoreId(storeId);
|
||||
LJStore store = storeService.selectStoreByStoreId(storeId);
|
||||
userGrade.setChainStoreId(store.getChainStoreId());
|
||||
IPage<LJUserGrade> ljUserGradeIPage = baseMapper.selectUserGradeList(page, userGrade);
|
||||
for (LJUserGrade record : ljUserGradeIPage.getRecords()) {
|
||||
if (StringUtils.isNotEmpty(record.getGasolineRule())){
|
||||
@ -56,9 +60,10 @@ public class LJUserGradeServiceImpl extends ServiceImpl<LJUserGradeMapper, LJUse
|
||||
|
||||
@Override
|
||||
public List<LJUserGrade> selectUserGradeAll(int storeId) {
|
||||
LJStore store = storeService.selectStoreByStoreId(storeId);
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("status","qy");
|
||||
queryWrapper.eq("store_id",storeId);
|
||||
queryWrapper.eq("chain_store_id",store.getChainStoreId());
|
||||
return baseMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@ -71,9 +76,10 @@ public class LJUserGradeServiceImpl extends ServiceImpl<LJUserGradeMapper, LJUse
|
||||
|
||||
@Override
|
||||
public List<LJUserGrade> selectUserGradeAllByStoreId(int storeId) {
|
||||
LJStore store = storeService.selectStoreByStoreId(storeId);
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("status","qy");
|
||||
queryWrapper.eq("store_id",storeId);
|
||||
queryWrapper.eq("chain_store_id",store.getChainStoreId());
|
||||
queryWrapper.orderByAsc("grade");
|
||||
return baseMapper.selectList(queryWrapper);
|
||||
}
|
||||
@ -86,14 +92,13 @@ public class LJUserGradeServiceImpl extends ServiceImpl<LJUserGradeMapper, LJUse
|
||||
@Override
|
||||
public LJUserGrade selectUserGradeByIdAndStoreId(int id) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
LJStore store = storeService.selectStoreByStoreId(nowAccountInfo.getStoreId());
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("store_id",nowAccountInfo.getStoreId());
|
||||
queryWrapper.eq("chain_store_id",store.getChainStoreId());
|
||||
queryWrapper.eq("id",id);
|
||||
return baseMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ILJStoreService storeService;
|
||||
@Autowired
|
||||
private ChainStoreConfigService chainStoreConfigService;
|
||||
@Autowired
|
||||
@ -145,8 +150,9 @@ public class LJUserGradeServiceImpl extends ServiceImpl<LJUserGradeMapper, LJUse
|
||||
|
||||
@Override
|
||||
public LJUserGrade selectUserGradeByStoreId(int storeId) {
|
||||
LJStore store = storeService.selectStoreByStoreId(storeId);
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("store_id",storeId);
|
||||
queryWrapper.eq("chain_store_id",store.getChainStoreId());
|
||||
queryWrapper.orderByAsc("grade");
|
||||
List<LJUserGrade> list = baseMapper.selectList(queryWrapper);
|
||||
return list.get(0);
|
||||
@ -183,11 +189,14 @@ public class LJUserGradeServiceImpl extends ServiceImpl<LJUserGradeMapper, LJUse
|
||||
return 2;
|
||||
}
|
||||
|
||||
LJStore store = storeService.selectStoreByStoreId(storeId);
|
||||
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("store_id",storeId);
|
||||
queryWrapper.eq("chain_store_id",store.getChainStoreId());
|
||||
Integer num = baseMapper.selectCount(queryWrapper);
|
||||
if (num<20){
|
||||
userGrade.setStoreId(storeId);
|
||||
userGrade.setChainStoreId(store.getChainStoreId());
|
||||
row = baseMapper.insert(userGrade);
|
||||
}else {
|
||||
row = 0;
|
||||
@ -195,9 +204,37 @@ public class LJUserGradeServiceImpl extends ServiceImpl<LJUserGradeMapper, LJUse
|
||||
return row;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LJUserGrade> selectUserGradeByChainStoreId(Integer chainStoreId) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("chain_store_id",chainStoreId);
|
||||
return baseMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateUserGrade(LJUserGrade userGrade) {
|
||||
int row = baseMapper.updateById(userGrade);
|
||||
int row = 0;
|
||||
boolean flag = false;
|
||||
LJStore store = storeService.selectStoreByStoreId(userGrade.getStoreId());
|
||||
List<LJUserGrade> ljUserGrades = this.selectUserGradeByChainStoreId(store.getChainStoreId());
|
||||
for (LJUserGrade ljUserGrade : ljUserGrades) {
|
||||
if (ljUserGrade.getGrade().equals(userGrade.getGrade()) && ljUserGrade.getId()!=userGrade.getId()){
|
||||
row = 2;
|
||||
flag = true;
|
||||
}
|
||||
if (ljUserGrade.getName().equals(userGrade.getName()) && ljUserGrade.getId()!=userGrade.getId()){
|
||||
row = 3;
|
||||
flag = true;
|
||||
}
|
||||
if (ljUserGrade.getGrowthValue().equals(userGrade.getGrowthValue()) && ljUserGrade.getId()!=userGrade.getId()){
|
||||
row = 4;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
return row;
|
||||
}
|
||||
row = baseMapper.updateById(userGrade);
|
||||
return row;
|
||||
}
|
||||
}
|
||||
|
@ -253,20 +253,27 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper,SysDept> imple
|
||||
|
||||
QRCode qrCode = new QRCode();
|
||||
iqrCodeService.insertQRCode(qrCode,store.getId());
|
||||
LJUserGrade userGrade = new LJUserGrade();
|
||||
userGrade.setStoreId(store.getId());
|
||||
userGrade.setGrade(1);
|
||||
userGrade.setName("普通会员");
|
||||
userGrade.setStatus("qy");
|
||||
userGrade.setGrowthValue(1);
|
||||
userGrade.setPreferential("自定义优惠");
|
||||
userGrade.setGasolineDiscount("无优惠");
|
||||
userGrade.setGasolineRule("[{\"gasolineRule1\":1,\"gasolineRule2\":1,\"gasolineRule3\":1}]");
|
||||
userGrade.setDieselDiscount("无优惠");
|
||||
userGrade.setDieselRule("[{\"dieselRule1\":1,\"dieselRule2\":1,\"dieselRule3\":1}]");
|
||||
userGrade.setNaturalGasDiscount("无优惠");
|
||||
userGrade.setNaturalGasRule("[{\"naturalGas1\":1,\"naturalGas2\":1,\"naturalGas3\":1}]");
|
||||
userGradeService.insertUserGrade(userGrade,store.getId());
|
||||
|
||||
// 判断当前连锁店是否存在会员等级信息 不存在则添加一个默认的等级
|
||||
List<LJUserGrade> ljUserGrades = userGradeService.selectUserGradeByChainStoreId(chainStoreInfo.getId());
|
||||
if (ljUserGrades.size()==0){
|
||||
LJUserGrade userGrade = new LJUserGrade();
|
||||
userGrade.setStoreId(store.getId());
|
||||
userGrade.setChainStoreId(chainStoreInfo.getId());
|
||||
userGrade.setGrade(1);
|
||||
userGrade.setName("普通会员");
|
||||
userGrade.setStatus("qy");
|
||||
userGrade.setGrowthValue(1);
|
||||
userGrade.setPreferential("自定义优惠");
|
||||
userGrade.setGasolineDiscount("无优惠");
|
||||
userGrade.setGasolineRule("[{\"gasolineRule1\":1,\"gasolineRule2\":1,\"gasolineRule3\":1}]");
|
||||
userGrade.setDieselDiscount("无优惠");
|
||||
userGrade.setDieselRule("[{\"dieselRule1\":1,\"dieselRule2\":1,\"dieselRule3\":1}]");
|
||||
userGrade.setNaturalGasDiscount("无优惠");
|
||||
userGrade.setNaturalGasRule("[{\"naturalGas1\":1,\"naturalGas2\":1,\"naturalGas3\":1}]");
|
||||
userGradeService.insertUserGrade(userGrade,store.getId());
|
||||
}
|
||||
|
||||
|
||||
}else {
|
||||
throw new Exception("数据有误,请联系管理员");
|
||||
|
Loading…
Reference in New Issue
Block a user