feat(basic): 客户管理模块重构及数据库配置更新
- 更新数据库连接配置为本地环境设置
- 将模块从 staff 切换为 basic 模块
- 在 Customer 实体类中新增使用用户和使用状态字段
- 添加 CustomerDto 和 CustomerPrivateDto 数据传输对象
- 引入 CustomerPrivate 和 CustomerPrivatePool 实体类
- 创建 CustomerPrivateController 控制器实现增删改查功能
- 实现 CustomerPrivateMapper 数据访问层接口
- 更新 CustomerFollowUp 表关联字段从 customerId 到 customerPrivatePoolId
- 修改 CustomerReturnVisit 表关联字段为 customerPrivatePoolId
- 重构 CustomerServiceImpl 中的列表查询逻辑
- 添加 CustomerMapper 的 listPage 分页查询方法
- 创建 CustomerMapper.xml 映射文件实现复杂查询逻辑
- 更新 InvoiceLedgerMapper.xml 的分组查询条件
- 修改回访提醒任务中的客户ID参数传递
- 添加销售台账中客户私海池的相关处理逻辑
- 更新忽略表配置增加产品相关表单
| | |
| | | // æ¼ç¤ºä¾åï¼æ§è¡ main æ¹æ³æ§å¶å°è¾å
¥æ¨¡å表åå车èªå¨çæå¯¹åºé¡¹ç®ç®å½ä¸ |
| | | public class CodeGenerator { |
| | | |
| | | public static String database_url = "jdbc:mysql://1.15.17.182:9999/product-inventory-management-new"; |
| | | public static String database_url = "jdbc:mysql://localhost:3300/product-inventory-management-new"; |
| | | public static String database_username = "root"; |
| | | public static String database_password= "xd@123456.."; |
| | | public static String database_password= "root"; |
| | | public static String author = "è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸"; |
| | | public static String model = "staff"; // 模å |
| | | public static String model = "basic"; // 模å |
| | | public static String setParent = "com.ruoyi."+ model; // å
è·¯å¾ |
| | | public static String tablePrefix = ""; // è®¾ç½®è¿æ»¤è¡¨åç¼ |
| | | public static void main(String[] args) { |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.CustomerDto; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.service.ICustomerService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | * æ¥è¯¢å®¢æ·æ¡£æ¡å表 |
| | | */ |
| | | @GetMapping("/list") |
| | | public IPage<Customer> list(Page<Customer> page, Customer customer) { |
| | | return customerService.selectCustomerList(page, customer); |
| | | public R list(Page<CustomerDto> page, CustomerDto customer) { |
| | | IPage<CustomerDto> customerDtoIPage = customerService.selectCustomerList(page, customer); |
| | | return R.ok(customerDtoIPage); |
| | | } |
| | | |
| | | /** |
| | |
| | | public List customerList(Customer customer) { |
| | | return customerService.customerList(customer); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | @ApiOperation("æ¥è¯¢å®¢æ·è·è¿å表") |
| | | public IPage<CustomerFollowUp> list(Page<CustomerFollowUp> page, CustomerFollowUp customerFollowUp) { |
| | | LambdaQueryWrapper<CustomerFollowUp> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(customerFollowUp.getCustomerId() != null, CustomerFollowUp::getCustomerId, customerFollowUp.getCustomerId()) |
| | | queryWrapper.eq(customerFollowUp.getCustomerPrivatePoolId() != null, CustomerFollowUp::getCustomerPrivatePoolId, customerFollowUp.getCustomerPrivatePoolId()) |
| | | .like(customerFollowUp.getFollowerUserName() != null, CustomerFollowUp::getFollowerUserName, customerFollowUp.getFollowerUserName()) |
| | | .orderByDesc(CustomerFollowUp::getFollowUpTime); |
| | | return customerFollowUpService.page(page, queryWrapper); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.CustomerDto; |
| | | import com.ruoyi.basic.dto.CustomerPrivateDto; |
| | | import com.ruoyi.basic.dto.CustomerPrivatePoolDto; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.pojo.CustomerPrivate; |
| | | import com.ruoyi.basic.service.CustomerPrivatePoolService; |
| | | import com.ruoyi.basic.service.CustomerPrivateService; |
| | | import com.ruoyi.basic.service.ICustomerService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | import static com.ruoyi.framework.web.domain.AjaxResult.success; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¢æ·æ¡£æ¡ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-17 10:39:09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/customerPrivate") |
| | | public class CustomerPrivateController { |
| | | @Autowired |
| | | private CustomerPrivateService customerPrivateService; |
| | | |
| | | @Autowired |
| | | private CustomerPrivatePoolService customerPrivatePoolService; |
| | | |
| | | |
| | | @PostMapping("/add") |
| | | public R add(@RequestBody CustomerPrivateDto customerPrivateDto) { |
| | | return R.ok(customerPrivateService.add(customerPrivateDto)); |
| | | } |
| | | |
| | | |
| | | @DeleteMapping("/delete") |
| | | public R delete(@RequestBody List<Long> ids) { |
| | | return R.ok(customerPrivateService.delete(ids)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导å
¥å®¢æ·æ¡£æ¡ |
| | | */ |
| | | @Log(title = "å®¢æ·æ¡£æ¡", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importData") |
| | | public R importData(MultipartFile file) throws Exception { |
| | | |
| | | return customerPrivateService.importData(file); |
| | | } |
| | | |
| | | /** |
| | | * 导åºå®¢æ·æ¡£æ¡å表 |
| | | */ |
| | | @Log(title = "å®¢æ·æ¡£æ¡", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, CustomerPrivatePoolDto customerPrivatePoolDto) { |
| | | List<Long> ids = customerPrivatePoolDto.getIds(); |
| | | List<CustomerPrivatePoolDto> list; |
| | | if (ids != null && ids.size() > 0) { |
| | | list = customerPrivatePoolService.selectCustomerPrivatePoolDtoListByIds(ids); |
| | | } else { |
| | | list = customerPrivatePoolService.selectCustomerPrivatePoolDtoLists(customerPrivatePoolDto); |
| | | } |
| | | ExcelUtil<CustomerPrivatePoolDto> util = new ExcelUtil<CustomerPrivatePoolDto>(CustomerPrivatePoolDto.class); |
| | | util.exportExcel(response, list, "å®¢æ·æ¡£æ¡æ°æ®"); |
| | | } |
| | | |
| | | @PostMapping("/downloadTemplate") |
| | | @Log(title = "å®¢æ·æ¡£æ¡-ä¸è½½æ¨¡æ¿", businessType = BusinessType.EXPORT) |
| | | public void downloadTemplate(HttpServletResponse response) { |
| | | ExcelUtil<CustomerPrivatePoolDto> util = new ExcelUtil<CustomerPrivatePoolDto>(CustomerPrivatePoolDto.class); |
| | | util.importTemplateExcel(response, "å®¢æ·æ¡£æ¡æ¨¡æ¿"); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.CustomerPrivatePoolDto; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.pojo.CustomerPrivatePool; |
| | | import com.ruoyi.basic.service.CustomerPrivatePoolService; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * å端æ§å¶å¨ 客æ·ï¼ç§æµ·ï¼ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-16 04:43:00 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "客æ·ï¼ç§æµ·ï¼") |
| | | @RequestMapping("/customerPrivatePool") |
| | | public class CustomerPrivatePoolController { |
| | | |
| | | @Autowired |
| | | private CustomerPrivatePoolService customerPrivatePoolService; |
| | | |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("客æ·ï¼ç§æµ·ï¼å表") |
| | | public R listPage(CustomerPrivatePoolDto customerPrivatePoolDto, Page<CustomerPrivatePoolDto> page){ |
| | | //æ¥è¯¢å½åç¨æ·ç客æ·ä¿¡æ¯ |
| | | customerPrivatePoolDto.setBoundId(SecurityUtils.getUserId()); |
| | | IPage<CustomerPrivatePoolDto> listPage = customerPrivatePoolService.listPage(page, customerPrivatePoolDto); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("åé
客æ·ï¼ç§æµ·ï¼") |
| | | public R add(@RequestBody CustomerPrivatePoolDto customerPrivatePool){ |
| | | boolean result = customerPrivatePoolService.add(customerPrivatePool); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | public R update(@RequestBody CustomerPrivatePoolDto customerPrivatePoolDto) { |
| | | return R.ok(customerPrivatePoolService.updateCustomerPrivatePoolDto(customerPrivatePoolDto)); |
| | | } |
| | | |
| | | |
| | | @DeleteMapping("/delete/{id}") |
| | | @ApiOperation("å é¤å®¢æ·ï¼ç§æµ·ï¼") |
| | | public R delete(@PathVariable Long id){ |
| | | boolean result = customerPrivatePoolService.deleteCustomerPrivatePool(id); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PostMapping("/together") |
| | | @ApiOperation("å
񄧮") |
| | | public R together( @RequestBody CustomerPrivatePoolDto customerPrivatePool){ |
| | | boolean result = customerPrivatePoolService.together(customerPrivatePool); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/info/{id}") |
| | | @ApiOperation("详æ
") |
| | | public R getInfo(@PathVariable Long id){ |
| | | CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolService.getInfo(id); |
| | | return R.ok(customerPrivatePool); |
| | | } |
| | | |
| | | @GetMapping("/getbyId/{id}") |
| | | @ApiOperation("详æ
") |
| | | public R getbyId(@PathVariable Long id){ |
| | | CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolService.getbyId(id); |
| | | return R.ok(customerPrivatePool); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | private List<CustomerFollowUpDto> followUpList; |
| | | |
| | | private String usageUserName; |
| | | |
| | | private String togetherUserNames; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.dto; |
| | | |
| | | import com.ruoyi.basic.pojo.CustomerPrivate; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class CustomerPrivateDto extends CustomerPrivate { |
| | | |
| | | private List<CustomerFollowUpDto> followUpList; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.basic.pojo.CustomerFollowUp; |
| | | import com.ruoyi.basic.pojo.CustomerPrivatePool; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class CustomerPrivatePoolDto extends CustomerPrivatePool { |
| | | |
| | | /** |
| | | * 客æ·åç§° |
| | | */ |
| | | @Excel(name = "客æ·åç§°") |
| | | private String customerName; |
| | | /** 客æ·åç±»ï¼é¶å®å®¢æ·ï¼è¿éåå®¢æ· */ |
| | | |
| | | @ApiModelProperty(value = "客æ·è¦id") |
| | | private Long customerId; |
| | | |
| | | /** |
| | | * è·è¿ç¨åº¦ |
| | | */ |
| | | // @Excel(name = "è·è¿ç¨åº¦") |
| | | @TableField(exist = false) |
| | | private String followUpLevel; |
| | | |
| | | /** |
| | | * è·è¿æ¶é´ |
| | | */ |
| | | // @Excel(name = "è·è¿æ¶é´" , width = 30, dateFormat = "yyyy-MM-dd") |
| | | @TableField(exist = false) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date followUpTime; |
| | | |
| | | @Excel(name = "客æ·åç±»") |
| | | private String customerType; |
| | | |
| | | |
| | | private String addressPhone; |
| | | /** |
| | | * 纳ç¨äººè¯å«å· |
| | | */ |
| | | @Excel(name = "纳ç¨äººè¯å«å·") |
| | | private String taxpayerIdentificationNumber; |
| | | |
| | | /** |
| | | * å
¬å¸å°å |
| | | */ |
| | | @Excel(name = "å
¬å¸å°å") |
| | | private String companyAddress; |
| | | |
| | | /** |
| | | * å
¬å¸çµè¯ |
| | | */ |
| | | @Excel(name = "å
¬å¸çµè¯") |
| | | private String companyPhone; |
| | | |
| | | /** |
| | | * è系人 |
| | | */ |
| | | @Excel(name = "è系人") |
| | | private String contactPerson; |
| | | |
| | | /** |
| | | * èç³»çµè¯ |
| | | */ |
| | | @Excel(name = "èç³»çµè¯",cellType = Excel.ColumnType.STRING) |
| | | private String contactPhone; |
| | | |
| | | /** |
| | | * ç»´æ¤äºº |
| | | */ |
| | | @Excel(name = "ç»´æ¤äºº") |
| | | private String maintainer; |
| | | |
| | | /** |
| | | * ç»´æ¤æ¶é´ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "ç»´æ¤æ¶é´" , width = 30, dateFormat = "yyyy-MM-dd") |
| | | private Date maintenanceTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @ApiModelProperty(value = "é¶è¡åºæ¬æ·") |
| | | @Excel(name = "é¶è¡åºæ¬æ·") |
| | | private String basicBankAccount; |
| | | |
| | | @ApiModelProperty(value = "é¶è¡è´¦å·") |
| | | @Excel(name = "é¶è¡è´¦å·") |
| | | private String bankAccount; |
| | | |
| | | @ApiModelProperty(value = "弿·è¡å·") |
| | | @Excel(name = "弿·è¡å·") |
| | | private String bankCode; |
| | | @ApiModelProperty(value = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | |
| | | @ApiModelProperty(value = "è·è¿è®°å½") |
| | | private List<CustomerFollowUpDto> followUpList; |
| | | |
| | | @ApiModelProperty(value = "ç»å®äººids") |
| | | private List< Long> boundIds; |
| | | |
| | | @Excel(isExport = false) |
| | | private List<Long> ids; |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.basic.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.CustomerDto; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @author ruoyi |
| | | * @date 2025-05-07 |
| | | */ |
| | | @Mapper |
| | | public interface CustomerMapper extends BaseMapper<Customer> |
| | | { |
| | | /** |
| | |
| | | * @return ç»æ |
| | | */ |
| | | int deleteCustomerByIds(Long[] ids); |
| | | |
| | | IPage<CustomerDto> listPage(Page<CustomerDto> page, @Param("c") CustomerDto customer); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.mapper; |
| | | |
| | | import com.ruoyi.basic.pojo.CustomerPrivate; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¢æ·æ¡£æ¡ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-17 10:39:09 |
| | | */ |
| | | @Mapper |
| | | public interface CustomerPrivateMapper extends BaseMapper<CustomerPrivate> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.basic.dto.CustomerPrivatePoolDto; |
| | | import com.ruoyi.basic.pojo.CustomerPrivatePool; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-16 04:43:00 |
| | | */ |
| | | @Mapper |
| | | public interface CustomerPrivatePoolMapper extends BaseMapper<CustomerPrivatePool> { |
| | | |
| | | IPage<CustomerPrivatePoolDto> listPage(IPage<CustomerPrivatePoolDto> page, @Param("c") CustomerPrivatePoolDto customerPrivatePoolDto); |
| | | |
| | | CustomerPrivatePoolDto selectInfo(Long id); |
| | | |
| | | List<CustomerPrivatePoolDto> selectInfos(); |
| | | |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | |
| | | /** |
| | | * å®¢æ·æ¡£æ¡å¯¹è±¡ customer |
| | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @ApiModelProperty(value = "使ç¨ç¨æ·") |
| | | private Long usageUser; |
| | | @ApiModelProperty(value = "使ç¨ç¶æ") |
| | | private Long usageStatus; |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | |
| | | private Integer id; |
| | | |
| | | /** |
| | | * å
³èç客æ·ID |
| | | * å
³èçç§æµ·id |
| | | */ |
| | | private Integer customerId; |
| | | private Long customerPrivatePoolId; |
| | | |
| | | /** |
| | | * è·è¿æ¹å¼ |
| | |
| | | * è·è¿æ¶é´ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime followUpTime; |
| | | |
| | | /** |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDate; |
| | | import java.util.Date; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¢æ·æ¡£æ¡ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-17 10:39:09 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("customer_private") |
| | | @ApiModel(value = "CustomerPrivate对象", description = "å®¢æ·æ¡£æ¡") |
| | | public class CustomerPrivate implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("客æ·åç§°") |
| | | @Excel(name = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @ApiModelProperty("纳ç¨äººè¯å«å·") |
| | | @Excel(name = "纳ç¨äººè¯å«å·") |
| | | private String taxpayerIdentificationNumber; |
| | | |
| | | @ApiModelProperty("å
¬å¸å°å") |
| | | @Excel(name = "å
¬å¸å°å") |
| | | private String companyAddress; |
| | | |
| | | @ApiModelProperty("å
¬å¸çµè¯") |
| | | @Excel(name = "å
¬å¸çµè¯") |
| | | private String companyPhone; |
| | | |
| | | @ApiModelProperty("è系人") |
| | | @Excel(name = "è系人") |
| | | private String contactPerson; |
| | | |
| | | @ApiModelProperty("èç³»çµè¯") |
| | | @Excel(name = "èç³»çµè¯", cellType = Excel.ColumnType.STRING) |
| | | private String contactPhone; |
| | | |
| | | @ApiModelProperty("ç»´æ¤äºº") |
| | | @Excel(name = "ç»´æ¤äºº") |
| | | private String maintainer; |
| | | |
| | | @ApiModelProperty("ç»´æ¤æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "ç»´æ¤æ¶é´", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private Date maintenanceTime; |
| | | |
| | | @ApiModelProperty("ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @ApiModelProperty("é¶è¡åºæ¬æ·") |
| | | @Excel(name = "é¶è¡åºæ¬æ·") |
| | | private String basicBankAccount; |
| | | |
| | | @ApiModelProperty("é¶è¡è´¦å·") |
| | | @Excel(name = "é¶è¡è´¦å·") |
| | | private String bankAccount; |
| | | |
| | | @ApiModelProperty("弿·è¡å·") |
| | | @Excel(name = "弿·è¡å·") |
| | | private String bankCode; |
| | | |
| | | @ApiModelProperty("客æ·åç±»ï¼é¶å®å®¢æ·ï¼è¿éå客æ·") |
| | | @Excel(name = "客æ·åç±»") |
| | | private String customerType; |
| | | |
| | | @ApiModelProperty("å建人ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | @ApiModelProperty("é¨é¨ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | |
| | | @ApiModelProperty("è·è¿ç¨åº¦") |
| | | @TableField(exist = false) |
| | | private String followUpLevel; |
| | | |
| | | @ApiModelProperty("è·è¿æ¶é´") |
| | | @TableField(exist = false) |
| | | private Date followUpTime; |
| | | |
| | | |
| | | @TableField(exist = false) |
| | | private Long[] ids; |
| | | |
| | | @TableField(exist = false) |
| | | private String addressPhone; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-16 04:43:00 |
| | | */ |
| | | @Data |
| | | @TableName("customer_private_pool") |
| | | @ApiModel(value = "CustomerPrivatePool对象", description = "") |
| | | public class CustomerPrivatePool implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty("主é®id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("客æ·id") |
| | | private Long customerId; |
| | | |
| | | @ApiModelProperty("ç»å®äººid") |
| | | private Long boundId; |
| | | |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty("æ´æ°äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("ç±»ååºåå
¬æµ·å®¢æ·åç§æµ·å®¢æ· é»è®¤æ¯ç§æµ·å®¢æ·0 å
¬æµ·1") |
| | | private Long type; |
| | | |
| | | @ApiModelProperty("é¨é¨id") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @ApiModelProperty("å 餿 è¯ é»è®¤0 1å·²ç»å é¤") |
| | | private Integer DeleteFlag; |
| | | } |
| | |
| | | /** |
| | | * å
³è客æ·ID |
| | | */ |
| | | private Integer customerId; |
| | | private Integer customerPrivatePoolId; |
| | | |
| | | /** |
| | | * æéå¼å
³ (0:å
³é, 1:å¼å¯) |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.CustomerPrivatePoolDto; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.pojo.CustomerPrivatePool; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-16 04:43:00 |
| | | */ |
| | | public interface CustomerPrivatePoolService extends IService<CustomerPrivatePool> { |
| | | |
| | | IPage<CustomerPrivatePoolDto> listPage(Page<CustomerPrivatePoolDto> page, CustomerPrivatePoolDto customerPrivatePoolDto); |
| | | |
| | | boolean deleteCustomerPrivatePool(Long id); |
| | | |
| | | boolean together(CustomerPrivatePoolDto customerPrivatePool); |
| | | |
| | | boolean add(CustomerPrivatePoolDto customerPrivatePool); |
| | | |
| | | CustomerPrivatePoolDto getInfo(Long id); |
| | | |
| | | Boolean updateCustomerPrivatePoolDto(CustomerPrivatePoolDto customerPrivatePoolDto); |
| | | |
| | | CustomerPrivatePoolDto getbyId(Long id); |
| | | |
| | | List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoListByIds(List<Long> ids); |
| | | |
| | | List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoLists(CustomerPrivatePoolDto customerPrivatePoolDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.CustomerPrivateDto; |
| | | import com.ruoyi.basic.dto.CustomerPrivatePoolDto; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.pojo.CustomerPrivate; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¢æ·æ¡£æ¡ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-17 10:39:09 |
| | | */ |
| | | public interface CustomerPrivateService extends IService<CustomerPrivate> { |
| | | |
| | | |
| | | Boolean add(CustomerPrivateDto customerPrivateDto); |
| | | |
| | | |
| | | Integer delete(List<Long> id); |
| | | |
| | | R importData(MultipartFile file); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.basic.dto.CustomerDto; |
| | | import com.ruoyi.basic.dto.CustomerPrivatePoolDto; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | * @param id å®¢æ·æ¡£æ¡ä¸»é® |
| | | * @return 客æ·è¯¦æ
DTO |
| | | */ |
| | | CustomerDto selectCustomerDetailById(Long id); |
| | | Customer selectCustomerDetailById(Long id); |
| | | |
| | | /** |
| | | * æ¥è¯¢å®¢æ·æ¡£æ¡å表 |
| | |
| | | * @param customer å®¢æ·æ¡£æ¡ |
| | | * @return å®¢æ·æ¡£æ¡éå |
| | | */ |
| | | IPage<Customer> selectCustomerList(Page<Customer> page, Customer customer); |
| | | |
| | | /** |
| | | * æ°å¢å®¢æ·æ¡£æ¡ |
| | |
| | | List<Customer> selectCustomerLists(Customer customer); |
| | | |
| | | AjaxResult importData(MultipartFile file); |
| | | |
| | | IPage<CustomerDto> selectCustomerList(Page<CustomerDto> page, CustomerDto customer); |
| | | } |
| | |
| | | } |
| | | |
| | | List<CustomerFollowUp> followUps = list(new LambdaQueryWrapper<CustomerFollowUp>() |
| | | .eq(CustomerFollowUp::getCustomerId, customerId)); |
| | | .eq(CustomerFollowUp::getCustomerPrivatePoolId, customerId)); |
| | | |
| | | if (followUps != null && !followUps.isEmpty()) { |
| | | for (CustomerFollowUp followUp : followUps) { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.CustomerDto; |
| | | import com.ruoyi.basic.dto.CustomerFollowUpDto; |
| | | import com.ruoyi.basic.dto.CustomerPrivatePoolDto; |
| | | import com.ruoyi.basic.mapper.CustomerPrivateMapper; |
| | | import com.ruoyi.basic.pojo.*; |
| | | import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper; |
| | | import com.ruoyi.basic.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.time.ZoneId; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-16 04:43:00 |
| | | */ |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class CustomerPrivatePoolServiceImpl extends ServiceImpl<CustomerPrivatePoolMapper, CustomerPrivatePool> implements CustomerPrivatePoolService { |
| | | |
| | | @Autowired |
| | | private CustomerPrivatePoolMapper customerPrivatePoolMapper; |
| | | |
| | | @Autowired |
| | | private CustomerFollowUpService customerFollowUpService; |
| | | |
| | | @Autowired |
| | | private CustomerReturnVisitService customerReturnVisitService; |
| | | |
| | | @Autowired |
| | | private ICustomerService customerService; |
| | | |
| | | @Autowired |
| | | private CustomerFollowUpFileService customerFollowUpFileService; |
| | | @Autowired |
| | | private CustomerPrivateMapper customerPrivateMapper; |
| | | |
| | | |
| | | @Override |
| | | public IPage<CustomerPrivatePoolDto> listPage(Page<CustomerPrivatePoolDto> page, CustomerPrivatePoolDto customerPrivatePoolDto) { |
| | | IPage<CustomerPrivatePoolDto> customerPrivatePoolDtoIPage = customerPrivatePoolMapper.listPage(page, customerPrivatePoolDto); |
| | | List<Long> customerIds = customerPrivatePoolDtoIPage.getRecords().stream() |
| | | .map(CustomerPrivatePoolDto::getId ) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (!org.springframework.util.CollectionUtils.isEmpty(customerIds)) { |
| | | Map<Long, CustomerFollowUp> latestFollowUpMap = getLatestFollowUpMap(customerIds); |
| | | |
| | | customerPrivatePoolDtoIPage.getRecords().forEach(c -> { |
| | | String address = StringUtils.defaultString(c.getCompanyAddress(), ""); |
| | | String phone = StringUtils.defaultString(c.getCompanyPhone(), ""); |
| | | c.setAddressPhone(address + "(" + phone + ")"); |
| | | |
| | | CustomerFollowUp followUp = latestFollowUpMap.get(c.getId()); |
| | | if (followUp != null) { |
| | | c.setFollowUpLevel(followUp.getFollowUpLevel()); |
| | | c.setFollowUpTime(Date.from( |
| | | followUp.getFollowUpTime().atZone(ZoneId.systemDefault()).toInstant() |
| | | )); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | return customerPrivatePoolDtoIPage; |
| | | } |
| | | |
| | | |
| | | private Map<Long, CustomerFollowUp> getLatestFollowUpMap(List<Long> customerIds) { |
| | | List<CustomerFollowUp> followUps = customerFollowUpService.list( |
| | | new LambdaQueryWrapper<CustomerFollowUp>() |
| | | .in(CustomerFollowUp::getCustomerPrivatePoolId, customerIds) |
| | | .orderByDesc(CustomerFollowUp::getFollowUpTime) |
| | | ); |
| | | |
| | | return followUps.stream() |
| | | .collect(Collectors.toMap( |
| | | CustomerFollowUp::getCustomerPrivatePoolId, |
| | | followUp -> followUp, |
| | | (existing, replacement) -> existing |
| | | )); |
| | | } |
| | | |
| | | @Override |
| | | public boolean deleteCustomerPrivatePool(Long id) { |
| | | List<CustomerPrivatePool> list = this.list(new QueryWrapper<CustomerPrivatePool>().lambda().eq(CustomerPrivatePool::getCustomerId, id)); |
| | | |
| | | for (CustomerPrivatePool customerPrivatePool : list) { |
| | | customerFollowUpService.remove(new QueryWrapper<CustomerFollowUp>().lambda().eq(CustomerFollowUp::getCustomerPrivatePoolId, customerPrivatePool.getId())); |
| | | customerReturnVisitService.remove(new QueryWrapper<CustomerReturnVisit>().lambda().eq(CustomerReturnVisit::getCustomerPrivatePoolId, customerPrivatePool.getId())); |
| | | } |
| | | Customer byId = customerService.getById(id); |
| | | byId.setUsageStatus(0L); |
| | | byId.setUsageUser(0L); |
| | | customerService.updateById(byId); |
| | | list.stream().forEach(customerPrivatePool -> { |
| | | customerPrivatePool.setDeleteFlag(1); |
| | | customerPrivatePoolMapper.updateById(customerPrivatePool); |
| | | }); |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean together(CustomerPrivatePoolDto customerPrivatePoolDto) { |
| | | List<CustomerPrivatePool> existingPools = this.list(new QueryWrapper<CustomerPrivatePool>().lambda().eq(CustomerPrivatePool::getCustomerId, customerPrivatePoolDto.getCustomerId())); |
| | | |
| | | List<Long> existingBoundIds = existingPools.stream() |
| | | .map(CustomerPrivatePool::getBoundId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | List<Long> newBoundIds = customerPrivatePoolDto.getBoundIds().stream() |
| | | .filter(boundId -> !existingBoundIds.contains(boundId)) |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (CollectionUtils.isEmpty(newBoundIds)) { |
| | | return true; |
| | | } |
| | | for (Long id : customerPrivatePoolDto.getBoundIds()) { |
| | | CustomerPrivatePool customerPrivatePool = new CustomerPrivatePool(); |
| | | customerPrivatePool.setCustomerId(customerPrivatePoolDto.getCustomerId()); |
| | | customerPrivatePool.setBoundId(id); |
| | | customerPrivatePool.setType(1L); |
| | | this.save(customerPrivatePool); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean add(CustomerPrivatePoolDto customerPrivatePool) { |
| | | customerPrivatePool.setType(1L); |
| | | this.save(customerPrivatePool); |
| | | Customer byId = customerService.getById(customerPrivatePool.getCustomerId()); |
| | | if (byId != null) { |
| | | byId.setUsageStatus(1L); |
| | | byId.setUsageUser(customerPrivatePool.getBoundId()); |
| | | return customerService.updateById(byId); |
| | | } |
| | | throw new RuntimeException("客æ·ä¸åå¨"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public CustomerPrivatePoolDto getInfo(Long id) { |
| | | CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolMapper.selectInfo(id); |
| | | if (customerPrivatePool == null) { |
| | | return null; |
| | | } |
| | | |
| | | // æ¥è¯¢è·è¿è®°å½ |
| | | List<CustomerFollowUp> followUpList = customerFollowUpService.list( |
| | | new LambdaQueryWrapper<CustomerFollowUp>() |
| | | .eq(CustomerFollowUp::getCustomerPrivatePoolId, id) |
| | | .orderByDesc(CustomerFollowUp::getFollowUpTime) |
| | | ); |
| | | if (!CollectionUtils.isEmpty(followUpList)) { |
| | | List<CustomerFollowUpDto> followUpDtoList = followUpList.stream().map(followUp -> { |
| | | CustomerFollowUpDto followUpDto = new CustomerFollowUpDto(); |
| | | BeanUtils.copyProperties(followUp, followUpDto); |
| | | |
| | | // æ¥è¯¢éä»¶ |
| | | List<CustomerFollowUpFile> fileList = customerFollowUpFileService.list( |
| | | new LambdaQueryWrapper<CustomerFollowUpFile>() |
| | | .eq(CustomerFollowUpFile::getFollowUpId, followUp.getId()) |
| | | ); |
| | | followUpDto.setFileList(fileList); |
| | | |
| | | return followUpDto; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | customerPrivatePool.setFollowUpList(followUpDtoList); |
| | | } |
| | | |
| | | return customerPrivatePool; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean updateCustomerPrivatePoolDto(CustomerPrivatePoolDto customerPrivatePoolDto) { |
| | | if (customerPrivatePoolDto.getType() == 0L) { |
| | | CustomerPrivate byId = customerPrivateMapper.selectById(customerPrivatePoolDto.getCustomerId()); |
| | | BeanUtils.copyProperties(customerPrivatePoolDto, byId); |
| | | byId.setId(customerPrivatePoolDto.getCustomerId()); |
| | | customerPrivateMapper.updateById(byId); |
| | | } else if (customerPrivatePoolDto.getType() == 1L) { |
| | | Customer customer = customerService.getById(customerPrivatePoolDto.getCustomerId()); |
| | | BeanUtils.copyProperties(customerPrivatePoolDto, customer); |
| | | customer.setId(customerPrivatePoolDto.getCustomerId()); |
| | | customerService.updateById(customer); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public CustomerPrivatePoolDto getbyId(Long id) { |
| | | CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolMapper.selectInfo(id); |
| | | return customerPrivatePool; |
| | | } |
| | | |
| | | @Override |
| | | public List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoListByIds(List<Long> ids) { |
| | | ArrayList<CustomerPrivatePoolDto> customerPrivatePoolDtos = new ArrayList<>(); |
| | | for (Long id : ids) { |
| | | CustomerPrivatePoolDto customerPrivatePoolDto = customerPrivatePoolMapper.selectInfo(id); |
| | | customerPrivatePoolDtos.add(customerPrivatePoolDto); |
| | | } |
| | | return customerPrivatePoolDtos; |
| | | } |
| | | |
| | | @Override |
| | | public List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoLists(CustomerPrivatePoolDto customerPrivatePoolDto) { |
| | | |
| | | return customerPrivatePoolMapper.selectInfos(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.CustomerPrivateDto; |
| | | import com.ruoyi.basic.dto.CustomerPrivatePoolDto; |
| | | import com.ruoyi.basic.mapper.CustomerMapper; |
| | | import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper; |
| | | import com.ruoyi.basic.pojo.*; |
| | | import com.ruoyi.basic.mapper.CustomerPrivateMapper; |
| | | import com.ruoyi.basic.service.CustomerFollowUpService; |
| | | import com.ruoyi.basic.service.CustomerPrivateService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.service.CustomerReturnVisitService; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®¢æ·æ¡£æ¡ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-04-17 10:39:09 |
| | | */ |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class CustomerPrivateServiceImpl extends ServiceImpl<CustomerPrivateMapper, CustomerPrivate> implements CustomerPrivateService { |
| | | |
| | | |
| | | @Autowired |
| | | private CustomerPrivatePoolMapper customerPrivatePoolMapper; |
| | | |
| | | @Autowired |
| | | private CustomerFollowUpService customerFollowUpService; |
| | | |
| | | @Autowired |
| | | private CustomerReturnVisitService customerReturnVisitService; |
| | | @Autowired |
| | | private SalesLedgerMapper salesLedgerMapper; |
| | | |
| | | |
| | | @Override |
| | | public Boolean add(CustomerPrivateDto customerPrivateDto) { |
| | | //æ°å¢ç§æµ· å®¢æ· |
| | | this.save(customerPrivateDto); |
| | | //æ°å¢ç§æµ·è®°å½ |
| | | CustomerPrivatePool customerPrivatePool = new CustomerPrivatePool(); |
| | | customerPrivatePool.setCustomerId(customerPrivateDto.getId()); |
| | | customerPrivatePool.setBoundId(SecurityUtils.getLoginUser().getUserId()); |
| | | customerPrivatePoolMapper.insert(customerPrivatePool); |
| | | return true; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Integer delete(List<Long> ids) { |
| | | List<CustomerPrivatePool> customerPrivatePools = customerPrivatePoolMapper.selectList(new QueryWrapper<CustomerPrivatePool>().lambda().in(CustomerPrivatePool::getId, ids)); |
| | | List<SalesLedger> salesLedgers = salesLedgerMapper.selectList(new QueryWrapper<SalesLedger>().lambda().in(SalesLedger::getCustomerId, customerPrivatePools.stream().map(CustomerPrivatePool::getCustomerId).collect(Collectors.toList()))); |
| | | if (!CollectionUtils.isEmpty(salesLedgers)) { |
| | | throw new RuntimeException("å®¢æ·æéå®ååï¼è¯·å
å é¤éå®åå"); |
| | | } |
| | | if (CollectionUtils.isEmpty(customerPrivatePools)) { |
| | | throw new RuntimeException("客æ·ä¸åå¨"); |
| | | } |
| | | customerFollowUpService.remove(new QueryWrapper<CustomerFollowUp>().lambda().in(CustomerFollowUp::getCustomerPrivatePoolId, customerPrivatePools.stream().map(CustomerPrivatePool::getCustomerId).collect(Collectors.toList()))); |
| | | customerReturnVisitService.remove(new QueryWrapper<CustomerReturnVisit>().lambda().in(CustomerReturnVisit::getCustomerPrivatePoolId, customerPrivatePools.stream().map(CustomerPrivatePool::getCustomerId).collect(Collectors.toList()))); |
| | | customerPrivatePools.stream().forEach(customerPrivatePool -> { |
| | | customerPrivatePool.setDeleteFlag(1); |
| | | customerPrivatePoolMapper.updateById(customerPrivatePool); |
| | | }); |
| | | return 1; |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public R importData(MultipartFile file) { |
| | | try { |
| | | ExcelUtil<CustomerPrivate> util = new ExcelUtil<CustomerPrivate>(CustomerPrivate.class); |
| | | List<CustomerPrivate> userList = util.importExcel(file.getInputStream()); |
| | | if (CollectionUtils.isEmpty(userList)) { |
| | | return R.fail("模æ¿é误æå¯¼å
¥æ°æ®ä¸ºç©º"); |
| | | } |
| | | for (CustomerPrivate user : userList) { |
| | | CustomerPrivateDto customerPrivateDto = new CustomerPrivateDto(); |
| | | BeanUtils.copyProperties(user, customerPrivateDto); |
| | | this.add(customerPrivateDto); |
| | | } |
| | | return R.ok(true); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return R.fail("导å
¥å¤±è´¥"); |
| | | } |
| | | } |
| | | } |
| | |
| | | throw new ServiceException("客æ·IDä¸è½ä¸ºç©º"); |
| | | } |
| | | LambdaQueryWrapper<CustomerReturnVisit> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(CustomerReturnVisit::getCustomerId, customerId); |
| | | queryWrapper.eq(CustomerReturnVisit::getCustomerPrivatePoolId, customerId); |
| | | CustomerReturnVisit returnVisit = baseMapper.selectOne(queryWrapper); |
| | | |
| | | if (returnVisit == null) { |
| | |
| | | throw new ServiceException("客æ·IDä¸è½ä¸ºç©º"); |
| | | } |
| | | LambdaQueryWrapper<CustomerReturnVisit> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(CustomerReturnVisit::getCustomerId, customerId); |
| | | queryWrapper.eq(CustomerReturnVisit::getCustomerPrivatePoolId, customerId); |
| | | List<CustomerReturnVisit> returnVisits = baseMapper.selectList(queryWrapper); |
| | | |
| | | for (CustomerReturnVisit returnVisit : returnVisits) { |
| | |
| | | if (returnVisit == null) { |
| | | throw new ServiceException("å访æéæ°æ®ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (returnVisit.getCustomerId() == null) { |
| | | if (returnVisit.getCustomerPrivatePoolId() == null) { |
| | | throw new ServiceException("客æ·IDä¸è½ä¸ºç©º"); |
| | | } |
| | | if (returnVisit.getReminderTime() == null) { |
| | |
| | | package com.ruoyi.basic.service.impl; |
| | | |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.date.LocalDateTimeUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.dto.CustomerDto; |
| | | import com.ruoyi.basic.dto.CustomerFollowUpDto; |
| | | import com.ruoyi.basic.dto.CustomerPrivatePoolDto; |
| | | import com.ruoyi.basic.mapper.CustomerMapper; |
| | | import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.pojo.CustomerFollowUp; |
| | | import com.ruoyi.basic.pojo.CustomerFollowUpFile; |
| | | import com.ruoyi.basic.pojo.CustomerPrivatePool; |
| | | import com.ruoyi.basic.service.CustomerFollowUpFileService; |
| | | import com.ruoyi.basic.service.CustomerFollowUpService; |
| | | import com.ruoyi.basic.service.CustomerReturnVisitService; |
| | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | @AllArgsConstructor |
| | | @Slf4j |
| | | public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements ICustomerService { |
| | | private final SalesLedgerMapper salesLedgerMapper; |
| | | @Autowired |
| | | private SalesLedgerMapper salesLedgerMapper; |
| | | @Autowired |
| | | private CustomerPrivatePoolMapper customerPrivatePoolMapper; |
| | | @Autowired |
| | | private CustomerMapper customerMapper; |
| | | |
| | | @Autowired |
| | | private CustomerFollowUpService customerFollowUpService; |
| | | |
| | | @Autowired |
| | | private CustomerFollowUpFileService customerFollowUpFileService; |
| | | |
| | | @Autowired |
| | | private CustomerReturnVisitService customerReturnVisitService; |
| | | |
| | | /** |
| | |
| | | * @return 客æ·è¯¦æ
DTO |
| | | */ |
| | | @Override |
| | | public CustomerDto selectCustomerDetailById(Long id) { |
| | | Customer customer = customerMapper.selectById(id); |
| | | if (customer == null) { |
| | | return null; |
| | | } |
| | | |
| | | CustomerDto dto = new CustomerDto(); |
| | | BeanUtils.copyProperties(customer, dto); |
| | | |
| | | // æ¥è¯¢è·è¿è®°å½ |
| | | List<CustomerFollowUp> followUpList = customerFollowUpService.list( |
| | | new LambdaQueryWrapper<CustomerFollowUp>() |
| | | .eq(CustomerFollowUp::getCustomerId, id) |
| | | .orderByDesc(CustomerFollowUp::getFollowUpTime) |
| | | ); |
| | | |
| | | if (!CollectionUtils.isEmpty(followUpList)) { |
| | | List<CustomerFollowUpDto> followUpDtoList = followUpList.stream().map(followUp -> { |
| | | CustomerFollowUpDto followUpDto = new CustomerFollowUpDto(); |
| | | BeanUtils.copyProperties(followUp, followUpDto); |
| | | |
| | | // æ¥è¯¢éä»¶ |
| | | List<CustomerFollowUpFile> fileList = customerFollowUpFileService.list( |
| | | new LambdaQueryWrapper<CustomerFollowUpFile>() |
| | | .eq(CustomerFollowUpFile::getFollowUpId, followUp.getId()) |
| | | ); |
| | | followUpDto.setFileList(fileList); |
| | | |
| | | return followUpDto; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | dto.setFollowUpList(followUpDtoList); |
| | | } |
| | | |
| | | return dto; |
| | | public Customer selectCustomerDetailById(Long id) { |
| | | return this.getById( id); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return å®¢æ·æ¡£æ¡ |
| | | */ |
| | | @Override |
| | | public IPage<Customer> selectCustomerList(Page<Customer> page, Customer customer) { |
| | | // 1. å¤ç空å¼åºæ¯ï¼åæ°æ ¡éªï¼ |
| | | if (page == null) { |
| | | page = Page.of(1, 10); // é»è®¤ç¬¬1é¡µï¼æ¯é¡µ10æ¡æ°æ® |
| | | } |
| | | if (customer == null) { |
| | | customer = new Customer(); // é¿å
空对象导è´çNPE |
| | | public IPage<CustomerDto> selectCustomerList(Page<CustomerDto> page, CustomerDto customer) { |
| | | IPage<CustomerDto> customerPage = customerMapper.listPage(page, customer); |
| | | |
| | | List<CustomerDto> records = customerPage.getRecords(); |
| | | if (CollectionUtils.isEmpty(records)) { |
| | | return customerPage; |
| | | } |
| | | |
| | | // 2. æå»ºæ¥è¯¢æ¡ä»¶ï¼å¢å¼ºç©ºå¼å®å
¨ï¼ |
| | | LambdaQueryWrapper<Customer> queryWrapper = new LambdaQueryWrapper<>(); |
| | | String customerName = customer.getCustomerName(); |
| | | String customerType = customer.getCustomerType(); |
| | | if (StringUtils.isNotBlank(customerName)) { |
| | | queryWrapper.like(Customer::getCustomerName, customerName); |
| | | } |
| | | if (StringUtils.isNotBlank(customerType)) { |
| | | queryWrapper.like(Customer::getCustomerType, customerType); |
| | | } |
| | | |
| | | // 3. æ§è¡å页æ¥è¯¢ï¼ä¿çå页å
æ°æ®ï¼ |
| | | IPage<Customer> customerPage = customerMapper.selectPage(page, queryWrapper); |
| | | |
| | | // 4. æ°æ®å¤çï¼å¢å¼ºç©ºå¼å®å
¨ & 代ç å¯è¯»æ§ï¼ |
| | | List<Customer> processedList = customerPage.getRecords().stream() |
| | | .filter(Objects::nonNull) // è¿æ»¤ç©ºå¯¹è±¡ï¼é¿å
åç»æä½NPEï¼ |
| | | .peek(c -> { |
| | | // å®å
¨è·ååæ®µï¼é¿å
null弿¼æ¥ |
| | | String address = StringUtils.defaultString(c.getCompanyAddress(), ""); |
| | | String phone = StringUtils.defaultString(c.getCompanyPhone(), ""); |
| | | c.setAddressPhone(address + "(" + phone + ")"); |
| | | |
| | | // æ¥è¯¢ææ°çè·è¿è®°å½ |
| | | CustomerFollowUp followUp = customerFollowUpService.getOne( |
| | | new LambdaQueryWrapper<CustomerFollowUp>() |
| | | .eq(CustomerFollowUp::getCustomerId, c.getId()) |
| | | .orderByDesc(CustomerFollowUp::getFollowUpTime) |
| | | .last("LIMIT 1") |
| | | ); |
| | | |
| | | if (followUp != null) { |
| | | c.setFollowUpLevel(followUp.getFollowUpLevel()); |
| | | c.setFollowUpTime( |
| | | Date.from( |
| | | followUp.getFollowUpTime().atZone(ZoneId.systemDefault()).toInstant() |
| | | ) |
| | | ); |
| | | } |
| | | }) |
| | | List<Long> customerIds = records.stream() |
| | | .map(CustomerDto::getId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // 5. æ´æ°åé¡µç»æä¸çæ°æ®ï¼ä¿æå页信æ¯å®æ´ï¼ |
| | | IPage<Customer> resultPage = new Page<>(customerPage.getCurrent(), customerPage.getSize(), customerPage.getTotal()); |
| | | resultPage.setRecords(processedList); |
| | | if (!CollectionUtils.isEmpty(customerIds)) { |
| | | Map<Long, CustomerFollowUp> latestFollowUpMap = getLatestFollowUpMap(customerIds); |
| | | |
| | | return customerPage; // è¿åå
å«å页信æ¯çIPage对象 |
| | | records.forEach(c -> { |
| | | String address = StringUtils.defaultString(c.getCompanyAddress(), ""); |
| | | String phone = StringUtils.defaultString(c.getCompanyPhone(), ""); |
| | | c.setAddressPhone(address + "(" + phone + ")"); |
| | | |
| | | CustomerFollowUp followUp = latestFollowUpMap.get(c.getId()); |
| | | if (followUp != null) { |
| | | c.setFollowUpLevel(followUp.getFollowUpLevel()); |
| | | c.setFollowUpTime(Date.from( |
| | | followUp.getFollowUpTime().atZone(ZoneId.systemDefault()).toInstant() |
| | | )); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | return customerPage; |
| | | } |
| | | |
| | | private Map<Long, CustomerFollowUp> getLatestFollowUpMap(List<Long> customerIds) { |
| | | List<CustomerFollowUp> followUps = customerFollowUpService.list( |
| | | new LambdaQueryWrapper<CustomerFollowUp>() |
| | | .in(CustomerFollowUp::getCustomerPrivatePoolId, customerIds) |
| | | .orderByDesc(CustomerFollowUp::getFollowUpTime) |
| | | ); |
| | | |
| | | return followUps.stream() |
| | | .collect(Collectors.toMap( |
| | | CustomerFollowUp::getCustomerPrivatePoolId, |
| | | followUp -> followUp, |
| | | (existing, replacement) -> existing |
| | | )); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | try { |
| | | unipushService.sendReturnVisitReminder(returnVisitId, client.getCid(), returnVisit.getContent(), returnVisit.getCustomerId()); |
| | | unipushService.sendReturnVisitReminder(returnVisitId, client.getCid(), returnVisit.getContent(), returnVisit.getCustomerPrivatePoolId()); |
| | | CustomerReturnVisit updateObj = new CustomerReturnVisit(); |
| | | updateObj.setId(returnVisitId); |
| | | updateObj.setIsCompleted(1); |
| | |
| | | IGNORE_TABLES.add("gen_table"); |
| | | IGNORE_TABLES.add("sys_notice"); |
| | | IGNORE_TABLES.add("sys_user_client"); |
| | | IGNORE_TABLES.add("gen_table_column"); |
| | | IGNORE_TABLES.add("product_model"); |
| | | IGNORE_TABLES.add("product"); |
| | | |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.service.AccountIncomeService; |
| | | import com.ruoyi.basic.dto.CustomerPrivatePoolDto; |
| | | import com.ruoyi.basic.mapper.CustomerMapper; |
| | | import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper; |
| | | import com.ruoyi.basic.mapper.ProductMapper; |
| | | import com.ruoyi.basic.mapper.ProductModelMapper; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.pojo.CustomerPrivatePool; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.enums.SaleEnum; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | |
| | | ; |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | @Autowired |
| | | private CustomerPrivatePoolMapper customerPrivatePoolMapper; |
| | | |
| | | @Override |
| | | public List<SalesLedger> selectSalesLedgerList(SalesLedgerDto salesLedgerDto) { |
| | |
| | | public int addOrUpdateSalesLedger(SalesLedgerDto salesLedgerDto) { |
| | | try { |
| | | // 1. æ ¡éªå®¢æ·ä¿¡æ¯ |
| | | Customer customer = customerMapper.selectById(salesLedgerDto.getCustomerId()); |
| | | CustomerPrivatePoolDto customer = customerPrivatePoolMapper.selectInfo(salesLedgerDto.getCustomerId()); |
| | | if (customer == null) { |
| | | throw new BaseException("客æ·ä¸åå¨"); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.ruoyi.basic.mapper.CustomerMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.Customer"> |
| | | <id column="id" property="id" /> |
| | | </resultMap> |
| | | <select id="listPage" resultType="com.ruoyi.basic.dto.CustomerDto"> |
| | | select |
| | | c.*, |
| | | u.user_name usage_user_name, |
| | | ( |
| | | select group_concat(u2.user_name separator ', ') |
| | | from customer_private_pool cpp2 |
| | | left join sys_user u2 on cpp2.bound_id = u2.user_id |
| | | where cpp2.customer_id = c.id |
| | | and cpp2.bound_id != c.usage_user |
| | | ) as together_user_names |
| | | from customer c |
| | | left join sys_user u on c.usage_user = u.user_id |
| | | <where> |
| | | <if test="c.customerName != null and c.customerName != ''"> |
| | | and customer_name like concat('%', #{c.customerName}, '%') |
| | | </if> |
| | | <if test="c.customerType != null and c.customerType != ''"> |
| | | and customer_type = #{c.customerType} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.ruoyi.basic.mapper.CustomerPrivateMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.CustomerPrivate"> |
| | | <id column="id" property="id" /> |
| | | <result column="customer_name" property="customerName" /> |
| | | <result column="taxpayer_identification_number" property="taxpayerIdentificationNumber" /> |
| | | <result column="company_address" property="companyAddress" /> |
| | | <result column="company_phone" property="companyPhone" /> |
| | | <result column="contact_person" property="contactPerson" /> |
| | | <result column="contact_phone" property="contactPhone" /> |
| | | <result column="maintainer" property="maintainer" /> |
| | | <result column="maintenance_time" property="maintenanceTime" /> |
| | | <result column="tenant_id" property="tenantId" /> |
| | | <result column="basic_bank_account" property="basicBankAccount" /> |
| | | <result column="bank_account" property="bankAccount" /> |
| | | <result column="bank_code" property="bankCode" /> |
| | | <result column="customer_type" property="customerType" /> |
| | | <result column="create_user" property="createUser" /> |
| | | <result column="dept_id" property="deptId" /> |
| | | </resultMap> |
| | | |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.ruoyi.basic.mapper.CustomerPrivatePoolMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.CustomerPrivatePool"> |
| | | <id column="id" property="id" /> |
| | | <result column="customer_id" property="customerId" /> |
| | | <result column="bound_id" property="boundId" /> |
| | | <result column="create_user" property="createUser" /> |
| | | <result column="update_user" property="updateUser" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | </resultMap> |
| | | <select id="listPage" resultType="com.ruoyi.basic.dto.CustomerPrivatePoolDto"> |
| | | select cpp.id, |
| | | cpp.bound_id, |
| | | cpp.type, |
| | | coalesce(c.id, cp.id) as customer_id, |
| | | coalesce(c.customer_name, cp.customer_name) as customer_name, |
| | | coalesce(c.customer_type, cp.customer_type) as customer_type, |
| | | coalesce(c.taxpayer_identification_number, cp.taxpayer_identification_number) as taxpayer_identification_number, |
| | | coalesce(c.company_address, cp.company_address) as company_address, |
| | | coalesce(c.company_phone, cp.company_phone) as company_phone, |
| | | coalesce(c.contact_person, cp.contact_person) as contact_person, |
| | | coalesce(c.contact_phone, cp.contact_phone) as contact_phone, |
| | | coalesce(c.maintainer, cp.maintainer) as maintainer, |
| | | coalesce(c.maintenance_time, cp.maintenance_time) as maintenance_time, |
| | | coalesce(c.tenant_id, cp.tenant_id) as tenant_id, |
| | | coalesce(c.basic_bank_account, cp.basic_bank_account) as basic_bank_account, |
| | | coalesce(c.bank_account, cp.bank_account) as bank_account, |
| | | coalesce(c.bank_code, cp.bank_code) as bank_code |
| | | from customer_private_pool cpp |
| | | left join customer c on c.id = cpp.customer_id and cpp.type = 1 |
| | | left join customer_private cp on cp.id = cpp.customer_id and cpp.type = 0 |
| | | <where> |
| | | cpp.delete_flag = 0 |
| | | <if test="c.customerName != null and c.customerName != ''"> |
| | | and c.customer_name like concat('%', #{c.customerName}, '%') |
| | | </if> |
| | | <if test="c.boundId != null"> |
| | | and cpp.bound_id = #{c.boundId} |
| | | </if> |
| | | </where> |
| | | order by cpp.id desc |
| | | </select> |
| | | <select id="selectInfo" resultType="com.ruoyi.basic.dto.CustomerPrivatePoolDto"> |
| | | select cpp.id, |
| | | cpp.bound_id, |
| | | cpp.type, |
| | | coalesce(c.id, cp.id) as customer_id, |
| | | coalesce(c.customer_name, cp.customer_name) as customer_name, |
| | | coalesce(c.customer_type, cp.customer_type) as customer_type, |
| | | coalesce(c.taxpayer_identification_number, cp.taxpayer_identification_number) as taxpayer_identification_number, |
| | | coalesce(c.company_address, cp.company_address) as company_address, |
| | | coalesce(c.company_phone, cp.company_phone) as company_phone, |
| | | coalesce(c.contact_person, cp.contact_person) as contact_person, |
| | | coalesce(c.contact_phone, cp.contact_phone) as contact_phone, |
| | | coalesce(c.maintainer, cp.maintainer) as maintainer, |
| | | coalesce(c.maintenance_time, cp.maintenance_time) as maintenance_time, |
| | | coalesce(c.tenant_id, cp.tenant_id) as tenant_id, |
| | | coalesce(c.basic_bank_account, cp.basic_bank_account) as basic_bank_account, |
| | | coalesce(c.bank_account, cp.bank_account) as bank_account, |
| | | coalesce(c.bank_code, cp.bank_code) as bank_code |
| | | from customer_private_pool cpp |
| | | left join customer c on c.id = cpp.customer_id and cpp.type = 1 |
| | | left join customer_private cp on cp.id = cpp.customer_id and cpp.type = 0 |
| | | <where> |
| | | <if test="id != null"> |
| | | and cpp.id = #{id} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="selectInfos" resultType="com.ruoyi.basic.dto.CustomerPrivatePoolDto"> |
| | | select cpp.id, |
| | | cpp.bound_id, |
| | | cpp.type, |
| | | coalesce(c.id, cp.id) as customer_id, |
| | | coalesce(c.customer_name, cp.customer_name) as customer_name, |
| | | coalesce(c.customer_type, cp.customer_type) as customer_type, |
| | | coalesce(c.taxpayer_identification_number, cp.taxpayer_identification_number) as taxpayer_identification_number, |
| | | coalesce(c.company_address, cp.company_address) as company_address, |
| | | coalesce(c.company_phone, cp.company_phone) as company_phone, |
| | | coalesce(c.contact_person, cp.contact_person) as contact_person, |
| | | coalesce(c.contact_phone, cp.contact_phone) as contact_phone, |
| | | coalesce(c.maintainer, cp.maintainer) as maintainer, |
| | | coalesce(c.maintenance_time, cp.maintenance_time) as maintenance_time, |
| | | coalesce(c.tenant_id, cp.tenant_id) as tenant_id, |
| | | coalesce(c.basic_bank_account, cp.basic_bank_account) as basic_bank_account, |
| | | coalesce(c.bank_account, cp.bank_account) as bank_account, |
| | | coalesce(c.bank_code, cp.bank_code) as bank_code |
| | | from customer_private_pool cpp |
| | | left join customer c on c.id = cpp.customer_id and cpp.type = 1 |
| | | left join customer_private cp on cp.id = cpp.customer_id and cpp.type = 0 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | T1.customer_name LIKE CONCAT ('%',#{invoiceLedgerDto.searchText},'%') |
| | | </if> |
| | | </where> |
| | | GROUP BY T1.customer_name |
| | | GROUP BY T1.customer_name,t1.customer_id |
| | | </select> |
| | | |
| | | <select id="invoiceLedgerProductInfo" resultType="com.ruoyi.sales.dto.InvoiceRegistrationProductDto"> |