优化项

This commit is contained in:
cun-nan 2024-01-10 11:06:41 +08:00
parent bbded088aa
commit c076b07a83
28 changed files with 684 additions and 84 deletions

View File

@ -372,10 +372,15 @@ export default {
}
if (this.form.id) {
updateCevGood(this.form).then(response => {
this.$modal.msgSuccess("分类更新成功");
this.open = false;
this.getList();
this.getFirstMenu();
if (response.data==1){
this.$modal.msgSuccess("分类更新成功");
this.open = false;
this.getList();
this.getFirstMenu();
}else {
this.$modal.msgError("分类名称已存在,修改失败");
}
});
} else {
insertCvsGoods(this.form).then(response => {

View File

@ -99,8 +99,10 @@ public class MerchantConfigServiceImpl extends ServiceImpl<MerchantConfigMapper,
@Override
public int updateMerchStatus(MerchantConfig merchantConfig) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("is_use",1);
queryWrapper.eq("store_id",nowAccountInfo.getStoreId());
List<MerchantConfig> list = baseMapper.selectList(queryWrapper);
for (MerchantConfig config : list) {
config.setIsUse("0");
@ -112,7 +114,10 @@ public class MerchantConfigServiceImpl extends ServiceImpl<MerchantConfigMapper,
@Override
public int updateMerchIsOpen(String isOpenRule) {
List<MerchantConfig> list = baseMapper.selectList(null);
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("store_id",nowAccountInfo.getStoreId());
List<MerchantConfig> list = baseMapper.selectList(queryWrapper);
int row = 0;
for (MerchantConfig merchantConfig : list) {
merchantConfig.setIsOpenRule(isOpenRule);

View File

@ -26,7 +26,7 @@ public interface CvsGoodsMapper extends BaseMapper<CvsGoods> {
List<CvsGoodsVo> selectCvsGoodsTreeList(CvsGoods goods);
//根据id和name查找
List<CvsGoods> selectGoodsList(CvsGoods goods);
List<CvsGoods> selectGoodsList(@Param("goods") CvsGoods goods);
void deleteByIdVo(Integer id);

View File

@ -14,14 +14,17 @@
<select id="selectGoodsList" parameterType="com.fuint.business.convenienceSore.entity.CvsGoods" resultType="com.fuint.business.convenienceSore.entity.CvsGoods" >
<include refid="selectCvsGoods"></include>
<where>
<if test="pid != null">
and pid = #{pid}
<if test="goods.storeId != null and goods.storeId != ''">
and store_id = #{goods.storeId}
</if>
<if test="name != null and name != ''">
and name = #{name}
<if test="goods.pid != null">
and pid = #{goods.pid}
</if>
<if test="sorted != null and sorted != ''">
and sorted = #{sorted}
<if test="goods.name != null and goods.name != ''">
and name = #{goods.name}
</if>
<if test="goods.sorted != null and goods.sorted != ''">
and sorted = #{goods.sorted}
</if>
</where>
order by sorted
@ -52,7 +55,7 @@
</if>
<if test="goods.name != null and goods.name!= ''">
and pTable.name like concat('%',#{goods.name},'%')
or cTable.name like concat('%',#{goods.name},'%')
or cTable.name like concat('%',#{goods.name},'%') and cTable.store_id = #{goods.storeId}
</if>
</where>
group by pTable.id

View File

@ -60,4 +60,12 @@ public interface CvsGoodsService extends IService<CvsGoods> {
* @param goods
*/
int updateCvsGood(CvsGoods goods);
/**
* 根据店铺id和分类名称查询分类信息
* @param name
* @param storeId
* @return
*/
CvsGoods selectCvsGoodsByName(String name,Integer storeId);
}

View File

@ -1,6 +1,7 @@
package com.fuint.business.convenienceSore.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -31,6 +32,8 @@ public class CvsGoodsServiceImpl extends ServiceImpl<CvsGoodsMapper,CvsGoods> im
*/
@Transactional
public int insertCvsGoods( CvsGoods cvsGoods){
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
cvsGoods.setStoreId(nowAccountInfo.getStoreId());
//查找分类名称是否存在
List<CvsGoods> cvsGoodsList = baseMapper.selectGoodsList(cvsGoods);
if(CollectionUtil.isNotEmpty(cvsGoodsList)){
@ -186,7 +189,19 @@ public class CvsGoodsServiceImpl extends ServiceImpl<CvsGoodsMapper,CvsGoods> im
*/
@Override
public int updateCvsGood(CvsGoods goods) {
int row = baseMapper.updateById(goods);
CvsGoods cvsGoods = this.selectCvsGoodsByName(goods.getName(), goods.getStoreId());
int row = 0;
if (ObjectUtil.isEmpty(cvsGoods)){
row = baseMapper.updateById(goods);
}
return row;
}
@Override
public CvsGoods selectCvsGoodsByName(String name, Integer storeId) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("name",name);
queryWrapper.eq("store_id",storeId);
return baseMapper.selectOne(queryWrapper);
}
}

View File

@ -64,7 +64,7 @@ public interface CardValueRecordService extends IService<CardValueRecord> {
* 根据用户id查询当前的储值卡信息
* @return
*/
CardValueRecord selectCardValueRecordByUserId();
CardValueRecord selectCardValueRecordByUserId(Integer storeId,Integer userId);
Map<String, String> orderStatistics(CardValueRecordDTO cardValueRecord);

View File

@ -753,10 +753,14 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
}
@Override
public CardValueRecord selectCardValueRecordByUserId() {
public CardValueRecord selectCardValueRecordByUserId(Integer storeId,Integer userId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("mt_user_id",nowAccountInfo.getId());
if (userId==null){
userId = nowAccountInfo.getId();
}
queryWrapper.eq("mt_user_id",userId);
queryWrapper.eq("store_id",storeId);
queryWrapper.last("LIMIT 1");
return baseMapper.selectOne(queryWrapper);
}

View File

@ -69,9 +69,9 @@ public class CardValudChildrensController extends BaseController {
* 根据用户id查询子卡列表信息
* @return
*/
@GetMapping("/list")
public ResponseObject list(){
return getSuccessResult(cardValudChildrensService.selectCardValudChildrensByUserId());
@GetMapping("/list/{storeId}")
public ResponseObject list(@PathVariable Integer storeId){
return getSuccessResult(cardValudChildrensService.selectCardValudChildrensByUserId(storeId));
}
/**

View File

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
@ -15,11 +16,16 @@ import java.io.Serializable;
* @author makejava
* @since 2023-12-18 15:59:36
*/
@Data
@SuppressWarnings("serial")
public class CardValudChildrens extends Model<CardValudChildrens> {
//主键id
@TableId(type = IdType.AUTO)
private Integer id;
//用户id
private Integer userId;
//店铺id
private Integer storeId;
//主卡id
private Integer cardValueId;
//子卡手机号

View File

@ -25,6 +25,14 @@ public interface CardValudChildrensService extends IService<CardValudChildrens>
* 查询当前用户的子卡信息
* @return
*/
List<CardValudChildrens> selectCardValudChildrensByUserId();
List<CardValudChildrens> selectCardValudChildrensByUserId(Integer storeId);
/**
* 根据店铺id和子卡手机号查询子卡信息
* @param mobile
* @param storeId
* @return
*/
CardValudChildrens selectCardValueChildrenByMobileAndStoreId(String mobile,Integer storeId);
}

View File

@ -8,6 +8,14 @@ import com.fuint.business.marketingActivity.cardValue.service.CardValueService;
import com.fuint.business.marketingActivity.cardValueChildrens.mapper.CardValudChildrensMapper;
import com.fuint.business.marketingActivity.cardValueChildrens.entity.CardValudChildrens;
import com.fuint.business.marketingActivity.cardValueChildrens.service.CardValudChildrensService;
import com.fuint.business.storeInformation.entity.LJStore;
import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.service.LJUserService;
import com.fuint.business.userManager.service.UserBalanceService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -26,9 +34,13 @@ import java.util.Map;
@Service("cardValudChildrensService")
public class CardValudChildrensServiceImpl extends ServiceImpl<CardValudChildrensMapper, CardValudChildrens> implements CardValudChildrensService {
@Autowired
private CardValueRecordService cardValueRecordService;
private UserBalanceService userBalanceService;
@Autowired
private LJUserService userService;
@Resource
private CardValueService cardValueService;
@Autowired
private ILJStoreService storeService;
/**
* 新增数据
@ -37,17 +49,19 @@ public class CardValudChildrensServiceImpl extends ServiceImpl<CardValudChildren
*/
@Override
public Map<String,String> add(CardValudChildrens cardValudChildrens) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Map<String,String> res = new HashMap<>();
if (ObjectUtils.isNotEmpty(cardValudChildrens)){
CardValueRecord cardValueRecord = cardValueRecordService.selectCardValueRecordByUserId();
if (ObjectUtils.isNotEmpty(cardValudChildrens)){
if (cardValueRecord.getMobile().equals(cardValudChildrens.getCardChildPhones())){
LJUser user = userService.queryUserByUserId(nowAccountInfo.getId());
LJStore store = storeService.selectStoreByStoreId(cardValudChildrens.getStoreId());
UserBalance balance = userBalanceService.selectUserBalance(nowAccountInfo.getId(), store.getChainStoreId());
if (user.getMobile().equals(cardValudChildrens.getCardChildPhones())){
res.put("error","添加失败,子卡手机号不能与主卡手机号一样!");
return res;
}
cardValudChildrens.setCardValueId(cardValueRecord.getCardValueId());
cardValudChildrens.setCardValueId(balance.getId());
List<CardValudChildrens> list = this.selectCardValudChildrensByUserId();
List<CardValudChildrens> list = this.selectCardValudChildrensByUserId(cardValudChildrens.getStoreId());
if (list.size()>=2){
res.put("error","添加失败,最多只能添加两张子卡!");
return res;
@ -55,7 +69,7 @@ public class CardValudChildrensServiceImpl extends ServiceImpl<CardValudChildren
boolean flag = false;
if (list.size() > 0) {
for (CardValudChildrens childrens : list) {
if (childrens.getCardChildPhones().equals(cardValudChildrens)) {
if (childrens.getCardChildPhones().equals(cardValudChildrens.getCardChildPhones())) {
flag = true;
}
}
@ -64,24 +78,35 @@ public class CardValudChildrensServiceImpl extends ServiceImpl<CardValudChildren
res.put("error", "添加失败,此手机号已存在!");
return res;
}
cardValudChildrens.setUserId(nowAccountInfo.getId());
baseMapper.insert(cardValudChildrens);
res.put("success", "添加成功!");
}
}
}
return res;
}
@Override
public List<CardValudChildrens> selectCardValudChildrensByUserId() {
CardValueRecord cardValueRecord = cardValueRecordService.selectCardValueRecordByUserId();
public List<CardValudChildrens> selectCardValudChildrensByUserId(Integer storeId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
LJStore store = storeService.selectStoreByStoreId(storeId);
UserBalance balance = userBalanceService.selectUserBalance(nowAccountInfo.getId(), store.getChainStoreId());
List<CardValudChildrens> list = null;
if (ObjectUtils.isNotEmpty(cardValueRecord)){
if (ObjectUtils.isNotEmpty(balance)){
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("card_value_id",cardValueRecord.getCardValueId());
queryWrapper.eq("card_value_id",balance.getId());
queryWrapper.eq("store_id",storeId);
list = baseMapper.selectList(queryWrapper);
}
return list;
}
@Override
public CardValudChildrens selectCardValueChildrenByMobileAndStoreId(String mobile, Integer storeId) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("card_child_phones",mobile);
queryWrapper.eq("store_id",storeId);
return baseMapper.selectOne(queryWrapper);
}
}

View File

@ -0,0 +1,34 @@
package com.fuint.business.order.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.order.service.CardValueChildOrderService;
import com.fuint.business.order.vo.CardValueChildOrderVo;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("business/order/cardValueChildOrder")
public class CardValueChildOrderController extends BaseController {
@Autowired
private CardValueChildOrderService cardValueChildOrderService;
/**
* 根据条件分页查询子卡交易订单信息
* @param cardValueChildOrderVo
* @param pageNo
* @param pageSize
* @return
*/
@GetMapping("/list")
public ResponseObject list(CardValueChildOrderVo cardValueChildOrderVo,
@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
Page page =new Page(pageNo,pageSize);
return getSuccessResult(cardValueChildOrderService.selectCardValueChildOrderList(page,cardValueChildOrderVo));
}
}

View File

@ -0,0 +1,78 @@
package com.fuint.business.order.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fuint.framework.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 子卡交易订单表(CardValueChildOrder)实体类
*/
@Data
@TableName("card_value_child_order")
@ApiModel(value = "CardValueChildOrder对象", description = "子卡交易订单表")
public class CardValueChildOrder extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ApiModelProperty("自增ID")
@TableId(value = "ID", type = IdType.AUTO)
private Integer id;
/**
* 储值卡id
*/
private Integer cardValueId;
/**
* 子卡id
*/
private Integer cardValueChildId;
/**
* 用户id
*/
private Integer userId;
/**
* 店铺id
*/
private Integer storeId;
/**
* 连锁店id
*/
private Integer chainStoreId;
/**
* 订单号
*/
private String orderNo;
/**
* 订单金额
*/
private Double amount;
/**
* 优惠金额
*/
private Double discount;
/**
* 支付金额
*/
private Double payAmount;
/**
* 支付时间
*/
private Date payTime;
/**
* 用户备注
*/
private String remark;
/**
* 订单状态
*/
private String status;
}

View File

@ -0,0 +1,18 @@
package com.fuint.business.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.order.entity.CardValueChildOrder;
import com.fuint.business.order.vo.CardValueChildOrderVo;
import org.apache.ibatis.annotations.Param;
public interface CardValueChildOrderMapper extends BaseMapper<CardValueChildOrder> {
/**
* 根据条件分页查询子卡订单信息
* @param page
* @param cardValueChildOrderVo
* @return
*/
IPage<CardValueChildOrderVo> selectCardValueChildOrderList(Page page,@Param("order") CardValueChildOrderVo cardValueChildOrderVo);
}

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuint.business.order.mapper.CardValueChildOrderMapper">
<select id="selectCardValueChildOrderList" resultType="com.fuint.business.order.vo.CardValueChildOrderVo">
select cvco.*,cvc.card_child_phones from card_value_child_order cvco left join card_valud_childrens cvc on cvco.card_value_child_id = cvc.id
<where>
<if test="order.storeId != null and order.storeId != ''">
and cvco.store_id = #{order.storeId}
</if>
<if test="order.cardChildPhones != null and order.cardChildPhones != ''">
and cvc.card_child_phones = #{order.cardChildPhones}
</if>
order by cvco.pay_time desc
</where>
</select>
</mapper>

View File

@ -0,0 +1,37 @@
package com.fuint.business.order.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.order.entity.CardValueChildOrder;
import com.fuint.business.order.vo.CardValueChildOrderVo;
public interface CardValueChildOrderService {
/**
* 根据条件分页查询子卡订单信息
* @param page
* @param cardValueChildOrderVo
* @return
*/
IPage<CardValueChildOrderVo> selectCardValueChildOrderList(Page page, CardValueChildOrderVo cardValueChildOrderVo);
/**
* 根据订单号查询子卡消费订单信息
* @param orderNo
* @return
*/
CardValueChildOrder selectCardValueChildOrderByOrderNo(String orderNo);
/**
* 添加储值卡子卡订单信息
* @param cardValueChildOrder
* @return
*/
int insertCardValueChildOrder(CardValueChildOrder cardValueChildOrder);
/**
* 修改储值卡子卡订单信息
* @param cardValueChildOrder
* @return
*/
int updateCardValueChildOrder(CardValueChildOrder cardValueChildOrder);
}

View File

@ -0,0 +1,57 @@
package com.fuint.business.order.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.cardValueChildrens.entity.CardValudChildrens;
import com.fuint.business.marketingActivity.cardValueChildrens.service.CardValudChildrensService;
import com.fuint.business.order.entity.CardValueChildOrder;
import com.fuint.business.order.mapper.CardValueChildOrderMapper;
import com.fuint.business.order.service.CardValueChildOrderService;
import com.fuint.business.order.vo.CardValueChildOrderVo;
import com.fuint.business.storeInformation.entity.LJStore;
import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.service.LJUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class CardValueChildOrderServiceImpl extends ServiceImpl<CardValueChildOrderMapper,CardValueChildOrder> implements CardValueChildOrderService {
@Autowired
private LJUserService userService;
@Autowired
private ILJStoreService storeService;
@Autowired
private CardValudChildrensService cardValudChildrensService;
@Override
public IPage<CardValueChildOrderVo> selectCardValueChildOrderList(Page page, CardValueChildOrderVo cardValueChildOrderVo) {
return baseMapper.selectCardValueChildOrderList(page,cardValueChildOrderVo);
}
@Override
public CardValueChildOrder selectCardValueChildOrderByOrderNo(String orderNo) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("order_no",orderNo);
return baseMapper.selectOne(queryWrapper);
}
@Override
public int insertCardValueChildOrder(CardValueChildOrder cardValueChildOrder) {
LJUser user = userService.queryUserByUserId(cardValueChildOrder.getUserId());
LJStore store = storeService.selectStoreByStoreId(cardValueChildOrder.getStoreId());
CardValudChildrens cardValudChildrens = cardValudChildrensService.selectCardValueChildrenByMobileAndStoreId(user.getMobile(), cardValueChildOrder.getStoreId());
cardValueChildOrder.setCardValueId(cardValudChildrens.getCardValueId());
cardValueChildOrder.setCardValueChildId(cardValudChildrens.getId());
cardValueChildOrder.setChainStoreId(store.getChainStoreId());
return baseMapper.insert(cardValueChildOrder);
}
@Override
public int updateCardValueChildOrder(CardValueChildOrder cardValueChildOrder) {
return baseMapper.updateById(cardValueChildOrder);
}
}

View File

@ -19,6 +19,8 @@ import com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord;
import com.fuint.business.marketingActivity.cardFule.mapper.CardFuelRecordMapper;
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
import com.fuint.business.marketingActivity.cardValue.mapper.CardValueRecordMapper;
import com.fuint.business.marketingActivity.cardValueChildrens.entity.CardValudChildrens;
import com.fuint.business.marketingActivity.cardValueChildrens.service.CardValudChildrensService;
import com.fuint.business.member.mapper.LJStaffMapper;
import com.fuint.business.order.entity.*;
import com.fuint.business.order.mapper.LJOrderMapper;
@ -701,7 +703,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
public Map<String, Object> appletPay(Map<String, String> map) {
String orderNo = map.get("orderNo");
// 支付金额
Integer payAmount = (int) (Double.valueOf(map.get("payAmount"))*100);
Double payAmount = Double.valueOf(map.get("payAmount"));
// 优惠金额
String discountAmount = map.get("discountAmount");
// 囤油卡消费后的信息
@ -714,12 +716,26 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
String balanceAmount = map.get("balanceAmount");
Integer tankId = Integer.valueOf(map.get("tankId"));
// 是否使用子卡消费
String isUseChildCard = map.get("isUseChildCard");
// 根据订单号查询订单信息
OilOrder oilOrder = this.selectOilOrderByOrderNo(orderNo);
// 获取油品信息
OilNumber oilNumber = oilNumberService.selectOilNumberByOilName(oilOrder.getOils(), oilOrder.getStoreId());
boolean result = false;
Integer userId = oilOrder.getUserId();
if (isUseChildCard.equals("true")){
Map<String, Object> map1 = userService.queryUserByStoreId(oilOrder.getStoreId(), oilOrder.getUserId());
String isUseChild = map1.get("isUseChild").toString();
LJUserVo userVo = (LJUserVo) map1.get("userVo");
userId = userVo.getId();
if (!isUseChild.equals("yes")){
result = true;
}
}
if (isOilStorageCard.equals("true")) {
// 使用囤油卡
@ -752,6 +768,13 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
Map<String, Object> applet = new HashMap<>();
applet.put("success","");
// 判断是否使用储值卡消费
if (!balanceAmount.equals("0")){
this.insertCardBalance(Double.valueOf(balanceAmount),userId,oilOrder.getStoreId());
}
// 判断是否需要调起支付
if (!map.get("payAmount").equals("0")) {
// 调用支付接口
// 判断是否开启支付规则
@ -759,15 +782,17 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
// if (list.size() > 0) {
// oilConfigService.oilRule();
// }
this.insertCardOrder(oilOrder.getUserId(),oilOrder.getStoreId(),orderNo,oilOrder.getOrderAmount(),"unpaid", Double.valueOf(balanceAmount),payAmount);
// 处理支付需要的数据
ReceiveParameter receiveParameter = new ReceiveParameter();
receiveParameter.setOrderNo(orderNo);
receiveParameter.setType("1");
receiveParameter.setContent("油品订单");
receiveParameter.setGoodsMoney(oilOrder.getOrderAmount());
receiveParameter.setGoodsMoney(Double.valueOf(map.get("payAmount")));
receiveParameter.setStoreId(oilOrder.getStoreId());
receiveParameter.setPayType(oilOrder.getPayType());
receiveParameter.setUserId(oilOrder.getUserId());
receiveParameter.setUserId(userId);
// 调用支付接口
try {
applet = fyPayService.applet(receiveParameter);
@ -776,33 +801,84 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
e.printStackTrace();
}
}else {
this.updateGrowthValue(Double.valueOf(payAmount),oilOrder.getUserId(), Integer.valueOf(oilOrder.getOils()),oilCardAmount,oilOrder.getStoreId());
this.updateGrowthValue(payAmount,userId, Integer.valueOf(oilOrder.getOils()),oilCardAmount,oilOrder.getStoreId());
this.addOilTracks(oilOrder,oilOrder.getStoreId());
this.insertCardBalance(Double.valueOf(balanceAmount),oilOrder.getUserId(),oilOrder.getStoreId());
oilOrder.setPayAmount(Double.valueOf(payAmount));
this.insertCardOrder(oilOrder.getUserId(),oilOrder.getStoreId(),orderNo,oilOrder.getOrderAmount(),"paid", Double.valueOf(balanceAmount),payAmount);
oilOrder.setPayAmount(payAmount);
oilOrder.setDiscountAmount(Double.valueOf(discountAmount));
oilOrder.setPayTime(new Date());
oilOrder.setOrderStatus("paid");
baseMapper.updateById(oilOrder);
applet.put("success","ok");
}
// 修改订单的优惠金额和支付金额
oilOrder.setDiscountAmount(Double.valueOf(discountAmount));
oilOrder.setPayAmount(payAmount);
this.updateOilOrder(oilOrder);
return applet;
}
@Autowired
CardValueChildOrderService cardValueChildOrderService;
/**
* 添加储值卡子卡订单信息
* @param userId 用户id
* @param storeId 店铺id
* @param orderNo 订单号
* @param amount 订单金额
* @param payStatus 支付状态
* @param cardAmount 储值卡消费金额
* @param payAmount 其他支付方式消费金额
*/
private void insertCardOrder(Integer userId,Integer storeId,String orderNo,Double amount,String payStatus,Double cardAmount,Double payAmount){
CardValueChildOrder cardValueChildOrder = new CardValueChildOrder();
cardValueChildOrder.setUserId(userId);
cardValueChildOrder.setStoreId(storeId);
cardValueChildOrder.setOrderNo(orderNo);
cardValueChildOrder.setAmount(amount);
cardValueChildOrder.setStatus(payStatus);
cardValueChildOrder.setPayAmount(amount);
cardValueChildOrder.setRemark("储值卡消费"+cardAmount+"元,其他支付方式消费"+payAmount+"");
if ("paid".equals(payStatus)){
cardValueChildOrder.setPayTime(new Date());
}
cardValueChildOrderService.insertCardValueChildOrder(cardValueChildOrder);
}
@Autowired
private CardValudChildrensService cardValudChildrensService;
@Override
public int updateOrderStatus(String orderNo, String status) {
int row = 0;
OilOrder oilOrder = this.selectOilOrderByOrderNo(orderNo);
Integer userId = oilOrder.getUserId();
LJUser user = userService.queryUserByUserId(userId);
if (ObjectUtil.isNotEmpty(oilOrder)){
oilOrder.setPayAmount(oilOrder.getOrderAmount()-oilOrder.getDiscountAmount());
// oilOrder.setPayAmount(oilOrder.getOrderAmount()-oilOrder.getDiscountAmount());
oilOrder.setOrderStatus(status);
if (status.equals("paid")){
oilOrder.setPayTime(new Date());
this.updateGrowthValue(oilOrder.getPayAmount(),oilOrder.getUserId(), Integer.valueOf(oilOrder.getOils()),null,oilOrder.getStoreId());
CardValueChildOrder cardValueChildOrder = cardValueChildOrderService.selectCardValueChildOrderByOrderNo(orderNo);
if (ObjectUtil.isNotEmpty(cardValueChildOrder)){
cardValueChildOrder.setStatus("paid");
cardValueChildOrder.setPayTime(new Date());
cardValueChildOrderService.updateCardValueChildOrder(cardValueChildOrder);
// 查询主卡信息
CardValudChildrens cardValudChildrens = cardValudChildrensService.selectCardValueChildrenByMobileAndStoreId(user.getMobile(), oilOrder.getStoreId());
userId = cardValudChildrens.getUserId();
}
this.updateGrowthValue(oilOrder.getPayAmount(),userId, Integer.valueOf(oilOrder.getOils()),null,oilOrder.getStoreId());
CashierOrder cashierOrder = cashierOrderService.selectCashierOrder(orderNo);
if (ObjectUtil.isNotEmpty(cashierOrder)){
cashierOrder.setPayTime(new Date());
cashierOrder.setStatus("paid");
cashierOrder.setOilDiscountAmount(oilOrder.getDiscountAmount());
cashierOrder.setPayAmount(oilOrder.getPayAmount());
cashierOrderService.updateCashierOrder(cashierOrder);
}
}
@ -955,8 +1031,14 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
}
}
/**
* 修改余额信息
* @param amount
* @param userId
* @param storeId
*/
private void insertCardBalance(Double amount,Integer userId,Integer storeId){
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// 根据用户id查询用户余额信息
LJStore store = storeService.selectStoreByStoreId(storeId);
UserBalance balance = userBalanceService.selectUserBalance(userId,store.getChainStoreId());

View File

@ -0,0 +1,9 @@
package com.fuint.business.order.vo;
import com.fuint.business.order.entity.CardValueChildOrder;
import lombok.Data;
@Data
public class CardValueChildOrderVo extends CardValueChildOrder {
private String cardChildPhones;
}

View File

@ -115,13 +115,15 @@ public class LJUserController extends BaseController {
/**
* 根据storeId查询会员信息
* @param storeId
* @param map
* @return
*/
@GetMapping("/storeUser/{storeId}")
public ResponseObject userVoInfo(@PathVariable Integer storeId){
LJUserVo user = userService.queryUserByStoreId(storeId);
return getSuccessResult(user);
@PostMapping("/storeUser")
public ResponseObject userVoInfo(@RequestBody Map<String,String> map){
Integer storeId = Integer.valueOf(map.get("storeId"));
Integer userId = Integer.valueOf(map.get("userId"));
Map<String, Object> map1 = userService.queryUserByStoreId(storeId, userId);
return getSuccessResult(map1);
}
@GetMapping("/getByUniApp")

View File

@ -58,7 +58,7 @@ public interface LJUserService extends IService<LJUser> {
* @param storeId
* @return
*/
public LJUserVo queryUserByStoreId(int storeId);
public Map<String,Object> queryUserByStoreId(Integer storeId,Integer mobile);
/**
* 根据手机号和连锁店id查询会员信息

View File

@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.cardValueChildrens.entity.CardValudChildrens;
import com.fuint.business.marketingActivity.cardValueChildrens.service.CardValudChildrensService;
import com.fuint.business.storeInformation.entity.LJStore;
import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.business.userManager.entity.*;
@ -20,6 +22,7 @@ import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.StringUtils;
import com.fuint.common.util.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -130,11 +133,24 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
return baseMapper.selectUserById(id);
}
@Autowired
@Lazy
private CardValudChildrensService cardValudChildrensService;
@Override
public LJUserVo queryUserByStoreId(int storeId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
public Map<String,Object> queryUserByStoreId(Integer storeId,Integer userId) {
Map<String,Object> map = new HashMap<>();
LJUser user = baseMapper.selectById(userId);
map.put("isUseChild","no");
CardValudChildrens cardValudChildrens = cardValudChildrensService.selectCardValueChildrenByMobileAndStoreId(user.getMobile(), storeId);
if (ObjectUtil.isNotEmpty(cardValudChildrens)){
userId = cardValudChildrens.getUserId();
map.put("isUseChild","yes");
}
LJStore store = storeService.selectStoreByStoreId(storeId);
return baseMapper.queryUserByChainStoreId(nowAccountInfo.getId(),store.getChainStoreId());
LJUserVo userVo = baseMapper.queryUserByChainStoreId(userId, store.getChainStoreId());
map.put("userVo",userVo);
return map;
}
@Override

View File

@ -223,7 +223,7 @@
if (uni.getStorageSync("storeId")) {
this.storeId = uni.getStorageSync("storeId")
} else {
let storeId = "12";
let storeId = "34";
uni.setStorageSync("storeId", storeId)
}

View File

@ -206,7 +206,7 @@
this.user = res.data
uni.setStorageSync('userId', res.data.id)
this.user.mobile = res.data.mobile.slice(0, 3) + "****" + res.data.mobile.slice(res.data
.mobile.length - 5, res.data.mobile.length - 1)
.mobile.length - 4, res.data.mobile.length)
}
})
},

View File

@ -30,30 +30,84 @@
</view>
</view>
</view> -->
<view class="hong-card" v-for="item in list" :key="item.id">
<view class="top-hang">
<view class="hgang"></view>
<view class="">{{store.name}}{{store.description ? "("+store.description+")" : ""}}</view>
</view>
<view class="title-box">储值卡</view>
<view class="red-bottom">
<view class="x-size">
<view class="">子卡手机号</view>
<view class="">{{item.cardChildPhones}}</view>
<view v-if="tindex==0">
<view class="hong-card" v-for="item in list" :key="item.id" @click="toCheck(item.cardChildPhones)">
<view class="top-hang">
<view class="hgang"></view>
<view class="">{{store.name}}{{store.description ? "("+store.description+")" : ""}}</view>
</view>
<view class="r-anniu">
<span>去完成</span>
<view class="title-box">储值卡</view>
<view class="red-bottom">
<view class="x-size">
<view class="">子卡手机号</view>
<view class="">{{item.cardChildPhones}}</view>
</view>
<view class="r-anniu">
<span>去完成</span>
</view>
</view>
</view>
</view>
<view class="x_anniu" @click="goDetail()">
<uni-icons type="plusempty" color="#fff" size="30"></uni-icons>
<view class="x_anniu" @click="goDetail()">
<uni-icons type="plusempty" color="#fff" size="30"></uni-icons>
</view>
<u-empty v-if="list.length == 0" mode="coupon" text="内容为空"
icon="http://cdn.uviewui.com/uview/empty/coupon.png">
</u-empty>
</view>
<u-empty v-if="list.length == 0" mode="coupon" text="内容为空"
icon="http://cdn.uviewui.com/uview/empty/coupon.png">
</u-empty>
<view v-if="tindex==1">
<scroll-view scroll-y="true" :scroll-top="scrollTop" id="scrollList" style="height: 78vh;"
@scrolltolower="scrolltolower">
<!-- 油品订单列表 -->
<view class="box-order" v-for="(item,index) in orderList" :key="index">
<view class="or-box-top">
<view class="">{{store.name}}</view>
<!-- <view class="chengg">{{getPayName(payList,item.orderStatus)}}</view> -->
<view class="chengg" v-if="item.status=='paid'">已支付</view>
<view class="chengg" v-else-if="item.status=='payFail'">支付失败</view>
<view class="chengg" v-else>未支付</view>
</view>
<!-- <view class="but-box">
<view class="huis">订单类型</view>
<view class="">油品订单</view>
</view> -->
<view class="but-box">
<view class="huis">订单金额</view>
<view class="">{{item.amount}}</view>
</view>
<view class="but-box">
<view class="huis">支付金额</view>
<view class="reds">{{item.payAmount}}</view>
</view>
<view class="but-box">
<view class="huis">订单时间</view>
<view class="" v-if="item.orderStatus=='paid'">{{parseTime(item.payTime)}}</view>
<view class="" v-else>{{item.createTime}}</view>
</view>
<view class="but-box">
<view class="huis">订单备注</view>
<view class="">{{item.remark}}</view>
</view>
<!-- <view v-if="item.orderStatus=='paid'" class="end-box" @click="goComment()">
<view class="anniu">
<text>评价有礼</text>
</view>
</view>
<view v-else-if="item.orderStatus=='unpaid'" class="end-box" @click="goPayment()">
<view class="anniu">
<text>去支付</text>
</view>
</view> -->
</view>
<u-empty v-if="orderList.length == 0" mode="coupon" text="内容为空"
icon="http://cdn.uviewui.com/uview/empty/coupon.png">
</u-empty>
</scroll-view>
</view>
</view>
</view>
</template>
@ -77,6 +131,15 @@
storeId: uni.getStorageSync("storeId"),
//
store:{},
scrollTop: 0,
orderList:[],
map:{
page:1,
pageSize:10,
storeId: uni.getStorageSync("storeId"),
cardChildPhones:'',
},
total:0,
}
},
onShow() {
@ -87,6 +150,46 @@
},
methods: {
//
toCheck(mobile){
this.map.cardChildPhones = mobile;
this.map.page = 1;
this.getMyOrder()
this.tindex = 1;
},
parseTime(dateTime) {
let date = new Date(dateTime);
let y = date.getFullYear() + "-";
let mon = ((date.getMonth() + 1 < 10) ? ('0' + date.getMonth()) : date.getMonth()) + "-";
let d = ((date.getDate() < 10) ? ('0' + date.getDate()) : date.getDate()) + " ";
let h = ((date.getHours() < 10) ? ('0' + date.getHours()) : date.getHours()) + ":";
let m = ((date.getMinutes() < 10) ? ('0' + date.getMinutes()) : date.getMinutes()) + ":";
let s = ((date.getSeconds() < 10) ? ('0' + date.getSeconds()) : date.getSeconds());
return y + mon + d + h + m + s;
},
//
scrolltolower() {
if (this.orderList.length < this.total) {
this.map.page++;
this.getMyOrder()
}
},
getMyOrder(){
request({
url: "business/order/cardValueChildOrder/list",
method: 'get',
params:this.map,
}).then((res) => {
if (res.code == 200) {
if (this.map.page == 1) {
this.orderList = res.data.records
} else {
this.orderList = _this.orderList.concat(res.data.records)
}
this.total = res.data.total
}
})
},
//
getStore(){
request({
@ -100,7 +203,7 @@
//
getCardValueChildren(){
request({
url: "cardValudChildrens/list",
url: "cardValudChildrens/list/"+this.storeId,
method: 'get',
}).then((res) => {
// console.log(res)
@ -109,6 +212,13 @@
},
tapindex(index) {
this.tindex = index
console.log(index);
if (index==0){
this.getCardValueChildren()
}
if (index==1){
this.getMyOrder()
}
},
goDetail() {
uni.navigateTo({
@ -259,4 +369,50 @@
justify-content: center;
background-color: #0000ff;
}
.box-order {
width: 95%;
border-radius: 8px;
background: #ffffff;
box-sizing: border-box;
padding: 10px;
margin: 10px auto;
}
.or-box-top {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 5px 0px;
border-bottom: 1px solid #e5e5e5;
}
.chengg {
color: #1678ff;
}
.but-box {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 5px 0px;
}
.reds {
color: red;
}
.huis {
color: #666666;
}
.end-box {
width: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
}
</style>

View File

@ -30,6 +30,7 @@
title: '',
cardValueChildrens:{
cardChildPhones:"",
storeId:uni.getStorageSync("storeId"),
},
}
},
@ -40,6 +41,7 @@
methods: {
//
submitCardValChildren(){
console.log(this.cardValueChildrens);
if(this.cardValueChildrens.cardChildPhones==""){
uni.showToast({
title:"请填写子卡手机号",
@ -59,8 +61,8 @@
method: 'post',
data:this.cardValueChildrens,
}).then((res) => {
console.log(res)
if (res.data.error != null && res.data.error != undefined && res.data.error != ""){
// console.log(res)
if (res.data.error){
uni.showToast({
title:res.data.error,
icon:"none"

View File

@ -51,7 +51,7 @@
<view class="desc" v-if="isStoreValueCard">
<view style="display: flex;">
储值卡
<span style="display: flex;">(余额{{user.cardBalance}})</span>
<span style="display: flex;">(<span v-if="isUseChildCard">主卡</span>余额{{user.cardBalance}})</span>
</view>
<view style="display: flex;">
<span style="margin-right: 10px;">-{{balanceRedece}}</span>
@ -195,11 +195,12 @@
storeId:uni.getStorageSync("storeId")
},
fixingLevel:{},
isUseChildCard:false,
}
},
onLoad(e) {
this.orderNo = e.orderNo
// this.orderNo = "2345202401061730169a69d8"
// this.orderNo = "234520240109161930c1f4e6"
},
onShow() {
this.getOilOrder();
@ -223,6 +224,7 @@
isOilStorageCard : this.isOilStorageCard,
tankId : uni.getStorageSync("tankId"),
// tankId : 6,
isUseChildCard:this.isUseChildCard,
};
let _this = this;
request({
@ -668,26 +670,37 @@
}
})
},
// 使
chooseCardBalanceChild(){
},
//
countPayMent(){
this.payAmount = this.deductAmount - this.gradeRedece - this.fullRedece - this.couponRedece;
},
// id
// id
getUser(id){
let _this = this;
request({
url: "business/userManager/user/storeUser/" + _this.oilOrder.storeId,
method: 'get',
url: "business/userManager/user/storeUser",
method: 'post',
data:{storeId:_this.oilOrder.storeId,userId:id}
}).then((res) => {
_this.user = res.data;
if (res.data.refuelMoney!=null && res.data.refuelMoney!=""){
_this.refuelMoney = JSON.parse(res.data.refuelMoney)
if (res.data.isUseChild){
_this.isUseChildCard = true
}else{
_this.isUseChildCard = false
}
_this.user = res.data.userVo;
_this.user = res.data.userVo;
if (res.data.userVo.refuelMoney!=null && res.data.userVo.refuelMoney!=""){
_this.refuelMoney = JSON.parse(res.data.userVo.refuelMoney)
_this.chooseRefuelMoney()
}else{
_this.chooseCardBalance(0)
_this.chooseGrade(res.data.gradeId)
_this.chooseGrade(res.data.userVo.gradeId)
}
})
},