Browse Source

[招商]adjust

release_toaliyun_real
Burce 6 years ago
parent
commit
f96f686fb9
8 changed files with 84 additions and 104 deletions
  1. +45
    -41
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java
  2. +3
    -50
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java
  3. +4
    -0
      mallinkAdmin/src/main/java/com/iformall/log/TableOperateAspect.java
  4. +8
    -2
      mallinkService/src/main/java/com/iformall/domain/po/invest/InvestFollowRecordEntity.java
  5. +2
    -2
      mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandVo.java
  6. +13
    -3
      mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java
  7. +8
    -6
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java
  8. +1
    -0
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestFollowRecordServiceImpl.java

+ 45
- 41
mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java View File

@@ -2,10 +2,15 @@ package com.iformall.controller.invest;


import com.iformall.annotation.SystemControllerLog;
import com.iformall.annotation.SystemServiceLog;
import com.iformall.common.InvestResultData;
import com.iformall.domain.dto.InvestDemandDto;
import com.iformall.domain.po.invest.InvestCustomerEntity;
import com.iformall.domain.vo.invest.InvestDemandQuery;
import com.iformall.domain.vo.invest.InvestDemandVo;
import com.iformall.domain.vo.invest.InvestPageQuery;
import com.iformall.domain.vo.invest.InvestPageResult;
import com.iformall.service.invest.InvestBizService;
import com.iformall.service.invest.InvestCustomerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -24,61 +29,60 @@ import org.springframework.beans.factory.annotation.Autowired;
@Slf4j
@RestController
@RequestMapping("invest/customer")
@Api(tags = "招商模块-客户管理")
@Api(tags = "招商模块-客户信息")
public class InvestCustomerController extends InvestBaseController{

@Autowired
private InvestBizService investBizService;

@Autowired
private InvestCustomerService investCustomerService;

/**
* 客户列表
*/
@ApiOperation("客户列表")
@SystemControllerLog(description = "客户列表")
@PostMapping("/list")
@ApiOperation("客户信息列表")
@SystemControllerLog(description = "客户信息列表")
@PostMapping("/list/simple")
public InvestResultData<InvestPageResult<InvestCustomerEntity>> list(InvestPageQuery<InvestCustomerEntity> params) {
return execute(params, p -> investCustomerService.queryPage(p));
}

/**
* 分页列表
*/
@SystemServiceLog
@ApiOperation(value = "分页列表接口")
@GetMapping("/list")
public InvestResultData<InvestPageResult<InvestDemandVo>> list(InvestDemandQuery params) {
return execute(params, p -> investBizService.queryPageDemand(p));
}

/**
// * 客户详细信息
// */
//@SystemControllerLog(description = "客户详细信息")
//@GetMapping("/info/{id}")
//public ResultData info(@PathVariable("id") Long id) {
// InvestCustomerEntity investCustomer = investCustomerService.getById(id);
// return new ResultData(investCustomer);
//}
* 信息
*/
@SystemServiceLog
@GetMapping("/info/{id}")
public InvestResultData<InvestDemandVo> info(@PathVariable("id") Long id) {
return execute(id, p -> investBizService.findDemandById(p));
}

///**
// * 保存客户
// */
//@SystemControllerLog(description = "保存客户")
//@PostMapping("/save")
//public ResultData save(@RequestBody InvestCustomerEntity investCustomer) {
// investCustomerService.save(investCustomer);
// return new ResultData();
//}
//
///**
// * 修改客户信息
// */
//@SystemControllerLog(description = "修改客户信息")
//@PostMapping("/update")
//public ResultData update(@RequestBody InvestCustomerEntity investCustomer) {
// investCustomerService.updateById(investCustomer);
//
// return new ResultData();
//}
/**
* 保存
*/
@SystemServiceLog
@PostMapping("/save")
public InvestResultData save(@RequestBody InvestDemandDto investDemand) {
return execute(investDemand, p -> investBizService.saveCustomerAndDemand(p));
}

///**
// * 删除客户信息
// */
//@SystemControllerLog(description = "删除客户信息")
//@GetMapping("/delete")
//public ResultData delete(@RequestBody Long[] ids) {
// investCustomerService.removeByIds(Arrays.asList(ids));
// return new ResultData();
//}
/**
* 修改
*/
@SystemServiceLog
@PostMapping("/update")
public InvestResultData update(@RequestBody InvestDemandDto customerDto) {
return execute(customerDto, p -> investBizService.updateCustomerAndDemand(p));
}

}

+ 3
- 50
mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java View File

@@ -1,15 +1,8 @@
package com.iformall.controller.invest;

