Merge remote-tracking branch 'origin/master'

This commit is contained in:
@QQNZX 2024-03-25 09:08:44 +08:00
commit 0f44748599
24 changed files with 1036 additions and 20 deletions

View File

@ -234,11 +234,16 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
*/
@Override
public boolean isDrawDown(CardFavorableRecord cardFavorableRecord) {
boolean isDrawDown = false;
LambdaQueryWrapper<CardFavorable> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(CardFavorable::getStoreId,cardFavorableRecord.getStoreId());
List<CardFavorable> list1 = cardFavorableService.list(queryWrapper1);
boolean isDrawDown = false;
//该店铺所有的优惠券id
ArrayList<Integer> cardFavorableIdList = new ArrayList<>();
/*if (CollectionUtils.isNotEmpty(list1)){
cardFavorableIdList.add(list1.get(0).getId());
}*/
//登录用户信息
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
LambdaQueryWrapper<CardFavorableRecord> queryWrapper = new LambdaQueryWrapper<>();

View File

@ -11,6 +11,7 @@ import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.business.storeInformation.service.impl.LJStoreServiceImpl;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
@ -75,6 +76,7 @@ public class QrCodeUtils {
g.setColor(Color.BLACK);
// 查询当前店铺信息
if (ObjectUtils.isNotEmpty(storeId)){
LJStore store = storeService.selectStoreByStoreId(storeId);
// 查询加油员信息
LJStaff staff = null;
@ -96,6 +98,12 @@ public class QrCodeUtils {
// 店铺地址位置文字绘制到指定位置
// g.drawString(store.getAddress(), returnX(g,bufImg.getWidth(),store.getAddress()), 900);
drawStringWithMultiLine(g,store.getAddress(), bufImg.getWidth()-20,20,940,10 );
}else {
drawStringWithMultiLine(g,"欢迎光临", bufImg.getWidth()-20,20,940,10 );
g.drawString("欢迎光临:", returnX(g, bufImg.getWidth(), "服务监督电话:"), 870);
}
// // 将码牌编号文字绘制到指定位置
// g.drawString(storeNumber, 200, 800);

View File

@ -141,6 +141,7 @@ public class OilOrder extends BaseEntity implements Serializable {
* 退款备注
*/
private String refundRemark;
private String oilTagSn;
/**
* 油罐id
*/

View File

@ -4,8 +4,10 @@ import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.api.fuyou.entity.MerchantConfig;
@ -47,6 +49,9 @@ import com.fuint.business.petrolStationManagement.mapper.OilNumberMapper;
import com.fuint.business.petrolStationManagement.service.*;
import com.fuint.business.storeInformation.entity.LJStore;
import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.business.tag.entity.OilTag;
import com.fuint.business.tag.service.OilTagService;
import com.fuint.business.tag.util.TagUtils;
import com.fuint.business.userManager.entity.ChainStoreConfig;
import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.entity.LJUserGrade;
@ -1075,6 +1080,10 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
oilOrder.setOrderType("主订单");
oilOrder.setInvoicing("未开票");
oilOrder.setUserId(nowAccountInfo.getId());
if (ObjectUtils.isNotEmpty(oilOrder.getOilTagSn())){
String[] split = oilOrder.getOilTagSn().split("=");
oilOrder.setOilTagSn(split[1]);
}
// 判断当前店铺是否存在此用户的会员信息没有的话进行添加
LJStore store = storeService.selectStoreByStoreId(oilOrder.getStoreId());
UserBalance balance = userBalanceService.selectUserBalance(oilOrder.getUserId(), store.getChainStoreId());
@ -1306,6 +1315,11 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
@Autowired
private CardValudChildrensService cardValudChildrensService;
@Resource
private TagUtils tagUtils;
@Resource
private OilTagService oilTagService;
@Override
public int updateOrderStatus(String orderNo, String status) throws Exception {
int row = 0;
@ -1316,6 +1330,26 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
// oilOrder.setPayAmount(oilOrder.getOrderAmount()-oilOrder.getDiscountAmount());
oilOrder.setOrderStatus(status);
if (status.equals("paid")){
HashMap<String, Object> hashMap = new HashMap<>();
String content = "";
//语音播报
if (ObjectUtils.isNotEmpty(oilOrder.getOilTagSn())){
String oilTagSn = oilOrder.getOilTagSn();
if (ObjectUtils.isNotEmpty(oilTagSn)){
LambdaQueryWrapper<OilTag> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OilTag::getTagCodeSn,oilTagSn);
OilTag oilTag = oilTagService.getOne(queryWrapper);
if (ObjectUtils.isNotEmpty(oilTag)){
hashMap.put("devName",oilTag.getSnCode());
}
}
}
String oils = oilOrder.getOils();
OilName oilName = oilNameService.getById(oils);
content = oilOrder.getOilGunNum()+"加油"+oilName.getOilName()+oilName.getOilType()+oilOrder.getOilNum()+"升,共计"+oilOrder.getPayAmount()+"";
hashMap.put("content",content);
tagUtils.voiceBroadcast(hashMap);
//tagUtils
if (ObjectUtil.isNotEmpty(oilOrder.getUserId())) integralSettingsService.refuelPoints(oilOrder);
oilOrder.setPayTime(new Date());
CardValueChildOrder cardValueChildOrder = cardValueChildOrderService.selectCardValueChildOrderByOrderNo(orderNo);

View File

@ -0,0 +1,94 @@
package com.fuint.business.tag.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.tag.entity.OilTag;
import com.fuint.business.tag.service.OilTagService;
import com.fuint.business.tag.util.TagUtils;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.Serializable;
import java.util.HashMap;
/**
* 码牌配置表(OilTag)表控制层
*
* @author makejava
* @since 2024-03-20 14:51:34
*/
@RestController
@RequestMapping("business/tag/oilTag")
public class OilTagController extends BaseController {
/**
* 服务对象
*/
@Resource
private OilTagService oilTagService;
@Resource
private TagUtils tagUtils;
/**
* 分页查询所有数据
* @return 所有数据
*/
@GetMapping
public ResponseObject selectAll(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelDiesel") OilTag oilTag) {
Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.oilTagService.page(page, new QueryWrapper<>(oilTag)));
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseObject selectOne(@PathVariable Serializable id) {
HashMap<String, Object> hashMap = new HashMap<>();
return getSuccessResult(this.oilTagService.getById(id));
}
/**
* 新增数据
*
* @param oilTag 实体对象
* @return 新增结果
*/
@PostMapping
public ResponseObject insert(@RequestBody OilTag oilTag) throws Exception {
return getSuccessResult(this.oilTagService.add(oilTag));
}
/**
* 修改数据
*
* @param oilTag 实体对象
* @return 修改结果
*/
@PutMapping
public ResponseObject update(@RequestBody OilTag oilTag) {
return getSuccessResult(this.oilTagService.updateById(oilTag));
}
/**
* 删除数据
*
* @param id 主键结合
* @return 删除结果
*/
@DeleteMapping("{id}")
public ResponseObject delete(@PathVariable("id") Long id) {
return getSuccessResult(this.oilTagService.removeById(id));
}
}

View File

@ -0,0 +1,89 @@
package com.fuint.business.tag.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.tag.dto.TagCodeDTO;
import com.fuint.business.tag.entity.TagCode;
import com.fuint.business.tag.service.TagCodeService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.Serializable;
/**
* 码牌二维码表(TagCode)表控制层
*
* @author makejava
* @since 2024-03-20 15:30:34
*/
@RestController
@RequestMapping("business/tag/tagCode")
public class TagCodeController extends BaseController {
/**
* 服务对象
*/
@Resource
private TagCodeService tagCodeService;
/**
* 分页查询所有数据
* @return 所有数据
*/
@GetMapping
public ResponseObject selectAll(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelDiesel") TagCode tagCode) {
Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.tagCodeService.page(page, new QueryWrapper<>(tagCode)));
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseObject selectOne(@PathVariable Serializable id) {
return getSuccessResult(this.tagCodeService.getById(id));
}
/**
* 新增数据
*
* @param tagCodeDTO 实体对象
* @return 新增结果
*/
@PostMapping
public ResponseObject insert(@RequestBody TagCodeDTO tagCodeDTO) throws Exception {
return getSuccessResult(this.tagCodeService.add(tagCodeDTO));
}
/**
* 修改数据
*
* @param tagCode 实体对象
* @return 修改结果
*/
@PutMapping
public ResponseObject update(@RequestBody TagCode tagCode) {
return getSuccessResult(this.tagCodeService.updateById(tagCode));
}
/**
* 删除数据
*
* @param id 主键结合
* @return 删除结果
*/
@DeleteMapping("{id}")
public ResponseObject delete(@PathVariable("id") Long id) {
return getSuccessResult(this.tagCodeService.removeById(id));
}
}

View File

@ -0,0 +1,119 @@
package com.fuint.business.tag.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.api.ApiController;
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.tag.dto.TagCodeRecordDTO;
import com.fuint.business.tag.entity.OilTag;
import com.fuint.business.tag.entity.TagCodeRecord;
import com.fuint.business.tag.service.OilTagService;
import com.fuint.business.tag.service.TagCodeRecordService;
import com.fuint.framework.exception.BusinessCheckException;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;
/**
* 码牌绑定记录表(TagCodeRecord)表控制层
*
* @author makejava
* @since 2024-03-20 17:09:30
*/
@RestController
@RequestMapping("business/tag/tagCodeRecord")
public class TagCodeRecordController extends BaseController {
/**
* 服务对象
*/
@Resource
private TagCodeRecordService tagCodeRecordService;
@Resource
private OilTagService oilTagService;
/**
* 分页查询所有数据
* @return 所有数据
*/
@GetMapping
public ResponseObject selectAll(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelDiesel") TagCodeRecord tagCodeRecord) {
Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.tagCodeRecordService.selectTagList(page, tagCodeRecord));
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseObject selectOne(@PathVariable Serializable id) {
return getSuccessResult(this.tagCodeRecordService.getById(id));
}
/**
* 码牌绑定到油站
*
* @param tagCodeRecordDTO 实体对象
* @return 新增结果
*/
@PostMapping
public ResponseObject insert(@RequestBody TagCodeRecordDTO tagCodeRecordDTO) {
return getSuccessResult(this.tagCodeRecordService.add(tagCodeRecordDTO));
}
/**
* 码牌绑定到员工
*
* @param tagCodeRecordDTO 实体对象
* @return 新增结果
*/
@PostMapping("staff")
public ResponseObject insertStaff(@RequestBody TagCodeRecordDTO tagCodeRecordDTO) throws BusinessCheckException {
return getSuccessResult(this.tagCodeRecordService.insertStaff(tagCodeRecordDTO));
}
/**
* 修改数据
*
* @param tagCodeRecord 实体对象
* @return 修改结果
*/
@PutMapping
public ResponseObject update(@RequestBody TagCodeRecord tagCodeRecord) {
TagCodeRecord tagCodeRecord1 = tagCodeRecordService.getById(tagCodeRecord.getId());
tagCodeRecord1.setStaffId("");
tagCodeRecord1.setStaffName("");
this.tagCodeRecordService.updateById(tagCodeRecord1);
//更新码牌绑定员工状态
OilTag oilTag = new OilTag();
oilTag.setId(tagCodeRecord1.getOilTagId());
oilTag.setMtStatus("0");
oilTagService.updateById(oilTag);
return getSuccessResult(true);
}
/**
* 删除数据
*
* @param id 主键结合
* @return 删除结果
*/
@DeleteMapping("id")
public ResponseObject delete(@PathVariable Long id) {
return getSuccessResult(this.tagCodeRecordService.removeById(id));
}
}

View File

@ -0,0 +1,12 @@
package com.fuint.business.tag.dto;
import com.fuint.business.tag.entity.TagCode;
import lombok.Data;
import java.io.Serializable;
@Data
public class TagCodeDTO extends TagCode implements Serializable {
//生成数量
private int total;
}

View File

@ -0,0 +1,13 @@
package com.fuint.business.tag.dto;
import com.fuint.business.tag.entity.TagCodeRecord;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class TagCodeRecordDTO extends TagCodeRecord implements Serializable {
private List<Integer> oilTagList;
private String status;
}

View File

@ -0,0 +1,48 @@
package com.fuint.business.tag.entity;
import java.util.Date;
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;
/**
* 码牌配置表(OilTag)表实体类
*
* @author makejava
* @since 2024-03-20 14:51:34
*/
@SuppressWarnings("serial")
@Data
public class OilTag extends Model<OilTag> {
//主键id
@TableId(type = IdType.AUTO)
private Integer id;
//二维码id
private Integer tagCodeId;
//二维码SN号
private String tagCodeSn;
//厂家名字
private String companyName;
//码牌SN号
private String snCode;
//是否已绑定油站 0未绑定 1已绑定
private String status;
//是否已绑定员工 0未绑定 1已绑定
private String mtStatus;
//创建者
private String createBy;
//创建时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private Date createTime;
//更新者
private String updateBy;
//更新时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private Date updateTime;
}

View File

@ -0,0 +1,42 @@
package com.fuint.business.tag.entity;
import java.util.Date;
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;
/**
* 码牌二维码表(TagCode)表实体类
*
* @author makejava
* @since 2024-03-20 15:30:34
*/
@SuppressWarnings("serial")
@Data
public class TagCode extends Model<TagCode> {
//主键id
@TableId(type = IdType.AUTO)
private Integer id;
//二维码SN号
private String tagCodeSn;
//图片地址
private String imageUrl;
//码牌二维码域名+字符串
private String collection;
//创建时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private Date createTime;
//更新时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private Date updateTime;
//创建用户
private String createBy;
//修改用户
private String updateBy;
}

View File

@ -0,0 +1,48 @@
package com.fuint.business.tag.entity;
import java.util.Date;
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;
/**
* 码牌绑定记录表(TagCodeRecord)表实体类
*
* @author makejava
* @since 2024-03-20 17:09:30
*/
@SuppressWarnings("serial")
@Data
public class TagCodeRecord extends Model<TagCodeRecord> {
//主键id
@TableId(type = IdType.AUTO)
private Integer id;
//所属连锁店id
private Integer chainStorId;
//店铺id
private Integer storeId;
//油站名称
private String storeName;
//码牌id
private Integer oilTagId;
//员工id
private String staffId;
//员工名字
private String staffName;
//创建时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private Date createTime;
//更新时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private Date updateTime;
//创建用户
private String createBy;
//修改用户
private String updateBy;
}

View File

@ -0,0 +1,15 @@
package com.fuint.business.tag.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.tag.entity.OilTag;
/**
* 码牌配置表(OilTag)表数据库访问层
*
* @author makejava
* @since 2024-03-20 14:51:34
*/
public interface OilTagMapper extends BaseMapper<OilTag> {
}

View File

@ -0,0 +1,15 @@
package com.fuint.business.tag.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.tag.entity.TagCode;
/**
* 码牌二维码表(TagCode)表数据库访问层
*
* @author makejava
* @since 2024-03-20 15:30:34
*/
public interface TagCodeMapper extends BaseMapper<TagCode> {
}

View File

@ -0,0 +1,20 @@
package com.fuint.business.tag.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.tag.entity.TagCodeRecord;
import com.fuint.business.tag.vo.TagCodeRecordVO;
import org.apache.ibatis.annotations.Param;
/**
* 码牌绑定记录表(TagCodeRecord)表数据库访问层
*
* @author makejava
* @since 2024-03-20 17:09:30
*/
public interface TagCodeRecordMapper extends BaseMapper<TagCodeRecord> {
IPage<TagCodeRecordVO> selectTagList(Page page, @Param("tagCodeRecord") TagCodeRecord tagCodeRecord);
}

View File

@ -0,0 +1,26 @@
<?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.tag.mapper.TagCodeRecordMapper">
<sql id="selectTagListsq">
SELECT
ot.*,
tc.image_url,
tc.collection,
tcr.store_id,
tcr.store_name,
tcr.staff_name
from oil_tag ot
left join tag_code_record tcr on tcr.oil_tag_id = ot.id
left join tag_code tc on ot.tag_code_id = tc.id
</sql>
<select id="selectTagList" resultType="com.fuint.business.tag.vo.TagCodeRecordVO">
<include refid="selectTagListsq"></include>
<where>
<if test="tagCodeRecord.storeId != null and tagCodeRecord.storeId != ''">
and tcr.store_id = #{tagCodeRecord.storeId}
</if>
</where>
order by tcr.create_time desc
</select>
</mapper>

View File

@ -0,0 +1,19 @@
package com.fuint.business.tag.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.tag.entity.OilTag;
import java.io.FileNotFoundException;
import java.io.IOException;
/**
* 码牌配置表(OilTag)表服务接口
*
* @author makejava
* @since 2024-03-20 14:51:34
*/
public interface OilTagService extends IService<OilTag> {
boolean add(OilTag oilTag) throws Exception;
}

View File

@ -0,0 +1,27 @@
package com.fuint.business.tag.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.tag.dto.TagCodeRecordDTO;
import com.fuint.business.tag.entity.TagCodeRecord;
import com.fuint.business.tag.vo.TagCodeRecordVO;
import com.fuint.framework.exception.BusinessCheckException;
import java.util.List;
/**
* 码牌绑定记录表(TagCodeRecord)表服务接口
*
* @author makejava
* @since 2024-03-20 17:09:30
*/
public interface TagCodeRecordService extends IService<TagCodeRecord> {
boolean add(TagCodeRecordDTO tagCodeRecordDTO);
IPage<TagCodeRecordVO> selectTagList(Page page, TagCodeRecord tagCodeRecord);
boolean insertStaff(TagCodeRecordDTO tagCodeRecordDTO) throws BusinessCheckException;
}

View File

@ -0,0 +1,19 @@
package com.fuint.business.tag.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.tag.dto.TagCodeDTO;
import com.fuint.business.tag.entity.TagCode;
import java.io.FileNotFoundException;
/**
* 码牌二维码表(TagCode)表服务接口
*
* @author makejava
* @since 2024-03-20 15:30:34
*/
public interface TagCodeService extends IService<TagCode> {
boolean add(TagCodeDTO tagCodeDTO) throws Exception;
}

View File

@ -0,0 +1,45 @@
package com.fuint.business.tag.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.member.utils.QrCodeUtils;
import com.fuint.business.tag.entity.TagCode;
import com.fuint.business.tag.mapper.OilTagMapper;
import com.fuint.business.tag.entity.OilTag;
import com.fuint.business.tag.mapper.TagCodeMapper;
import com.fuint.business.tag.service.OilTagService;
import com.fuint.business.tag.service.TagCodeService;
import com.fuint.module.backendApi.controller.BackendFileController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.*;
/**
* 码牌配置表(OilTag)表服务实现类
*
* @author makejava
* @since 2024-03-20 14:51:34
*/
@Service("oilTagService")
public class OilTagServiceImpl extends ServiceImpl<OilTagMapper, OilTag> implements OilTagService {
@Resource
private TagCodeService tagCodeService;
@Override
public boolean add(OilTag oilTag) throws Exception {
LambdaQueryWrapper<TagCode> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TagCode::getTagCodeSn, oilTag.getTagCodeSn());
TagCode tagCode = tagCodeService.getOne(queryWrapper);
//TagCode tagCode = tagCodeService.getById(oilTag.getTagCodeId());
oilTag.setTagCodeId(tagCode.getId());
return save(oilTag);
}
}

View File

@ -0,0 +1,110 @@
package com.fuint.business.tag.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.member.entity.LJStaff;
import com.fuint.business.member.service.ILJStaffService;
import com.fuint.business.store.entity.MtStore;
import com.fuint.business.store.service.StoreService;
import com.fuint.business.tag.dto.TagCodeRecordDTO;
import com.fuint.business.tag.entity.OilTag;
import com.fuint.business.tag.mapper.TagCodeRecordMapper;
import com.fuint.business.tag.entity.TagCodeRecord;
import com.fuint.business.tag.service.OilTagService;
import com.fuint.business.tag.service.TagCodeRecordService;
import com.fuint.business.tag.vo.TagCodeRecordVO;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.service.StaffService;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.exception.BusinessCheckException;
import com.fuint.repository.model.MtStaff;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
* 码牌绑定记录表(TagCodeRecord)表服务实现类
*
* @author makejava
* @since 2024-03-20 17:09:30
*/
@Service("tagCodeRecordService")
public class TagCodeRecordServiceImpl extends ServiceImpl<TagCodeRecordMapper, TagCodeRecord> implements TagCodeRecordService {
@Resource
private OilTagService oilTagService;
@Resource
private TagCodeRecordMapper tagCodeRecordMapper;
@Resource
private StoreService storeService;
@Resource
private ILJStaffService mtStaffService;
@Override
@Transactional
public boolean add(TagCodeRecordDTO tagCodeRecordDTO) {
boolean flag = false;
TagCodeRecord tagCodeRecord = new TagCodeRecord();
if (ObjectUtils.isNotEmpty(tagCodeRecordDTO) && CollectionUtils.isNotEmpty(tagCodeRecordDTO.getOilTagList())){
for (Integer integer : tagCodeRecordDTO.getOilTagList()) {
OilTag oilTag = new OilTag();
//码牌绑定店铺
tagCodeRecord.setOilTagId(integer);
if (ObjectUtils.isNotEmpty(tagCodeRecordDTO.getChainStorId())){
tagCodeRecord.setChainStorId(tagCodeRecordDTO.getChainStorId());
}
if (ObjectUtils.isNotEmpty(tagCodeRecordDTO.getStoreId())){
tagCodeRecord.setStoreId(tagCodeRecordDTO.getStoreId());
MtStore mtStore = storeService.getById(tagCodeRecordDTO.getStoreId());
tagCodeRecord.setStoreName(mtStore.getName());
}
flag = save(tagCodeRecord);
//更新码牌绑定状态
oilTag.setId(integer);
oilTag.setStatus(tagCodeRecordDTO.getStatus());
flag = oilTagService.updateById(oilTag);
}
}
return flag;
}
@Override
public IPage<TagCodeRecordVO> selectTagList(Page page, TagCodeRecord tagCodeRecord) {
return tagCodeRecordMapper.selectTagList(page,tagCodeRecord);
}
@Override
@Transactional
public boolean insertStaff(TagCodeRecordDTO tagCodeRecordDTO) throws BusinessCheckException {
//根据码牌id查询
LambdaQueryWrapper<TagCodeRecord> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TagCodeRecord::getOilTagId,tagCodeRecordDTO.getOilTagId());
TagCodeRecord tagCodeRecord = getOne(queryWrapper);
//绑定员工
if (ObjectUtils.isNotEmpty(tagCodeRecordDTO) && ObjectUtils.isNotEmpty(tagCodeRecordDTO.getStaffId())){
LJStaff ljStaff = mtStaffService.selectStaffById(Integer.parseInt(tagCodeRecordDTO.getStaffId()));
tagCodeRecord.setStaffId(tagCodeRecordDTO.getStaffId());
tagCodeRecord.setStaffName(ljStaff.getRealName());
//更新码牌记录表
updateById(tagCodeRecord);
//更新码牌绑定员工状态
OilTag oilTag = new OilTag();
oilTag.setId(tagCodeRecordDTO.getOilTagId());
oilTag.setMtStatus("1");
oilTagService.updateById(oilTag);
}
return false;
}
}

View File

@ -0,0 +1,83 @@
package com.fuint.business.tag.service.impl;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.member.utils.QrCodeUtils;
import com.fuint.business.tag.dto.TagCodeDTO;
import com.fuint.business.tag.mapper.TagCodeMapper;
import com.fuint.business.tag.entity.TagCode;
import com.fuint.business.tag.service.TagCodeService;
import com.fuint.module.backendApi.controller.BackendFileController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.Random;
/**
* 码牌二维码表(TagCode)表服务实现类
*
* @author makejava
* @since 2024-03-20 15:30:34
*/
@Service("tagCodeService")
public class TagCodeServiceImpl extends ServiceImpl<TagCodeMapper, TagCode> implements TagCodeService {
@Autowired
private QrCodeUtils qrCodeUtils;
@Autowired
private BackendFileController backendFileController;
@Override
@Transactional
public boolean add(TagCodeDTO tagCodeDTO) throws Exception {
boolean flag = false;
if (ObjectUtils.isNotEmpty(tagCodeDTO) && ObjectUtils.isNotEmpty(tagCodeDTO.getTotal())){
int total = tagCodeDTO.getTotal();
for (int i = 0; i < total; i++) {
Random random = new Random();
int i1 = random.nextInt(90000000);
//String url = "https://oil.youkerr.com/";
String url = "https://www.tuofeng.cc/oilStation?sn=byx"+i1;
// String finalPath="/temp/qrCode/" + oilTag.getSnCode() + ".jpg";
//String finalPath="D:\\office\\document\\photos\\tagCode\\"+"str"+i+".jpg";
String finalPath="/temp/qrCode/" + "byx"+i1 + ".jpg";
TagCode tagCode = new TagCode();
tagCode.setCollection(url);
tagCode.setTagCodeSn("byx"+i1);
//在图片上生成二维码
String backgroundImage = "static/qrCodeImg/huanyingguanglin2.jpg";
InputStream backgroundStream = this.getClass().getClassLoader().getResourceAsStream(backgroundImage);
qrCodeUtils.createLogoCodePicture(backgroundStream, null, url, finalPath, null,null);
File file1 = new File("/temp/qrCode/");
// 判断目录是否存在
if (!file1.exists()) {
file1.mkdirs();
}
File file =new File(finalPath);
FileInputStream fileInputStream =new FileInputStream(file);
MultipartFile resFile = new MockMultipartFile("file", file.getName(), null, fileInputStream);
// 返回图片路径
String saveFile = backendFileController.saveFile(resFile);
//return saveFile;
tagCode.setImageUrl(finalPath);
flag = save(tagCode);
}
}
return flag;
}
}

View File

@ -0,0 +1,106 @@
package com.fuint.business.tag.util;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import java.util.*;
@Component
@Slf4j
public class TagUtils {
//语音播报方法
public void voiceBroadcast(HashMap<String, Object> hashMap){
//获取token
HashMap<String, Object> objectMap = new HashMap<>();
String requestId = generateRandomString(8);
String appSecret = "2023bsjZF2055IDW";
long time = new Date().getTime();
objectMap.put("appId","ZF2055");
objectMap.put("timestamp",time);
objectMap.put("requestId",requestId);
objectMap.put("userCode","ZF2055");
log.info("获取token");
String token = getToken(objectMap, appSecret);
log.info("token:"+token);
//语音播报方法
String url = "https://ioe.car900.com/v1/openApi/dev/controlDevice.json";
url += "?appId=ZF2055&requestId="+requestId+"&timestamp="+time+"&userCode=ZF2055"+"&token="+token+
"&devName="+hashMap.get("devName")+"&bizType=2"+"&content="+hashMap.get("content");
log.info("语音播报方法");
HttpResponse execute = HttpUtil.createGet(url).execute();
}
/**
* 获取token
*
* @param objectMap 接口请求参数appIdtimestamprequestIduserCode
* @param appSecret 密钥
* @return
*/
public static String getToken(Map<String, Object> objectMap, String appSecret) {
StringBuffer content = new StringBuffer();
List keys = new ArrayList();
for (String key : objectMap.keySet()) {
switch (key) {
case "appId":
keys.add(key);
break;
case "timestamp":
keys.add(key);
break;
case "requestId":
keys.add(key);
break;
case "userCode":
keys.add(key);
break;
}
}
Collections.sort(keys);
for (int i = 0; i < keys.size(); i++) {
String key = keys.get(i).toString();
String value = objectMap.get(key).toString();
if (StringUtils.isNotBlank(key) && StringUtils.isNotBlank(value)) {
content.append(key).append(value);
} else {
return "key:" + key + "的值非法";
}
}
System.out.println("加密字符串:" + content);
// 加密后的字符串
String md5str = DigestUtils.md5Hex(String.valueOf(content.append(appSecret)));
//32位大写
String md532Upper=md5str.toUpperCase();
return md532Upper;
}
//生成随机字符串
public static String generateRandomString(int length) {
String characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; // 定义包含所有字母大小写的字符集合
StringBuilder sb = new StringBuilder();
Random random = new Random();
for (int i = 0; i < length; i++) {
char c = characters.charAt(random.nextInt(characters.length())); // 从字符集合中随机选取一个字符
sb.append(c); // 将字符添加到字符串构建器中
}
return sb.toString();
}
}

View File

@ -0,0 +1,18 @@
package com.fuint.business.tag.vo;
import com.fuint.business.tag.entity.OilTag;
import lombok.Data;
import java.io.Serializable;
@Data
public class TagCodeRecordVO extends OilTag implements Serializable {
//图片地址
private String imageUrl;
//码牌二维码域名+字符串
private String collection;
//油站名称
private String storeName;
//员工名字
private String staffName;
}