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

[招商]adjust

release_toaliyun_real
Burce 6 лет назад
Родитель
Сommit
5e2438bd5e
10 измененных файлов: 107 добавлений и 168 удалений
  1. +33
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java
  2. +9
    -30
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java
  3. +10
    -27
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestFollowRecordController.java
  4. +10
    -27
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestOperateRecordController.java
  5. +10
    -37
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestRemindController.java
  6. +10
    -31
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestTaskController.java
  7. +2
    -12
      mallinkService/src/main/java/com/iformall/domain/po/InvestBaseEntity.java
  8. +18
    -2
      mallinkService/src/main/java/com/iformall/domain/po/InvestRemindEntity.java
  9. +1
    -1
      mallinkService/src/main/java/com/iformall/service/invest/InvestDemandService.java
  10. +4
    -1
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestRemindServiceImpl.java

+ 33
- 0
mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java Просмотреть файл

@@ -0,0 +1,33 @@
package com.iformall.controller.invest;

import com.iformall.common.ErrorCode;
import com.iformall.common.InvestResultData;
import com.iformall.controller.base.BaseController;
import com.iformall.domain.vo.invest.InvestUserContext;
import com.iformall.exception.MallinkException;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class InvestBaseController extends BaseController {

interface ExecuteFunction<T, E> {
E execute(T t);
}

public <E, T> InvestResultData<E> execute(T params, ExecuteFunction<T, E> function) {
try {
InvestUserContext.setUser(getUser());
E e = function.execute(params);
return new InvestResultData(e);
} catch (MallinkException e) {
log.error("execute error", e);
return new InvestResultData(e.getErrorCode(), e.getMessage());
} catch (Exception e) {
log.error("execute error", e);
return new InvestResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
} finally {
InvestUserContext.remove();
}
}

}

+ 9
- 30
mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java Просмотреть файл

@@ -3,15 +3,11 @@ package com.iformall.controller.invest;
import java.util.Arrays;