import com.iformall.annotation.SystemServiceLog;
import com.iformall.common.InvestResultData;
import com.iformall.domain.dto.InvestDemandDto;
import com.iformall.domain.vo.invest.InvestDemandQuery;
import com.iformall.domain.vo.invest.InvestDemandVo;
import com.iformall.domain.vo.invest.InvestPageResult;
import com.iformall.service.invest.InvestBizService;
import com.iformall.service.invest.InvestDemandService;
import com.iformall.service.invest.InvestCustomerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -31,53 +24,13 @@ import java.util.Arrays;
public class InvestDemandController extends InvestBaseController {

@Autowired
private InvestBizService investBizService ;

@Autowired
private InvestDemandService investDemandService;

/**
* 分页列表
*/
@SystemServiceLog
@ApiOperation(value = "分页列表接口")
@GetMapping("/list")
public InvestResultData<InvestPageResult<InvestDemandVo>> list(InvestDemandQuery params) {
return execute(params, p -> investBizService.queryPageDemand(p));
}

/**
* 信息
*/
@SystemServiceLog
@GetMapping("/info/{id}")
public InvestResultData<InvestDemandVo> info(@PathVariable("id") Long id) {
return execute(id, p -> investBizService.findDemandById(p));
}

/**
* 保存
*/
@SystemServiceLog
@PostMapping("/save")
public InvestResultData save(@RequestBody InvestDemandDto investDemand) {
return execute(investDemand, p -> investBizService.saveCustomerAndDemand(p));
}

/**
* 修改
*/
@SystemServiceLog
@PostMapping("/update")
public InvestResultData update(@RequestBody InvestDemandDto customerDto) {
return execute(customerDto, p -> investBizService.updateCustomerAndDemand(p));
}
private InvestCustomerService customerService;

/**
* 删除
*/
//@GetMapping("/delete")
public InvestResultData delete(@RequestBody Long[] ids) {
return execute(ids, p -> investDemandService.removeByIds(Arrays.asList(p)));
return execute(ids, p -> customerService.removeByIds(Arrays.asList(p)));
}
}

+ 4
- 0
mallinkAdmin/src/main/java/com/iformall/log/TableOperateAspect.java View File

