Commit a423e55a authored by 赵啸非's avatar 赵啸非

回退站点业务请求列表

parent 301eaf3d
......@@ -146,6 +146,11 @@ public class MidSignApiController {
headerMap.put("sign", sign);
//todo 添加rsa非对称加密
String pwdRsa = pwd + "#" + timeStamp;
pwdRsa = EncryptionUtils.encrypt(pwdRsa, publickey);
String param = "{\"USER\":\"" + user + "\",\"PWD\":\"" + pwdRsa + "\"}";
param = Base64.encodeBase64String(param.getBytes("UTF-8"));
headerMap.put("param", param);
/* String pwdRsa = pwd + "#" + timeStamp;
pwdRsa = EncryptionUtils.encrypt(pwdRsa, publickey);
String param = "{\"USER\":\"" + user + "\",\"PWD\":\"" + pwdRsa + "\"}";
......
......@@ -6,9 +6,7 @@ import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.framework.utils.PageUtils;
import com.mortals.xhx.common.code.IsBusinessEnum;
import com.mortals.xhx.common.utils.MemoryPagination;
import com.mortals.xhx.module.business.model.BusinessEntity;
import com.mortals.xhx.module.business.model.BusinessMatterEntity;
import com.mortals.xhx.module.business.model.BusinessMatterQuery;
......@@ -21,7 +19,6 @@ import com.mortals.xhx.module.site.model.SiteBusinessQuery;
import com.mortals.xhx.module.site.model.SiteBusinessTreeSelect;
import com.mortals.xhx.module.site.service.SiteBusinessService;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -56,10 +53,6 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu
*/
@Override
protected SiteBusinessEntity findBefore(SiteBusinessEntity params, PageInfo pageInfo, Context context) throws AppException {
//查询所有
// pageInfo.setCurrPage(1);
//pageInfo.setPrePageResult(-1);
if (!ObjectUtils.isEmpty(params.getIdNotList())) {
Set<Long> notIdSet = params.getIdNotList().stream().collect(Collectors.toSet());
//排除掉了父级,但是子集存在,需要吧父id排除到notlist外
......@@ -85,100 +78,13 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu
}
params.setIdNotList(notIdSet.stream().collect(Collectors.toList()));
}
return super.findBefore(params, pageInfo, context);
}
/**
* @param params
* @param pageInfo
* @param context
* @return
* @throws AppException
*/
@Override
public Result<SiteBusinessEntity> find(SiteBusinessEntity params, PageInfo pageInfo, Context context) throws AppException {
if (!ObjectUtils.isEmpty(params.getIdNotList())) {
Set<Long> notIdSet = params.getIdNotList().stream().collect(Collectors.toSet());
//排除掉了父级,但是子集存在,需要吧父id排除到notlist外
SiteBusinessQuery siteBusinessQuery = new SiteBusinessQuery();
siteBusinessQuery.setIdList(params.getIdNotList());
List<SiteBusinessEntity> rootSiteBusiness = this.find(siteBusinessQuery).stream().filter(f -> f.getIsBusiness() == IsBusinessEnum.一级业务.getValue()).collect(Collectors.toList());
for (SiteBusinessEntity root : rootSiteBusiness) {
SiteBusinessQuery query = new SiteBusinessQuery();
query.setParentId(root.getId());
List<SiteBusinessEntity> childSiteBusiness = this.find(query, context);
//判断排除的id是否包含所有
Boolean bool = false;
for (SiteBusinessEntity child : childSiteBusiness) {
if (!notIdSet.contains(child.getId())) {
bool = true;
break;
}
}
if (bool) {
//排除掉父id
notIdSet.remove(root.getId());
}
}
params.setIdNotList(notIdSet.stream().collect(Collectors.toList()));
}
//SiteBusinessEntity params = this.findBefore(entity, pageInfo, context);
Result<SiteBusinessEntity> result = this.dao.getList(params, pageInfo);
List<SiteBusinessEntity> list = result.getList();
if (!ObjectUtils.isEmpty(params.getIdNotList())) {
//重新内存分页
// result.getPageInfo().setCurrPage(params.getPage());
// result.getPageInfo().setPrePageResult(params.getSize());
list = MemoryPagination.pagination(list, params.getSize() == -1 ? list.size() : params.getSize(), params.getPage());
//排除掉已经存在的ids
log.info("idNotList:{}", JSON.toJSONString(params.getIdNotList()));
Iterator<SiteBusinessEntity> iterator = list.iterator();
while (iterator.hasNext()) {
SiteBusinessQuery siteBusinessQuery = new SiteBusinessQuery();
SiteBusinessEntity item = iterator.next();
siteBusinessQuery.siteId(item.getSiteId());
siteBusinessQuery.setParentId(item.getBusinessId());
int count = this.count(siteBusinessQuery, context);
if (count > 0) {
siteBusinessQuery.setIdNotList(params.getIdNotList());
List<SiteBusinessEntity> childs = this.find(siteBusinessQuery);
if (ObjectUtils.isEmpty(childs)) {
//子节点已经全部选中,删除父节点
iterator.remove();
pageInfo.setTotalResult(pageInfo.getTotalResult() - 1);
} else {
childs.stream().forEach(item1 -> {
buildChildBusiness(item1);
});
item.setChildren(childs);
}
}
buildChildBusiness(item);
}
} else {
list.stream().peek(item -> {
SiteBusinessQuery siteBusinessQuery = new SiteBusinessQuery();
List<SiteBusinessEntity> childs = this.find(siteBusinessQuery.siteId(item.getSiteId()).parentId(item.getBusinessId()));
childs.stream().forEach(item1 -> {
buildChildBusiness(item1);
});
item.setChildren(childs);
buildChildBusiness(item);
}).count();
}
result.setList(list);
// this.findAfter(entity, pageInfo, context, result.getList());
return result;
return super.findBefore(params, pageInfo, context);
}
@Override
protected void findAfter(SiteBusinessEntity params, PageInfo pageInfo, Context context, List<SiteBusinessEntity> list) throws AppException {
//重新内存分页
list = MemoryPagination.pagination(list, params.getSize() == -1 ? list.size() : params.getSize(), params.getPage());
if (!ObjectUtils.isEmpty(params.getIdNotList())) {
//排除掉已经存在的ids
log.info("idNotList:{}", JSON.toJSONString(params.getIdNotList()));
......@@ -241,8 +147,6 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu
item.setBusinessChildren(businessEntities);
}
}
}else{
log.info("未找到businessEntity BusinessId :{}",item.getBusinessId());
}
}
}
......@@ -268,19 +172,19 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu
SiteBusinessEntity siteBusinessEntity = this.get(item);
return this.find(new SiteBusinessQuery().parentId(siteBusinessEntity.getId())).stream();
}).collect(Collectors.toList());
log.info("delete childs list:{}", JSON.toJSONString(childs));
Long[] childIds = childs.stream().map(item -> item.getId()).toArray(Long[]::new);
log.info("delete childs list:{}",JSON.toJSONString(childs));
Long[] childIds = childs.stream().map(item->item.getId()).toArray(Long[]::new);
this.getDao().delete(childIds);
Long[] bussinessIds = childs.stream().map(item -> item.getBusinessId()).toArray(Long[]::new);
log.info("childBussinessIds:{}", JSON.toJSONString(bussinessIds));
if (!ObjectUtils.isEmpty(bussinessIds)) {
businessService.remove(bussinessIds, context);
Long[] bussinessIds = childs.stream().map(item->item.getBusinessId()).toArray(Long[]::new);
log.info("childBussinessIds:{}",JSON.toJSONString(bussinessIds));
if(!ObjectUtils.isEmpty(bussinessIds)){
businessService.remove(bussinessIds,context);
}
Long[] mainIds = this.get(ids, context).stream().map(item -> item.getBusinessId()).toArray(Long[]::new);
if (!ObjectUtils.isEmpty(mainIds)) {
if(!ObjectUtils.isEmpty(mainIds)){
//删除
businessService.remove(mainIds, context);
businessService.remove(mainIds,context);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment