Przeglądaj źródła

[招商]adjust

release_toaliyun_real
Burce 6 lat temu
rodzic
commit
4bdd690854
7 zmienionych plików z 101 dodań i 14 usunięć
  1. +4
    -1
      mallinkService/src/main/java/com/iformall/domain/po/invest/InvestTaskEntity.java
  2. +4
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java
  3. +3
    -3
      mallinkService/src/main/java/com/iformall/service/WxRentContractService.java
  4. +30
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  5. +5
    -0
      mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java
  6. +43
    -10
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java
  7. +12
    -0
      mallinkService/src/main/resources/mapper/WxRentContractMapper.xml

+ 4
- 1
mallinkService/src/main/java/com/iformall/domain/po/invest/InvestTaskEntity.java Wyświetl plik

@@ -50,10 +50,13 @@ public class InvestTaskEntity extends InvestBaseEntity {
*/
@io.swagger.annotations.ApiModelProperty(value = "任务设定条件", name = "content",example = "{" +
"\"business\": 1," +
" \"lastDate\": \"2018-10-01 12:18:48\",\"contractId\":222222222222" +
"\"contractId\":222222222222" +
"}")
private String content;

@io.swagger.annotations.ApiModelProperty(value = "最晚出租时间", name = "lastTime", example = "2018-10-01",readOnly = true)
private Date lastTime;

/**
* 更新时间
*/


+ 4
- 0
mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java Wyświetl plik

@@ -5,7 +5,9 @@ import com.iformall.domain.po.WxBillRent;
import com.iformall.domain.po.WxBusiness;
import com.iformall.domain.po.WxRentContract;
import com.iformall.domain.vo.WxRentPropertyContractVo;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;
import java.util.Map;

@@ -58,6 +60,8 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Long>

List<WxRentContract> selectRentContractByShopId(WxRentContract record);

List<WxRentContract> selectRentContractByShopIds(@Param("shopIds") Collection<Long> shopIds, @Param("shopIdsRegexp") String shopIdsRegexp);

int hasContractNumber(WxRentContract wxRentContract);

Integer getShopType(WxRentContract wxRentContract);


+ 3
- 3
mallinkService/src/main/java/com/iformall/service/WxRentContractService.java Wyświetl plik

@@ -1,13 +1,11 @@
package com.iformall.service;

import com.github.pagehelper.PageInfo;
import com.iformall.common.ResultData;
import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxRentPropertyContractVo;
import io.swagger.models.auth.In;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -96,4 +94,6 @@ public interface WxRentContractService {

WxRentContract getByBill(WxBillRent billRent);

Map<Long,WxRentContract> selectRentContractByShopIds(Collection<Long> shopIds, String shopIdsRegexp);

}

+ 30
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Wyświetl plik

@@ -2488,4 +2488,34 @@ public class WxRentContractServiceImpl implements WxRentContractService {
public WxRentContract getByBill(WxBillRent billRent) {
return wxRentContractMapper.getByBill(billRent);
}

@Override
public Map<Long, WxRentContract> selectRentContractByShopIds(Collection<Long> shopIds, String shopIdsRegexp) {
List<WxRentContract> list = wxRentContractMapper.selectRentContractByShopIds(shopIds, shopIdsRegexp);
Map<Long, WxRentContract> allShopContract = new HashMap<>();
for (WxRentContract wxRentContract : list) {
if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) {
String rentInfo = wxRentContract.getRentInfo();
JSONArray rentInfoArray = JSONArray.parseArray(rentInfo);
int size = rentInfoArray.size();
//查询rent_info 包括 shopId
for (int i = 0; i < size; i++) {
JSONObject rentInfoObject = rentInfoArray.getJSONObject(i);
WxRentContract rentContract = new WxRentContract();
rentContract.setRentalStartDate(wxRentContract.getRentalStartDate());
rentContract.setRentalEndDate(wxRentContract.getRentalEndDate());
Long shopId = rentInfoObject.getLong("shopId");
if (Objects.isNull(shopId) || !shopIdsRegexp.contains(String.valueOf(shopId))) {
continue;
}
rentContract.setShopId(shopId);
allShopContract.put(shopId, rentContract);
}
}
if (shopIds.contains(wxRentContract.getShopId())) {
allShopContract.put(wxRentContract.getShopId(), wxRentContract);
}
}
return allShopContract;
}
}

