Merge remote-tracking branch 'origin/master'

This commit is contained in:
齐天大圣 2023-12-07 14:02:10 +08:00
commit 68c0ab29e7
56 changed files with 1176 additions and 164 deletions

View File

@ -130,9 +130,9 @@
<el-tab-pane label="成长值记录" name="growthValue">
<growthValueRecord :pUserId="form.id"></growthValueRecord>
</el-tab-pane>
<el-tab-pane label="加油金记录" name="refuelMoney">
<refuelMoneyRecord :pUserId="form.id"></refuelMoneyRecord>
</el-tab-pane>
<!-- <el-tab-pane label="加油金记录" name="refuelMoney"> -->
<!-- <refuelMoneyRecord :pUserId="form.id"></refuelMoneyRecord> -->
<!-- </el-tab-pane> -->
</el-tabs>
</template>
</el-card>

View File

@ -43,7 +43,7 @@ images.root=C:/fuintV3.0.1/fuintBackend/fuint-application/target/classes
images.path=/static/uploadImages/
# 上传图片服务器域名
images.upload.url=http://localhost:8008
images.upload.url=http://192.168.1.6:8008
# 上传图片允许的大小单位MB
images.upload.maxSize=5

View File

@ -4,6 +4,10 @@ import com.fuint.api.fuyou.service.FyPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
@RestController
@ -37,6 +41,26 @@ public class FyPayController {
return map;
}
// 接收支付平台异步通知的接口
@PostMapping("/notify")
public String notifyUrl(@RequestBody HttpServletRequest request,@RequestBody HttpServletResponse response) {
System.out.println(request+"111");
System.out.println(response+"222");
// Map paramMap = new HashMap<>();
// Enumeration parameterNames = request.getParameterNames();
// while(parameterNames.hasMoreElements()) {
// String parameterName = (String) parameterNames.nextElement();
// paramMap.put(parameterName, request.getParameter(parameterName));
// }
// boolean isSuccess = processNotify(paramMap); // 处理支付结果并返回成功或失败状态
// if(isSuccess) {
// return "success"; // 返回成功状态通知支付平台异步通知已成功接收
// } else {
// return "fail"; // 返回失败状态通知支付平台异步通知已失败
// }
return "11111111";
}
/**
* 退款 成功 result_msg 显示success
* result_code显示000000

View File

@ -38,7 +38,7 @@ public class Builder {
Calendar calendar = Calendar.getInstance();
// sdf_no.format(calendar.getTime()) + (int) (random.nextDouble() * 100000)
map.put("mchnt_order_no", "");
map.put("curr_type", "");
map.put("curr_type", "CNY");
map.put("order_amt", "1");
map.put("term_ip", Const.term_ip);
SimpleDateFormat sdf_ts = new SimpleDateFormat("yyyyMMddHHmmss");
@ -71,6 +71,49 @@ public class Builder {
return map;
}
/**
* 小程序
*
* @return
*/
public static Map<String, String> buildFuiou23() {
Map<String, String> map = new HashMap<>();
map.put("version", Const.version);
map.put("ins_cd", Const.ins_cd);
map.put("mchnt_cd", Const.mchnt_cd);
map.put("term_id", Const.term_id);
map.put("random_str", randomNumberGenerator.nextBytes().toHex());
map.put("sign", "");
map.put("goods_des", Const.goods_des);
map.put("goods_detail", "");
map.put("goods_tag", "");
map.put("product_id", "");
map.put("addn_inf", "");
map.put("mchnt_order_no", "");
map.put("curr_type", "CNY");
map.put("openid", "");
map.put("order_amt", "1");
map.put("term_ip", Const.term_ip);
Calendar calendar = Calendar.getInstance();
SimpleDateFormat sdf_ts = new SimpleDateFormat("yyyyMMddHHmmss");
map.put("txn_begin_ts",sdf_ts.format(calendar.getTime()));
map.put("notify_url", Const.notify_url);
map.put("limit_pay", "");
map.put("trade_type", Const.trade_type);
map.put("sub_openid", "");
map.put("sub_appid", Const.sub_appid);
map.put("reserved_expire_minute", "1");
map.put("reserved_fy_term_id", "");
map.put("reserved_fy_term_type", "");
map.put("reserved_txn_bonus", "");
map.put("reserved_fy_term_sn", "");
map.put("reserved_device_info", "");
return map;
}
/**
* 退款
*

View File

@ -35,18 +35,23 @@ public class Const {
public static String auth_code = "";
// 交易关闭时间
public static Integer reserved_expire_minute = 1;
// 小程序appid
public static String sub_appid = "wxba517a9bac38fe92";
// 订单类型 小程序等
public static String trade_type = "LETPAY";
//机构公钥
public static String INS_PUBLIC_KEY="";
//异步通知(回调地址)
// public static String notify_url = "https://www.fuint.cn/fuint-application/clientApi/pay/aliPayCallback";
public static String notify_url = "http://www.wrx.cn";
//下单
public static String fuiou_21_url = "https://fundwx.fuiou.com/preCreate";
//扫码
public static String fuiou_22_url = "https://fundwx.fuiou.com/micropay";
//公众号/服务窗统一下单
//公众号/服务窗/小程序统一下单
public static String fuiou_23_url = "https://fundwx.fuiou.com/wxPreCreate";
//退款
public static String fuiou_24_url = "https://fundwx.fuiou.com/commonRefund";

View File

@ -17,6 +17,13 @@ public interface FyPayService {
*/
public Map<String, String> queryOrder(Map<String, String> map) throws Exception;
/**
* 小程序
* @return
* @throws Exception
*/
public Map<String, String> applet(Map<String, String> map) throws Exception;
/**
* 退款
* @return

View File

@ -11,6 +11,7 @@ import com.fuint.api.fuyou.entity.MerchantConfig;
import com.fuint.api.fuyou.entity.Message;
import com.fuint.api.fuyou.service.FyPayService;
import com.fuint.api.fuyou.service.MerchantConfigService;
import com.fuint.api.fuyou.util.HttpUtils;
import com.fuint.api.fuyou.util.Utils;
import com.fuint.business.integral.service.IntegralOrdersService;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
@ -19,14 +20,16 @@ import com.fuint.business.marketingActivity.cardFule.service.CardFuelRecordServi
import com.fuint.business.marketingActivity.cardValue.service.CardValueRecordService;
import com.fuint.business.order.entity.*;
import com.fuint.business.order.service.*;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.net.URLDecoder;
import javax.annotation.Resource;
import java.net.URLEncoder;
import java.util.*;
@Service
@ -297,6 +300,45 @@ public class FyPayServiceImpl implements FyPayService {
return resMap;
}
@Override
public Map<String, String> applet(Map<String, String> map1) throws Exception {
String publicKey = map1.get("publicKey");
String privateKey = map1.get("privateKey");
Const.INS_PUBLIC_KEY = publicKey;
Const.INS_PRIVATE_KEY = privateKey;
String orderNo = map1.get("orderNo");
String payType = "WECHAT";
String allAmount = map1.get("allAmount");
String insCd = map1.get("insCd");
String mchntCd = map1.get("mchntCd");
String goodsDes = map1.get("goodsDes");
Map<String, String> map = Builder.buildFuiou23();
map.put("mchnt_order_no",orderNo);
map.put("order_type",payType);
map.put("order_amt", allAmount);
map.put("ins_cd", insCd);
map.put("mchnt_cd", mchntCd);
map.put("goods_des", goodsDes);
map.put("openid", map1.get("openId"));
// 请求报文
String reqBody = Message.requestMsg(map);
// 响应报文
String rspXml = Message.responseMsg(reqBody,Const.fuiou_23_url);
System.out.println("1+"+reqBody);
System.out.println("2+"+rspXml);
//响应报文验签
Map<String, String> resMap = Utils.xmlStr2Map(rspXml);
String str = resMap.get("sign");
if (Utils.verifySign(resMap, str)){
}
System.out.println(resMap);
return resMap;
}
@Override
public Map<String, String> refund(Map<String, String> map1) throws Exception {
String orderNo = map1.get("orderNo");

View File

@ -0,0 +1,79 @@
package com.fuint.api.fuyou.util;
import com.fuint.api.fuyou.entity.Const;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class HttpUtils {
/**
* 发送 post请求访问本地应用并根据传递参数不同返回不同结果
*/
public void post(String url, Map<String, String> map, StringBuffer result) {
// 创建默认的httpClient实例.
CloseableHttpClient httpclient = HttpClients.createDefault();
// 创建httppost
HttpPost httppost = new HttpPost(url);
// 创建参数队列
List<NameValuePair> formparams = new ArrayList<>();
Iterator it=map.keySet().iterator();
while(it.hasNext()){
String key;
String value;
key=it.next().toString();
value=map.get(key);
formparams.add(new BasicNameValuePair(key, value));
}
UrlEncodedFormEntity uefEntity;
try {
uefEntity = new UrlEncodedFormEntity(formparams, Const.charset);
httppost.setEntity(uefEntity);
System.out.println("提交请求 " + httppost.getURI());
CloseableHttpResponse response = httpclient.execute(httppost);
try {
HttpEntity entity = response.getEntity();
if (entity != null && result != null) {
result.append(EntityUtils.toString(entity, Const.charset));
}
// 打印响应状态
System.out.println(response.getStatusLine());
} finally {
response.close();
}
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
// 关闭连接,释放资源
try {
httpclient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

View File

@ -0,0 +1,48 @@
package com.fuint.api.rocketMQ.test;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.client.producer.SendStatus;
import org.apache.rocketmq.common.message.Message;
import java.util.concurrent.TimeUnit;
/**
* 发送同步消息
*/
public class SyncProducer {
public static void main(String[] args) throws Exception {
//1.创建消息生产者producer并制定生产者组名
DefaultMQProducer producer = new DefaultMQProducer("group1");
//2.指定Nameserver地址
producer.setNamesrvAddr("39.104.58.101:9876");
//3.启动producer
producer.start();
for (int i = 0; i < 10; i++) {
//4.创建消息对象指定主题TopicTag和消息体
/**
* 参数一消息主题Topic
* 参数二消息Tag
* 参数三消息内容
*/
Message msg = new Message("springboot-mq", "Tag1", ("Hello World" + i).getBytes());
//5.发送消息
SendResult result = producer.send(msg);
//发送状态
SendStatus status = result.getSendStatus();
System.out.println("发送结果:" + result);
//线程睡1秒
TimeUnit.SECONDS.sleep(1);
}
//6.关闭生产者producer
producer.shutdown();
}
}

View File

@ -48,6 +48,15 @@ public class IntegralOrdersController extends BaseController {
return getSuccessResult(integralOrdersIPage);
}
@GetMapping("queryByPageUni")
public ResponseObject queryByPageUni(@RequestParam(value = "page",defaultValue = "1") Integer page,
@RequestParam(value = "pageSize",defaultValue = "1000") Integer pageSize,
@Param("integralOrders") IntegralOrdersDTO integralOrders) {
Page pages = new Page(page, pageSize);
IPage<IntegralOrdersVO> integralOrdersIPage = this.integralOrdersService.queryByPageUni(pages, integralOrders);
return getSuccessResult(integralOrdersIPage);
}
/**
* 通过主键查询单条数据

View File

@ -38,6 +38,9 @@ public interface IntegralOrdersMapper {
*/
IPage<IntegralOrdersVO> queryAllByLimit(@Param("page") Page page, @Param("integralOrders") IntegralOrdersDTO integralOrders);
IPage<IntegralOrdersVO> queryByPageUni(@Param("page") Page page, @Param("integralOrders") IntegralOrdersDTO integralOrders);
/**
* 统计总行数
*

View File

@ -37,6 +37,9 @@
<if test="integralDetail.storeId != null">
and store_id = #{integralDetail.storeId}
</if>
<if test="integralDetail.userId != null">
and user_id = #{integralDetail.userId}
</if>
</where>

View File

@ -85,7 +85,6 @@
left join integral_gift ig ON io.gift_id = ig.id
left join mt_user_express_address ea ON io.address_id = ea.id
<where>
io.store_id = #{integralOrders.storeId}
<if test="integralOrders.giftName != null">
and ig.gift_name like CONCAT ('%',#{integralOrders.giftName},'%')
@ -105,6 +104,7 @@
<if test="integralOrders.shippingType != null and integralOrders.shippingType != ''">
and io.shipping_type = #{integralOrders.shippingType}
</if>
<if test="integralOrders.orderStatus != null and integralOrders.orderStatus != '' and integralOrders.orderStatus != 0 ">
and (
(#{integralOrders.orderStatus} = 1 and (io.order_status = '待处理' or io.order_status = '待发货')) or
@ -146,6 +146,79 @@
</select>
<select id="queryByPageUni" resultMap="IntegralOrdersMap">
select
io.id,
io.user_id,
io.order_number,
io.gift_id,
io.shipping_type,
io.amount,
io.integral,
io.come_on,
io.exchange_quantity,
io.order_status,
io.status,
io.order_type,
io.processing_result,
io.notes,
io.store_id,
io.create_time,
io.update_time,
io.courier_companies,
io.the_tracking_number,
mu.mobile,
mu.user_no,
mu.name,
ig.gift_name,
ig.cover_image,
ea.name addrName,
ea.mobile addrMobile,
ea.address
from integral_orders io
left join mt_user mu ON io.user_id = mu.id
left join integral_gift ig ON io.gift_id = ig.id
left join mt_user_express_address ea ON io.address_id = ea.id
<where>
<if test="integralOrders.giftName != null">
and ig.gift_name like CONCAT ('%',#{integralOrders.giftName},'%')
</if>
<if test="integralOrders.mobile != null">
and mu.mobile like CONCAT ('%',#{integralOrders.mobile},'%')
</if>
<if test="integralOrders.params.beginTime != null and integralOrders.params.beginTime != ''">
and date_format(io.create_time,'%y%m%d') &gt;= date_format(#{integralOrders.params.beginTime},'%y%m%d')
</if>
<if test="integralOrders.params.endTime != null and integralOrders.params.endTime != ''">
and date_format(io.create_time,'%y%m%d') &lt;= date_format(#{integralOrders.params.endTime},'%y%m%d')
</if>
<if test="integralOrders.orderStatus != null and integralOrders.orderStatus != '' and integralOrders.orderStatus != 0 ">
and (
(#{integralOrders.orderStatus} = 1 and (io.order_status = '待处理' or io.order_status = '待发货' or io.order_status = '已发货')) or
(#{integralOrders.orderStatus} = 2 and (io.order_status = '已完成')) or
(#{integralOrders.orderStatus} = 3 and (io.order_status = '已退款' or io.order_status = '已拒绝')) or
(#{integralOrders.orderStatus} = 4 and io.order_status = '未支付')
)
</if>
<if test="integralOrders.id != null">
and io.id = #{integralOrders.id}
</if>
<if test="integralOrders.userId != null">
and io.user_id = #{integralOrders.userId}
</if>
<if test="integralOrders.giftId != null">
and io.gift_id = #{integralOrders.giftId}
</if>
<if test="integralOrders.exchangeQuantity != null">
and io.exchange_quantity = #{integralOrders.exchangeQuantity}
</if>
</where>
order by io.create_time desc
</select>
<!-- io.store_id = #{integralOrders.storeId}-->
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)

View File

@ -37,6 +37,9 @@ public interface IntegralOrdersService {
*/
IPage<IntegralOrdersVO> queryByPage(@Param("page") Page page, @Param("integralGift") IntegralOrdersDTO integralOrders);
IPage<IntegralOrdersVO> queryByPageUni(@Param("page") Page page, @Param("integralGift") IntegralOrdersDTO integralOrders);
/**
* 新增数据
*

View File

@ -52,6 +52,8 @@ public class IntegralDetailServiceImpl implements IntegralDetailService {
@Override
public IPage<IntegralDetail> queryByPageUni(@Param("page") Page page, IntegralDetail integralDetail) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
integralDetail.setUserId(nowAccountInfo.getId());
return this.integralDetailMapper.queryAllByLimit(page, integralDetail);
}

View File

@ -80,6 +80,14 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
integralOrders.setStoreId(nowAccountInfo.getStoreId());
return integralOrdersDao.queryAllByLimit(page, integralOrders);
}
@Override
public IPage<IntegralOrdersVO> queryByPageUni(@Param("page") Page page, @Param("integralOrders") IntegralOrdersDTO integralOrders) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
integralOrders.setUserId(nowAccountInfo.getId());
return integralOrdersDao.queryAllByLimit(page, integralOrders);
}
/**
* 新增数据
*

View File

@ -111,5 +111,19 @@ public class CardFuelRecordController extends BaseController {
public ResponseObject checkTheStatusOfYourPaymentByFuel(Integer id) {
return getSuccessResult(this.cardFuelRecordService.checkTheStatusOfYourPaymentByFuel(id));
}
/**
* 查询用户屯油卡充值记录
*/
@GetMapping("selectFuelRecord")
public ResponseObject selectFuelRecord(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelRecord") CardFuelRecord cardFuelRecord) {
Page page = new Page(pageNo, pageSize);
IPage<CardFuelRecordDTO> iPageList = this.cardFuelRecordService.selectFuelRecord(page, cardFuelRecord);
return getSuccessResult(iPageList);
}
}

View File

@ -7,4 +7,7 @@ import lombok.Data;
public class CardFuelRecordDTO extends CardFuelRecord {
private String authCode;
private String recordName;
private String obtain;
}

View File

@ -2,6 +2,7 @@ package com.fuint.business.marketingActivity.cardFule.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardFule.dto.CardFuelRecordDTO;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
@ -81,5 +82,15 @@ public interface CardFuelRecordMapper {
*/
int deleteById(Integer id);
/**
* 查询指定行数据
*
* @param cardFuelRecord 查询条件
* @param page 分页对象
* @return 对象列表
*/
IPage<CardFuelRecordDTO> selectFuelRecord(@Param("page") Page page, CardFuelRecord cardFuelRecord);
}

View File

@ -212,6 +212,7 @@
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into card_fuel_record(mt_user_id, name, mobile, mt_staff_id, real_name, staff_mobile, card_fuel_id, recharge_balance, income_litres, payment_type, remark, points, growth_value, royalty_type, percentage_commissions, amount_commission, create_by, create_time, update_by, update_time, pay_status, store_id, payment_no, type, oil_type,chain_store_id)
@ -348,5 +349,12 @@
delete from card_fuel_record where id = #{id}
</delete>
<select id="selectFuelRecord"
resultType="com.fuint.business.marketingActivity.cardFule.dto.CardFuelRecordDTO">
SELECT '屯油卡' AS recordName, recharge_balance rechargeBalance, income_litres obtain, create_time createTime FROM card_fuel_record
ORDER BY create_time;
</select>
</mapper>

View File

@ -33,6 +33,8 @@ public interface CardFuelRecordService {
*/
IPage<CardFuelRecord> queryByPage(@Param("page") Page page, CardFuelRecord cardFuelRecord);
/**
* 新增数据
*
@ -73,5 +75,9 @@ public interface CardFuelRecordService {
boolean editPayStatus(Integer id, String payStatus);
/**
* 查询用户屯油卡充值记录
*/
IPage<CardFuelRecordDTO> selectFuelRecord(@Param("page") Page page, CardFuelRecord cardFuelRecord);
}

View File

@ -309,4 +309,15 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
return integralDetail;
}
/**
* 查询用户屯油卡充值记录
*/
@Override
public IPage<CardFuelRecordDTO> selectFuelRecord(@Param("page") Page page, CardFuelRecord cardFuelRecord) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
cardFuelRecord.setStoreId(nowAccountInfo.getStoreId());
return this.cardFuelRecordMapper.selectFuelRecord(page, cardFuelRecord);
}
}

