This commit is contained in:
lzttt 2024-10-12 12:41:10 +08:00
commit b1eb9cfbc4
68 changed files with 3207 additions and 404 deletions

View File

@ -94,5 +94,30 @@ public class BaseConstants {
public static final String ORDER_KKYL = "3";
/**订单店铺名称*/
public static final String ORDER_TENANT_NAME = "蓝安集团";
/**------工单记录常量-----------*/
/**工单*/
public static final String REPAIR_RECORD_TYPE_TICKET = "ticket";
/**工单附属项目*/
public static final String REPAIR_RECORD_TYPE_REPAIR_ITEM = "repairItem";
/**维修记录*/
public static final String REPAIR_RECORD_TYPE_RECORD = "record";
/**创建工单*/
public static final String REPAIR_RECORD_TYPE_CJGD = "cjgd";
/**指派施工*/
public static final String REPAIR_RECORD_TYPE_ZPSG = "zpsg";
/**领料*/
public static final String REPAIR_RECORD_TYPE_LL = "ll";
/**退料*/
public static final String REPAIR_RECORD_TYPE_TL = "tl";
/**施工完成(自检)*/
public static final String REPAIR_RECORD_TYPE_SGWCZJ = "sgwczj";
/**总检*/
public static final String REPAIR_RECORD_TYPE_ZJ = "zj";
/**结束工单*/
public static final String REPAIR_RECORD_TYPE_JSGD = "jsgd";
}

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