+ 5
- 0
mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java Wyświetl plik

@@ -19,6 +19,7 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;

public class InvestHelper {
@@ -174,4 +175,8 @@ public class InvestHelper {
public static <T, R> Collection<R> getIds(Collection<T> dataList, Function<? super T, R> mapper) {
return dataList.parallelStream().map(mapper).collect(Collectors.toList());
}

public static <T, R> Collection<R> getIds(Collection<T> dataList, Predicate<T> predicate,Function<? super T, R> mapper) {
return dataList.parallelStream().filter(predicate).map(mapper).collect(Collectors.toList());
}
}

+ 43
- 10
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java Wyświetl plik

@@ -9,11 +9,10 @@ import com.iformall.domain.dto.InvestTaskDto;
import com.iformall.domain.po.*;
import com.iformall.domain.po.invest.*;
import com.iformall.domain.vo.invest.*;
import com.iformall.enums.EnumFollowType;
import com.iformall.enums.EnumInvestUserType;
import com.iformall.enums.EnumNegotiationType;
import com.iformall.enums.*;
import com.iformall.service.MallUserInfoService;
import com.iformall.service.WxBrandService;
import com.iformall.service.WxRentContractService;
import com.iformall.service.WxShopService;
import com.iformall.service.invest.*;
import org.apache.commons.collections.CollectionUtils;
@@ -53,6 +52,8 @@ public class InvestBizServiceImpl implements InvestBizService {
private WxBrandService brandService;
@Autowired
private MallUserInfoService userInfoService;
@Autowired
private WxRentContractService rentContractService;

@Override
public InvestPageResult<InvestDemandVo> queryPageDemand(InvestDemandQuery params) {
@@ -140,9 +141,24 @@ public class InvestBizServiceImpl implements InvestBizService {
Collection<InvestTaskEntity> taskList = taskPage.getRecords();
//2、目标信息
Collection<WxShop> shops = shopService.getByIds(getIds(taskList, InvestTaskEntity::getTargetId));
//3、商品合同信息
Map<Long, WxRentContract> shopContractMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(shops)) {
Collection<Long> shopPointIds = buildShopContractQuery(shops, EnumRentShopType.POINT);
Collection<Long> shopIds = buildShopContractQuery(shops, EnumRentShopType.SHOP);
shopContractMap = rentContractService.selectRentContractByShopIds(shopPointIds, StringUtils.join(shopIds, "|"));
}
for (WxShop shop : shops) {
WxRentContract contract = shopContractMap.get(shop.getId());
if (Objects.nonNull(contract)) {
shop.setStartdate(contract.getRentalStartDate());
shop.setEnddate(contract.getEndDate());
}
}

Map<Long, WxShop> shopsMap = getMap(shops, WxShop::getId);
//3、用户信息
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(), MallUserInfo::getId);
//4、用户信息
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(null), MallUserInfo::getId);
List<InvestTaskVo> resultList = new ArrayList<>();
for (InvestTaskEntity item : taskList) {
WxShop shop = shopsMap.get(item.getTargetId());
@@ -153,6 +169,17 @@ public class InvestBizServiceImpl implements InvestBizService {
return investPage;
}

private Collection<Long> buildShopContractQuery(Collection<WxShop> shops, EnumRentShopType shopType) {
Collection<Long> shopIds = new ArrayList<>();
if (CollectionUtils.isNotEmpty(shops)) {
shopIds = InvestHelper.getIds(shops, wxShop -> Objects.equals(wxShop.getType(), shopType.getCode()), WxShop::getId);
}
if (CollectionUtils.isEmpty(shopIds)) {
shopIds.add(00L);
}
return shopIds;
}


private InvestTaskDto doConvertTask(InvestTaskQuery params) {
InvestTaskEntity task = new InvestTaskEntity();
@@ -195,7 +222,7 @@ public class InvestBizServiceImpl implements InvestBizService {
Collection<InvestFollowRecordEntity> recordList = recordPage.getRecords();

//2、用户信息
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(), MallUserInfo::getId);
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(null), MallUserInfo::getId);

//3、客户
Collection<InvestCustomerEntity> customers = customerService.listByIds(getIds(recordList, InvestFollowRecordEntity::getCustomerId));
@@ -292,8 +319,14 @@ public class InvestBizServiceImpl implements InvestBizService {

@Override
public List<MallUserInfo> queryUserList() {
return queryUserList(EnumInvestUserType.USER);
}

public List<MallUserInfo> queryUserList(EnumInvestUserType userType) {
LambdaQueryWrapper<MallUserInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(MallUserInfo::getInvestRule, EnumInvestUserType.USER.getCode());
if (Objects.nonNull(userType)) {
queryWrapper.eq(MallUserInfo::getInvestRule, userType.getCode());
}
return userInfoService.selectList(queryWrapper);
}

@@ -329,7 +362,7 @@ public class InvestBizServiceImpl implements InvestBizService {
InvestDemandEntity demandEntity = demandService.getByCustomerId(customerEntity.getId());
WxBrand brand = brandService.getById(customerEntity.getBrandId());
WxShop shop = shopService.getById(demandEntity.getTargetId());
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(), MallUserInfo::getId);
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(null), MallUserInfo::getId);
return buildDemindItem(demandEntity, customerEntity, brand, shop, usersMap);
}

@@ -337,7 +370,7 @@ public class InvestBizServiceImpl implements InvestBizService {
public InvestTaskVo findTaskById(Long id) {
InvestTaskEntity taskEntity = taskService.getByIdNotNull(id);
WxShop shop = shopService.getById(taskEntity.getTargetId());
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(), MallUserInfo::getId);
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(null), MallUserInfo::getId);
return buildTaskItem(taskEntity, shop, usersMap);
}

