This commit is contained in:
齐天大圣 2024-03-27 09:42:45 +08:00
parent b6fbcbd345
commit fa268dc54a
5 changed files with 79 additions and 9 deletions

View File

@ -40,14 +40,15 @@ public class LJDutyServiceImpl extends ServiceImpl<LJDutyMapper, TDuty> implemen
@Override
public List<TDuty> selectDutys(TDuty duty) {
QueryWrapper<TDuty> 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<LJDutyMapper, TDuty> implemen
@Override
public Page<TDuty> 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);
}

View File

@ -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;

View File

@ -85,14 +85,14 @@ public class TagCodeServiceImpl extends ServiceImpl<TagCodeMapper, TagCode> 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<TagCodeMapper, TagCode> 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 = "D:\\temp\\tagCode\\"+DateUtil.formatDate(new Date(), "yyyyMMdd")+"-"+i2;
// String IMAGE_DIRECTORY = "/temp/tagCode/"+DateUtil.formatDate(new Date(), "yyyyMMdd")+"-"+i2;
List<File> imageFiles = getImageFiles(IMAGE_DIRECTORY);
InputStream zipInputStream = createZipInputStream(imageFiles);

View File

@ -283,6 +283,12 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> 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);

View File

@ -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,6 +88,9 @@ public class BackendLoginController extends BaseController {
@Autowired
public RedisTemplate redisTemplate;
@Resource
private LJDutyMapper ljDutyMapper;
/**
* 后台登录
* */
@ -100,6 +104,11 @@ public class BackendLoginController extends BaseController {
String captchaCode = loginRequest.getCaptchaCode();
String uuid = loginRequest.getUuid();
//不知道是哪个平台过来的请求
/*LambdaQueryWrapper<TAccount> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TAccount::getAccountName, accountName);
ljDutyMapper*/
Boolean captchaVerify = captchaService.checkCodeByUuid(captchaCode, uuid);
if (!captchaVerify) {
return getFailureResult(201,"图形验证码有误");