| @@ -2,6 +2,7 @@ package com.iformall.controller.invest; | |||||
| import com.iformall.annotation.SystemServiceLog; | 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.InvestDemandEntity; | import com.iformall.domain.po.InvestDemandEntity; | ||||
| import com.iformall.domain.vo.invest.InvestDemandVo; | import com.iformall.domain.vo.invest.InvestDemandVo; | ||||
| import com.iformall.domain.vo.invest.InvestPageQuery; | import com.iformall.domain.vo.invest.InvestPageQuery; | ||||
| @@ -63,7 +64,7 @@ public class InvestDemandController extends InvestBaseController { | |||||
| */ | */ | ||||
| @SystemServiceLog | @SystemServiceLog | ||||
| @PostMapping("/save") | @PostMapping("/save") | ||||
| public InvestResultData save(InvestDemandVo investDemand) { | |||||
| public InvestResultData save(@RequestBody InvestDemandDto investDemand) { | |||||
| return execute(investDemand, p -> investBizService.saveCustomerAndDemand(p)); | return execute(investDemand, p -> investBizService.saveCustomerAndDemand(p)); | ||||
| } | } | ||||
| @@ -72,7 +73,7 @@ public class InvestDemandController extends InvestBaseController { | |||||
| */ | */ | ||||
| @SystemServiceLog | @SystemServiceLog | ||||
| @PostMapping("/update") | @PostMapping("/update") | ||||
| public InvestResultData update(InvestDemandVo investDemand) { | |||||
| public InvestResultData update(@RequestBody InvestDemandVo investDemand) { | |||||
| return execute(investDemand, p -> investBizService.updateCustomerAndDemand(p)); | return execute(investDemand, p -> investBizService.updateCustomerAndDemand(p)); | ||||
| } | } | ||||
| @@ -80,7 +81,7 @@ public class InvestDemandController extends InvestBaseController { | |||||
| * 删除 | * 删除 | ||||
| */ | */ | ||||
| //@GetMapping("/delete") | //@GetMapping("/delete") | ||||
| public InvestResultData delete(Long[] ids) { | |||||
| public InvestResultData delete(@RequestBody Long[] ids) { | |||||
| return execute(ids, p -> investDemandService.removeByIds(Arrays.asList(p))); | return execute(ids, p -> investDemandService.removeByIds(Arrays.asList(p))); | ||||
| } | } | ||||
| @@ -0,0 +1,13 @@ | |||||
| package com.iformall.domain.dto; | |||||
| import com.iformall.domain.po.InvestCustomerEntity; | |||||
| import com.iformall.domain.po.InvestDemandEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| @Data | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class InvestDemandDto extends InvestDemandEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "customer", name = "customer",required = true) | |||||
| private InvestCustomerEntity customer; | |||||
| } | |||||
| @@ -6,15 +6,20 @@ import com.iformall.domain.po.MallUserInfo; | |||||
| import com.iformall.domain.po.WxBrand; | import com.iformall.domain.po.WxBrand; | ||||
| import lombok.Builder; | import lombok.Builder; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | |||||
| @Data | @Data | ||||
| @Builder | @Builder | ||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class InvestDemandVo<T> extends InvestDemandEntity { | public class InvestDemandVo<T> extends InvestDemandEntity { | ||||
| @io.swagger.annotations.ApiModelProperty(value = "customer", name = "customer",required = true) | |||||
| private InvestCustomerEntity customer; | private InvestCustomerEntity customer; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "brand", name = "brand") | |||||
| private WxBrand brand; | private WxBrand brand; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "ownerInfo", name = "ownerInfo") | |||||
| private MallUserInfo ownerInfo; | private MallUserInfo ownerInfo; | ||||
| private T targetInfo; | private T targetInfo; | ||||
| @@ -3,11 +3,13 @@ package com.iformall.domain.vo.invest; | |||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import lombok.Builder; | import lombok.Builder; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | |||||
| import java.util.List; | import java.util.List; | ||||
| @Data | @Data | ||||
| @Builder | @Builder | ||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class InvestFollowRecordVo extends InvestFollowRecordEntity { | public class InvestFollowRecordVo extends InvestFollowRecordEntity { | ||||
| private InvestCustomerEntity customer; | private InvestCustomerEntity customer; | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.service.invest; | package com.iformall.service.invest; | ||||
| import com.iformall.domain.dto.InvestDemandDto; | |||||
| import com.iformall.domain.po.InvestDemandEntity; | import com.iformall.domain.po.InvestDemandEntity; | ||||
| import com.iformall.domain.po.InvestFollowRecordEntity; | import com.iformall.domain.po.InvestFollowRecordEntity; | ||||
| import com.iformall.domain.po.InvestTaskEntity; | import com.iformall.domain.po.InvestTaskEntity; | ||||
| @@ -18,7 +19,7 @@ public interface InvestBizService { | |||||
| List<MallUserInfo> queryUserList() ; | List<MallUserInfo> queryUserList() ; | ||||
| boolean saveCustomerAndDemand(InvestDemandVo customerDemandVo) ; | |||||
| boolean saveCustomerAndDemand(InvestDemandDto customerDemandDto) ; | |||||
| boolean updateCustomerAndDemand(InvestDemandVo customerDemandVo) ; | boolean updateCustomerAndDemand(InvestDemandVo customerDemandVo) ; | ||||
| @@ -1,6 +1,7 @@ | |||||
| package com.iformall.service.invest.impl; | package com.iformall.service.invest.impl; | ||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.iformall.domain.dto.InvestDemandDto; | |||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.invest.*; | import com.iformall.domain.vo.invest.*; | ||||
| import com.iformall.service.MallUserInfoService; | import com.iformall.service.MallUserInfoService; | ||||
| @@ -128,13 +129,19 @@ public class InvestBizServiceImpl implements InvestBizService { | |||||
| @Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
| @Override | @Override | ||||
| public boolean saveCustomerAndDemand(InvestDemandVo customerDemandVo) { | |||||
| InvestHelper.allNotNull(customerDemandVo); | |||||
| InvestHelper.allNotNull(customerDemandVo.getBrand(), customerDemandVo.getCustomer()); | |||||
| InvestCustomerEntity customerEntity = customerDemandVo.getCustomer(); | |||||
| customerService.save(customerEntity); | |||||
| public boolean saveCustomerAndDemand(InvestDemandDto customerDemandDto) { | |||||
| InvestHelper.allNotNull(customerDemandDto, customerDemandDto.getCustomerId()); | |||||
| InvestCustomerEntity customerEntity = customerDemandDto.getCustomer(); | |||||
| InvestCustomerEntity customerEntityDB = customerService.getById(customerDemandDto.getCustomerId()); | |||||
| if (Objects.nonNull(customerEntity)) { | |||||
| if (Objects.isNull(customerEntityDB)) { | |||||
| customerService.save(customerEntity); | |||||
| } else { | |||||
| customerService.updateById(customerEntity); | |||||
| } | |||||
| } | |||||
| InvestDemandEntity demandEntity = new InvestDemandEntity(); | InvestDemandEntity demandEntity = new InvestDemandEntity(); | ||||
| BeanUtils.copyProperties(customerDemandVo, demandEntity); | |||||
| BeanUtils.copyProperties(customerDemandDto, demandEntity); | |||||
| return demandService.save(demandEntity); | return demandService.save(demandEntity); | ||||
| } | } | ||||