This commit is contained in:
PQZ 2024-10-11 14:04:01 +08:00
commit 7e450c719a
24 changed files with 282 additions and 168 deletions

View File

@ -0,0 +1,44 @@
package cn.iocoder.yudao.common;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* Bpm 消息的枚举
*
* @author 芋道源码
*/
@AllArgsConstructor
@Getter
public enum SystemEnum {
/**
* 维修系统
*/
REPAIR("weixiu","维修系统"),
/**
* 救援系统
*/
RESCUE("jiuyuan","救援系统"),
/**
* 驾校系统
*/
SCHOOL("jiaxiao","驾校系统"),
/**
* 检测系统
*/
INSPECTION("jiance","检测系统"),
/**
* 保险系统
*/
INSURE("baoxian","保险系统");
/**
* 系统标识
*/
private String code;
/**
* 系统名称
*/
private String name;
}

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.app.wechat.service;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
/**
* @author vinjor-m
@ -14,4 +15,17 @@ public interface WechatService {
* @param map 参数
**/
CommonResult<?> loginByOpenId(String code);
/**
* 微信授权登录-未注册自动注册已登录的返回用户信息-
* --目前维修系统使用后续客户信息整合可以复用
* @author vinjor-M
* @date 15:14 2024/10/9
* @param sysCode 系统标识
* @param decryptResult 微信授权解密密文
* @param openId 微信openId
* @param inviteId 邀请者code
* @return cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO
**/
AdminUserDO wechatLogin(String sysCode, String decryptResult, String openId, String inviteId);
}

View File

@ -1,15 +1,22 @@
package cn.iocoder.yudao.module.app.wechat.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.common.SystemEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.app.wechat.service.WechatService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.auth.AdminAuthService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import cn.iocoder.yudao.util.WeChatLoginUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -31,6 +38,10 @@ public class WechatServiceImpl implements WechatService {
private AdminUserApi adminUserApi;
@Resource
private AdminAuthService loginService;
@Resource
private AdminUserService userService;
@Resource
private PasswordEncoder passwordEncoder;
/**
* 微信自动登录
*
@ -88,4 +99,67 @@ public class WechatServiceImpl implements WechatService {
throw new Exception(e.getMessage());
}
}
/**
* 微信授权登录-未注册自动注册已登录的返回用户信息-
* --目前维修系统使用后续客户信息整合可以复用
*
* @param sysCode 系统标识
* @param decryptResult 微信授权解密密文
* @param openId 微信openId
* @param inviteId 邀请者code
* @return cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO
* @author vinjor-M
* @date 15:14 2024/10/9
**/
@Override
public AdminUserDO wechatLogin(String sysCode, String decryptResult, String openId, String inviteId) {
//字符串转json
JSONObject jsonObject = JSONUtil.parseObj(decryptResult);
String phoneNumber = jsonObject.getStr("phoneNumber");
//根据手机号判断数据库中是否有该用户
AdminUserDO wxUser = userService.getUserByMobileWithoutTenant(phoneNumber);
//如果查不到则新增查到了则更新
UserSaveReqVO user = new UserSaveReqVO();
if (null == wxUser) {
// 直接新注册一个账号
user.setUsername(phoneNumber);
user.setNickname(phoneNumber);
user.setMobile(phoneNumber);
user.setPassword(passwordEncoder.encode("123456"));
//TODO 客户后期没有租户ID
user.setTenantId(180L);
user.setDeptId(100L);
}else {
//更新
user.setId(wxUser.getId());
}
//设置微信openId
if(SystemEnum.REPAIR.getCode().equals(sysCode)){
//维修业务系统
user.setRepairOpenId(openId);
}else if(SystemEnum.INSPECTION.getCode().equals(sysCode)){
//检测业务系统
}else if(SystemEnum.SCHOOL.getCode().equals(sysCode)){
//驾校业务系统
}else if(SystemEnum.RESCUE.getCode().equals(sysCode)){
//救援业务系统
}else if(SystemEnum.INSURE.getCode().equals(sysCode)){
//保险业务系统
}else {
//默认维修业务
user.setRepairOpenId(openId);
}
if(null!=user.getId()){
//更新
userService.updateUser(user);
}else{
//插入
Long uid = userService.createUser(user);
wxUser = new AdminUserDO();
wxUser.setId(uid);
wxUser.setUsername(phoneNumber);
}
return wxUser;
}
}

