Merge branch 'refs/heads/dev_New' into dev_西宁_湟水峡
| | |
| | | // æ¼ç¤ºä¾åï¼æ§è¡ 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; |
| | | |
| | | @Autowired |
| | | private CustomerPrivateMapper customerPrivateMapper; |
| | | @Autowired |
| | | private CustomerPrivateService customerPrivateService; |
| | | |
| | | |
| | | @Override |
| | | public Boolean add(CustomerPrivateDto customerPrivateDto) { |
| | | //æ°å¢ç§æµ· å®¢æ· |
| | | this.save(customerPrivateDto); |
| | | //æ°å¢ç§æµ·è®°å½ |
| | | CustomerPrivatePool customerPrivatePool = new CustomerPrivatePool(); |
| | | customerPrivatePool.setCustomerId(customerPrivateDto.getId()); |
| | | customerPrivatePool.setType(0L); |
| | | 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 { |
| | | List<CustomerPrivate> existingList = customerPrivateService.list(); |
| | | java.util.Set<String> existingCustomerNames = existingList.stream() |
| | | .map(CustomerPrivate::getCustomerName) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | ExcelUtil<CustomerPrivate> util = new ExcelUtil<CustomerPrivate>(CustomerPrivate.class); |
| | | List<CustomerPrivate> userList = util.importExcel(file.getInputStream()); |
| | | if (CollectionUtils.isEmpty(userList)) { |
| | | return R.fail("模æ¿é误æå¯¼å
¥æ°æ®ä¸ºç©º"); |
| | | } |
| | | |
| | | int successCount = 0; |
| | | int skipCount = 0; |
| | | for (CustomerPrivate user : userList) { |
| | | if (existingCustomerNames.contains(user.getCustomerName())) { |
| | | skipCount++; |
| | | continue; |
| | | } |
| | | CustomerPrivateDto customerPrivateDto = new CustomerPrivateDto(); |
| | | BeanUtils.copyProperties(user, customerPrivateDto); |
| | | this.add(customerPrivateDto); |
| | | existingCustomerNames.add(user.getCustomerName()); |
| | | successCount++; |
| | | } |
| | | return R.ok("导å
¥å®æï¼æå" + successCount + "æ¡ï¼è·³è¿éå¤" + skipCount + "æ¡"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return R.fail("导å
¥å¤±è´¥ï¼" + e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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 |
| | | )); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (!salesLedgers.isEmpty()) { |
| | | throw new RuntimeException("å®¢æ·æ¡£æ¡ä¸æéå®ååï¼è¯·å
å é¤éå®åå"); |
| | | } |
| | | List<CustomerPrivatePool> customerPrivatePools = customerPrivatePoolMapper.selectList(new QueryWrapper<CustomerPrivatePool>().lambda().in(CustomerPrivatePool::getCustomerId, idList)); |
| | | if (!customerPrivatePools.isEmpty()) { |
| | | throw new RuntimeException("å®¢æ·æ¡£æ¡ä¸æå®¢æ·ç§æµ·ï¼è¯·å
æ¶åç§æµ·æ°æ®"); |
| | | } |
| | | // å é¤å®¢æ·çåæ¶ä¹éè¦å é¤å¯¹åºç客æ·è·éãéä»¶åå访æé |
| | | for (Long id : ids) { |
| | | customerFollowUpService.deleteByCustomerId(id); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.dto.ProductDto; |
| | |
| | | |
| | | @Override |
| | | public int addOrEditProduct(ProductDto productDto) { |
| | | if (ObjectUtils.isEmpty(productDto.getParentId())) { |
| | | throw new IllegalArgumentException("è¯·éæ©ç¶èç¹"); |
| | | } |
| | | if (productDto.getId() == null) { |
| | | // æ°å¢äº§åé»è¾ |
| | | if (productDto.getParentId() == null) { |
| | |
| | | } |
| | | |
| | | 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.inner.BlockAttackInnerInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor; |
| | | import com.ruoyi.common.handler.CustomTenantLineHandler; |
| | | import com.ruoyi.common.interceptor.DataScopeSqlInterceptor; |
| | | import org.apache.ibatis.executor.Executor; |
| | | import org.apache.ibatis.mapping.BoundSql; |
| | |
| | | import java.sql.SQLException; |
| | | |
| | | /** |
| | | * Mybatis Plus é
ç½® |
| | | * |
| | | * @author ruoyi |
| | | * MyBatis Plus config. |
| | | */ |
| | | @EnableTransactionManagement(proxyTargetClass = true) |
| | | @Configuration |
| | |
| | | private DataScopeSqlInterceptor dataScopeSqlInterceptor; |
| | | |
| | | @Bean |
| | | public MybatisPlusInterceptor mybatisPlusInterceptor() |
| | | { |
| | | public MybatisPlusInterceptor mybatisPlusInterceptor() { |
| | | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); |
| | | // ç§æ·æä»¶ |
| | | // TenantLineInnerInterceptor tenantLineInnerInterceptor = new TenantLineInnerInterceptor(new CustomTenantLineHandler()); |
| | | // interceptor.addInnerInterceptor(tenantLineInnerInterceptor); |
| | | // å页æä»¶ |
| | | interceptor.addInnerInterceptor(paginationInnerInterceptor()); |
| | | // ä¹è§éæä»¶ |
| | | interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor()); |
| | | // 黿æä»¶ |
| | | interceptor.addInnerInterceptor(blockAttackInnerInterceptor()); |
| | | // æ°æ®æéæä»¶ |
| | | // Rewrite the original SQL before pagination generates the count query. |
| | | interceptor.addInnerInterceptor(dataScopeSqlInterceptor); |
| | | interceptor.addInnerInterceptor(paginationInnerInterceptor()); |
| | | interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor()); |
| | | interceptor.addInnerInterceptor(blockAttackInnerInterceptor()); |
| | | return interceptor; |
| | | } |
| | | |
| | | /** |
| | | * å页æä»¶ï¼èªå¨è¯å«æ°æ®åºç±»å https://baomidou.com/guide/interceptor-pagination.html |
| | | * Pagination interceptor. |
| | | */ |
| | | // public PaginationInnerInterceptor paginationInnerInterceptor() |
| | | // { |
| | | // PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(); |
| | | // // è®¾ç½®æ°æ®åºç±»å为mysql |
| | | // paginationInnerInterceptor.setDbType(DbType.MYSQL); |
| | | // // 设置æå¤§å页éå¶æ°éï¼é»è®¤ 500 æ¡ï¼-1 ä¸åéå¶ |
| | | // paginationInnerInterceptor.setMaxLimit(-1L); |
| | | // return paginationInnerInterceptor; |
| | | // } |
| | | |
| | | public PaginationInnerInterceptor paginationInnerInterceptor() { |
| | | PaginationInnerInterceptor interceptor = new PaginationInnerInterceptor(DbType.MYSQL) { |
| | | @Override |
| | | public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, |
| | | RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException { |
| | | RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) |
| | | throws SQLException { |
| | | IPage<?> page = ParameterUtils.findPage(parameter).orElse(null); |
| | | if (page != null && page.getSize() <= 0) { |
| | | // å½size<=0æ¶ï¼ä¸è¿è¡å页 |
| | | return; |
| | | } |
| | | super.beforeQuery(executor, ms, parameter, rowBounds, resultHandler, boundSql); |
| | | } |
| | | }; |
| | | interceptor.setMaxLimit(1000L); // 建议设置åççæå¤§å¼ |
| | | interceptor.setMaxLimit(1000L); |
| | | return interceptor; |
| | | } |
| | | |
| | | /** |
| | | * ä¹è§éæä»¶ https://baomidou.com/guide/interceptor-optimistic-locker.html |
| | | * Optimistic lock interceptor. |
| | | */ |
| | | public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor() |
| | | { |
| | | public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor() { |
| | | return new OptimisticLockerInnerInterceptor(); |
| | | } |
| | | |
| | | /** |
| | | * 妿æ¯å¯¹å
¨è¡¨çå é¤ææ´æ°æä½ï¼å°±ä¼ç»æ¢è¯¥æä½ https://baomidou.com/guide/interceptor-block-attack.html |
| | | * Block full-table update and delete. |
| | | */ |
| | | public BlockAttackInnerInterceptor blockAttackInnerInterceptor() |
| | | { |
| | | public BlockAttackInnerInterceptor blockAttackInnerInterceptor() { |
| | | return new BlockAttackInnerInterceptor(); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | 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 com.ruoyi.production.dto.ProcessRouteItemDto; |
| | | import com.ruoyi.production.pojo.ProcessRoute; |
| | | import com.ruoyi.production.pojo.ProcessRouteItem; |
| | | import com.ruoyi.production.service.ProcessRouteItemService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("processRouteItem") |
| | | @RequestMapping("/processRouteItem") |
| | | @Api(tags = "å·¥èºè·¯çº¿æç»") |
| | | public class ProcessRouteItemController { |
| | | @Autowired |
| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | 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 com.ruoyi.production.dto.ProductOrderDto; |
| | | import com.ruoyi.production.pojo.ProcessRoute; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | | import com.ruoyi.production.service.ProductOrderService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @RequestMapping("productOrder") |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.dto.ProductOrderMaterialDto; |
| | | import com.ruoyi.production.pojo.ProductOrderMaterial; |
| | | import com.ruoyi.production.service.ProductOrderMaterialService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/productOrderMaterial") |
| | | @Api(value = "ProductOrderMaterial", tags = "ç产订åç©æè¡¨") |
| | | public class ProductOrderMaterialController { |
| | | |
| | | private ProductOrderMaterialService productOrderMaterialservice; |
| | | |
| | | @GetMapping("/detailList") |
| | | @ApiOperation("å页æ¥è¯¢ææç产订åç©æè¡¨") |
| | | public R listPage(Page<ProductOrderMaterial> page, ProductOrderMaterial productOrderMaterial) { |
| | | IPage<ProductOrderMaterial> listPage = productOrderMaterialservice.listPage(page, productOrderMaterial); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("æ°å¢ç产订åç©æè¡¨") |
| | | public R add(@RequestBody ProductOrderMaterial productOrderMaterial) { |
| | | return R.ok(productOrderMaterialservice.save(productOrderMaterial)); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @ApiOperation("ä¿®æ¹ç产订åç©æè¡¨") |
| | | public R update(@RequestBody ProductOrderMaterial productOrderMaterial) { |
| | | return R.ok(productOrderMaterialservice.updateById(productOrderMaterial)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation("颿å°è´¦å表") |
| | | public R list(ProductOrderMaterialDto productOrderMaterialDto) { |
| | | List<ProductOrderMaterialDto> productOrderMaterialDtos = productOrderMaterialservice.pickMaterial(productOrderMaterialDto); |
| | | return R.ok(productOrderMaterialDtos); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.dto; |
| | | |
| | | import com.ruoyi.production.pojo.ProductOrderMaterial; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | public class ProductOrderMaterialDto extends ProductOrderMaterial { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.production.dto.ProductOrderMaterialDto; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | import com.ruoyi.production.pojo.ProductOrderMaterial; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface ProductOrderMaterialMapper extends BaseMapper<ProductOrderMaterial> { |
| | | |
| | | IPage<ProductOrderMaterial> pickMaterial(@Param("id") Long ProductOrderId); |
| | | |
| | | List<ProductStructureDto> selectLeafNode(@Param("bomId") Long bomId); |
| | | |
| | | List<ProductOrderMaterialDto> selectByProductModelIds(@Param("ids") List<Long> productModelIds); |
| | | } |
| | |
| | | package com.ruoyi.production.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.production.dto.ProductStructureDto; |
| | | import com.ruoyi.production.pojo.ProductStructure; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | |
| | | List<ProductStructureDto> listBybomId(@Param("bomId") Integer bomId); |
| | | |
| | | List<ProductStructureDto> listBybomAndProcess(@Param("bomId") Integer bomId, @Param("processId") Long processId); |
| | | |
| | | List<ProductStructureDto> selectLeafNode(@Param("bomId") Integer bomId); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @TableName("product_order_material") |
| | | @ApiModel(description="ç产订åç©æè¡¨") |
| | | public class ProductOrderMaterial implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主é®ID |
| | | */ |
| | | @ApiModelProperty(value="主é®ID") |
| | | private Long id; |
| | | /** |
| | | * ç产订åID |
| | | */ |
| | | @ApiModelProperty(value="ç产订åID") |
| | | private Long productOrderId; |
| | | /** |
| | | * å·¥åºåç§° |
| | | */ |
| | | @ApiModelProperty(value="å·¥åºåç§°") |
| | | private String processName; |
| | | /** |
| | | * åæåç§° |
| | | */ |
| | | @ApiModelProperty(value="åæåç§°") |
| | | private String materialName; |
| | | /** |
| | | * åæåå· |
| | | */ |
| | | @ApiModelProperty(value="åæåå·") |
| | | private String materialModel; |
| | | /** |
| | | * éæ±æ°é |
| | | */ |
| | | @ApiModelProperty(value="éæ±æ°é") |
| | | private BigDecimal requiredQty; |
| | | /** |
| | | * 计éåä½ |
| | | */ |
| | | @ApiModelProperty(value="计éåä½") |
| | | private String unit; |
| | | /** |
| | | * é¢ç¨æ°é |
| | | */ |
| | | @ApiModelProperty(value="é¢ç¨æ°é") |
| | | private BigDecimal pickQty; |
| | | /** |
| | | * è¡¥ææ°é |
| | | */ |
| | | @ApiModelProperty(value="è¡¥ææ°é") |
| | | private BigDecimal supplementQty; |
| | | /** |
| | | * éææ°é |
| | | */ |
| | | @ApiModelProperty(value="éææ°é") |
| | | private BigDecimal returnQty; |
| | | /** |
| | | * å®é
æ°é |
| | | */ |
| | | @ApiModelProperty(value="å®é
æ°é") |
| | | private BigDecimal actualQty; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹ç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Long updateUser; |
| | | } |
| | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @ApiModelProperty(value ="æ¯å¦å
¥åº") |
| | | @TableField("is_inbound") |
| | | private Boolean inbound; |
| | | |
| | | @ApiModelProperty(value ="æ¯å¦æ¥å·¥") |
| | | @TableField("is_report_work") |
| | | private Boolean reportWork; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.production.dto.ProductOrderMaterialDto; |
| | | import com.ruoyi.production.pojo.ProductOrderMaterial; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface ProductOrderMaterialService extends IService<ProductOrderMaterial> { |
| | | IPage<ProductOrderMaterial> listPage(Page<ProductOrderMaterial> page, ProductOrderMaterial productOrderMaterial); |
| | | |
| | | List<ProductOrderMaterialDto> pickMaterial(ProductOrderMaterialDto productOrderMaterialDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.production.dto.ProductOrderMaterialDto; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | import com.ruoyi.production.mapper.ProcessRouteMapper; |
| | | import com.ruoyi.production.mapper.ProductOrderMapper; |
| | | import com.ruoyi.production.mapper.ProductOrderMaterialMapper; |
| | | import com.ruoyi.production.pojo.ProcessRoute; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | | import com.ruoyi.production.pojo.ProductOrderMaterial; |
| | | import com.ruoyi.production.service.ProductOrderMaterialService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class ProductOrderMaterialServiceImpl extends ServiceImpl<ProductOrderMaterialMapper, ProductOrderMaterial> implements ProductOrderMaterialService { |
| | | |
| | | private final ProductOrderMaterialMapper productOrderMaterialmapper; |
| | | |
| | | private final ProductOrderMapper productOrderMapper; |
| | | |
| | | private final ProcessRouteMapper processRouteMapper; |
| | | |
| | | |
| | | @Override |
| | | public IPage<ProductOrderMaterial> listPage(Page<ProductOrderMaterial> page, ProductOrderMaterial productOrderMaterial) { |
| | | return productOrderMaterialmapper.selectPage(page, null); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductOrderMaterialDto> pickMaterial(ProductOrderMaterialDto productOrderMaterialDto) { |
| | | Long productOrderId = productOrderMaterialDto.getProductOrderId(); |
| | | ProductOrder productOrder = productOrderMapper.selectById(productOrderId); |
| | | BigDecimal quantity = productOrder.getQuantity(); |
| | | ProcessRoute processRoute = processRouteMapper.selectById(productOrder.getRouteId()); |
| | | //æ¥è¯¢å¶åèç¹ |
| | | List<ProductStructureDto> productStructureDtoList = productOrderMaterialmapper.selectLeafNode(Long.valueOf(processRoute.getBomId())); |
| | | List<Long> productModelIds = productStructureDtoList.stream() |
| | | .map(ProductStructureDto::getProductModelId) |
| | | .filter(Objects::nonNull) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (!productModelIds.isEmpty()) { |
| | | List<ProductOrderMaterialDto> productOrderMaterialDtos = productOrderMaterialmapper.selectByProductModelIds(productModelIds); |
| | | if (!productOrderMaterialDtos.isEmpty()) { |
| | | return productOrderMaterialDtos; |
| | | }else { |
| | | throw new RuntimeException("åºå没æå¯¹åºäº§å"); |
| | | } |
| | | }else { |
| | | throw new RuntimeException("请å
ç»´æ¤BOM"); |
| | | } |
| | | } |
| | | } |
| | |
| | | SalesLedgerProductTemplate salesLedgerProductTemplate = new SalesLedgerProductTemplate(); |
| | | BeanUtils.copyProperties(product, salesLedgerProductTemplate); |
| | | salesLedgerProductTemplate.setSalesLedgerId(purchaseLedgerTemplate.getId()); |
| | | salesLedgerProductTemplate.setType(2); |
| | | salesLedgerProductTemplateMapper.insert(salesLedgerProductTemplate); |
| | | }); |
| | | } |
| | |
| | | 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.delete_flag = 0 |
| | | 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}, '%') or cp.customer_name like concat('%', #{c.customerName}, '%')) |
| | | </if> |
| | | <if test="c.customerType != null"> |
| | | and c.customer_type = #{c.customerType} |
| | | </if> |
| | | <if test="c.boundId != null"> |
| | | and cpp.boundId = #{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> |
| | |
| | | select pri.*, |
| | | pr.description , |
| | | pp.name as process_name, |
| | | pp.is_inbound as inbound, |
| | | pp.is_report_work as reportWork, |
| | | pm.speculative_trading_name, |
| | | pm.product_id, |
| | | pm.model, |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.production.mapper.ProductOrderMaterialMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.production.pojo.ProductOrderMaterial"> |
| | | <id column="id" property="id" /> |
| | | <result column="tenant_id" property="tenantId" /> |
| | | <result column="process_name" property="processName" /> |
| | | <result column="material_name" property="materialName" /> |
| | | <result column="material_model" property="materialModel" /> |
| | | <result column="required_qty" property="requiredQty" /> |
| | | <result column="unit" property="unit" /> |
| | | <result column="pick_qty" property="pickQty" /> |
| | | <result column="supplement_qty" property="supplementQty" /> |
| | | <result column="return_qty" property="returnQty" /> |
| | | <result column="actual_qty" property="actualQty" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="create_user" property="createUser" /> |
| | | <result column="update_user" property="updateUser" /> |
| | | |
| | | </resultMap> |
| | | <select id="pickMaterial" resultType="com.ruoyi.production.pojo.ProductOrderMaterial"> |
| | | SELECT |
| | | si.id, |
| | | si.qualitity, |
| | | COALESCE(si.locked_quantity, 0) AS locked_quantity, |
| | | si.product_model_id, |
| | | si.create_time, |
| | | si.update_time, |
| | | COALESCE(si.warn_num, 0) AS warn_num, |
| | | si.version, |
| | | (si.qualitity - COALESCE(si.locked_quantity, 0)) AS un_locked_quantity, |
| | | pm.model, |
| | | si.remark, |
| | | pm.unit, |
| | | pm.uid_no AS uidNo, |
| | | p.product_name, |
| | | p1.product_name AS parentName, |
| | | si.batch_no, |
| | | si.customer |
| | | FROM |
| | | stock_inventory si |
| | | LEFT JOIN product_model pm ON si.product_model_id = pm.id |
| | | LEFT JOIN product p ON pm.product_id = p.id |
| | | LEFT JOIN product p1 ON p1.id = p.parent_id |
| | | </select> |
| | | |
| | | <select id="selectLeafNode" resultType="com.ruoyi.production.dto.ProductStructureDto"> |
| | | SELECT |
| | | ps.*, |
| | | p.product_name, |
| | | pp.NAME AS process_name, |
| | | pm.product_id, |
| | | pm.model |
| | | FROM |
| | | product_structure ps |
| | | LEFT JOIN product_model pm ON ps.product_model_id = pm.id |
| | | LEFT JOIN product p ON pm.product_id = p.id |
| | | LEFT JOIN product_process pp ON ps.process_id = pp.id |
| | | WHERE |
| | | ps.bom_id = #{bomId} |
| | | AND NOT EXISTS (SELECT 1 FROM product_structure ps_child WHERE ps_child.parent_id = ps.id AND ps_child.bom_id = 30) |
| | | ORDER BY |
| | | ps.id |
| | | </select> |
| | | |
| | | <select id="selectByProductModelIds" resultType="com.ruoyi.production.dto.ProductOrderMaterialDto"> |
| | | SELECT |
| | | si.id, |
| | | si.qualitity, |
| | | COALESCE(si.locked_quantity, 0) AS locked_quantity, |
| | | si.product_model_id, |
| | | si.create_time, |
| | | si.update_time, |
| | | COALESCE(si.warn_num, 0) AS warn_num, |
| | | si.version, |
| | | (si.qualitity - COALESCE(si.locked_quantity, 0)) AS un_locked_quantity, |
| | | pm.model as materialModel, |
| | | si.remark, |
| | | pm.unit, |
| | | pm.uid_no AS uidNo, |
| | | p.product_name as materialName, |
| | | p1.product_name AS parentName, |
| | | leaf.process_name, |
| | | leaf.id AS structure_id |
| | | FROM stock_inventory si |
| | | LEFT JOIN product_model pm ON si.product_model_id = pm.id |
| | | LEFT JOIN product p ON pm.product_id = p.id |
| | | LEFT JOIN product p1 ON p1.id = p.parent_id |
| | | INNER JOIN ( |
| | | SELECT |
| | | ps.product_model_id, |
| | | pp.name AS process_name, |
| | | ps.id |
| | | FROM product_structure ps |
| | | LEFT JOIN product_process pp ON ps.process_id = pp.id |
| | | WHERE ps.product_model_id IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | AND ps.id NOT IN ( |
| | | SELECT DISTINCT parent_id |
| | | FROM product_structure |
| | | WHERE parent_id IS NOT NULL |
| | | AND parent_id != 0 |
| | | AND product_model_id IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | )) |
| | | leaf ON leaf.product_model_id = si.product_model_id |
| | | ORDER BY si.id |
| | | </select> |
| | | </mapper> |
| | |
| | | <select id="listItem" resultType="com.ruoyi.production.dto.ProductProcessRouteItemDto"> |
| | | select ppri.*, |
| | | pp.name as process_name, |
| | | pp.is_inbound as inbound, |
| | | pp.is_report_work as reportWork, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name, |
| | |
| | | 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"> |