View File

@ -112,5 +112,35 @@ public class CardValueRecordController extends BaseController {
public ResponseObject checkTheStatusOfYourPayment(Integer id) {
return getSuccessResult(this.cardValueRecordService.checkTheStatusOfYourPayment(id));
}
/**
* 查询用户的储值充值记录
* @param pageNo
* @param pageSize
* @param cardValueRecord
* @return
*/
@GetMapping("selectCardRecord")
public ResponseObject selectCardRecord(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardValueRecord") CardValueRecordDTO cardValueRecord) {
Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.cardValueRecordService.selectCardRecord(page, cardValueRecord));
}
/**
* 查询用户的储值充值记录 和囤油充值记录
* @param pageNo
* @param pageSize
* @param cardValueRecord
* @return
*/
@GetMapping("selectAllRecord")
public ResponseObject selectAllRecord(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardValueRecord") CardValueRecordDTO cardValueRecord) {
Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.cardValueRecordService.selectAllRecord(page, cardValueRecord));
}
}

View File

@ -8,6 +8,8 @@ import lombok.Data;
*/
@Data
public class CardValueRecordDTO extends CardValueRecord {
private String recordName;
private String obtain;
private String authCode;
private Double realyPayBills;

View File

@ -82,6 +82,16 @@ public class CardValueRecord extends Model<CardValueRecord> {
// 支付编号
private String paymentNo;
//
private Integer chainStoreId;
public Integer getChainStoreId() {
return chainStoreId;
}
public void setChainStoreId(Integer chainStoreId) {
this.chainStoreId = chainStoreId;
}
public String getPaymentNo() {
return paymentNo;
}

View File

@ -1,6 +1,10 @@
package com.fuint.business.marketingActivity.cardValue.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.integral.entity.IntegralDetail;
import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO;
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
import org.apache.ibatis.annotations.Param;
@ -12,5 +16,10 @@ import org.apache.ibatis.annotations.Param;
*/
public interface CardValueRecordMapper extends BaseMapper<CardValueRecord> {
IPage<CardValueRecordDTO> selectCardRecord(@Param("page") Page page,@Param("cardValueRecord") CardValueRecordDTO cardValueRecord);
IPage<CardValueRecordDTO> selectAllRecord(@Param("page") Page page, @Param("cardValueRecord") CardValueRecordDTO cardValueRecord);
}

View File

@ -0,0 +1,41 @@
<?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.marketingActivity.cardValue.mapper.CardValueRecordMapper">
<select id="selectCardRecord"
resultType="com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO">
</select>
<select id="selectAllRecord"
resultType="com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO">
SELECT
combined_result.recordName,
combined_result.rechargeBalance,
combined_result.obtain,
combined_result.createTime,
combined_result.chainStoreId,
combined_result.mtUserId,
combined_result.storeId
FROM
(SELECT '储值卡' AS recordName,mt_user_id mtUserId, recharge_balance rechargeBalance, gift_balance obtain, create_time createTime, chain_store_id chainStoreId, store_id storeId FROM card_value_record
UNION
SELECT '升数卡' AS recordName,mt_user_id mtUserId, recharge_balance rechargeBalance, income_litres obtain, create_time createTime, chain_store_id chainStoreId, store_id storeId FROM card_fuel_record) AS combined_result
<where>
<if test="cardValueRecord.mtUserId != null">
and combined_result.mtUserId = #{cardValueRecord.mtUserId}
</if>
<if test="cardValueRecord.storeId != null">
and combined_result.storeId = #{cardValueRecord.storeId}
</if>
<if test="cardValueRecord.recordName != null">
and combined_result.recordName = #{cardValueRecord.recordName}
</if>
</where>
ORDER BY combined_result.createTime
</select>
</mapper>

View File

@ -1,9 +1,13 @@
package com.fuint.business.marketingActivity.cardValue.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.integral.entity.IntegralDetail;
import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO;
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
import com.fuint.business.petrolStationManagement.entity.OilGun;
import io.lettuce.core.dynamic.annotation.Param;
/**
* 储值充值表(CardValueRecord)表服务接口
@ -33,4 +37,11 @@ public interface CardValueRecordService extends IService<CardValueRecord> {
CardValueRecord checkTheStatusOfYourPayment(Integer id);
boolean editPayStatus(Integer id, String payStatus);
IPage<CardValueRecordDTO> selectCardRecord(@Param("page") Page page, CardValueRecordDTO cardValueRecord);
IPage<CardValueRecordDTO> selectAllRecord(@Param("page") Page page, CardValueRecordDTO cardValueRecord);
}

View File

@ -2,6 +2,8 @@ package com.fuint.business.marketingActivity.cardValue.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
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.api.fuyou.entity.MerchantConfig;
import com.fuint.api.fuyou.service.FyPayService;
@ -24,8 +26,8 @@ import com.fuint.business.userManager.service.UserBalanceService;
import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import io.lettuce.core.dynamic.annotation.Param;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -65,6 +67,9 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
@Resource
CommissionRecordService commissionRecordService;
@Resource
CardValueRecordMapper cardValueRecordMapper;
/**
* 储值卡充值新增
* @param cardValueRecord
@ -279,5 +284,18 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
int i = baseMapper.updateById(cardValueRecord);
return i>0;
}
@Override
public IPage<CardValueRecordDTO> selectCardRecord(@Param("page") Page page, CardValueRecordDTO cardValueRecord) {
return this.cardValueRecordMapper.selectCardRecord(page, cardValueRecord);
}
@Override
public IPage<CardValueRecordDTO> selectAllRecord(@Param("page") Page page, CardValueRecordDTO cardValueRecord) {
return this.cardValueRecordMapper.selectAllRecord(page, cardValueRecord);
}
}

View File

@ -74,6 +74,17 @@ public class OilOrderController extends BaseController {
return getSuccessResult(order);
}
/**
* 小程序支付接口
* @param map
* @return
*/
@PostMapping("/appletPay")
public ResponseObject appletPay(@Validated @RequestBody Map<String,String> map){
orderService.appletPay(map);
return getSuccessResult("success");
}
/**
* 根据订单号查询订单信息
* @param map

View File

@ -1,6 +1,7 @@
package com.fuint.business.order.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fuint.framework.entity.BaseEntity;
@ -117,6 +118,10 @@ public class OilOrder extends BaseEntity implements Serializable {
* 订单备注
*/
private String remark;
/**
* 油罐id
*/
@TableField(exist = false)
private Integer tankId;
}

View File

@ -72,6 +72,12 @@ public interface OilOrderService extends IService<OilOrder> {
*/
public String addOilOrder(OilOrder oilOrder);
/**
* 小程序订单支付
* @param map
*/
public void appletPay(Map<String,String> map);
/**
* 添加油品跟踪信息
* @param oilOrder
@ -79,6 +85,13 @@ public interface OilOrderService extends IService<OilOrder> {
*/
public void addOilTrack(JSONObject oilOrder, Integer storeId);
/**
* 添加油品跟踪信息
* @param oilOrder
* @param storeId
*/
public void addOilTracks(OilOrder oilOrder,Integer storeId);
/**
* 添加油品订单信息
* @param order

View File

@ -18,11 +18,15 @@ import com.fuint.business.order.mapper.OilOrderMapper;
import com.fuint.business.order.service.*;
import com.fuint.business.order.vo.OilOrderVo;
import com.fuint.business.petrolStationManagement.entity.OilName;
import com.fuint.business.petrolStationManagement.entity.OilNumber;
import com.fuint.business.petrolStationManagement.entity.OilTank;
import com.fuint.business.petrolStationManagement.entity.OilTracking;
import com.fuint.business.petrolStationManagement.service.OilNameService;
import com.fuint.business.petrolStationManagement.service.OilNumberService;
import com.fuint.business.petrolStationManagement.service.OilTankService;
import com.fuint.business.petrolStationManagement.service.OilTrackingService;
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.LJUserGrade;
import com.fuint.business.userManager.entity.UserBalance;
@ -146,7 +150,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
// 会员id
userId = Integer.valueOf(map.get("userId"));
this.insertCardBalance(consumeAmount,userId);
this.insertCardBalance(consumeAmount,userId,storeId);
}
// 优惠券id
Integer couponId = null;
@ -271,7 +275,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
}
if (userId!=null){
this.updateGrowthValue(oilActualPay, userId, Integer.valueOf(jsonObjects.get(i).get("oilName").toString()),refuelMoney);
this.updateGrowthValue(oilActualPay, userId, Integer.valueOf(jsonObjects.get(i).get("oilName").toString()),refuelMoney,storeId);
}
order.setStoreId(storeId);
order.setUserId(userId);
@ -378,6 +382,64 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
return orderNo;
}
@Override
public void appletPay(Map<String, String> map) {
String orderNo = map.get("orderNo");
// 支付金额
Integer payAmount = (int) (Double.valueOf(map.get("payAmount"))*100);
// 优惠金额
String discountAmount = map.get("discountAmount");
// 囤油卡消费后的信息
String oilCardAmount = map.get("oilCardAmount");
// 储值卡消费金额
String balanceAmount = map.get("balanceAmount");
Integer tankId = Integer.valueOf(map.get("tankId"));
// 根据订单号查询订单信息
OilOrder oilOrder = this.selectOilOrderByOrderNo(orderNo);
oilOrder.setTankId(tankId);
if (!map.get("payAmount").equals("0")) {
// 调用支付接口
// 判断是否开启支付规则
List<MerchantConfig> list = merchantConfigService.selectMeChByIsOpen();
if (list.size() > 0) {
oilConfigService.oilRule();
}
// 根据店铺id查询商户配置信息
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIsUse("1");
LJUserVo userVo = userService.selectUserById(oilOrder.getUserId());
// 处理支付需要的数据
Map<String, String> map1 = new HashMap<>();
map1.put("allAmount", payAmount.toString());
map1.put("orderNo", oilOrder.getOrderNo());
map1.put("insCd", merchantConfig.getInsCd());
map1.put("mchntCd", merchantConfig.getMchntCd());
map1.put("goodsDes", oilOrder.getOils() + oilOrder.getOilGunNum());
map1.put("publicKey", merchantConfig.getPublicKey());
map1.put("privateKey", merchantConfig.getPrivateKey());
map1.put("discountAmount", discountAmount);
map1.put("oilCardAmount", oilCardAmount);
map1.put("balanceAmount", balanceAmount);
map1.put("openId", userVo.getOpenId());
// 调用支付接口
try {
fyPayService.applet(map1);
} catch (Exception e) {
e.printStackTrace();
}
}else {
this.updateGrowthValue(Double.valueOf(payAmount),oilOrder.getUserId(), 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));
oilOrder.setDiscountAmount(Double.valueOf(discountAmount));
oilOrder.setPayTime(new Date());
oilOrder.setOrderStatus("paid");
baseMapper.updateById(oilOrder);
}
}
@Autowired
private OilTankService oilTankService;
@Autowired
@ -411,6 +473,32 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
oilTankService.update(oilTank);
}
/**
* 添加油品库存跟踪信息
* @param oilOrder
*/
@Override
public void addOilTracks(OilOrder oilOrder,Integer storeId){
OilTank oilTank = oilTankService.queryById(oilOrder.getTankId());
// 添加库存跟踪信息
OilTracking oilTracking = new OilTracking();
oilTracking.setDocument("油品出售");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String timestamp = dateFormat.format(new Date());
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
oilTracking.setOrderNumber(timestamp+randomString);
oilTracking.setQuantityChange(-oilOrder.getOilNum());
oilTracking.setStoreId(storeId);
oilTracking.setTankId(oilOrder.getTankId());
oilTrackingService.insert(oilTracking);
// 修改油罐容量
Double storedQuantity = oilTank.getStoredQuantity();
oilTank.setStoredQuantity(storedQuantity-oilOrder.getOilNum());
oilTankService.update(oilTank);
}
@Override
public int updateOilOrder(OilOrder order) {
int row = baseMapper.updateById(order);
@ -423,19 +511,21 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
private LJUserService userService;
@Autowired
private LJUserGradeService userGradeService;
@Autowired
private ILJStoreService storeService;
/**
* 修改用户成长值信息
*/
private void updateGrowthValue(Double oilActualPay,Integer userid,Integer oilId,String refuelMoney){
private void updateGrowthValue(Double oilActualPay,Integer userid,Integer oilId,String refuelMoney,Integer storeId){
if (oilId!=null){
OilName oilName = oilNameService.selectOilNameById(oilId);
// 获取成长值增长数值
Integer gasGrowthValue = null;
Integer dieselGrowthValue = null;
Integer naturalGrowthValue = null;
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
UserBalance balance = userBalanceService.selectUserBalance(userid,nowAccountInfo.getStoreId());
LJStore store = storeService.selectStoreByStoreId(storeId);
UserBalance balance = userBalanceService.selectUserBalance(userid,store.getChainStoreId());
int growth = balance.getGrowthValue();
balance.setRefuelMoney(refuelMoney);
// 查询会员等级列表信息
@ -492,10 +582,11 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
}
}
private void insertCardBalance(Double amount,Integer userId){
private void insertCardBalance(Double amount,Integer userId,Integer storeId){
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// 根据用户id查询用户余额信息
UserBalance balance = userBalanceService.selectUserBalance(userId,nowAccountInfo.getStoreId());
LJStore store = storeService.selectStoreByStoreId(storeId);
UserBalance balance = userBalanceService.selectUserBalance(userId,store.getChainStoreId());
// 修改余额信息
Double beforeBalance = balance.getCardBalance();
Double afterBalance = beforeBalance - amount;

View File

@ -132,7 +132,9 @@
</select>
<select id="selectOilNumberNameByStoreId" resultType="com.fuint.business.petrolStationManagement.vo.OilNumberNameVo"
parameterType="java.lang.Integer">
select onu.*,ona.oil_type,ona.oil_name oilNames from oil_number onu left join oil_name ona on onu.oil_name = ona.id
select onu.*,ona.oil_type,ona.oil_name oilNames,ot.id tankId from oil_tank ot
left join oil_number onu on ot.number_id = onu.number_id
left join oil_name ona on onu.oil_name = ona.id
<where>
onu.store_id = #{storeId} and onu.state = '启用'
</where>

View File

@ -61,5 +61,13 @@ public interface OilNumberService extends IService<OilNumber> {
* @return
*/
List<OilNumberNameVo> selectOilNumberNameByStoreId(Integer storeId);
/**
* 根据油号和店铺id查询店铺油品信息
* @param oilName
* @param storeId
* @return
*/
OilNumber selectOilNumberByOilName(String oilName,Integer storeId);
}

View File

@ -3,6 +3,7 @@ package com.fuint.business.petrolStationManagement.service.impl;
import cn.hutool.core.util.ObjectUtil;
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;
@ -98,5 +99,14 @@ public class OilNumberServiceImpl extends ServiceImpl<OilNumberMapper, OilNumber
return baseMapper.selectOilNumberNameByStoreId(storeId);
}
@Override
public OilNumber selectOilNumberByOilName(String oilName, Integer storeId) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("oil_name",oilName);
queryWrapper.eq("store_id",storeId);
OilNumber oilNumber = baseMapper.selectOne(queryWrapper);
return oilNumber;
}
}

View File

@ -9,4 +9,6 @@ public class OilNumberNameVo extends OilNumber {
private String oilType;
// 油号
private String oilNames;
// 油罐id
private String tankId;
}

View File

@ -28,7 +28,7 @@ public class LJStoreController extends BaseController {
return getSuccessResult(store);
}
@GetMapping("storeInfoUni")
@GetMapping("storeInfoUni")
public ResponseObject storeInfoUni(Integer storeId){
LJStore store = storeService.selectStoreByIdUni(storeId);
return getSuccessResult(store);

View File

@ -27,6 +27,16 @@ public class ChainStoreConfigController extends BaseController {
return getSuccessResult(chainStoreConfig);
}
/**
* 根据id查询连锁店配置信息
* @return
*/
@GetMapping("chainStoreConfigInfoByChainId")
public ResponseObject chainStoreConfigInfoByChainId(ChainStoreConfig chainStoreConfig){
return getSuccessResult(chainStoreConfigService.chainStoreConfigInfoByChainId(chainStoreConfig));
}
/**
* 修改连锁店配置信息
* @param chainStoreConfig

View File

@ -34,4 +34,10 @@ public class ChainStoreConfig extends BaseEntity implements Serializable {
@ApiModelProperty("等级清算规则")
private String levelClearRule;
/**
* 微信小程序 配置信息
*/
private String wxAppId;
private String wxAppSecret;
}

View File

@ -13,6 +13,8 @@ public interface ChainStoreConfigService extends IService<ChainStoreConfig> {
*/
public ChainStoreConfig selectChainStoreConfigById();
public ChainStoreConfig chainStoreConfigInfoByChainId(ChainStoreConfig chainStoreConfig);
/**
* 根据id修改连锁店配置信息
* @param chainStoreConfig

View File

@ -1,5 +1,6 @@
package com.fuint.business.userManager.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.member.entity.LJStaff;
@ -28,6 +29,17 @@ public class ChainStoreConfigServiceImpl extends ServiceImpl<ChainStoreConfigMap
return baseMapper.selectById(id);
}
/**
* 根据连锁店id查询连锁店配置信息
* @return
*/
@Override
public ChainStoreConfig chainStoreConfigInfoByChainId(ChainStoreConfig chainStoreConfig) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("chain_store_id", chainStoreConfig.getChainStoreId());
return baseMapper.selectOne(queryWrapper);
}
/**
* 根据id修改连锁店配置信息
* @param chainStoreConfig

View File

@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
import com.fuint.business.store.service.StoreService;
import com.fuint.business.storeInformation.entity.LJStore;
import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.business.userManager.entity.ChainStoreConfig;
import com.fuint.business.userManager.service.ChainStoreConfigService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.dto.TokenDto;
import com.fuint.common.dto.UserInfo;
@ -94,6 +96,12 @@ public class ClientSignController extends BaseController {
@Resource
ILJStoreService iljStoreService;
/**
* 连锁店配置信息
*/
@Resource
ChainStoreConfigService chainStoreConfigService;
@Autowired
private Environment env;
@ -113,9 +121,17 @@ public class ClientSignController extends BaseController {
logger.info("微信授权登录参数:{}", param);
JSONObject userInfo = paramsObj.getJSONObject("userInfo");
String storeId = ObjectUtil.isEmpty(userInfo.get("storeId"))? "" : userInfo.get("storeId").toString();
// String staffId = ObjectUtil.isEmpty(userInfo.get("staffId"))? "" : userInfo.get("staffId").toString();
// String inviterId = ObjectUtil.isEmpty(userInfo.get("inviterId"))? "" : userInfo.get("inviterId").toString();
JSONObject loginInfo = weixinService.getWxProfile2(param.get("code").toString()); // 发起的登录请求 merchantId用来获取商户的appid 目前用不到
if ("".equals(storeId)) return getFailureResult(0, "微信登录失败");
// 根据storeId查找对应的连锁店id
LJStore ljStore = iljStoreService.selectStoreByIdUni(Integer.parseInt(storeId));
// todo 获取微信小程序配置信息
ChainStoreConfig chainStoreConfig = new ChainStoreConfig();
chainStoreConfig.setChainStoreId(ljStore.getChainStoreId());
ChainStoreConfig wxConfig = chainStoreConfigService.chainStoreConfigInfoByChainId(chainStoreConfig);
System.out.println("wxConfig"+wxConfig);
// 发起的登录请求
JSONObject loginInfo = weixinService.getWxProfile2(param.get("code").toString());
if (loginInfo == null) {
return getFailureResult(0, "微信登录失败");
}
@ -125,8 +141,7 @@ public class ClientSignController extends BaseController {
return getFailureResult(0, "用户状态异常");
}
// 根据storeId查找对应的连锁店id
LJStore ljStore = iljStoreService.selectStoreByIdUni(Integer.parseInt(storeId));
String userAgent = request.getHeader("user-agent");
AccountInfo accountInfo = new AccountInfo();

View File

@ -1,8 +1,7 @@
# \u57FA\u672C\u914D\u7F6E
server.port=8080
env.profile=dev
env.properties.path=D:/office/proj/oilSystem/fuintBackend/configure/
env.properties.path=D:/code/oilSystem/fuintBackend/configure/
# \u6570\u636E\u5E93\u914D\u7F6E
spring.datasource.type=com.zaxxer.hikari.HikariDataSource

View File

@ -9,6 +9,7 @@ import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.remoting.common.RemotingHelper;
import org.apache.rocketmq.remoting.exception.RemotingException;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -27,63 +28,129 @@ import java.util.List;
public class UserSeriviceTest {
@Test
public void test() throws MQClientException, UnsupportedEncodingException, MQBrokerException, RemotingException, InterruptedException {
//1.创建一个发送消息的对象Producer指定分组生产者分组 等会讲
DefaultMQProducer producer = new DefaultMQProducer("group1");
//2.设定发送的命名服务器地址连接上ns之后才能拿到broker地址发送消息
producer.setNamesrvAddr("39.104.58.101:9876");
//3.1启动发送的服务
producer.start();
//4.创建要发送的消息对象,指定topic指定内容body
Message msg = new Message("topic1","hello rocketmq".getBytes("UTF-8"));
//3.2发送消息这里是同步请求如果broker没有给出响应就拿不到返回值并且卡死在当前行代码
SendResult result = producer.send(msg);
System.out.println("返回结果:"+result);
//5.关闭连接
// //1.创建一个发送消息的对象Producer指定分组生产者分组 等会讲
// DefaultMQProducer producer = new DefaultMQProducer("group1");
//
// //2.设定发送的命名服务器地址连接上ns之后才能拿到broker地址发送消息
// producer.setNamesrvAddr("47.95.206.185:9876");
//
// //3.1启动发送的服务
// producer.start();
//
// //4.创建要发送的消息对象,指定topic指定内容body
// Message msg = new Message("topic1","hello rocketmq".getBytes("UTF-8"));
// //3.2发送消息这里是同步请求如果broker没有给出响应就拿不到返回值并且卡死在当前行代码
// SendResult result = producer.send(msg);
// System.out.println("返回结果:"+result);
// //5.关闭连接
// producer.shutdown();
//Instantiate with a producer group name.
DefaultMQProducer producer = new
DefaultMQProducer("please_rename_unique_group_name");
// Specify name server addresses.
producer.setNamesrvAddr("47.95.206.185:9876");
//Launch the instance.
producer.start();
for (int i = 0; i < 100; i++) {
//Create a message instance, specifying topic, tag and message body.
Message msg = new Message("TopicTest" /* Topic */,
"TagA" /* Tag */,
("Hello RocketMQ " +
i).getBytes(RemotingHelper.DEFAULT_CHARSET) /* Message body */
);
//Call send message to deliver message to one of brokers.
SendResult sendResult = producer.send(msg);
System.out.printf("%s%n", sendResult);
}
//Shut down once the producer instance is not longer in use.
producer.shutdown();
}
@Test
public void consumer() throws MQClientException {
//1.创建一个接收消息的对象Consumer
DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("group1");
//2.设定接收的命名服务器地址
consumer.setNamesrvAddr("39.104.58.101:9876");
//3.设置接收消息对应的topic,对应的sub标签为任意*
// 如果想接收之前topic1的生产者发送的消息这里的就要订阅相同的topic才可以
try {
consumer.subscribe("topic1", "*");
} catch (MQClientException e) {
e.printStackTrace();
}
//4.开启监听用于接收消息
consumer.registerMessageListener(new MessageListenerConcurrently() {
/**
* 设置好监听之后只要有消息出现就会调用 consumeMessage方法
* @param list 所有的消息都会存入该集合供消费者消费
* @param consumeConcurrentlyContext 同时并行消费(多线程)的上下文
* @return
*/
@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> list, ConsumeConcurrentlyContext consumeConcurrentlyContext) {
//遍历消息
for (MessageExt msg : list) {
// System.out.println("收到消息:"+msg);
System.out.println("消息:" + new String(msg.getBody()));
}
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
});
//5.启动接收消息的服务
consumer.start();
System.out.println("接收消息服务已开启运行");
// //1.创建一个接收消息的对象Consumer
// DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("group1");
// //2.设定接收的命名服务器地址
// consumer.setNamesrvAddr("47.95.206.185:9876");
// //3.设置接收消息对应的topic,对应的sub标签为任意*
// // 如果想接收之前topic1的生产者发送的消息这里的就要订阅相同的topic才可以
// try {
// consumer.subscribe("topic1", "*");
// } catch (MQClientException e) {
// e.printStackTrace();
// }
// //4.开启监听用于接收消息
// consumer.registerMessageListener(new MessageListenerConcurrently() {
// /**
// * 设置好监听之后只要有消息出现就会调用 consumeMessage方法
// * @param list 所有的消息都会存入该集合供消费者消费
// * @param consumeConcurrentlyContext 同时并行消费(多线程)的上下文
// * @return
// */
// @Override
// public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> list, ConsumeConcurrentlyContext consumeConcurrentlyContext) {
// //遍历消息
// for (MessageExt msg : list) {
//// System.out.println("收到消息:"+msg);
// System.out.println("消息:" + new String(msg.getBody()));
// }
// return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
// }
// });
// //5.启动接收消息的服务
// consumer.start();
// System.out.println("接收消息服务已开启运行");
// 不能关闭消费者端服务器因为对broker中topic设置了监听
// 该topic中只要有了新消息就要通知消费者消费
// consumer.shutdown();
// Instantiate with specified consumer group name.
DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("please_rename_unique_group_name");
// Specify name server addresses.
consumer.setNamesrvAddr("47.95.206.185:9876");
// Subscribe one more more topics to consume.
consumer.subscribe("TopicTest", "*");
// Register callback to execute on arrival of messages fetched from brokers.
consumer.registerMessageListener(new MessageListenerConcurrently() {
@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs,
ConsumeConcurrentlyContext context) {
System.out.printf("%s Receive New Messages: %s %n", Thread.currentThread().getName(), msgs);
for (MessageExt msg : msgs) {
byte[] body = msg.getBody();
String messageBody = null;
try {
messageBody = new String(body, RemotingHelper.DEFAULT_CHARSET);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
System.out.printf("%s 转成之后的信息: %s%n", Thread.currentThread().getName(), messageBody);
// 在这里添加你的业务逻辑处理消息
}
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
});
//Launch the consumer instance.
consumer.start();
System.out.printf("Consumer Started.%n");
}
}

View File

@ -2279,7 +2279,7 @@
this.map.oilOrder = JSON.stringify(this.oilOrder);
this.map.goodsOrder = JSON.stringify(this.goodsOrder);
this.map.authCode = this.authCode;
this.map.allAmount = (this.oilActualPay + this.goodsActualPay).toFixed(2);
this.map.allAmount = +this.oilActualPay + +this.goodsActualPay
this.map.consumeAmount = this.consumeAmount;
this.updateRefuelMoney();
this.map.refuelMoney = JSON.stringify(this.refuelMoney)

View File

@ -63,7 +63,7 @@
"desc":"您的位置信息将用于获取离您最近的店铺信息"
}
},
"requiredPrivateInfos" : [ "getLocation" ]
"requiredPrivateInfos": ["chooseLocation", "getLocation"]
},
"mp-alipay" : {
"usingComponents" : true

View File

@ -178,7 +178,7 @@
this.storeId = uni.getStorageSync("inviteStoreId")
this.staffId = uni.getStorageSync("inviteStaffId")
}
this.isExistStoreId();
// this.isExistStoreId();
this.getUserAuthority();
this.getOilType();
@ -200,6 +200,8 @@
//
getUserAuthority() {
let _this = this;
// this.getAddress();
wx.getSetting({
success(res) {
if (!res.authSetting['scope.userLocation']) {
@ -232,7 +234,7 @@
}).then((response) => {
_this.store = response.data
let welfare = response.data.welfare
console.log(response.data)
uni.setStorageSync("storeId",response.data.id)
uni.setStorageSync("chainStoreId",response.data.chainStoreId)
if (welfare != undefined && welfare != null && welfare != "") {
if (welfare.includes(",")) {
@ -279,9 +281,16 @@
}
}
})
uni.showToast({
title:"获取位置信息成功"
})
},
fail: function(err) {
_this.getStore(0);
_this.getStore(2);
uni.showToast({
title:"获取位置信息失败"
})
console.log('获取位置信息失败: ' + err.errMsg);
}
});

View File

@ -248,6 +248,7 @@
_this.oilPrice = res.data[0].gbPrice
_this.oilUnit = res.data[0].unit
_this.oilOrder.oils = res.data[0].oilName
uni.setStorageSync("tankId",res.data[0].tankId)
}
})
},
@ -298,10 +299,12 @@
//
getHIndex(index,data) {
this.hindex = index
console.log(data)
this.getOilGun(data.numberId)
this.oilPrice = data.gbPrice
this.oilUnit = data.unit
this.oilOrder.oils = data.oilName
uni.setStorageSync("tankId",data.tankId)
},
//
getQIndex(index,data) {

View File

@ -13,8 +13,8 @@
<view class="title-bai">{{myPoints}}</view>
<view class="size-bai">
<uni-icons type="location" color="#ffffff" size="16"></uni-icons>
<text>蓝鲸加油站总站</text>
<uni-icons type="right" color="#ffffff" size="16"></uni-icons>
<text>{{storeName}}</text>
<!-- <uni-icons type="right" color="#ffffff" size="16"></uni-icons> -->
</view>
</view>
@ -103,6 +103,7 @@
data() {
return {
myPoints: 0,
storeName: '',
categoryList: {},
integralGiftList: {},
title: '',
@ -130,6 +131,8 @@
},
onShow() {
this.getUserInfoList()
//
this.getInfoByStoreId()
},
methods: {
transferIndex(index, categoryId) {
@ -222,6 +225,20 @@
}
})
},
// storeId
getInfoByStoreId() {
request({
url: '/business/storeInformation/store/storeInfoUni',
method: 'get',
params: {
storeId: uni.getStorageSync('storeId')
}
}).then((res) => {
if (res.code == 200) {
this.storeName = res.data.name
}
})
}
},
onUnload() {
uni.$off('goodsInfo')

View File

@ -14,17 +14,21 @@
<view class="gang" v-if="actinput == index"></view>
</view>
</view>
<view class="goods-box">
<view class="goods-box" v-for="(item,index) in orderList">
<view class="goods-top">
<view class="goods-img">
<image src="../../static/imgs/xp.jpg" mode=""></image>
<image :src="baseUrl+item.coverImage" mode=""></image>
</view>
<view class="nr-tip">
<view class="title-s">这是我用积分买的老婆啊啊啊啊啊啊啊啊</view>
<view class="hui-s">165 - 90 嗨丝儿</view>
<view class="title-s">{{item.giftName}}</view>
<view class="hui-s">{{item.createTime}}</view>
<view class="right-size">
<view class="jg">648.00</view>
<view class="">X8</view>
<view class="jg">{{item.amount?"¥"+item.amount:''}}
{{item.amount && item.integral ? '+':''}}
{{item.integral?item.integral+'积分':''}}
</view>
<view class="">X{{item.exchangeQuantity}}</view>
</view>
</view>
</view>
@ -53,10 +57,21 @@
</template>
<script>
import config from '@/config'
import request from '../../utils/request'
export default {
data() {
return {
title: '',
orderList: [],
baseUrl: config.baseUrl,
query: {
orderStatus: '',
chainStoreId: uni.getStorageSync('chainStoreId'),
storeId: uni.getStorageSync('storeId')
},
taplist: [{
title: '全部'
},
@ -66,13 +81,13 @@
{
title: '已完成'
},
{
title: '待支付'
},
{
title: '已退款'
},
{
title: '待支付'
},
],
arrList: ["1"],
@ -81,15 +96,39 @@
},
components: {
},
onShow() {
this.getIntegralOrderList()
},
methods: {
getindex(index) {
this.actinput = index
console.log("index", index)
if (index != 0) {
this.query.orderStatus = index
} else {
this.query.orderStatus = ''
}
this.getIntegralOrderList()
},
goback() {
uni.navigateBack()
}
},
//
getIntegralOrderList() {
request({
url: 'business/integral/integralOrders/queryByPageUni',
method: 'get',
params: this.query
}).then((res) => {
if (res.code == 200) {
this.orderList = res.data.records
}
})
},
}
}
</script>
@ -101,7 +140,7 @@
.container {
width: 100%;
height: 100vh;
height: 100%;
box-sizing: border-box;
padding-top: 88px;
}

View File

@ -20,9 +20,9 @@
<image src="../../static/logo.png" mode=""></image>
</view>
<view class="">
<view class="">蓝鲸加油站总站</view>
<view class="">{{storeName}}</view>
<view class="hui-time">
山东省济南市槐荫区兴福路
{{storeAddress}}
</view>
</view>
@ -111,7 +111,7 @@
<script>
import config from '@/config'
import request from '../../utils/request'
/* import BigNumber from 'bignumber.js'; */
import BigNumber from 'bignumber.js';
export default {
@ -120,6 +120,8 @@
return {
myPoints: 0, //
goodsInfo: '',
storeName: '',
storeAddress: '',
flag: false, //
title: '',
qhindex: 0,
@ -172,6 +174,9 @@
this.transferIndex(0)
// storeId
this.getInfoByStoreId()
},
@ -337,6 +342,21 @@
this.myPoints = res.data.points
}
})
},
// storeId
getInfoByStoreId() {
request({
url: '/business/storeInformation/store/storeInfoUni',
method: 'get',
params: {
storeId: uni.getStorageSync('storeId')
}
}).then((res) => {
if (res.code == 200) {
this.storeName = res.data.name
this.storeAddress = res.data.address
}
})
}
}
}

