This commit is contained in:
cun-nan 2024-01-25 15:49:18 +08:00
parent 96af32a2dd
commit 0fe4d0d202
10 changed files with 71 additions and 51 deletions

View File

@ -49,8 +49,8 @@ public class Const {
public static String NOTIFY_PUBLIC_KEYS="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCbBAl3xSB7YeUnze4yYZmnTeT7OtXZr0sP10TsDVRH2SY/VEjgS9KPmHMmVeKZT3+6xKsUvulgVyie46GGtZPrnoh+glF1gzsYAXJ7dvR/R5nYO5VvfwK/ChPFTiKhbTtO4OKtchgBZuqCbsemG+gFIiVJo37dY0Kg0zISmFHdOQIDAQAB";
//异步通知(回调地址)
public static String notify_url = "https://www.tuofeng.cc/oilAdmin/api/fyPay/notify";
// public static String notify_url = "https://8q4f124343.yicp.fun/api/fyPay/notify";
// public static String notify_url = "https://www.tuofeng.cc/oilAdmin/api/fyPay/notify";
public static String notify_url = "https://8q4f124343.yicp.fun/api/fyPay/notify";
//下单
public static String fuiou_21_url = "https://fundwx.fuiou.com/preCreate";

View File

@ -11,6 +11,8 @@ public class ActiveConsumptionVO implements Serializable {
private Integer activeId;
//活动名称
private String activeName;
//适用会员类型 0:全部用户 1全部会员 2等级会员
private String adaptUserType;
//适用会员
private String adaptUser;
//可用油品

View File

@ -841,8 +841,9 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
UserBalance userBalance1 = new UserBalance();
if (CollectionUtils.isNotEmpty(activeConsumptionVOS)){
for (ActiveConsumptionVO activeConsumptionVO : activeConsumptionVOS) {
if (activeConsumptionVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) &&
activeConsumptionVO.getAdaptUser().contains(paymentActiveDTO.getMtUserLevel().toString())){
if (activeConsumptionVO.getAdaptUserType().equals("2") && activeConsumptionVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) &&
activeConsumptionVO.getAdaptUser().contains(paymentActiveDTO.getMtUserLevel().toString()) || activeConsumptionVO.getAdaptUserType().equals("0") && activeConsumptionVO.getOilId().contains(paymentActiveDTO.getOilId().toString())
|| activeConsumptionVO.getAdaptUserType().equals("1") && activeConsumptionVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) && StringUtils.isNotEmpty(paymentActiveDTO.getMtUserLevel().toString())){
//如果满足条件/给当前用户加积分
//用户 (新用户新建 老用户叠加)
if (ObjectUtils.isNotEmpty(userBalance)){
@ -861,7 +862,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
userBalanceService.save(userBalance1);
}
//优惠券
if (activeConsumptionVO.getActiveGift().equals("1")){
if (StringUtils.isNotEmpty(activeConsumptionVO.getActiveGift()) && activeConsumptionVO.getActiveGift().equals("1")){
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();
cardFavorableRecord.setCardFavorableId(activeConsumptionVO.getVouchersId());
cardFavorableRecord.setStoreId(storeId1);
@ -872,7 +873,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
cardFavorableRecord.setExchangeFrom("充值送券");
cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord);
//兑换券
}else if (activeConsumptionVO.getActiveGift().equals("2")){
}else if (StringUtils.isNotEmpty(activeConsumptionVO.getActiveGift()) && activeConsumptionVO.getActiveGift().equals("2")){
CardExchangeRecord cardExchangeRecord = new CardExchangeRecord();
cardExchangeRecord.setCardExchangeId(activeConsumptionVO.getVouchersId());
cardExchangeRecord.setStoreId(storeId1);

View File

@ -232,17 +232,24 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
if (ObjectUtils.isNotEmpty(cardFavorable) && ObjectUtils.isNotEmpty(cardFavorable.getTimeType())) {
if (cardFavorable.getTimeType().equals("0")) {
cardFavorableRecord.setStartTime(new Date());
long endTimeL = new Date().getTime() + cardFavorable.getValidityZero() * 86400000;
cardFavorableRecord.setEndTime(new Date(endTimeL));
LocalDate today = LocalDate.now();
LocalDate localDate = today.plusDays(cardFavorable.getValidityZero());
Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
cardFavorableRecord.setEndTime(from);
} else if (cardFavorable.getTimeType().equals("1")) {
cardFavorableRecord.setStartTime(cardFavorable.getEffectiveDate());
long endTimeM = cardFavorable.getEffectiveDate().getTime() + cardFavorable.getValidityOne() * 86400000;
cardFavorableRecord.setEndTime(new Date(endTimeM));
LocalDate today = LocalDate.now();
LocalDate localDate = today.plusDays(cardFavorable.getValidityOne());
Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
cardFavorableRecord.setEndTime(from);
} else {
long startTimeN = new Date().getTime() + Integer.parseInt(cardFavorable.getValidityDay()) * 86400000L;
long endTimeN = startTimeN + cardFavorable.getValidityTwo() * 86400000L;
cardFavorableRecord.setStartTime(new Date(startTimeN));
cardFavorableRecord.setEndTime(new Date(endTimeN));
LocalDate today = LocalDate.now();
LocalDate localDate = today.plusDays(cardFavorable.getValidityTwo());
LocalDate localDates = today.plusDays(Integer.parseInt(cardFavorable.getValidityDay()));
Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
Date froms = Date.from(localDates.atStartOfDay(ZoneId.systemDefault()).toInstant());
cardFavorableRecord.setStartTime(froms);
cardFavorableRecord.setEndTime(from);
}
}
}

View File

@ -221,7 +221,7 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
IPage<CouponVO> couponVOS = cardFavorableRecordMapper.selectAllByCondition(page,cardFavorableDTOS);
List<CouponVO> records = couponVOS.getRecords();
//有效期
List<CouponVO> collect = records.stream().filter(s -> s.getEndTime().getTime() > System.currentTimeMillis()).collect(Collectors.toList());
List<CouponVO> collect = records.stream().filter(s -> s.getEndTime().getTime() < System.currentTimeMillis()).collect(Collectors.toList());
if (ObjectUtils.isNotEmpty(collect)){
for (CouponVO couponVO : collect) {
CardFavorableRecord cardFavorableRecord = new CardFavorableRecord();

View File

@ -66,7 +66,7 @@
combined_result.mtUserId,
combined_result.storeId,
combined_result.OilName,
combined_result.type
combined_result.type,
combined_result.paymentType
FROM
(SELECT '储值卡' AS recordName,payment_type paymentType,mt_user_id mtUserId, recharge_balance rechargeBalance, gift_balance obtain, fringe_benefit oilName,royalty_type type,create_time createTime, chain_store_id chainStoreId, store_id storeId FROM card_value_record

View File

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.member.entity.LJStaff;
import com.fuint.business.member.mapper.LJStaffMapper;
import com.fuint.business.member.service.ILJStaffService;
import com.fuint.business.member.utils.QrCodeUtils;
import com.fuint.business.storeInformation.entity.LJStore;
import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.common.dto.AccountInfo;
@ -28,10 +29,7 @@ import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@ -240,15 +238,20 @@ public class LJStaffServiceImpl extends ServiceImpl<LJStaffMapper, LJStaff> impl
LJStaff staff = this.selectStaffById(id);
LJStore store = storeService.selectStoreByStoreId(staff.getStoreId());
//在图片上生成二维码
String backgroundImage = "/static/qrCodeImg/laigeyouhui_bg.jpg";
String logoImage = "/static/qrCodeImg/logo.png";
// String backgroundImage = env.getProperty("staff.bg");
// String logoImage = env.getProperty("staff.logo");
String backgroundImage = "static/qrCodeImg/laigeyouhui_bg.jpg";
String logoImage = "static/qrCodeImg/logo.png";
String url = staff.getStaffCode();
String area = store.getName();
String finalPath="D:/ruoyi/qrCode/" + area + ".jpg";
String finalPath="/temp/qrCode/" + area + ".jpg";
InputStream backgroundStream = this.getClass().getClassLoader().getResourceAsStream(backgroundImage);
InputStream logoStream = this.getClass().getClassLoader().getResourceAsStream(logoImage);
//背景图片路径 loge图片 二维码 输出地址
createLogoCodePicture(backgroundImage, logoImage, url, finalPath, area,store.getAddress());
createLogoCodePicture(backgroundStream, logoStream, url, finalPath, area,store.getAddress());
File file1 = new File("/temp/qrCode/");
// 判断目录是否存在
if (!file1.exists()) {
file1.mkdir();
}
File file =new File(finalPath);
FileInputStream fileInputStream =new FileInputStream(file);

View File

@ -9,10 +9,7 @@ import org.springframework.util.ResourceUtils;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.*;
/**
* @Description: QrCodeUtils
@ -24,16 +21,17 @@ public class QrCodeUtils {
/***
* 在一张背景图上添加二维码
*/
public static void createLogoCodePicture(String roundImage, String logoImage, String url, String outImgPath, String storeName, String storeNumber) {
public static void createLogoCodePicture(InputStream backgroundStream, InputStream logoStream, String url, String outImgPath, String storeName, String storeNumber) {
try {
// 读取原图片信息
//得到文件
// File file = ResourceUtils.getFile(roundImage);
ClassPathResource resource = new ClassPathResource(roundImage);
ClassPathResource logoResource = new ClassPathResource(logoImage);
File file = resource.getFile();
//// File file = ResourceUtils.getFile(roundImage);
// ClassPathResource resource = new ClassPathResource(roundImage);
// ClassPathResource logoResource = new ClassPathResource(logoImage);
// File file = resource.getFile();
//文件转化为图片
Image srcImg = ImageIO.read(file);
Image srcImg = ImageIO.read(backgroundStream);
//获取图片的宽
int srcImgWidth = srcImg.getWidth(null);
//获取图片的高
@ -43,7 +41,7 @@ public class QrCodeUtils {
Graphics2D g = bufImg.createGraphics();
g.drawImage(srcImg, 0, 0, srcImgWidth, srcImgHeight, null);
//使用工具类生成二维码
Image image = createQrCode(logoResource.getFile().toString(), url, 360, 360);
Image image = createQrCode(logoStream, url, 360, 360);
//将小图片绘到大图片上,500,300 .表示你的小图片在大图片上的位置
g.drawImage(image, 260, 320, null);
// 设置字体样式字体大小
@ -56,6 +54,11 @@ public class QrCodeUtils {
// g.drawString(storeNumber, 200, 800);
g.dispose();
// 输出图片
File file1 = new File("/temp/qrCode/");
// 判断目录是否存在
if (!file1.exists()) {
file1.mkdir();
}
FileOutputStream outImgStream = new FileOutputStream(outImgPath);
ImageIO.write(bufImg, "jpg", outImgStream);
@ -69,31 +72,30 @@ public class QrCodeUtils {
/**
* 将字符串转为二维码
*
* @param roundImage
* @param url
* @param width
* @param height
* @return
* @throws IOException
*/
private static BufferedImage createQrCode(String roundImage, String url, int width, int height) throws IOException {
private static BufferedImage createQrCode(InputStream logoStream, String url, int width, int height) throws IOException {
QrConfig config = new QrConfig(width, height);
Image image = ImageIO.read(new FileInputStream(roundImage));
Image image = ImageIO.read(logoStream);
config.setImg(image);
config.setMargin(1);
config.setErrorCorrection(ErrorCorrectionLevel.H);
return QrCodeUtil.generate(url, config);
}
public static void main(String[] args) {
//在图片上生成二维码
String backgroundImage = "D:/ruoyi/qrCode/laigeyouhui_bg.jpg";
String logoImage = "D:/ruoyi/qrCode/logo.png";
String url = "https://www.baidu.com";
String area = "来个油慧测试店铺";
String room = "lgyh15487";
String outImgPath = "D:/ruoyi/qrCode/" + area + ".jpg";
//背景图片路径 loge图片 二维码 输出地址 病区 病房号 床号
createLogoCodePicture(backgroundImage, logoImage, url, outImgPath, area, room);
}
// public static void main(String[] args) {
// //在图片上生成二维码
// String backgroundImage = "D:/ruoyi/qrCode/laigeyouhui_bg.jpg";
// String logoImage = "D:/ruoyi/qrCode/logo.png";
// String url = "https://www.baidu.com";
// String area = "来个油慧测试店铺";
// String room = "lgyh15487";
// String outImgPath = "D:/ruoyi/qrCode/" + area + ".jpg";
// //背景图片路径 loge图片 二维码 输出地址 病区 病房号 床号
// createLogoCodePicture(backgroundImage, logoImage, url, outImgPath, area, room);
// }
}

View File

@ -459,13 +459,16 @@
ac.adapt_oil oilId,
ac.points points,
ac.participation_condition_money amount,
ac.adapt_user_type adaptUserType,
acc.active_gift activeGift,
acc.vouchers_id vouchersId
FROM
active_consumption ac
LEFT JOIN active_consumption_child acc ON ac.id = acc.active_consumption_id
where ac.store_id = #{storeId}
and ac.status = 0
and ac.participation_condition_money &lt;= #{amount}
group by ac.id
</select>
<select id="orderStatistics" resultType="java.util.Map">
select count(*) numberOfOilPens,

View File

@ -1330,6 +1330,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
cardBalanceChange.setFromType("油品订单消费");
cardBalanceChange.setBalance(oilAmount - oilActualPay);
cardBalanceChange.setOrderNo(orderNo);
cardBalanceChange.setStoreId(storeId);
cardBalanceChangeService.insertCardBalance(cardBalanceChange);
}
@ -1364,6 +1365,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
cardBalanceChange.setFromType("油品订单消费");
cardBalanceChange.setBalance(amount);
cardBalanceChange.setOrderNo(orderNo);
cardBalanceChange.setStoreId(storeId);
cardBalanceChangeService.insertCardBalance(cardBalanceChange);
}