@@ -422,7 +455,7 @@ public class InvestBizServiceImpl implements InvestBizService {
@Override
public InvestFollowRecordVo findFollowRecordById(Long id) {
InvestFollowRecordEntity followRecordEntity = followRecordService.getByIdNotNull(id);
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(), MallUserInfo::getId);
Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(null), MallUserInfo::getId);
InvestCustomerEntity customerEntity = customerService.getByIdNotNull(followRecordEntity.getCustomerId());
WxBrand brand = brandService.getById(customerEntity.getBrandId());
return buildFollowRecordItem(usersMap, followRecordEntity, customerEntity, brand);


+ 12
- 0
mallinkService/src/main/resources/mapper/WxRentContractMapper.xml Wyświetl plik

@@ -432,5 +432,17 @@
select 2 type,c.`rental_start_date`,c.`rental_end_date`,c.id id from wx_merchant m left join wx_property_contract c on(m.id = c.merchant_id)
where m.business_id = #{id} and c.price is not null and c.`rental_start_date` is not null and c.`rental_end_date` is not null
</select>
<select id="selectRentContractByShopIds" resultType="com.iformall.domain.po.WxRentContract">
SELECT rc.id,rc.rental_start_date,rc.rental_end_date,rc.`shop_id`,rc.`rent_shop_type`,rc.`rent_info` FROM
`wx_rent_contract` rc
WHERE rc.`status` IN (2,3,4)
AND ( (rc.`rent_shop_type`=2 AND rc.`shop_id` IN
<foreach collection="shopIds" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
)
OR (rc.`rent_shop_type`=1 AND rc.`rent_info` REGEXP #{shopIdsRegexp})
)
</select>
</mapper>


Ładowanie…
Anuluj
Zapisz