Merge branch 'master' of http://122.51.230.86:3000/dianliang/lanan-system
This commit is contained in:
commit
989adaad4b
@ -15,6 +15,11 @@
|
||||
点亮业务基础库
|
||||
</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-system-biz</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-system-api</artifactId>
|
||||
|
@ -9,6 +9,10 @@ public class BaseConstants {
|
||||
public static final String CUS_TYPE_CORP_ATTN = "04";
|
||||
/**政企客户*/
|
||||
public static final String CUS_TYPE_CORP = "03";
|
||||
/**私人客户*/
|
||||
public static final String CUS_TYPE_PRIVATE = "01";
|
||||
/**代办客户*/
|
||||
public static final String CUS_TYPE_AGENT = "02";
|
||||
/**客户标识*/
|
||||
public static final String CUS_SIGN_CUSTOMER = "customer";
|
||||
/**车辆标识*/
|
||||
@ -23,8 +27,12 @@ public class BaseConstants {
|
||||
public static final String SIGN_UPDATE = "update";
|
||||
/**默认密码*/
|
||||
public static final String PASSWORD_DEFAULT = "123456";
|
||||
/**租户下部门名称*/
|
||||
/**租户下部门名称--政企客户*/
|
||||
public static final String DEPT_NAME_CORP_NAME = "政企客户";
|
||||
/**租户下部门名称--私人客户*/
|
||||
public static final String DEPT_NAME_PRIVATE_NAME = "私人客户";
|
||||
/**租户下部门名称--代办客户*/
|
||||
public static final String DEPT_NAME_AGENT_NAME = "代办客户";
|
||||
/**私家车*/
|
||||
public static final String CAR_CATEGORY_PRIVATE = "01";
|
||||
/**货车*/
|
||||
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.common;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class WechatCommon {
|
||||
/**
|
||||
* 微信公众号APPID
|
||||
*/
|
||||
@Value(value = "${wx.mp.app-id}")
|
||||
public String APP_ID;
|
||||
/**
|
||||
* 微信公众号秘钥
|
||||
*/
|
||||
@Value(value = "${wx.mp.secret}")
|
||||
public String APP_SECRET;
|
||||
|
||||
/**
|
||||
* 获取网页的token,后续还有+"&code=&grant_type=authorization_code"
|
||||
**/
|
||||
public String getTokeUrl(){
|
||||
String appId = APP_ID;
|
||||
String appSecret = APP_SECRET;
|
||||
return "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + appId + "&secret=" + appSecret;
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.app.car.controller;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.custom.entity.CarBrand;
|
||||
import cn.iocoder.yudao.module.custom.service.CarBrandService;
|
||||
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;
|
||||
import java.util.List;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "小程序 - 车辆品牌维护")
|
||||
@RestController
|
||||
@RequestMapping("/userClient/base/carBrand")
|
||||
@Validated
|
||||
public class AppCarBrandController {
|
||||
|
||||
@Resource
|
||||
private CarBrandService carBrandService;
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得全部车辆品牌")
|
||||
public CommonResult<List<CarBrand>> getCarBrandList() {
|
||||
List<CarBrand> carBrandList = carBrandService.getCarBrandList();
|
||||
return success(carBrandList);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package cn.iocoder.yudao.module.app.car.controller;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.app.car.entity.AppCarMain;
|
||||
import cn.iocoder.yudao.module.app.car.service.AppCarMainService;
|
||||
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.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Tag(name = "小程序 - 我的车辆")
|
||||
@RestController
|
||||
@RequestMapping("/userClient/base/myCar")
|
||||
@Validated
|
||||
public class AppCarMainController {
|
||||
|
||||
@Autowired
|
||||
private AppCarMainService carMainService;
|
||||
|
||||
/**
|
||||
* 创建车辆信息
|
||||
*
|
||||
* @param carMain
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建车辆信息")
|
||||
// @PreAuthorize("@ss.hasPermission('base:car-main:create')")
|
||||
public CommonResult<String> createCarMain(@RequestBody AppCarMain carMain) {
|
||||
return carMainService.createCarMain(carMain);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新车辆信息
|
||||
*
|
||||
* @param carMain
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新车辆信息")
|
||||
// @PreAuthorize("@ss.hasPermission('base:car-main:update')")
|
||||
public CommonResult<String> updateCarMain(@RequestBody AppCarMain carMain) {
|
||||
return carMainService.updateCarMain(carMain);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除车辆信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除车辆信息")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
// @PreAuthorize("@ss.hasPermission('base:car-main:delete')")
|
||||
public CommonResult<String> deleteCarMain(@RequestParam("id") String id) {
|
||||
return carMainService.deleteCarMain(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前用户获得车辆信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得车辆信息")
|
||||
// @PreAuthorize("@ss.hasPermission('base:car-main:query')")
|
||||
public CommonResult<List<AppCarMainResVo>> getCarMain() {
|
||||
|
||||
List<AppCarMainResVo> carMain = carMainService.getCarMain();
|
||||
return CommonResult.success(carMain);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
package cn.iocoder.yudao.module.app.car.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 com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 车辆信息 DO
|
||||
*
|
||||
* @author 后台管理员
|
||||
*/
|
||||
@TableName("base_car_main")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AppCarMain extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 主键标识
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
/**
|
||||
* 发动机号码
|
||||
*/
|
||||
private String engineNumber;
|
||||
/**
|
||||
* 车架号
|
||||
*/
|
||||
private String vin;
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
private String licenseNumber;
|
||||
/**
|
||||
* 车辆型号
|
||||
*/
|
||||
private String carModel;
|
||||
/**
|
||||
* 保养日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date maintenanceDate;
|
||||
/**
|
||||
* 保养里程
|
||||
*/
|
||||
private BigDecimal maintenanceMileage;
|
||||
/**
|
||||
* 年检日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
private Date inspectionDate;
|
||||
/**
|
||||
* 保险日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
private Date insuranceDate;
|
||||
/**
|
||||
* 二级维护时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date checkDate;
|
||||
/**
|
||||
* 下次保养日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date nextMaintenanceDate;
|
||||
/**
|
||||
* 下次保养里程
|
||||
*/
|
||||
private BigDecimal nextMaintenanceMileage;
|
||||
/**
|
||||
* 下次年检日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date nextInspectionDate;
|
||||
/**
|
||||
* 保险到期日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date insuranceExpiryDate;
|
||||
/**
|
||||
* 下次二级维护时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date nextCheckDate;
|
||||
/**
|
||||
* 车辆品牌
|
||||
*/
|
||||
private String carBrand;
|
||||
/**
|
||||
* 车辆性质:营运 非营运等
|
||||
*/
|
||||
private String carNature;
|
||||
/**
|
||||
* 车辆类别:私家车 货车 教练车 公务车 出租车
|
||||
*/
|
||||
private String carCategory;
|
||||
/**
|
||||
* 车辆注册日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
private Date carRegisterDate;
|
||||
/**
|
||||
* 行驶证图片
|
||||
*/
|
||||
private String carLicenseImg;
|
||||
/**
|
||||
* 最近办理业务
|
||||
*/
|
||||
private String recentlyHandledBusiness;
|
||||
/**
|
||||
* 最近办理业务的时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date recentlyHandleBusinessTime;
|
||||
/**
|
||||
* 车辆型号(输入框)
|
||||
*/
|
||||
private String carModelInput;
|
||||
/**
|
||||
* 车辆品牌(输入框)
|
||||
*/
|
||||
private String carBrandInput;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.app.car.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.app.car.entity.AppCarMain;
|
||||
import cn.iocoder.yudao.module.app.car.vo.AppCarMainResVo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface AppCarMainMapper extends BaseMapper<AppCarMain> {
|
||||
|
||||
|
||||
// 查询当前用户的所有车辆
|
||||
List<AppCarMainResVo> getUserCarMain(@Param("userId") Long userId);
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package cn.iocoder.yudao.module.app.car.service;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.app.car.entity.AppCarMain;
|
||||
import cn.iocoder.yudao.module.app.car.vo.AppCarMainResVo;
|
||||
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆信息 Service 接口
|
||||
*
|
||||
* @author 后台管理员
|
||||
*/
|
||||
public interface AppCarMainService extends IService<AppCarMain> {
|
||||
|
||||
/**
|
||||
* 创建车辆信息
|
||||
*
|
||||
* @param carMain 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
CommonResult<String> createCarMain(AppCarMain carMain);
|
||||
|
||||
/**
|
||||
* 更新车辆信息
|
||||
*
|
||||
* @param carMain 更新信息
|
||||
*/
|
||||
CommonResult<String> updateCarMain(AppCarMain carMain);
|
||||
|
||||
/**
|
||||
* 删除车辆信息
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
CommonResult<String> deleteCarMain(String id);
|
||||
|
||||
/**
|
||||
* 根据当前用户获得车辆信息
|
||||
*
|
||||
* @return 车辆信息
|
||||
*/
|
||||
List<AppCarMainResVo> getCarMain();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
package cn.iocoder.yudao.module.app.car.service.impl;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.app.car.entity.AppCarMain;
|
||||
import cn.iocoder.yudao.module.app.car.mapper.AppCarMainMapper;
|
||||
import cn.iocoder.yudao.module.app.car.service.AppCarMainService;
|
||||
import cn.iocoder.yudao.module.app.car.vo.AppCarMainResVo;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerCar;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||
import cn.iocoder.yudao.module.custom.mapper.CustomerCarMapper;
|
||||
import cn.iocoder.yudao.module.custom.mapper.CustomerMainMapper;
|
||||
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
|
||||
import cn.iocoder.yudao.module.label.service.BusiLabelService;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆信息 Service 实现类
|
||||
*
|
||||
* @author 后台管理员
|
||||
*/
|
||||
@Service
|
||||
public class AppCarMainServiceImpl extends ServiceImpl<AppCarMainMapper, AppCarMain> implements AppCarMainService {
|
||||
|
||||
@Autowired
|
||||
private CustomerCarMapper customerCarMapper;
|
||||
@Autowired
|
||||
private CustomerMainMapper customerMainMapper;
|
||||
|
||||
/**
|
||||
* 创建车辆信息
|
||||
*
|
||||
* @param carMain 创建信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CommonResult<String> createCarMain(AppCarMain carMain) {
|
||||
|
||||
baseMapper.insert(carMain);
|
||||
// 获取当前登录用户
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
// 根据当前登录用户id 查询 base_customer_main 的id
|
||||
HashMap<String, Object> m = new HashMap<>();
|
||||
m.put("user_id", loginUser.getId());
|
||||
List<CustomerMain> customerMains = customerMainMapper.selectByMap(m);
|
||||
// 关联表添加数据
|
||||
CustomerCar customerCar = new CustomerCar();
|
||||
customerCar.setCarId(carMain.getId());
|
||||
customerCar.setCusId(customerMains.get(0).getId());
|
||||
customerCarMapper.insert(customerCar);
|
||||
|
||||
// 返回
|
||||
return CommonResult.success("新增成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新车辆信息
|
||||
*
|
||||
* @param carMain 更新信息
|
||||
*/
|
||||
@Override
|
||||
public CommonResult<String> updateCarMain(AppCarMain carMain) {
|
||||
baseMapper.updateById(carMain);
|
||||
return CommonResult.success("修改成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除车辆信息
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CommonResult<String> deleteCarMain(String id) {
|
||||
// 删除主表
|
||||
baseMapper.deleteById(id);
|
||||
LambdaUpdateWrapper<CustomerCar> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(CustomerCar::getCarId, id);
|
||||
CustomerCar customerCar = new CustomerCar();
|
||||
customerCar.setDeleted(true);
|
||||
// 删除关联表
|
||||
customerCarMapper.update(customerCar, updateWrapper);
|
||||
return CommonResult.success("删除成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得车辆信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<AppCarMainResVo> getCarMain() {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
List<AppCarMainResVo> userCarMain = super.baseMapper.getUserCarMain(loginUser.getId());
|
||||
|
||||
|
||||
return userCarMain;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.app.car.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.app.car.entity.AppCarMain;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AppCarMainResVo extends AppCarMain {
|
||||
|
||||
// 品牌名称
|
||||
private String brandName;
|
||||
// 品牌图片路径
|
||||
private String logoImg;
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package cn.iocoder.yudao.module.app.customer;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import cn.iocoder.yudao.module.system.service.auth.AdminAuthService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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 javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.common.BaseConstants.SIGN_CREATE;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 客户管理
|
||||
*
|
||||
* @author : http://www.chiner.pro
|
||||
* @date : 2024-7-31
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/base/custom-app")
|
||||
@Tag(name = "客户管理-小程序端接口")
|
||||
@Validated
|
||||
public class CustomerAPI {
|
||||
@Resource
|
||||
private CustomerMainService customerMainService;
|
||||
@Resource
|
||||
private AdminAuthService loginService;
|
||||
|
||||
/**
|
||||
* 新增客户
|
||||
*
|
||||
* @param saveReqVO 保存客户信息扩展实体
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
|
||||
* @author PQZ
|
||||
* @date 15:42 2024/8/1
|
||||
**/
|
||||
@PostMapping("/register")
|
||||
@Operation(summary = "客户自行注册")
|
||||
public CommonResult<?> createCustomerMain(@Valid @RequestBody CustomerMainSaveReqVO saveReqVO, HttpServletRequest request) {
|
||||
//客户类型,统一为私人客户
|
||||
saveReqVO.setTypeCode("01");
|
||||
//客户来源,统一为04-维修
|
||||
saveReqVO.setDataFrom("04");
|
||||
//注册方式,统一为自主创建
|
||||
saveReqVO.setInviterType("01");
|
||||
try {
|
||||
UserDTO userDTO = customerMainService.saveCustomer(saveReqVO,SIGN_CREATE);
|
||||
//注册并登录
|
||||
return success(loginService.wxLoginByUserId(userDTO.getId(),userDTO.getUsername()));
|
||||
}catch (ServiceException e){
|
||||
return error(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.app.customer.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.conf.entity.BaseType;
|
||||
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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 客户管理API
|
||||
* @author PQZ
|
||||
* @date 18:17 2024/9/24
|
||||
**/
|
||||
@RestController
|
||||
@RequestMapping("/userClient/customer")
|
||||
public class CustomerMainApi {
|
||||
|
||||
@Resource
|
||||
private CustomerMainService customerMainService;
|
||||
|
||||
/**
|
||||
* 查询当前登录客户信息
|
||||
* @author PQZ
|
||||
* @date 17:24 2024/9/24
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO>
|
||||
**/
|
||||
@GetMapping("/getUserCustomer")
|
||||
@Operation(summary = "获取当前登录用户的客户信息")
|
||||
public CommonResult<CustomerMainRespVO> getUserCustomer() {
|
||||
return success(customerMainService.getUserCustomer());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package cn.iocoder.yudao.module.app.wechat.controller;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.app.wechat.service.WechatService;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginRespVO;
|
||||
import cn.iocoder.yudao.module.system.service.auth.AdminAuthService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.annotation.security.PermitAll;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 微信登录控制层
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/userClient/weChat")
|
||||
@Tag(name = "微信登录")
|
||||
@Validated
|
||||
public class WechatLoginController {
|
||||
@Autowired
|
||||
private WechatService wechatService;
|
||||
@Resource
|
||||
private AdminAuthService authService;
|
||||
|
||||
/**
|
||||
* 微信获取openId
|
||||
* @author vinjor-M
|
||||
* @date 9:53 2024/8/2
|
||||
* @param code 请求参数
|
||||
**/
|
||||
@GetMapping("/wechatLogin")
|
||||
@Operation(summary = "微信获取openId")
|
||||
public CommonResult<?> createCompany(String code) {
|
||||
return wechatService.loginByOpenId(code);
|
||||
}
|
||||
|
||||
@PostMapping("/login")
|
||||
@PermitAll
|
||||
@Operation(summary = "使用账号密码登录")
|
||||
public CommonResult<AuthLoginRespVO> login(@RequestBody @Valid AuthLoginReqVO reqVO) {
|
||||
return success(authService.login(reqVO));
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.app.wechat.service;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
|
||||
/**
|
||||
* @author vinjor-m
|
||||
* @description 微信模块服务层
|
||||
**/
|
||||
public interface WechatService {
|
||||
/**
|
||||
* 微信自动登录
|
||||
* @author vinjor-M
|
||||
* @date 23:53 2024/9/23
|
||||
* @param map 参数
|
||||
**/
|
||||
CommonResult<?> loginByOpenId(String code);
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package cn.iocoder.yudao.module.app.wechat.service.impl;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
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.service.auth.AdminAuthService;
|
||||
import cn.iocoder.yudao.util.WeChatLoginUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.LOCKED;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* @Author vinjor-m
|
||||
* @Description 微信模块服务层
|
||||
**/
|
||||
@Service
|
||||
public class WechatServiceImpl implements WechatService {
|
||||
@Autowired
|
||||
private WeChatLoginUtil weChatLoginUtil;
|
||||
@Autowired
|
||||
private AdminUserApi adminUserApi;
|
||||
@Resource
|
||||
private AdminAuthService loginService;
|
||||
/**
|
||||
* 微信自动登录
|
||||
*
|
||||
* @param code 参数
|
||||
* @return java.lang.String
|
||||
* @author vinjor-M
|
||||
* @date 23:53 2024/9/23
|
||||
**/
|
||||
@Override
|
||||
public CommonResult<?> loginByOpenId(String code) {
|
||||
try {
|
||||
//当前登录用户的openId
|
||||
Map<String,String> authMap = getWeChatOpenId(code);
|
||||
String openId = authMap.getOrDefault("openId",null);
|
||||
//默认租户180,查是否有user表数据
|
||||
AdminUserRespDTO userRespDTO = adminUserApi.getUserByOpenId(openId,null);
|
||||
if(null==userRespDTO){
|
||||
//未找到用户,去注册
|
||||
return CommonResult.success(openId);
|
||||
}else{
|
||||
//找到用户,登录并返回
|
||||
return success(loginService.wxLoginByUserId(userRespDTO.getId(),userRespDTO.getUsername()));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return CommonResult.error(LOCKED.getCode(),e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取openId
|
||||
* @author vinjor-M
|
||||
* @date 23:56 2024/9/23
|
||||
* @param code (静默/非静默)授权拿到的code
|
||||
* @return java.util.Map<java.lang.String,java.lang.String>
|
||||
**/
|
||||
private Map<String,String> getWeChatOpenId(String code) throws Exception {
|
||||
Map<String,String> rtnMap = new HashMap<>(2);
|
||||
try {
|
||||
//code为空为没有获取到code
|
||||
if (StringUtils.isNotBlank(code)) {
|
||||
JSONObject tokenJson = weChatLoginUtil.getTokenJson(code);
|
||||
//获取到tokenJson后,解析tokenJson获取其openId
|
||||
if (null != tokenJson && tokenJson.containsKey("openid")) {
|
||||
rtnMap.put("openId",tokenJson.getStr("openid"));
|
||||
rtnMap.put("token",tokenJson.getStr("access_token"));
|
||||
}else{
|
||||
throw new Exception("code过期");
|
||||
}
|
||||
}else{
|
||||
throw new Exception("没有code");
|
||||
}
|
||||
return rtnMap;
|
||||
} catch (Exception e) {
|
||||
throw new Exception(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
@ -39,7 +39,6 @@ public class CustomerCouponController {
|
||||
**/
|
||||
@PostMapping("/couponVerification")
|
||||
@Operation(summary = "核销用户卡券")
|
||||
@PreAuthorize("@ss.hasPermission('base:customer-coupon:create')")
|
||||
public CommonResult<Boolean> createCustomerCoupon(@Valid @RequestBody CustomerCouponSaveReqVO saveReqVO) {
|
||||
customerCouponService.couponVerification(saveReqVO);
|
||||
return success(true);
|
||||
@ -57,7 +56,6 @@ public class CustomerCouponController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除用户卡券")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('base:customer-coupon:delete')")
|
||||
public CommonResult<Boolean> deleteCustomerCoupon(@RequestParam("id") String id) {
|
||||
customerCouponService.deleteCustomerCoupon(id);
|
||||
return success(true);
|
||||
@ -74,7 +72,6 @@ public class CustomerCouponController {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得用户卡券")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('base:customer-coupon:query')")
|
||||
public CommonResult<CustomerCouponRespVO> getCustomerCoupon(@RequestParam("id") String id) {
|
||||
return success(customerCouponService.getCustomerCoupon(id));
|
||||
}
|
||||
|
@ -129,7 +129,6 @@ public class CustomerMainController {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得客户管理")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('base:customer-main:query')")
|
||||
public CommonResult<CustomerMainRespVO> getCustomerMain(@RequestParam("id") String id) {
|
||||
return success(customerMainService.getCustomerById(id));
|
||||
}
|
||||
@ -180,26 +179,5 @@ public class CustomerMainController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序客户注册
|
||||
* cusName,phoneNumber,birthday,sex,inviter
|
||||
*/
|
||||
@PostMapping("/addUniUser")
|
||||
public CommonResult<Boolean> addUniUser(@Valid @RequestBody CustomerMainSaveReqVO saveReqVO) {
|
||||
if(!saveReqVO.getCode().isEmpty()){
|
||||
String code = saveReqVO.getCode();
|
||||
JSONObject jsonObj = new JSONObject();
|
||||
String url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code="
|
||||
+code+"&grant_type=authorization_code";
|
||||
String response = HttpRequest.get(url).execute().body();
|
||||
JSONObject json = JSONUtil.parseObj(response);
|
||||
if (json.containsKey("access_token") && json.containsKey("openid")) {
|
||||
String accessToken = json.getStr("access_token");
|
||||
String openid = json.getStr("openid");
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -8,6 +8,8 @@ import cn.iocoder.yudao.module.custom.vo.CarBrandRespVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆品牌维护 Service 接口
|
||||
*
|
||||
@ -53,4 +55,6 @@ public interface CarBrandService extends IService<CarBrand> {
|
||||
*/
|
||||
IPage<CarBrandRespVO> getCarBrandPage(CarBrandReqVO pageReqVO);
|
||||
|
||||
List<CarBrand> getCarBrandList();
|
||||
|
||||
}
|
@ -74,4 +74,5 @@ public interface CarModelService extends IService<CarModel> {
|
||||
*/
|
||||
List<CascaderOptionsVO> searchBrand(CarModelReqVO reqVO);
|
||||
|
||||
List<CarModel> getCarModelList();
|
||||
}
|
@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
|
||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@ -38,7 +39,7 @@ public interface CustomerMainService extends IService<CustomerMain> {
|
||||
* @author PQZ
|
||||
* @date 15:46 2024/8/1
|
||||
**/
|
||||
void saveCustomer(CustomerMainSaveReqVO saveReqVO, String sign);
|
||||
UserDTO saveCustomer(CustomerMainSaveReqVO saveReqVO, String sign);
|
||||
|
||||
/**
|
||||
* 根据客户id查询客户信息
|
||||
@ -50,6 +51,16 @@ public interface CustomerMainService extends IService<CustomerMain> {
|
||||
**/
|
||||
CustomerMainRespVO getCustomerById(String id);
|
||||
|
||||
/**
|
||||
* 获取当前登录用户的客户信息
|
||||
* @author PQZ
|
||||
* @date 17:27 2024/9/24
|
||||
* @return cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO
|
||||
**/
|
||||
CustomerMainRespVO getUserCustomer();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据经办人所属企业查询经办人信息
|
||||
*
|
||||
|
@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -86,4 +87,9 @@ public class CarBrandServiceImpl extends ServiceImpl<CarBrandMapper, CarBrand> i
|
||||
return baseMapper.findPage(page,pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CarBrand> getCarBrandList() {
|
||||
return baseMapper.selectList(null);
|
||||
}
|
||||
|
||||
}
|
@ -123,6 +123,12 @@ public class CarModelServiceImpl extends ServiceImpl<CarModelMapper, CarModel> i
|
||||
return getChildModel(nameResult,reqVO.getModelName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CarModel> getCarModelList() {
|
||||
List<CarModel> carModels = baseMapper.selectByMap(null);
|
||||
return carModels;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据父级品牌集合取所有的型号子选项
|
||||
*
|
||||
|
@ -147,6 +147,7 @@ public class CustomerActiveServiceImpl extends ServiceImpl<CustomerActiveMapper,
|
||||
orderInfo.setOrderTime(LocalDateTime.now());
|
||||
orderInfo.setIsOnline("01");
|
||||
orderInfo.setOrderStatus("0");
|
||||
orderInfo.setPayType(saveReqVO.getAccountType());
|
||||
repairOrderInfoService.save(orderInfo);
|
||||
//保存余额信息
|
||||
// balanceService.updateByCusId(balance);
|
||||
|
@ -48,7 +48,7 @@ public class CustomerCouponServiceImpl extends ServiceImpl<CustomerCouponMapper,
|
||||
public void couponVerification(CustomerCouponSaveReqVO saveReqVO) {
|
||||
CustomerCoupon customerCoupon = getById(saveReqVO.getId());
|
||||
//核销后剩余
|
||||
BigDecimal newBalance = customerCoupon.getBalance().subtract(saveReqVO.getChangeBalance());
|
||||
BigDecimal newBalance = customerCoupon.getBalance().subtract(customerCoupon.getUnitPrice());
|
||||
customerCoupon.setBalance(newBalance);
|
||||
if (newBalance.compareTo(BigDecimal.ZERO) == 0) {
|
||||
customerCoupon.setIsValid(GENERAL_NO);
|
||||
@ -62,9 +62,9 @@ public class CustomerCouponServiceImpl extends ServiceImpl<CustomerCouponMapper,
|
||||
BALANCE_CHANGE_TYPE_KQHX,
|
||||
BALANCE_CHANGE_MAIN_KQ,
|
||||
saveReqVO.getOutRule(),
|
||||
saveReqVO.getChangeBalance(),
|
||||
saveReqVO.getUnitPrice(),
|
||||
newBalance,
|
||||
"核销" + saveReqVO.getCouponName() + saveReqVO.getChangeBalance() + "次/元,核销后剩余" + newBalance + "次/元"
|
||||
"核销" + saveReqVO.getCouponName() + saveReqVO.getUnitPrice() + "次/元,核销后剩余" + newBalance + "次/元"
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,8 @@ import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerCar;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerItem;
|
||||
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||
@ -31,6 +33,7 @@ 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 org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -98,12 +101,12 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void saveCustomer(CustomerMainSaveReqVO saveReqVO, String sign) {
|
||||
public UserDTO saveCustomer(CustomerMainSaveReqVO saveReqVO, String sign) {
|
||||
Long userId;
|
||||
UserDTO user = null;
|
||||
try {
|
||||
/*1、入参及基础参数值设置*/
|
||||
CustomerMain main = JSONUtil.toBean(JSONUtil.parseObj(saveReqVO).toJSONString(0), CustomerMain.class);
|
||||
Long userId;
|
||||
UserDTO user;
|
||||
/*2、新增客户时绑定绑定客户信息*/
|
||||
if (SIGN_CREATE.equals(sign)){
|
||||
//查询数据字典,根据客户类型匹配出预设角色code;
|
||||
@ -135,11 +138,28 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
|
||||
user.setDeptId(deptId);
|
||||
//客户信息表绑定deptCode
|
||||
main.setDeptCode(deptId);
|
||||
}else{
|
||||
//私人客户和代办客户归属到默认的部门中
|
||||
String deptName = "";
|
||||
if(CUS_TYPE_PRIVATE.equals(main.getTypeCode())){
|
||||
deptName =DEPT_NAME_PRIVATE_NAME;
|
||||
}else if(CUS_TYPE_AGENT.equals(main.getTypeCode())){
|
||||
deptName = DEPT_NAME_AGENT_NAME;
|
||||
}
|
||||
DeptRespDTO parentDept = deptApi.getDeptByName(deptName);
|
||||
user.setDeptId(parentDept.getId());
|
||||
}
|
||||
//创建客户
|
||||
userId = adminUserApi.createUser(user);
|
||||
user.setId(userId);
|
||||
} else {
|
||||
userId = user.getId();
|
||||
if(StringUtils.isNotEmpty(saveReqVO.getOpenId())){
|
||||
//穿了openId。更新openId
|
||||
user.setOpenId(saveReqVO.getOpenId());
|
||||
//更新用户表
|
||||
adminUserApi.setOpenId(user.getId(),saveReqVO.getOpenId());
|
||||
}
|
||||
}
|
||||
//客户表绑定用户id
|
||||
main.setUserId(userId);
|
||||
@ -149,16 +169,18 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
|
||||
permissionApi.assignUserRole(userId, roleCodes);
|
||||
}
|
||||
/*3、保存客户主表信息*/
|
||||
//暂时写死会员id TODO
|
||||
main.setMemberLevelId("9d4567b7e68803933f4917a4aab6b745");
|
||||
this.saveOrUpdate(main);
|
||||
/*4、保存扩展表信息*/
|
||||
if (!saveReqVO.getItemList().isEmpty()) {
|
||||
if ( null!=saveReqVO.getItemList() && !saveReqVO.getItemList().isEmpty()) {
|
||||
customerItemService.saveCutomItem(main.getId(), saveReqVO.getItemList());
|
||||
}
|
||||
} catch (ServiceException e) {
|
||||
log.error(e.getMessage());
|
||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -190,6 +212,22 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录用户的客户信息
|
||||
*
|
||||
* @return cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO
|
||||
* @author PQZ
|
||||
* @date 17:27 2024/9/24
|
||||
**/
|
||||
@Override
|
||||
public CustomerMainRespVO getUserCustomer() {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
LambdaQueryWrapper<CustomerMain> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CustomerMain::getUserId,loginUser.getId()).eq(BaseDO::getDeleted,'0');
|
||||
CustomerMain customerMain = getOne(lambdaQueryWrapper);
|
||||
return getCustomerById(customerMain.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据经办人所属企业查询经办人信息
|
||||
*
|
||||
|
@ -14,6 +14,8 @@ import javax.validation.constraints.*;
|
||||
public class CustomerActiveSaveReqVO extends CustomerActive {
|
||||
/**充值金额*/
|
||||
private BigDecimal topUpAmount;
|
||||
/**充值金额*/
|
||||
private String accountType;
|
||||
/**选中的优惠券*/
|
||||
private List<MemberCoupon> selectCoupon;
|
||||
}
|
@ -20,7 +20,7 @@ public class CustomerMainSaveReqVO extends CustomerMain {
|
||||
List<BusiLabel> labelList;
|
||||
|
||||
/**
|
||||
* Code
|
||||
* 微信openId
|
||||
*/
|
||||
private String Code;
|
||||
private String openId;
|
||||
}
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.order.entity.RepairOrderInfo;
|
||||
import cn.iocoder.yudao.module.order.service.RepairOrderInfoService;
|
||||
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoPageReqVO;
|
||||
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoRespVO;
|
||||
import cn.iocoder.yudao.module.order.vo.RepairOrderInfoSaveReqVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -48,6 +49,21 @@ public class RepairOrderInfoController {
|
||||
return success(BeanUtils.toBean(orderInfo, RepairOrderInfoRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 更新订单信息
|
||||
*
|
||||
* @param saveReqVO 订单信息
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新车辆信息")
|
||||
@PreAuthorize("@ss.hasPermission('base:car-main:update')")
|
||||
public CommonResult<Boolean> updateCarMain(@RequestBody RepairOrderInfoSaveReqVO saveReqVO) {
|
||||
repairOrderInfoService.rechargeCallback(saveReqVO.getOrderNo());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询订单内容
|
||||
*
|
||||
|
@ -61,13 +61,7 @@ public interface RepairOrderInfoService extends IService<RepairOrderInfo> {
|
||||
**/
|
||||
RepairOrderInfo getOrderByOrderNo(String orderNo);
|
||||
|
||||
/**
|
||||
* 获得维修模块 订单分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 维修模块 订单分页
|
||||
*/
|
||||
PageResult<RepairOrderInfo> getOrderInfoPage(RepairOrderInfoPageReqVO pageReqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询订单信息
|
||||
|
@ -80,11 +80,13 @@ public class RepairOrderInfoServiceImpl extends ServiceImpl<RepairOrderInfoMappe
|
||||
**/
|
||||
@Override
|
||||
public void rechargeCallback(String orderNo) {
|
||||
//通过订单编号查询订单
|
||||
RepairOrderInfo orderInfo = getOrderByOrderNo(orderNo);
|
||||
if (ORDER_HYCZ.equals(orderInfo.getGoodsType())){
|
||||
//会员充值回调
|
||||
balanceService.balanceCallback(orderInfo);
|
||||
} else {
|
||||
|
||||
// TODO: 2024/9/24 维修服务回调
|
||||
}
|
||||
orderInfo.setOrderStatus(GENERAL_YES);
|
||||
orderInfo.setPayTime(LocalDateTime.now());
|
||||
@ -118,10 +120,6 @@ public class RepairOrderInfoServiceImpl extends ServiceImpl<RepairOrderInfoMappe
|
||||
return getOne(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<RepairOrderInfo> getOrderInfoPage(RepairOrderInfoPageReqVO pageReqVO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询订单信息
|
||||
@ -151,6 +149,7 @@ public class RepairOrderInfoServiceImpl extends ServiceImpl<RepairOrderInfoMappe
|
||||
return baseMapper.getOrderPageByStatus(respVO, page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询订单详情(包括工单)
|
||||
*
|
||||
|
@ -0,0 +1,222 @@
|
||||
package cn.iocoder.yudao.util;
|
||||
|
||||
import javax.net.ssl.*;
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.security.cert.Certificate;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
|
||||
public class NetWorkHelper {
|
||||
|
||||
public String getHttpsResponse(String hsUrl, String requestMethod) {
|
||||
URL url;
|
||||
InputStream is = null;
|
||||
String resultData = "";
|
||||
try {
|
||||
url = new URL(hsUrl);
|
||||
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
|
||||
TrustManager[] tm = {xtm};
|
||||
|
||||
SSLContext ctx = SSLContext.getInstance("TLS");
|
||||
ctx.init(null, tm, null);
|
||||
|
||||
con.setSSLSocketFactory(ctx.getSocketFactory());
|
||||
con.setHostnameVerifier(new HostnameVerifier() {
|
||||
@Override
|
||||
public boolean verify(String arg0, SSLSession arg1) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
con.setDoInput(true); //允许输入流,即允许下载
|
||||
|
||||
//在android中必须将此项设置为false
|
||||
con.setDoOutput(false); //允许输出流,即允许上传
|
||||
con.setUseCaches(false); //不使用缓冲
|
||||
if(null!=requestMethod && !requestMethod.equals("")) {
|
||||
con.setRequestMethod(requestMethod); //使用指定的方式
|
||||
}
|
||||
else{
|
||||
con.setRequestMethod("GET"); //使用get请求
|
||||
}
|
||||
is = con.getInputStream(); //获取输入流,此时才真正建立链接
|
||||
InputStreamReader isr = new InputStreamReader(is);
|
||||
BufferedReader bufferReader = new BufferedReader(isr);
|
||||
String inputLine = "";
|
||||
while ((inputLine = bufferReader.readLine()) != null) {
|
||||
resultData += inputLine + "\n";
|
||||
}
|
||||
|
||||
Certificate[] certs = con.getServerCertificates();
|
||||
|
||||
int certNum = 1;
|
||||
|
||||
for (Certificate cert : certs) {
|
||||
X509Certificate xcert = (X509Certificate) cert;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultData;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
* @param hsUrl
|
||||
* @return
|
||||
*/
|
||||
public String DownLoadHttpsFile(String hsUrl, String fileName, String path) {
|
||||
URL url;
|
||||
InputStream is = null;
|
||||
String filePath = path+fileName;
|
||||
try {
|
||||
url = new URL(hsUrl);
|
||||
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
|
||||
TrustManager[] tm = {xtm};
|
||||
|
||||
SSLContext ctx = SSLContext.getInstance("TLS");
|
||||
ctx.init(null, tm, null);
|
||||
|
||||
con.setSSLSocketFactory(ctx.getSocketFactory());
|
||||
con.setHostnameVerifier(new HostnameVerifier() {
|
||||
@Override
|
||||
public boolean verify(String arg0, SSLSession arg1) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
con.setDoInput(true); //允许输入流,即允许下载
|
||||
|
||||
//在android中必须将此项设置为false
|
||||
con.setDoOutput(false); //允许输出流,即允许上传
|
||||
con.setUseCaches(false); //不使用缓冲
|
||||
con.setRequestMethod("GET"); //使用get请求
|
||||
is = con.getInputStream(); //获取输入流,此时才真正建立链接
|
||||
|
||||
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
int len = 0;
|
||||
while( (len=is.read(buffer)) != -1 ){
|
||||
outStream.write(buffer, 0, len);
|
||||
}
|
||||
is.close();
|
||||
byte[] fileBytes = outStream.toByteArray();
|
||||
|
||||
File file = new File(filePath);
|
||||
FileOutputStream fops = new FileOutputStream(file);
|
||||
fops.write(fileBytes);
|
||||
fops.flush();
|
||||
fops.close();
|
||||
/* Certificate[] certs = con.getServerCertificates();
|
||||
for (Certificate cert : certs) {
|
||||
X509Certificate xcert = (X509Certificate) cert;
|
||||
}*/
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTPS协议的POST请求
|
||||
* @param hsUrl 请求地址
|
||||
* @param json 请求数据
|
||||
* @return
|
||||
*/
|
||||
public String PostHttpsResponse(String hsUrl, String json) {
|
||||
URL url;
|
||||
InputStream is = null;
|
||||
String resultData = "";
|
||||
try {
|
||||
url = new URL(hsUrl);
|
||||
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
|
||||
TrustManager[] tm = {xtm};
|
||||
|
||||
SSLContext ctx = SSLContext.getInstance("TLS");
|
||||
ctx.init(null, tm, null);
|
||||
|
||||
con.setSSLSocketFactory(ctx.getSocketFactory());
|
||||
con.setHostnameVerifier(new HostnameVerifier() {
|
||||
@Override
|
||||
public boolean verify(String arg0, SSLSession arg1) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
con.setDoInput(true); //允许输入流,即允许下载
|
||||
|
||||
//在android中必须将此项设置为false
|
||||
con.setDoOutput(true); //允许输出流,即允许上传
|
||||
con.setUseCaches(false); //不使用缓冲
|
||||
con.setRequestMethod("POST"); //使用get请求
|
||||
|
||||
//表单数据
|
||||
if (null != json) {
|
||||
OutputStream outputStream = con.getOutputStream();
|
||||
outputStream.write(json.getBytes("UTF-8"));
|
||||
outputStream.close();
|
||||
}
|
||||
|
||||
|
||||
is = con.getInputStream(); //获取输入流,此时才真正建立链接
|
||||
InputStreamReader isr = new InputStreamReader(is);
|
||||
BufferedReader bufferReader = new BufferedReader(isr);
|
||||
String inputLine = "";
|
||||
while ((inputLine = bufferReader.readLine()) != null) {
|
||||
resultData += inputLine + "\n";
|
||||
}
|
||||
/* log(con.getResponseCode());
|
||||
log(con.getCipherSuite());
|
||||
log("");*/
|
||||
Certificate[] certs = con.getServerCertificates();
|
||||
|
||||
int certNum = 1;
|
||||
|
||||
for (Certificate cert : certs) {
|
||||
X509Certificate xcert = (X509Certificate) cert;
|
||||
/*log("Cert No. " + certNum++);
|
||||
log(xcert.getType());
|
||||
log(xcert.getPublicKey().getAlgorithm());
|
||||
log(xcert.getIssuerDN());
|
||||
log(xcert.getIssuerDN());
|
||||
log(xcert.getNotAfter());
|
||||
log(xcert.getNotBefore());
|
||||
log("");*/
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultData;
|
||||
}
|
||||
|
||||
X509TrustManager xtm = new X509TrustManager() {
|
||||
@Override
|
||||
public X509Certificate[] getAcceptedIssuers() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(X509Certificate[] arg0, String arg1)
|
||||
throws CertificateException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkClientTrusted(X509Certificate[] arg0, String arg1)
|
||||
throws CertificateException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
};
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.util;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.iocoder.yudao.common.WechatCommon;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @Author vinjor-m
|
||||
* @Description 微信模块工具类
|
||||
**/
|
||||
@Component
|
||||
public class WeChatLoginUtil {
|
||||
@Autowired
|
||||
private WechatCommon wechatCommon;
|
||||
|
||||
/**
|
||||
* @param code 授权后拿到的code
|
||||
* @return net.sf.json.JSONObject
|
||||
* ---modify history---
|
||||
* Modify By Date Description
|
||||
* @Author PQZ
|
||||
* @Description 获取网页的token
|
||||
* @Date 17:12 2021/1/26
|
||||
**/
|
||||
public JSONObject getTokenJson(String code) {
|
||||
//请求获取网页的token
|
||||
String url = wechatCommon.getTokeUrl() + "&code=" + code + "&grant_type=authorization_code";
|
||||
NetWorkHelper helper = new NetWorkHelper();
|
||||
String response = helper.getHttpsResponse(url, "");
|
||||
return JSONUtil.parseObj(response);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<?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.app.car.mapper.AppCarMainMapper">
|
||||
|
||||
<select id="getUserCarMain" resultType="cn.iocoder.yudao.module.app.car.vo.AppCarMainResVo">
|
||||
|
||||
SELECT main.*, brand.brand_name as brandName, brand.logo_img as logoImg
|
||||
from (select main.*
|
||||
from base_customer_car car
|
||||
INNER JOIN base_car_main main on car.car_id = main.id
|
||||
where car.cus_id = (
|
||||
select id
|
||||
from base_customer_main
|
||||
where user_id = #{userId}
|
||||
and deleted = 0
|
||||
)
|
||||
and main.deleted = 0) as main
|
||||
LEFT JOIN base_car_brand brand on main.car_brand = brand.id
|
||||
</select>
|
||||
</mapper>
|
@ -28,5 +28,6 @@
|
||||
WHERE
|
||||
bcc.cus_id = #{cusId}
|
||||
AND bcc.deleted = 0
|
||||
AND bcc.is_valid = 1
|
||||
</select>
|
||||
</mapper>
|
@ -20,7 +20,7 @@
|
||||
and roi.order_no like concat('%', #{entity.orderNo}, '%')
|
||||
</if>
|
||||
<if test="entity.goodsTitle != null and entity.goodsTitle != ''">
|
||||
and roi.goods_totle like concat('%', #{entity.goodsTitle}, '%')
|
||||
and roi.goods_title like concat('%', #{entity.goodsTitle}, '%')
|
||||
</if>
|
||||
<if test="entity.goodsType != null and entity.goodsType != ''">
|
||||
and roi.goods_type = #{entity.goodsType}
|
||||
@ -31,7 +31,11 @@
|
||||
<if test="entity.orderStatus != null and entity.orderStatus != ''">
|
||||
and roi.order_status = #{entity.orderStatus}
|
||||
</if>
|
||||
<if test="entity.payType != null and entity.payType != ''">
|
||||
and roi.pay_type = #{entity.payType}
|
||||
</if>
|
||||
</where>
|
||||
order by roi.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getOrderPageByStatus" resultType="cn.iocoder.yudao.module.order.vo.RepairOrderInfoRespVO">
|
||||
|
@ -146,6 +146,7 @@ public class YudaoWebSecurityConfigurerAdapter {
|
||||
// 微信支付接口
|
||||
.antMatchers("/admin-api/notify/**").permitAll()
|
||||
.antMatchers("/userClient/pay/**").permitAll()
|
||||
.antMatchers("/userClient/weChat/**").permitAll()
|
||||
.antMatchers("/admin-api/websocket/**").permitAll()
|
||||
// 小程序首页
|
||||
.antMatchers("/admin-api/system/notice/listWx","/admin-api/system/swiper/listWx","/admin-api/system/shopconfig/listWx").permitAll()
|
||||
|
@ -41,6 +41,16 @@ public interface AdminUserApi {
|
||||
*/
|
||||
AdminUserRespDTO getUser(Long id);
|
||||
|
||||
/**
|
||||
* 根据openid和租户id查询用户
|
||||
* @author vinjor-M
|
||||
* @date 11:29 2024/9/24
|
||||
* @param openId 微信id
|
||||
* @param tenantId 租户id,可能为null
|
||||
* @return cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO
|
||||
**/
|
||||
AdminUserRespDTO getUserByOpenId(String openId,String tenantId);
|
||||
|
||||
/**
|
||||
* 通过用户 登录账户 查询用户
|
||||
*
|
||||
@ -137,5 +147,13 @@ public interface AdminUserApi {
|
||||
*/
|
||||
AdminUserRespDTO getUserByMobile(String mobile);
|
||||
|
||||
/**
|
||||
* 设置用户openId
|
||||
* @author vinjor-M
|
||||
* @date 15:45 2024/9/24
|
||||
* @param userId 用户id
|
||||
* @param openId 微信id
|
||||
**/
|
||||
void setOpenId(Long userId,String openId);
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,10 @@ public class AdminUserRespDTO {
|
||||
* 用户ID
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 用户登录账号
|
||||
*/
|
||||
private String username;
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
|
@ -47,5 +47,9 @@ public class UserDTO {
|
||||
* 用户性别
|
||||
**/
|
||||
private String sex;
|
||||
/**
|
||||
* 用户openId
|
||||
**/
|
||||
private String openId;
|
||||
|
||||
}
|
||||
|
@ -64,6 +64,21 @@ public class AdminUserApiImpl implements AdminUserApi {
|
||||
return BeanUtils.toBean(user, AdminUserRespDTO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据openid和租户id查询用户
|
||||
*
|
||||
* @param openId 微信id
|
||||
* @param tenantId 租户id,可能为null
|
||||
* @return cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO
|
||||
* @author vinjor-M
|
||||
* @date 11:29 2024/9/24
|
||||
**/
|
||||
@Override
|
||||
public AdminUserRespDTO getUserByOpenId(String openId, String tenantId) {
|
||||
AdminUserDO user = userService.selectUserByOpenId(openId,tenantId);
|
||||
return BeanUtils.toBean(user, AdminUserRespDTO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过用户 登录账户 查询用户
|
||||
*
|
||||
@ -153,4 +168,17 @@ public class AdminUserApiImpl implements AdminUserApi {
|
||||
return BeanUtils.toBean(user, AdminUserRespDTO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户openId
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param openId 微信id
|
||||
* @author vinjor-M
|
||||
* @date 15:45 2024/9/24
|
||||
**/
|
||||
@Override
|
||||
public void setOpenId(Long userId, String openId) {
|
||||
userService.setOpenId(userId, openId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataSaveReqVO;
|
||||
@ -101,4 +102,14 @@ public class DictDataController {
|
||||
ExcelUtils.write(response, "字典数据.xls", "数据", DictDataRespVO.class,
|
||||
BeanUtils.toBean(list, DictDataRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/type")
|
||||
@Operation(summary = "根据字典类型查询字典数据信息")
|
||||
@Parameter(name = "type", description = "字典类型", required = true, example = "common_status")
|
||||
@TenantIgnore
|
||||
public CommonResult<List<AppDictDataRespVO>> getDictDataListByType(@RequestParam("type") String type) {
|
||||
List<DictDataDO> list = dictDataService.getDictDataList(
|
||||
CommonStatusEnum.ENABLE.getStatus(), type);
|
||||
return success(BeanUtils.toBean(list, AppDictDataRespVO.class));
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.controller.app.dict;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.system.controller.app.dict.vo.AppDictDataRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
|
||||
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
|
||||
@ -32,6 +33,7 @@ public class AppDictDataController {
|
||||
@GetMapping("/type")
|
||||
@Operation(summary = "根据字典类型查询字典数据信息")
|
||||
@Parameter(name = "type", description = "字典类型", required = true, example = "common_status")
|
||||
@TenantIgnore
|
||||
public CommonResult<List<AppDictDataRespVO>> getDictDataListByType(@RequestParam("type") String type) {
|
||||
List<DictDataDO> list = dictDataService.getDictDataList(
|
||||
CommonStatusEnum.ENABLE.getStatus(), type);
|
||||
|
@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -41,4 +42,6 @@ public interface DeptMapper extends BaseMapperX<DeptDO> {
|
||||
default DeptDO selectTenantDeptTop(Long parentId, Long tenantId) {
|
||||
return selectOne(DeptDO::getParentId, parentId, DeptDO::getTenantId, tenantId);
|
||||
}
|
||||
|
||||
List<DeptDO> selectDeptByName(@Param("name")String name);
|
||||
}
|
||||
|
@ -57,4 +57,6 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||
AdminUserDO selectUserByPhone(String phone);
|
||||
|
||||
AdminUserDO getUserByMobileWithoutTenant(String phoneNumber);
|
||||
|
||||
int updateSetOpenId(@Param("userId")Long userId,@Param("openId")String openId);
|
||||
}
|
||||
|
@ -75,4 +75,14 @@ public interface AdminAuthService {
|
||||
AuthLoginRespVO wxLoginRescue(String decryptResult, String openId, Long inviteId);
|
||||
|
||||
AuthLoginRespVO wxLoginJc(String decryptResult, String openId, Long inviteId);
|
||||
|
||||
/**
|
||||
* 根据用户id自动登录
|
||||
* @author vinjor-M
|
||||
* @date 12:17 2024/9/24
|
||||
* @param userId 用户id
|
||||
* @param userName 用户名称
|
||||
* @return cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginRespVO
|
||||
**/
|
||||
AuthLoginRespVO wxLoginByUserId(Long userId,String userName);
|
||||
}
|
||||
|
@ -439,4 +439,19 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
// 生成token
|
||||
return createTokenAfterLoginSuccess(wxUser.getId(), wxUser.getUsername(), LoginLogTypeEnum.LOGIN_SOCIAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户id自动登录
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param userName 用户名称
|
||||
* @return cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginRespVO
|
||||
* @author vinjor-M
|
||||
* @date 12:17 2024/9/24
|
||||
**/
|
||||
@Override
|
||||
public AuthLoginRespVO wxLoginByUserId(Long userId, String userName) {
|
||||
// 生成token
|
||||
return createTokenAfterLoginSuccess(userId, userName, LoginLogTypeEnum.LOGIN_USERNAME);
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptSaveReqV
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.dept.DeptMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.redis.RedisKeyConstants;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -244,7 +245,8 @@ public class DeptServiceImpl implements DeptService {
|
||||
**/
|
||||
@Override
|
||||
public DeptDO selectDeptByName(String name) {
|
||||
return deptMapper.selectByDeptName(name);
|
||||
List<DeptDO> list = deptMapper.selectDeptByName(name);
|
||||
return list.size()>0?list.get(0):new DeptDO();
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,6 +20,7 @@ import cn.iocoder.yudao.module.system.dal.mysql.oauth2.OAuth2AccessTokenMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.oauth2.OAuth2RefreshTokenMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.redis.oauth2.OAuth2AccessTokenRedisDAO;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -219,4 +219,22 @@ public interface AdminUserService {
|
||||
AdminUserDO selectUserByPhone(String phone);
|
||||
|
||||
AdminUserDO getUserByMobileWithoutTenant(String phoneNumber);
|
||||
|
||||
/**
|
||||
* 根据openid和租户id查询用户
|
||||
* @author vinjor-M
|
||||
* @date 11:29 2024/9/24
|
||||
* @param openId 微信id
|
||||
* @param tenantId 租户id,可能为null
|
||||
**/
|
||||
AdminUserDO selectUserByOpenId(String openId,String tenantId);
|
||||
/**
|
||||
* 设置用户openId
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param openId 微信id
|
||||
* @author vinjor-M
|
||||
* @date 15:45 2024/9/24
|
||||
**/
|
||||
void setOpenId(Long userId,String openId);
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
||||
import cn.iocoder.yudao.module.system.service.dept.PostService;
|
||||
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
|
||||
import cn.iocoder.yudao.module.system.service.tenant.TenantService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.mzt.logapi.context.LogRecordContext;
|
||||
import com.mzt.logapi.service.impl.DiffParseFunction;
|
||||
@ -530,6 +531,37 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
return userMapper.getUserByMobileWithoutTenant(phoneNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据openid和租户id查询用户
|
||||
*
|
||||
* @param openId 微信id
|
||||
* @param tenantId 租户id,可能为null
|
||||
* @author vinjor-M
|
||||
* @date 11:29 2024/9/24
|
||||
**/
|
||||
@Override
|
||||
public AdminUserDO selectUserByOpenId(String openId, String tenantId) {
|
||||
LambdaQueryWrapper<AdminUserDO> queryWrapper = new LambdaQueryWrapper<AdminUserDO>()
|
||||
.eq(AdminUserDO::getOpenId,openId);
|
||||
if(StringUtils.isNotEmpty(tenantId)){
|
||||
queryWrapper.eq(AdminUserDO::getTenantId,tenantId);
|
||||
}
|
||||
return userMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户openId
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param openId 微信id
|
||||
* @author vinjor-M
|
||||
* @date 15:45 2024/9/24
|
||||
**/
|
||||
@Override
|
||||
public void setOpenId(Long userId, String openId) {
|
||||
userMapper.updateSetOpenId(userId,openId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对密码进行加密
|
||||
*
|
||||
|
@ -0,0 +1,10 @@
|
||||
<?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.system.dal.mysql.dept.DeptMapper">
|
||||
|
||||
<select id="selectDeptByName" resultType="cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO">
|
||||
select * from system_dept where name = #{name}
|
||||
</select>
|
||||
</mapper>
|
@ -3,8 +3,11 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper">
|
||||
<update id="updateSetOpenId">
|
||||
UPDATE system_users SET open_id = #{openId} WHERE id = #{userId}
|
||||
</update>
|
||||
|
||||
<select id="getUsersByRoleRescue" resultType="cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO">
|
||||
<select id="getUsersByRoleRescue" resultType="cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO">
|
||||
SELECT
|
||||
distinct su.*
|
||||
FROM
|
||||
|
@ -185,12 +185,10 @@ debug: false
|
||||
--- #################### 微信公众号、小程序相关配置 ####################
|
||||
wx:
|
||||
mp: # 公众号配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md 文档
|
||||
# app-id: wx041349c6f39b268b # 测试号(牛希尧提供的)
|
||||
# secret: 5abee519483bc9f8cb37ce280e814bd0
|
||||
app-id: wx5b23ba7a5589ecbb # 测试号(自己的)
|
||||
secret: 2a7b3b20c537e52e74afd395eb85f61f
|
||||
# app-id: wxa69ab825b163be19 # 测试号(Kongdy 提供的)
|
||||
# secret: bd4f9fab889591b62aeac0d7b8d8b4a0
|
||||
# app-id: wx8653afe16dffec37 # 蓝安
|
||||
# secret: ab94673dd0cca78abd0a453d0aac9f98
|
||||
app-id: wxb1f71e5e0c5f9ee7 # 点亮
|
||||
secret: 2e9864a6b224feb6fba4ab73b70212cd
|
||||
# 存储配置,解决 AccessToken 的跨节点的共享
|
||||
config-storage:
|
||||
type: RedisTemplate # 采用 RedisTemplate 操作 Redis,会自动从 Spring 中获取
|
||||
|
@ -223,6 +223,7 @@ yudao:
|
||||
- /admin-api/system/config/configKey/**
|
||||
- /websocket/**
|
||||
- /userClient/pay/**
|
||||
- /userClient/weChat/**
|
||||
- /admin-api/websocket/**
|
||||
- /admin-api/rescue/wxLoginRescue
|
||||
- /admin-api/rescue/wxLoginJc
|
||||
@ -280,7 +281,9 @@ yudao:
|
||||
- /admin-api/rescue/loginJcApp
|
||||
- /admin-api/system/tenant/getListByWebsite
|
||||
- /admin-api/websocket/**
|
||||
- /admin-api/system/dict-data/type
|
||||
- /userClient/pay/**
|
||||
- /userClient/weChat/**
|
||||
ignore-tables:
|
||||
- system_tenant
|
||||
- system_tenant_package
|
||||
|
Loading…
Reference in New Issue
Block a user