|
@@ -13,6 +13,8 @@ import com.fjhx.area.utils.CustomizeAreaUtil;
|
|
|
import com.fjhx.common.constant.SourceConstant;
|
|
|
import com.fjhx.common.entity.coding.bo.CustomerCodeAndCountryId;
|
|
|
import com.fjhx.common.service.coding.CodingRuleCustomerService;
|
|
|
+import com.fjhx.common.utils.excel.util.ExcelUtil;
|
|
|
+import com.fjhx.customer.entity.customer.CustomerExcelBo;
|
|
|
import com.fjhx.customer.entity.customer.dto.CustomerDto;
|
|
|
import com.fjhx.customer.entity.customer.dto.CustomerSelectDto;
|
|
|
import com.fjhx.customer.entity.customer.po.Customer;
|
|
@@ -29,6 +31,8 @@ import com.fjhx.file.utils.ObsFileUtil;
|
|
|
import com.fjhx.tenant.entity.dict.dto.DictTenantDataSelectDto;
|
|
|
import com.fjhx.tenant.entity.dict.vo.DictTenantDataVo;
|
|
|
import com.fjhx.tenant.service.dict.DictTenantDataService;
|
|
|
+import com.fjhx.tenant.utils.DeptUstil;
|
|
|
+import com.fjhx.tenant.utils.DictUtils;
|
|
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
@@ -41,6 +45,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -68,7 +73,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public List<CustomerVo> getList(IWrapper<Customer> wrapper) {
|
|
|
+ public List<CustomerVo> getList(IWrapper<CustomerVo> wrapper) {
|
|
|
return baseMapper.getList(wrapper);
|
|
|
}
|
|
|
|
|
@@ -106,16 +111,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|
|
return page;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 查询客户的列表
|
|
|
- *
|
|
|
- * @param dto
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- public Page<CustomerVo> getPage(CustomerSelectDto dto) {
|
|
|
-
|
|
|
- IWrapper<CustomerVo> wrapper = IWrapper.getWrapper();
|
|
|
+ private void setPageWrapper(IWrapper<CustomerVo> wrapper, CustomerSelectDto dto) {
|
|
|
|
|
|
// 客户来源查询
|
|
|
wrapper.eq("c", Customer::getSource, dto.getSource());
|
|
@@ -206,6 +202,20 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|
|
|
|
|
wrapper.orderByDesc("c", Customer::getAllocationTime);
|
|
|
wrapper.orderByDesc("c", Customer::getCreateTime);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询客户的列表
|
|
|
+ *
|
|
|
+ * @param dto
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Page<CustomerVo> getPage(CustomerSelectDto dto) {
|
|
|
+
|
|
|
+ IWrapper<CustomerVo> wrapper = IWrapper.getWrapper();
|
|
|
+
|
|
|
+ setPageWrapper(wrapper, dto);
|
|
|
|
|
|
Page<CustomerVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
|
|
@@ -233,6 +243,8 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|
|
}
|
|
|
|
|
|
// 赋值是否置顶
|
|
|
+ List<Long> customerIds = customerTopService.listObject(CustomerTop::getCustomerId,
|
|
|
+ q -> q.eq(CustomerTop::getUserId, SecurityUtils.getUserId()));
|
|
|
for (CustomerVo record : records) {
|
|
|
record.setIsTop(customerIds.contains(record.getId()) ? 1 : 0);
|
|
|
}
|
|
@@ -583,4 +595,39 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|
|
|
|
|
return customerVos;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void exportExcel(CustomerSelectDto dto, HttpServletResponse httpServletResponse) {
|
|
|
+ IWrapper<CustomerVo> wrapper = IWrapper.getWrapper();
|
|
|
+ setPageWrapper(wrapper, dto);
|
|
|
+ List<CustomerVo> list = getList(wrapper);
|
|
|
+ CustomizeAreaUtil.setAreaName(list);
|
|
|
+ UserUtil.assignmentNickName(list, CustomerVo::getUserId, CustomerVo::setUserName);
|
|
|
+
|
|
|
+ DeptUstil.assignmentNickName(list, Customer::getDeptId, CustomerVo::setDeptName);
|
|
|
+
|
|
|
+ Map<String, Map<String, String>> allDictMap = DictUtils.getAllDictKVMap();
|
|
|
+ for (CustomerVo customerVo : list) {
|
|
|
+ customerVo.setCompanySize(allDictMap.get("customer_scale").get(customerVo.getCompanySize()));
|
|
|
+ customerVo.setSettlementMode(allDictMap.get("settlement_way").get(customerVo.getSettlementMode()));
|
|
|
+ customerVo.setStatus(allDictMap.get("customer_status").get(customerVo.getStatus()));
|
|
|
+ customerVo.setLevel(allDictMap.get("customer_slevel").get(customerVo.getLevel()));
|
|
|
+ customerVo.setNewOld(allDictMap.get("newold_customer").get(customerVo.getNewOld()));
|
|
|
+ customerVo.setState(allDictMap.get("customer_state").get(customerVo.getState()));
|
|
|
+ customerVo.setSource(allDictMap.get("customer_source").get(customerVo.getSource()));
|
|
|
+ String tags = customerVo.getTag();
|
|
|
+ if (ObjectUtil.isNotEmpty(tags)) {
|
|
|
+ StringJoiner stringJoiner = new StringJoiner(",");
|
|
|
+ for (String tag : tags.split(",")) {
|
|
|
+ stringJoiner.add(allDictMap.get("customer_tag").get(tag));
|
|
|
+ }
|
|
|
+ customerVo.setTag(stringJoiner.toString());
|
|
|
+ }
|
|
|
+ customerVo.setInvoiceType(allDictMap.get("invoice_type").get(customerVo.getInvoiceType()));
|
|
|
+ customerVo.setCooperateStatus(allDictMap.get("cooperation_status").get(customerVo.getCooperateStatus()));
|
|
|
+ }
|
|
|
+
|
|
|
+ List<CustomerExcelBo> customerExcelBos = BeanUtil.copyToList(list, CustomerExcelBo.class);
|
|
|
+ ExcelUtil.export(httpServletResponse, customerExcelBos, CustomerExcelBo.class);
|
|
|
+ }
|
|
|
}
|