View File

@ -0,0 +1,61 @@
package cn.iocoder.yudao.util;
import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;
import org.springframework.stereotype.Component;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.spec.AlgorithmParameterSpec;
import java.util.Arrays;
/**
* AES加解密util
* @author vinjor-M
* @date 17:41 2024/10/10
**/
@Component
public class AESUtil {
/**
* AES解密
*/
public String decrypt(String sessionKey,String encryptedIv,String encryptedData) throws Exception{
// 转化为字节数组
byte[] key = Base64.decode(sessionKey);
byte[] iv = Base64.decode(encryptedIv);
byte[] encData = Base64.decode(encryptedData);
// 如果密钥不足16位那么就补足
int base =16;
if (key.length % base !=0) {
int groups = key.length / base +(key.length % base != 0 ? 1 : 0);
byte[] temp = new byte[groups * base];
Arrays.fill(temp,(byte) 0);
System.arraycopy(key,0,temp,0,key.length);
key = temp;
}
// 如果初始向量不足16位也补足
if (iv.length % base !=0) {
int groups = iv.length / base +(iv.length % base != 0 ? 1 : 0);
byte[] temp = new byte[groups * base];
Arrays.fill(temp,(byte) 0);
System.arraycopy(iv,0,temp,0,iv.length);
iv = temp;
}
AlgorithmParameterSpec ivSpec = new IvParameterSpec(iv);
String resultStr = null;
try {
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
SecretKeySpec keySpec = new SecretKeySpec(key,"AES");
cipher.init(Cipher.DECRYPT_MODE,keySpec,ivSpec);
resultStr = new String(cipher.doFinal(encData),"UTF-8");
} catch (Exception e){
// logger.info("解析错误");
e.printStackTrace();
}
// 解析加密后的字符串
return resultStr;
}
}

View File