View File

@ -14,43 +14,62 @@
<view class="gang" :class="{ 'lan' : tindex == index }"></view>
</view>
</view>
<view class="ail">
<view class="ail" v-if="list.length != 0 ">
<view class="box-order" v-for="(item,index) in list" :key="index">
<view class="or-box-top">
<view class="">储值卡</view>
<view class="">{{item.recordName}}</view>
<view class="chengg">充值成功</view>
</view>
<view class="but-box">
<view class="huis">充值金额</view>
<view class="">123</view>
<view class="">{{item.rechargeBalance}}</view>
</view>
<view class="but-box">
<view class="but-box" v-if="item.recordName == '储值卡'">
<view class="huis">优惠合计</view>
<view class="reds">999</view>
<view class="reds">{{item.obtain}}</view>
</view>
<view class="but-box" v-else>
<view class="huis">所得升数</view>
<view class="reds">{{item.obtain}}</view>
</view>
<view class="but-box">
<view class="huis">订单时间</view>
<view class="">20230304</view>
<view class="">{{item.createTime}}</view>
</view>
</view>
</view>
<!-- <u-empty v-if="list.length == 0 " mode="coupon" text="内容为空"
<u-empty v-if="list.length == 0 " mode="coupon" text="内容为空"
icon="http://cdn.uviewui.com/uview/empty/coupon.png">
</u-empty> -->
</u-empty>
<u-loadmore :status="status" v-if="show == true" />
</view>
</view>
</template>
<script>
import config from '@/config'
import request from '../../utils/request'
export default {
data() {
return {
title: '',
tindex: 0,
list: ["1"],
status: 'loading',
totalDetail: '',
show: false,
list: [],
query: {
mtUserId: '',
storeId: '',
recordName: '',
pageNo: 1,
pageSize: 10
},
tapList: [{
text: "全部"
},
@ -69,14 +88,60 @@
components: {
},
onShow() {
this.getAllOrderList()
},
onReachBottom() {
this.show = true
if (this.list.length >= this.totalDetail) {
uni.showToast({
title: '没有下一页数据',
icon: 'none'
})
this.status = "nomore"
} else {
this.query.pageNo++
this.getAllOrderList()
}
},
methods: {
tapindex(index) {
this.tindex = index
if (index == 0) {
this.query.recordName = ''
} else if (index == 1) {
this.query.recordName = '储值卡'
} else if (index == 2) {
this.query.recordName = '升数卡'
}
this.getAllOrderList()
},
goback() {
uni.navigateBack()
}
},
//
getAllOrderList() {
request({
url: 'business/marketingActivity/cardValueRecord/selectAllRecord',
method: 'get',
params: this.query
}).then((res) => {
if (res.code == 200) {
if (this.pageNo != 1) {
this.list = this.list.concat(res.data.records)
} else {
this.list = res.data.records
}
this.totalDetail = res.data.total
this.show = false
uni.hideLoading();
}
})
},
}
}
</script>
@ -88,7 +153,7 @@
.container {
width: 100%;
height: 100vh;
height: 100%;
box-sizing: border-box;
padding-top: 88px;
}

View File

@ -24,7 +24,7 @@
</view>
<view>
<scroll-view scroll-y="true" :scroll-top="scrollTop" id="scrollList" style="height: 80vh;"
<scroll-view scroll-y="true" :scroll-top="scrollTop" id="scrollList" style="height: 78vh;"
@scrolltolower="scrolltolower">
<!-- 列表 -->
<view class="box-order" v-for="(item,index) in list" :key="index">

View File

@ -97,46 +97,107 @@
</view>
</view>
<view class="desc" v-if="fullRedece >= couponRedece && exclusion == 0">
<view style="display: flex;">
<u-collapse>
<u-collapse-item title="满减优惠" :open="true">
<view v-for="(item,index) in fullReduceDiscount" :key="index">
<span v-if="item.discount!=0">
{{item.type}}:{{ item.full }}{{ item.discount }}
</span>
<span v-else>{{ item.full }}{{ item.reduce }}</span>
</view>
</u-collapse-item>
</u-collapse>
<!-- 满减优惠fullReduceDiscount -->
<view v-if="exclusion == 0">
<view class="desc" v-if="fullRedece >= couponRedece && exclusion == 0">
<view style="display: flex;">
<u-collapse>
<u-collapse-item title="满减优惠" :open="true">
<view v-for="(item,index) in fullReduceDiscount" :key="index">
<span v-if="item.discount!=0">
{{item.type}}:{{ item.full }}{{ item.discount }}
</span>
<span v-else>{{ item.full }}{{ item.reduce }}</span>
</view>
</u-collapse-item>
</u-collapse>
<!-- <u-dropdown ref="uDropdown">
<u-dropdown-item title="满减优惠">
<view class="slot-content">
<view class="u-text-center u-content-color u-m-t-20 u-m-b-20">其他自定义内容</view>
<u-button type="primary" @click="closeDropdown">确定</u-button>
</view>
</u-dropdown-item>
</u-dropdown> -->
<!-- 满减优惠fullReduceDiscount -->
</view>
<view style="display: flex;">
<span style="margin-right: 10px;">-{{fullRedece}}</span>
<u-checkbox-group>
<u-checkbox v-model="coupon"></u-checkbox>
</u-checkbox-group>
</view>
</view>
<view style="display: flex;">
<span style="margin-right: 10px;">-{{fullRedece}}</span>
<u-checkbox-group>
<u-checkbox v-model="coupon"></u-checkbox>
</u-checkbox-group>
<view class="desc" v-else-if="fullRedece < couponRedece && exclusion == 0">
<view style="display: flex;">
<u-collapse>
<u-collapse-item title="优惠券" :open="true">
<view v-for="(item,index) in couponDiscount" :key="index">
{{ item.full }}{{ item.reduce }}
</view>
</u-collapse-item>
</u-collapse>
<!-- 优惠券 couponDiscount -->
</view>
<view style="display: flex;">
<span style="margin-right: 10px;">-{{couponRedece}}</span>
<u-checkbox-group>
<u-checkbox v-model="coupon"></u-checkbox>
</u-checkbox-group>
</view>
</view>
</view>
<view class="desc" v-else>
<view style="display: flex;">
<u-collapse>
<u-collapse-item title="优惠券" :open="true">
<view v-for="(item,index) in couponDiscount" :key="index">
{{ item.full }}{{ item.reduce }}
</view>
</u-collapse-item>
</u-collapse>
<!-- 优惠券 couponDiscount -->
<view v-else>
<view class="desc" v-if="fullRedece >= 0">
<view style="display: flex;">
<u-collapse>
<u-collapse-item title="满减优惠" :open="true">
<view v-for="(item,index) in fullReduceDiscount" :key="index">
<span v-if="item.discount!=0">
{{item.type}}:{{ item.full }}{{ item.discount }}
</span>
<span v-else>{{ item.full }}{{ item.reduce }}</span>
</view>
</u-collapse-item>
</u-collapse>
<!-- <u-dropdown ref="uDropdown">
<u-dropdown-item title="满减优惠">
<view class="slot-content">
<view class="u-text-center u-content-color u-m-t-20 u-m-b-20">其他自定义内容</view>
<u-button type="primary" @click="closeDropdown">确定</u-button>
</view>
</u-dropdown-item>
</u-dropdown> -->
<!-- 满减优惠fullReduceDiscount -->
</view>
<view style="display: flex;">
<span style="margin-right: 10px;">-{{fullRedece}}</span>
<u-checkbox-group>
<u-checkbox v-model="coupon"></u-checkbox>
</u-checkbox-group>
</view>
</view>
<view style="display: flex;">
<span style="margin-right: 10px;">-{{couponRedece}}</span>
<u-checkbox-group>
<u-checkbox v-model="coupon"></u-checkbox>
</u-checkbox-group>
<view class="desc" v-if="fullRedece >= 0">
<view style="display: flex;">
<u-collapse>
<u-collapse-item title="优惠券" :open="true">
<view v-for="(item,index) in couponDiscount" :key="index">
{{ item.full }}{{ item.reduce }}
</view>
</u-collapse-item>
</u-collapse>
<!-- 优惠券 couponDiscount -->
</view>
<view style="display: flex;">
<span style="margin-right: 10px;">-{{couponRedece}}</span>
<u-checkbox-group>
<u-checkbox v-model="coupon"></u-checkbox>
</u-checkbox-group>
</view>
</view>
</view>
</view>
<view style="background-color: white;width: 94%;margin: 15px auto;">
@ -158,7 +219,7 @@
</view>
<view style="color: red;font-size: 12px;">应付金额</view>
</view>
<view
<view @click="payment"
style="margin-right: 20px;width: 30%;border-radius:30px;background-color: #1879ff;height: 40px;line-height: 40px;text-align: center;color: white">
确认支付
</view>
@ -231,22 +292,32 @@
}
},
onLoad(e) {
this.orderNo = e.orderNo
// this.orderNo = "20231201114800ebe24b"
// this.orderNo = e.orderNo
this.orderNo = "20231201175248e68558"
},
onShow() {
this.getOilOrder();
this.testPay();
},
components: {
},
methods: {
//
testPay(){
//
payment(){
let map = {
orderNo : "20231201175248e68558",
payAmount : "0.01",
discountAmount : '0',
oilCardAmount : "",
balanceAmount : this.balanceRedece,
// tankId : uni.getStorageSync("tankId"),
tankId : 6,
};
let _this = this;
request({
url: "api/wechat/pay",
url: "business/oilOrder/appletPay",
method: 'post',
data: map,
}).then(res => {
console.log(res)
})
@ -748,7 +819,9 @@
method: 'get',
}).then((res) => {
_this.user = res.data;
_this.refuelMoney = JSON.parse(res.data.refuelMoney)
if (res.data.refuelMoney!=null && res.data.refuelMoney!=""){
_this.refuelMoney = JSON.parse(res.data.refuelMoney)
}
_this.changeRefuelMoney()
_this.getGrade(res.data.gradeId)
_this.preferentialData.oilPrice = _this.oilPrice

View File

@ -103,9 +103,6 @@ try {
uniIcons: function () {
return Promise.all(/*! import() | node-modules/@dcloudio/uni-ui/lib/uni-icons/uni-icons */[__webpack_require__.e("common/vendor"), __webpack_require__.e("node-modules/@dcloudio/uni-ui/lib/uni-icons/uni-icons")]).then(__webpack_require__.bind(null, /*! @dcloudio/uni-ui/lib/uni-icons/uni-icons.vue */ 453))
},
uEmpty: function () {
return Promise.all(/*! import() | uni_modules/uview-ui/components/u-empty/u-empty */[__webpack_require__.e("common/vendor"), __webpack_require__.e("uni_modules/uview-ui/components/u-empty/u-empty")]).then(__webpack_require__.bind(null, /*! @/uni_modules/uview-ui/components/u-empty/u-empty.vue */ 536))
},
}
} catch (e) {
if (
@ -128,15 +125,6 @@ var render = function () {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
var g0 = _vm.list.length
_vm.$mp.data = Object.assign(
{},
{
$root: {
g0: g0,
},
}
)
}
var recyclableRender = false
var staticRenderFns = []
@ -200,12 +188,34 @@ exports.default = void 0;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var _default = {
data: function data() {
return {
title: '',
tindex: 0,
list: [],
list: ["1"],
tapList: [{
text: "全部"
}, {