Просмотр исходного кода

[招商][客户信息]录入合同编号

release_toaliyun_real
Burce 6 лет назад
Родитель
Сommit
c6017c3c83
6 измененных файлов: 30 добавлений и 7 удалений
  1. +1
    -0
      mallinkAdmin/src/main/resources/db/migration/V201910231900__W_INVEST_CREATE.sql
  2. +6
    -0
      mallinkService/src/main/java/com/iformall/domain/po/invest/InvestCustomerEntity.java
  3. +1
    -1
      mallinkService/src/main/java/com/iformall/service/invest/event/InvestListener.java
  4. +3
    -3
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBaseServiceImpl.java
  5. +18
    -3
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java
  6. +1
    -0
      mallinkService/src/main/resources/mapper/InvestCustomerMapper.xml

+ 1
- 0
mallinkAdmin/src/main/resources/db/migration/V201910231900__W_INVEST_CREATE.sql Просмотреть файл

@@ -40,6 +40,7 @@ CREATE TABLE `invest_customer` (
`type` TINYINT(6) NOT NULL DEFAULT '0' COMMENT '客户分类:0-潜在客户;1-意向客户;2-合作客户;3-谈判失败',
`rating` TINYINT(6) NOT NULL DEFAULT '0' COMMENT '客户预评级:0-无;1-主力店;2-次主力店;3-甲;4-乙;5-丙' ,
`invest_channel` VARCHAR(10) NOT NULL COMMENT '招商渠道:0-无;1-电视;2-广播;3-报纸;4-刊物;5-物联网;6-招商活动;7-中介机构;8-自定义渠道',
`contract_no` VARCHAR(100) NOT NULL COMMENT '合同编号',
`create_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),


+ 6
- 0
mallinkService/src/main/java/com/iformall/domain/po/invest/InvestCustomerEntity.java Просмотреть файл

@@ -87,4 +87,10 @@ public class InvestCustomerEntity extends InvestBaseEntity {
@Version
private Date updateDate;

/**
* 合同编号
*/
@io.swagger.annotations.ApiModelProperty(value = "合同编号", name = "contractNo")
private String contractNo;

}

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/invest/event/InvestListener.java Просмотреть файл

@@ -35,7 +35,7 @@ public class InvestListener implements ApplicationListener<InvestEvent> {
LambdaQueryWrapper<InvestTaskEntity> query = new LambdaQueryWrapper<>();
query.in(InvestTaskEntity::getTargetId, rentEventInfo.getTargetIds());
query.eq(InvestTaskEntity::getTargetType, EnumInvestType.RENT);
query.eq(InvestTaskEntity::getStatus, EnumTaskStatus.NEGOTIATING);
query.in(InvestTaskEntity::getStatus, EnumTaskStatus.NEGOTIATING, EnumTaskStatus.INTENTION);
List<InvestTaskEntity> tasks = taskService.list(query);
if (CollectionUtils.isEmpty(tasks)) {
log.warn("receive InvestEvent , tasks is empty : {}", tasks);


+ 3
- 3
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBaseServiceImpl.java Просмотреть файл

@@ -68,9 +68,9 @@ public class InvestBaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceIm

@Override
public T getByIdNotNull(Serializable id) {
InvestHelper.checkResult(id, "id=null");
InvestHelper.checkResult(id, "id=" + id);
T t = super.getById(id);
InvestHelper.checkResult(t, "id=null");
InvestHelper.checkResult(t, "id=" + id);
return t;
}

@@ -95,7 +95,7 @@ public class InvestBaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceIm
}

void checkUserAndTenant(T input, Consumer<T> consumer) {
InvestHelper.notNull(input, "参数");
InvestHelper.notNull(input, "参数 " + input);
InvestHelper.notNull(InvestUserContext.getUser(), ErrorCode.USER_IS_EMPTY);
((InvestBaseEntity) input).setTenantId(InvestUserContext.getUser().getTenantId());
if (consumer != null) {


+ 18
- 3
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java Просмотреть файл

@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.iformall.common.ErrorCode;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.dto.InvestDemandDto;
import com.iformall.domain.dto.InvestTaskDto;
import com.iformall.domain.po.*;
@@ -772,6 +773,7 @@ public class InvestBizServiceImpl implements InvestBizService {
public boolean saveCustomerAndDemand(InvestDemandDto demandDto) {
InvestHelper.notNull(demandDto, demandDto.getCustomer(), demandDto.getDemand());
InvestCustomerEntity customerEntity = demandDto.getCustomer();
checkCustomer(customerEntity);
customerService.save(customerEntity);
InvestDemandEntity demandEntity = demandDto.getDemand();
demandEntity.setCustomerId(customerEntity.getId());
@@ -780,16 +782,29 @@ public class InvestBizServiceImpl implements InvestBizService {
return true;
}

private void checkCustomer(InvestCustomerEntity customerEntity) {
if (Objects.equals(customerEntity.getType(), EnumCustomerType.COOPERATIVE)) {
InvestHelper.notNull(customerEntity.getContractNo(), "合同编号");
WxRentContract contract = new WxRentContract();
contract.setTenantId(InvestUserContext.getUser().getTenantId());
contract.setContractNumber(customerEntity.getContractNo());
ResultData resultData = rentContractService.hasContractNumber(contract);
InvestHelper.isTrue(Objects.equals(resultData.data, true),ErrorCode.INVEST_RESULT_NOT_FOUND,"合同编号");
}
}

@Transactional(rollbackFor = Exception.class)
@Override
public boolean updateCustomerAndDemand(InvestDemandDto demandDto) {
InvestHelper.notNull(demandDto, demandDto.getCustomer(), demandDto.getDemand());
Long customerId = demandDto.getCustomer().getId();
InvestCustomerEntity customerEntity = demandDto.getCustomer();
if (Objects.isNull(customerId)) {
customerId = demandDto.getDemand().getCustomerId();
demandDto.getCustomer().setId(customerId);
customerEntity.setId(customerId);
}
customerService.updateById(demandDto.getCustomer());
checkCustomer(customerEntity);
customerService.updateById(customerEntity);
InvestDemandEntity demandEntity = demandDto.getDemand();
if (Objects.isNull(demandEntity.getCustomerId())) {
demandEntity.setCustomerId(customerId);
@@ -800,7 +815,7 @@ public class InvestBizServiceImpl implements InvestBizService {
} else {
demandService.updateById(demandEntity);
}
saveMessage(demandEntity, demandDto.getCustomer());
saveMessage(demandEntity, customerEntity);
return true;
}



+ 1
- 0
mallinkService/src/main/resources/mapper/InvestCustomerMapper.xml Просмотреть файл

@@ -15,6 +15,7 @@
<result property="type" column="type"/>
<result property="rating" column="rating"/>
<result property="investChannel" column="invest_channel"/>
<result property="contractNo" column="contract_no"/>
<result property="createDate" column="create_date"/>
<result property="updateDate" column="update_date"/>
</resultMap>


Загрузка…
Отмена
Сохранить