@@ -10,6 +10,7 @@ import com.iformall.domain.po.invest.InvestBaseEntity;
import com.iformall.domain.po.invest.InvestOperateRecordEntity;
import com.iformall.domain.vo.invest.TableTriple;
import com.iformall.enums.EnumTableOperateType;
import com.iformall.service.invest.InvestHelper;
import com.iformall.service.invest.InvestOperateRecordService;
import com.iformall.service.invest.impl.InvestBaseServiceImpl;
import com.iformall.utils.SpringContextUtils;
@@ -136,6 +137,9 @@ public class TableOperateAspect {
for (Field field : fields) {
String annotationVal = field.getAnnotation(LogColumn.class).value();
Object value = FieldUtils.readDeclaredField(entity, field.getName(), true);
if (field.getType().isEnum()) {
value = InvestHelper.getEnumVal(InvestHelper.valueOf(value.getClass(), ((Enum) value).name()));
}
if (Objects.equals(annotationVal, InvestBaseEntity.COLUMN_TYPE)) {
value = JSON.parseObject((String) value, Map.class);
}


+ 8
- 2
mallinkService/src/main/java/com/iformall/domain/po/invest/InvestFollowRecordEntity.java View File

@@ -3,11 +3,12 @@ package com.iformall.domain.po.invest;
import com.baomidou.mybatisplus.annotation.TableName;


import com.iformall.domain.po.invest.InvestBaseEntity;
import com.iformall.enums.EnumFollowType;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

/**
* 跟踪记录
*
@@ -34,7 +35,6 @@ public class InvestFollowRecordEntity extends InvestBaseEntity {
* 洽谈内容
*/
@io.swagger.annotations.ApiModelProperty(value = "洽谈内容", name = "content",example = "{" +
"\"date\": \"2019-09-03\"," +
" \"address\": \"北京三里屯\"," +
" \"text\": \"今天约了王老板,目标要签订框架协议\"," +
" \"document\": [\"url1\",\"url2\"]," +
@@ -59,4 +59,10 @@ public class InvestFollowRecordEntity extends InvestBaseEntity {
*/
@io.swagger.annotations.ApiModelProperty(value = "操作人", name = "followId")
private Long operator;

/**
* 跟踪日期
*/
@io.swagger.annotations.ApiModelProperty(value = "followDate", name = "followDate",example = "2019-09-03")
private Date followDate;
}

+ 2
- 2
mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandVo.java View File

@@ -9,10 +9,10 @@ import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class InvestDemandVo extends InvestDemandEntity {
public class InvestDemandVo extends InvestCustomerEntity {

@io.swagger.annotations.ApiModelProperty(value = "customer", name = "customer")
private InvestCustomerEntity customer;
private InvestDemandEntity demand;

@io.swagger.annotations.ApiModelProperty(value = "brand", name = "brand")
private WxBrand brand;


+ 13
- 3
mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java View File

@@ -123,7 +123,7 @@ public class InvestHelper {
}

@SuppressWarnings("unchecked")
public static <T extends Enum<T>> T codeOf(Class<T> enumType, String value) {
public static <T extends Enum<T>> T codeOf(Class enumType, String value) {
if (StringUtils.isEmpty(value)) {
return null;
}
@@ -137,8 +137,18 @@ public class InvestHelper {
}
}

public static <T extends Enum<T>> T valueOf(Class<T> enumType, String name) {
return T.valueOf(enumType, name);
public static String getEnumVal(Object o) {
try {
Method method = o.getClass().getDeclaredMethod("getInfo");
Object rs = method.invoke(o);
return (String) rs;
} catch (ReflectiveOperationException e) {
throw new IllegalArgumentException(e);
}
}

public static <T extends Enum<T>> T valueOf(Class enumType, String name) {
return (T) T.valueOf(enumType, name);
}

private <T, R> ImmutableListMultimap<R, T> getMultiMap(Collection<T> dataList) {


+ 8
- 6
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java View File

@@ -110,6 +110,12 @@ public class InvestBizServiceImpl implements InvestBizService {
}
LambdaQueryWrapper<InvestTaskEntity> taskQueryWrapper = new LambdaQueryWrapper<>();
InvestPageResult<InvestTaskVo> investPage = new InvestPageResult<>();
if (Objects.nonNull(taskParams)) {
taskQueryWrapper.apply(StringUtils.isNotEmpty(taskParams.getOwner()), "`owner` REGEXP {0}", taskParams.getOwner());
taskParams.setOwner(null);
taskQueryWrapper.setEntity(taskParams);
}

if (Objects.nonNull(shopParams)) {
Collection<WxShop> shops = shopService.selectList(new QueryWrapper<>(shopParams));
if (CollectionUtils.isEmpty(shops)) {
@@ -117,10 +123,6 @@ public class InvestBizServiceImpl implements InvestBizService {
}
taskQueryWrapper.in(InvestTaskEntity::getTargetId, getIds(shops, WxShop::getId));
}
if (Objects.nonNull(taskParams)) {
taskQueryWrapper.apply(StringUtils.isNotEmpty(taskParams.getOwner()), "`owner` REGEXP {0}", taskParams.getOwner());
taskParams.setOwner(null);
}

InvestPageResult<InvestTaskEntity> taskPage = taskService.queryPage(buildPageQuery(params, taskParams), taskQueryWrapper);
if (CollectionUtils.isEmpty(taskPage.getRecords())) {
@@ -412,14 +414,14 @@ public class InvestBizServiceImpl implements InvestBizService {
private InvestDemandVo buildDemindItem(InvestDemandEntity item, InvestCustomerEntity customer, WxBrand brand,
WxShop shop, Map<Long, MallUserInfo> usersMap) {
InvestDemandVo resultItemVo = new InvestDemandVo();
BeanUtils.copyProperties(customer, resultItemVo);
resultItemVo.setBrand(brand);
resultItemVo.setCustomer(customer);
resultItemVo.setDemand(item);
resultItemVo.setTargetInfo(shop);
if (Objects.nonNull(item)) {
if (Objects.nonNull(usersMap.get(item.getOwner()))) {
resultItemVo.setOwnerInfo(usersMap.get(item.getOwner()));
}
BeanUtils.copyProperties(item, resultItemVo);
}
return resultItemVo;
}


+ 1
- 0
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestFollowRecordServiceImpl.java View File

@@ -43,6 +43,7 @@ public class InvestFollowRecordServiceImpl extends InvestBaseServiceImpl<InvestF
private void checkBeforeSaveOrUpdate(InvestFollowRecordEntity entity) {
InvestHelper.notNull(entity);
InvestHelper.notNull(entity.getFollowId(), "followId");
InvestHelper.notNull(entity.getFollowDate(), "followDate");
Object object = null;
if(Objects.equals(entity.getType(), EnumFollowType.DEMAND)) {
object = demandService.getById(entity.getFollowId());


Loading…
Cancel
Save