呼出号码管理增删改查
This commit is contained in:
@@ -85,6 +85,8 @@ public enum ErrorCodeEnum {
|
||||
INSPECTION_USER_OCCUPY(600002,"当前稽核人已经配置其他战区",null),
|
||||
INSPECTION_INFO_NOT_EXIST(600005, "稽核信息不存在!", null),
|
||||
OPEN_AREA_NULL(600006,"归属地区不能为空",null),
|
||||
|
||||
OUTBOUND_NUMBER_EXIST(110001, "手机号已存在!", null);
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
|
||||
import com.cool.store.dto.outbound.OutboundListDTO;
|
||||
import com.cool.store.entity.HyOutboundMobileDO;
|
||||
import com.cool.store.vo.HyOutboundVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Fun Li
|
||||
* @date 2023/08/09
|
||||
*/
|
||||
public interface HyOutboundMobileMapper {
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(HyOutboundMobileDO record);
|
||||
|
||||
int insertSelective(HyOutboundMobileDO record);
|
||||
|
||||
HyOutboundMobileDO selectByPrimaryKey(Long id);
|
||||
|
||||
List<HyOutboundMobileDO> selectByPrimarySelective(HyOutboundMobileDO hyOutboundMobileDO);
|
||||
|
||||
int updateByPrimaryKeySelective(HyOutboundMobileDO record);
|
||||
|
||||
int updateByPrimaryKey(HyOutboundMobileDO record);
|
||||
|
||||
/**
|
||||
* 获取呼出手机号列表
|
||||
*
|
||||
* @param dto
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<HyOutboundVo> getOutboundNumberList(@Param("dto") OutboundListDTO dto, @Param("userId") String userId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
<?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="com.cool.store.mapper.HyOutboundMobileMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyOutboundMobileDO">
|
||||
<id column="id" property="id" />
|
||||
<result column="mobile" property="mobile" />
|
||||
<result column="remark" property="remark" />
|
||||
<result column="create_user_id" property="createUserId" />
|
||||
<result column="update_user_id" property="updateUserId" />
|
||||
<result column="deleted" property="deleted" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, mobile, remark, create_user_id, update_user_id, deleted, create_time, update_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from hy_outbound_mobile
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectByPrimarySelective" resultType="com.cool.store.entity.HyOutboundMobileDO">
|
||||
select <include refid="Base_Column_List" />
|
||||
from hy_outbound_mobile
|
||||
where deleted = 0
|
||||
<if test="id != null">
|
||||
id = #{id}
|
||||
</if>
|
||||
<if test="mobile != null">
|
||||
and mobile = #{mobile}
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
and remark = #{remark}
|
||||
</if>
|
||||
<if test="createUserId != null">
|
||||
and create_user_id = #{createUserId}
|
||||
</if>
|
||||
<if test="updateUserId != null">
|
||||
and update_user_id = #{updateUserId}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from hy_outbound_mobile
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.cool.store.entity.HyOutboundMobileDO">
|
||||
insert into hy_outbound_mobile (id, mobile, remark,
|
||||
create_user_id, update_user_id, deleted,
|
||||
create_time, update_time)
|
||||
values (#{id}, #{mobile}, #{remark},
|
||||
#{createUserId}, #{updateUserId}, #{deleted},
|
||||
#{createTime}, #{updateTime})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.cool.store.entity.HyOutboundMobileDO">
|
||||
insert into hy_outbound_mobile
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="mobile != null">
|
||||
mobile,
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark,
|
||||
</if>
|
||||
<if test="createUserId != null">
|
||||
create_user_id,
|
||||
</if>
|
||||
<if test="updateUserId != null">
|
||||
update_user_id,
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id},
|
||||
</if>
|
||||
<if test="mobile != null">
|
||||
#{mobile},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
#{remark},
|
||||
</if>
|
||||
<if test="createUserId != null">
|
||||
#{createUserId},
|
||||
</if>
|
||||
<if test="updateUserId != null">
|
||||
#{updateUserId},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
#{deleted},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.cool.store.entity.HyOutboundMobileDO">
|
||||
update hy_outbound_mobile
|
||||
<set>
|
||||
<if test="mobile != null">
|
||||
mobile = #{mobile},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark = #{remark},
|
||||
</if>
|
||||
<if test="createUserId != null">
|
||||
create_user_id = #{createUserId},
|
||||
</if>
|
||||
<if test="updateUserId != null">
|
||||
update_user_id = #{updateUserId},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.cool.store.entity.HyOutboundMobileDO">
|
||||
update hy_outbound_mobile
|
||||
set mobile = #{mobile},
|
||||
remark = #{remark},
|
||||
create_user_id = #{createUserId},
|
||||
update_user_id = #{updateUserId},
|
||||
deleted = #{deleted},
|
||||
create_time = #{createTime},
|
||||
update_time = #{updateTime}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 获取呼出手机号列表 -->
|
||||
<select id="getOutboundNumberList" resultType="com.cool.store.vo.HyOutboundVo">
|
||||
SELECT t1.id, t1.mobile as outboundNumber, t2.name as updaterName, t2.mobile as updaterMobile, t1.update_time as update_time
|
||||
FROM hy_outbound_mobile t1
|
||||
LEFT JOIN enterprise_user t2 ON t1.update_user_id = t2.user_id
|
||||
WHERE t2.deleted = 0 AND t1.deleted = 0
|
||||
AND t1.update_user_id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.cool.store.dto.outbound;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/8/9 17:44
|
||||
* @version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class AddNumberDTO {
|
||||
|
||||
@ApiModelProperty("11位外呼号码")
|
||||
private String outboundNumber;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.cool.store.dto.outbound;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/8/9 18:38
|
||||
* @version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class DeleteNumberDTO {
|
||||
|
||||
@ApiModelProperty("id")
|
||||
private Long id;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.cool.store.dto.outbound;
|
||||
|
||||
import com.cool.store.common.PageBasicInfo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/8/9 15:49
|
||||
* @version 1.0
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class OutboundListDTO extends PageBasicInfo {
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.cool.store.dto.outbound;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/8/9 18:05
|
||||
* @version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class UpdateNumberDTO {
|
||||
|
||||
@ApiModelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("11位外呼号码")
|
||||
private String newOutboundNumber;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.cool.store.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* @author Fun Li
|
||||
* @date 2023/08/09
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class HyOutboundMobileDO {
|
||||
@ApiModelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty("备注(保留字段)")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("创建人user_id(enterprise_user.user_id)")
|
||||
private String createUserId;
|
||||
|
||||
@ApiModelProperty("修改人user_id(enterprise_user.user_id)")
|
||||
private String updateUserId;
|
||||
|
||||
@ApiModelProperty("是否删除,0表示未删除")
|
||||
private Boolean deleted;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.cool.store.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/8/9 15:38
|
||||
* @version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class HyOutboundVo {
|
||||
|
||||
@ApiModelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("外呼手机号码")
|
||||
private String outboundNumber;
|
||||
|
||||
@ApiModelProperty("编辑人姓名")
|
||||
private String updaterName;
|
||||
|
||||
@ApiModelProperty("编辑人手机号")
|
||||
private String updaterMobile;
|
||||
|
||||
@ApiModelProperty("编辑时间")
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.dto.outbound.AddNumberDTO;
|
||||
import com.cool.store.dto.outbound.DeleteNumberDTO;
|
||||
import com.cool.store.dto.outbound.OutboundListDTO;
|
||||
import com.cool.store.dto.outbound.UpdateNumberDTO;
|
||||
import com.cool.store.exception.ApiException;
|
||||
import com.cool.store.vo.HyOutboundVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/8/9 15:35
|
||||
* @version 1.0
|
||||
*/
|
||||
public interface HyOutboundService {
|
||||
|
||||
/**
|
||||
* 获取呼出手机号列表信息
|
||||
* @return 手机号信息列表
|
||||
*/
|
||||
List<HyOutboundVo> getOutboundNumberList(OutboundListDTO dto);
|
||||
|
||||
/**
|
||||
* 新增呼出手机号
|
||||
* @param dto 新增手机号信息
|
||||
*/
|
||||
void addOutboundNumber(AddNumberDTO dto) throws ApiException;
|
||||
|
||||
/**
|
||||
* 编辑呼出手机号
|
||||
* @param dto 修改的手机号信息
|
||||
*/
|
||||
void updateOutboundNumber(UpdateNumberDTO dto) throws ApiException;
|
||||
|
||||
/**
|
||||
* 删除呼出手机号
|
||||
* @param dto 待删除的手机号信息编号
|
||||
*/
|
||||
void deleteOutboundNumber(DeleteNumberDTO dto);
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.cool.store.context.CurrentUserHolder;
|
||||
import com.cool.store.dto.outbound.AddNumberDTO;
|
||||
import com.cool.store.dto.outbound.DeleteNumberDTO;
|
||||
import com.cool.store.dto.outbound.OutboundListDTO;
|
||||
import com.cool.store.dto.outbound.UpdateNumberDTO;
|
||||
import com.cool.store.entity.HyOutboundMobileDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.exception.ApiException;
|
||||
import com.cool.store.mapper.HyOutboundMobileMapper;
|
||||
import com.cool.store.service.HyOutboundService;
|
||||
import com.cool.store.vo.HyOutboundVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/8/9 15:36
|
||||
* @version 1.0
|
||||
*/
|
||||
@Service
|
||||
public class HyOutboundServiceImpl implements HyOutboundService {
|
||||
|
||||
@Autowired
|
||||
private HyOutboundMobileMapper outboundMobileMapper;
|
||||
|
||||
/**
|
||||
* 获取呼出手机号列表信息
|
||||
* @return 手机号信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<HyOutboundVo> getOutboundNumberList(OutboundListDTO dto) {
|
||||
return outboundMobileMapper.getOutboundNumberList(dto, CurrentUserHolder.getUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增呼出手机号
|
||||
* @param dto 新增手机号信息
|
||||
*/
|
||||
@Override
|
||||
public void addOutboundNumber(AddNumberDTO dto) throws ApiException {
|
||||
if (whetherRepeat(dto.getOutboundNumber())) {
|
||||
throw new ApiException(ErrorCodeEnum.OUTBOUND_NUMBER_EXIST);
|
||||
}
|
||||
String userId = CurrentUserHolder.getUserId();
|
||||
HyOutboundMobileDO hyOutboundMobile = new HyOutboundMobileDO();
|
||||
hyOutboundMobile.setMobile(dto.getOutboundNumber());
|
||||
hyOutboundMobile.setCreateUserId(userId);
|
||||
hyOutboundMobile.setUpdateUserId(userId);
|
||||
outboundMobileMapper.insertSelective(hyOutboundMobile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑呼出手机号
|
||||
* @param dto 修改的手机号信息
|
||||
*/
|
||||
@Override
|
||||
public void updateOutboundNumber(UpdateNumberDTO dto) throws ApiException {
|
||||
if (whetherRepeat(dto.getNewOutboundNumber())) {
|
||||
throw new ApiException(ErrorCodeEnum.OUTBOUND_NUMBER_EXIST);
|
||||
}
|
||||
String userId = CurrentUserHolder.getUserId();
|
||||
HyOutboundMobileDO hyOutboundMobile = new HyOutboundMobileDO();
|
||||
hyOutboundMobile.setId(dto.getId());
|
||||
hyOutboundMobile.setMobile(dto.getNewOutboundNumber());
|
||||
hyOutboundMobile.setCreateUserId(userId);
|
||||
hyOutboundMobile.setUpdateUserId(userId);
|
||||
outboundMobileMapper.updateByPrimaryKeySelective(hyOutboundMobile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除呼出手机号
|
||||
* @param dto 待删除的手机号信息编号
|
||||
*/
|
||||
@Override
|
||||
public void deleteOutboundNumber(DeleteNumberDTO dto) {
|
||||
HyOutboundMobileDO hyOutboundMobile = new HyOutboundMobileDO();
|
||||
hyOutboundMobile.setId(dto.getId());
|
||||
hyOutboundMobile.setDeleted(true);
|
||||
outboundMobileMapper.updateByPrimaryKeySelective(hyOutboundMobile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询某个手机号是否重复
|
||||
* @param number 手机号
|
||||
* @return 是否重复
|
||||
*/
|
||||
public boolean whetherRepeat(String number) {
|
||||
HyOutboundMobileDO hyOutboundMobileDO = new HyOutboundMobileDO();
|
||||
hyOutboundMobileDO.setMobile(number);
|
||||
List<HyOutboundMobileDO> outboundMobileList = outboundMobileMapper.selectByPrimarySelective(hyOutboundMobileDO);
|
||||
return outboundMobileList != null && outboundMobileList.size() != 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.cool.store.controller;
|
||||
|
||||
import com.cool.store.dto.outbound.AddNumberDTO;
|
||||
import com.cool.store.dto.outbound.DeleteNumberDTO;
|
||||
import com.cool.store.dto.outbound.OutboundListDTO;
|
||||
import com.cool.store.dto.outbound.UpdateNumberDTO;
|
||||
import com.cool.store.exception.ApiException;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.HyOutboundService;
|
||||
import com.cool.store.vo.HyOutboundVo;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/8/9 15:31
|
||||
* @version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/outbound/number")
|
||||
@Api(tags = "呼出号码管理")
|
||||
public class OutboundController {
|
||||
|
||||
@Autowired
|
||||
private HyOutboundService hyOutboundService;
|
||||
|
||||
@ApiOperation("已配置号码列表")
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<PageInfo<HyOutboundVo>> getOutboundNumberList(@RequestBody OutboundListDTO dto) {
|
||||
PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
|
||||
List<HyOutboundVo> result = hyOutboundService.getOutboundNumberList(dto);
|
||||
return ResponseResult.success(new PageInfo<>(result));
|
||||
}
|
||||
|
||||
@ApiOperation("新增号码")
|
||||
@PostMapping("/add")
|
||||
public ResponseResult addOutboundNumber(@RequestBody AddNumberDTO dto) throws ApiException {
|
||||
hyOutboundService.addOutboundNumber(dto);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("编辑号码")
|
||||
@PostMapping("/update")
|
||||
public ResponseResult updateOutboundNumber(@RequestBody UpdateNumberDTO dto) throws ApiException {
|
||||
hyOutboundService.updateOutboundNumber(dto);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("删除号码")
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult deleteOutboundNumber(@RequestBody DeleteNumberDTO dto) throws ApiException {
|
||||
hyOutboundService.deleteOutboundNumber(dto);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user