diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/Const.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/Const.java index fc1531ef8..c69471fc9 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/Const.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/entity/Const.java @@ -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"; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java index a607fa7d7..d5bd5f0ce 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeExchange/service/impl/ActiveExchangeServiceImpl.java @@ -785,7 +785,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService { //4. 3和优惠券比较 if (ObjectUtils.isNotEmpty(activeDiscountPayVO3)) { finalAmount = activeDiscountPayVO3.getDiscounts(); - if (ObjectUtils.isNotEmpty(cardFavorableRecordVO) && finalAmount < cardFavorableRecordVO.getDiscountAmount()) { + if (ObjectUtils.isNotEmpty(cardFavorableRecordVO) && ObjectUtils.isNotEmpty(cardFavorableRecordVO.getDiscountAmount()) && finalAmount < cardFavorableRecordVO.getDiscountAmount()) { PaymentActiveVO paymentActiveVO1 = new PaymentActiveVO(); //单用优惠券优惠力度最大 paymentActiveVO1.setCardFavorableId(cardFavorableRecordVO.getId()); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/member/service/impl/LJDutyServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/member/service/impl/LJDutyServiceImpl.java index a19d86f62..134b96e34 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/member/service/impl/LJDutyServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/member/service/impl/LJDutyServiceImpl.java @@ -40,14 +40,15 @@ public class LJDutyServiceImpl extends ServiceImpl implemen @Override public List selectDutys(TDuty duty) { QueryWrapper queryWrapper = new QueryWrapper<>(); - if (ObjectUtil.isNotEmpty(duty.getStoreId())) { + /*if (ObjectUtil.isNotEmpty(duty.getStoreId())) { SysDept sysDept = sysDeptService.selectParentId(Long.valueOf(duty.getStoreId())); queryWrapper.eq("store_id", sysDept.getDeptId()); }else { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); SysDept sysDept = sysDeptService.selectParentId(nowAccountInfo.getDeptId()); queryWrapper.eq("store_id", sysDept.getDeptId()); - } + }*/ + queryWrapper.eq("store_id", duty.getStoreId()); return baseMapper.selectList(queryWrapper); } @@ -63,14 +64,15 @@ public class LJDutyServiceImpl extends ServiceImpl implemen @Override public Page selectDutyPage(Page page, TDuty duty) { - if (ObjectUtil.isNotEmpty(duty.getStoreId())){ + /*if (ObjectUtil.isNotEmpty(duty.getStoreId())){ SysDept sysDept = sysDeptService.selectParentId(Long.valueOf(duty.getStoreId())); duty.setStoreId(Math.toIntExact(sysDept.getDeptId())); }else { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); SysDept sysDept = sysDeptService.selectParentId(nowAccountInfo.getDeptId()); duty.setStoreId(Math.toIntExact(sysDept.getDeptId())); - } + }*/ + duty.setStoreId(duty.getStoreId()); return baseMapper.selectDutyPage(page,duty); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/member/utils/QrCodeUtils.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/member/utils/QrCodeUtils.java index 542dbdf9d..bb5c31a93 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/member/utils/QrCodeUtils.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/member/utils/QrCodeUtils.java @@ -22,6 +22,7 @@ import javax.swing.*; import java.awt.*; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; +import java.awt.image.RenderedImage; import java.io.*; /** @@ -128,6 +129,58 @@ public class QrCodeUtils { } } + public void createLogoCodePictures(InputStream logoStream, String url, String outImgPath, Integer staffId, Integer storeId,String urls) { + try { + // 读取原图片信息 + //得到文件 +//// File file = ResourceUtils.getFile(roundImage); +// ClassPathResource resource = new ClassPathResource(roundImage); +// ClassPathResource logoResource = new ClassPathResource(logoImage); +// File file = resource.getFile(); + + //文件转化为图片 + // 加水印 + //使用工具类生成二维码 + Image image = createQrCode(logoStream, url, 360, 360); + //将小图片绘到大图片上,500,300 .表示你的小图片在大图片上的位置。 + +// 查询当前店铺信息 + if (ObjectUtils.isNotEmpty(storeId)){ + LJStore store = storeService.selectStoreByStoreId(storeId); +// 查询加油员信息 + LJStaff staff = null; + if (ObjectUtil.isNotEmpty(staffId)){ + staff = staffService.selectStaffById(staffId); + } + LJStaff staff1 = staffService.selectStaffByStoreId(storeId); + }else { + //drawStringWithMultiLine(g,"欢迎光临", bufImg.getWidth()-20,20,940,10 ); + } + + +// // 将码牌编号文字绘制到指定位置 +// g.drawString(storeNumber, 200, 800); + // 输出图片 + String urlsss = "/temp/qrCode/"; + if (ObjectUtils.isNotEmpty(urls)){ + urlsss = urls; + } + File file1 = new File(urlsss); + // 判断目录是否存在 + if (!file1.exists()) { + file1.mkdirs(); + } + + FileOutputStream outImgStream = new FileOutputStream(outImgPath); + ImageIO.write((RenderedImage) image, "jpg", outImgStream); + outImgStream.flush(); + outImgStream.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public Font chineseFont() throws Exception { // 设置中文 Font b = null; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java index 4faeb0c1c..69a85e656 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java @@ -65,6 +65,7 @@ import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.StringUtils; import com.fuint.common.util.TokenUtil; import com.fuint.system.config.service.SysConfigService; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; @@ -80,6 +81,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; @Service +@Slf4j public class OilOrderServiceImpl extends ServiceImpl implements OilOrderService { @Autowired private LJOrderService orderService; @@ -123,6 +125,8 @@ public class OilOrderServiceImpl extends ServiceImpl i private ActiveDiscountService activeDiscountService; @Resource private IntegralSettingsService integralSettingsService; + @Resource + private OilGunService oilGunService; @Override public IPage selectOilOrderList(Page page, OilOrder order) { @@ -1080,10 +1084,7 @@ public class OilOrderServiceImpl extends ServiceImpl i oilOrder.setOrderType("主订单"); oilOrder.setInvoicing("未开票"); oilOrder.setUserId(nowAccountInfo.getId()); - if (ObjectUtils.isNotEmpty(oilOrder.getOilTagSn())){ - String[] split = oilOrder.getOilTagSn().split("="); - oilOrder.setOilTagSn(split[1]); - } + oilOrder.setOilTagSn(oilOrder.getOilTagSn()); // 判断当前店铺是否存在此用户的会员信息,没有的话进行添加 LJStore store = storeService.selectStoreByStoreId(oilOrder.getStoreId()); UserBalance balance = userBalanceService.selectUserBalance(oilOrder.getUserId(), store.getChainStoreId()); @@ -1346,7 +1347,18 @@ public class OilOrderServiceImpl extends ServiceImpl i } String oils = oilOrder.getOils(); OilName oilName = oilNameService.getById(oils); - content = oilOrder.getOilGunNum()+"加油"+oilName.getOilName()+oilName.getOilType()+oilOrder.getOilNum()+"升,共计"+oilOrder.getPayAmount()+"元"; + //油枪名字 + OilGun oilGun = oilGunService.queryById(Integer.parseInt(oilOrder.getOilGunNum())); + String oilName11 = ""; + if (oilName.getOilName().contains("#")){ + String[] split = oilName.getOilName().split("#"); + oilName11 = split[0]; + content = oilGun.getGunName()+"加油"+oilName11+oilName.getOilType()+oilOrder.getOilNum()+"升,共计"+oilOrder.getPayAmount()+"元"; + }else { + content = oilGun.getGunName()+"加油"+oilName.getOilName()+oilName.getOilType()+oilOrder.getOilNum()+"升,共计"+oilOrder.getPayAmount()+"元"; + } + + log.info("码牌播报内容111:"+content); hashMap.put("content",content); tagUtils.voiceBroadcast(hashMap); //tagUtils @@ -1873,9 +1885,6 @@ return stringDoubleMap; saleDetailService.insertSaleDetail(saleDetail,isMember); } - - @Resource - OilGunService oilGunService; @Override public OilOrderVo getInfoByTime(Date time,Integer tankId) { List oilGuns = oilGunService.selectOilGunByTankId(tankId); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/controller/OilTagController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/controller/OilTagController.java index a06479cb4..6feb8ffca 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/controller/OilTagController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/controller/OilTagController.java @@ -3,20 +3,28 @@ package com.fuint.business.tag.controller; 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.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.business.tag.util.TagUtils; +import com.fuint.business.tag.vo.OilTagVO; +import com.fuint.common.dto.AccountInfo; +import com.fuint.common.util.TokenUtil; import com.fuint.framework.web.BaseController; import com.fuint.framework.web.ResponseObject; import org.apache.ibatis.annotations.Param; +import org.springframework.beans.BeanUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.io.Serializable; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; /** * 码牌配置表(OilTag)表控制层 @@ -33,6 +41,9 @@ public class OilTagController extends BaseController { @Resource private OilTagService oilTagService; + @Resource + private TagCodeRecordService tagCodeRecordService; + @Resource private TagUtils tagUtils; /** @@ -44,15 +55,34 @@ public class OilTagController extends BaseController { @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize, @Param("cardFuelDiesel") OilTag oilTag) { Page page = new Page(pageNo, pageSize); + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); if (ObjectUtils.isNotEmpty(oilTag.getTagCodeSn())){ queryWrapper.eq(OilTag::getTagCodeSn,oilTag.getTagCodeSn()); } + queryWrapper.eq(OilTag::getDeptId,nowAccountInfo.getDeptId()); if (ObjectUtils.isNotEmpty(oilTag.getSnCode())){ queryWrapper.eq(OilTag::getSnCode,oilTag.getSnCode()); } queryWrapper.orderByDesc(OilTag::getCreateTime); - return getSuccessResult(this.oilTagService.page(page, queryWrapper)); + ArrayList oilTagVOArrayList = new ArrayList<>(); + IPage page1 = this.oilTagService.page(page, queryWrapper); + List records = page1.getRecords(); + for (OilTag record : records) { + Integer oilTagId = record.getId(); + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(TagCodeRecord::getOilTagId,oilTagId); + TagCodeRecord one = tagCodeRecordService.getOne(queryWrapper1); + OilTagVO oilTagVO = new OilTagVO(); + BeanUtils.copyProperties(record,oilTagVO); + if (ObjectUtils.isNotEmpty(one)){ + oilTagVO.setStoreName(one.getStoreName()); + } + + oilTagVOArrayList.add(oilTagVO); + } + page1.setRecords(oilTagVOArrayList); + return getSuccessResult(page1); } /** @@ -98,7 +128,34 @@ public class OilTagController extends BaseController { */ @DeleteMapping("{id}") public ResponseObject delete(@PathVariable("id") Long id) { - return getSuccessResult(this.oilTagService.removeById(id)); + OilTag oilTag = this.oilTagService.getById(id); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(TagCodeRecord::getOilTagId,oilTag.getId()); + TagCodeRecord tagCodeRecord = this.tagCodeRecordService.getOne(queryWrapper); + if (ObjectUtils.isNotEmpty(tagCodeRecord.getStaffId())){ + return getSuccessResult("该码牌已绑定员工,请先解绑员工!"); + }else { + this.tagCodeRecordService.removeById(tagCodeRecord.getId()); + oilTag.setStatus("0"); + this.oilTagService.updateById(oilTag); + return getSuccessResult("解绑成功!"); + } + /* TagCodeRecord tagCodeRecord = this.tagCodeRecordService.getById(id); + return getSuccessResult(this.oilTagService.removeById(id));*/ + } + + + //通过二维码sn查油站id + @GetMapping("/getSn/{sn}") + public ResponseObject selectOne(@PathVariable String sn) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(OilTag::getTagCodeSn, sn); + OilTag one = this.oilTagService.getOne(queryWrapper); + Integer oilTagId = one.getId(); + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(TagCodeRecord::getOilTagId,oilTagId); + TagCodeRecord one1 = tagCodeRecordService.getOne(queryWrapper1); + return getSuccessResult(one1); } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/controller/TagCodeController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/controller/TagCodeController.java index 13e852861..8b4cbd20f 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/controller/TagCodeController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/controller/TagCodeController.java @@ -9,6 +9,8 @@ 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.common.dto.AccountInfo; +import com.fuint.common.util.TokenUtil; import com.fuint.framework.web.BaseController; import com.fuint.framework.web.ResponseObject; import org.apache.ibatis.annotations.Param; @@ -59,10 +61,12 @@ public class TagCodeController extends BaseController { @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize, @Param("cardFuelDiesel") TagCode tagCode) { Page page = new Page(pageNo, pageSize); + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); if (ObjectUtils.isNotEmpty(tagCode.getTagCodeSn())){ queryWrapper.eq(TagCode::getTagCodeSn,tagCode.getTagCodeSn()); } + queryWrapper.eq(TagCode::getDeptId,nowAccountInfo.getDeptId()); queryWrapper.orderByDesc(TagCode::getCreateTime); return getSuccessResult(this.tagCodeService.page(page, queryWrapper)); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/entity/OilTag.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/entity/OilTag.java index b55b4f2bb..7ff301aff 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/entity/OilTag.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/entity/OilTag.java @@ -24,6 +24,7 @@ public class OilTag extends Model { private Integer id; //二维码id private Integer tagCodeId; + private Integer deptId; //二维码SN号 private String tagCodeSn; //厂家名字 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/OilTagServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/OilTagServiceImpl.java index 519e0a93f..6a7a2a700 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/OilTagServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/OilTagServiceImpl.java @@ -9,6 +9,8 @@ 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.common.dto.AccountInfo; +import com.fuint.common.util.TokenUtil; import com.fuint.module.backendApi.controller.BackendFileController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mock.web.MockMultipartFile; @@ -34,6 +36,8 @@ public class OilTagServiceImpl extends ServiceImpl impleme @Override public boolean add(OilTag oilTag) throws Exception { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + oilTag.setDeptId(Integer.parseInt(nowAccountInfo.getDeptId().toString())); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(TagCode::getTagCodeSn, oilTag.getTagCodeSn()); TagCode tagCode = tagCodeService.getOne(queryWrapper); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/TagCodeRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/TagCodeRecordServiceImpl.java index e16041a96..8a4762ad0 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/TagCodeRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/TagCodeRecordServiceImpl.java @@ -17,6 +17,7 @@ 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.service.TagCodeService; import com.fuint.business.tag.vo.TagCodeRecordVO; import com.fuint.common.dto.AccountInfo; import com.fuint.common.service.StaffService; @@ -51,6 +52,9 @@ public class TagCodeRecordServiceImpl extends ServiceImpl impl tagCode.setDeptId(Integer.parseInt(nowAccountInfo.getDeptId().toString())); //在图片上生成二维码 - String backgroundImage = "static/qrCodeImg/huanyingguanglin2.jpg"; + String backgroundImage = "static/qrCodeImg/huanyingguanglin.jpg"; InputStream backgroundStream = this.getClass().getClassLoader().getResourceAsStream(backgroundImage); String urls = ""; urls = "/temp/tagCode/"+ DateUtil.formatDate(new Date(), "yyyyMMdd") + "-"+i2; File file1 = new File(urls); // String finalPath="/temp/tagCode/" + "byx"+i1 + ".jpg"; String finalPath=urls+"/" + "byx"+i1 + ".jpg"; - qrCodeUtils.createLogoCodePicture(backgroundStream, null, url, finalPath, null,null,urls); + qrCodeUtils.createLogoCodePictures(null, url, finalPath, null,null,urls); // 判断目录是否存在 @@ -107,13 +107,13 @@ public class TagCodeServiceImpl extends ServiceImpl impl // 返回图片路径 String saveFile = backendFileController.saveFile(resFile); //return saveFile; - tagCode.setImageUrl(finalPath); + tagCode.setImageUrl(saveFile); flag = save(tagCode); } //导出码牌 //String IMAGE_DIRECTORY = "D:\\temp\\tagCode\\"+DateUtil.formatDate(new Date(), "yyyyMMdd")+"-"+i2; - String IMAGE_DIRECTORY = "/temp/tagCode/"+DateUtil.formatDate(new Date(), "yyyyMMdd")+"-"+i2; + String IMAGE_DIRECTORY = "/temp/tagCode/"+DateUtil.formatDate(new Date(), "yyyyMMdd")+"-"+i2; List imageFiles = getImageFiles(IMAGE_DIRECTORY); InputStream zipInputStream = createZipInputStream(imageFiles); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/vo/OilTagVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/vo/OilTagVO.java new file mode 100644 index 000000000..7ca2ff7e2 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/vo/OilTagVO.java @@ -0,0 +1,12 @@ +package com.fuint.business.tag.vo; + +import com.fuint.business.tag.entity.OilTag; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class OilTagVO extends OilTag implements Serializable { + //店铺名字 + private String storeName; +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/AccountServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/AccountServiceImpl.java index 05c171728..113fdc4dd 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/AccountServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/AccountServiceImpl.java @@ -283,6 +283,12 @@ public class AccountServiceImpl extends ServiceImpl im tAccount.setAccountName(accountName); tAccount.setAccountStatus(Integer.parseInt(accountStatus)); tAccount.setPassword(password); + if (ObjectUtil.isNotEmpty(param.get("deptType")) && "2".equals(param.get("deptType"))){ + tAccount.setOwnerId(2); + } + if (ObjectUtil.isNotEmpty(param.get("deptType")) && "3".equals(param.get("deptType"))){ + tAccount.setOwnerId(3); + } tAccount.setIsActive(1); tAccount.setLocked(0); if (ObjectUtil.isEmpty(mtStore)) mtStore.setId(0); @@ -498,6 +504,7 @@ public class AccountServiceImpl extends ServiceImpl im account.setPassword(tAccount.getPassword()); account.setStaffId(tAccount.getStaffId()); account.setMobile(tAccount.getMobile()); + account.setOwnerId(tAccount.getOwnerId()); this.entryptPassword(account); int id = tAccountMapper.insert(account); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendLoginController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendLoginController.java index 4b406b6d7..4b730abef 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendLoginController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendLoginController.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.extension.api.R; import com.fuint.business.member.entity.LJStaff; +import com.fuint.business.member.mapper.LJDutyMapper; import com.fuint.business.member.service.ILJStaffService; import com.fuint.business.storeInformation.entity.LJStore; import com.fuint.business.storeInformation.service.ILJStoreService; @@ -87,10 +88,14 @@ public class BackendLoginController extends BaseController { @Autowired public RedisTemplate redisTemplate; + @Resource + private LJDutyMapper ljDutyMapper; + + /** * 后台登录 * */ - @ApiOperation(value = "后台登录") + @ApiOperation(value = "油站登录") @RequestMapping(value="/doLogin", method = RequestMethod.POST) @OperationServiceLog(description = "登录后台系统") public ResponseObject doLogin(HttpServletRequest request, @RequestBody LoginRequest loginRequest) { @@ -100,6 +105,71 @@ public class BackendLoginController extends BaseController { String captchaCode = loginRequest.getCaptchaCode(); String uuid = loginRequest.getUuid(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(TAccount::getAccountName, accountName); + TAccount one = accountService.getOne(queryWrapper); + if (ObjectUtils.isNotEmpty(one) && one.getOwnerId().toString().equals("2") ||one.getOwnerId().toString().equals("1") ){ + return getFailureResult(201,"请登录终台端!"); + } + + + Boolean captchaVerify = captchaService.checkCodeByUuid(captchaCode, uuid); + if (!captchaVerify) { + return getFailureResult(201,"图形验证码有误"); + } + + if (StringUtil.isEmpty(accountName)|| StringUtil.isEmpty(password) || StringUtil.isEmpty(captchaCode)) { + return getFailureResult(Constants.HTTP_RESPONSE_CODE_PARAM_ERROR); + } else { + AccountInfo accountInfo = accountService.getAccountByName(loginRequest.getUsername()); + if (accountInfo == null) { + return getFailureResult(Constants.HTTP_RESPONSE_CODE_USER_LOGIN_ERROR); + } + TAccount tAccount = accountService.getAccountInfoById(accountInfo.getId()); + String myPassword = tAccount.getPassword(); + String inputPassword = accountService.getEntryptPassword(password, tAccount.getSalt()); + if (!myPassword.equals(inputPassword) || !tAccount.getAccountStatus().toString().equals("1")) { + return getFailureResult(201, "账号或密码有误"); + } + Subject subject = SecurityUtils.getSubject(); + UsernamePasswordToken info = new UsernamePasswordToken(accountInfo.getAccountName(), tAccount.getPassword()); + subject.login(info); + String token = TokenUtil.generateToken(userAgent, accountInfo.getId()); + accountInfo.setToken(token); + TokenUtil.saveAccountToken(accountInfo); + LoginResponse response = new LoginResponse(); + response.setLogin(true); + response.setToken(token); + response.setTokenCreatedTime(new Date()); + return getSuccessResult(response); + } + } + + /** + * 后台登录 + * */ + @ApiOperation(value = "终台登录") + @RequestMapping(value="/doLogins", method = RequestMethod.POST) + @OperationServiceLog(description = "登录后台系统") + public ResponseObject doLogins(HttpServletRequest request, @RequestBody LoginRequest loginRequest) { + String userAgent = request.getHeader("user-agent"); + String accountName = loginRequest.getUsername(); + String password = loginRequest.getPassword(); + String captchaCode = loginRequest.getCaptchaCode(); + String uuid = loginRequest.getUuid(); + + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(TAccount::getAccountName, accountName); + TAccount one = accountService.getOne(queryWrapper); + if (ObjectUtils.isNotEmpty(one) && one.getOwnerId().toString().equals("3")){ + return getFailureResult(201,"请登录油站端!"); + } + + //不知道是哪个平台过来的请求 + /*LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(TAccount::getAccountName, accountName); + ljDutyMapper*/ + Boolean captchaVerify = captchaService.checkCodeByUuid(captchaCode, uuid); if (!captchaVerify) { return getFailureResult(201,"图形验证码有误"); diff --git a/gasStation-uni/App.vue b/gasStation-uni/App.vue index 37c22f8dd..a1961d966 100644 --- a/gasStation-uni/App.vue +++ b/gasStation-uni/App.vue @@ -3,7 +3,7 @@ onLaunch: function(e) { console.log('App Launch') // #ifdef MP-WEIXIN - uni.setStorageSync("appltType","WECHAT") + uni.setStorageSync("appltType", "WECHAT") console.log("微信") //检查是否存在新版本 uni.getUpdateManager().onCheckForUpdate(function(res) { @@ -39,21 +39,22 @@ }); // #endif // #ifdef MP-ALIPAY - uni.setStorageSync("appltType","ALIPAY") + uni.setStorageSync("appltType", "ALIPAY") console.log("支付宝") my.canIUse('button.open-type.getAuthorize') //获取关联普通二维码的码值,放到全局变量qrCode中 if (e.query && e.query.qrCode) { - console.log(JSON.stringify(e)+"1.0") - let q = e.query.qrCode; + console.log(JSON.stringify(e) + "1.0") + let q = e.query.qrCode; if (e.query.qrCode) { let str = q.split("?")[1]; let storeId = ""; - + let staffId = ""; let userId = ""; let type = ""; - if (str.includes("&")){ + let sn = ""; + if (str.includes("&")) { let arr = str.split("&"); arr.forEach(item => { if (item.includes("storeId")) { @@ -64,14 +65,17 @@ userId = item.split("=")[1] } else if (item.includes("type")) { type = item.split("=")[1] + } else { + sn = item.split("=")[1] } }) - }else{ + } else { if (str.includes("storeId")) { storeId = str.split("=")[1] } } uni.setStorageSync("storeId", storeId) + uni.setStorageSync("sn", sn) uni.setStorageSync("y_type", type) uni.setStorageSync("y_userId", userId) uni.setStorageSync("inviteStaffId", staffId) @@ -79,7 +83,7 @@ // title:uni.getStorageSync("storeId") + "staffId" + uni.getStorageSync("inviteStaffId") // }) } - } + } // #endif }, onShow: function() { diff --git a/gasStation-uni/pages/refuel/refuel.vue b/gasStation-uni/pages/refuel/refuel.vue index ed0ab800d..e387de787 100644 --- a/gasStation-uni/pages/refuel/refuel.vue +++ b/gasStation-uni/pages/refuel/refuel.vue @@ -28,7 +28,7 @@ --> - + 选择油号 请务必与员工确认类型 @@ -74,7 +74,7 @@ 立即加油 - + 选择油号 请务必与员工确认类型 @@ -231,19 +231,24 @@ let storeId = "19"; let staffId = ""; + let sn = ""; + console.log("115151515:" + str); if (str.includes("&")) { let arr = str.split("&"); arr.forEach(item => { if (item.includes("storeId")) { storeId = item.split("=")[1] - } else { + } else if (item.includes("staffId")) { staffId = item.split("=")[1] + } else { + sn = item.split("=")[1] } }) } else { storeId = str.split("=")[1] } uni.setStorageSync("storeId", storeId) + uni.setStorageSync("sn", sn) uni.setStorageSync("inviteStaffId", staffId) this.storeId = uni.getStorageSync("storeId") this.staffId = uni.getStorageSync("inviteStaffId") @@ -360,7 +365,7 @@ method: 'get', }).then((res) => { _this.oilNumberList = res.data; - if (res.data.length>0) { + if (res.data.length > 0) { // _this.getOilGun(res.data[0].numberId); _this.oilPrice = res.data[0].oilPrice _this.oilUnit = res.data[0].unit @@ -388,7 +393,7 @@ getStaffList(storeId) { let _this = this; request({ - url: "business/member/staff/queryList1/"+storeId, + url: "business/member/staff/queryList1/" + storeId, method: 'get', }).then((res) => { _this.staffList = res.data @@ -420,6 +425,7 @@ this.oilOrder.staffId = id this.oilOrder.oilNum = (this.value / this.oilPrice).toFixed(2) this.oilOrder.tankId = uni.getStorageSync("tankId") + this.oilOrder.oilTagSn = uni.getStorageSync("sn") let _this = this; // 添加油品订单信息 request({ @@ -484,7 +490,7 @@ } else { if (this.value != "" && this.qindex != null) { this.show = false - if (uni.getStorageSync("inviteStaffId") || this.staffList.length==0) { + if (uni.getStorageSync("inviteStaffId") || this.staffList.length == 0) { this.toPayment(uni.getStorageSync("inviteStaffId")) } else { // this.$refs.popup.open('bottom') @@ -562,7 +568,7 @@ }) } - if (uni.getStorageSync("appltType")== "WECHAT") { + if (uni.getStorageSync("appltType") == "WECHAT") { // 判断当前登录的code是否相同 wx.login({ success(res) { @@ -587,8 +593,8 @@ } }) } - - if (uni.getStorageSync("appltType")== "ALIPAY") { + + if (uni.getStorageSync("appltType") == "ALIPAY") { my.getAuthCode({ scopes: 'auth_base', success: res => { @@ -844,4 +850,4 @@ text-align: right; color: #999999; } - + \ No newline at end of file