@@ -42,15 +42,15 @@ public class CustomerCompanyServiceImpl implements CustomerCompanyService {
public Result insert(CustomerCompanyVO company) {
CustomerCompany temp = new CustomerCompany();
Result result = new Result();
int flag=0;
try{
int flag = 0;
try {
BeanUtils.copyProperties(company, temp);
flag = customerCompanyMapper.insert(temp);
}catch (Exception e){
} catch (Exception e) {
}
// 判断数据库操作是否成功
if(SqlHelper.retBool(flag)){
if (SqlHelper.retBool(flag)) {
result.setCode("0");
} else {
result.setCode("-1");
@@ -63,17 +63,17 @@ public class CustomerCompanyServiceImpl implements CustomerCompanyService {
public Result delete(String companyId) {
CustomerCompany temp;
Result result = new Result();
int flag=0;
int flag = 0;
try {
// 将deleted字段设置为1
temp = customerCompanyMapper.selectById(companyId);
if(temp==null){
if (temp == null) {
result.setCode("-1");
result.setMessage("未查找到此企业/服务商");
return result;
}
temp.setSysDeleted((short) 1);
flag =customerCompanyMapper.updateById(temp);
flag = customerCompanyMapper.updateById(temp);
} catch (Exception e) {
}
@@ -90,11 +90,11 @@ public class CustomerCompanyServiceImpl implements CustomerCompanyService {
public Result update(CustomerCompanyVO company) {
CustomerCompany temp = new CustomerCompany();
Result result = new Result();
int flag=0;
try{
int flag = 0;
try {
BeanUtils.copyProperties(company, temp);
flag = customerCompanyMapper.updateById(temp);
}catch(Exception e){
} catch (Exception e) {
}
// 判断数据库操作是否成功
@@ -111,20 +111,19 @@ public class CustomerCompanyServiceImpl implements CustomerCompanyService {
public DataResult<CustomerCompanyVO> queryCompanyByCompanyId(String companyId) {
CustomerCompanyVO customerCompanyVO = new CustomerCompanyVO();
DataResult<CustomerCompanyVO> result = new DataResult<>();
try{
try {
CustomerCompany temp = customerCompanyMapper.selectById(companyId);
// 这个已经被删除
if (temp == null || temp.getSysDeleted() == 1){
if (temp == null || temp.getSysDeleted() == 1) {
result.setCode("-1");
result.setMessage("企业不存在/已删除");
return result;
}
else {
} else {
BeanUtils.copyProperties(temp, customerCompanyVO);
result.setCode("0");
result.setData(customerCompanyVO);
}
}catch(Exception e){
} catch (Exception e) {
}
return result;
@@ -136,7 +135,7 @@ public class CustomerCompanyServiceImpl implements CustomerCompanyService {
List<CustomerCompanyVO> companyVOs = new ArrayList<>();
IPage<CustomerCompany> page = new Page<>(current, size);
QueryWrapper<CustomerCompany> queryWrapper = new QueryWrapper<>();
try{
try {
queryWrapper.orderByDesc("sys_create_time");
queryWrapper.eq("sys_deleted", 0);
queryWrapper.eq("type", type);
@@ -153,7 +152,7 @@ public class CustomerCompanyServiceImpl implements CustomerCompanyService {
result.setTotal(page.getTotal());
result.setCurrent(current);
result.setSize(size);
}catch (Exception e){
} catch (Exception e) {
}
return result;
@@ -165,7 +164,7 @@ public class CustomerCompanyServiceImpl implements CustomerCompanyService {
List<CustomerCompanyVO> companyVOs = new ArrayList<>();
IPage<CustomerCompany> page = new Page<>(current, size);
QueryWrapper<CustomerCompany> wrapper = new QueryWrapper<>();
try{
try {
wrapper.orderByDesc("sys_create_time");
wrapper.eq("sys_deleted", 0);
wrapper.eq("type", 0);
@@ -185,7 +184,7 @@ public class CustomerCompanyServiceImpl implements CustomerCompanyService {
result.setTotal(page.getTotal());
result.setCurrent(current);
result.setSize(size);
}catch (Exception e){
} catch (Exception e) {
}
return result;
@@ -197,7 +196,7 @@ public class CustomerCompanyServiceImpl implements CustomerCompanyService {
List<CustomerCompanyVO> companyVOs = new ArrayList<>();
IPage<CustomerCompany> page = new Page<>(current, size);
QueryWrapper<CustomerCompany> wrapper = new QueryWrapper<>();
try{
try {
// 关联服务商
if (!StringUtils.isEmpty(serviceProviderName)) {
QueryWrapper<CustomerCompany> queryWrapper = new QueryWrapper<>();
@@ -230,7 +229,7 @@ public class CustomerCompanyServiceImpl implements CustomerCompanyService {
for (CustomerCompany company : companys) {
t = new CustomerCompanyVO();
BeanUtils.copyProperties(company, t);
tt=csService.queryCsByCompanyId(company.getCustomerId());
tt = csService.queryCsByCompanyId(company.getCustomerId());
if (tt.getCode().equals("0")) {
t.setServiceProviderId(tt.getData().getServiceProviderId());
}
@@ -241,7 +240,57 @@ public class CustomerCompanyServiceImpl implements CustomerCompanyService {
result.setTotal(page.getTotal());
result.setCurrent(current);
result.setSize(size);
}catch (Exception e){
} catch (Exception e) {
}
return result;
}
@Override
public PageResult<CustomerCompanyVO> queryCompanysPageByServiceProviderIdAndNameAndStatus(String serviceProviderId, String name, Integer status, Long current, Integer size) {
PageResult<CustomerCompanyVO> result = new PageResult<>();
List<CustomerCompanyVO> companyVOs = new ArrayList<>();
IPage<CustomerCompany> page = new Page<>(current, size);
QueryWrapper<CustomerCompany> wrapper = new QueryWrapper<>();
try {
//根据服务商Id与企业Id的对应情况查企业Id
QueryWrapper<CustomerServiceProviderEnterprise> tempWrapper = new QueryWrapper<>();
tempWrapper.eq("service_provider_id", serviceProviderId);
List<CustomerServiceProviderEnterprise> temp = customerServiceProviderEnterpriseMapper.selectList(tempWrapper);
List<String> companyIds = new ArrayList<>();
for (CustomerServiceProviderEnterprise tt : temp) {
companyIds.add(tt.getEnterpriseId());
}
wrapper.in("customer_id", companyIds);
if (status != 0) {
wrapper.eq("status", status);
}
if (!StringUtils.isEmpty(name)) {
wrapper.like("name", name);
}
wrapper.orderByDesc("sys_create_time");
wrapper.eq("sys_deleted", 0);
wrapper.eq("type", 1);
customerCompanyMapper.selectPage(page, wrapper);
List<CustomerCompany> companys = page.getRecords();
CustomerCompanyVO t;
DataResult<CustomerServiceProviderEnterpriseVO> tt;
for (CustomerCompany company : companys) {
t = new CustomerCompanyVO();
BeanUtils.copyProperties(company, t);
tt = csService.queryCsByCompanyId(company.getCustomerId());
if (tt.getCode().equals("0")) {
t.setServiceProviderId(tt.getData().getServiceProviderId());
}
companyVOs.add(t);
}
result.setCode("0");
result.setDataList(companyVOs);
result.setTotal(page.getTotal());
result.setCurrent(current);
result.setSize(size);
} catch (Exception e) {
}
return result;
@@ -249,9 +298,9 @@ public class CustomerCompanyServiceImpl implements CustomerCompanyService {
@Override
public PageResult<CompanyAuditVO> getCompanyAuditsPage(Long current, Integer size) {
PageResult<CompanyAuditVO> result= new PageResult<>();
PageResult<CompanyAuditVO> result = new PageResult<>();
Page<CompanyAudit> page = new Page<>(current, size);
try{
try {
List<CompanyAudit> companyAudits = customerCompanyMapper.selectCompanyAuditPage(page);
List<CompanyAuditVO> companyAuditVOList = new ArrayList<>();
CompanyAuditVO temp;
@@ -265,7 +314,7 @@ public class CustomerCompanyServiceImpl implements CustomerCompanyService {
result.setTotal(page.getTotal());
result.setCurrent(current);
result.setSize(size);
}catch (Exception e){
} catch (Exception e) {
}
return result;
@@ -273,9 +322,9 @@ public class CustomerCompanyServiceImpl implements CustomerCompanyService {
@Override
public PageResult<CompanyAuditVO> queryCompanysPageByNameAndStatusAndCreateTime(String name, Integer status, Date startTime, Date endTime, Long current, Integer size) {
PageResult<CompanyAuditVO> result= new PageResult<>();
PageResult<CompanyAuditVO> result = new PageResult<>();
Page<CompanyAudit> page = new Page<>(current, size);
try{
try {
List<CompanyAudit> companyAudits = customerCompanyMapper.queryCompanyAuditPageByNameAndStatusAndCreateTime(page, name, status, startTime, endTime);
List<CompanyAuditVO> companyAuditVOList = new ArrayList<>();
@@ -290,18 +339,18 @@ public class CustomerCompanyServiceImpl implements CustomerCompanyService {
result.setTotal(page.getTotal());
result.setCurrent(current);
result.setSize(size);
}catch(Exception e){
} catch (Exception e) {
}
return result;
}
@Override
public PageResult<CompanyAuditVO> queryCluesPageOfContractUserByCreateTimeAndBusinessContactAndPhoneNumberAndFollowAndSourceAndPush(Date startTime, Date endTime, String businessContact, String phoneNumber, Integer follow, Integer re source, Integer push, Long current, Integer size) {
PageResult<CompanyAuditVO> result= new PageResult<>();
public PageResult<CompanyAuditVO> queryCluesPageOfContractUserByCreateTimeAndBusinessContactAndPhoneNumberAndFollowAndSourceAndPush(Date startTime, Date endTime, String businessContact, String phoneNumber, Integer follow, Integer source, Integer push, Long current, Integer size) {
PageResult<CompanyAuditVO> result = new PageResult<>();
Page<CompanyAudit> page = new Page<>(current, size);
try{
List<CompanyAudit> companyAudits = customerCompanyMapper.queryCluesPageOfContractUserByCreateTimeAndNameAndPhoneAndFollowAndSourceAndPush(page,startTime,endTime,businessContact,phoneNumber,follow,resource, push);
try {
List<CompanyAudit> companyAudits = customerCompanyMapper.queryCluesPageOfContractUserByCreateTimeAndNameAndPhoneAndFollowAndSourceAndPush(page, startTime, endTime, businessContact, phoneNumber, follow, source, push);
List<CompanyAuditVO> companyAuditVOList = new ArrayList<>();
CompanyAuditVO temp;
for (CompanyAudit companyAudit : companyAudits) {
@@ -314,7 +363,7 @@ public class CustomerCompanyServiceImpl implements CustomerCompanyService {
result.setTotal(page.getTotal());
result.setCurrent(current);
result.setSize(size);
}catch(Exception e){
} catch (Exception e) {
}
return result;