diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java index 77b1449c8..26f0274a4 100755 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java @@ -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> list(InvestPageQuery params) { return execute(params, p -> investCustomerService.queryPage(p)); } + /** + * 分页列表 + */ + @SystemServiceLog + @ApiOperation(value = "分页列表接口") + @GetMapping("/list") + public InvestResultData> 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 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)); + } } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java index 6259e2efd..6f110cd3e 100755 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java @@ -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> list(InvestDemandQuery params) { - return execute(params, p -> investBizService.queryPageDemand(p)); - } - - /** - * 信息 - */ - @SystemServiceLog - @GetMapping("/info/{id}") - public InvestResultData 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))); } } diff --git a/mallinkAdmin/src/main/java/com/iformall/log/TableOperateAspect.java b/mallinkAdmin/src/main/java/com/iformall/log/TableOperateAspect.java index 9d865df7e..0fea283bd 100644 --- a/mallinkAdmin/src/main/java/com/iformall/log/TableOperateAspect.java +++ b/mallinkAdmin/src/main/java/com/iformall/log/TableOperateAspect.java @@ -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); } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestFollowRecordEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestFollowRecordEntity.java index dfb170c25..6e60c56e7 100755 --- a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestFollowRecordEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestFollowRecordEntity.java @@ -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; } diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandVo.java index bd238ff4b..9d60f375e 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandVo.java @@ -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; diff --git a/mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java b/mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java index 98f87c0bc..dbaccc8fd 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java @@ -123,7 +123,7 @@ public class InvestHelper { } @SuppressWarnings("unchecked") - public static > T codeOf(Class enumType, String value) { + public static > T codeOf(Class enumType, String value) { if (StringUtils.isEmpty(value)) { return null; } @@ -137,8 +137,18 @@ public class InvestHelper { } } - public static > T valueOf(Class 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 valueOf(Class enumType, String name) { + return (T) T.valueOf(enumType, name); } private ImmutableListMultimap getMultiMap(Collection dataList) { diff --git a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java index b53934e3f..e63bdf5be 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java @@ -110,6 +110,12 @@ public class InvestBizServiceImpl implements InvestBizService { } LambdaQueryWrapper taskQueryWrapper = new LambdaQueryWrapper<>(); InvestPageResult 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 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 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 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; } diff --git a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestFollowRecordServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestFollowRecordServiceImpl.java index 2ad4e633f..44a7c2679 100755 --- a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestFollowRecordServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestFollowRecordServiceImpl.java @@ -43,6 +43,7 @@ public class InvestFollowRecordServiceImpl extends InvestBaseServiceImpl