@ -7,6 +7,8 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService;
import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
import cn.iocoder.yudao.util.ExcelUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -39,11 +41,11 @@ public class InspectionEquInfoController extends BaseController
* 查询equInfo列表
*/
@GetMapping("/list")
public TableDataInfo list(InspectionEquInfo inspectionEquInfo) throws Exception {
public CommonResult list(Integer pageNum,Integer pageSize,InspectionEquInfo inspectionEquInfo) throws Exception {
startPage();
List<InspectionEquInfo> list = inspectionEquInfoService.selectInspectionEquInfoList(inspectionEquInfo);
return getDataTable(list);
Page page =new Page(pageNum,pageSize);
IPage<InspectionEquInfo> list = inspectionEquInfoService.selectInspectionEquInfoList(page,inspectionEquInfo);
return success(list);
}
/**
@ -52,9 +54,10 @@ public class InspectionEquInfoController extends BaseController
@PostMapping("/export")
public void export(HttpServletResponse response, InspectionEquInfo inspectionEquInfo)
{
List<InspectionEquInfo> list = inspectionEquInfoService.selectInspectionEquInfoList(inspectionEquInfo);
Page page =new Page(1,100000);
IPage<InspectionEquInfo> list = inspectionEquInfoService.selectInspectionEquInfoList(page,inspectionEquInfo);
ExcelUtil<InspectionEquInfo> util = new ExcelUtil<InspectionEquInfo>(InspectionEquInfo.class);
util.exportExcel(response, list, "equInfo数据");
util.exportExcel(response, list.getRecords(), "equInfo数据");
}
/**

View File

@ -347,14 +347,14 @@ public class PartnerOwnController extends BaseController {
//获取检测的数据
@GetMapping("/inspectionList")
public TableDataInfo inspectionList(Long partnerId,String status,String carNum,Integer pageSize,Integer pageNum) throws Exception {
public CommonResult inspectionList(Long partnerId,String status,String carNum,Integer pageSize,Integer pageNum) throws Exception {
ShopMallPartners partners = partnerList.shopInfo();
if (!partnerId.equals(partners.getPartnerId())){
return null;
}
Page<InspectionInfo> page = new Page<>(pageNum,pageSize);
List<InspectionInfo> inspectionInfos = partnerList.inspectionList(page,partnerId, status, carNum);
return getDataTable(inspectionInfos);
IPage<InspectionInfo> inspectionInfos = partnerList.inspectionList(page,partnerId, status, carNum);
return success(inspectionInfos);
}
//获取检测的详细信息
@ -365,7 +365,7 @@ public class PartnerOwnController extends BaseController {
//获取检测的数据
@GetMapping("/workerInspectionList")
public TableDataInfo workerInspectionList(Long partnerId,String status,String searchValue,Integer pageSize,Integer pageNum) {
public CommonResult workerInspectionList(Long partnerId,String status,String searchValue,Integer pageSize,Integer pageNum) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
LambdaQueryWrapper<PartnerWorker> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.eq(PartnerWorker::getUserId,user.getId()).eq(PartnerWorker::getPartnerId,partnerId);
@ -374,8 +374,8 @@ public class PartnerOwnController extends BaseController {
return null;
}
Page<InspectionInfo> page = new Page<>(pageNum,pageSize);
List<InspectionInfo> inspectionInfos = partnerList.inspectionList(page,partnerId, status, searchValue);
return getDataTable(inspectionInfos);
IPage<InspectionInfo> inspectionInfos = partnerList.inspectionList(page,partnerId, status, searchValue);
return success(inspectionInfos);
}
//增加检测步骤信息
@PostMapping("/addStepInfo")
@ -397,28 +397,28 @@ public class PartnerOwnController extends BaseController {
}
//获取到店预约的数据
@GetMapping("/getAppointmentList")
public TableDataInfo getAppointmentList(Long partnerId,String phoneNum,Integer pageSize,Integer pageNum) {
public CommonResult getAppointmentList(Long partnerId,String phoneNum,Integer pageSize,Integer pageNum) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
ShopMallPartners partnersTmp = partnerList.getById(partnerId);
if (!partnersTmp.getUserId().equals(user.getId())){
return null;
}
Page<InspectionAppointment> page = new Page<>(pageNum,pageSize);
List<InspectionAppointment> appointments = partnerList.getAppointmentList(page,partnerId,phoneNum);
return getDataTable(appointments);
IPage<InspectionAppointment> appointments = partnerList.getAppointmentList(page,partnerId,phoneNum);
return success(appointments);
}
//获取上门取车数据
@GetMapping("/getPickCarList")
public TableDataInfo getPickCarList(Long partnerId,String phoneNum,String pickStatus,Integer pageSize,Integer pageNum) {
public CommonResult getPickCarList(Long partnerId,String phoneNum,String pickStatus,Integer pageSize,Integer pageNum) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
ShopMallPartners partnersTmp = partnerList.getById(partnerId);
if (!partnersTmp.getUserId().equals(user.getId())){
return null;
}
PageHelper.startPage(pageNum,pageSize);
List<InspectionPickCar> pickCarList = partnerList.getPickCarList(partnerId,phoneNum,pickStatus);
return getDataTable(pickCarList);
Page<InspectionPickCar> page = new Page<>(pageNum,pageSize);
IPage<InspectionPickCar> pickCarList = partnerList.getPickCarList(page,partnerId,phoneNum,pickStatus);
return success(pickCarList);
}
//获取上门取车详情页

View File

@ -36,10 +36,10 @@ public interface AppInspectionPartnerMapper extends BaseMapper<ShopMallPartners>
List<OrderAppDetail> orderList(@Param("partnerId") Long partnerId, @Param("phoneNum") String phoneNum,@Param("title") String title);
List<PartnerWorker> getWorkList(@Param("partnerId")Long partnerId, @Param("postId") Long postId, @Param("workName") String workName, @Param("phoneNum")String phoneNum);
IPage<PartnerWorker> pageWorkList(@Param("partnerId")Long partnerId, @Param("postId") Long postId, @Param("workName") String workName, @Param("phoneNum")String phoneNum,Page<LabelRespVO> page);
List<InspectionInfo> inspectionList(Page<InspectionInfo> page,@Param("partnerId")Long partnerId, @Param("status") String status, @Param("carNum")String carNum);
IPage<InspectionInfo> inspectionList(Page<InspectionInfo> page,@Param("partnerId")Long partnerId, @Param("status") String status, @Param("carNum")String carNum);
List<InspectionInfo> workerInspectionList(@Param("workerId")Long workerId,@Param("status") String status, @Param("searchValue")String searchValue);
List<OrderInfo> validationList(@Param("partnerId") Long partnerId, @Param("searchValue") String searchValue);
List<InspectionPickCar> getPickCarList(@Param("partnerId") Long partnerId, @Param("phoneNum") String phoneNum, @Param("pickStatus") String pickStatus);
IPage<InspectionPickCar> getPickCarList(Page page,@Param("partnerId") Long partnerId, @Param("phoneNum") String phoneNum, @Param("pickStatus") String pickStatus);
List<InspectionPickCar> getPickCarListOfWorker(@Param("workerId") Long workerId, @Param("phoneNum") String phoneNum);
List<OrderInfo> chartInfoAmount(@Param("startTime") String startTime,@Param("endTime")String endTime,@Param("partnerId")Long partnerId);

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.inspection.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.iocoder.yudao.module.inspection.entity.InspectionAppointment;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -64,7 +65,7 @@ public interface InspectionAppointmentMapper extends BaseMapper<InspectionAppoin
* @return 结果
*/
public int deleteInspectionAppointmentByIds(Long[] ids);
List<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page,@Param("partnerId") Long partnerId, @Param("phoneNum")String phoneNum);
IPage<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page, @Param("partnerId") Long partnerId, @Param("phoneNum")String phoneNum);
List<InspectionAppointment> getAppointmentOwn(@Param("userId") Long userId);

