# CustomerScoreServiceImpl.java

    package cloud.wconnect.workperformance.service.monthlyreport.impl;

    import cloud.wconnect.commonlib.pojo.dto.PropertyDTO;
    import cloud.wconnect.workperformance.entity.monthlyreport.CustomerScore;
    import cloud.wconnect.workperformance.entity.monthlyreport.MonthlyReport;
    import cloud.wconnect.workperformance.mapper.monthlyreport.CustomerScoreMapper;
    import cloud.wconnect.workperformance.service.monthlyreport.ICustomerScoreService;
    import cloud.wconnect.workperformance.service.monthlyreport.IHandlePropertySettingChange;
    import com.baomidou.dynamic.datasource.annotation.DS;
    import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
    import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
    import org.apache.commons.collections.CollectionUtils;
    import org.springframework.stereotype.Service;

    import java.util.List;

    /**
     * <p>
     * 月报Customer Satisfaction（客户满意度）区域，客户较低评分说明表 服务实现类
     * </p>
     *
     * @author lichen
     * @since 2023-09-01
     */
    @Service
    @DS("monthly_report")
    public class CustomerScoreServiceImpl extends ServiceImpl<CustomerScoreMapper, CustomerScore> implements ICustomerScoreService, IHandlePropertySettingChange {

        /**
         * 查询客户评分
         *
         * @param propertyId 资产id
         * @param reportId   月报id
         * @return java.util.List<cloud.wconnect.workperformance.entity.monthlyreport.CustomerScore>
         * @author lichen
         * @date 2023/9/4
         */
        @Override
        public List<CustomerScore> listByReportId(Integer propertyId, Long reportId) {
            return list(new LambdaQueryWrapper<CustomerScore>()
                    .eq(CustomerScore::getReportId, reportId)
                    .eq(CustomerScore::getPropertyId, propertyId)
                    .orderByAsc(CustomerScore::getId));
        }

        /**
         * 删除区域数据
         *
         * @param propertyDTO    资产DTO
         * @param monthlyReports 月报集合
         * @return void
         * @author lichen
         * @date 2023/9/5
         */
        @Override
        public void delete(PropertyDTO propertyDTO, List<MonthlyReport> monthlyReports) {
            List<Long> reportIds = monthlyReports.stream().map(MonthlyReport::getId).toList();
            if (CollectionUtils.isEmpty(reportIds)) return;
            remove(new LambdaQueryWrapper<CustomerScore>()
                    .in(CustomerScore::getReportId, reportIds)
                    .eq(CustomerScore::getPropertyId, propertyDTO.getId()));
        }
    }