Merge remote-tracking branch 'origin/master'
| New file |
| | |
| | | package com.xiaopeng.account.config; |
| | | |
| | | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
| | | import com.xiaopeng.common.core.utils.StringUtils; |
| | | import com.xiaopeng.common.security.utils.SecurityUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.reflection.MetaObject; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName DataUpdateInterceptor |
| | | * @Description 数据更新操作处理 |
| | | * @date 2021-12-15 |
| | | * <p> |
| | | * 注意,之前在此处注入了 JwtTokenUtils |
| | | * <p> |
| | | * 造成spring循环依赖,项目支棱不起来 |
| | | */ |
| | | @Slf4j |
| | | @Configuration |
| | | public class DataUpdateHandlerConfig implements MetaObjectHandler { |
| | | |
| | | |
| | | /** |
| | | * 新增数据执行 |
| | | * |
| | | * @param metaObject |
| | | */ |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | String userName = ""; |
| | | try{ |
| | | // 获取登录信息 |
| | | userName = SecurityUtils.getLoginUser().getSysUser().getNickName(); |
| | | log.info("DataUpdateInterceptor insertFill"); |
| | | } catch (Exception e) { |
| | | log.error("DataUpdateInterceptor insertFill error:{}", e.getMessage()); |
| | | } |
| | | if (StringUtils.isNotBlank(userName)) { |
| | | this.setFieldValByName("createBy", userName, metaObject); |
| | | this.setFieldValByName("updateBy", userName, metaObject); |
| | | } else { |
| | | this.setFieldValByName("createBy", userName, metaObject); |
| | | this.setFieldValByName("updateBy", userName, metaObject); |
| | | } |
| | | this.setFieldValByName("createTime", LocalDateTime.now(), metaObject); |
| | | this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); |
| | | } |
| | | |
| | | /** |
| | | * 修改数据执行 |
| | | * |
| | | * @param metaObject |
| | | */ |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | String userName = ""; |
| | | try{ |
| | | // 获取登录信息 |
| | | userName = SecurityUtils.getLoginUser().getSysUser().getNickName(); |
| | | log.info("DataUpdateInterceptor insertFill"); |
| | | } catch (Exception e) { |
| | | log.error("DataUpdateInterceptor insertFill error:{}", e.getMessage()); |
| | | } |
| | | this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); |
| | | this.setFieldValByName("updateBy", userName, metaObject); |
| | | |
| | | } |
| | | } |
| | |
| | | import com.xiaopeng.account.vo.RoleAddDto; |
| | | import com.xiaopeng.account.vo.RoleInfoVo; |
| | | import com.xiaopeng.account.vo.RoleUpdateDto; |
| | | import com.xiaopeng.api.model.account.SysRoleBak; |
| | | import com.xiaopeng.api.model.account.SysRoleMenu; |
| | | import com.xiaopeng.api.model.account.SysUser; |
| | | import com.xiaopeng.api.model.account.SysUserRole; |
| | | import com.xiaopeng.api.model.account.SysDept; |
| | | import com.xiaopeng.api.model.account.*; |
| | | import com.xiaopeng.common.core.utils.StringUtils; |
| | | import com.xiaopeng.common.core.web.controller.BaseController; |
| | | import com.xiaopeng.common.core.web.domain.AjaxResult; |
| | |
| | | import com.xiaopeng.common.security.annotation.Logical; |
| | | import com.xiaopeng.common.security.annotation.RequiresPermissions; |
| | | import com.xiaopeng.common.security.utils.SecurityUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/role") |
| | | @Api(tags = "角色模块") |
| | | public class SysRoleBakController extends BaseController { |
| | | @Resource |
| | | private ISysRoleBakService roleService; |
| | |
| | | @RequiresPermissions(value = {"/roleManagement"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/listPage") |
| | | @ApiOperation(value = "获取角色列表", tags = {"管理后台-角色管理"}) |
| | | public AjaxResult listPage(String name, BasePage basePage) { |
| | | PageInfo<SysRoleBak> pageInfo = new PageInfo<>(basePage.getPageNum(), basePage.getPageSize()); |
| | | LambdaQueryWrapper<SysRoleBak> wrapper = new LambdaQueryWrapper<SysRoleBak>().eq(SysRoleBak::getStatus, 0).eq(SysRoleBak::getDelFlag, 0); |
| | |
| | | |
| | | @RequiresPermissions(value = {"/roleManagement/info", "/roleManagement/update"}, logical = Logical.OR) |
| | | @GetMapping("/roleInfo") |
| | | @ApiOperation(value = "角色详情", tags = {"管理后台-角色管理"}) |
| | | public AjaxResult roleInfo(@RequestParam Long id) { |
| | | SysRoleBak role = roleService.selectRoleById(id); |
| | | RoleInfoVo roleInfoVo = new RoleInfoVo(); |
| | |
| | | |
| | | @RequiresPermissions(value = {"/roleManagement/update"}, logical = Logical.OR) |
| | | @PostMapping("/roleUpdate") |
| | | @ApiOperation(value = "编辑角色", tags = {"管理后台-角色管理"}) |
| | | public AjaxResult roleUpdate(@Validated @RequestBody RoleUpdateDto dto) { |
| | | SysRoleBak role = new SysRoleBak(); |
| | | role.setRoleName(dto.getRoleName()); |
| | |
| | | @RequiresPermissions(value = {"/roleManagement/del"}, logical = Logical.OR) |
| | | @Log(title = "角色管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{roleIds}") |
| | | @ApiOperation(value = "删除角色", tags = {"管理后台-角色管理"}) |
| | | public AjaxResult remove(@PathVariable Long[] roleIds) { |
| | | return toAjax(roleService.deleteRoleByIds(roleIds)); |
| | | } |
| | |
| | | import com.xiaopeng.account.model.dto.UserPwdResetDTO; |
| | | import com.xiaopeng.account.model.query.SysUserListQuery; |
| | | import com.xiaopeng.account.service.*; |
| | | import com.xiaopeng.api.model.account.SysRole; |
| | | import com.xiaopeng.api.model.account.SysRoleBak; |
| | | import com.xiaopeng.api.model.account.SysUser; |
| | | import com.xiaopeng.api.model.account.SysUserRole; |
| | | import com.xiaopeng.api.model.account.SysDept; |
| | | import com.xiaopeng.api.model.account.*; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.enums.DisabledEnum; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.core.utils.RSAUtil; |
| | | import com.xiaopeng.common.core.utils.StringUtils; |
| | |
| | | import com.xiaopeng.common.log.annotation.Log; |
| | | import com.xiaopeng.common.log.enums.BusinessType; |
| | | import com.xiaopeng.common.redis.service.RedisService; |
| | | import com.xiaopeng.common.security.annotation.Logical; |
| | | import com.xiaopeng.common.security.annotation.RequiresPermissions; |
| | | import com.xiaopeng.common.security.service.TokenService; |
| | | import com.xiaopeng.common.security.utils.SecurityUtils; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | /** |
| | | * 获取用户列表 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement", "/roleManagement/info"}, logical = Logical.OR) |
| | | @GetMapping("/api/v1/sys-user/pageList") |
| | | @ApiOperation(value = "账号管理分页列表", tags = {"管理后台-账号管理"}) |
| | | public AjaxResult<PageInfo<SysUser>> list(SysUserListQuery sysUserListQuery) { |
| | |
| | | /** |
| | | * 新增用户 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement/add"}, logical = Logical.OR) |
| | | @Log(title = "帐号管理", businessType = BusinessType.INSERT) |
| | | @PostMapping("/api/v1/sys-user/add") |
| | | @ApiOperation(value = "添加帐号", tags = {"管理后台-帐号管理"}) |
| | |
| | | if (count > 0) { |
| | | throw new ServiceException("用户编号已存在", I18nKeyConstant.ACCOUNT_UNIQUE_NUMBER_DUPLICATE); |
| | | } |
| | | user.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | //TODO 手机号脱敏存储 |
| | | userService.insertUser(user); |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/systemUserManagement/add", "/systemUserManagement/update"}, logical = Logical.OR) |
| | | @GetMapping("/verifyUserNameRepeat/{username}") |
| | | @ApiOperation(value = "校验账号是否重复", tags = {"管理后台-系统用户管理"}) |
| | | public AjaxResult verifyUserNameRepeat(@PathVariable String username){ |
| | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement/update"}, logical = Logical.OR) |
| | | @Log(title = "帐号管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/api/v1/sys-user/edit") |
| | | @ApiOperation(value = "编辑帐号", tags = {"管理后台-帐号管理"}) |
| | | public AjaxResult edit(@Validated @RequestBody SysUser user) { |
| | | R<Integer> admin = this.isAdmin(user.getId()); |
| | | Integer data = admin.getData(); |
| | | if(data == null || data != 1){ |
| | | SysUserRole one = sysUserRoleService.getOne(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, user.getId())); |
| | | one.setRoleId(user.getRoleId()); |
| | | sysUserRoleService.updateSysUserRole(one); |
| | | } |
| | | userService.checkUserAllowed(user); |
| | | // userService.checkUserDataScope(user.getId()); |
| | | SysUser sysUser = userService.getOne(Wrappers.lambdaQuery(SysUser.class) |
| | |
| | | if (StringUtils.isNotEmpty(user.getUserAccount()) && (Objects.nonNull(sysUser) && !user.getId().equals(sysUser.getId()) )) { |
| | | throw new ServiceException("登录账号重复", I18nKeyConstant.ACCOUNT_DUPLICATE); |
| | | } |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | if (user.getPassword() != null && !user.getPassword().isEmpty()) { |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setPassword(null); |
| | | } |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | userService.updateUser(user); |
| | | userService.updateById(user); |
| | | |
| | | //删除旧的角色数据,添加新的角色 |
| | | sysUserRoleService.remove(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, user.getId())); |
| | |
| | | /** |
| | | * 删除用户 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement/del"}, logical = Logical.OR) |
| | | @Log(title = "帐号管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/api/v1/sys-user/{userIds}") |
| | | @ApiOperation(value = "删除账号", tags = {"管理后台-帐号管理"}) |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/systemUserManagement/forbidden"}, logical = Logical.OR) |
| | | @PostMapping("/api/v1/sys-user/switchStatus/{id}") |
| | | @ApiOperation(value = "账号管理--禁用/启用", tags = {"管理后台-帐号管理"}) |
| | | public AjaxResult shopUserStart(@ApiParam(name = "id", value = "帐号ID") @PathVariable("id") Long id) { |
| | | SysUser sysUser = userService.selectUserById(id); |
| | | if (sysUser.getStatus().equals("0")) { |
| | | sysUser.setStatus("1"); |
| | | SysUser sysUser = userService.getById(id); |
| | | if (sysUser.getStatus().equals(DisabledEnum.NO.getCode())) { |
| | | sysUser.setStatus(DisabledEnum.YES.getCode()); |
| | | } else { |
| | | sysUser.setStatus("0"); |
| | | sysUser.setStatus(DisabledEnum.NO.getCode()); |
| | | } |
| | | return toAjax(userService.updateById(sysUser)); |
| | | } |
| | |
| | | |
| | | |
| | | @PostMapping("/isAdmin") |
| | | public R<Integer> isAdmin(@RequestBody Long userId){ |
| | | public R<Long> isAdmin(@RequestBody Long userId){ |
| | | Long id = null; |
| | | SysUserRole one = sysUserRoleService.getOne(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId)); |
| | | Long id =one.getRoleId(); |
| | | return R.ok(id.intValue()); |
| | | if (Objects.nonNull(one)) { |
| | | id =one.getRoleId(); |
| | | } |
| | | return R.ok(id); |
| | | } |
| | | |
| | | @PostMapping("/getSysUser") |
| | |
| | | /** |
| | | * 重置密码 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement/reset_passwords"}, logical = Logical.OR) |
| | | @Log(title = "帐号管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/api/v1/sys-user/rePassword") |
| | | @ApiOperation(value = "重置密码", tags = {"管理后台-帐号管理"}) |
| | |
| | | userService.checkUserAllowed(user); |
| | | // userService.checkUserDataScope(user.getId()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | return toAjax(userService.resetPwd(user)); |
| | | return toAjax(userService.updateById(user)); |
| | | } |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 校验用户名称是否唯一 |
| | | * |
| | | * @param userName 用户名称 |
| | | * @param userAccount 用户名称 |
| | | * @return 结果 |
| | | */ |
| | | public SysUser checkUserNameUnique(String userName); |
| | | public SysUser checkUserNameUnique(String userAccount); |
| | | |
| | | /** |
| | | * 校验手机号码是否唯一 |
| | | * |
| | | * @param phonenumber 手机号码 |
| | | * @param phoneNumber 手机号码 |
| | | * @return 结果 |
| | | */ |
| | | public SysUser checkPhoneUnique(String phonenumber); |
| | | public SysUser checkPhoneUnique(String phoneNumber); |
| | | |
| | | |
| | | |
| | |
| | | package com.xiaopeng.account.model.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * 权限组分页列表VO |
| | |
| | | |
| | | @ApiModelProperty(value = "关联账号数") |
| | | private Long bindCount; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | } |
| | |
| | | FROM sys_user su |
| | | INNER JOIN sys_user_role sur ON su.id = sur.user_id |
| | | INNER JOIN sys_role sr ON sur.role_id = sr.id |
| | | LEFT JOIN sys_group sg ON sr.group_id = sg.id |
| | | WHERE sr.group_id = #{query.groupId} |
| | | AND sr.is_deleted = 0 |
| | | AND su.is_deleted = 0 |
| | | <if test="query.groupType != null"> |
| | | AND sr.group_type = #{query.groupType} |
| | | AND sg.group_type = #{query.groupType} |
| | | </if> |
| | | <if test="query.nickName != null and query.nickName != ''"> |
| | | AND su.nick_name LIKE CONCAT('%', #{query.nickName}, '%') |
| | |
| | | <mapper namespace="com.xiaopeng.account.mapper.SysUserMapper"> |
| | | |
| | | <resultMap type="com.xiaopeng.api.model.account.SysUser" id="SysUserResult"> |
| | | <id property="userId" column="id" /> |
| | | <result property="deptId" column="dept_id" /> |
| | | <result property="userName" column="user_name" /> |
| | | <result property="nickName" column="nick_name" /> |
| | | <result property="email" column="email" /> |
| | | <result property="phonenumber" column="phonenumber" /> |
| | | <result property="sex" column="sex" /> |
| | | <result property="avatar" column="avatar" /> |
| | | <result property="password" column="password" /> |
| | | <id property="id" column="id" /> |
| | | <result property="nickName" column="nick_name" /> |
| | | <result property="uniqueNumber" column="unique_number" /> |
| | | <result property="userAccount" column="user_account" /> |
| | | <result property="phoneNumber" column="phone_number" /> |
| | | <result property="password" column="password" /> |
| | | <result property="avatar" column="avatar" /> |
| | | <result property="status" column="status" /> |
| | | <result property="delFlag" column="del_flag" /> |
| | | <result property="loginIp" column="login_ip" /> |
| | | <result property="loginDate" column="login_date" /> |
| | | <result property="remarks" column="remarks" /> |
| | | <result property="deleted" column="is_deleted" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="forbiddenRemark" column="forbidden_remark"/> |
| | | <result property="remark" column="remark" /> |
| | | <result property="passWordUpdate" column="passWordUpdate" /> |
| | | <result property="roleType" column="roleType" /> |
| | | <result property="objectId" column="objectId" /> |
| | | <association property="dept" column="dept_id" javaType="com.xiaopeng.api.model.account.SysDept" resultMap="deptResult" /> |
| | | <result property="roleId" column="role_id" /> |
| | | <collection property="roles" javaType="java.util.List" resultMap="RoleResult" /> |
| | | </resultMap> |
| | | |
| | |
| | | </resultMap> |
| | | |
| | | <resultMap id="RoleResult" type="com.xiaopeng.api.model.account.SysRole"> |
| | | <id property="roleId" column="role_id" /> |
| | | <id property="id" column="role_id" /> |
| | | <result property="roleName" column="role_name" /> |
| | | <result property="roleKey" column="role_key" /> |
| | | <result property="dataScope" column="data_scope" /> |
| | | <result property="status" column="role_status" /> |
| | | <result property="groupId" column="group_id" /> |
| | | <result property="remarks" column="remarks" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectUserVo"> |
| | |
| | | </select> |
| | | |
| | | <select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult"> |
| | | select user_id, user_name from sys_user where user_name = #{userName} and del_flag = '0' limit 1 |
| | | select id, user_account from sys_user where user_account = #{userName} and is_deleted = 0 limit 1 |
| | | </select> |
| | | |
| | | <select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult"> |
| | | select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1 |
| | | select id, phone_number from sys_user where phone_number = #{phonenumber} and is_deleted = 0 limit 1 |
| | | </select> |
| | | |
| | | <select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult"> |
| | | select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1 |
| | | </select> |
| | | <select id="getList" resultMap="SysUserResult"> |
| | | select su.*,sr.role_name from sys_user su |
| | | select su.*,sr.role_name, sur.role_id from sys_user su |
| | | left join sys_user_role sur on su.id= sur.user_id |
| | | left join sys_role sr on sr.id = sur.role_id where 1=1 |
| | | <if test="req.nickname !=null and req.nickname !=''"> |
| | | and nick_name like concat("%", #{req.nickname},"%") |
| | | <if test="req.nickName !=null and req.nickName !=''"> |
| | | and su.nick_name like concat("%", #{req.nickName},"%") |
| | | </if> |
| | | <if test="req.phoneNumber !=null and req.phoneNumber !=''"> |
| | | and su.phone_number like concat("%", #{req.phoneNumber},"%") |
| | | </if> |
| | | <if test="null != req.roleId"> |
| | | and sur.role_id = #{req.roleId} |
| | |
| | | <if test="userName != null and userName != ''">user_name = #{userName},</if> |
| | | <if test="nickName != null and nickName != ''">nick_name = #{nickName},</if> |
| | | <if test="email != null ">email = #{email},</if> |
| | | <if test="phonenumber != null ">phonenumber = #{phonenumber},</if> |
| | | <if test="phoneNumber != null ">phone_number = #{phonenumber},</if> |
| | | <if test="sex != null and sex != ''">sex = #{sex},</if> |
| | | <if test="avatar != null and avatar != ''">avatar = #{avatar},</if> |
| | | <if test="password != null and password != ''">password = #{password},</if> |
| | |
| | | </delete> |
| | | |
| | | <delete id="deleteUserByIds" parameterType="Long"> |
| | | update sys_user set del_flag = '2' where user_id in |
| | | update sys_user set is_deleted = 1 where id in |
| | | <foreach collection="array" item="userId" open="(" separator="," close=")"> |
| | | #{userId} |
| | | </foreach> |
| | |
| | | /** 帐号状态(0正常 1停用) */ |
| | | @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") |
| | | @ApiModelProperty(value = "帐号状态 0=正常,1=停用") |
| | | private String status; |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | |
| | | |
| | | //开通城市已存在 |
| | | String OPEN_CITY_EXISTS = "open.city.exists"; |
| | | |
| | | //定价已存在 |
| | | String PRICING_EXISTS = "pricing.exists"; |
| | | |
| | | //定价不存在 |
| | | String PRICING_NOT_EXIST = "pricing.not.exist"; |
| | | |
| | | //价格配置json格式错误 |
| | | String PRICING_JSON_INVALID = "pricing.json.invalid"; |
| | | |
| | | //价格规则不能为空 |
| | | String PRICING_RULE_EMPTY = "pricing.rule.empty"; |
| | | } |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.xiaopeng.api.dto.operation.LonLatDto; |
| | | import com.xiaopeng.api.model.operation.XpGeoQueryEntity; |
| | | import com.xiaopeng.api.model.operation.XpPricing; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.web.controller.BaseController; |
| | | import com.xiaopeng.common.core.web.domain.AjaxResult; |
| | | import com.xiaopeng.api.dto.map.RouteAndFareDto; |
| | | import com.xiaopeng.api.dto.operation.LonLatDto; |
| | | import com.xiaopeng.api.model.operation.XpPricing; |
| | | import com.xiaopeng.api.vo.operation.RouteAndFareVo; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.core.web.controller.BaseController; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.operation.constant.I18nKeyConstant; |
| | | import com.xiaopeng.operation.dto.PricingAddDTO; |
| | | import com.xiaopeng.operation.dto.PricingSetPriceDTO; |
| | | import com.xiaopeng.operation.dto.PricingSetRuleDTO; |
| | | import com.xiaopeng.operation.dto.XpOrderDto; |
| | | import com.xiaopeng.operation.query.PricingPageListQuery; |
| | | import com.xiaopeng.operation.service.IXpGeoQueryEntityService; |
| | | import com.xiaopeng.operation.service.XpPricingService; |
| | | import com.xiaopeng.api.vo.operation.RouteAndFareVo; |
| | | import com.xiaopeng.operation.vo.PricingPageListVO; |
| | | import com.xiaopeng.operation.vo.SaveOrderVo; |
| | | import com.xiaopeng.unifiedverification.interceptor.XpClientCheck; |
| | | import io.swagger.annotations.Api; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | return R.ok(saveOrderVo); |
| | | } |
| | | |
| | | @PostMapping("/api/v1/pricing/pageList") |
| | | @ApiOperation(value = "管理后台-定价管理分页列表", tags = {"管理后台-定价管理"}) |
| | | public R<PageInfo<PricingPageListVO>> pageList(@RequestBody PricingPageListQuery query) { |
| | | return R.ok(xpPricingService.pageList(query)); |
| | | } |
| | | |
| | | @GetMapping("/api/v1/pricing/queryById") |
| | | @ApiOperation(value = "管理后台-定价管理-详情", tags = {"管理后台-定价管理"}, response = XpPricing.class) |
| | | public R<XpPricing> queryById(@RequestParam Long id) { |
| | | XpPricing pricing = xpPricingService.getById(id); |
| | | if (pricing == null) { |
| | | throw new ServiceException("定价不存在", I18nKeyConstant.PRICING_NOT_EXIST); |
| | | } |
| | | return R.ok(pricing); |
| | | } |
| | | |
| | | @PostMapping("/api/v1/pricing/add") |
| | | @ApiOperation(value = "管理后台-新增定价", tags = {"管理后台-定价管理"}) |
| | | public R<?> add(@Valid @RequestBody PricingAddDTO dto) { |
| | | xpPricingService.add(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/api/v1/pricing/setPrice") |
| | | @ApiOperation(value = "管理后台-定价管理-设置价格", tags = {"管理后台-定价管理"}) |
| | | public R<?> setPrice(@Valid @RequestBody PricingSetPriceDTO dto) { |
| | | xpPricingService.setPrice(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/api/v1/pricing/setRule") |
| | | @ApiOperation(value = "管理后台-计费规则富文本配置", tags = {"管理后台-定价管理"}) |
| | | public R<?> setRule(@Valid @RequestBody PricingSetRuleDTO dto) { |
| | | xpPricingService.setRule(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @DeleteMapping("/api/v1/pricing/deleteById") |
| | | @ApiOperation(value = "管理后台-定价管理-删除", tags = {"管理后台-定价管理"}) |
| | | public R<?> deleteById(@RequestParam Long id) { |
| | | XpPricing pricing = xpPricingService.getById(id); |
| | | if (pricing == null) { |
| | | throw new ServiceException("定价不存在", I18nKeyConstant.PRICING_NOT_EXIST); |
| | | } |
| | | xpPricingService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.xiaopeng.operation.service.XpOpenCityService; |
| | | import com.xiaopeng.operation.service.XpRegionService; |
| | | import com.xiaopeng.operation.vo.RegionCascaderVO; |
| | | import com.xiaopeng.operation.vo.RegionDistrictSyncResultVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | |
| | | */ |
| | | @Api(tags = "省市管理") |
| | | @RestController |
| | | @RequestMapping("/base/v1/mini-program") |
| | | public class XpRegionController { |
| | | |
| | | private final XpRegionService regionService; |
| | |
| | | * 查询省市管理 |
| | | */ |
| | | @ApiOperation(value = "查询省市管理",tags = {"小程序-省市管理"},response = XpRegion.class) |
| | | @GetMapping(value = "/open/t-region/getRegion") |
| | | @GetMapping(value = "/base/v1/mini-program/open/t-region/getRegion") |
| | | public R<List<List<XpRegion>>> geXpRegion() { |
| | | return R.ok(regionService.getXpRegion()); |
| | | } |
| | |
| | | * 查询市 |
| | | */ |
| | | @ApiOperation(value = "查询市",tags = {"小程序-查询市"},response = XpRegion.class) |
| | | @PostMapping(value = "/open/t-region/getProvince") |
| | | @PostMapping(value = "/base/v1/mini-program/open/t-region/getProvince") |
| | | public R<List<XpRegion>> getProvince(@RequestBody getProvinceQuery query) { |
| | | // 缓存数据 |
| | | List<Object> cacheList = redisService.getCacheList(CacheConstants.XP_REGION_CITY); |
| | |
| | | public R<List<RegionCascaderVO>> getRegionCascader() { |
| | | return R.ok(regionService.getRegionCascader()); |
| | | } |
| | | |
| | | /** |
| | | * 管理后台-同步区级数据 |
| | | */ |
| | | @ApiOperation(value = "管理后台-同步区级数据", tags = {"管理后台-省市区管理"}) |
| | | @PostMapping("/api/v1/region/syncDistrict") |
| | | public R<RegionDistrictSyncResultVO> syncDistrict() { |
| | | return R.ok(regionService.syncDistrictFromRegionAll()); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.xiaopeng.operation.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.Max; |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * 定价新增数据传输对象 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "定价新增数据传输对象") |
| | | public class PricingAddDTO { |
| | | |
| | | @ApiModelProperty(value = "车型", required = true) |
| | | @NotBlank(message = "车型不能为空") |
| | | private String vehicleModel; |
| | | |
| | | @ApiModelProperty(value = "渠道", required = true) |
| | | @NotBlank(message = "渠道不能为空") |
| | | private String channel; |
| | | |
| | | @ApiModelProperty(value = "开通城市ID", required = true) |
| | | @NotNull(message = "开通城市ID不能为空") |
| | | private Long cityId; |
| | | |
| | | @ApiModelProperty(value = "说明") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "计费规则 1动态计费 2一口价", required = true) |
| | | @NotNull(message = "计费规则不能为空") |
| | | @Min(value = 1, message = "计费规则不合法") |
| | | @Max(value = 2, message = "计费规则不合法") |
| | | private Integer pricingType; |
| | | } |
| New file |
| | |
| | | package com.xiaopeng.operation.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * 定价设置价格数据传输对象 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "定价设置价格数据传输对象") |
| | | public class PricingSetPriceDTO { |
| | | |
| | | @ApiModelProperty(value = "定价ID", required = true) |
| | | @NotNull(message = "定价ID不能为空") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "基础价格json配置", required = true) |
| | | @NotBlank(message = "基础价格json配置不能为空") |
| | | private String basicPricingJson; |
| | | |
| | | @ApiModelProperty(value = "起步价json配置", required = true) |
| | | @NotBlank(message = "起步价json配置不能为空") |
| | | private String startingFareJson; |
| | | |
| | | @ApiModelProperty(value = "动态价格json配置", required = true) |
| | | @NotBlank(message = "动态价格json配置不能为空") |
| | | private String dynamicPricingJson; |
| | | } |
| New file |
| | |
| | | package com.xiaopeng.operation.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * 定价计费规则富文本配置数据传输对象 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "定价计费规则富文本配置数据传输对象") |
| | | public class PricingSetRuleDTO { |
| | | |
| | | @ApiModelProperty(value = "定价ID", required = true) |
| | | @NotNull(message = "定价ID不能为空") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "价格规则", required = true) |
| | | @NotBlank(message = "价格规则不能为空") |
| | | private String priceRule; |
| | | } |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.xiaopeng.api.model.operation.XpPricing; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.operation.query.PricingPageListQuery; |
| | | import com.xiaopeng.operation.vo.PricingPageListVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface XpPricingMapper extends BaseMapper<XpPricing> { |
| | | |
| | | /** |
| | | * 定价管理分页列表 |
| | | * |
| | | * @param pageInfo 分页信息 |
| | | * @param query 查询条件 |
| | | * @return 分页数据 |
| | | */ |
| | | Page<PricingPageListVO> pageList(@Param("pageInfo") PageInfo<PricingPageListVO> pageInfo, |
| | | @Param("query") PricingPageListQuery query); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.xiaopeng.api.model.operation.XpRegion; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 省市区三级联动 Mapper 接口 |
| | |
| | | * @since 2026-02-03 |
| | | */ |
| | | public interface XpRegionMapper extends BaseMapper<XpRegion> { |
| | | |
| | | /** |
| | | * 查询缺失的区级数据 |
| | | * @return 待同步区级数据 |
| | | */ |
| | | List<XpRegion> selectMissingDistrictFromRegionAll(); |
| | | |
| | | /** |
| | | * 查询可参与同步的市级总数 |
| | | * @return 市级总数 |
| | | */ |
| | | Long countCityForDistrictSync(); |
| | | |
| | | /** |
| | | * 查询候选区级总数(无论是否已存在) |
| | | * @return 候选区级总数 |
| | | */ |
| | | Long countCandidateDistrictForSync(); |
| | | |
| | | } |
| New file |
| | |
| | | package com.xiaopeng.operation.query; |
| | | |
| | | import com.xiaopeng.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * 定价管理分页查询对象 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ApiModel(value = "定价管理分页查询对象") |
| | | public class PricingPageListQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "车型") |
| | | private String vehicleModel; |
| | | |
| | | @ApiModelProperty(value = "城市") |
| | | private String cityName; |
| | | } |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.xiaopeng.api.model.operation.XpPricing; |
| | | import com.xiaopeng.api.dto.map.RouteAndFareDto; |
| | | import com.xiaopeng.api.model.operation.XpPricing; |
| | | import com.xiaopeng.api.vo.operation.RouteAndFareVo; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.operation.dto.PricingAddDTO; |
| | | import com.xiaopeng.operation.dto.PricingSetPriceDTO; |
| | | import com.xiaopeng.operation.dto.PricingSetRuleDTO; |
| | | import com.xiaopeng.operation.dto.XpOrderDto; |
| | | import com.xiaopeng.operation.query.PricingPageListQuery; |
| | | import com.xiaopeng.operation.vo.PricingPageListVO; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | Long saveOrder(XpOrderDto dto,String uid); |
| | | |
| | | /** |
| | | * 管理后台-定价管理分页列表 |
| | | * |
| | | * @param query 查询条件 |
| | | * @return 分页结果 |
| | | */ |
| | | PageInfo<PricingPageListVO> pageList(PricingPageListQuery query); |
| | | |
| | | /** |
| | | * 管理后台-新增定价 |
| | | * |
| | | * @param dto 新增参数 |
| | | */ |
| | | void add(PricingAddDTO dto); |
| | | |
| | | /** |
| | | * 管理后台-定价管理-设置价格 |
| | | * |
| | | * @param dto 设置参数 |
| | | */ |
| | | void setPrice(PricingSetPriceDTO dto); |
| | | |
| | | /** |
| | | * 管理后台-计费规则富文本配置 |
| | | * |
| | | * @param dto 配置参数 |
| | | */ |
| | | void setRule(PricingSetRuleDTO dto); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.xiaopeng.api.model.operation.XpRegion; |
| | | import com.xiaopeng.operation.vo.RegionCascaderVO; |
| | | import com.xiaopeng.operation.vo.RegionDistrictSyncResultVO; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @return 级联树 |
| | | */ |
| | | List<RegionCascaderVO> getRegionCascader(); |
| | | |
| | | /** |
| | | * 从xp_region_all同步区级数据到xp_region |
| | | * @return 同步结果 |
| | | */ |
| | | RegionDistrictSyncResultVO syncDistrictFromRegionAll(); |
| | | |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xiaopeng.api.dto.account.GetUserCouponDto; |
| | | import com.xiaopeng.api.dto.map.RouteAndFareDto; |
| | |
| | | import com.xiaopeng.api.feignClient.account.XpAppUserCouponClient; |
| | | import com.xiaopeng.api.feignClient.map.XpMapClient; |
| | | import com.xiaopeng.api.feignClient.order.XpOrderClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient; |
| | | import com.xiaopeng.api.model.account.XpAppUser; |
| | | import com.xiaopeng.api.model.operation.*; |
| | | import com.xiaopeng.api.model.order.XpOrder; |
| | |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.core.utils.DateUtils; |
| | | import com.xiaopeng.common.core.utils.uuid.UUID; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.redis.service.RedisService; |
| | | import com.xiaopeng.operation.constant.I18nKeyConstant; |
| | | import com.xiaopeng.operation.dto.PricingAddDTO; |
| | | import com.xiaopeng.operation.dto.PricingSetPriceDTO; |
| | | import com.xiaopeng.operation.dto.PricingSetRuleDTO; |
| | | import com.xiaopeng.operation.dto.XpOrderDto; |
| | | import com.xiaopeng.api.model.operation.XpGeoQueryEntity; |
| | | import com.xiaopeng.operation.mapper.*; |
| | | import com.xiaopeng.operation.query.PricingPageListQuery; |
| | | import com.xiaopeng.operation.service.IXpGeoQueryEntityService; |
| | | import com.xiaopeng.operation.service.XpPricingService; |
| | | import com.xiaopeng.operation.utils.XpPricingUtil; |
| | | import com.xiaopeng.operation.utils.holiday.HolidayUtil; |
| | | import com.xiaopeng.operation.utils.map.FastDistanceCalculator; |
| | | import com.xiaopeng.operation.vo.PricingPageListVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.geo.GeoJsonPoint; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.PreDestroy; |
| | | import javax.annotation.Resource; |
| | | import java.time.Duration; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.concurrent.*; |
| | |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<PricingPageListVO> pageList(PricingPageListQuery query) { |
| | | PageInfo<PricingPageListVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | Page<PricingPageListVO> page = this.baseMapper.pageList(pageInfo, query); |
| | | pageInfo.setRecords(page.getRecords()); |
| | | pageInfo.setTotal(page.getTotal()); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public void add(PricingAddDTO dto) { |
| | | XpOpenCity openCity = xpOpenCityMapper.selectById(dto.getCityId()); |
| | | if (openCity == null) { |
| | | throw new ServiceException("开通城市不存在"); |
| | | } |
| | | |
| | | Long count = this.lambdaQuery() |
| | | .eq(XpPricing::getVehicleModel, dto.getVehicleModel()) |
| | | .eq(XpPricing::getChannel, dto.getChannel()) |
| | | .eq(XpPricing::getCityId, dto.getCityId().intValue()) |
| | | .count(); |
| | | if (count != null && count > 0) { |
| | | throw new ServiceException("该车型/渠道/城市的定价已存在", I18nKeyConstant.PRICING_EXISTS); |
| | | } |
| | | |
| | | XpPricing pricing = new XpPricing(); |
| | | pricing.setVehicleModel(dto.getVehicleModel()); |
| | | pricing.setChannel(dto.getChannel()); |
| | | pricing.setCityId(dto.getCityId().intValue()); |
| | | pricing.setRemark(dto.getRemark()); |
| | | pricing.setPricingType(dto.getPricingType()); |
| | | pricing.setBasicPricingJson("{}"); |
| | | pricing.setStartingFareJson("[]"); |
| | | pricing.setDynamicPricingJson("{}"); |
| | | pricing.setIsDynamicPrice(0); |
| | | this.save(pricing); |
| | | } |
| | | |
| | | @Override |
| | | public void setPrice(PricingSetPriceDTO dto) { |
| | | XpPricing pricing = this.getById(dto.getId()); |
| | | if (pricing == null) { |
| | | throw new ServiceException("定价不存在", I18nKeyConstant.PRICING_NOT_EXIST); |
| | | } |
| | | |
| | | try { |
| | | JSONObject.parseObject(dto.getBasicPricingJson()); |
| | | JSONArray.parseArray(dto.getStartingFareJson()); |
| | | JSONObject.parseObject(dto.getDynamicPricingJson()); |
| | | } catch (Exception e) { |
| | | throw new ServiceException("价格配置JSON格式不正确", I18nKeyConstant.PRICING_JSON_INVALID); |
| | | } |
| | | |
| | | XpPricing update = new XpPricing(); |
| | | update.setId(dto.getId()); |
| | | update.setBasicPricingJson(dto.getBasicPricingJson()); |
| | | update.setStartingFareJson(dto.getStartingFareJson()); |
| | | update.setDynamicPricingJson(dto.getDynamicPricingJson()); |
| | | this.updateById(update); |
| | | } |
| | | |
| | | @Override |
| | | public void setRule(PricingSetRuleDTO dto) { |
| | | XpPricing pricing = this.getById(dto.getId()); |
| | | if (pricing == null) { |
| | | throw new ServiceException("定价不存在", I18nKeyConstant.PRICING_NOT_EXIST); |
| | | } |
| | | |
| | | XpPricing update = new XpPricing(); |
| | | update.setId(dto.getId()); |
| | | update.setPriceRule(dto.getPriceRule()); |
| | | this.updateById(update); |
| | | } |
| | | |
| | | } |
| | |
| | | .comparing((XpRegion region) -> StringUtils.defaultString(region.getInitial())) |
| | | .thenComparing((XpRegion region) -> StringUtils.defaultString(region.getCode())); |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public RegionDistrictSyncResultVO syncDistrictFromRegionAll() { |
| | | Long cityCount = this.baseMapper.countCityForDistrictSync(); |
| | | if (cityCount == null) { |
| | | cityCount = 0L; |
| | | } |
| | | Long candidateDistrictCount = this.baseMapper.countCandidateDistrictForSync(); |
| | | if (candidateDistrictCount == null) { |
| | | candidateDistrictCount = 0L; |
| | | } |
| | | |
| | | List<XpRegion> missingDistrictList = this.baseMapper.selectMissingDistrictFromRegionAll(); |
| | | long insertedCount = 0L; |
| | | if (missingDistrictList != null && !missingDistrictList.isEmpty()) { |
| | | this.saveBatch(missingDistrictList); |
| | | insertedCount = missingDistrictList.size(); |
| | | } |
| | | |
| | | redisService.deleteObject(CacheConstants.XP_REGION); |
| | | redisService.deleteObject(CacheConstants.XP_REGION_CITY); |
| | | redisService.deleteObject(CacheConstants.XP_REGION_CASCADER); |
| | | |
| | | RegionDistrictSyncResultVO result = new RegionDistrictSyncResultVO(); |
| | | result.setCityCount(cityCount); |
| | | result.setCandidateDistrictCount(candidateDistrictCount); |
| | | result.setInsertedCount(insertedCount); |
| | | result.setSkippedCount(Math.max(candidateDistrictCount - insertedCount, 0)); |
| | | result.setMessage("区级数据同步完成"); |
| | | return result; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.xiaopeng.operation.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 定价管理分页列表项 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "定价管理分页列表项") |
| | | public class PricingPageListVO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value = "车型") |
| | | private String vehicleModel; |
| | | |
| | | @ApiModelProperty(value = "使用城市") |
| | | private String useCity; |
| | | |
| | | @ApiModelProperty(value = "渠道") |
| | | private String channel; |
| | | |
| | | @ApiModelProperty(value = "计费规则 1动态计费 2一口价") |
| | | private Integer pricingType; |
| | | } |
| | |
| | | fence.not.exist=围栏不存在 |
| | | fence.status.cannot.copied=围栏启用状态不可复制; |
| | | order.create.fail=订单创建失败 |
| | | open.city.exists=该城市已存在 |
| | | open.city.exists=该城市已存在 |
| | | pricing.exists=该车型/渠道/城市的定价已存在 |
| | | pricing.not.exist=定价不存在 |
| | | pricing.json.invalid=价格配置JSON格式不正确 |
| | | pricing.rule.empty=价格规则不能为空 |
| | |
| | | fence.status.cannot.copied=The enabled state of the fence cannot be copied; |
| | | fence.not.exist=The fence does not exist. |
| | | order.create.fail=Order creation failed |
| | | open.city.exists=This city already exists |
| | | open.city.exists=This city already exists |
| | | pricing.exists=Pricing for this vehicle model/channel/city already exists |
| | | pricing.not.exist=Pricing does not exist |
| | | pricing.json.invalid=Invalid JSON format for pricing configuration |
| | | pricing.rule.empty=Price rule cannot be empty |
| | |
| | | fence.not.exist=围栏不存在 |
| | | fence.status.cannot.copied=围栏启用状态不可复制 |
| | | order.create.fail=订单创建失败 |
| | | open.city.exists=该城市已存在 |
| | | open.city.exists=该城市已存在 |
| | | pricing.exists=该车型/渠道/城市的定价已存在 |
| | | pricing.not.exist=定价不存在 |
| | | pricing.json.invalid=价格配置JSON格式不正确 |
| | | pricing.rule.empty=价格规则不能为空 |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.xiaopeng.operation.mapper.XpPricingMapper"> |
| | | |
| | | |
| | | <select id="pageList" resultType="com.xiaopeng.operation.vo.PricingPageListVO"> |
| | | SELECT |
| | | p.create_time AS createTime, |
| | | p.vehicle_model AS vehicleModel, |
| | | CASE |
| | | WHEN oc.district_name IS NOT NULL AND oc.district_name != '' |
| | | THEN CONCAT(oc.city_name, '->', oc.district_name) |
| | | ELSE oc.city_name |
| | | END AS useCity, |
| | | p.channel AS channel, |
| | | p.pricing_type AS pricingType |
| | | FROM xp_pricing p |
| | | LEFT JOIN xp_open_city oc ON p.city_id = oc.id |
| | | WHERE p.is_deleted = 0 |
| | | <if test="query.vehicleModel != null and query.vehicleModel != ''"> |
| | | AND p.vehicle_model LIKE CONCAT('%', #{query.vehicleModel}, '%') |
| | | </if> |
| | | <if test="query.cityName != null and query.cityName != ''"> |
| | | AND ( |
| | | oc.city_name LIKE CONCAT('%', #{query.cityName}, '%') |
| | | OR oc.district_name LIKE CONCAT('%', #{query.cityName}, '%') |
| | | ) |
| | | </if> |
| | | ORDER BY p.create_time DESC |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.xiaopeng.operation.mapper.XpRegionMapper"> |
| | | |
| | | <select id="selectMissingDistrictFromRegionAll" resultType="com.xiaopeng.api.model.operation.XpRegion"> |
| | | select |
| | | district.name as name, |
| | | district.code as code, |
| | | district.citycode as cityCode, |
| | | city.id as parentId, |
| | | district.english as english, |
| | | city.initial as initial |
| | | from xp_region city |
| | | join xp_region_all all_city on all_city.code = city.code |
| | | join xp_region_all district on district.parent_id = all_city.id |
| | | left join xp_region existing on existing.code = district.code |
| | | where city.parentId != 0 |
| | | and city.code like '%00' |
| | | and city.code not like '%0000' |
| | | and existing.id is null |
| | | order by city.code, district.code |
| | | </select> |
| | | |
| | | <select id="countCityForDistrictSync" resultType="java.lang.Long"> |
| | | select count(1) |
| | | from xp_region city |
| | | join xp_region_all all_city on all_city.code = city.code |
| | | where city.parentId != 0 |
| | | and city.code like '%00' |
| | | and city.code not like '%0000' |
| | | </select> |
| | | |
| | | <select id="countCandidateDistrictForSync" resultType="java.lang.Long"> |
| | | select count(1) |
| | | from xp_region city |
| | | join xp_region_all all_city on all_city.code = city.code |
| | | join xp_region_all district on district.parent_id = all_city.id |
| | | where city.parentId != 0 |
| | | and city.code like '%00' |
| | | and city.code not like '%0000' |
| | | </select> |
| | | |
| | | </mapper> |