|
|
@@ -0,0 +1,136 @@
|
|
|
+package com.fdkankan.agent.service.impl;
|
|
|
+
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
+import com.alibaba.excel.ExcelWriter;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.fdkankan.agent.common.PageInfo;
|
|
|
+import com.fdkankan.agent.common.RequestBase;
|
|
|
+import com.fdkankan.agent.entity.ContactUs;
|
|
|
+import com.fdkankan.agent.entity.ContactUsPoint;
|
|
|
+import com.fdkankan.agent.mapper.IContactUsMapper;
|
|
|
+import com.fdkankan.agent.request.ContactUsParam;
|
|
|
+import com.fdkankan.agent.response.*;
|
|
|
+import com.fdkankan.agent.service.IContactUsPointService;
|
|
|
+import com.fdkankan.agent.service.IContactUsService;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fdkankan.agent.service.IExcelService;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author
|
|
|
+ * @since 2025-10-21
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class ContactUsServiceImpl extends ServiceImpl<IContactUsMapper, ContactUs> implements IContactUsService {
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ IExcelService excelService;
|
|
|
+ @Autowired
|
|
|
+ IContactUsPointService contactUsPointService;
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Object pageList(RequestBase requestBase) {
|
|
|
+ LambdaQueryWrapper<ContactUs> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.orderByDesc(ContactUs::getId);
|
|
|
+ Page<ContactUs> page = this.page(new Page<>(requestBase.getPageNum(), requestBase.getPageSize()),wrapper);
|
|
|
+ return PageInfo.PageInfo(page);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void export(HttpServletRequest req, HttpServletResponse resp, String lang) {
|
|
|
+ List<ContactUs> list = this.list();
|
|
|
+ ExcelWriter excelWriter = null;
|
|
|
+ try {
|
|
|
+ if("en".equals(lang)){
|
|
|
+ List<ContactUsVoEn> listen = new ArrayList<>();
|
|
|
+ for (ContactUs entity : list) {
|
|
|
+ ContactUsVoEn en = new ContactUsVoEn();
|
|
|
+ BeanUtils.copyProperties(entity,en);
|
|
|
+ listen.add(en);
|
|
|
+ }
|
|
|
+ excelWriter = EasyExcel.write(resp.getOutputStream(), ContactUsVoEn.class).build();
|
|
|
+ excelService.commonExport(req,resp,"user",listen,excelWriter);
|
|
|
+ }else {
|
|
|
+ List<ContactUsVo> listVo = new ArrayList<>();
|
|
|
+ for (ContactUs entity : list) {
|
|
|
+ ContactUsVo en = new ContactUsVo();
|
|
|
+ BeanUtils.copyProperties(entity,en);
|
|
|
+ listVo.add(en);
|
|
|
+ }
|
|
|
+ excelWriter = EasyExcel.write(resp.getOutputStream(), ContactUsVo.class).build();
|
|
|
+ excelService.commonExport(req,resp,"意向用户",listVo,excelWriter);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }finally {
|
|
|
+ if(excelWriter != null){
|
|
|
+ excelWriter.finish();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Object pointPageList(ContactUsParam param) {
|
|
|
+ LambdaQueryWrapper<ContactUsPoint> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ if(StringUtils.isNotBlank(param.getUtmSource())){
|
|
|
+ wrapper.like(ContactUsPoint::getUtmSource,param.getUtmSource());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(param.getStartTime())){
|
|
|
+ wrapper.ge(ContactUsPoint::getCreateTime,param.getStartTime());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(param.getEndTime())){
|
|
|
+ wrapper.le(ContactUsPoint::getCreateTime,param.getEndTime());
|
|
|
+ }
|
|
|
+ Page<ContactUsPoint> page = contactUsPointService.page(new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
|
|
|
+ return PageInfo.PageInfo(page);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void exportPoint(HttpServletRequest req, HttpServletResponse resp, String lang) {
|
|
|
+ List<ContactUsPoint> list = contactUsPointService.list();
|
|
|
+ ExcelWriter excelWriter = null;
|
|
|
+ try {
|
|
|
+ if("en".equals(lang)){
|
|
|
+ List<ContactUsPointVoEn> listen = new ArrayList<>();
|
|
|
+ for (ContactUsPoint entity : list) {
|
|
|
+ ContactUsPointVoEn en = new ContactUsPointVoEn();
|
|
|
+ BeanUtils.copyProperties(entity,en);
|
|
|
+ listen.add(en);
|
|
|
+ }
|
|
|
+ excelWriter = EasyExcel.write(resp.getOutputStream(), ContactUsPointVoEn.class).build();
|
|
|
+ excelService.commonExport(req,resp,"page",listen,excelWriter);
|
|
|
+ }else {
|
|
|
+ List<ContactUsPointVo> listVo = new ArrayList<>();
|
|
|
+ for (ContactUsPoint entity : list) {
|
|
|
+ ContactUsPointVo en = new ContactUsPointVo();
|
|
|
+ BeanUtils.copyProperties(entity,en);
|
|
|
+ listVo.add(en);
|
|
|
+ }
|
|
|
+ excelWriter = EasyExcel.write(resp.getOutputStream(), ContactUsPointVo.class).build();
|
|
|
+ excelService.commonExport(req,resp,"页面分析",listVo,excelWriter);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }finally {
|
|
|
+ if(excelWriter != null){
|
|
|
+ excelWriter.finish();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|