View File

@ -4,7 +4,10 @@ import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.iocoder.yudao.module.inspection.entity.InspectionEquInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* equInfoMapper接口
@ -29,6 +32,6 @@ public interface InspectionEquInfoMapper extends BaseMapper<InspectionEquInfo>
* @param inspectionEquInfo equInfo
* @return equInfo集合
*/
public List<InspectionEquInfo> selectInspectionEquInfoList(InspectionEquInfo inspectionEquInfo);
public IPage<InspectionEquInfo> selectInspectionEquInfoList(Page page, @Param("inspectionEquInfo") InspectionEquInfo inspectionEquInfo);
}

View File

@ -69,20 +69,20 @@ public interface AppInspectionPartnerService extends IService<ShopMallPartners>
void delWorker(Long partnerId,Long workId);
List<InspectionInfo> inspectionList(Page<InspectionInfo> page,Long partnerId, String status, String carNum);
IPage<InspectionInfo> inspectionList(Page<InspectionInfo> page,Long partnerId, String status, String carNum);
InspectionInfoVo inspectionDetail(Long inspectionInfoId);
List<InspectionInfo> workerInspectionList(Long partnerId,String status,String searchValue);
void addStepInfo(InspectionStepInfo stepInfo);
void stopInspection(InspectionInfo info) throws Exception;
void makeCertOk(Long inspectionId);
List<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page,Long partnerId,String phoneNum);
IPage<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page,Long partnerId,String phoneNum);
List<OrderInfo> validationList(Long partnerId,String searchValue);
void sendCoupon(ShopCouponTemplate template) throws Exception;
List<ShopCouponTemplate> listCoupon(Long partnerId,String searchValue);
void delCoupon(Long partnerId,Long id);
void designatePickCarWorker(Long pickCarId,Long workerId);
List<InspectionPickCar> getPickCarList(Long partnerId, String phoneNum,String pickStatus);
IPage<InspectionPickCar> getPickCarList(Page page,Long partnerId, String phoneNum,String pickStatus);
InspectionPickCar getPickCarDetail(Long dataId);
List<InspectionPickCar> getPickCarListOfWorker(Long workerId, String phoneNum);
JSONObject vehicleLicenseOCR(String imagePath) throws Exception;

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.inspection.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.iocoder.yudao.module.inspection.entity.InspectionAppointment;
@ -73,6 +74,6 @@ public interface IInspectionAppointmentService extends IService<InspectionAppoi
JSONObject pickCarInfo();
JSONObject computeDistanceAndPrice(Long goodsId,Double longitude,Double latitude,String type ) throws Exception;
public List<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page,Long partnerId, String phoneNum);
public IPage<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page, Long partnerId, String phoneNum);
List<InspectionAppointment> getAppointmentOwn();
}

View File

