Merge remote-tracking branch 'origin/dev_New' into dev_New
已添加6个文件
已修改32个文件
已删除14个文件
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | drop table if exists customer_user; |
| | | create table customer_user |
| | | ( |
| | | id bigint auto_increment |
| | | primary key, |
| | | customer_id bigint not null default 0 comment '客æ·id', |
| | | user_id bigint not null default 0 comment 'ç¨æ·id', |
| | | create_time datetime null comment 'å½å
¥æ¶é´', |
| | | tenant_id bigint not null default 0 comment 'ç§æ·id' |
| | | ); |
| | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * è´¢å¡ç®¡ç--æ¶å
¥ç®¡ç |
| | |
| | | */ |
| | | @TableName(value = "account_income") |
| | | @Data |
| | | public class AccountIncome extends DateQueryDto implements Serializable { |
| | | public class AccountIncome extends DateQueryDto implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * æ¶å
¥ç±»å(é宿¶å
¥ï¼æå¡æ¶å
¥ï¼å
¶ä»æ¶å
¥) |
| | | */ |
| | | @Excel(name = "æ¶å
¥ç±»å",readConverterExp = "0=é宿¶å
¥,1=æå¡æ¶å
¥,2=å
¶ä»æ¶å
¥,3=忬¾æ¶å
¥") |
| | | @Excel(name = "æ¶å
¥ç±»å", readConverterExp = "0=é宿¶å
¥,1=æå¡æ¶å
¥,2=å
¶ä»æ¶å
¥,3=忬¾æ¶å
¥") |
| | | @NotBlank(message = "æ¶å
¥ç±»åä¸è½ä¸ºç©º!!") |
| | | private String incomeType; |
| | | |
| | |
| | | /** |
| | | * æ¶æ¬¾æ¹å¼(ç°éï¼æ¯ç¥¨ï¼é¶è¡è½¬è´¦ï¼å
¶ä») |
| | | */ |
| | | @Excel(name = "æ¶æ¬¾æ¹å¼",readConverterExp = "0=ç°é,1=æ¯ç¥¨,2=é¶è¡è½¬è´¦,3=å
¶ä»") |
| | | @Excel(name = "æ¶æ¬¾æ¹å¼", readConverterExp = "0=ç°é,1=æ¯ç¥¨,2=é¶è¡è½¬è´¦,3=å
¶ä»") |
| | | private String incomeMethod; |
| | | |
| | | /** |
| | | * æ¶æ¬¾æ¹å¼æ ç¾ |
| | | */ |
| | | @TableField(exist = false) |
| | | private String incomeMethodLabel; |
| | | |
| | | /** |
| | | * payment_methods åå
¸ç¼ç éåï¼business_type 为空æ¶ï¼ |
| | | */ |
| | | @TableField(exist = false) |
| | | private List<String> paymentMethodList; |
| | | |
| | | /** |
| | | * receipt_payment_type åå
¸ç¼ç éåï¼business_type=1æ¶ï¼ |
| | | */ |
| | | @TableField(exist = false) |
| | | private List<String> receiptPaymentMethodList; |
| | | |
| | | /** |
| | | * å票å·ç |
| | | */ |
| | | @Excel(name = "å票å·ç ") |
| | |
| | | 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.account.dto.AccountDto2; |
| | | import com.ruoyi.account.dto.AccountDto3; |
| | | import com.ruoyi.account.dto.ReportDateDto; |
| | | import com.ruoyi.account.mapper.AccountIncomeMapper; |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.account.service.AccountIncomeService; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.dto.DateQueryDto; |
| | | import com.ruoyi.project.system.domain.SysDictData; |
| | |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @AllArgsConstructor |
| | | @Service |
| | |
| | | //å页æ¥è¯¢ |
| | | @Override |
| | | public IPage<AccountIncome> accountIncomeListPage(Page page, AccountIncome accountIncome) { |
| | | resolveIncomeMethodLabelFilter(accountIncome); |
| | | return accountIncomeMapper.accountIncomeListPage(page,accountIncome); |
| | | } |
| | | |
| | | private void resolveIncomeMethodLabelFilter(AccountIncome accountIncome) { |
| | | if (accountIncome == null) { |
| | | return; |
| | | } |
| | | if (accountIncome.getIncomeMethodLabel() == null || accountIncome.getIncomeMethodLabel().trim().isEmpty()) { |
| | | return; |
| | | } |
| | | String targetLabel = accountIncome.getIncomeMethodLabel().trim(); |
| | | List<String> paymentMethodList = selectDictValuesByLabel("payment_methods", targetLabel); |
| | | List<String> receiptPaymentMethodList = selectDictValuesByLabel("receipt_payment_type", targetLabel); |
| | | if (paymentMethodList.isEmpty()) { |
| | | paymentMethodList = Collections.singletonList("__NO_MATCH__"); |
| | | } |
| | | if (receiptPaymentMethodList.isEmpty()) { |
| | | receiptPaymentMethodList = Collections.singletonList("__NO_MATCH__"); |
| | | } |
| | | accountIncome.setPaymentMethodList(paymentMethodList); |
| | | accountIncome.setReceiptPaymentMethodList(receiptPaymentMethodList); |
| | | accountIncome.setIncomeMethod(null); |
| | | } |
| | | |
| | | private List<String> selectDictValuesByLabel(String dictType, String label) { |
| | | return sysDictDataMapper.selectDictDataByType(dictType).stream() |
| | | .filter(item -> label.equals(item.getDictLabel())) |
| | | .map(SysDictData::getDictValue) |
| | | .filter(v -> v != null && !v.trim().isEmpty()) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | //å¯¼åº |
| | | @Override |
| | | public void accountIncomeExport(HttpServletResponse response, AccountIncome accountIncome) { |
| | |
| | | import com.ruoyi.approve.bean.vo.ApproveProcessConfigNodeVo; |
| | | import com.ruoyi.approve.bean.vo.ApproveProcessVO; |
| | | import com.ruoyi.approve.mapper.ApproveNodeMapper; |
| | | import com.ruoyi.approve.mapper.ApproveProcessConfigNodeMapper; |
| | | import com.ruoyi.approve.mapper.ApproveProcessMapper; |
| | | import com.ruoyi.approve.pojo.ApproveNode; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.approve.pojo.ApproveProcessConfigNode; |
| | | import com.ruoyi.approve.service.ApproveProcessConfigNodeService; |
| | | import com.ruoyi.approve.service.IApproveNodeService; |
| | | import com.ruoyi.approve.service.IApproveProcessService; |
| | |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | private final ApproveNodeMapper approveNodeMapper; |
| | | private final ApproveProcessConfigNodeService approveProcessConfigNodeService; |
| | | private final ApproveProcessConfigNodeMapper approveProcessConfigNodeMapper; |
| | | |
| | | @Override |
| | | public void addApprove(ApproveProcessVO approveProcessVO) throws Exception { |
| | |
| | | .last("limit 1"); |
| | | ApproveProcess approveProcess = approveProcessMapper.selectOne(approveProcessLambdaQueryWrapper); |
| | | if (approveProcess == null) throw new RuntimeException("è¯·éæ©å®¡æ¹äºº"); |
| | | String[] split = approveGetAndUpdateVo.getApproveUserIds().split(","); |
| | | if (split.length == 0) { |
| | | throw new RuntimeException("è¯·éæ©å®¡æ¹äºº"); |
| | | } |
| | | List<SysUser> sysUsers = sysUserMapper.selectUserByIds(Arrays.asList(split).stream().map(Long::parseLong).collect(Collectors.toList())); |
| | | //æ¥è¯¢å®¡æ¹é
ç½® |
| | | List<ApproveProcessConfigNode> approveProcessConfig = approveProcessConfigNodeMapper.selectList(new LambdaQueryWrapper<ApproveProcessConfigNode>().eq(ApproveProcessConfigNode::getApproveType, approveGetAndUpdateVo.getApproveType())); |
| | | List<Long> configNodeIds = approveProcessConfig.stream() |
| | | .sorted(Comparator.comparing(ApproveProcessConfigNode::getNodeOrder)) |
| | | .map(ApproveProcessConfigNode::getApproverId) |
| | | .collect(Collectors.toList()); |
| | | List<SysUser> sysUsers = sysUserMapper.selectUserByIds(configNodeIds); |
| | | if (CollectionUtils.isEmpty(sysUsers)) throw new RuntimeException("è¯·éæ©å®¡æ¹äºº"); |
| | | //å®¡æ ¸ä¸ä¸å¯ä»¥ç¼è¾å®¡æ ¸äºº |
| | | if (approveProcess.getApproveStatus() != 1) { |
| | | approveProcess.setApproveUserCurrentId(Long.parseLong(split[0])); |
| | | approveProcess.setApproveUserCurrentName(sysUsers.stream().filter(user -> user.getUserId().equals(Long.parseLong(split[0]))).collect(Collectors.toList()).get(0).getNickName()); |
| | | approveProcess.setApproveUserCurrentId(configNodeIds.get(0)); |
| | | approveProcess.setApproveUserCurrentName(sysUsers.stream().filter(user -> user.getUserId().equals(configNodeIds.get(0))).collect(Collectors.toList()).get(0).getNickName()); |
| | | } |
| | | if (approveGetAndUpdateVo.getApproveStatus() != null) { |
| | | approveProcess.setApproveStatus(approveGetAndUpdateVo.getApproveStatus()); |
| | |
| | | LambdaQueryWrapper<ApproveNode> approveNodeLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | approveNodeLambdaQueryWrapper.eq(ApproveNode::getApproveProcessId, approveProcess.getApproveId()) |
| | | .eq(ApproveNode::getDeleteFlag, 0) |
| | | // .eq(ApproveNode::getTenantId, SecurityUtils.getLoginUser().getTenantId()) |
| | | .orderByAsc(ApproveNode::getApproveNodeOrder); |
| | | approveNodeMapper.delete(approveNodeLambdaQueryWrapper); |
| | | //æ¥è¯¢å®¡æ¹é
ç½® |
| | | approveGetAndUpdateVo.setApproveUserIds(configNodeIds.stream() |
| | | .map(String::valueOf) |
| | | .collect(Collectors.joining(","))); |
| | | approveNodeService.initApproveNodes(approveGetAndUpdateVo.getApproveUserIds(), approveProcess.getApproveId(), approveProcess.getTenantId()); |
| | | /*æ¶æ¯éç¥*/ |
| | | String id = approveProcess.getApproveUserIds().split(",")[0]; |
| | | Long id = configNodeIds.get(0); |
| | | if (approveProcess.getApproveType()==8){ |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveProcess.getApproveId() + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | Collections.singletonList(id), |
| | | "/safeProduction/safeWorkApproval?approveType=" + approveProcess.getApproveType() + "&approveId=" + approveProcess.getApproveId()); |
| | | }else { |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveProcess.getApproveId() + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | Collections.singletonList(id), |
| | | "/collaborativeApproval/approvalProcess?approveType=" + approveProcess.getApproveType() + "&approveId=" + approveProcess.getApproveId()); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.basic.dto.CustomerDto; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.service.ICustomerService; |
| | | import com.ruoyi.basic.vo.CustomerVo; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | |
| | | */ |
| | | @GetMapping("/list") |
| | | public R list(Page<CustomerDto> page, CustomerDto customer) { |
| | | IPage<CustomerDto> customerDtoIPage = customerService.selectCustomerList(page, customer); |
| | | IPage<CustomerVo> customerDtoIPage = customerService.selectCustomerList(page, customer); |
| | | return R.ok(customerDtoIPage); |
| | | } |
| | | |
| | |
| | | */ |
| | | @Log(title = "å®¢æ·æ¡£æ¡", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, Customer customer) { |
| | | Long[] ids = customer.getIds(); |
| | | List<Customer> list; |
| | | if (ids != null && ids.length > 0) { |
| | | list = customerService.selectCustomerListByIds(ids); |
| | | } else { |
| | | list = customerService.selectCustomerLists(customer); |
| | | } |
| | | ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class); |
| | | util.exportExcel(response, list, "å®¢æ·æ¡£æ¡æ°æ®"); |
| | | public void export(HttpServletResponse response, CustomerDto customer) { |
| | | ExcelUtil<CustomerVo> util = new ExcelUtil<CustomerVo>(CustomerVo.class); |
| | | util.exportExcel(response, customerService.selectCustomerLists(customer), "å®¢æ·æ¡£æ¡æ°æ®"); |
| | | } |
| | | |
| | | @PostMapping("/downloadTemplate") |
| | |
| | | */ |
| | | @Log(title = "å®¢æ·æ¡£æ¡", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importData") |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | public AjaxResult importData(MultipartFile file, Integer type) throws Exception { |
| | | |
| | | return customerService.importData(file); |
| | | return customerService.importData(file, type); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | |
| | | } |
| | | /** |
| | | * åé
å®¢æ· |
| | | */ |
| | | @Log(title = "å®¢æ·æ¡£æ¡", businessType = BusinessType.OTHER) |
| | | @PostMapping("/assignCustomer") |
| | | public AjaxResult assignCustomer(@RequestBody CustomerDto customer) { |
| | | customerService.assignCustomer(customer); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * åæ¶å®¢æ· |
| | | */ |
| | | @Log(title = "å®¢æ·æ¡£æ¡", businessType = BusinessType.OTHER) |
| | | @PostMapping("/recycleCustomer") |
| | | public AjaxResult recycleCustomer(@RequestBody CustomerDto customer) { |
| | | customerService.recycleCustomer(customer); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * å
±äº«å®¢æ· |
| | | */ |
| | | @Log(title = "å®¢æ·æ¡£æ¡", businessType = BusinessType.OTHER) |
| | | @PostMapping("/together") |
| | | public AjaxResult together(@RequestBody CustomerDto customer) { |
| | | customerService.together(customer); |
| | | return AjaxResult.success(); |
| | | } |
| | | } |
| | |
| | | @ApiOperation("æ¥è¯¢å®¢æ·è·è¿å表") |
| | | public IPage<CustomerFollowUp> list(Page<CustomerFollowUp> page, CustomerFollowUp customerFollowUp) { |
| | | LambdaQueryWrapper<CustomerFollowUp> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(customerFollowUp.getCustomerPrivatePoolId() != null, CustomerFollowUp::getCustomerPrivatePoolId, customerFollowUp.getCustomerPrivatePoolId()) |
| | | queryWrapper.eq(customerFollowUp.getCustomerId() != null, CustomerFollowUp::getCustomerId, customerFollowUp.getCustomerId()) |
| | | .like(customerFollowUp.getFollowerUserName() != null, CustomerFollowUp::getFollowerUserName, customerFollowUp.getFollowerUserName()) |
| | | .orderByDesc(CustomerFollowUp::getFollowUpTime); |
| | | return customerFollowUpService.page(page, queryWrapper); |
| | |
| | | |
| | | private String togetherUserNames; |
| | | |
| | | } |
| | | /** |
| | | * å
±äº«ç¨æ·IDå表 |
| | | */ |
| | | private List<Long> userIds; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.CustomerDto; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.vo.CustomerVo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | */ |
| | | int deleteCustomerByIds(Long[] ids); |
| | | |
| | | IPage<CustomerDto> listPage(Page<CustomerDto> page, @Param("c") CustomerDto customer); |
| | | } |
| | | IPage<CustomerVo> listPage(Page<CustomerDto> page, @Param("c") CustomerDto customer, @Param("loginUserId") Long loginUserId); |
| | | |
| | | List<CustomerVo> list(@Param("c") CustomerDto customer, @Param("loginUserId") Long loginUserId); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.basic.pojo.CustomerUser; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * 客æ·å
±äº«Mapperæ¥å£ |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @date 2026-04-29 |
| | | */ |
| | | @Mapper |
| | | public interface CustomerUserMapper extends BaseMapper<CustomerUser> { |
| | | } |
| | |
| | | @ApiModelProperty(value = "使ç¨ç¶æ") |
| | | private Long usageStatus; |
| | | |
| | | @ApiModelProperty(value = "ç±»å 0 ç§æµ·å®¢æ· 1 å
¬æµ·å®¢æ·") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "æ¯å¦è¢«åé
ï¼0-æªåé
ï¼1-å·²åé
") |
| | | private Integer isAssigned; |
| | | } |
| | |
| | | /** |
| | | * å
³èçç§æµ·id |
| | | */ |
| | | private Long customerPrivatePoolId; |
| | | private Long customerId; |
| | | |
| | | /** |
| | | * è·è¿æ¹å¼ |
| | |
| | | /** |
| | | * å
³è客æ·ID |
| | | */ |
| | | private Integer customerPrivatePoolId; |
| | | private Long customerId; |
| | | |
| | | /** |
| | | * æéå¼å
³ (0:å
³é, 1:å¼å¯) |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @TableName(value = "customer_user") |
| | | @Data |
| | | public class CustomerUser implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * åºå· |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 客æ·id |
| | | */ |
| | | private Long customerId; |
| | | |
| | | /** |
| | | * ç¨æ·id |
| | | */ |
| | | private Long userId; |
| | | |
| | | /** |
| | | * ç§æ·id |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | /** |
| | | * å½å
¥æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.basic.pojo.CustomerUser; |
| | | |
| | | /** |
| | | * 客æ·å
±äº«Serviceæ¥å£ |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @date 2026-04-29 |
| | | */ |
| | | public interface CustomerUserService extends IService<CustomerUser> { |
| | | } |
| | |
| | | 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.basic.vo.CustomerVo; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | * @param id å®¢æ·æ¡£æ¡ä¸»é® |
| | | * @return 客æ·è¯¦æ
DTO |
| | | */ |
| | | Customer selectCustomerDetailById(Long id); |
| | | CustomerVo selectCustomerDetailById(Long id); |
| | | |
| | | /** |
| | | * æ¥è¯¢å®¢æ·æ¡£æ¡å表 |
| | |
| | | */ |
| | | List<Map<String, Object>> customerList(Customer customer); |
| | | |
| | | List<Customer> selectCustomerLists(Customer customer); |
| | | List<CustomerVo> selectCustomerLists(CustomerDto customer); |
| | | |
| | | AjaxResult importData(MultipartFile file); |
| | | AjaxResult importData(MultipartFile file, Integer type); |
| | | |
| | | IPage<CustomerDto> selectCustomerList(Page<CustomerDto> page, CustomerDto customer); |
| | | } |
| | | IPage<CustomerVo> selectCustomerList(Page<CustomerDto> page, CustomerDto customer); |
| | | |
| | | void assignCustomer(CustomerDto customer); |
| | | |
| | | void recycleCustomer(CustomerDto customer); |
| | | |
| | | /** |
| | | * å
±äº«å®¢æ·ç»å
¶ä»ç¨æ· |
| | | * |
| | | * @param customerDto 客æ·DTOï¼å
å«å®¢æ·IDåå
±äº«ç¨æ·IDåè¡¨ï¼ |
| | | */ |
| | | void together(CustomerDto customerDto); |
| | | } |
| | |
| | | } |
| | | |
| | | List<CustomerFollowUp> followUps = list(new LambdaQueryWrapper<CustomerFollowUp>() |
| | | .eq(CustomerFollowUp::getCustomerPrivatePoolId, customerId)); |
| | | .eq(CustomerFollowUp::getCustomerId, customerId)); |
| | | |
| | | if (followUps != null && !followUps.isEmpty()) { |
| | | for (CustomerFollowUp followUp : followUps) { |
| | |
| | | throw new ServiceException("客æ·IDä¸è½ä¸ºç©º"); |
| | | } |
| | | LambdaQueryWrapper<CustomerReturnVisit> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(CustomerReturnVisit::getCustomerPrivatePoolId, customerId); |
| | | queryWrapper.eq(CustomerReturnVisit::getCustomerId, customerId); |
| | | CustomerReturnVisit returnVisit = baseMapper.selectOne(queryWrapper); |
| | | |
| | | if (returnVisit == null) { |
| | |
| | | throw new ServiceException("客æ·IDä¸è½ä¸ºç©º"); |
| | | } |
| | | LambdaQueryWrapper<CustomerReturnVisit> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(CustomerReturnVisit::getCustomerPrivatePoolId, customerId); |
| | | queryWrapper.eq(CustomerReturnVisit::getCustomerId, customerId); |
| | | List<CustomerReturnVisit> returnVisits = baseMapper.selectList(queryWrapper); |
| | | |
| | | for (CustomerReturnVisit returnVisit : returnVisits) { |
| | |
| | | if (returnVisit == null) { |
| | | throw new ServiceException("å访æéæ°æ®ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (returnVisit.getCustomerPrivatePoolId() == null) { |
| | | if (returnVisit.getCustomerId() == null) { |
| | | throw new ServiceException("客æ·IDä¸è½ä¸ºç©º"); |
| | | } |
| | | if (returnVisit.getReminderTime() == null) { |
| | |
| | | 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.pojo.*; |
| | | import com.ruoyi.basic.service.CustomerFollowUpFileService; |
| | | import com.ruoyi.basic.service.CustomerFollowUpService; |
| | | import com.ruoyi.basic.service.CustomerReturnVisitService; |
| | | import com.ruoyi.basic.service.CustomerUserService; |
| | | import com.ruoyi.basic.service.ICustomerService; |
| | | import com.ruoyi.basic.vo.CustomerVo; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | @Autowired |
| | | private SalesLedgerMapper salesLedgerMapper; |
| | | @Autowired |
| | | private CustomerPrivatePoolMapper customerPrivatePoolMapper; |
| | | @Autowired |
| | | private CustomerMapper customerMapper; |
| | | |
| | | @Autowired |
| | |
| | | private CustomerFollowUpFileService customerFollowUpFileService; |
| | | @Autowired |
| | | private CustomerReturnVisitService customerReturnVisitService; |
| | | @Autowired |
| | | private CustomerUserService customerUserService; |
| | | |
| | | /** |
| | | * æ¥è¯¢å®¢æ·æ¡£æ¡ |
| | |
| | | * @return 客æ·è¯¦æ
DTO |
| | | */ |
| | | @Override |
| | | public Customer selectCustomerDetailById(Long id) { |
| | | return this.getById( id); |
| | | public CustomerVo selectCustomerDetailById(Long id) { |
| | | CustomerVo customerVo = new CustomerVo(); |
| | | BeanUtils.copyProperties(this.getById(id), customerVo); |
| | | |
| | | // æ¥è¯¢è·è¿è®°å½ |
| | | List<CustomerFollowUp> followUpList = customerFollowUpService.list( |
| | | new LambdaQueryWrapper<CustomerFollowUp>() |
| | | .eq(CustomerFollowUp::getCustomerId, id) |
| | | .orderByDesc(CustomerFollowUp::getFollowUpTime) |
| | | ); |
| | | if (!com.baomidou.mybatisplus.core.toolkit.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()); |
| | | |
| | | customerVo.setFollowUpList(followUpDtoList); |
| | | } |
| | | |
| | | return customerVo; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return å®¢æ·æ¡£æ¡ |
| | | */ |
| | | @Override |
| | | public IPage<CustomerDto> selectCustomerList(Page<CustomerDto> page, CustomerDto customer) { |
| | | IPage<CustomerDto> customerPage = customerMapper.listPage(page, customer); |
| | | public IPage<CustomerVo> selectCustomerList(Page<CustomerDto> page, CustomerDto customer) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | Long loginUserId = loginUser.getUserId(); |
| | | IPage<CustomerVo> customerPage = customerMapper.listPage(page, customer, loginUserId); |
| | | |
| | | List<CustomerDto> records = customerPage.getRecords(); |
| | | List<CustomerVo> records = customerPage.getRecords(); |
| | | if (CollectionUtils.isEmpty(records)) { |
| | | return customerPage; |
| | | } |
| | | |
| | | List<Long> customerIds = records.stream() |
| | | .map(CustomerDto::getId) |
| | | .map(CustomerVo::getId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toList()); |
| | | |
| | |
| | | followUp.getFollowUpTime().atZone(ZoneId.systemDefault()).toInstant() |
| | | )); |
| | | } |
| | | |
| | | // 转æ¢å
±äº«ç¨æ·IDå符串为List<Long> |
| | | String userIdsStr = c.getUserIdsStr(); |
| | | if (StringUtils.isNotEmpty(userIdsStr)) { |
| | | List<Long> userIds = Arrays.stream(userIdsStr.split(",")) |
| | | .map(String::trim) |
| | | .map(Long::parseLong) |
| | | .collect(Collectors.toList()); |
| | | c.setUserIds(userIds); |
| | | } |
| | | }); |
| | | } |
| | | |
| | |
| | | private Map<Long, CustomerFollowUp> getLatestFollowUpMap(List<Long> customerIds) { |
| | | List<CustomerFollowUp> followUps = customerFollowUpService.list( |
| | | new LambdaQueryWrapper<CustomerFollowUp>() |
| | | .in(CustomerFollowUp::getCustomerPrivatePoolId, customerIds) |
| | | .in(CustomerFollowUp::getCustomerId, customerIds) |
| | | .orderByDesc(CustomerFollowUp::getFollowUpTime) |
| | | ); |
| | | |
| | | return followUps.stream() |
| | | .collect(Collectors.toMap( |
| | | CustomerFollowUp::getCustomerPrivatePoolId, |
| | | CustomerFollowUp::getCustomerId, |
| | | 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("å®¢æ·æ¡£æ¡ä¸æå®¢æ·ç§æµ·ï¼è¯·å
æ¶åç§æµ·æ°æ®"); |
| | | // æ¥è¯¢æ¯å¦æå·²åé
çå
¬æµ·å®¢æ· |
| | | List<Customer> assignedPools = customerMapper.selectList( |
| | | new QueryWrapper<Customer>().lambda() |
| | | .in(Customer::getId, idList) |
| | | .eq(Customer::getType, 1). |
| | | eq(Customer::getIsAssigned, 1) // å
¬æµ·å®¢æ· |
| | | ); |
| | | if (!assignedPools.isEmpty()) { |
| | | throw new RuntimeException("å®¢æ·æ¡£æ¡ä¸æå·²åé
çå
¬æµ·å®¢æ·ï¼è¯·å
æ¶å"); |
| | | } |
| | | // å é¤å®¢æ·çåæ¶ä¹éè¦å é¤å¯¹åºç客æ·è·éãéä»¶åå访æé |
| | | // å é¤å®¢æ·çåæ¶ä¹éè¦å é¤å¯¹åºç客æ·è·éãéä»¶åå访æé |
| | | for (Long id : ids) { |
| | | customerFollowUpService.deleteByCustomerId(id); |
| | | customerReturnVisitService.deleteByCustomerId(id); |
| | | // å é¤å®¢æ·çå
±äº«å
³ç³» |
| | | customerUserService.remove( |
| | | new QueryWrapper<CustomerUser>().lambda() |
| | | .eq(CustomerUser::getCustomerId, id) |
| | | ); |
| | | } |
| | | |
| | | // å é¤å®¢æ·ä¸»è¡¨æ°æ® |
| | | return customerMapper.deleteBatchIds(idList); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Customer> selectCustomerLists(Customer customer) { |
| | | return customerMapper.selectList(null); |
| | | public List<CustomerVo> selectCustomerLists(CustomerDto customer) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | Long loginUserId = loginUser.getUserId(); |
| | | return customerMapper.list(customer, loginUserId); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult importData(MultipartFile file) { |
| | | public AjaxResult importData(MultipartFile file, Integer type) { |
| | | try { |
| | | ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class); |
| | | List<Customer> userList = util.importExcel(file.getInputStream()); |
| | | if (CollectionUtils.isEmpty(userList)) { |
| | | return AjaxResult.warn("模æ¿é误æå¯¼å
¥æ°æ®ä¸ºç©º"); |
| | | } |
| | | |
| | | // æ ¹æ® type åæ°è®¾ç½®å®¢æ·ç±»åï¼ç§æµ·/å
¬æµ·ï¼ |
| | | if (type != null) { |
| | | userList.forEach(customer -> { |
| | | customer.setType(type); |
| | | }); |
| | | } |
| | | this.saveOrUpdateBatch(userList); |
| | | return AjaxResult.success(true); |
| | |
| | | ).collect(Collectors.toList()); |
| | | } |
| | | |
| | | // åé
å
¬æµ·å®¢æ·ç»ç§æµ· |
| | | @Override |
| | | public void assignCustomer(CustomerDto customerDto) { |
| | | Customer customer = customerMapper.selectById(customerDto.getId()); |
| | | if (customer.getType() == 1 && customer.getIsAssigned() == 0) { // å
¬æµ·ä¸å¯åé
|
| | | customer.setIsAssigned(1); |
| | | customer.setUsageStatus(1L); |
| | | customer.setUsageUser(customerDto.getUsageUser()); |
| | | customerMapper.updateById(customer); |
| | | } |
| | | } |
| | | |
| | | // åæ¶ç§æµ·å®¢æ·å°å
¬æµ· |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void recycleCustomer(CustomerDto customerDto) { |
| | | Customer customer = customerMapper.selectById(customerDto.getId()); |
| | | if (customer.getType() == 1 && customer.getIsAssigned() == 1) { // å
¬æµ·ä¸å·²åé
|
| | | customer.setIsAssigned(0); |
| | | customer.setUsageStatus(0L); |
| | | customer.setUsageUser(0L); |
| | | customerMapper.updateById(customer); |
| | | |
| | | // å é¤è¯¥å®¢æ·çææå
±äº«å
³ç³» |
| | | customerUserService.remove( |
| | | new QueryWrapper<CustomerUser>().lambda() |
| | | .eq(CustomerUser::getCustomerId, customerDto.getId()) |
| | | ); |
| | | } |
| | | } |
| | | |
| | | // 客æ·å
񄧮 |
| | | @Override |
| | | public void together(CustomerDto customerDto) { |
| | | // æ¥è¯¢ç°æçå
±äº«è®°å½ |
| | | List<CustomerUser> existingUsers = customerUserService.list( |
| | | new QueryWrapper<CustomerUser>().lambda().eq(CustomerUser::getCustomerId, customerDto.getId()) |
| | | ); |
| | | |
| | | // è·åå·²åå¨çç¨æ·IDå表 |
| | | List<Long> existingUserIds = existingUsers.stream() |
| | | .map(CustomerUser::getUserId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // è¿æ»¤æå·²åå¨çç¨æ·ï¼åªä¿çæ°ç¨æ· |
| | | List<Long> newUserIds = customerDto.getUserIds().stream() |
| | | .filter(userId -> !existingUserIds.contains(userId)) |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (CollectionUtils.isEmpty(newUserIds)) { |
| | | return; |
| | | } |
| | | |
| | | // è·åå½åç§æ·ID |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | Long tenantId = loginUser.getTenantId(); |
| | | |
| | | // æ¹éä¿åæ°çå
±äº«è®°å½ |
| | | List<CustomerUser> customerUsers = newUserIds.stream() |
| | | .map(userId -> { |
| | | CustomerUser customerUser = new CustomerUser(); |
| | | customerUser.setCustomerId(customerDto.getId()); |
| | | customerUser.setUserId(userId); |
| | | customerUser.setTenantId(tenantId); |
| | | return customerUser; |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | |
| | | customerUserService.saveBatch(customerUsers); |
| | | } |
| | | |
| | | /** |
| | | * ä¸å线å½å转驼峰å½å |
| | | */ |
| | |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.service.impl; |
| | | |
| | | import com.ruoyi.basic.mapper.CustomerUserMapper; |
| | | import com.ruoyi.basic.pojo.CustomerUser; |
| | | import com.ruoyi.basic.service.CustomerUserService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * 客æ·å
±äº«Serviceå®ç°ç±» |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @date 2026-04-29 |
| | | */ |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class CustomerUserServiceImpl extends ServiceImpl<CustomerUserMapper, CustomerUser> implements CustomerUserService { |
| | | } |
| | |
| | | } |
| | | |
| | | try { |
| | | unipushService.sendReturnVisitReminder(returnVisitId, client.getCid(), returnVisit.getContent(), returnVisit.getCustomerPrivatePoolId()); |
| | | unipushService.sendReturnVisitReminder(returnVisitId, client.getCid(), returnVisit.getContent(), returnVisit.getCustomerId()); |
| | | CustomerReturnVisit updateObj = new CustomerReturnVisit(); |
| | | updateObj.setId(returnVisitId); |
| | | updateObj.setIsCompleted(1); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.vo; |
| | | |
| | | import com.ruoyi.basic.dto.CustomerFollowUpDto; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class CustomerVo extends Customer { |
| | | @ApiModelProperty(value = "è·è¿è®°å½") |
| | | private List<CustomerFollowUpDto> followUpList; |
| | | |
| | | private String usageUserName; |
| | | |
| | | private String togetherUserNames; |
| | | |
| | | /** |
| | | * å
±äº«ç¨æ·IDå表 |
| | | */ |
| | | private List<Long> userIds; |
| | | |
| | | /** |
| | | * å
±äº«ç¨æ·IDå符串ï¼SQLæ¥è¯¢è¿åï¼ç¨äºè½¬æ¢ä¸ºListï¼ |
| | | */ |
| | | private String userIdsStr; |
| | | } |
| | |
| | | dto.setDateStr(inspectionTask.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | |
| | | // åå§åä¸ä¸ªéä»¶å表 |
| | | dto.setCommonFileList(finalCommonFiles.stream().filter(commonFile -> commonFile.getType().equals(FileNameType.INSPECTION.getValue())).collect(Collectors.toList())); |
| | | dto.setCommonFileListAfter(finalCommonFiles.stream().filter(commonFile -> commonFile.getType().equals(FileNameType.INSPECTION_PRODUCTION_AFTER.getValue())).collect(Collectors.toList())); |
| | | dto.setCommonFileListBefore(finalCommonFiles.stream().filter(commonFile -> commonFile.getType().equals(FileNameType.INSPECTION_PRODUCTION_BEFORE.getValue())).collect(Collectors.toList())); |
| | | List<CommonFile> taskFiles = finalCommonFiles.stream() |
| | | .filter(commonFile -> Objects.equals(commonFile.getCommonId(), inspectionTask.getId())) |
| | | .collect(Collectors.toList()); |
| | | dto.setCommonFileList(taskFiles.stream() |
| | | .filter(commonFile -> Objects.equals(commonFile.getType(), FileNameType.INSPECTION.getValue())) |
| | | .collect(Collectors.toList())); |
| | | dto.setCommonFileListAfter(taskFiles.stream() |
| | | .filter(commonFile -> Objects.equals(commonFile.getType(), FileNameType.INSPECTION_PRODUCTION_AFTER.getValue())) |
| | | .collect(Collectors.toList())); |
| | | dto.setCommonFileListBefore(taskFiles.stream() |
| | | .filter(commonFile -> Objects.equals(commonFile.getType(), FileNameType.INSPECTION_PRODUCTION_BEFORE.getValue())) |
| | | .collect(Collectors.toList())); |
| | | |
| | | |
| | | return dto; |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper; |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.dto.StockUninventoryDto; |
| | | import com.ruoyi.stock.mapper.StockInventoryMapper; |
| | |
| | | import com.ruoyi.stock.service.StockInventoryService; |
| | | import com.ruoyi.stock.service.StockOutRecordService; |
| | | import com.ruoyi.stock.service.StockUninventoryService; |
| | | import com.ruoyi.stock.service.impl.StockInRecordServiceImpl; |
| | | import com.ruoyi.stock.service.impl.StockOutRecordServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | @Component |
| | | @RequiredArgsConstructor |
| | | public class StockUtils { |
| | | private final ProcurementRecordOutMapper procurementRecordOutMapper; |
| | | private final ProcurementRecordMapper procurementRecordMapper; |
| | | private final StockUninventoryService stockUninventoryService; |
| | | private final StockInventoryService stockInventoryService; |
| | | private final StockInRecordService stockInRecordService; |
| | |
| | | /** |
| | | * åéå访æé |
| | | */ |
| | | public void sendReturnVisitReminder(Long returnVisitId, String cid, String content, Integer customerId) { |
| | | public void sendReturnVisitReminder(Long returnVisitId, String cid, String content, Long customerId) { |
| | | String targetPath = "pages/cooperativeOffice/customerManage/detail?customerId=" + customerId; |
| | | sendRoutingPush(returnVisitId, cid, "客æ·å访æé", content, targetPath, false); |
| | | } |
| | |
| | | accountExpense.setSupplierName(purchaseLedger.getSupplierName()); |
| | | accountExpense.setExpenseMoney(paymentRegistration.getCurrentPaymentAmount()); |
| | | accountExpense.setExpenseDescribed("仿¬¾æ¯åº"); |
| | | accountExpense.setExpenseMethod("0"); |
| | | |
| | | accountExpense.setExpenseMethod(paymentRegistration.getPaymentMethod()); |
| | | accountExpense.setBusinessId(paymentRegistration.getId()); |
| | | accountExpense.setBusinessType(1); |
| | | accountExpense.setInputTime(new Date()); |
| | |
| | | @ApiModelProperty(value = "éè´§æ»æ°") |
| | | private BigDecimal totalReturnNum; |
| | | |
| | | private String supplierNameOrContractNo; |
| | | |
| | | } |
| | |
| | | @Excel(name = "客æ·åç§°") |
| | | private String customer; |
| | | |
| | | @ApiModelProperty(value = "客æ·id") |
| | | private Long customerId; |
| | | |
| | | @ApiModelProperty(value = "ä¸å¡å") |
| | | @Excel(name = "ä¸å¡å") |
| | | private String salesperson; |
| | |
| | | import com.ruoyi.account.service.AccountIncomeService; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.sales.dto.CustomerInteractionDto; |
| | | import com.ruoyi.sales.dto.InvoiceLedgerDto; |
| | | import com.ruoyi.sales.dto.ReceiptPaymentDto; |
| | | import com.ruoyi.sales.dto.ReceiptPaymentExeclDto; |
| | |
| | | import com.ruoyi.sales.mapper.ReceiptPaymentMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.pojo.InvoiceLedger; |
| | | import com.ruoyi.sales.pojo.ReceiptPayment; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | |
| | | import java.time.LocalDate; |
| | | import java.time.YearMonth; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class ReceiptPaymentServiceImpl extends ServiceImpl<ReceiptPaymentMapper,ReceiptPayment> implements ReceiptPaymentService { |
| | |
| | | accountIncome.setIncomeType("3"); |
| | | accountIncome.setCustomerName(salesLedger.getCustomerName()); |
| | | accountIncome.setIncomeMoney(receiptPayment.getReceiptPaymentAmount()); |
| | | accountIncome.setIncomeMethod("0"); |
| | | accountIncome.setIncomeMethod(receiptPayment.getReceiptPaymentType()); |
| | | accountIncome.setInputTime(new Date()); |
| | | accountIncome.setInputUser(salesLedger.getEntryPerson()); |
| | | accountIncome.setInputUser(SecurityUtils.getLoginUser().getNickName()); |
| | | accountIncome.setIncomeDescribed("忬¾æ¶å
¥"); |
| | | accountIncome.setBusinessId(Long.parseLong(receiptPayment.getId().toString())); |
| | | accountIncome.setBusinessType(1); |
| | |
| | | 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. æ ¡éªå®¢æ·ä¿¡æ¯ |
| | | CustomerPrivatePoolDto customer = customerPrivatePoolMapper.selectInfo(salesLedgerDto.getCustomerId()); |
| | | Customer customer = customerMapper.selectById(salesLedgerDto.getCustomerId()); |
| | | if (customer == null) { |
| | | throw new BaseException("客æ·ä¸åå¨"); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.approve.service.IApproveProcessService; |
| | | import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl; |
| | | import com.ruoyi.approve.bean.vo.ApproveGetAndUpdateVo; |
| | | import com.ruoyi.approve.bean.vo.ApproveProcessVO; |
| | | import com.ruoyi.basic.dto.CustomerPrivatePoolDto; |
| | | import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.uuid.UUID; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.sales.dto.SalesQuotationDto; |
| | | import com.ruoyi.sales.mapper.SalesQuotationMapper; |
| | |
| | | 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.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.EnumUtil; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.service.ShippingInfoService; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.dto.StockOutRecordDto; |
| | | import com.ruoyi.stock.dto.StockUninventoryDto; |
| | |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class StockOutRecordServiceImpl extends ServiceImpl<StockOutRecordMapper, StockOutRecord> implements StockOutRecordService { |
| | | private StockOutRecordMapper stockOutRecordMapper; |
| | | private StockInventoryMapper stockInventoryMapper; |
| | | private StockUninventoryMapper stockUninventoryMapper; |
| | | private final ShippingInfoService shippingInfoService; |
| | | private final StockOutRecordMapper stockOutRecordMapper; |
| | | private final StockInventoryMapper stockInventoryMapper; |
| | | private final StockUninventoryMapper stockUninventoryMapper; |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | |
| | | @Override |
| | | public IPage<StockOutRecordDto> listPage(Page page, StockOutRecordDto stockOutRecordDto) { |
| | |
| | | if ("13".equals(stockOutRecord.getRecordType())){ |
| | | // æ¤ä¸º éå®-åè´§åºåº 没æå
³èè®°å½æè½æåå é¤ |
| | | // æ¥è¯¢å¯¹åºæ¯å¦å«æéå®åºè´§è®°å½ |
| | | ShippingInfo byId = shippingInfoService.getById(stockOutRecord.getRecordId()); |
| | | ShippingInfo byId = shippingInfoMapper.selectById(stockOutRecord.getRecordId()); |
| | | Assert.isNull(byId, StrUtil.format("{}åå¨éå®åºè´§è®°å½,æ æ³å é¤!!!",stockOutRecord.getOutboundBatches())); |
| | | |
| | | } |
| | |
| | | <if test="accountIncome.incomeType != null and accountIncome.incomeType != '' "> |
| | | AND income_type = #{accountIncome.incomeType} |
| | | </if> |
| | | <if test="accountIncome.incomeMethod != null and accountIncome.incomeMethod != '' "> |
| | | <if test="accountIncome.incomeMethodLabel != null and accountIncome.incomeMethodLabel != ''"> |
| | | AND ( |
| | | ( |
| | | business_type = 1 |
| | | AND income_method in |
| | | <foreach collection="accountIncome.receiptPaymentMethodList" item="method" open="(" separator="," close=")"> |
| | | #{method} |
| | | </foreach> |
| | | ) |
| | | OR |
| | | ( |
| | | business_type is null |
| | | AND income_method in |
| | | <foreach collection="accountIncome.paymentMethodList" item="method" open="(" separator="," close=")"> |
| | | #{method} |
| | | </foreach> |
| | | ) |
| | | ) |
| | | </if> |
| | | <if test="(accountIncome.incomeMethodLabel == null or accountIncome.incomeMethodLabel == '') and accountIncome.incomeMethod != null and accountIncome.incomeMethod != '' "> |
| | | AND income_method = #{accountIncome.incomeMethod} |
| | | </if> |
| | | </select> |
| | |
| | | <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 id="listPage" resultType="com.ruoyi.basic.vo.CustomerVo"> |
| | | 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_user cu |
| | | left join sys_user u2 on cu.user_id = u2.user_id |
| | | where cu.customer_id = c.id |
| | | and cu.user_id != c.usage_user |
| | | ) as together_user_names, |
| | | ( |
| | | select group_concat(cu.user_id separator ',') |
| | | from customer_user cu |
| | | where cu.customer_id = c.id |
| | | and cu.user_id != c.usage_user |
| | | ) as user_ids_str |
| | | from customer c |
| | | left join sys_user u on c.usage_user = u.user_id |
| | | <where> |
| | |
| | | <if test="c.customerType != null and c.customerType != ''"> |
| | | and customer_type = #{c.customerType} |
| | | </if> |
| | | <!-- å
¬æµ·æ¥è¯¢ï¼type = 1ï¼å
¬æµ·å®¢æ·ï¼--> |
| | | <if test="c.type != null and c.type == 1"> |
| | | and type = #{c.type} |
| | | </if> |
| | | <!-- ç§æµ·æ¥è¯¢ï¼type = 0ï¼ç§æµ·å®¢æ·ï¼æè
type = 1ï¼å
¬æµ·å®¢æ·ï¼ä¸å·²è¢«åé
ï¼å¹¶ä¸æ¯èªå·±é¢ç¨ãèªå·±å建æè
å
±äº«ç»èªå·±çå®¢æ· --> |
| | | <if test="c.type != null and c.type == 0"> |
| | | and ( |
| | | (type = #{c.type} or (type = 1 and is_assigned = 1)) |
| | | and ( |
| | | c.usage_user = #{loginUserId} |
| | | or c.create_user = #{loginUserId} |
| | | or exists ( |
| | | select 1 from customer_user cu |
| | | where cu.customer_id = c.id |
| | | and cu.user_id = #{loginUserId} |
| | | ) |
| | | ) |
| | | ) |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | | <select id="list" resultType="com.ruoyi.basic.vo.CustomerVo"> |
| | | select |
| | | c.*, |
| | | u.user_name usage_user_name, |
| | | ( |
| | | select group_concat(u2.user_name separator ', ') |
| | | from customer_user cu |
| | | left join sys_user u2 on cu.user_id = u2.user_id |
| | | where cu.customer_id = c.id |
| | | and cu.user_id != c.usage_user |
| | | ) as together_user_names, |
| | | ( |
| | | select group_concat(cu.user_id separator ',') |
| | | from customer_user cu |
| | | where cu.customer_id = c.id |
| | | and cu.user_id != c.usage_user |
| | | ) as user_ids_str |
| | | from customer c |
| | | left join sys_user u on c.usage_user = u.user_id |
| | | <where> |
| | | <if test="c.ids != null and c.ids.length > 0"> |
| | | and c.id in |
| | | <foreach collection="c.ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | <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> |
| | | <!-- å
¬æµ·æ¥è¯¢ï¼type = 1ï¼å
¬æµ·å®¢æ·ï¼--> |
| | | <if test="c.type != null and c.type == 1"> |
| | | and type = #{c.type} |
| | | </if> |
| | | <!-- ç§æµ·æ¥è¯¢ï¼type = 0ï¼ç§æµ·å®¢æ·ï¼æè
type = 1ï¼å
¬æµ·å®¢æ·ï¼ä¸å·²è¢«åé
ï¼å¹¶ä¸æ¯èªå·±é¢ç¨ãèªå·±å建æè
å
±äº«ç»èªå·±çå®¢æ· --> |
| | | <if test="c.type != null and c.type == 0"> |
| | | and ( |
| | | (type = #{c.type} or (type = 1 and is_assigned = 1)) |
| | | and ( |
| | | c.usage_user = #{loginUserId} |
| | | or c.create_user = #{loginUserId} |
| | | or exists ( |
| | | select 1 from customer_user cu |
| | | where cu.customer_id = c.id |
| | | and cu.user_id = #{loginUserId} |
| | | ) |
| | | ) |
| | | ) |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | </where> |
| | | ORDER BY T1.payment_date,T1.create_time DESC |
| | | </select> |
| | | |
| | | <select id="supplierNameListPage" resultType="com.ruoyi.purchase.dto.PaymentRegistrationDto"> |
| | | SELECT |
| | | T1.supplier_id , |
| | | T1.supplier_id, |
| | | T1.supplier_name, |
| | | SUM(T1.contract_amount) AS invoiceAmount, |
| | | IFNULL(SUM(T2.current_payment_amount), 0) AS paymentAmount, |
| | | IFNULL(SUM(T1.contract_amount) - IFNULL(SUM(T2.current_payment_amount), 0), 0) AS payableAmount |
| | | T1.invoiceAmount, |
| | | IFNULL(T2.paymentAmount, 0) AS paymentAmount, |
| | | (T1.invoiceAmount - IFNULL(T2.paymentAmount, 0)) AS payableAmount |
| | | FROM ( |
| | | SELECT id,supplier_id, supplier_name, SUM(contract_amount) contract_amount |
| | | SELECT |
| | | supplier_id, |
| | | supplier_name, |
| | | SUM(contract_amount) AS invoiceAmount |
| | | FROM purchase_ledger |
| | | GROUP BY supplier_id, supplier_name,id |
| | | ) T1 |
| | | LEFT JOIN ( |
| | | SELECT purchase_ledger_id, SUM(current_payment_amount) current_payment_amount |
| | | FROM payment_registration |
| | | GROUP BY purchase_ledger_id |
| | | ) T2 ON T1.id = T2.purchase_ledger_id |
| | | <where> |
| | | <if test="req.supplierName != null and req.supplierName != '' "> |
| | | T1.supplier_name LIKE CONCAT ('%',#{req.supplierName},'%') |
| | | AND supplier_name LIKE CONCAT ('%',#{req.supplierName},'%') |
| | | </if> |
| | | </where> |
| | | GROUP BY T1.supplier_id, T1.supplier_name |
| | | GROUP BY supplier_id, supplier_name |
| | | ) T1 |
| | | LEFT JOIN ( |
| | | SELECT |
| | | supplier_id, |
| | | SUM(current_payment_amount) AS paymentAmount |
| | | FROM payment_registration |
| | | GROUP BY supplier_id |
| | | ) T2 ON T1.supplier_id = T2.supplier_id |
| | | </select> |
| | | |
| | | |
| | | <select id="supplierNameListPageDetails" resultType="com.ruoyi.purchase.dto.PaymentRegistrationDto"> |
| | | SELECT |
| | | T1.purchase_contract_number, |
| | | T1.contract_amount AS invoiceAmount, |
| | | IFNULL(SUM(T2.current_payment_amount), 0) AS paymentAmount, |
| | | IFNULL((T1.contract_amount - IFNULL(SUM(T2.current_payment_amount), 0)), 0) AS payableAmount, |
| | | T2.payment_date |
| | | FROM purchase_ledger T1 |
| | | INNER JOIN payment_registration T2 ON T1.id = T2.purchase_ledger_id |
| | | <where> |
| | | T1.supplier_id = #{req.supplierId} |
| | | <if test="req.supplierName != null and req.supplierName != '' "> |
| | | AND T1.supplier_name LIKE CONCAT ('%', #{req.supplierName}, '%') |
| | | </if> |
| | | </where> |
| | | GROUP BY T1.id, T1.purchase_contract_number, T1.contract_amount, T2.payment_date |
| | | SELECT |
| | | T2.id, |
| | | T1.purchase_contract_number, |
| | | T1.contract_amount AS invoiceAmount, |
| | | IFNULL(T2.current_payment_amount, 0) AS paymentAmount, |
| | | IFNULL(( |
| | | T1.contract_amount - IFNULL(( |
| | | SELECT SUM(T3.current_payment_amount) |
| | | FROM payment_registration T3 |
| | | WHERE T3.purchase_ledger_id = T1.id |
| | | AND ( |
| | | T3.payment_date < T2.payment_date |
| | | OR (T3.payment_date = T2.payment_date AND T3.id <= T2.id) |
| | | ) |
| | | ), 0) |
| | | ), 0) AS payableAmount, |
| | | T2.payment_date |
| | | FROM purchase_ledger T1 |
| | | INNER JOIN payment_registration T2 ON T1.id = T2.purchase_ledger_id |
| | | <where> |
| | | T1.supplier_id = #{req.supplierId} |
| | | <if test="req.supplierName != null and req.supplierName != '' "> |
| | | AND T1.supplier_name LIKE CONCAT ('%', #{req.supplierName}, '%') |
| | | </if> |
| | | </where> |
| | | ORDER BY T2.payment_date ASC, T2.id ASC |
| | | |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | </select> |
| | | |
| | | <select id="invoiceLedgerSalesAccount" resultType="com.ruoyi.sales.dto.InvoiceLedgerDto"> |
| | | SELECT |
| | | T1.customer_id AS id, |
| | | T1.customer_name, |
| | | SUM(T1.contract_amount) AS invoice_total, |
| | | IFNULL(SUM(T2.receipt_payment_amount), 0) AS receipt_payment_amount, |
| | | IFNULL(SUM(T1.contract_amount) - IFNULL(SUM(T2.receipt_payment_amount), 0), 0) AS unReceipt_payment_amount |
| | | FROM ( |
| | | SELECT id,customer_id, customer_name, SUM(contract_amount) contract_amount |
| | | FROM sales_ledger |
| | | GROUP BY customer_id, customer_name |
| | | ) T1 |
| | | LEFT JOIN ( |
| | | SELECT sales_ledger_id, SUM(receipt_payment_amount) receipt_payment_amount |
| | | FROM receipt_payment |
| | | GROUP BY sales_ledger_id |
| | | ) T2 ON T1.id = T2.sales_ledger_id |
| | | <where> |
| | | <if test="invoiceLedgerDto.searchText != null and invoiceLedgerDto.searchText != '' "> |
| | | T1.customer_name LIKE CONCAT('%',#{invoiceLedgerDto.searchText},'%') |
| | | </if> |
| | | </where> |
| | | GROUP BY T1.customer_id, T1.customer_name |
| | | SELECT |
| | | T1.customer_id AS id, |
| | | T1.customer_name, |
| | | T1.invoice_total, |
| | | IFNULL(T2.receipt_payment_amount, 0) AS receipt_payment_amount, |
| | | IFNULL(T1.invoice_total - IFNULL(T2.receipt_payment_amount, 0), 0) AS unReceipt_payment_amount |
| | | FROM ( |
| | | SELECT |
| | | customer_id, |
| | | customer_name, |
| | | SUM(contract_amount) AS invoice_total |
| | | FROM sales_ledger |
| | | GROUP BY customer_id, customer_name |
| | | ) T1 |
| | | LEFT JOIN ( |
| | | SELECT |
| | | T3.customer_id, |
| | | SUM(T2.receipt_payment_amount) AS receipt_payment_amount |
| | | FROM receipt_payment T2 |
| | | LEFT JOIN sales_ledger T3 ON T3.id = T2.sales_ledger_id |
| | | GROUP BY T3.customer_id |
| | | ) T2 ON T1.customer_id = T2.customer_id |
| | | <where> |
| | | <if test="invoiceLedgerDto.searchText != null and invoiceLedgerDto.searchText != '' "> |
| | | T1.customer_name LIKE CONCAT('%',#{invoiceLedgerDto.searchText},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="invoiceLedgerProductInfo" resultType="com.ruoyi.sales.dto.InvoiceRegistrationProductDto"> |
| | |
| | | |
| | | <select id="invoiceLedgerSalesAccount" resultType="com.ruoyi.sales.dto.InvoiceLedgerDto"> |
| | | SELECT |
| | | T2.id, |
| | | T1.sales_contract_no, |
| | | T1.contract_amount AS invoice_total, |
| | | IFNULL(SUM(T2.receipt_payment_amount), 0) AS receipt_payment_amount, |
| | | IFNULL((T1.contract_amount - IFNULL(SUM(T2.receipt_payment_amount), 0)), 0) AS unReceipt_payment_amount, |
| | | IFNULL(T2.receipt_payment_amount, 0) AS receipt_payment_amount, |
| | | IFNULL(( |
| | | T1.contract_amount - IFNULL(( |
| | | SELECT SUM(T3.receipt_payment_amount) |
| | | FROM receipt_payment T3 |
| | | WHERE T3.sales_ledger_id = T1.id |
| | | AND ( |
| | | T3.receipt_payment_date < T2.receipt_payment_date |
| | | OR (T3.receipt_payment_date = T2.receipt_payment_date AND T3.id <= T2.id) |
| | | ) |
| | | ), 0) |
| | | ), 0) AS unReceipt_payment_amount, |
| | | T2.receipt_payment_date |
| | | FROM sales_ledger T1 |
| | | INNER JOIN receipt_payment T2 ON T1.id = T2.sales_ledger_id |
| | |
| | | AND T1.customer_name LIKE CONCAT ('%', #{invoiceLedgerDto.searchText}, '%') |
| | | </if> |
| | | </where> |
| | | GROUP BY T1.id, T1.sales_contract_no, T1.contract_amount, T2.receipt_payment_date |
| | | ORDER BY T2.receipt_payment_date ASC, T2.id ASC |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <if test="req.status != null and req.status "> |
| | | AND slp.pending_tickets_total > 0 |
| | | </if> |
| | | <if test="req.supplierNameOrContractNo != null and req.supplierNameOrContractNo != ''"> |
| | | AND (sl.supplier_name like concat('%',#{req.supplierNameOrContractNo},'%') or |
| | | sl.purchase_contract_number like concat('%',#{req.supplierNameOrContractNo},'%')) |
| | | </if> |
| | | </where> |
| | | order by slp.register_date desc |
| | | </select> |
| | |
| | | FROM sales_quotation t1 |
| | | LEFT JOIN approve_process t2 ON t1.quotation_no = t2.approve_reason and t2.approve_type = 6 |
| | | WHERE 1=1 |
| | | and t2.approve_deleted = 0 |
| | | <if test="salesQuotationDto.quotationNo != null and salesQuotationDto.quotationNo != '' "> |
| | | AND t1.quotation_no LIKE CONCAT('%',#{salesQuotationDto.quotationNo},'%') |
| | | </if> |