|
|
@@ -1,10 +1,14 @@
|
|
1
|
1
|
package api.controller.system;
|
|
2
|
2
|
|
|
|
3
|
+import api.entity.database.call.CallLog;
|
|
3
|
4
|
import api.entity.database.system.DictData;
|
|
|
5
|
+import api.entity.view.call.CallLogExportView;
|
|
4
|
6
|
import api.entity.view.order.WorkOrderBaseView;
|
|
5
|
7
|
import api.entity.view.system.CustomerView;
|
|
|
8
|
+import api.entity.view.system.CustomerViewExportView;
|
|
6
|
9
|
import api.service.system.IDictDataService;
|
|
7
|
10
|
import api.util.annotation.Anonymous;
|
|
|
11
|
+import api.util.helper.ExcelHelper;
|
|
8
|
12
|
import com.alibaba.fastjson2.JSON;
|
|
9
|
13
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
10
|
14
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
@@ -23,6 +27,7 @@ import lombok.var;
|
|
23
|
27
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
24
|
28
|
import org.springframework.web.bind.annotation.*;
|
|
25
|
29
|
|
|
|
30
|
+import java.time.temporal.ChronoUnit;
|
|
26
|
31
|
import java.util.ArrayList;
|
|
27
|
32
|
import java.util.Arrays;
|
|
28
|
33
|
import java.util.Date;
|
|
|
@@ -77,7 +82,60 @@ public class CustomerController extends BaseController {
|
|
77
|
82
|
return Success("成功", customerService.getList(qw));
|
|
78
|
83
|
}
|
|
79
|
84
|
}
|
|
|
85
|
+ @ApiOperation("导出Excel")
|
|
|
86
|
+ @Log(title = "导出excel", businessType = BusinessType.EXPORT)
|
|
|
87
|
+ @GetMapping("/exportExcel")
|
|
|
88
|
+ @Anonymous
|
|
|
89
|
+ public void ExportExcel(Customer input) {
|
|
|
90
|
+ LambdaQueryWrapper<Customer> qw = new LambdaQueryWrapper<>();
|
|
|
91
|
+ qw.eq(input.getCustomerId() != null && input.getCustomerId() > 0, Customer::getCustomerId, input.getCustomerId());
|
|
|
92
|
+ qw.like(!StringHelper.isEmpty(input.getCustomerName()), Customer::getCustomerName, input.getCustomerName());
|
|
|
93
|
+ qw.eq(!StringHelper.isEmpty(input.getCustomerSex()), Customer::getCustomerSex, input.getCustomerSex());
|
|
|
94
|
+ qw.like(!StringHelper.isEmpty(input.getCustomerPhone()), Customer::getCustomerPhone, input.getCustomerPhone());
|
|
|
95
|
+ qw.like(!StringHelper.isEmpty(input.getCustomerMobile()), Customer::getCustomerMobile, input.getCustomerMobile());
|
|
|
96
|
+ qw.like(!StringHelper.isEmpty(input.getCustomerNumber()), Customer::getCustomerNumber, input.getCustomerNumber());
|
|
|
97
|
+ qw.like(!StringHelper.isEmpty(input.getRemarks()), Customer::getRemarks, input.getRemarks());
|
|
|
98
|
+ qw.eq(Customer::getFIsdelete, 0);
|
|
|
99
|
+ qw.eq(input.getFCreatetime() != null , Customer::getFCreatetime, input.getFCreatetime());
|
|
|
100
|
+ qw.eq(input.getFUpdatetime() != null , Customer::getFUpdatetime, input.getFUpdatetime());
|
|
|
101
|
+ qw.eq(input.getType() != null && input.getType() > 0, Customer::getType, input.getType());
|
|
|
102
|
+ qw.like(!StringHelper.isEmpty(input.getIcon()), Customer::getIcon, input.getIcon());
|
|
|
103
|
+ qw.orderByDesc(Customer::getCustomerId);
|
|
|
104
|
+
|
|
|
105
|
+ var list=customerService.getList(qw);
|
|
80
|
106
|
|
|
|
107
|
+ List<CustomerViewExportView> customerView= JSON.parseArray(JSON.toJSONString(list),CustomerViewExportView.class);
|
|
|
108
|
+ int i=0;
|
|
|
109
|
+ if (customerView!=null && customerView.size()>0)
|
|
|
110
|
+ {
|
|
|
111
|
+ for (CustomerViewExportView customer : customerView) {
|
|
|
112
|
+
|
|
|
113
|
+ if (list.get(i ).getType()!=null)
|
|
|
114
|
+ {
|
|
|
115
|
+ if (list.get(i ).getType()==1)
|
|
|
116
|
+ {
|
|
|
117
|
+ customer.setTypeName("普通");
|
|
|
118
|
+ }
|
|
|
119
|
+ else if (list.get(i ).getType()==2)
|
|
|
120
|
+ {
|
|
|
121
|
+ customer.setTypeName("微信");
|
|
|
122
|
+ }
|
|
|
123
|
+ else
|
|
|
124
|
+ {
|
|
|
125
|
+ customer.setTypeName("官网");
|
|
|
126
|
+ }
|
|
|
127
|
+ if ( list.get(i ).getProject() != null && list.get(i ).getProject() > 0) {
|
|
|
128
|
+
|
|
|
129
|
+ DictData dicdata = dictDataService.getEntity(list.get(i ).getProject());
|
|
|
130
|
+ customer.setProjectname(dicdata.getDictLabel());
|
|
|
131
|
+ }
|
|
|
132
|
+ }
|
|
|
133
|
+ i++;
|
|
|
134
|
+ }
|
|
|
135
|
+ }
|
|
|
136
|
+ ExcelHelper<CustomerViewExportView> excel = new ExcelHelper<>(CustomerViewExportView.class);
|
|
|
137
|
+ excel.exportExcel("xlsx", customerView);
|
|
|
138
|
+ }
|
|
81
|
139
|
@ApiOperation("详情")
|
|
82
|
140
|
@Log(title = "查询sys_customer详情",businessType = BusinessType.QUERY)
|
|
83
|
141
|
@GetMapping("/{id}")
|