developrelease_toaliyun_real
| @@ -198,6 +198,7 @@ public class MallUserInfoController extends BaseController { | |||
| if (StringUtils.isNotBlank(userInfo.getPhone())) { | |||
| adminUser.setPhone(userInfo.getPhone()); | |||
| } | |||
| adminUser.setInvestRule(userInfo.getInvestRule()); | |||
| userInfoService.saveOrUpdate(adminUser); | |||
| } else { | |||
| userInfoService.saveOrUpdate(userInfo); | |||
| @@ -8,6 +8,7 @@ import com.google.common.collect.Maps; | |||
| import com.iformall.common.LogColumn; | |||
| import com.iformall.domain.po.invest.InvestBaseEntity; | |||
| import com.iformall.domain.po.invest.InvestOperateRecordEntity; | |||
| import com.iformall.domain.vo.invest.InvestUserContext; | |||
| import com.iformall.domain.vo.invest.TableTriple; | |||
| import com.iformall.enums.EnumTableOperateType; | |||
| import com.iformall.service.invest.InvestHelper; | |||
| @@ -108,6 +109,7 @@ public class TableOperateAspect { | |||
| InvestOperateRecordEntity recordEntity = new InvestOperateRecordEntity(); | |||
| recordEntity.setContent(JSON.toJSONString(o)); | |||
| recordEntity.setOperateType(operateType); | |||
| recordEntity.setOperator(InvestUserContext.getUserId()); | |||
| recordEntity.setTbl(getTbl(signature)); | |||
| recordEntity.setTid(tid); | |||
| toSaveRecord.add(recordEntity) ; | |||
| @@ -0,0 +1,2 @@ | |||
| ALTER TABLE `invest_demand` CHANGE COLUMN `owner` `owner` bigint(20) DEFAULT 0 COMMENT '负责人'; | |||
| ALTER TABLE `invest_customer` ADD COLUMN `customer_no` varchar(20) NOT NULL DEFAULT '' COMMENT '客户编号' AFTER `tenant_id`; | |||
| @@ -25,6 +25,7 @@ public class InvestBaseEntity implements Serializable { | |||
| @TableId(type = IdType.ID_WORKER) | |||
| @io.swagger.annotations.ApiModelProperty(value = "主键ID", name = "id") | |||
| private Long id; | |||
| /** | |||
| * 租户ID | |||
| */ | |||
| @@ -29,6 +29,12 @@ import java.util.Date; | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class InvestCustomerEntity extends InvestBaseEntity { | |||
| /** | |||
| * 客户编号 | |||
| */ | |||
| @io.swagger.annotations.ApiModelProperty(value = "客户编号", name = "customerNo") | |||
| private String customerNo; | |||
| /** | |||
| * 客户名称 | |||
| */ | |||
| @@ -55,19 +61,18 @@ public class InvestCustomerEntity extends InvestBaseEntity { | |||
| @LogColumn | |||
| @io.swagger.annotations.ApiModelProperty(value = "品牌ID", name = "brandId") | |||
| private Long brandId; | |||
| /** | |||
| * 客户分类:0-潜在客户;1-意向客户;2-合作客户;3-谈判失败 | |||
| */ | |||
| @io.swagger.annotations.ApiModelProperty(value = "客户分类:0-潜在客户;1-意向客户;2-合作客户;3-谈判失败", name = "type") | |||
| @LogColumn | |||
| @TableField(strategy = FieldStrategy.IGNORED) | |||
| private EnumCustomerType type; | |||
| /** | |||
| * 客户预评级:0-无;1-主力店;2-次主力店;3-甲;4-乙;5-丙 | |||
| */ | |||
| @io.swagger.annotations.ApiModelProperty(value = "客户预评级:0-无;1-主力店;2-次主力店;3-甲;4-乙;5-丙", name = "rating") | |||
| @LogColumn | |||
| @TableField(strategy = FieldStrategy.IGNORED) | |||
| private EnumCustomerRatingType rating; | |||
| /** | |||
| @@ -34,7 +34,6 @@ public class InvestDemandEntity extends InvestBaseEntity { | |||
| */ | |||
| @io.swagger.annotations.ApiModelProperty(value = "负责人", name = "owner") | |||
| @LogColumn | |||
| @TableField(strategy = FieldStrategy.IGNORED) | |||
| private Long owner; | |||
| /** | |||
| * 客户ID | |||
| @@ -9,10 +9,10 @@ import lombok.EqualsAndHashCode; | |||
| public class InvestDemandQuery extends InvestPageQuery { | |||
| /** | |||
| * 主键ID | |||
| * 客户编号 | |||
| */ | |||
| @io.swagger.annotations.ApiModelProperty(value = "客户编号", name = "customerId") | |||
| private Long customerId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "客户编号", name = "customerNo") | |||
| private String customerNo; | |||
| /** | |||
| * 客户分类:0-潜在客户;1-意向客户;2-合作客户;3-谈判失败 | |||
| @@ -126,10 +126,10 @@ public class WxBillDepositServiceImpl implements WxBillDepositService { | |||
| @Override | |||
| public ResultData saveOrUpdate(WxBillDeposit record, MallUserInfo user) { | |||
| int receivepay = record.getRealReceivePay() == null ? 0 : record.getRealReceivePay().intValue(); | |||
| int receivepay = record.getReceivePay() == null ? 0 : record.getReceivePay().intValue(); | |||
| int pay = record.getPay()==null?0:record.getPay().intValue(); | |||
| if(pay>receivepay){ | |||
| return new ResultData(ErrorCode.BILL_PAY_ERROR.getCode(), "实收金额不能大于实际应收总金额"); | |||
| return new ResultData(ErrorCode.BILL_PAY_ERROR.getCode(), "实收金额不能大于实际应收金额"); | |||
| } | |||
| Date date = new Date(); | |||
| if (record.getId() == null) { | |||
| @@ -138,7 +138,7 @@ public class WxBillDepositServiceImpl implements WxBillDepositService { | |||
| record.setId(idWorker.nextId()); | |||
| record.setCreatetime(date); | |||
| record.setUpdatetime(date); | |||
| record.setOwe(record.getRealReceivePay() - record.getPay()); | |||
| record.setOwe(record.getReceivePay() - record.getPay()); | |||
| record.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | |||
| try { | |||
| wxBillDepositMapper.insert(record); | |||
| @@ -156,8 +156,8 @@ public class WxBillDepositServiceImpl implements WxBillDepositService { | |||
| Long addpay = wxBillDeposit.getPay(); | |||
| wxBillDeposit.setPay(record.getPay()); | |||
| wxBillDeposit.setReceivePay(record.getReceivePay()); | |||
| wxBillDeposit.setOwe(record.getRealReceivePay() - record.getPay()); | |||
| if (record.getPay().equals(record.getRealReceivePay())) { | |||
| wxBillDeposit.setOwe(record.getReceivePay() - record.getPay()); | |||
| if (record.getPay().equals(record.getReceivePay())) { | |||
| wxBillDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); | |||
| Date receiveDate = wxBillDeposit.getReceiveDate(); | |||
| wxBillDeposit.setExpiredDay(0L); | |||
| @@ -51,10 +51,10 @@ public class WxBillPropertyDepositServiceImpl implements WxBillPropertyDepositSe | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(record.getTenantId()); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<WxBillPropertyDeposit> billDepositList = wxBillPropertyDepositMapper.queryBillDepositList(record); | |||
| billDepositList.stream().forEach(e->{ | |||
| /*billDepositList.stream().forEach(e->{ | |||
| //手续费 = 合同应收+手续费+滞纳金 | |||
| computeTotalMoney(wxPayAccountBill, e); | |||
| }); | |||
| });*/ | |||
| PageInfo<WxBillPropertyDeposit> pageInfo = new PageInfo<>(billDepositList); | |||
| return pageInfo; | |||
| } | |||
| @@ -421,7 +421,9 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| if (wxPayAccount != null && wxPayAccount.getShare().equals(EnumPayShare.NO.getCode())) { | |||
| try { | |||
| // 核销记账 | |||
| recordAfterVerified(couponOrder, bUser.getMerchantId()); | |||
| if (couponOrder.getCouponPrice() > 0) { | |||
| recordAfterVerified(couponOrder, bUser.getMerchantId()); | |||
| } | |||
| } catch (Exception e) { | |||
| logger.info("核销记账失败"); | |||
| logger.error(e.getMessage()); | |||
| @@ -93,15 +93,19 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| List<InvestDemandEntity> demandList = demandService.list(new LambdaQueryWrapper<>(demandParams)); | |||
| LambdaQueryWrapper<InvestCustomerEntity> queryWrapperCustomer = new LambdaQueryWrapper<>(customerParams); | |||
| if (Objects.isNull(InvestUserContext.getDataUser())) { | |||
| queryWrapperCustomer.in(ObjectUtils.allNotNull(params.getDemandOwner()), | |||
| InvestCustomerEntity::getId, getIds(demandList, InvestDemandEntity::getCustomerId)); | |||
| if (CollectionUtils.isEmpty(demandList) && Objects.nonNull(params.getDemandOwner())) { | |||
| return investPage; | |||
| } else { | |||
| queryWrapperCustomer.in(CollectionUtils.isNotEmpty(demandList),InvestCustomerEntity::getId, getIds(demandList, InvestDemandEntity::getCustomerId)); | |||
| } | |||
| } else { | |||
| if (CollectionUtils.isEmpty(demandList)) { | |||
| return investPage; | |||
| } else { | |||
| queryWrapperCustomer.in(InvestCustomerEntity::getId, getIds(demandList, InvestDemandEntity::getCustomerId)); | |||
| queryWrapperCustomer.in(CollectionUtils.isNotEmpty(demandList),InvestCustomerEntity::getId, getIds(demandList, InvestDemandEntity::getCustomerId)); | |||
| } | |||
| } | |||
| queryWrapperCustomer.like(StringUtils.isNotBlank(params.getCustomerNo()), InvestCustomerEntity::getCustomerNo, params.getCustomerNo()); | |||
| queryWrapperCustomer.orderByDesc(InvestCustomerEntity::getCreateDate); | |||
| InvestPageResult<InvestCustomerEntity> customers = customerService.queryPage(buildPageQuery(params, null), queryWrapperCustomer); | |||
| List<InvestDemandVo> resultList = getTargeInfoList(demandList, customers.getRecords()); | |||
| @@ -276,12 +280,10 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| return; | |||
| } | |||
| //品牌信息 | |||
| List<WxBrand> brands = brandService.listAsPage(null, 1, Integer.MAX_VALUE).getList(); | |||
| Map<String, WxBrand> brandMap = getMap(brands, WxBrand::getName); | |||
| Map<String, WxBrand> brandMap = getBrandMap(); | |||
| //业态信息 | |||
| List<WxBusiness> businesses = businessService.listAsPage(null, 1, Integer.MAX_VALUE).getList(); | |||
| Map<String, WxBusiness> businesseMap = getMap(businesses, WxBusiness::getTitle); | |||
| Map<String, WxBusiness> businesseMap = getBusinessMap(); | |||
| //商铺信息 | |||
| List<WxShop> shops = shopService.listAsPage(null, 1, Integer.MAX_VALUE).getList(); | |||
| @@ -334,6 +336,16 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| } | |||
| } | |||
| private Map<String, WxBusiness> getBusinessMap() { | |||
| List<WxBusiness> businesses = businessService.listAsPage(null, 1, Integer.MAX_VALUE).getList(); | |||
| return getMap(businesses, WxBusiness::getTitle); | |||
| } | |||
| private Map<String, WxBrand> getBrandMap() { | |||
| List<WxBrand> brands = brandService.listAsPage(null, 1, Integer.MAX_VALUE).getList(); | |||
| return getMap(brands, WxBrand::getName); | |||
| } | |||
| private InvestDemandDto convetCustomer(InvestCustomerVoT customerVoT, Map<String, WxBrand> brandMap, Map<String, WxBusiness> businesseMap, Map<String, WxShop> shopMap, Map<String, InvestCustomerEntity> customerMap) { | |||
| InvestCustomerEntity customerEntity = new InvestCustomerEntity(); | |||
| if (Objects.isNull(brandMap.get(customerVoT.getBrandName()))) { | |||
| @@ -409,9 +421,9 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| private InvestDemandDto doConvertDemand(InvestDemandQuery params) { | |||
| InvestCustomerEntity customerEntity = null; | |||
| if (ObjectUtils.anyNotNull(params.getCustomerId(), params.getCustomerType(), params.getBusinessId())) { | |||
| if (ObjectUtils.anyNotNull(params.getCustomerNo(), params.getCustomerType(), params.getBusinessId())) { | |||
| customerEntity = new InvestCustomerEntity(); | |||
| customerEntity.setId(params.getCustomerId()); | |||
| customerEntity.setCustomerNo(params.getCustomerNo()); | |||
| customerEntity.setType(params.getCustomerType()); | |||
| customerEntity.setBusinessId(params.getBusinessId()); | |||
| } | |||
| @@ -702,12 +714,12 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| return true; | |||
| } | |||
| private void saveMessage(InvestDemandEntity entity, InvestCustomerEntity customerEntity) { | |||
| if (Objects.isNull(entity)) { | |||
| private void saveMessage(InvestDemandEntity demandEntity, InvestCustomerEntity customerEntity) { | |||
| if (Objects.isNull(demandEntity)) { | |||
| return; | |||
| } | |||
| Long owner = entity.getOwner(); | |||
| if (Objects.nonNull(owner)) { | |||
| Long owner = demandEntity.getOwner(); | |||
| if (Objects.nonNull(owner) && !Objects.equals(owner, 0L)) { | |||
| List<Long> ownerArray = Arrays.asList(owner); | |||
| demandService.saveBatchMessage(ownerArray, EnumInvestMessageType.CUSTOMER_CREATE.getInfo(), EnumInvestMessageTag.CUSTOMER_CREATE, EnumFollowType.DEMAND, customerEntity.getId()); | |||
| } | |||
| @@ -816,6 +828,12 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| Collection<InvestOperateRecordEntity> recordList = entityPageList.getRecords(); | |||
| Map<Long, MallUserInfo> usersMap = getMap(userInfoService.getByIds(getIds(recordList, InvestOperateRecordEntity::getOperator)), MallUserInfo::getId); | |||
| //品牌信息 | |||
| Map<String, WxBrand> brandMap = getBrandMap(); | |||
| //业态信息 | |||
| Map<String, WxBusiness> businesseMap = getBusinessMap(); | |||
| List<InvestOperateRecordVo> resultList = new ArrayList<>(); | |||
| for (InvestOperateRecordEntity recordEntity : recordList) { | |||
| InvestOperateRecordVo itemVo = new InvestOperateRecordVo(); | |||
| @@ -825,7 +843,38 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| itemVo.setOperatorName(userInfo.getName()); | |||
| } | |||
| TableTriple content = JSON.parseObject(recordEntity.getContent(), TableTriple.class); | |||
| itemVo.setRecord(content); | |||
| itemVo.setRecord(convert(content, tableTriple -> { | |||
| Object column = tableTriple.getColumn(); | |||
| if (Objects.equals(column, "businessId")) { | |||
| WxBusiness businessBefore = businesseMap.get(tableTriple.getBefore()) ; | |||
| WxBusiness businessAfter = businesseMap.get(tableTriple.getAfter()) ; | |||
| if (Objects.nonNull(businessBefore)) { | |||
| tableTriple.setBefore(businessBefore.getTitle()); | |||
| } | |||
| if (Objects.nonNull(businessAfter)) { | |||
| tableTriple.setBefore(businessAfter.getTitle()); | |||
| } | |||
| } else if (Objects.equals(column, "brandId")) { | |||
| WxBrand brandBefore = brandMap.get(tableTriple.getBefore()) ; | |||
| WxBrand brandAfter = brandMap.get(tableTriple.getAfter()) ; | |||
| if (Objects.nonNull(brandBefore)) { | |||
| tableTriple.setBefore(brandBefore.getName()); | |||
| } | |||
| if (Objects.nonNull(brandAfter)) { | |||
| tableTriple.setBefore(brandAfter.getName()); | |||
| } | |||
| } else if (Objects.equals(column, "owner")) { | |||
| MallUserInfo userBefore = usersMap.get(tableTriple.getBefore()); | |||
| MallUserInfo userAfter = usersMap.get(tableTriple.getAfter()); | |||
| if (Objects.nonNull(userBefore)) { | |||
| tableTriple.setBefore(userBefore.getName()); | |||
| } | |||
| if (Objects.nonNull(userAfter)) { | |||
| tableTriple.setBefore(userAfter.getName()); | |||
| } | |||
| } | |||
| return tableTriple; | |||
| })); | |||
| resultList.add(itemVo); | |||
| } | |||
| BeanUtils.copyProperties(entityPageList, investPage); | |||
| @@ -905,13 +954,16 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| InvestDemandVo resultItemVo = new InvestDemandVo(); | |||
| BeanUtils.copyProperties(customer, resultItemVo); | |||
| resultItemVo.setBrand(brand); | |||
| resultItemVo.setDemand(item); | |||
| resultItemVo.setTargetInfo(shop); | |||
| if (Objects.nonNull(item)) { | |||
| if (Objects.equals(item.getOwner(), 0L)) { | |||
| item.setOwner(null); | |||
| } | |||
| if (Objects.nonNull(usersMap.get(item.getOwner()))) { | |||
| resultItemVo.setOwnerInfo(usersMap.get(item.getOwner())); | |||
| } | |||
| } | |||
| resultItemVo.setDemand(item); | |||
| return resultItemVo; | |||
| } | |||
| @@ -49,6 +49,9 @@ public class InvestDemandServiceImpl extends InvestBaseServiceImpl<InvestDemandM | |||
| if(Objects.nonNull(entity.getIntent())) { | |||
| entity.setIntent(stringToJson(entity.getIntent())); | |||
| } | |||
| if(Objects.isNull(entity.getOwner())) { | |||
| entity.setOwner(0L); | |||
| } | |||
| } | |||
| @Deprecated | |||
| @@ -7,6 +7,7 @@ | |||
| <resultMap type="com.iformall.domain.po.invest.InvestCustomerEntity" id="investCustomerMap"> | |||
| <result property="id" column="id"/> | |||
| <result property="tenantId" column="tenant_id"/> | |||
| <result property="customerNo" column="customer_no"/> | |||
| <result property="name" column="name"/> | |||
| <result property="phone" column="phone"/> | |||
| <result property="businessId" column="business_id"/> | |||
| @@ -270,7 +270,7 @@ | |||
| </update> | |||
| <update id="updateServiceCharge" parameterType="com.iformall.domain.po.WxPayAccountBill"> | |||
| update wx_bill_property set service_charge_pay=round(receive_pay*#{serviceChargeRate}/100) where tenant_id=#{tenantId} and service_charge_pay=0 and status in(1,2,4) | |||
| update wx_bill_property set service_charge_pay=round(receive_pay*#{serviceChargeRate}/10000) where tenant_id=#{tenantId} and service_charge_pay=0 and status in(1,2,4) | |||
| </update> | |||
| <update id="updateOwe"> | |||
| @@ -276,7 +276,7 @@ | |||
| </update> | |||
| <update id="updateServiceCharge" parameterType="com.iformall.domain.po.WxPayAccountBill"> | |||
| update wx_bill_rent set service_charge_pay=round(receive_pay*#{serviceChargeRate}/100) where tenant_id=#{tenantId} and service_charge_pay=0 and status in(1,2,4) | |||
| update wx_bill_rent set service_charge_pay=round(receive_pay*#{serviceChargeRate}/10000) where tenant_id=#{tenantId} and service_charge_pay=0 and status in(1,2,4) | |||
| </update> | |||
| <update id="updateOwe"> | |||