@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.inspection.service;
import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.iocoder.yudao.module.inspection.entity.InspectionEquInfo;
@ -27,7 +29,7 @@ public interface IInspectionEquInfoService extends IService<InspectionEquInfo>
* @param inspectionEquInfo equInfo
* @return equInfo集合
*/
public List<InspectionEquInfo> selectInspectionEquInfoList(InspectionEquInfo inspectionEquInfo);
public IPage<InspectionEquInfo> selectInspectionEquInfoList(Page page,InspectionEquInfo inspectionEquInfo);
/**
* 新增equInfo

View File

@ -239,7 +239,6 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
return null;
}
StatisticsInfo statisticsInfo2 = baseMapper.orderNum(partnerId, DateUtil.format(new Date(),"yyyy-MM-dd"));
//合规且合格双燃料
Integer i = baseMapper.srlNum(partnerId, DateUtil.format(new Date(), "yyyy-MM-dd"));
Integer hgNum = baseMapper.hgNum(partnerId, DateUtil.format(new Date(), "yyyy-MM-dd"));
@ -1100,7 +1099,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
}
@Override
public List<InspectionInfo> inspectionList(Page<InspectionInfo> page,Long partnerId, String status, String carNum) {
public IPage<InspectionInfo> inspectionList(Page<InspectionInfo> page,Long partnerId, String status, String carNum) {
return baseMapper.inspectionList(page,partnerId,status,carNum);
}
@ -1243,7 +1242,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
}
@Override
public List<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page,Long partnerId,String phoneNum) {
public IPage<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page,Long partnerId,String phoneNum) {
return appointmentService.getAppointmentList(page,partnerId,phoneNum);
}
@ -1311,9 +1310,9 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
}
@Override
public List<InspectionPickCar> getPickCarList(Long partnerId, String phoneNum,String pickStatus) {
public IPage<InspectionPickCar> getPickCarList(Page page,Long partnerId, String phoneNum,String pickStatus) {
return baseMapper.getPickCarList(partnerId,phoneNum,pickStatus);
return baseMapper.getPickCarList(page,partnerId,phoneNum,pickStatus);
}
@Override

View File

@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import cn.iocoder.yudao.util.SendSmsUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.iocoder.yudao.util.DateUtils;
@ -347,7 +348,7 @@ public class InspectionAppointmentServiceImpl extends ServiceImpl<InspectionAppo
}
@Override
public List<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page,Long partnerId, String phoneNum) {
public IPage<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page, Long partnerId, String phoneNum) {
return baseMapper.getAppointmentList(page,partnerId,phoneNum);
}

View File

@ -7,6 +7,8 @@ import java.util.List;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.iocoder.yudao.util.DateUtils;
import cn.iocoder.yudao.module.inspection.entity.WarnMessage;
@ -48,9 +50,9 @@ public class InspectionEquInfoServiceImpl extends ServiceImpl<InspectionEquInfoM
* @return equInfo
*/
@Override
public List<InspectionEquInfo> selectInspectionEquInfoList(InspectionEquInfo inspectionEquInfo)
public IPage<InspectionEquInfo> selectInspectionEquInfoList(Page page,InspectionEquInfo inspectionEquInfo)
{
return baseMapper.selectInspectionEquInfoList(inspectionEquInfo);
return baseMapper.selectInspectionEquInfoList(page,inspectionEquInfo);
}
/**

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.payment.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
@ -14,7 +15,7 @@ import java.util.Date;
* @since 2023-07-24 18:30:28
*/
@Data
public class OrderInfo {
public class OrderInfo extends TenantBaseDO {
//订单id
private Long id;
private String transactionId;
@ -63,16 +64,11 @@ public class OrderInfo {
private Integer commentStar;
//订单类型
private String orderType;
//创建时间
private Date createTime;
//创建人id
private Long creator;
//创建人所在部门
private Long deptId;
//更新时间
private Date updateTime;
//更新人id
private Integer updater;
//积分充值的金额
@TableField(exist = false)
private Long balanceCz;

View File

@ -278,7 +278,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
createOrder.setPartnerName(goods.getString("partnerName"));
createOrder.setRealName(user.getNickname());
createOrder.setPhonenumber(user.getMobile());
createOrder.setCreator(user.getId());
createOrder.setCreator(String.valueOf(user.getId()));
createOrder.setDeptId(user.getDeptId());
createOrder.setReduceMoney(goods.getLong("reduceMoney"));
//待支付

View File

@ -113,7 +113,6 @@
sum((oi.pay_time like CONCAT(#{timeStr},'%') and oi.create_time like CONCAT(#{timeStr},'%'))),0) as workedNum
FROM
order_info oi
</select>
<select id="allAmount" resultType="java.lang.Integer">
SELECT
@ -431,7 +430,7 @@ FROM
partner_worker pw
INNER JOIN system_users su ON pw.user_id = su.id
left JOIN system_user_post sup on sup.user_id = su.id
where pw.partner_id = #{partnerId}
where pw.deleted = 0
<if test="workName!=null and workName!=''">
and su.nickname like concat('%',#{workName},'%')
</if>

View File

@ -10,10 +10,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectInspectionEquInfoList" parameterType="cn.iocoder.yudao.module.inspection.entity.InspectionEquInfo" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionEquInfo">
select * from inspection_equ_info
<where>
<if test="equName != null and equName != ''"> and equ_name like concat('%', #{equName}, '%')</if>
<if test="equModel != null and equModel != ''"> and equ_model like concat('%', #{equModel}, '%')</if>
<if test="equNumber != null and equNumber != ''"> and equ_number like concat('%', #{equNumber}, '%')</if>
<if test="params.beginNextCheckTime != null and params.beginNextCheckTime != '' and params.endNextCheckTime != null and params.endNextCheckTime != ''"> and next_check_time between #{params.beginNextCheckTime} and #{params.endNextCheckTime}</if>
<if test="inspectionEquInfo.equName != null and inspectionEquInfo.equName != ''"> and equ_name like concat('%', #{inspectionEquInfo.equName}, '%')</if>
<if test="inspectionEquInfo.equModel != null and inspectionEquInfo.equModel != ''"> and equ_model like concat('%', #{inspectionEquInfo.equModel}, '%')</if>
<if test="inspectionEquInfo.equNumber != null and inspectionEquInfo.equNumber != ''"> and equ_number like concat('%', #{inspectionEquInfo.equNumber}, '%')</if>
<if test="inspectionEquInfo.params.beginNextCheckTime != null and inspectionEquInfo.params.beginNextCheckTime != '' and params.endNextCheckTime != null and params.endNextCheckTime != ''">
and next_check_time between #{inspectionEquInfo.params.beginNextCheckTime} and #{inspectionEquInfo.params.endNextCheckTime}</if>
</where>
</select>

View File

@ -1,62 +1,34 @@
package cn.iocoder.yudao.module.app.controller;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.common.CommonErrorCodeConstants;
import cn.iocoder.yudao.common.SystemEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.config.SecurityProperties;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.app.vo.WxLoginBody;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginReqVO;
import cn.iocoder.yudao.module.app.wechat.service.WechatService;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginRespVO;
import cn.iocoder.yudao.module.system.controller.admin.user.LoginBody;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.auth.AdminAuthService;
import cn.iocoder.yudao.module.system.service.permission.MenuService;
import cn.iocoder.yudao.module.system.service.permission.RoleService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import cn.iocoder.yudao.util.AESUtil;
import cn.iocoder.yudao.util.WechatPayConfig;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;
import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
import java.security.spec.AlgorithmParameterSpec;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.*;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
* 登录验证
@ -76,11 +48,20 @@ public class LoginController {
@Resource
private SecurityProperties securityProperties;
@Autowired
private CustomerMainService customerMainService;
private WechatService wechatService;
@Autowired
private AESUtil aesUtil;
/**
* 微信授权登录
* @author vinjor-M
* @date 17:43 2024/10/10
* @param wxLoginBody 请求体
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
@PostMapping("/wxLogin")
@TenantIgnore
public CommonResult wxLogin(@RequestBody WxLoginBody wxLoginBody) {
public CommonResult<?> wxLogin(@RequestBody WxLoginBody wxLoginBody) {
String code = wxLoginBody.getCode();
//秘钥
String encryptedIv = wxLoginBody.getEncryptedIv();
@ -97,29 +78,25 @@ public class LoginController {
String decryptResult = "";
try {
//如果没有绑定微信开放平台解析结果是没有unionid的
decryptResult = decrypt(sessionKey, encryptedIv, encryptedData);
decryptResult = aesUtil.decrypt(sessionKey, encryptedIv, encryptedData);
} catch (Exception e) {
e.printStackTrace();
return error(500, "微信登录失败!");
}
if (StringUtils.hasText(decryptResult)) {
//如果解析成功,获取token
AuthLoginRespVO loginVO = loginService.wxLoginRepair(decryptResult,openId,wxLoginBody.getInviteId());
//查用户未注册的话自动注册
AdminUserDO adminUserDO = wechatService.wechatLogin(SystemEnum.REPAIR.getCode(),decryptResult,openId,wxLoginBody.getInviteId());
//登录生成token
AuthLoginRespVO loginVO = loginService.wxLoginByUserId(adminUserDO.getId(),adminUserDO.getUsername());
Map<String, Object> map = new HashMap<>();
map.put("token", loginVO.getAccessToken());
//查会员表里是否有数据
CustomerMain customerMain = customerMainService.getCustomerByUserId(loginVO.getUserId());
map.put("ifNeedFill", null==customerMain);
return success(map);
} else {
return error(500, "微信登录失败!");
}
}
@PostMapping("/logout")
@Operation(summary = "登出系统")
public CommonResult<Boolean> logout(HttpServletRequest request) {
@ -130,48 +107,4 @@ public class LoginController {
}
return success(true);
}
/**
* AES解密
*/
private String decrypt(String sessionKey,String encryptedIv,String encryptedData) throws Exception{
// 转化为字节数组
byte[] key = Base64.decode(sessionKey);
byte[] iv = Base64.decode(encryptedIv);
byte[] encData = Base64.decode(encryptedData);
// 如果密钥不足16位那么就补足
int base =16;
if (key.length % base !=0) {
int groups = key.length / base +(key.length % base != 0 ? 1 : 0);
byte[] temp = new byte[groups * base];
Arrays.fill(temp,(byte) 0);
System.arraycopy(key,0,temp,0,key.length);
key = temp;
}
// 如果初始向量不足16位也补足
if (iv.length % base !=0) {
int groups = iv.length / base +(iv.length % base != 0 ? 1 : 0);
byte[] temp = new byte[groups * base];
Arrays.fill(temp,(byte) 0);
System.arraycopy(iv,0,temp,0,iv.length);
iv = temp;
}
AlgorithmParameterSpec ivSpec = new IvParameterSpec(iv);
String resultStr = null;
try {
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
SecretKeySpec keySpec = new SecretKeySpec(key,"AES");
cipher.init(Cipher.DECRYPT_MODE,keySpec,ivSpec);
resultStr = new String(cipher.doFinal(encData),"UTF-8");
} catch (Exception e){
// logger.info("解析错误");
e.printStackTrace();
}
// 解析加密后的字符串
return resultStr;
}
}

View File

@ -1,20 +0,0 @@
package cn.iocoder.yudao.module.app.service;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
/**
* @author vinjor-m
* @description 维修模块微信登录逻辑
**/
public interface WechatLoginService {
/**
* 维修系统-微信授权登录-未注册自动注册
* @author vinjor-M
* @date 15:14 2024/10/9
* @param decryptResult TODO
* @param openId TODO
* @param inviteId TODO
* @return cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO
**/
AdminUserDO wechatLogin(String decryptResult,String openId,String inviteId);
}

View File

@ -20,5 +20,5 @@ public class WxLoginBody {
private String encryptedData;
//邀请码
private Long inviteId;
private String inviteId;
}

View File

@ -26,7 +26,7 @@
<druid.version>1.2.23</druid.version>
<mybatis.version>3.5.16</mybatis.version>
<mybatis-plus.version>3.5.7</mybatis-plus.version>
<pagehelper.boot.version>2.1.0</pagehelper.boot.version>
<pagehelper.boot.version>1.4.6</pagehelper.boot.version>
<jsqlparser.version>4.9</jsqlparser.version>
<mybatis-plus-generator.version>3.5.7</mybatis-plus-generator.version>
<dynamic-datasource.version>4.3.1</dynamic-datasource.version>

View File

@ -375,7 +375,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
List<RoleDO> jcyh = roleService.getRoleListByCodes(Collections.singletonList("jcyh"));
Set<Long> ids = new HashSet<>();
ids.add(jcyh.get(0).getId());
permissionService.assignUserRole(user.getId(),ids);
permissionService.assignUserRole(uid,ids);
}else {
//更新
user.setId(wxUser.getId());
@ -408,7 +408,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
@Override
public AuthLoginRespVO wxLoginByUserId(Long userId, String userName) {
// 生成token
return createTokenAfterLoginSuccess(userId, userName, LoginLogTypeEnum.LOGIN_USERNAME);
return createTokenAfterLoginSuccess(userId, userName, LoginLogTypeEnum.LOGIN_SOCIAL);
}
/**