import com.iformall.annotation.SystemServiceLog;
import com.iformall.common.ErrorCode;
import com.iformall.common.InvestResultData;
import com.iformall.common.ResultData;
import com.iformall.controller.base.BaseController;
import com.iformall.domain.po.InvestDemandEntity;
import com.iformall.domain.vo.invest.InvestDemandVo;
import com.iformall.domain.vo.invest.InvestPageQuery;
import com.iformall.domain.vo.invest.InvestPageResult;
import com.iformall.exception.MallinkException;
import com.iformall.service.invest.InvestDemandService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -31,7 +27,7 @@ import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("invest/demand")
@Api(tags = "需求管理")
public class InvestDemandController extends BaseController {
public class InvestDemandController extends InvestBaseController {
@Autowired
private InvestDemandService investDemandService;

@@ -42,16 +38,7 @@ public class InvestDemandController extends BaseController {
@ApiOperation(value = "分页列表接口")
@GetMapping("/list")
public InvestResultData<InvestPageResult<InvestDemandVo>> list(InvestPageQuery<InvestDemandEntity> params) {
try {
InvestPageResult<InvestDemandVo> page = investDemandService.queryPage(params);
return new InvestResultData(page);
} catch (MallinkException e) {
log.error("list error", e);
return new InvestResultData(e.getErrorCode(), e.getMessage());
} catch (Exception e) {
log.error("list error", e);
return new InvestResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
return execute(params, p -> investDemandService.queryPage(p));
}


@@ -61,9 +48,7 @@ public class InvestDemandController extends BaseController {
@SystemServiceLog
@GetMapping("/info/{id}")
public InvestResultData<InvestDemandVo> info(@PathVariable("id") Long id) {
InvestDemandVo investDemand = investDemandService.findById(id);

return new InvestResultData(investDemand);
return execute(id, p -> investDemandService.findById(p));
}

/**
@@ -71,10 +56,8 @@ public class InvestDemandController extends BaseController {
*/
@SystemServiceLog
@PostMapping("/save")
public ResultData save(InvestDemandVo investDemand) {
investDemandService.saveCustomerAndDemand(investDemand);

return new ResultData();
public InvestResultData save(InvestDemandVo investDemand) {
return execute(investDemand, p -> investDemandService.saveCustomerAndDemand(p));
}

/**
@@ -82,20 +65,16 @@ public class InvestDemandController extends BaseController {
*/
@SystemServiceLog
@PostMapping("/update")
public ResultData update(InvestDemandVo investDemand) {
investDemandService.updateCustomerAndDemand(investDemand);

return new ResultData();
public InvestResultData update(InvestDemandVo investDemand) {
return execute(investDemand, p -> investDemandService.updateCustomerAndDemand(p));
}

/**
* 删除
*/
//@GetMapping("/delete")
public ResultData delete(Long[] ids) {
investDemandService.removeByIds(Arrays.asList(ids));

return new ResultData();
public InvestResultData delete(Long[] ids) {
return execute(ids, p -> investDemandService.removeByIds(Arrays.asList(p)));
}

}

+ 10
- 27
mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestFollowRecordController.java Просмотреть файл

@@ -30,7 +30,7 @@ import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("invest/followrecord")
@Api(tags = "跟踪管理")
public class InvestFollowRecordController extends BaseController {
public class InvestFollowRecordController extends InvestBaseController {
@Autowired
private InvestFollowRecordService investFollowRecordService;

@@ -40,16 +40,7 @@ public class InvestFollowRecordController extends BaseController {
@ApiOperation("分页列表接口")
@GetMapping("/list")
public InvestResultData<InvestPageResult<InvestFollowRecordEntity>> list(InvestPageQuery<InvestFollowRecordEntity> params) {
try {
InvestPageResult<InvestFollowRecordEntity> page = investFollowRecordService.queryPage(params);
return new InvestResultData(page);
} catch (MallinkException e) {
log.error("list error", e);
return new InvestResultData(e.getErrorCode(), e.getMessage());
} catch (Exception e) {
log.error("list error", e);
return new InvestResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
return execute(params, p -> investFollowRecordService.queryPage(p));
}


@@ -57,40 +48,32 @@ public class InvestFollowRecordController extends BaseController {
* 信息
*/
//@GetMapping("/info/{id}")
public ResultData info(@PathVariable("id") Long id){
InvestFollowRecordEntity investFollowRecord = investFollowRecordService.getById(id);

return new ResultData(investFollowRecord);
public InvestResultData info(@PathVariable("id") Long id){
return execute(id, p -> investFollowRecordService.getById(p));
}

/**
* 保存
*/
@PostMapping("/save")
public ResultData save(@RequestBody InvestFollowRecordEntity investFollowRecord){
investFollowRecordService.save(investFollowRecord);

return new ResultData();
public InvestResultData save(@RequestBody InvestFollowRecordEntity investFollowRecord){
return execute(investFollowRecord, p -> investFollowRecordService.save(p));
}

/**
* 修改
*/
//@PostMapping("/update")
public ResultData update(@RequestBody InvestFollowRecordEntity investFollowRecord){
investFollowRecordService.updateById(investFollowRecord);

return new ResultData();
public InvestResultData update(@RequestBody InvestFollowRecordEntity investFollowRecord){
return execute(investFollowRecord, p -> investFollowRecordService.updateById(p));
}

/**
* 删除
*/
//@GetMapping("/delete")
public ResultData delete(@RequestBody Long[] ids){
investFollowRecordService.removeByIds(Arrays.asList(ids));

return new ResultData();
public InvestResultData delete(@RequestBody Long[] ids){
return execute(ids, p -> investFollowRecordService.removeByIds(Arrays.asList(p)));
}

}

+ 10
- 27
mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestOperateRecordController.java Просмотреть файл

@@ -32,7 +32,7 @@ import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("invest/operaterecord")
@Api(tags = "操作记录")
public class InvestOperateRecordController extends BaseController {
public class InvestOperateRecordController extends InvestBaseController {
@Autowired
private InvestOperateRecordService investOperateRecordService;

@@ -42,16 +42,7 @@ public class InvestOperateRecordController extends BaseController {
@ApiOperation("分页列表接口")
@GetMapping("/list")
public InvestResultData<InvestPageResult<InvestOperateRecordEntity>> list(InvestPageQuery<InvestOperateRecordEntity> params) {
try {
InvestPageResult<InvestOperateRecordEntity> page = investOperateRecordService.queryPage(params);
return new InvestResultData(page);
} catch (MallinkException e) {
log.error("list error", e);
return new InvestResultData(e.getErrorCode(), e.getMessage());
} catch (Exception e) {
log.error("list error", e);
return new InvestResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
return execute(params, p -> investOperateRecordService.queryPage(p));
}


@@ -59,40 +50,32 @@ public class InvestOperateRecordController extends BaseController {
* 信息
*/
//@GetMapping("/info/{id}")
public ResultData info(@PathVariable("id") Long id){
InvestOperateRecordEntity investOperateRecord = investOperateRecordService.getById(id);

return new ResultData(investOperateRecord);
public InvestResultData info(@PathVariable("id") Long id){
return execute(id, p -> investOperateRecordService.getById(p));
}

/**
* 保存
*/
//@PostMapping("/save")
public ResultData save(@RequestBody InvestOperateRecordEntity investOperateRecord){
investOperateRecordService.save(investOperateRecord);

return new ResultData();
public InvestResultData save(@RequestBody InvestOperateRecordEntity investOperateRecord){
return execute(investOperateRecord, p -> investOperateRecordService.save(p));
}

/**
* 修改
*/
//@PostMapping("/update")
public ResultData update(@RequestBody InvestOperateRecordEntity investOperateRecord){
investOperateRecordService.updateById(investOperateRecord);

return new ResultData();
public InvestResultData update(@RequestBody InvestOperateRecordEntity investOperateRecord){
return execute(investOperateRecord, p -> investOperateRecordService.updateById(p));
}

/**
* 删除
*/
//@GetMapping("/delete")
public ResultData delete(@RequestBody Long[] ids){
investOperateRecordService.removeByIds(Arrays.asList(ids));

return new ResultData();
public InvestResultData delete(@RequestBody Long[] ids){
return execute(ids, p -> investOperateRecordService.removeByIds(Arrays.asList(p)));
}

}

+ 10
- 37
mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestRemindController.java Просмотреть файл

@@ -1,18 +1,11 @@
package com.iformall.controller.invest;

import java.util.Arrays;
import java.util.List;

import com.iformall.common.ErrorCode;
import com.iformall.common.InvestResultData;
import com.iformall.common.ResultData;
import com.iformall.controller.base.BaseController;
import com.iformall.domain.po.InvestOperateRecordEntity;
import com.iformall.domain.po.InvestRemindEntity;
import com.iformall.domain.vo.invest.InvestPageQuery;
import com.iformall.domain.vo.invest.InvestPageResult;
import com.iformall.domain.vo.invest.InvestUserContext;
import com.iformall.exception.MallinkException;
import com.iformall.service.invest.InvestRemindService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -34,7 +27,7 @@ import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("invest/remind")
@Api(tags = "招商提醒")
public class InvestRemindController extends BaseController {
public class InvestRemindController extends InvestBaseController {
@Autowired
private InvestRemindService investRemindService;

@@ -44,19 +37,7 @@ public class InvestRemindController extends BaseController {
@ApiOperation("分页列表接口")
@GetMapping("/list")
public InvestResultData<InvestPageResult<InvestRemindEntity>> list(InvestPageQuery<InvestRemindEntity> params) {
try {
InvestUserContext.setUser(getUser());
InvestPageResult<InvestRemindEntity> page = investRemindService.queryPage(params);
return new InvestResultData(page);
} catch (MallinkException e) {
log.error("list error", e);
return new InvestResultData(e.getErrorCode(), e.getMessage());
} catch (Exception e) {
log.error("list error", e);
return new InvestResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
} finally {
InvestUserContext.remove();
}
return execute(params, p -> investRemindService.queryPage(p));
}


@@ -64,40 +45,32 @@ public class InvestRemindController extends BaseController {
* 信息
*/
@GetMapping("/info/{id}")
public ResultData info(@PathVariable("id") Long id){
InvestRemindEntity investRemind = investRemindService.getById(id);

return new ResultData(investRemind);
public InvestResultData<InvestRemindEntity> info(@PathVariable("id") Long id) {
return execute(id, p -> investRemindService.getById(p));
}

/**
* 保存
*/
@PostMapping("/save")
public ResultData save(@RequestBody InvestRemindEntity investRemind){
investRemindService.save(investRemind);

return new ResultData();
public InvestResultData save(@RequestBody InvestRemindEntity investRemind) {
return execute(investRemind, p -> investRemindService.save(p));
}

/**
* 修改
*/
@PostMapping("/update")
public ResultData update(@RequestBody InvestRemindEntity investRemind){
investRemindService.updateById(investRemind);

return new ResultData();
public InvestResultData update(@RequestBody InvestRemindEntity investRemind) {
return execute(investRemind, p -> investRemindService.updateById(p));
}

/**
* 删除
*/
@GetMapping("/delete")
public ResultData delete(@RequestBody Long[] ids){
investRemindService.removeByIds(Arrays.asList(ids));

return new ResultData();
public InvestResultData delete(@RequestBody Long[] ids) {
return execute(ids, p -> investRemindService.removeByIds(Arrays.asList(p)));
}

}

+ 10
- 31
mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestTaskController.java Просмотреть файл

@@ -3,15 +3,11 @@ package com.iformall.controller.invest;
import java.util.Arrays;

import com.iformall.annotation.SystemServiceLog;
import com.iformall.common.ErrorCode;
import com.iformall.common.InvestResultData;
import com.iformall.common.ResultData;
import com.iformall.controller.base.BaseController;
import com.iformall.domain.po.InvestTaskEntity;
import com.iformall.domain.vo.invest.InvestPageQuery;
import com.iformall.domain.vo.invest.InvestPageResult;
import com.iformall.domain.vo.invest.InvestTaskVo;
import com.iformall.exception.MallinkException;
import com.iformall.service.invest.InvestTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -32,7 +28,7 @@ import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("invest/task")
@Api(tags = "招商任务")
public class InvestTaskController extends BaseController {
public class InvestTaskController extends InvestBaseController {
@Autowired
private InvestTaskService investTaskService;

@@ -43,16 +39,7 @@ public class InvestTaskController extends BaseController {
@ApiOperation("分页列表接口")
@GetMapping("/list")
public InvestResultData<InvestPageResult<InvestTaskVo>> list(InvestPageQuery<InvestTaskEntity> params){
try {
InvestPageResult<InvestTaskVo> page = investTaskService.queryPage(params);
return new InvestResultData(page);
} catch (MallinkException e) {
log.error("list error", e);
return new InvestResultData(e.getErrorCode(), e.getMessage());
} catch (Exception e) {
log.error("list error", e);
return new InvestResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
return execute(params, p -> investTaskService.queryPage(p));
}


@@ -61,10 +48,8 @@ public class InvestTaskController extends BaseController {
*/
@SystemServiceLog
@GetMapping("/info/{id}")
public ResultData info(@PathVariable("id") Long id){
InvestTaskEntity investTask = investTaskService.getById(id);

return new ResultData(investTask);
public InvestResultData info(@PathVariable("id") Long id){
return execute(id, p -> investTaskService.getById(id));
}

/**
@@ -72,10 +57,8 @@ public class InvestTaskController extends BaseController {
*/
@SystemServiceLog
@PostMapping("/save")
public ResultData save(@RequestBody InvestTaskEntity investTask){
investTaskService.save(investTask);

return new ResultData();
public InvestResultData save(@RequestBody InvestTaskEntity investTask){
return execute(investTask, p -> investTaskService.save(p));
}

/**
@@ -83,10 +66,8 @@ public class InvestTaskController extends BaseController {
*/
@SystemServiceLog
@PostMapping("/update")
public ResultData update(@RequestBody InvestTaskEntity investTask){
investTaskService.updateById(investTask);

return new ResultData();
public InvestResultData update(@RequestBody InvestTaskEntity investTask){
return execute(investTask, p -> investTaskService.updateById(p));
}

/**
@@ -94,10 +75,8 @@ public class InvestTaskController extends BaseController {
*/
@SystemServiceLog
@PostMapping("/delete")
public ResultData delete(@RequestBody Long[] ids){
investTaskService.removeByIds(Arrays.asList(ids));

return new ResultData();
public InvestResultData delete(@RequestBody Long[] ids){
return execute(ids, p -> investTaskService.removeByIds(Arrays.asList(p)));
}

}

+ 2
- 12
mallinkService/src/main/java/com/iformall/domain/po/InvestBaseEntity.java Просмотреть файл

@@ -1,26 +1,18 @@
package com.iformall.domain.po;

import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.*;
import com.iformall.common.SortColumn;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.*;

/**
* @author luozukai
* @date 2019/4/24 14:32
*/
@JsonIgnoreType()
@Data
@Slf4j
public class InvestBaseEntity implements Serializable {

private static final long serialVersionUID = 1L;
@@ -41,15 +33,13 @@ public class InvestBaseEntity implements Serializable {
/**
* 创建时间
*/
@io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createDate", example = "2018-10-01 12:18:48",readOnly = true)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createDate")
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
private Date createDate;
/**
* 更新时间
*/
@io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateDate", example = "2018-10-01 12:18:48",readOnly = true)
@io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateDate")
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateDate;
}

+ 18
- 2
mallinkService/src/main/java/com/iformall/domain/po/InvestRemindEntity.java Просмотреть файл

@@ -26,11 +26,27 @@ public class InvestRemindEntity extends InvestBaseEntity {
/**
* 提醒内容
*/
@io.swagger.annotations.ApiModelProperty(value = "提醒内容", name = "content")
@io.swagger.annotations.ApiModelProperty(value = "提醒内容", name = "content",example = "" +
"{\n" +
" \"text\": \"今天约了王老板,要求签订框架协议\",\n" +
" \"customer_id\": 222222,\n" +
" \"negotiation_type\": 2\n" +
"}")
private String content;
/**
* 提醒时间
*/
@io.swagger.annotations.ApiModelProperty(value = "提醒时间", name = "minute")
@io.swagger.annotations.ApiModelProperty(value = "提醒时间", name = "minute",example = "10")
private Long minute;

/**
* 开始时间
*/
@io.swagger.annotations.ApiModelProperty(value = "开始时间", name = "beginDate" ,example = "2018-10-01 12:18:48")
private Date beginDate;
/**
* 结束时间
*/
@io.swagger.annotations.ApiModelProperty(value = "结束时间", name = "endDate" ,example = "2018-10-01 12:18:48")
private Date endDate;
}

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

@@ -16,7 +16,7 @@ import com.iformall.domain.vo.invest.InvestPageResult;
*/
public interface InvestDemandService extends IService<InvestDemandEntity> {

InvestPageResult<InvestDemandVo> queryPage(InvestPageQuery<InvestDemandEntity> params) throws Exception;
InvestPageResult<InvestDemandVo> queryPage(InvestPageQuery<InvestDemandEntity> params);

boolean saveCustomerAndDemand(InvestDemandVo customerDemandVo) ;



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

@@ -75,6 +75,9 @@ public class InvestRemindServiceImpl extends ServiceImpl<InvestRemindDao, Invest

private void checkBeforeSaveOrUpdate(InvestRemindEntity input) {
InvestHelper.checkAllNotNull(input);
InvestHelper.checkUserExit(userInfoService, input.getOwner());

InvestHelper.checkAllNotNull(InvestUserContext.getUser());
input.setOwner(InvestUserContext.getUserId());
input.setTenantId(InvestUserContext.getUser().getTenantId());
}
}

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