|
@@ -8,23 +8,14 @@ import cn.com.ty.lift.enterprise.custom.dao.entity.model.PropertyCompanyReq;
|
|
|
import cn.com.ty.lift.enterprise.custom.dao.mapper.PropertyCompanyMapper;
|
|
|
import cn.com.ty.lift.enterprise.custom.service.PropertyCompanyService;
|
|
|
import cn.com.xwy.boot.web.dto.RestResponse;
|
|
|
-import cn.hutool.poi.excel.ExcelUtil;
|
|
|
-import cn.hutool.poi.excel.ExcelWriter;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-import org.springframework.web.client.RestTemplate;
|
|
|
-
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -44,6 +35,8 @@ public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMappe
|
|
|
PropertyCompany byId = this.getById(id);
|
|
|
if (byId.getStatus() == 2) {
|
|
|
return RestResponse.ok(null, "0", "有正在服务的关联项目,无法删除");
|
|
|
+ } else if (this.getBaseMapper().selectProjectCount() != null && this.getBaseMapper().selectProjectCount().get("count") > 0) {
|
|
|
+ return RestResponse.ok(null, "0", "有正在服务的关联项目,无法删除");
|
|
|
} else {
|
|
|
byId.setStatus(0);
|
|
|
if (this.updateById(byId)) {
|
|
@@ -62,8 +55,11 @@ public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMappe
|
|
|
.eq("mt_company_id", propertyCompany.getMtCompanyId())
|
|
|
.ne("status", 0)
|
|
|
.like(propertyCompany.getName() != null, "name", propertyCompany.getName())
|
|
|
+ .or()
|
|
|
.like(propertyCompany.getAddress() != null, "address", propertyCompany.getAddress())
|
|
|
+ .or()
|
|
|
.like(propertyCompany.getTelephone() != null, "telephone", propertyCompany.getTelephone())
|
|
|
+ .or()
|
|
|
.like(propertyCompany.getMailingAddress() != null, "mailing_address", propertyCompany.getMailingAddress()));
|
|
|
if (records.getRecords().isEmpty()) {
|
|
|
return RestResponse.ok(null, ApiConstants.RESULT_NO_DATA, "无数据");
|
|
@@ -87,4 +83,20 @@ public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMappe
|
|
|
public RestResponse export() {
|
|
|
return RestResponse.ok(null, ApiConstants.RESULT_ERROR, "待实现");
|
|
|
}
|
|
|
+
|
|
|
+ //更新客户公司和客户联系人的status
|
|
|
+ @Transactional
|
|
|
+ public RestResponse updateStatus(PropertyCompanyReq req) {
|
|
|
+ PropertyCompany companyById = this.getById(req.getPropertyCompanyId());
|
|
|
+ PropertyContact contactById = propertyContactService.getById(req.getPropertyContactId());
|
|
|
+ if (companyById == null | contactById == null) {
|
|
|
+ return RestResponse.ok(null, ApiConstants.RESULT_NO_DATA, "客户或联系人不存在");
|
|
|
+ }
|
|
|
+ companyById.setStatus(2);
|
|
|
+ contactById.setStatus(2);
|
|
|
+ if (this.updateById(companyById) && propertyContactService.updateById(contactById)) {
|
|
|
+ return RestResponse.ok(null, ApiConstants.RESULT_SUCCESS, "成功");
|
|
|
+ }
|
|
|
+ return RestResponse.ok(null, ApiConstants.RESULT_ERROR, "失败");
|
|
|
+ }
|
|
|
}
|