|
|
|
@ -51,8 +51,10 @@ import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import javax.validation.Valid; |
|
|
|
|
import java.security.NoSuchAlgorithmException; |
|
|
|
|
import java.util.Comparator; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 基础客户表 控制器 |
|
|
|
@ -87,16 +89,17 @@ public class BasicdataClientController extends BladeController {
|
|
|
|
|
.eq(BasicdataStoreContactEntity::getShopId, detail.getId()) |
|
|
|
|
.eq(BasicdataStoreContactEntity::getDefaultType, 1) |
|
|
|
|
); |
|
|
|
|
if(ObjectUtils.isNotNull(one)){ |
|
|
|
|
if (ObjectUtils.isNotNull(one)) { |
|
|
|
|
detail.setLinkman(one.getLinkman()); |
|
|
|
|
detail.setPhone(one.getPhone()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(!list.isEmpty()){ |
|
|
|
|
if (!list.isEmpty()) { |
|
|
|
|
detail.setTypeServiceBusiness(list); |
|
|
|
|
} |
|
|
|
|
return R.data(detail); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 基础客户表 分页 |
|
|
|
|
*/ |
|
|
|
@ -107,27 +110,55 @@ public class BasicdataClientController extends BladeController {
|
|
|
|
|
Object o = basicdataClient.get("contractStartTime"); |
|
|
|
|
Object o1 = basicdataClient.get("contractEntTime"); |
|
|
|
|
Object o2 = basicdataClient.get("pid"); |
|
|
|
|
basicdataClient.put("contractStartTime",null); |
|
|
|
|
basicdataClient.put("contractEntTime",null); |
|
|
|
|
basicdataClient.put("contractStartTime", null); |
|
|
|
|
basicdataClient.put("contractEntTime", null); |
|
|
|
|
QueryWrapper<BasicdataClientEntity> queryWrapper = Condition.getQueryWrapper(basicdataClient, BasicdataClientEntity.class); |
|
|
|
|
/* queryWrapper.apply(o != null, |
|
|
|
|
"date_format (contract_start_time,'%Y-%m-%d') >= date_format ({0},'%Y-%m-%d')", o) |
|
|
|
|
.apply(o1 != null, |
|
|
|
|
"date_format (contract_ent_time,'%Y-%m-%d') <= date_format ({0},'%Y-%m-%d')", o1);*/ |
|
|
|
|
if(ObjectUtils.isNotNull(o)){ |
|
|
|
|
queryWrapper.between("contract_start_time",o,o1); |
|
|
|
|
if (ObjectUtils.isNotNull(o)) { |
|
|
|
|
queryWrapper.between("contract_start_time", o, o1); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if(ObjectUtils.isNotNull(o2)){ |
|
|
|
|
queryWrapper.eq("pid",o2); |
|
|
|
|
}else{ |
|
|
|
|
queryWrapper.eq("pid","0"); |
|
|
|
|
if (ObjectUtils.isNotNull(o2)) { |
|
|
|
|
queryWrapper.eq("pid", o2); |
|
|
|
|
} else { |
|
|
|
|
queryWrapper.eq("pid", "0"); |
|
|
|
|
} |
|
|
|
|
queryWrapper.orderByDesc("create_time"); |
|
|
|
|
IPage<BasicdataClientEntity> pages = basicdataClientService.page(Condition.getPage(query),queryWrapper); |
|
|
|
|
pages.getRecords().forEach( i ->{ |
|
|
|
|
IPage<BasicdataClientEntity> pages = basicdataClientService.page(Condition.getPage(query), queryWrapper); |
|
|
|
|
pages.getRecords().forEach(i -> { |
|
|
|
|
List<BasicdataStoreBusinessEntity> list = basicdataStoreBusinessService.list(Wrappers.<BasicdataStoreBusinessEntity>query().lambda().eq(BasicdataStoreBusinessEntity::getClientId, i.getId())); |
|
|
|
|
i.setTypeServiceBusiness(list); |
|
|
|
|
//查询客户绑定第一位联系人
|
|
|
|
|
List<BasicdataStoreContactEntity> listed = basicdataStoreContactService.list(Wrappers.<BasicdataStoreContactEntity>query().lambda().eq(BasicdataStoreContactEntity::getShopId, i.getId())); |
|
|
|
|
if (Func.isNotEmpty(listed)) { |
|
|
|
|
String string = listed.stream().sorted(Comparator.comparing(BasicdataStoreContactEntity::getCreateTime)).findFirst().map(BasicdataStoreContactEntity::getLinkman).get(); |
|
|
|
|
i.setLinkman(string); |
|
|
|
|
} |
|
|
|
|
List<String> collect = list.stream().filter(f -> Func.isNotEmpty(f.getMold())).map(BasicdataStoreBusinessEntity::getMold).collect(Collectors.toList()); |
|
|
|
|
if (collect.size() > 0) { |
|
|
|
|
//进行
|
|
|
|
|
String s = collect.get(0); |
|
|
|
|
switch (s) { |
|
|
|
|
case "1": |
|
|
|
|
i.setTypeServiceName("商配"); |
|
|
|
|
break; |
|
|
|
|
case "2": |
|
|
|
|
i.setTypeServiceName("市配"); |
|
|
|
|
break; |
|
|
|
|
case "3": |
|
|
|
|
i.setTypeServiceName("自提"); |
|
|
|
|
break; |
|
|
|
|
case "4": |
|
|
|
|
i.setTypeServiceName("三方中转"); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//处理客户的配送类型
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if(!i.getCreateUser().equals(null)){
|
|
|
|
|
// R<User> userR = userClient.userInfoById(i.getCreateUser());
|
|
|
|
|
// i.setCreateUserName(userR.getData().getName());
|
|
|
|
@ -157,6 +188,7 @@ public class BasicdataClientController extends BladeController {
|
|
|
|
|
List<BasicdataClientEntity> pages = basicdataClientService.listName(name); |
|
|
|
|
return R.data(pages); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 基础客户表查询 |
|
|
|
|
*/ |
|
|
|
|