@ -7,7 +7,6 @@ import cn.iocoder.yudao.module.app.car.vo.AppCarMainResVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -73,7 +72,6 @@ public class AppCarMainController {
@Operation(summary = "获得车辆信息")
// @PreAuthorize("@ss.hasPermission('base:car-main:query')")
public CommonResult<List<AppCarMainResVo>> getCarMain() {
List<AppCarMainResVo> carMain = carMainService.getCarMain();
return CommonResult.success(carMain);
}

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,20 @@
package cn.iocoder.yudao.module.app.wechat.service.impl;
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 +36,10 @@ public class WechatServiceImpl implements WechatService {
private AdminUserApi adminUserApi;
@Resource
private AdminAuthService loginService;
@Resource
private AdminUserService userService;
@Resource
private PasswordEncoder passwordEncoder;
/**
* 微信自动登录
*
@ -88,4 +97,71 @@ 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(user.getUsername());
wxUser.setNickname(user.getNickname());
}
if(!StringUtils.isEmpty(inviteId)){
//那邀请者的码查邀请者的信息
}
return wxUser;
}
}

View File

@ -0,0 +1,66 @@
package cn.iocoder.yudao.module.custom.controller.app;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.custom.service.UserCarService;
import cn.iocoder.yudao.module.custom.vo.UserCarVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@Tag(name = "管理后台 - 用户车辆信息表--用户个人录入的")
@RestController
@RequestMapping("/base/user-car")
@Validated
public class UserCarController {
@Resource
private UserCarService userCarService;
/**
* 查询当前登录用户的所有车辆
* @author vinjor-M
* @date 14:28 2024/10/11
**/
@GetMapping("/getMyCar")
@Operation(summary = "查询个人车辆列表")
public CommonResult<?> getMyCar() {
return CommonResult.success(userCarService.getMyCar());
}
/**
* 创建或更新车辆信息
*
* @param userCarVO 车辆信息
*/
@PostMapping("/createOrUpdate")
@Operation(summary = "创建或更新车辆信息")
public CommonResult<?> createOrUpdate(@RequestBody UserCarVO userCarVO) {
return userCarService.createOrUpdate(userCarVO);
}
/**
* OCR识别
* @author vinjor-M
* @date 16:58 2024/10/11
* @param imagePath 公网图片地址
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
@PostMapping("/vehicleLicenseOCR")
public CommonResult<?> vehicleLicenseOCR(@RequestBody String imagePath) throws Exception {
return CommonResult.success(userCarService.vehicleLicenseOCR(imagePath));
}
/**
* 删除车辆
* @author vinjor-M
* @date 14:28 2024/10/11
**/
@DeleteMapping("/delById")
@Operation(summary = "删除车辆")
public CommonResult<?> delById(String id) {
return CommonResult.success(userCarService.removeById(id));
}
}

View File

@ -0,0 +1,115 @@
package cn.iocoder.yudao.module.custom.entity;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.util.Date;
/**
* 用户车辆信息表--用户个人录入的 DO
*
* @author vinjor-M
*/
@TableName("base_user_car")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class UserCar extends BaseDO {
/**
* 主键标识
*/
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/**
* 用户ID
*/
private Long userId;
/**
* 发动机号码
*/
private String engineNumber;
/**
* 车架号
*/
private String vin;
/**
* 车牌号
*/
private String licenseNumber;
/**
* 车辆品牌
*/
private String carBrand;
/**
* 车辆型号
*/
private String carModel;
/**
* 车辆性质营运 非营运等
*/
private String carNature;
/**
* 车辆类别私家车 货车 教练车 公务车 出租车
*/
private String carCategory;
/**
* 行驶证图片
*/
private String carLicenseImg;
/**
* 车辆注册日期
*/
private Date carRegisterDate;
/**
* 保养日期
*/
private Date maintenanceDate;
/**
* 保养里程
*/
private Long maintenanceMileage;
/**
* 年检日期
*/
private Date inspectionDate;
/**
* 保险日期
*/
private Date insuranceDate;
/**
* 二级维护时间
*/
private Date checkDate;
/**
* 下次保养日期
*/
private Date nextMaintenanceDate;
/**
* 下次保养里程
*/
private Long nextMaintenanceMileage;
/**
* 下次年检日期
*/
private Date nextInspectionDate;
/**
* 保险到期日期
*/
private Date insuranceExpiryDate;
/**
* 下次二级维护时间
*/
private Date nextCheckDate;
/**
* 是否车主
*/
private String isOwner;
}

View File

@ -0,0 +1,28 @@
package cn.iocoder.yudao.module.custom.mapper;
import cn.iocoder.yudao.module.custom.entity.UserCar;
import cn.iocoder.yudao.module.custom.vo.UserCarVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 用户车辆信息表--用户个人录入的 Mapper
*
* @author vinjor-M
*/
@Mapper
public interface UserCarMapper extends BaseMapper<UserCar> {
/**
* 查询用户的车辆
* @author vinjor-M
* @date 18:53 2024/10/11
* @param userId 用户id
* @return java.util.List<cn.iocoder.yudao.module.custom.entity.UserCar>
**/
List<UserCarVO> selectByUserId(@Param("userId") Long userId);
}

View File

@ -0,0 +1,43 @@
package cn.iocoder.yudao.module.custom.service;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.custom.entity.UserCar;
import cn.iocoder.yudao.module.custom.vo.UserCarVO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import java.util.List;
/**
* 用户车辆信息表--用户个人录入的 Service 接口
*
* @author vinjor-M
*/
public interface UserCarService extends IService<UserCar> {
/**
* 创建或更新车辆信息
* @author vinjor-M
* @date 14:11 2024/10/11
* @param userCarVO 车辆信息
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
CommonResult<?> createOrUpdate(UserCarVO userCarVO);
/**
* 查询当前登录用户的所有车辆
* @author vinjor-M
* @date 14:28 2024/10/11
* @return java.util.List<cn.iocoder.yudao.module.custom.vo.UserCarVO>
**/
List<UserCarVO> getMyCar();
/**
*
* @author vinjor-M
* @date 16:59 2024/10/11
* @param imagePath 公网图片地址
* @return java.lang.Object
**/
Object vehicleLicenseOCR(String imagePath) throws TencentCloudSDKException;
}

View File

@ -0,0 +1,83 @@
package cn.iocoder.yudao.module.custom.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.custom.entity.UserCar;
import cn.iocoder.yudao.module.custom.mapper.UserCarMapper;
import cn.iocoder.yudao.module.custom.service.UserCarService;
import cn.iocoder.yudao.module.custom.vo.DrivelicenseVO;
import cn.iocoder.yudao.module.custom.vo.UserCarVO;
import cn.iocoder.yudao.util.VehicleLicenseOCR;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.List;
/**
* 用户车辆信息表--用户个人录入的 Service 实现类
*
* @author vinjor-M
*/
@Service
@Validated
public class UserCarServiceImpl extends ServiceImpl<UserCarMapper, UserCar> implements UserCarService {
@Resource
private UserCarMapper userCarMapper;
/**
* 创建或更新车辆信息
*
* @param userCarVO 车辆信息
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
* @author vinjor-M
* @date 14:11 2024/10/11
**/
@Override
public CommonResult<?> createOrUpdate(UserCarVO userCarVO) {
//车牌号英文全部转大写
userCarVO.setLicenseNumber(userCarVO.getLicenseNumber().toUpperCase());
//设置所属者
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
userCarVO.setUserId(loginUser.getId());
this.saveOrUpdate(userCarVO);
return CommonResult.ok();
}
/**
* 查询当前登录用户的所有车辆
*
* @return java.util.List<cn.iocoder.yudao.module.custom.vo.UserCarVO>
* @author vinjor-M
* @date 14:28 2024/10/11
**/
@Override
public List<UserCarVO> getMyCar() {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
return userCarMapper.selectByUserId(loginUser.getId());
}
/**
* @param imagePath 公网图片地址
* @return java.lang.Object
* @author vinjor-M
* @date 16:59 2024/10/11
**/
@Override
public Object vehicleLicenseOCR(String imagePath) throws TencentCloudSDKException {
String info = VehicleLicenseOCR.dealFunction(imagePath);
JSONObject infoJson = JSONUtil.parseObj(info);
DrivelicenseVO licenseVO = BeanUtil.toBean(infoJson.getJSONObject("FrontInfo"),DrivelicenseVO.class);
if(licenseVO.getModel().contains("")){
licenseVO.setBrand(licenseVO.getModel().split("")[0]);
}
return licenseVO;
}
}

View File

@ -0,0 +1,36 @@
package cn.iocoder.yudao.module.custom.vo;
import lombok.Data;
/**
* 行驶证OCR识别结果
* @author vinjor-M
* @date 17:17 2024/10/11
**/
@Data
public class DrivelicenseVO {
/**所有人*/
private String Owner;
/**住址*/
private String Address;
/**车辆类型*/
private String VehicleType;
/**品牌型号*/
private String Model;
/**品牌*/
private String brand;
/**注册日期*/
private String RegisterDate;
/**发证日期*/
private String IssueDate;
/**车辆识别代号*/
private String Vin;
/**所有人*/
private String Seal;
/**车牌号*/
private String PlateNo;
/**使用性质*/
private String UseCharacter;
/**发动机号码*/
private String EngineNo;
}

View File

@ -0,0 +1,12 @@
package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.module.custom.entity.UserCar;
import lombok.Data;
@Data
public class UserCarVO extends UserCar {
/**品牌名称*/
private String brandName;
/**品牌logo*/
private String logoImg;
}

View File

@ -75,7 +75,7 @@ public class DlBaseNoticeController {
return CommonResult.ok();
}
@GetMapping("get")
@GetMapping("/get")
@Operation(summary = "平台通用信息公告 查询 按服务")
public CommonResult<?> getNoticeById(@RequestParam("id") String id) {
return success(dlBaseNoticeService.getById(id));

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.notice.entity;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
@ -16,7 +17,7 @@ import lombok.EqualsAndHashCode;
@TableName(value ="dl_base_notice")
@Data
@EqualsAndHashCode(callSuper = true)
public class DlBaseNotice extends TenantBaseDO {
public class DlBaseNotice extends BaseDO {
/**
* 公告ID
*/

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

@ -0,0 +1,12 @@
package cn.iocoder.yudao.util;
import org.springframework.stereotype.Component;
/**
* 基础工具类
* @author vinjor-M
* @date 14:15 2024/10/11
**/
@Component
public class BaseUtil {
}

View File

@ -0,0 +1,23 @@
<?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="cn.iocoder.yudao.module.custom.mapper.UserCarMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="selectByUserId" resultType="cn.iocoder.yudao.module.custom.vo.UserCarVO">
SELECT
buc.* ,
bcb.brand_name AS brandName,
bcb.logo_img as logoImg
FROM
base_user_car buc
LEFT JOIN base_car_brand bcb ON buc.car_brand = bcb.id
WHERE buc.user_id = #{userId}
AND buc.deleted = 0
</select>
</mapper>

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,26 @@ 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);
map.put("userinfo", adminUserDO);
return success(map);
} else {
return error(500, "微信登录失败!");
}
}
@PostMapping("/logout")
@Operation(summary = "登出系统")
public CommonResult<Boolean> logout(HttpServletRequest request) {
@ -130,48 +108,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

@ -1,21 +1,12 @@
package cn.iocoder.yudao.module.base.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO;
import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO;
import cn.iocoder.yudao.module.base.vo.RepairRecordsSaveReqVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
* 维修记录 管理 API
@ -30,43 +21,5 @@ public class RepairRecordsController {
@Resource
private RepairRecordsService repairRecordsService;
@PostMapping("/create")
@Operation(summary = "创建维修记录")
public CommonResult<String> createRepairRecords(@Valid @RequestBody RepairRecordsSaveReqVO createReqVO) {
return success(repairRecordsService.createRepairRecords(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新维修记录")
public CommonResult<Boolean> updateRepairRecords(@Valid @RequestBody RepairRecordsSaveReqVO updateReqVO) {
repairRecordsService.updateRepairRecords(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除维修记录")
@Parameter(name = "id", description = "编号", required = true)
public CommonResult<Boolean> deleteRepairRecords(@RequestParam("id") String id) {
repairRecordsService.deleteRepairRecords(id);
return success(true);
}
// @GetMapping("/get")
// @Operation(summary = "获得维修记录")
// @Parameter(name = "id", description = "编号", required = true, example = "1024")
// public CommonResult<RepairRecordsRespVO> getRecords(@RequestParam("id") String id) {
// RepairRecords records = repairRecordsService.getRepairRecords(id);
// return success(BeanUtils.toBean(records, RepairRecordsRespVO.class));
// }
/**
* 维修工查询维修记录
* @param pageReqVO
*
*/
@GetMapping("/page")
@Operation(summary = "获得维修记录分页")
public List<RepairRecordsRespVO> queryAllRepairRecords(@RequestBody RepairRecordsPageReqVO pageReqVO) {
return repairRecordsService.queryAllRepairRecords(pageReqVO);
}
}

View File

@ -23,7 +23,7 @@ public class RepairRecords extends TenantBaseDO {
/**
* 主键标识
*/
@TableId(type = IdType.INPUT)
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/**
* 工单id
@ -32,7 +32,7 @@ public class RepairRecords extends TenantBaseDO {
/**
* 工单子表id
*/
private String repairTitemId;
private String repairItemId;
/**
* 记录类型repair_records_type
*/
@ -41,10 +41,6 @@ public class RepairRecords extends TenantBaseDO {
* 记录描述
*/
private String remark;
/**
* 过程记录中的图片多个拼接
*/
private String image;
/**
* 处理人
*/
@ -52,6 +48,6 @@ public class RepairRecords extends TenantBaseDO {
/**
* 处理人员工表id
*/
private String dealUserId;
private Long dealUserId;
}

View File

@ -0,0 +1,52 @@
package cn.iocoder.yudao.module.base.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
/**
* 维修记录附件
* @author pqz
*/
@TableName("dl_repair_records_item")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RepairRecordsItem extends TenantBaseDO {
/**
* 主键标识
*/
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/**
* 记录id
*/
private String recordId;
/**
* 工单id
*/
private String ticketId;
/**
* 工单子表id
*/
private String repairItemId;
/**
* 记录描述
*/
private String remark;
/**
* 图片附件
*/
private String image;
/**
* 是否开放给用户0否1是
*/
private String isOpen;
}

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.base.mapper;
import cn.iocoder.yudao.module.base.entity.RepairRecordsItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 维修记录 Mapper
*
* @author pqz
*/
@Mapper
public interface RepairRecordsItemMapper extends BaseMapper<RepairRecordsItem> {
}

View File

@ -17,7 +17,6 @@ import java.util.List;
@Mapper
public interface RepairRecordsMapper extends BaseMapper<RepairRecords> {
/**
* 查询维修记录
* @author lzt
@ -25,6 +24,8 @@ public interface RepairRecordsMapper extends BaseMapper<RepairRecords> {
* @return List<RepairRecordsRespVO>
* @date 2024年10月9日
*/
List<RepairRecordsRespVO> queryAllRepairRecords(@Param("entity") RepairRecordsPageReqVO entity);
List<RepairRecordsRespVO> queryRepairRecords(@Param("entity") RepairRecordsPageReqVO entity);
}

View File

@ -0,0 +1,58 @@
package cn.iocoder.yudao.module.base.service;
import cn.iocoder.yudao.module.base.entity.RepairRecordsItem;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* 维修记录 Service 接口
*
* @author pqz
*/
public interface RepairRecordsItemService extends IService<RepairRecordsItem> {
/**
* 根据主表id删除附件
*
* @param mainType ticket工单repairItem工单附属项目record维修记录
* @param mainId 主表id
* @author PQZ
* @date 11:43 2024/10/11
**/
void removeByMainId(String mainType, String mainId);
/**
* 通过主表id查询图片
*
* @param mainType ticket工单repairItem工单附属项目record维修记录
* @param mainId 主表id
* @param isOpen 是否开放给用户默认查询全部如不为null则根据条件查询
* @return 记录图片集合
* @author PQZ
* @date 14:30 2024/10/11
**/
List<RepairRecordsItem> getByMainId(String mainType, String mainId, String isOpen);
/**
* 保存维修记录相关的图片
*
* @param recordId 记录id
* @param ticketId 工单id
* @param repairItemId 工单子表id
* @param image 上传附件相对路径多个用分隔
* @author PQZ
* @date 14:09 2024/10/11
**/
void saveItem(String recordId, String ticketId, String repairItemId, String image);
/**
* 设置图片是否开放给用户
*
* @param ids 前端选中图片id多个用分隔
* @param isOpen 0否1是
* @author PQZ
* @date 14:22 2024/10/11
**/
void setRepairOpen(String ids, String isOpen);
}

View File

@ -3,13 +3,8 @@ package cn.iocoder.yudao.module.base.service;
import cn.iocoder.yudao.module.base.entity.RepairRecords;
import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO;
import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO;
import cn.iocoder.yudao.module.base.vo.RepairRecordsSaveReqVO;
import cn.iocoder.yudao.module.base.vo.RepairWorkerPageReqVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.validation.Valid;
import java.util.List;
/**
@ -20,43 +15,25 @@ import java.util.List;
public interface RepairRecordsService extends IService<RepairRecords> {
/**
* 创建维修记录
* 保存维修记录
*
* @param createReqVO 创建信息
* @return 编号
*/
String createRepairRecords(@Valid RepairRecordsSaveReqVO createReqVO);
* @param ticketId 工单id
* @param repairItemId 工单子表id
* @param type 工作类型数据字典repair_records_type;后端已初始化常量可直接引用base包中BaseConstants下106-119行
* @param remark 备注
* @param images 图片(相对路径按照,分隔)
* @author PQZ
* @date 14:51 2024/10/11
**/
void saveRepairRecord(String ticketId, String repairItemId, String type, String remark, String images);
/**
* 更新维修记录
*
* @param updateReqVO 更新信息
*/
void updateRepairRecords(@Valid RepairRecordsSaveReqVO updateReqVO);
/**
* 删除维修记录
*
* @param id 编号
*/
void deleteRepairRecords(String id);
// /**
// * 获得维修记录
// *
// * @param id 编号
// * @return 维修记录
// */
// RepairRecords getRepairRecords(String id);
/**
* 获得维修记录
*
* @param pageReqVO 查询条件
* @return queryAllRepairRecords 所有维修记录
*/
List<RepairRecordsRespVO> queryAllRepairRecords(RepairRecordsPageReqVO pageReqVO);
* 根据条件查询维修记录
* @author PQZ
* @date 15:14 2024/10/11
* @param pageReqVO RepairRecordsPageReqVO实体
* @return java.util.List<cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO>
**/
List<RepairRecordsRespVO> queryList(RepairRecordsPageReqVO pageReqVO);
}

View File

@ -0,0 +1,154 @@
package cn.iocoder.yudao.module.base.service.impl;
import cn.iocoder.yudao.module.base.entity.RepairRecordsItem;
import cn.iocoder.yudao.module.base.mapper.RepairRecordsItemMapper;
import cn.iocoder.yudao.module.base.service.RepairRecordsItemService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.common.BaseConstants.*;
/**
* 维修记录 Service 实现类
*
* @author pqz
*/
@Service
@Validated
public class RepairRecordsItemServiceImpl extends ServiceImpl<RepairRecordsItemMapper, RepairRecordsItem> implements RepairRecordsItemService {
@Resource
private RepairRecordsItemMapper itemMapper;
/**
* 根据主表id删除附件
*
* @param mainType ticket工单repairItem工单附属项目record维修记录
* @param mainId 主表id
* @author PQZ
* @date 11:43 2024/10/11
**/
@Override
public void removeByMainId(String mainType, String mainId) {
//根据不同类型初始化不通过查询条件
LambdaQueryWrapper<RepairRecordsItem> lambdaQueryWrapper = queryType(mainType, mainId);
remove(lambdaQueryWrapper);
}
/**
* 通过主表id查询图片
*
* @param mainType ticket工单repairItem工单附属项目record维修记录
* @param mainId 主表id
* @param isOpen 是否开放给用户默认查询全部如不为null则根据条件查询
* @return 记录图片集合
* @author PQZ
* @date 14:30 2024/10/11
**/
@Override
public List<RepairRecordsItem> getByMainId(String mainType, String mainId, String isOpen) {
//根据不同类型初始化不通过查询条件
LambdaQueryWrapper<RepairRecordsItem> lambdaQueryWrapper = queryType(mainType, mainId);
//默认查询全部如不为null则根据条件查询
if (StringUtils.isNotEmpty(isOpen)) {
lambdaQueryWrapper.eq(RepairRecordsItem::getIsOpen, isOpen);
}
return list(lambdaQueryWrapper);
}
/**
* 保存维修记录相关的图片
*
* @param recordId 记录id
* @param ticketId 工单id
* @param repairItemId 工单子表id
* @param image 上传附件相对路径多个用分隔
* @author PQZ
* @date 14:09 2024/10/11
**/
@Override
public void saveItem(String recordId, String ticketId, String repairItemId, String image) {
//根据记录id删除改记录中原有的图片
removeByMainId(REPAIR_RECORD_TYPE_RECORD, recordId);
//组装维修记录图片集合
List<RepairRecordsItem> saveList = new ArrayList<>();
if (StringUtils.isNotEmpty(image)) {
//字符串转换集合
List<String> imageList = Arrays.stream(image.split(","))
.collect(Collectors.toList());
imageList.forEach(item -> {
RepairRecordsItem saveItem = new RepairRecordsItem();
saveItem.setRecordId(recordId);
saveItem.setTicketId(ticketId);
saveItem.setRepairItemId(repairItemId);
saveItem.setImage(item);
saveList.add(saveItem);
});
saveBatch(saveList);
}
}
/**
* 设置图片是否开放给用户
*
* @param ids 前端选中图片id多个用分隔
* @param isOpen 0否1是
* @author PQZ
* @date 14:22 2024/10/11
**/
@Override
public void setRepairOpen(String ids, String isOpen) {
if (StringUtils.isNotEmpty(ids)) {
//id字符串转换集合
List<String> idList = Arrays.stream(ids.split(","))
.collect(Collectors.toList());
LambdaUpdateWrapper<RepairRecordsItem> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
//设置更新条件
lambdaUpdateWrapper.in(RepairRecordsItem::getId, idList).set(RepairRecordsItem::getIsOpen, isOpen);
//更新
update(lambdaUpdateWrapper);
}
}
/**
* 封装查询条件
*
* @param mainType ticket工单repairItem工单附属项目record维修记录
* @param mainId 主表id
* @return com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<cn.iocoder.yudao.module.base.entity.RepairRecordsItem>
* @author PQZ
* @date 14:36 2024/10/11
**/
private LambdaQueryWrapper<RepairRecordsItem> queryType(String mainType, String mainId) {
LambdaQueryWrapper<RepairRecordsItem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
switch (mainType) {
//匹配根据工单表id删除条件
case REPAIR_RECORD_TYPE_TICKET:
lambdaQueryWrapper.eq(RepairRecordsItem::getTicketId, mainId);
break;
//匹配根据工单子表id删除条件
case REPAIR_RECORD_TYPE_REPAIR_ITEM:
lambdaQueryWrapper.eq(RepairRecordsItem::getRepairItemId, mainId);
break;
//匹配根据根据记录表id删除条件
case REPAIR_RECORD_TYPE_RECORD:
lambdaQueryWrapper.eq(RepairRecordsItem::getRecordId, mainId);
break;
default:
break;
}
return lambdaQueryWrapper;
}
}

View File

@ -1,21 +1,24 @@
package cn.iocoder.yudao.module.base.service.impl;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.base.entity.RepairRecords;
import cn.iocoder.yudao.module.base.entity.RepairRecordsItem;
import cn.iocoder.yudao.module.base.mapper.RepairRecordsMapper;
import cn.iocoder.yudao.module.base.service.RepairRecordsItemService;
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO;
import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO;
import cn.iocoder.yudao.module.base.vo.RepairRecordsSaveReqVO;
import cn.iocoder.yudao.module.base.vo.RepairWorkerPageReqVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.common.BaseConstants.REPAIR_RECORD_TYPE_RECORD;
/**
* 维修记录 Service 实现类
@ -28,46 +31,61 @@ public class RepairRecordsServiceImpl extends ServiceImpl<RepairRecordsMapper, R
@Resource
private RepairRecordsMapper repairRecordsMapper;
@Override
public String createRepairRecords(RepairRecordsSaveReqVO createReqVO) {
// 插入
RepairRecords records = BeanUtils.toBean(createReqVO, RepairRecords.class);
repairRecordsMapper.insert(records);
// 返回
return records.getId();
}
@Override
public void updateRepairRecords(RepairRecordsSaveReqVO updateReqVO) {
// 更新
RepairRecords updateObj = BeanUtils.toBean(updateReqVO, RepairRecords.class);
repairRecordsMapper.updateById(updateObj);
}
@Override
public void deleteRepairRecords(String id) {
// 删除
repairRecordsMapper.deleteById(id);
}
// @Override
// public RepairRecords getRepairRecords(String id) {
// return repairRecordsMapper.selectById(id);
// }
@Resource
private AdminUserApi userApi;
@Resource
private RepairRecordsItemService itemService;
/**
* 查询维修记录
* @apiNote lzt
* @param pageReqVO 查询条件
* @return queryAllRepairRecords 所有维修记录
* @date 2024年10月9日
*/
* 保存维修记录
*
* @param ticketId 工单id
* @param repairItemId 工单子表id
* @param type 工作类型数据字典repair_records_type;后端已初始化常量可直接引用base包中BaseConstants下106-119行
* @param remark 备注
* @param images 图片(相对路径按照分隔)
* @author PQZ
* @date 14:51 2024/10/11
**/
@Override
public List<RepairRecordsRespVO> queryAllRepairRecords(RepairRecordsPageReqVO pageReqVO) {
return repairRecordsMapper.queryAllRepairRecords(pageReqVO);
public void saveRepairRecord(String ticketId, String repairItemId, String type, String remark, String images) {
//获取当前登录用户
Long userId = SecurityFrameworkUtils.getLoginUserId();
AdminUserRespDTO loginUser = userApi.getUser(userId);
//初始化维修记录
RepairRecords repairRecords = new RepairRecords();
repairRecords.setTicketId(ticketId);
repairRecords.setRepairItemId(repairItemId);
repairRecords.setType(type);
repairRecords.setRemark(remark);
repairRecords.setDealUserId(loginUser.getId());
repairRecords.setDealUserName(loginUser.getNickname());
//保存维修记录
save(repairRecords);
//保存附件信息
itemService.saveItem(repairRecords.getId(), ticketId, repairItemId, images);
}
/**
* 根据条件查询维修记录
*
* @param pageReqVO RepairRecordsPageReqVO实体
* @return java.util.List<cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO>
* @author PQZ
* @date 15:14 2024/10/11
**/
@Override
public List<RepairRecordsRespVO> queryList(RepairRecordsPageReqVO pageReqVO) {
//根据条件查询维修记录
List<RepairRecordsRespVO> list = repairRecordsMapper.queryRepairRecords(pageReqVO);
//为每一条维修记录设置查询附件
list.forEach(item -> {
List<RepairRecordsItem> itemList = itemService.getByMainId(REPAIR_RECORD_TYPE_RECORD, item.getId(), pageReqVO.getIsOpen());
item.setItemList(itemList);
//相对路径按照分隔
item.setImages(itemList.stream().map(RepairRecordsItem::getImage).collect(Collectors.joining(",")));
});
return list;
}
}

View File

@ -11,5 +11,7 @@ import lombok.ToString;
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class RepairRecordsPageReqVO extends RepairRecords {
/**是否开放给用户*/
private String isOpen;
}

View File

@ -1,13 +1,20 @@
package cn.iocoder.yudao.module.base.vo;
import cn.iocoder.yudao.module.base.entity.RepairRecords;
import cn.iocoder.yudao.module.base.entity.RepairRecordsItem;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Schema(description = "管理后台 - 维修记录 Response VO")
@Data
@ExcelIgnoreUnannotated
public class RepairRecordsRespVO extends RepairRecords {
/**维修记录关联子表*/
private List<RepairRecordsItem> itemList;
/**维修记录关联附件信息*/
private String images;
}

View File

@ -9,4 +9,5 @@ import lombok.Data;
public class RepairRecordsSaveReqVO extends RepairRecords {
}

View File

@ -126,8 +126,7 @@ public class RepairWaresController {
@GetMapping("/getByName")
@Operation(summary = "根据名称获取最新的数据")
public CommonResult<?> getWaresByName(@RequestParam("name") String name) {
List<RepairWares> list = waresService.list(new LambdaQueryWrapper<RepairWares>().eq(RepairWares::getName, name));
return success(list.stream().max(Comparator.comparing(RepairWares::getCreateTime)).orElse(null));
return success(waresService.getWaresByName(name));
}

View File

@ -102,5 +102,7 @@ public class RepairWares extends TenantBaseDO {
private String status;
/**数据来源*/
private String dataForm;
/** 进价 */
private String purPrice;
}

View File

@ -28,4 +28,11 @@ public interface RepairWaresMapper extends BaseMapper<RepairWares> {
**/
IPage<RepairWaresRespVO> queryListPage(@Param("entity") RepairWaresPageReqVO pageReqVO, Page<RepairWaresRespVO> page);
/**
* 根据名称获取最新的数据
*
* @author 小李
* @date 18:03 2024/9/25
**/
RepairWaresRespVO getWaresByName(@Param("name") String name);
}

View File

@ -53,4 +53,11 @@ public interface RepairWaresService extends IService<RepairWares> {
**/
IPage<RepairWaresRespVO> getWaresPage(RepairWaresPageReqVO pageReqVO, Page<RepairWaresRespVO> page);
/**
* 根据名称获取最新的数据
*
* @author 小李
* @date 18:03 2024/9/25
**/
RepairWaresRespVO getWaresByName(String name);
}

View File

@ -89,4 +89,15 @@ public class RepairWaresServiceImpl extends ServiceImpl<RepairWaresMapper, Repai
return waresMapper.queryListPage(pageReqVO, page);
}
/**
* 根据名称获取最新的数据
*
* @author 小李
* @date 18:03 2024/9/25
**/
@Override
public RepairWaresRespVO getWaresByName(String name){
return waresMapper.getWaresByName(name);
}
}

View File

@ -7,6 +7,8 @@ import cn.iocoder.yudao.common.RepairErrorCodeConstants;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.company.entity.Company;
import cn.iocoder.yudao.module.company.service.CompanyService;
import cn.iocoder.yudao.module.project.entity.RepairWares;
import cn.iocoder.yudao.module.project.service.RepairWaresService;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
import cn.iocoder.yudao.module.stockOperate.mapper.DlRepairSoMapper;
@ -18,14 +20,18 @@ import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@ -48,6 +54,10 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
@Resource
private CompanyService companyService;
@Resource
@Lazy
private RepairWaresService waresService;
/**
* 采购单/领料单 新增
* @author 小李
@ -65,7 +75,9 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
if (ObjectUtil.isNotEmpty(dept)){
repairSoRespVO.setCorpId(dept.getCorpId());
Company company = companyService.getById(dept.getCorpId());
repairSoRespVO.setCorpName(company.getCorpName());
if (ObjectUtil.isNotEmpty(company)){
repairSoRespVO.setCorpName(company.getCorpName());
}
}
// 新增主表
@ -76,9 +88,31 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
}
repairSoRespVO.getGoodsList().forEach(item -> {
item.setSoId(repairSoRespVO.getId());
item.setSoiType(repairSoRespVO.getSoType());
// item.setSoiType(repairSoRespVO.getSoType());
});
repairSoiService.saveBatch(repairSoRespVO.getGoodsList());
// 操作配件库存表
// 获取所有需要操作的数据
List<DlRepairSoi> goodsList = repairSoRespVO.getGoodsList();
List<String> ids = goodsList.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList());
List<RepairWares> repairWares = waresService.listByIds(ids);
// 更新库存和进价
List<RepairWares> newWares = repairWares.stream().map(item -> {
// 取数据
DlRepairSoi repairSoi = goodsList.stream().filter(i -> i.getGoodsId().equals(item.getId())).collect(Collectors.toList()).get(0);
// 设置新值
// 如果是采购入库数量+如果是领料出库数量-
// 01, 03 是采购 02 是领料
BigDecimal count = new BigDecimal(repairSoi.getGoodsCount());
RepairWares wares = new RepairWares();
wares.setId(item.getId());
wares.setStock("02".equals(repairSoRespVO.getSoType()) ? item.getStock().subtract(count) : item.getStock().add(count));
// 更新进价
wares.setPurPrice(repairSoi.getGoodsPrice().toString());
return wares;
}).collect(Collectors.toList());
waresService.updateBatchById(newWares);
}
/**

View File

@ -0,0 +1,12 @@
<?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="cn.iocoder.yudao.module.base.mapper.RepairRecordsItemMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -9,15 +9,25 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="queryAllRepairRecords" resultType="cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO">
<select id="queryRepairRecords" resultType="cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO">
SELECT *
FROM dl_repair_records
<where>
<if test="entity.someField != null">
AND some_column = #{entity.someField}
deleted = '0'
<if test="entity.ticketId != null and entity.ticketId != ''">
AND ticket_id = #{entity.ticketId}
</if>
<if test="entity.repairItemId != null and entity.repairItemId != ''">
AND repair_item_id = #{entity.repairItemId}
</if>
<if test="entity.dealUserId != null and entity.dealUserId != ''">
AND deal_user_id = #{entity.dealUserId}
</if>
<if test="entity.type != null and entity.type != ''">
AND type = #{entity.type}
</if>
</where>
order by create_time desc
</select>
</mapper>

View File

@ -30,4 +30,18 @@
ORDER BY
drw.create_time DESC
</select>
<select id="getWaresByName" resultType="cn.iocoder.yudao.module.project.vo.RepairWaresRespVO">
SELECT
drw.*,
dbt.`name` AS typeName,
dbw.`name` AS warehouseName,
GROUP_CONCAT( bc.corp_name ) AS corpNames
FROM
dl_repair_wares drw
LEFT JOIN base_company bc ON FIND_IN_SET( bc.id, drw.corp_id ) > 0
LEFT JOIN dl_base_type dbt ON drw.type = dbt.id AND dbt.deleted = 0
LEFT JOIN dl_base_warehouse dbw ON drw.warehouse = dbw.id AND dbw.deleted = 0
where drw.name = #{name} order by drw.create_time desc limit 1
</select>
</mapper>

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

@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.system.controller.app.user;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 用户")
@RestController
@RequestMapping("/system/user")
@Validated
public class AppUserController {
@Resource
private AdminUserService userService;
/**
* 微信小程序端修改个人信息
* @author vinjor-M
* @date 20:14 2024/10/11
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
**/
@PutMapping("update")
@Operation(summary = "修改用户")
public CommonResult<Boolean> updateUser(@RequestBody UserInfoVO reqVO) {
userService.updateCusInfo(reqVO);
return success(true);
}
}

View File

@ -0,0 +1,13 @@
package cn.iocoder.yudao.module.system.controller.app.user;
import lombok.Data;
@Data
public class UserInfoVO {
/** 用户id **/
private Long id;
/** 用户昵称 **/
private String nickname;
/** 头像地址 **/
private String avatar;
}

View File

@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
import cn.iocoder.yudao.module.system.controller.app.user.UserInfoVO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -59,4 +60,6 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
AdminUserDO getUserByMobileWithoutTenant(String phoneNumber);
int updateSetOpenId(@Param("userId")Long userId,@Param("openId")String openId);
int updateCusInfo(@Param("entity") UserInfoVO userInfoVO);
}

View File

@ -6,8 +6,6 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils;
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.system.api.logger.dto.LoginLogCreateReqDTO;
import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi;
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO;
@ -217,6 +215,16 @@ public class AdminAuthServiceImpl implements AdminAuthService {
return AuthConvert.INSTANCE.convert(accessTokenDO);
}
private AuthLoginRespVO createTokenAfterLoginSuccessCustomer(Long userId, String username, LoginLogTypeEnum logType) {
// 插入登陆日志
createLoginLog(userId, username, logType, LoginResultEnum.SUCCESS);
// 创建访问令牌
OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.createAccessToken(userId, UserTypeEnum.MEMBER.getValue(),
OAuth2ClientConstants.CLIENT_ID_DEFAULT, null);
// 构建返回结果
return AuthConvert.INSTANCE.convert(accessTokenDO);
}
@Override
public AuthLoginRespVO refreshToken(String refreshToken) {
OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.refreshAccessToken(refreshToken, OAuth2ClientConstants.CLIENT_ID_DEFAULT);
@ -375,7 +383,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 +416,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
@Override
public AuthLoginRespVO wxLoginByUserId(Long userId, String userName) {
// 生成token
return createTokenAfterLoginSuccess(userId, userName, LoginLogTypeEnum.LOGIN_USERNAME);
return createTokenAfterLoginSuccessCustomer(userId, userName, LoginLogTypeEnum.LOGIN_SOCIAL);
}
/**

View File

@ -1,17 +1,23 @@
package cn.iocoder.yudao.module.system.service.user;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportExcelVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportRespVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
import cn.iocoder.yudao.module.system.controller.app.user.UserInfoVO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import javax.validation.Valid;
import java.io.InputStream;
import java.util.*;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 后台用户 Service 接口
@ -35,6 +41,14 @@ public interface AdminUserService {
*/
void updateUser(@Valid UserSaveReqVO updateReqVO);
/**
* 微信小程序端修改用户个人信息
* @author vinjor-M
* @date 20:11 2024/10/11
* @param userInfoVO 用户对象
**/
void updateCusInfo(UserInfoVO userInfoVO);
/**
* 更新用户的最后登陆信息
*

View File

@ -12,13 +12,13 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.datapermission.core.util.DataPermissionUtils;
import cn.iocoder.yudao.module.infra.api.config.ConfigApi;
import cn.iocoder.yudao.module.infra.api.file.FileApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportExcelVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportRespVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
import cn.iocoder.yudao.module.system.controller.app.user.UserInfoVO;
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
import cn.iocoder.yudao.module.system.dal.dataobject.dept.UserPostDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
@ -142,6 +142,18 @@ public class AdminUserServiceImpl implements AdminUserService {
LogRecordContext.putVariable("user", oldUser);
}
/**
* 微信小程序端修改用户个人信息
*
* @param userInfoVO 用户对象
* @author vinjor-M
* @date 20:11 2024/10/11
**/
@Override
public void updateCusInfo(UserInfoVO userInfoVO) {
userMapper.updateCusInfo(userInfoVO);
}
private void updateUserPost(UserSaveReqVO reqVO, AdminUserDO updateObj) {
Long userId = reqVO.getId();
Set<Long> dbPostIds = convertSet(userPostMapper.selectListByUserId(userId), UserPostDO::getPostId);

View File

@ -6,6 +6,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateSetOpenId">
UPDATE system_users SET open_id = #{openId} WHERE id = #{userId}
</update>
<update id="updateCusInfo">
UPDATE system_users
SET nickname = #{entity.nickname},avatar = #{entity.avatar}
WHERE id = #{entity.id}
</update>
<select id="getUsersByRoleRescue" resultType="cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO">
SELECT

View File

@ -36,6 +36,12 @@
<groupId>cn.iocoder.boot</groupId>
<artifactId>dl-module-base</artifactId>
<version>${revision}</version>
<exclusions>
<exclusion>
<artifactId>commons-fileupload</artifactId>
<groupId>commons-fileupload</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- 企业管理包 -->
<dependency>

View File

@ -296,7 +296,8 @@ yudao:
- /admin-api/rescue/driverLogin
- /admin-api/rescuePayApi/payNotify
- /admin-api/payApi/payNotify
- /admin-api/base/notice/**
- /app-api/** #小程序端接口,不区分租户
ignore-tables:
- system_tenant
- system_tenant_package
@ -342,6 +343,8 @@ yudao:
- tmp_report_data_1
- tmp_report_data_income
- system_users
- dl_base_notice
- base_user_car
ignore-caches:
- permission_menu_ids
- oauth_client

File diff suppressed because it is too large Load Diff