diff --git a/coolstore-partner-common/src/main/java/com/cool/store/enums/ErrorCodeEnum.java b/coolstore-partner-common/src/main/java/com/cool/store/enums/ErrorCodeEnum.java index 69ec9e182..a03c78579 100644 --- a/coolstore-partner-common/src/main/java/com/cool/store/enums/ErrorCodeEnum.java +++ b/coolstore-partner-common/src/main/java/com/cool/store/enums/ErrorCodeEnum.java @@ -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); ; diff --git a/coolstore-partner-dao/src/main/java/com/cool/store/mapper/HyOutboundMobileMapper.java b/coolstore-partner-dao/src/main/java/com/cool/store/mapper/HyOutboundMobileMapper.java new file mode 100644 index 000000000..d81c92346 --- /dev/null +++ b/coolstore-partner-dao/src/main/java/com/cool/store/mapper/HyOutboundMobileMapper.java @@ -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 selectByPrimarySelective(HyOutboundMobileDO hyOutboundMobileDO); + + int updateByPrimaryKeySelective(HyOutboundMobileDO record); + + int updateByPrimaryKey(HyOutboundMobileDO record); + + /** + * 获取呼出手机号列表 + * + * @param dto + * @param userId + * @return + */ + List getOutboundNumberList(@Param("dto") OutboundListDTO dto, @Param("userId") String userId); + +} \ No newline at end of file diff --git a/coolstore-partner-dao/src/main/resources/mapper/HyOutboundMobileMapper.xml b/coolstore-partner-dao/src/main/resources/mapper/HyOutboundMobileMapper.xml new file mode 100644 index 000000000..b05211b6a --- /dev/null +++ b/coolstore-partner-dao/src/main/resources/mapper/HyOutboundMobileMapper.xml @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + id, mobile, remark, create_user_id, update_user_id, deleted, create_time, update_time + + + + + + + delete from hy_outbound_mobile + where id = #{id} + + + 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 into hy_outbound_mobile + + + id, + + + mobile, + + + remark, + + + create_user_id, + + + update_user_id, + + + deleted, + + + create_time, + + + update_time, + + + + + #{id}, + + + #{mobile}, + + + #{remark}, + + + #{createUserId}, + + + #{updateUserId}, + + + #{deleted}, + + + #{createTime}, + + + #{updateTime}, + + + + + update hy_outbound_mobile + + + mobile = #{mobile}, + + + remark = #{remark}, + + + create_user_id = #{createUserId}, + + + update_user_id = #{updateUserId}, + + + deleted = #{deleted}, + + + create_time = #{createTime}, + + + update_time = #{updateTime}, + + + where id = #{id} + + + 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} + + + + + \ No newline at end of file diff --git a/coolstore-partner-model/src/main/java/com/cool/store/dto/outbound/AddNumberDTO.java b/coolstore-partner-model/src/main/java/com/cool/store/dto/outbound/AddNumberDTO.java new file mode 100644 index 000000000..da99c51fb --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/dto/outbound/AddNumberDTO.java @@ -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; + +} diff --git a/coolstore-partner-model/src/main/java/com/cool/store/dto/outbound/DeleteNumberDTO.java b/coolstore-partner-model/src/main/java/com/cool/store/dto/outbound/DeleteNumberDTO.java new file mode 100644 index 000000000..4518e687e --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/dto/outbound/DeleteNumberDTO.java @@ -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; + +} diff --git a/coolstore-partner-model/src/main/java/com/cool/store/dto/outbound/OutboundListDTO.java b/coolstore-partner-model/src/main/java/com/cool/store/dto/outbound/OutboundListDTO.java new file mode 100644 index 000000000..6038b337e --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/dto/outbound/OutboundListDTO.java @@ -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 { +} diff --git a/coolstore-partner-model/src/main/java/com/cool/store/dto/outbound/UpdateNumberDTO.java b/coolstore-partner-model/src/main/java/com/cool/store/dto/outbound/UpdateNumberDTO.java new file mode 100644 index 000000000..373466d3a --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/dto/outbound/UpdateNumberDTO.java @@ -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; + +} diff --git a/coolstore-partner-model/src/main/java/com/cool/store/entity/HyOutboundMobileDO.java b/coolstore-partner-model/src/main/java/com/cool/store/entity/HyOutboundMobileDO.java new file mode 100644 index 000000000..42f723700 --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/entity/HyOutboundMobileDO.java @@ -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; +} \ No newline at end of file diff --git a/coolstore-partner-model/src/main/java/com/cool/store/vo/HyOutboundVo.java b/coolstore-partner-model/src/main/java/com/cool/store/vo/HyOutboundVo.java new file mode 100644 index 000000000..261ff113d --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/vo/HyOutboundVo.java @@ -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; + +} diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/HyOutboundService.java b/coolstore-partner-service/src/main/java/com/cool/store/service/HyOutboundService.java new file mode 100644 index 000000000..ddd626081 --- /dev/null +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/HyOutboundService.java @@ -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 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); +} diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/HyOutboundServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/HyOutboundServiceImpl.java new file mode 100644 index 000000000..e35960e6a --- /dev/null +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/HyOutboundServiceImpl.java @@ -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 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 outboundMobileList = outboundMobileMapper.selectByPrimarySelective(hyOutboundMobileDO); + return outboundMobileList != null && outboundMobileList.size() != 0; + } + +} diff --git a/coolstore-partner-webb/src/main/java/com/cool/store/controller/OutboundController.java b/coolstore-partner-webb/src/main/java/com/cool/store/controller/OutboundController.java new file mode 100644 index 000000000..26a4232c7 --- /dev/null +++ b/coolstore-partner-webb/src/main/java/com/cool/store/controller/OutboundController.java @@ -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> getOutboundNumberList(@RequestBody OutboundListDTO dto) { + PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); + List 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(); + } + +}