diff --git a/smart-switch-service/src/main/java/com/ruoyi/common/constants/DictTypeConstants.java b/smart-switch-service/src/main/java/com/ruoyi/common/constants/DictTypeConstants.java index e10a9160..86384407 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/common/constants/DictTypeConstants.java +++ b/smart-switch-service/src/main/java/com/ruoyi/common/constants/DictTypeConstants.java @@ -19,4 +19,7 @@ public class DictTypeConstants { public static final String SUIT_FEE_MODE = "suit_fee_mode"; // 套餐收费类型 public static final String SUIT_FEE_TYPE = "suit_fee_type"; + // 客服类型 + public static final String CUSTOMER_SERVICE_TYPE = "customer_service_type"; + } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/domain/CustomerService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/domain/CustomerService.java new file mode 100644 index 00000000..e5c3431a --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/domain/CustomerService.java @@ -0,0 +1,57 @@ +package com.ruoyi.ss.customerService.domain; + +import com.ruoyi.common.constants.DictTypeConstants; +import com.ruoyi.common.core.domain.ValidGroup; +import com.ruoyi.common.utils.RegexpUtils; +import com.ruoyi.system.valid.DictValid; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; + +/** + * 客服对象 ss_customer_service + * + * @author ruoyi + * @date 2024-09-19 + */ +@Data +public class CustomerService extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + private Long id; + + @Excel(name = "名称") + @ApiModelProperty("名称") + @Size(max = 32, message = "名称长度不能超过32个字符") + @NotBlank(message = "名称不能为空", groups = {ValidGroup.Create.class}) + private String name; + + @Excel(name = "手机号") + @ApiModelProperty("手机号") + @Size(max = 11, message = "手机号长度不能超过11个字符") + @Pattern(regexp = RegexpUtils.MOBILE_PHONE_REGEXP, message = "手机号格式不正确") + private String mobile; + + @Excel(name = "类型", readConverterExp = "1=官方客服") + @ApiModelProperty("类型") + @DictValid(type = DictTypeConstants.CUSTOMER_SERVICE_TYPE, message = "非法的客服类型") + @NotBlank(message = "类型不能为空", groups = {ValidGroup.Create.class}) + private String type; + + @Excel(name = "微信号") + @ApiModelProperty("微信号") + @Size(max = 64, message = "微信号长度不能超过64个字符") + private String wx; + + @Excel(name = "排序") + @ApiModelProperty("排序") + private Integer sort; +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/domain/CustomerServiceQuery.java b/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/domain/CustomerServiceQuery.java new file mode 100644 index 00000000..708ff737 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/domain/CustomerServiceQuery.java @@ -0,0 +1,11 @@ +package com.ruoyi.ss.customerService.domain; + +import lombok.Data; + +/** + * @author wjh + * 2024/9/19 + */ +@Data +public class CustomerServiceQuery extends CustomerServiceVO { +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/domain/CustomerServiceVO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/domain/CustomerServiceVO.java new file mode 100644 index 00000000..83eee6b3 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/domain/CustomerServiceVO.java @@ -0,0 +1,11 @@ +package com.ruoyi.ss.customerService.domain; + +import lombok.Data; + +/** + * @author wjh + * 2024/9/19 + */ +@Data +public class CustomerServiceVO extends CustomerService { +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/mapper/CustomerServiceMapper.java b/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/mapper/CustomerServiceMapper.java new file mode 100644 index 00000000..5f870e55 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/mapper/CustomerServiceMapper.java @@ -0,0 +1,64 @@ +package com.ruoyi.ss.customerService.mapper; + +import java.util.List; +import com.ruoyi.ss.customerService.domain.CustomerService; +import com.ruoyi.ss.customerService.domain.CustomerServiceVO; +import com.ruoyi.ss.customerService.domain.CustomerServiceQuery; +import org.apache.ibatis.annotations.Param; + +/** + * 客服Mapper接口 + * + * @author ruoyi + * @date 2024-09-19 + */ +public interface CustomerServiceMapper +{ + /** + * 查询客服 + * + * @param id 客服主键 + * @return 客服 + */ + public CustomerServiceVO selectCustomerServiceById(Long id); + + /** + * 查询客服列表 + * + * @param query 客服 + * @return 客服集合 + */ + public List selectCustomerServiceList(@Param("query")CustomerServiceQuery query); + + /** + * 新增客服 + * + * @param customerService 客服 + * @return 结果 + */ + public int insertCustomerService(CustomerService customerService); + + /** + * 修改客服 + * + * @param customerService 客服 + * @return 结果 + */ + public int updateCustomerService(@Param("data") CustomerService customerService); + + /** + * 删除客服 + * + * @param id 客服主键 + * @return 结果 + */ + public int deleteCustomerServiceById(Long id); + + /** + * 批量删除客服 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteCustomerServiceByIds(Long[] ids); +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/mapper/CustomerServiceMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/mapper/CustomerServiceMapper.xml new file mode 100644 index 00000000..17d558ab --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/mapper/CustomerServiceMapper.xml @@ -0,0 +1,88 @@ + + + + + + + + select + scs.id, + scs.name, + scs.mobile, + scs.type, + scs.wx, + scs.create_time, + scs.sort + from ss_customer_service scs + + + + and scs.id = #{query.id} + and scs.`name` like concat('%', #{query.name}, '%') + and scs.mobile like concat('%', #{query.mobile}, '%') + and scs.type = #{query.type} + and scs.wx like concat('%', #{query.wx}, '%') + + + + + + + + insert into ss_customer_service + + name, + mobile, + type, + wx, + create_time, + sort, + + + #{name}, + #{mobile}, + #{type}, + #{wx}, + #{createTime}, + #{sort}, + + + + + update ss_customer_service + + + + where id = #{data.id} + + + + `name` = #{data.name}, + mobile = #{data.mobile}, + type = #{data.type}, + wx = #{data.wx}, + create_time = #{data.createTime}, + sort = #{data.sort}, + + + + delete from ss_customer_service where id = #{id} + + + + delete from ss_customer_service where id in + + #{id} + + + diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/service/CustomerServiceService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/service/CustomerServiceService.java new file mode 100644 index 00000000..a2a1da58 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/service/CustomerServiceService.java @@ -0,0 +1,63 @@ +package com.ruoyi.ss.customerService.service; + +import java.util.List; +import com.ruoyi.ss.customerService.domain.CustomerService; +import com.ruoyi.ss.customerService.domain.CustomerServiceVO; +import com.ruoyi.ss.customerService.domain.CustomerServiceQuery; + +/** + * 客服Service接口 + * + * @author ruoyi + * @date 2024-09-19 + */ +public interface CustomerServiceService +{ + /** + * 查询客服 + * + * @param id 客服主键 + * @return 客服 + */ + public CustomerServiceVO selectCustomerServiceById(Long id); + + /** + * 查询客服列表 + * + * @param customerService 客服 + * @return 客服集合 + */ + public List selectCustomerServiceList(CustomerServiceQuery customerService); + + /** + * 新增客服 + * + * @param customerService 客服 + * @return 结果 + */ + public int insertCustomerService(CustomerService customerService); + + /** + * 修改客服 + * + * @param customerService 客服 + * @return 结果 + */ + public int updateCustomerService(CustomerService customerService); + + /** + * 批量删除客服 + * + * @param ids 需要删除的客服主键集合 + * @return 结果 + */ + public int deleteCustomerServiceByIds(Long[] ids); + + /** + * 删除客服信息 + * + * @param id 客服主键 + * @return 结果 + */ + public int deleteCustomerServiceById(Long id); +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/service/impl/CustomerServiceServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/service/impl/CustomerServiceServiceImpl.java new file mode 100644 index 00000000..fb3ed23f --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/customerService/service/impl/CustomerServiceServiceImpl.java @@ -0,0 +1,98 @@ +package com.ruoyi.ss.customerService.service.impl; + +import java.util.List; + +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.ss.customerService.mapper.CustomerServiceMapper; +import com.ruoyi.ss.customerService.domain.CustomerService; +import com.ruoyi.ss.customerService.domain.CustomerServiceVO; +import com.ruoyi.ss.customerService.domain.CustomerServiceQuery; +import com.ruoyi.ss.customerService.service.CustomerServiceService; + +/** + * 客服Service业务层处理 + * + * @author ruoyi + * @date 2024-09-19 + */ +@Service +public class CustomerServiceServiceImpl implements CustomerServiceService +{ + @Autowired + private CustomerServiceMapper customerServiceMapper; + + /** + * 查询客服 + * + * @param id 客服主键 + * @return 客服 + */ + @Override + public CustomerServiceVO selectCustomerServiceById(Long id) + { + return customerServiceMapper.selectCustomerServiceById(id); + } + + /** + * 查询客服列表 + * + * @param customerService 客服 + * @return 客服 + */ + @Override + public List selectCustomerServiceList(CustomerServiceQuery customerService) + { + return customerServiceMapper.selectCustomerServiceList(customerService); + } + + /** + * 新增客服 + * + * @param customerService 客服 + * @return 结果 + */ + @Override + public int insertCustomerService(CustomerService customerService) + { + customerService.setCreateTime(DateUtils.getNowDate()); + return customerServiceMapper.insertCustomerService(customerService); + } + + /** + * 修改客服 + * + * @param customerService 客服 + * @return 结果 + */ + @Override + public int updateCustomerService(CustomerService customerService) + { + return customerServiceMapper.updateCustomerService(customerService); + } + + /** + * 批量删除客服 + * + * @param ids 需要删除的客服主键 + * @return 结果 + */ + @Override + public int deleteCustomerServiceByIds(Long[] ids) + { + return customerServiceMapper.deleteCustomerServiceByIds(ids); + } + + /** + * 删除客服信息 + * + * @param id 客服主键 + * @return 结果 + */ + @Override + public int deleteCustomerServiceById(Long id) + { + return customerServiceMapper.deleteCustomerServiceById(id); + } +} diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppCustomerServiceController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppCustomerServiceController.java new file mode 100644 index 00000000..76531906 --- /dev/null +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppCustomerServiceController.java @@ -0,0 +1,33 @@ +package com.ruoyi.web.controller.app; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.ss.customerService.domain.CustomerServiceQuery; +import com.ruoyi.ss.customerService.service.CustomerServiceService; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author wjh + * 2024/9/19 + */ +@RestController +@RequestMapping("/app/customerService") +public class AppCustomerServiceController extends BaseController { + + @Autowired + private CustomerServiceService customerServiceService; + + @ApiOperation("获取客服列表") + @GetMapping("/list") + public TableDataInfo list(CustomerServiceQuery query) { + startPage(); + startOrderBy(); + return getDataTable(customerServiceService.selectCustomerServiceList(query)); + } + +} diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/CustomerServiceController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/CustomerServiceController.java new file mode 100644 index 00000000..626d9d76 --- /dev/null +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/CustomerServiceController.java @@ -0,0 +1,110 @@ +package com.ruoyi.web.controller.ss; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.domain.ValidGroup; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.ss.customerService.domain.CustomerService; +import com.ruoyi.ss.customerService.domain.CustomerServiceVO; +import com.ruoyi.ss.customerService.domain.CustomerServiceQuery; +import com.ruoyi.ss.customerService.service.CustomerServiceService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 客服Controller + * + * @author ruoyi + * @date 2024-09-19 + */ +@RestController +@RequestMapping("/ss/customerService") +public class CustomerServiceController extends BaseController +{ + @Autowired + private CustomerServiceService customerServiceService; + + /** + * 查询客服列表 + */ + @PreAuthorize("@ss.hasPermi('ss:customerService:list')") + @GetMapping("/list") + public TableDataInfo list(CustomerServiceQuery query) + { + startPage(); + startOrderBy(); + List list = customerServiceService.selectCustomerServiceList(query); + return getDataTable(list); + } + + /** + * 导出客服列表 + */ + @PreAuthorize("@ss.hasPermi('ss:customerService:export')") + @Log(title = "客服", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, CustomerServiceQuery query) + { + List list = customerServiceService.selectCustomerServiceList(query); + ExcelUtil util = new ExcelUtil(CustomerServiceVO.class); + util.exportExcel(response, list, "客服数据"); + } + + /** + * 获取客服详细信息 + */ + @PreAuthorize("@ss.hasPermi('ss:customerService:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(customerServiceService.selectCustomerServiceById(id)); + } + + /** + * 新增客服 + */ + @PreAuthorize("@ss.hasPermi('ss:customerService:add')") + @Log(title = "客服", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody @Validated(ValidGroup.Create.class) CustomerService customerService) + { + return toAjax(customerServiceService.insertCustomerService(customerService)); + } + + /** + * 修改客服 + */ + @PreAuthorize("@ss.hasPermi('ss:customerService:edit')") + @Log(title = "客服", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody @Validated(ValidGroup.Update.class) CustomerService customerService) + { + return toAjax(customerServiceService.updateCustomerService(customerService)); + } + + /** + * 删除客服 + */ + @PreAuthorize("@ss.hasPermi('ss:customerService:remove')") + @Log(title = "客服", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(customerServiceService.deleteCustomerServiceByIds(ids)); + } +}