diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/sys/MallUserInfoController.java b/mallinkAdmin/src/main/java/com/iformall/controller/sys/MallUserInfoController.java index 4415afdbe..93e20027e 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/sys/MallUserInfoController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/sys/MallUserInfoController.java @@ -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); diff --git a/mallinkAdmin/src/main/java/com/iformall/log/TableOperateAspect.java b/mallinkAdmin/src/main/java/com/iformall/log/TableOperateAspect.java index 42f1966a1..2f46ac4ed 100644 --- a/mallinkAdmin/src/main/java/com/iformall/log/TableOperateAspect.java +++ b/mallinkAdmin/src/main/java/com/iformall/log/TableOperateAspect.java @@ -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) ; diff --git a/mallinkAdmin/src/main/resources/db/migration/V201910241400__W_INVEST_ALTER.sql b/mallinkAdmin/src/main/resources/db/migration/V201910241400__W_INVEST_ALTER.sql new file mode 100644 index 000000000..f6e8c8b82 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V201910241400__W_INVEST_ALTER.sql @@ -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`; \ No newline at end of file diff --git a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestBaseEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestBaseEntity.java index af61780ae..1cfa8d6ad 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestBaseEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestBaseEntity.java @@ -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 */ diff --git a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestCustomerEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestCustomerEntity.java index 0a011e4ef..4db3cfb6a 100755 --- a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestCustomerEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestCustomerEntity.java @@ -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; /** diff --git a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestDemandEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestDemandEntity.java index 2d2fbf390..54d3358e8 100755 --- a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestDemandEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestDemandEntity.java @@ -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 diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandQuery.java b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandQuery.java index e6ff72e00..6951906b7 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandQuery.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandQuery.java @@ -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-谈判失败 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillDepositServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillDepositServiceImpl.java index b3c079dbf..1affcfc74 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillDepositServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillDepositServiceImpl.java @@ -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); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyDepositServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyDepositServiceImpl.java index 406f1bbc2..4c8c7b772 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyDepositServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyDepositServiceImpl.java @@ -51,10 +51,10 @@ public class WxBillPropertyDepositServiceImpl implements WxBillPropertyDepositSe WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(record.getTenantId()); PageHelper.startPage(pageIndex, pageSize); List billDepositList = wxBillPropertyDepositMapper.queryBillDepositList(record); - billDepositList.stream().forEach(e->{ + /*billDepositList.stream().forEach(e->{ //手续费 = 合同应收+手续费+滞纳金 computeTotalMoney(wxPayAccountBill, e); - }); + });*/ PageInfo pageInfo = new PageInfo<>(billDepositList); return pageInfo; } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java index a4be5dc17..34908733b 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java @@ -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()); 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 4674112a2..370ec72eb 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 @@ -93,15 +93,19 @@ public class InvestBizServiceImpl implements InvestBizService { List demandList = demandService.list(new LambdaQueryWrapper<>(demandParams)); LambdaQueryWrapper 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 customers = customerService.queryPage(buildPageQuery(params, null), queryWrapperCustomer); List resultList = getTargeInfoList(demandList, customers.getRecords()); @@ -276,12 +280,10 @@ public class InvestBizServiceImpl implements InvestBizService { return; } //品牌信息 - List brands = brandService.listAsPage(null, 1, Integer.MAX_VALUE).getList(); - Map brandMap = getMap(brands, WxBrand::getName); + Map brandMap = getBrandMap(); //业态信息 - List businesses = businessService.listAsPage(null, 1, Integer.MAX_VALUE).getList(); - Map businesseMap = getMap(businesses, WxBusiness::getTitle); + Map businesseMap = getBusinessMap(); //商铺信息 List shops = shopService.listAsPage(null, 1, Integer.MAX_VALUE).getList(); @@ -334,6 +336,16 @@ public class InvestBizServiceImpl implements InvestBizService { } } + private Map getBusinessMap() { + List businesses = businessService.listAsPage(null, 1, Integer.MAX_VALUE).getList(); + return getMap(businesses, WxBusiness::getTitle); + } + + private Map getBrandMap() { + List brands = brandService.listAsPage(null, 1, Integer.MAX_VALUE).getList(); + return getMap(brands, WxBrand::getName); + } + private InvestDemandDto convetCustomer(InvestCustomerVoT customerVoT, Map brandMap, Map businesseMap, Map shopMap, Map 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 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 recordList = entityPageList.getRecords(); Map usersMap = getMap(userInfoService.getByIds(getIds(recordList, InvestOperateRecordEntity::getOperator)), MallUserInfo::getId); + //品牌信息 + Map brandMap = getBrandMap(); + + //业态信息 + Map businesseMap = getBusinessMap(); + List 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; } diff --git a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestDemandServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestDemandServiceImpl.java index 7556d2a13..2291abc16 100755 --- a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestDemandServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestDemandServiceImpl.java @@ -49,6 +49,9 @@ public class InvestDemandServiceImpl extends InvestBaseServiceImpl + diff --git a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml index 5efc5dbf7..bbe2ca89e 100644 --- a/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml @@ -270,7 +270,7 @@ - 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) diff --git a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml index 474207444..e063bd4d1 100644 --- a/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxBillRentMapper.xml @@ -276,7 +276,7 @@ - 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)