| @@ -2,10 +2,15 @@ package com.iformall.controller.invest; | |||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.annotation.SystemServiceLog; | |||||
| import com.iformall.common.InvestResultData; | import com.iformall.common.InvestResultData; | ||||
| import com.iformall.domain.dto.InvestDemandDto; | |||||
| import com.iformall.domain.po.invest.InvestCustomerEntity; | 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.InvestPageQuery; | ||||
| import com.iformall.domain.vo.invest.InvestPageResult; | import com.iformall.domain.vo.invest.InvestPageResult; | ||||
| import com.iformall.service.invest.InvestBizService; | |||||
| import com.iformall.service.invest.InvestCustomerService; | import com.iformall.service.invest.InvestCustomerService; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| @@ -24,61 +29,60 @@ import org.springframework.beans.factory.annotation.Autowired; | |||||
| @Slf4j | @Slf4j | ||||
| @RestController | @RestController | ||||
| @RequestMapping("invest/customer") | @RequestMapping("invest/customer") | ||||
| @Api(tags = "招商模块-客户管理") | |||||
| @Api(tags = "招商模块-客户信息") | |||||
| public class InvestCustomerController extends InvestBaseController{ | public class InvestCustomerController extends InvestBaseController{ | ||||
| @Autowired | |||||
| private InvestBizService investBizService; | |||||
| @Autowired | @Autowired | ||||
| private InvestCustomerService investCustomerService; | private InvestCustomerService investCustomerService; | ||||
| /** | /** | ||||
| * 客户列表 | * 客户列表 | ||||
| */ | */ | ||||
| @ApiOperation("客户列表") | |||||
| @SystemControllerLog(description = "客户列表") | |||||
| @PostMapping("/list") | |||||
| @ApiOperation("客户信息列表") | |||||
| @SystemControllerLog(description = "客户信息列表") | |||||
| @PostMapping("/list/simple") | |||||
| public InvestResultData<InvestPageResult<InvestCustomerEntity>> list(InvestPageQuery<InvestCustomerEntity> params) { | public InvestResultData<InvestPageResult<InvestCustomerEntity>> list(InvestPageQuery<InvestCustomerEntity> params) { | ||||
| return execute(params, p -> investCustomerService.queryPage(p)); | 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)); | |||||
| } | |||||
| } | } | ||||
| @@ -1,15 +1,8 @@ | |||||
| package com.iformall.controller.invest; | package com.iformall.controller.invest; | ||||
| import com.iformall.annotation.SystemServiceLog; | |||||
| import com.iformall.common.InvestResultData; | 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.Api; | ||||
| import io.swagger.annotations.ApiOperation; | |||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| @@ -31,53 +24,13 @@ import java.util.Arrays; | |||||
| public class InvestDemandController extends InvestBaseController { | public class InvestDemandController extends InvestBaseController { | ||||
| @Autowired | @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") | //@GetMapping("/delete") | ||||
| public InvestResultData delete(@RequestBody Long[] ids) { | public InvestResultData delete(@RequestBody Long[] ids) { | ||||
| return execute(ids, p -> investDemandService.removeByIds(Arrays.asList(p))); | |||||
| return execute(ids, p -> customerService.removeByIds(Arrays.asList(p))); | |||||
| } | } | ||||
| } | } | ||||
| @@ -10,6 +10,7 @@ import com.iformall.domain.po.invest.InvestBaseEntity; | |||||
| import com.iformall.domain.po.invest.InvestOperateRecordEntity; | import com.iformall.domain.po.invest.InvestOperateRecordEntity; | ||||
| import com.iformall.domain.vo.invest.TableTriple; | import com.iformall.domain.vo.invest.TableTriple; | ||||
| import com.iformall.enums.EnumTableOperateType; | import com.iformall.enums.EnumTableOperateType; | ||||
| import com.iformall.service.invest.InvestHelper; | |||||
| import com.iformall.service.invest.InvestOperateRecordService; | import com.iformall.service.invest.InvestOperateRecordService; | ||||
| import com.iformall.service.invest.impl.InvestBaseServiceImpl; | import com.iformall.service.invest.impl.InvestBaseServiceImpl; | ||||
| import com.iformall.utils.SpringContextUtils; | import com.iformall.utils.SpringContextUtils; | ||||
| @@ -136,6 +137,9 @@ public class TableOperateAspect { | |||||
| for (Field field : fields) { | for (Field field : fields) { | ||||
| String annotationVal = field.getAnnotation(LogColumn.class).value(); | String annotationVal = field.getAnnotation(LogColumn.class).value(); | ||||
| Object value = FieldUtils.readDeclaredField(entity, field.getName(), true); | 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)) { | if (Objects.equals(annotationVal, InvestBaseEntity.COLUMN_TYPE)) { | ||||
| value = JSON.parseObject((String) value, Map.class); | value = JSON.parseObject((String) value, Map.class); | ||||
| } | } | ||||
| @@ -3,11 +3,12 @@ package com.iformall.domain.po.invest; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import com.iformall.domain.po.invest.InvestBaseEntity; | |||||
| import com.iformall.enums.EnumFollowType; | import com.iformall.enums.EnumFollowType; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| import java.util.Date; | |||||
| /** | /** | ||||
| * 跟踪记录 | * 跟踪记录 | ||||
| * | * | ||||
| @@ -34,7 +35,6 @@ public class InvestFollowRecordEntity extends InvestBaseEntity { | |||||
| * 洽谈内容 | * 洽谈内容 | ||||
| */ | */ | ||||
| @io.swagger.annotations.ApiModelProperty(value = "洽谈内容", name = "content",example = "{" + | @io.swagger.annotations.ApiModelProperty(value = "洽谈内容", name = "content",example = "{" + | ||||
| "\"date\": \"2019-09-03\"," + | |||||
| " \"address\": \"北京三里屯\"," + | " \"address\": \"北京三里屯\"," + | ||||
| " \"text\": \"今天约了王老板,目标要签订框架协议\"," + | " \"text\": \"今天约了王老板,目标要签订框架协议\"," + | ||||
| " \"document\": [\"url1\",\"url2\"]," + | " \"document\": [\"url1\",\"url2\"]," + | ||||
| @@ -59,4 +59,10 @@ public class InvestFollowRecordEntity extends InvestBaseEntity { | |||||
| */ | */ | ||||
| @io.swagger.annotations.ApiModelProperty(value = "操作人", name = "followId") | @io.swagger.annotations.ApiModelProperty(value = "操作人", name = "followId") | ||||
| private Long operator; | private Long operator; | ||||
| /** | |||||
| * 跟踪日期 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "followDate", name = "followDate",example = "2019-09-03") | |||||
| private Date followDate; | |||||
| } | } | ||||
| @@ -9,10 +9,10 @@ import lombok.EqualsAndHashCode; | |||||
| @Data | @Data | ||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||
| public class InvestDemandVo extends InvestDemandEntity { | |||||
| public class InvestDemandVo extends InvestCustomerEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "customer", name = "customer") | @io.swagger.annotations.ApiModelProperty(value = "customer", name = "customer") | ||||
| private InvestCustomerEntity customer; | |||||
| private InvestDemandEntity demand; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "brand", name = "brand") | @io.swagger.annotations.ApiModelProperty(value = "brand", name = "brand") | ||||
| private WxBrand brand; | private WxBrand brand; | ||||
| @@ -123,7 +123,7 @@ public class InvestHelper { | |||||
| } | } | ||||
| @SuppressWarnings("unchecked") | @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)) { | if (StringUtils.isEmpty(value)) { | ||||
| return null; | 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) { | private <T, R> ImmutableListMultimap<R, T> getMultiMap(Collection<T> dataList) { | ||||
| @@ -110,6 +110,12 @@ public class InvestBizServiceImpl implements InvestBizService { | |||||
| } | } | ||||
| LambdaQueryWrapper<InvestTaskEntity> taskQueryWrapper = new LambdaQueryWrapper<>(); | LambdaQueryWrapper<InvestTaskEntity> taskQueryWrapper = new LambdaQueryWrapper<>(); | ||||
| InvestPageResult<InvestTaskVo> investPage = new InvestPageResult<>(); | 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)) { | if (Objects.nonNull(shopParams)) { | ||||
| Collection<WxShop> shops = shopService.selectList(new QueryWrapper<>(shopParams)); | Collection<WxShop> shops = shopService.selectList(new QueryWrapper<>(shopParams)); | ||||
| if (CollectionUtils.isEmpty(shops)) { | if (CollectionUtils.isEmpty(shops)) { | ||||
| @@ -117,10 +123,6 @@ public class InvestBizServiceImpl implements InvestBizService { | |||||
| } | } | ||||
| taskQueryWrapper.in(InvestTaskEntity::getTargetId, getIds(shops, WxShop::getId)); | 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); | InvestPageResult<InvestTaskEntity> taskPage = taskService.queryPage(buildPageQuery(params, taskParams), taskQueryWrapper); | ||||
| if (CollectionUtils.isEmpty(taskPage.getRecords())) { | if (CollectionUtils.isEmpty(taskPage.getRecords())) { | ||||
| @@ -412,14 +414,14 @@ public class InvestBizServiceImpl implements InvestBizService { | |||||
| private InvestDemandVo buildDemindItem(InvestDemandEntity item, InvestCustomerEntity customer, WxBrand brand, | private InvestDemandVo buildDemindItem(InvestDemandEntity item, InvestCustomerEntity customer, WxBrand brand, | ||||
| WxShop shop, Map<Long, MallUserInfo> usersMap) { | WxShop shop, Map<Long, MallUserInfo> usersMap) { | ||||
| InvestDemandVo resultItemVo = new InvestDemandVo(); | InvestDemandVo resultItemVo = new InvestDemandVo(); | ||||
| BeanUtils.copyProperties(customer, resultItemVo); | |||||
| resultItemVo.setBrand(brand); | resultItemVo.setBrand(brand); | ||||
| resultItemVo.setCustomer(customer); | |||||
| resultItemVo.setDemand(item); | |||||
| resultItemVo.setTargetInfo(shop); | resultItemVo.setTargetInfo(shop); | ||||
| if (Objects.nonNull(item)) { | if (Objects.nonNull(item)) { | ||||
| if (Objects.nonNull(usersMap.get(item.getOwner()))) { | if (Objects.nonNull(usersMap.get(item.getOwner()))) { | ||||
| resultItemVo.setOwnerInfo(usersMap.get(item.getOwner())); | resultItemVo.setOwnerInfo(usersMap.get(item.getOwner())); | ||||
| } | } | ||||
| BeanUtils.copyProperties(item, resultItemVo); | |||||
| } | } | ||||
| return resultItemVo; | return resultItemVo; | ||||
| } | } | ||||
| @@ -43,6 +43,7 @@ public class InvestFollowRecordServiceImpl extends InvestBaseServiceImpl<InvestF | |||||
| private void checkBeforeSaveOrUpdate(InvestFollowRecordEntity entity) { | private void checkBeforeSaveOrUpdate(InvestFollowRecordEntity entity) { | ||||
| InvestHelper.notNull(entity); | InvestHelper.notNull(entity); | ||||
| InvestHelper.notNull(entity.getFollowId(), "followId"); | InvestHelper.notNull(entity.getFollowId(), "followId"); | ||||
| InvestHelper.notNull(entity.getFollowDate(), "followDate"); | |||||
| Object object = null; | Object object = null; | ||||
| if(Objects.equals(entity.getType(), EnumFollowType.DEMAND)) { | if(Objects.equals(entity.getType(), EnumFollowType.DEMAND)) { | ||||
| object = demandService.getById(entity.getFollowId()); | object = demandService.getById(entity.getFollowId()); | ||||