* 'master' of http://221.0.232.152:9393/ability-center/share-platform:
  ...
  fix bug
  selectDTOById 查出多条数据
  申购车不需要出attr
  ...
  一些优化
  ...
  ...
  屮...
  查询能力列表去除infoList 统一门户及其他页面查询能力条件 新增知识库对接 ...

# Conflicts:
#	renren-admin/src/main/java/io/renren/modules/security/oauth2/Oauth2Filter.java
#	renren-admin/src/main/resources/application.yml
This commit is contained in:
huangweixiong 2022-06-03 14:41:12 +08:00
commit 95e59c82f4
26 changed files with 503 additions and 235 deletions

View File

@ -1,12 +1,10 @@
package io.renren; package io.renren;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2; import springfox.documentation.swagger2.annotations.EnableSwagger2;
@ -27,7 +25,6 @@ public class AdminApplication extends SpringBootServletInitializer {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(AdminApplication.class, args); SpringApplication.run(AdminApplication.class, args);
System.out.println("项目启动成功");
} }
@Override @Override

View File

@ -14,6 +14,7 @@ import io.renren.modules.activiti.service.ActRunningService;
import io.renren.modules.processForm.dto.TAbilityApplicationDTO; import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
import io.renren.modules.processForm.dto.TAbilityBatchApplicationDTO; import io.renren.modules.processForm.dto.TAbilityBatchApplicationDTO;
import io.renren.modules.processForm.service.TAbilityApplicationService; import io.renren.modules.processForm.service.TAbilityApplicationService;
import io.renren.modules.security.user.SecurityUser;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.ObjectMapper;
@ -68,6 +69,9 @@ public class AbilityCenterController {
return new Result().error("联系管理员添加流程"); return new Result().error("联系管理员添加流程");
} }
return new Result().ok(abilityBatchApplicationDTO.getSystem().stream().map(index -> { return new Result().ok(abilityBatchApplicationDTO.getSystem().stream().map(index -> {
if (tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0) { // 防止重复发起申请
return null;
}
TAbilityApplicationDTO tAbilityApplicationDTO = new TAbilityApplicationDTO(); TAbilityApplicationDTO tAbilityApplicationDTO = new TAbilityApplicationDTO();
tAbilityApplicationDTO.setArea(abilityBatchApplicationDTO.getArea()); tAbilityApplicationDTO.setArea(abilityBatchApplicationDTO.getArea());
tAbilityApplicationDTO.setAttachment(abilityBatchApplicationDTO.getAttachment()); tAbilityApplicationDTO.setAttachment(abilityBatchApplicationDTO.getAttachment());

View File

@ -86,7 +86,6 @@ public class CensusController {
}; };
dbAmount.add(nullMap); dbAmount.add(nullMap);
} }
}); });
Long sum = dbAmount.stream().mapToLong(index -> Long.valueOf(index.get("amount").toString())).sum(); Long sum = dbAmount.stream().mapToLong(index -> Long.valueOf(index.get("amount").toString())).sum();
Map<String, Object> sumMap = new HashMap<String, Object>() { Map<String, Object> sumMap = new HashMap<String, Object>() {

View File

@ -25,7 +25,7 @@ public class FordController {
String uri = request.getRequestURI(); String uri = request.getRequestURI();
String fordUrl = imageDomain + uri; String fordUrl = imageDomain + uri;
URLConnection con = null; URLConnection con;
try { try {
URL url = new URL(fordUrl); URL url = new URL(fordUrl);

View File

@ -34,4 +34,13 @@ public interface TAbilityApplicationDao extends BaseDao<TAbilityApplicationEntit
List<Map> selectDeptApplyCount(Integer n); List<Map> selectDeptApplyCount(Integer n);
List<String> selectDeptApply(Long deptId); List<String> selectDeptApply(Long deptId);
/**
* 统计该用户对某个资源的申请数量
*
* @param userId
* @param resourceId
* @return
*/
Long countUserResourceApply(Long userId, Long resourceId);
} }

View File

@ -34,4 +34,13 @@ public interface TAbilityApplicationService extends CrudService<TAbilityApplicat
List<Map> selectDeptApplyCount(Integer n); List<Map> selectDeptApplyCount(Integer n);
List<String> selectDeptApply(Long deptId); List<String> selectDeptApply(Long deptId);
/**
* 统计该用户对某个资源的申请数量
*
* @param userId
* @param resourceId
* @return
*/
Long countUserResourceApply(Long userId, Long resourceId);
} }

View File

@ -73,5 +73,17 @@ public class TAbilityApplicationServiceImpl extends CrudServiceImpl<TAbilityAppl
return baseDao.selectDeptApply(deptId); return baseDao.selectDeptApply(deptId);
} }
/**
* 统计该用户对某个资源的申请数量
*
* @param userId
* @param resourceId
* @return
*/
@Override
public Long countUserResourceApply(Long userId, Long resourceId) {
return null;
}
} }

View File

@ -1,5 +1,7 @@
package io.renren.modules.resource.controller; package io.renren.modules.resource.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import io.renren.common.annotation.LogOperation; import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant; import io.renren.common.constant.Constant;
@ -9,6 +11,7 @@ import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup; import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup; import io.renren.common.validator.group.DefaultGroup;
import io.renren.modules.resource.dto.ResourceDTO; import io.renren.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.entity.AttrEntity;
import io.renren.modules.resource.service.ResourceService; import io.renren.modules.resource.service.ResourceService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@ -17,11 +20,16 @@ import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*; import org.springframework.http.*;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -36,6 +44,36 @@ import java.util.Map;
@Api(tags = "资源表") @Api(tags = "资源表")
public class ResourceController { public class ResourceController {
@Value("${qdyjj.ipAndPort}")
private String ipAndPort;
@Value("${zsk.appid}")
private String appId;
@Value("${zsk.appkey}")
private String appKey;
@Value("${zsk.url.sign}")
private String sign;
@Value("${zsk.url.gateway}")
private String gateway;
@Value("${zsk.methodId}")
private String methodId;
@Value("${zsk.param.charset}")
private String charset;
@Value("${zsk.param.origin}")
private String origin;
@Value("${zsk.param.version}")
private String version;
@Value("${zsk.catalogIds}")
private String[] catalogIds;
@Autowired @Autowired
private ResourceService resourceService; private ResourceService resourceService;
@ -183,7 +221,6 @@ public class ResourceController {
" <soap:Body>\n" + " <soap:Body>\n" +
" </soap:Body>\n" + " </soap:Body>\n" +
"</soap:Envelope>"; "</soap:Envelope>";
HttpHeaders requestHeaders = new HttpHeaders(); HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.set("SOAPAction", "http://tempuri.org/ZywMessagePort"); requestHeaders.set("SOAPAction", "http://tempuri.org/ZywMessagePort");
requestHeaders.setContentType(MediaType.TEXT_XML); requestHeaders.setContentType(MediaType.TEXT_XML);
@ -195,10 +232,118 @@ public class ResourceController {
return new Result().ok(map); return new Result().ok(map);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return new Result().error(); return new Result().ok(new HashMap<>());
}
} }
@GetMapping("qdyjjWeather")
@ApiOperation("青岛应急局-查询青岛市地区天气信息")
public Result qdyjjWeather(String cityName){
String loginUrl = "http://" + ipAndPort + "/service-oauth/login";
String weatherUrl = "http://" + ipAndPort + "/service-map/qxWeather/getTodayWeatherInfo";
HashMap<String, Object> loginParam = new HashMap<>();
loginParam.put("loginName", "qdyjj");
loginParam.put("loginPassword", "i/NA1EJ70VaPP0mhFGyJsg==");
HttpEntity<String> loginRequestEntity = new HttpEntity(loginParam, new HttpHeaders());
try {
String loginBody = restTemplate.postForObject(loginUrl, loginRequestEntity, String.class);
JSONObject json = JSON.parseObject(loginBody);
String token = json.getString("data");
MultiValueMap<String, Object> weatherParam = new LinkedMultiValueMap<>();
weatherParam.add("cityName", cityName);
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.add("token", token);
HttpEntity<String> weatherRequestEntity = new HttpEntity(weatherParam, httpHeaders);
String weatherBody = restTemplate.postForEntity(weatherUrl, weatherRequestEntity, String.class).getBody();
return new Result().ok(weatherBody);
} catch (Exception e) {
e.printStackTrace();
return new Result().ok(new HashMap(){{
put("message", "接口调用失败!");
put("code", "500");
}});
} }
}
@GetMapping("knowledgeBase")
@ApiOperation("对接知识库数据")
public void knowledgeBase(){
long timestamp = new Date().getTime();
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>();
paramMap.add("app_id",appId);
paramMap.add("interface_id", methodId);
paramMap.add("version", version);
paramMap.add("charset", charset);
paramMap.add("timestamp", String.valueOf(timestamp));
paramMap.add("origin", origin);
String bizContent;
for (String catalogId: catalogIds) {
bizContent = "{\"appkey\":\""+ appKey +"\",\n" +
"\"catalogId\":\""+ catalogId +"\",\n" +
"\"pageIndex\":1,\n" +
"\"pageSize\":1000}";
paramMap.add("biz_content", bizContent);
try {
String signResult = restTemplate.postForObject(sign, paramMap, String.class);
JSONObject signJsonObject = JSON.parseObject(signResult);
Map<String, Object> signData = (Map<String, Object>)signJsonObject.get("data");
String signString = signData.get("sign").toString();
paramMap.add("sign", signString);
String gatewayResult = restTemplate.postForObject(gateway, paramMap, String.class);
JSONObject gatewayJsonObject = JSON.parseObject(gatewayResult);
JSONObject gatewayData = JSON.parseObject(gatewayJsonObject.get("data").toString());
JSONArray infos = gatewayData.getJSONObject("data").getJSONArray("infos");
infos.forEach(item -> {
Map<String, Object> map = (Map<String, Object>) item;
ResourceDTO dto = new ResourceDTO();
dto.setName(map.get("title").toString());
dto.setType("知识库");
dto.setVisits(0L);
//所属部门暂时设为青岛市政府办公厅
dto.setDeptId(1517116100113850370L);
dto.setDelFlag(0);
ArrayList<AttrEntity> infoList = new ArrayList<>();
map.forEach((key, value) -> {
switch (key) {
case "title":
dto.setName(value.toString());
break;
case "url":
dto.setLink(value.toString());
break;
case "createtime":
Date createDate = new Date(Long.parseLong(value.toString()));
dto.setCreateDate(createDate);
break;
default:
AttrEntity attrEntity = new AttrEntity();
attrEntity.setDelFlag(0);
attrEntity.setAttrType(key);
attrEntity.setAttrValue(value.toString());
infoList.add(attrEntity);
break;
}
});
AttrEntity attrEntity = new AttrEntity();
attrEntity.setDelFlag(0);
attrEntity.setAttrType("文件类型");
if ("f49561afc7204f008c4bb3cd821eb6ba".equals(catalogId)) {
attrEntity.setAttrValue("政府公报");
} else {
attrEntity.setAttrValue("政策解读");
}
infoList.add(attrEntity);
dto.setInfoList(infoList);
resourceService.insertWithAttrs(dto);
});
} catch (Exception e) {
e.printStackTrace();
}
paramMap.remove("sign");
paramMap.remove("biz_content");
}
}
@GetMapping("algorithmPage") @GetMapping("algorithmPage")
@ApiOperation("算法仓分页查询") @ApiOperation("算法仓分页查询")
@ -225,4 +370,5 @@ public class ResourceController {
ExcelUtils.exportExcelToTarget(response, null, "资源表", list, ResourceExcel.class); ExcelUtils.exportExcelToTarget(response, null, "资源表", list, ResourceExcel.class);
} }
*/ */
} }

View File

@ -23,9 +23,12 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
List<ResourceDTO> selectWithAttrs(@Param("dto") ResourceDTO resourceDTO, List<ResourceDTO> selectWithAttrs(@Param("dto") ResourceDTO resourceDTO,
@Param("orderField") String orderField, @Param("orderField") String orderField,
@Param("orderType") String orderType); @Param("orderType") String orderType,
@Param("pageNum") Integer pageNum,
@Param("pageSize") Integer pageSize
);
List<Map> selectTypeCount(Long deptId); List<Map> selectTypeCount();
List<ResourceDTO> selectMostPopular(Map<String, Object> selectMap); List<ResourceDTO> selectMostPopular(Map<String, Object> selectMap);

View File

@ -115,7 +115,6 @@ public class ResourceEntity extends BaseEntity {
*/ */
private String note5; private String note5;
/** /**
* 附件 * 附件
*/ */
@ -124,11 +123,11 @@ public class ResourceEntity extends BaseEntity {
/** /**
* 下架理由 * 下架理由
*/ */
// private String undercarriageReason; private String undercarriageReason;
/** /**
* 提起下架人员 * 提起下架人员
*/ */
// private String undercarriageUserName; private String undercarriageUserName;
} }

View File

@ -23,17 +23,13 @@ import io.renren.modules.resourceCar.dao.ResourceCarDao;
import io.renren.modules.resourceCollection.dao.ResourceCollectionDao; import io.renren.modules.resourceCollection.dao.ResourceCollectionDao;
import io.renren.modules.resourceScore.dao.ResourceScoreDao; import io.renren.modules.resourceScore.dao.ResourceScoreDao;
import io.renren.modules.security.user.SecurityUser; import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.security.user.UserDetail;
import io.renren.modules.sys.dao.SysDeptDao; import io.renren.modules.sys.dao.SysDeptDao;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -107,9 +103,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
resourceEntity.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag()); resourceEntity.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag());
} }
resourceDao.insert(resourceEntity); resourceDao.insert(resourceEntity);
BeanUtils.copyProperties(resourceEntity, dto); BeanUtils.copyProperties(resourceEntity, dto);
List<AttrEntity> attrEntities = dto.getInfoList(); List<AttrEntity> attrEntities = dto.getInfoList();
if (attrEntities != null) { if (attrEntities != null) {
attrEntities.forEach(item -> { attrEntities.forEach(item -> {
@ -177,13 +171,13 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
Page<ResourceDTO> resultPage = new Page<>(pageNum, pageSize); Page<ResourceDTO> resultPage = new Page<>(pageNum, pageSize);
if (resourceDTO.getInfoList().isEmpty()) { if (resourceDTO.getInfoList().isEmpty()) {
List<ResourceDTO> resourceDTOS = resourceDao.selectDTOPage(resourceDTO, (pageNum - 1) * pageSize, pageSize, orderField, orderType); List<ResourceDTO> resourceDTOS = resourceDao.selectDTOPage(resourceDTO, (pageNum - 1) * pageSize, pageSize, orderField, orderType);
resourceDTOS.forEach(item -> { //resourceDTOS.forEach(item -> {
item.setInfoList(this.selectAttrsByResourceId(item.getId())); // item.setInfoList(this.selectAttrsByResourceId(item.getId()));
}); //});
resultPage.setRecords(resourceDTOS); resultPage.setRecords(resourceDTOS);
resultPage.setTotal(resourceDao.selectDTOPage(resourceDTO, 0, 100000, orderField, orderType).size()); resultPage.setTotal(resourceDao.selectDTOPage(resourceDTO, 0, 100000, orderField, orderType).size());
} else { } else {
List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType); List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType, (pageNum - 1) * pageSize, pageSize);
int j = Math.min(pageNum * pageSize, resourceDTOS.size()); int j = Math.min(pageNum * pageSize, resourceDTOS.size());
if (resourceDTOS.isEmpty()) { if (resourceDTOS.isEmpty()) {
resultPage.setRecords(null); resultPage.setRecords(null);
@ -211,12 +205,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override @Override
public Object selectTotal() { public Object selectTotal() {
UserDetail user = SecurityUser.getUser();
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
List<Map> totalMap = resourceDao.selectTypeCount(null); resultMap.put("total", resourceDao.selectTypeCount());
resultMap.put("total", totalMap);
List<Map> deptMap = resourceDao.selectTypeCount(user.getDeptId());
resultMap.put("dept", deptMap);
return resultMap; return resultMap;
} }
@ -225,11 +215,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
public Object selectNewest(JSONObject jsonObject) { public Object selectNewest(JSONObject jsonObject) {
IPage<ResourceEntity> page = new Page<>(jsonObject.getIntValue("pageNum"), jsonObject.getIntValue("pageSize")); IPage<ResourceEntity> page = new Page<>(jsonObject.getIntValue("pageNum"), jsonObject.getIntValue("pageSize"));
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByDesc("create_date") queryWrapper.eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type"))
.eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type")) .eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag())
.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()); .orderByDesc("create_date");
IPage<ResourceEntity> entityIPage = resourceDao.selectPage(page, queryWrapper); return resourceDao.selectPage(page, queryWrapper);
return entityIPage;
} }
@ -326,11 +315,14 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
HashMap<String, Object> resourceMap = new HashMap<>(); HashMap<String, Object> resourceMap = new HashMap<>();
resourceMap.put("type", "全部能力目录"); resourceMap.put("type", "全部能力目录");
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in(true, "del_flag", 0, 5) queryWrapper.eq("del_flag", 0)
.eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type")); .eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type"));
resourceMap.put("total", resourceDao.selectCount(queryWrapper)); resourceMap.put("total", resourceDao.selectCount(queryWrapper));
resultList.add(resourceMap); resultList.add(resourceMap);
List<Map<String, Object>> typeMapList = resourceDao.selectGroupByDeptId(jsonObject.getString("type")); List<Map<String, Object>> typeMapList = resourceDao.selectGroupByDeptId(jsonObject.getString("type"));
if (typeMapList.isEmpty()) {
return resultList;
}
Map<String, List<Map<String, Object>>> listMap = typeMapList.stream() Map<String, List<Map<String, Object>>> listMap = typeMapList.stream()
.collect(Collectors.groupingBy(m -> m.get("type").toString())); .collect(Collectors.groupingBy(m -> m.get("type").toString()));
//区级要根据行政区划多加一层结构 //区级要根据行政区划多加一层结构
@ -344,14 +336,14 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
map.put("dataList", item.getValue()); map.put("dataList", item.getValue());
resultList.add(map); resultList.add(map);
}); });
List<Map<String, Object>> areaList = listMap.get("区级"); Optional<List<Map<String, Object>>> areaList = Optional.ofNullable(listMap.get("区级"));
Map<String, List<Map<String, Object>>> areaTypeList = areaList.stream() Optional<Map<String, List<Map<String, Object>>>> areaTypeList = Optional.ofNullable(areaList.orElse(new ArrayList<>()).stream()
.collect(Collectors.groupingBy(m -> m.get("districtName").toString())); .collect(Collectors.groupingBy(m -> m.get("districtName").toString())));
HashMap<Object, Object> areaMap = new HashMap<>(); HashMap<Object, Object> areaMap = new HashMap<>();
areaMap.put("type", "区级"); areaMap.put("type", "区级");
areaMap.put("total", resourceDao.selectTypeCountByDept("区级", jsonObject.getString("type"))); areaMap.put("total", resourceDao.selectTypeCountByDept("区级", jsonObject.getString("type")));
ArrayList<Map> areaListTemp = new ArrayList<>(); ArrayList<Map> areaListTemp = new ArrayList<>();
areaTypeList.entrySet().stream().forEach(item -> { areaTypeList.orElse(new HashMap<>()).entrySet().stream().forEach(item -> {
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
map.put("type", item.getKey()); map.put("type", item.getKey());
map.put("total", resourceDao.selectTypeCountByDist(item.getKey(), jsonObject.getString("type"))); map.put("total", resourceDao.selectTypeCountByDist(item.getKey(), jsonObject.getString("type")));
@ -428,7 +420,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override @Override
public List<String> selectDeptProvide(Long deptId) { public List<String> selectDeptProvide(Long deptId) {
return baseDao.selectDeptProvide(deptId); return baseDao.selectDeptProvide(deptId);
} }

View File

@ -2,7 +2,6 @@ package io.renren.modules.resourceCar.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.common.service.impl.CrudServiceImpl; import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.resource.service.ResourceService; import io.renren.modules.resource.service.ResourceService;
@ -67,13 +66,13 @@ public class ResourceCarServiceImpl extends CrudServiceImpl<ResourceCarDao, Reso
}else { }else {
ResourceCarEntity entity = carEntities.get(0); ResourceCarEntity entity = carEntities.get(0);
ResourceCarEntity carEntity = new ResourceCarEntity(); ResourceCarEntity carEntity = new ResourceCarEntity();
BeanUtils.copyProperties(entity, carEntity, "updateDate"); BeanUtils.copyProperties(entity, carEntity, "updateDate", "updater");
resourceCarDao.updateById(carEntity); resourceCarDao.updateById(carEntity);
} }
} }
@Override @Override
public IPage<ResourceCarDTO> selectPage(Map<String, Object> params) { public Page<ResourceCarDTO> selectPage(Map<String, Object> params) {
UserDetail user = SecurityUser.getUser(); UserDetail user = SecurityUser.getUser();
int pageNum = Integer.parseInt(params.get("pageNum").toString()); int pageNum = Integer.parseInt(params.get("pageNum").toString());
int pageSize = Integer.parseInt(params.get("pageSize").toString()); int pageSize = Integer.parseInt(params.get("pageSize").toString());
@ -81,7 +80,8 @@ public class ResourceCarServiceImpl extends CrudServiceImpl<ResourceCarDao, Reso
params.put("userId", user.getId()); params.put("userId", user.getId());
List<ResourceCarDTO> resourceCarDTOS = resourceCarDao.selectPageWithResource(params, (pageNum - 1) * pageSize, pageSize); List<ResourceCarDTO> resourceCarDTOS = resourceCarDao.selectPageWithResource(params, (pageNum - 1) * pageSize, pageSize);
resourceCarDTOS.forEach(item -> { resourceCarDTOS.forEach(item -> {
item.setResourceDTO(resourceService.selectWithAttrs(item.getResourceId())); //TODO:不需带attr属性数据
item.setResourceDTO(resourceService.get(item.getResourceId()));
}); });
List<ResourceCarDTO> resourceCarDTOSs = resourceCarDao.selectPageWithResource(params, 0, 100000); List<ResourceCarDTO> resourceCarDTOSs = resourceCarDao.selectPageWithResource(params, 0, 100000);
page.setRecords(resourceCarDTOS); page.setRecords(resourceCarDTOS);

View File

@ -40,7 +40,7 @@ public class SysDeptDTO extends TreeNode implements Serializable {
@ApiModelProperty(value = "类型1省级部门2市级部门3区级部门4企业") @ApiModelProperty(value = "类型1省级部门2市级部门3区级部门4企业")
private Integer type; private Integer type;
@ApiModelProperty(value = "") @ApiModelProperty(value = "地区")
private Long district; private Long district;
@ApiModelProperty(value = "排序") @ApiModelProperty(value = "排序")

View File

@ -8,13 +8,13 @@ import io.renren.modules.taskList.service.ShangTangService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
import java.util.Optional;
@RestController @RestController
@RequestMapping("STapi/project") @RequestMapping("STapi/project")
@ -29,74 +29,106 @@ public class ShangTangController {
private TaskListControllerDao taskListControllerDao; private TaskListControllerDao taskListControllerDao;
/** /**
* 事件模板分页查询接口 * 事件模板分页查询接口
*
* @return * @return
*/ */
@RequestMapping("tamplate") @RequestMapping("tamplate")
@ApiOperation("事件模板分页查询接口") @ApiOperation("事件模板分页查询接口")
public JSONObject tamplate(){ public JSONObject tamplate() {
return shangTangService.template(); return shangTangService.template();
} }
/** /**
* 定时插入场景任务列表 * 定时插入场景任务列表
*
*/ */
@RequestMapping("insertTaskList") @RequestMapping("insertTaskList")
@ApiOperation("场景任务列表插入") @ApiOperation("场景任务列表插入")
@Scheduled(cron = "0 */1 * * * ?") //@Scheduled(cron = "0 */1 * * * ?")
@Transactional @Transactional
public void insertTaskList(){ public void insertTaskList() {
log.info("insertTaskList!");
taskListControllerDao.deleteAll(); taskListControllerDao.deleteAll();
JSONObject jobj = this.tamplate(); Optional<JSONObject> jobj = Optional.ofNullable(this.tamplate());
JSONObject datajobj = jobj.getJSONObject("data"); Optional<JSONObject> datajobj = Optional.ofNullable(jobj.orElse(new JSONObject()).getJSONObject("data"));
JSONArray tamplateList = datajobj.getJSONArray("dataList"); Optional<JSONArray> tamplateList = Optional.ofNullable(datajobj.orElse(new JSONObject()).getJSONArray("dataList"));
//JSONArray tamplateList = jobj.getJSONArray("data");//构建JSONArray数组 tamplateList.orElse(new JSONArray()).parallelStream().forEach(index -> {
Map<String, Object> key = (Map<String, Object>) index;
for (int i = 0 ; i < tamplateList.size();i++) {
Map<String, Object> key = (Map<String, Object>) tamplateList.get(i);
String eventType = (String) key.get("eventType"); String eventType = (String) key.get("eventType");
String eventCnName = (String)key.get("eventCnName"); String eventCnName = (String) key.get("eventCnName");
JSONObject taskListBody = shangTangService.tasklist(eventType); JSONObject taskListBody = shangTangService.tasklist(eventType);
if (taskListBody.size()>0){ if (taskListBody.isEmpty()) {
JSONObject taskdatajobj = taskListBody.getJSONObject("data"); return;
if (taskdatajobj!=null){ }
JSONArray taskdatajobjJSONArray = taskdatajobj.getJSONArray("dataList"); Optional<JSONObject> taskdatajobj = Optional.ofNullable(taskListBody.getJSONObject("data"));
if (taskdatajobjJSONArray!=null){ taskdatajobj.ifPresent(task -> {
for (int j = 0 ; j < taskdatajobjJSONArray.size();j++) { Optional<JSONArray> taskdatajobjJSONArray = Optional.ofNullable(task.getJSONArray("dataList"));
Map<String, Object> key1 = (Map<String, Object>)taskdatajobjJSONArray.get(j); taskdatajobjJSONArray.orElse(new JSONArray()).stream().forEach(index_ -> {
Map<String, Object> key1 = (Map<String, Object>) index_;
String taskSerial = (String) key1.get("taskSerial"); String taskSerial = (String) key1.get("taskSerial");
Integer taskStatus = (Integer) key1.get("taskStatus"); Integer taskStatus = (Integer) key1.get("taskStatus");
JSONObject taskDetailObj = shangTangService.tasklistDetail(taskSerial); Optional<JSONObject> taskDetailObj = Optional.ofNullable(shangTangService.tasklistDetail(taskSerial));
JSONObject taskDetail = taskDetailObj.getJSONObject("data"); JSONObject taskDetail = taskDetailObj.orElse(new JSONObject()).getJSONObject("data");
TaskListControllerEntity taskListobj = new TaskListControllerEntity(); TaskListControllerEntity taskListobj = new TaskListControllerEntity();
if (taskDetail!=null){ if (taskDetail != null) {
String taskName = taskDetail.getString("taskName"); String taskName = taskDetail.getString("taskName");
taskListobj .setTaskName(taskName); taskListobj.setTaskName(taskName);
}else{ } else {
taskListobj .setTaskName("任务停止"); taskListobj.setTaskName("任务停止");
} }
taskListobj .setTaskSerial(taskSerial); taskListobj.setTaskSerial(taskSerial);
taskListobj.setTaskStatus(taskStatus); taskListobj.setTaskStatus(taskStatus);
taskListobj .setEventType(eventType); taskListobj.setEventType(eventType);
taskListobj .setEventCnName(eventCnName); taskListobj.setEventCnName(eventCnName);
taskListControllerDao.insert(taskListobj); taskListControllerDao.insert(taskListobj);
} });
} });
} });
} // for (int i = 0; i < tamplateList.orElse(new JSONArray()).size(); i++) {
} // Map<String, Object> key = (Map<String, Object>) tamplateList.get().get(i);
// String eventType = (String) key.get("eventType");
// String eventCnName = (String) key.get("eventCnName");
// JSONObject taskListBody = shangTangService.tasklist(eventType);
// if (taskListBody.size() > 0) {
// JSONObject taskdatajobj = taskListBody.getJSONObject("data");
// if (taskdatajobj != null) {
// JSONArray taskdatajobjJSONArray = taskdatajobj.getJSONArray("dataList");
// if (taskdatajobjJSONArray != null) {
// for (int j = 0; j < taskdatajobjJSONArray.size(); j++) {
// Map<String, Object> key1 = (Map<String, Object>) taskdatajobjJSONArray.get(j);
//
// String taskSerial = (String) key1.get("taskSerial");
// Integer taskStatus = (Integer) key1.get("taskStatus");
//
// JSONObject taskDetailObj = shangTangService.tasklistDetail(taskSerial);
// JSONObject taskDetail = taskDetailObj.getJSONObject("data");
//
// TaskListControllerEntity taskListobj = new TaskListControllerEntity();
//
// if (taskDetail != null) {
// String taskName = taskDetail.getString("taskName");
// taskListobj.setTaskName(taskName);
// } else {
// taskListobj.setTaskName("任务停止");
// }
//
// taskListobj.setTaskSerial(taskSerial);
// taskListobj.setTaskStatus(taskStatus);
//
// taskListobj.setEventType(eventType);
// taskListobj.setEventCnName(eventCnName);
// taskListControllerDao.insert(taskListobj);
// }
// }
// }
// }
// }
} }
} }

View File

@ -36,14 +36,14 @@ import java.util.Map;
/** /**
* test * test
* *
* @author Mark sunlightcs@gmail.com * @author Mark sunlightcs@gmail.com
* @since 3.0 2022-05-24 * @since 3.0 2022-05-24
*/ */
@RestController @RestController
@RequestMapping("/taskList/tasklistcontroller") @RequestMapping("/taskList/tasklistcontroller")
@Api(tags="任务列表查询") @Api(tags = "任务列表查询")
public class TaskListController { public class TaskListController {
@Autowired @Autowired
private TaskListControllerService taskListControllerService; private TaskListControllerService taskListControllerService;
@ -54,13 +54,13 @@ public class TaskListController {
@GetMapping("page") @GetMapping("page")
@ApiOperation("分页") @ApiOperation("分页")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String")
}) })
@RequiresPermissions("taskList:tasklistcontroller:page") // @RequiresPermissions("taskList:tasklistcontroller:page")
public Result<PageData<TaskListControllerDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<TaskListControllerDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<TaskListControllerDTO> page = taskListControllerService.page(params); PageData<TaskListControllerDTO> page = taskListControllerService.page(params);
return new Result<PageData<TaskListControllerDTO>>().ok(page); return new Result<PageData<TaskListControllerDTO>>().ok(page);
@ -70,42 +70,42 @@ public class TaskListController {
@GetMapping("/selectTaskList") @GetMapping("/selectTaskList")
@ApiOperation("根据分页以及任务名称状态查询数据") @ApiOperation("根据分页以及任务名称状态查询数据")
// @RequiresPermissions("taskList:tasklistcontroller:info") // @RequiresPermissions("taskList:tasklistcontroller:info")
public Map<String,Object> get( public Map<String, Object> get(
@RequestParam(value = "taskName",required = false) String taskName, @RequestParam(value = "taskName", required = false) String taskName,
@RequestParam(value = "taskStatus",required = false) Integer taskStatus, @RequestParam(value = "taskStatus", required = false) Integer taskStatus,
@RequestParam(value = "page",required = true,defaultValue = "1") Integer page, @RequestParam(value = "page", required = true, defaultValue = "1") Integer page,
@RequestParam(value = "pageSize",required = true,defaultValue = "10") Integer pageSize @RequestParam(value = "pageSize", required = true, defaultValue = "10") Integer pageSize
){ ) {
Page<TaskListControllerEntity> page1 = new Page<>(page,pageSize); Page<TaskListControllerEntity> page1 = new Page<>(page, pageSize);
QueryWrapper<TaskListControllerEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<TaskListControllerEntity> queryWrapper = new QueryWrapper<>();
if (taskName!=null){ if (taskName != null) {
if (!StringUtils.isEmpty(taskName)) { if (!StringUtils.isEmpty(taskName)) {
//构建条件 //构建条件
//第一个为字段名称第二个值为模糊查询传递的值 //第一个为字段名称第二个值为模糊查询传递的值
queryWrapper.like("task_name",taskName); queryWrapper.like("task_name", taskName);
} }
} }
if (taskStatus!=null){ if (taskStatus != null) {
if (!StringUtils.isEmpty(taskStatus.toString())) { if (!StringUtils.isEmpty(taskStatus.toString())) {
//构建条件 //构建条件
//第一个为字段名称第二个值为模糊查询传递的值 //第一个为字段名称第二个值为模糊查询传递的值
queryWrapper.eq("task_status",taskStatus); queryWrapper.eq("task_status", taskStatus);
} }
} }
taskListControllerDao.selectPage(page1,queryWrapper); taskListControllerDao.selectPage(page1, queryWrapper);
List<TaskListControllerEntity> taskEntityList = page1.getRecords(); List<TaskListControllerEntity> taskEntityList = page1.getRecords();
long num = page1.getTotal(); long num = page1.getTotal();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
if (taskEntityList.size()>0){ if (taskEntityList.size() > 0) {
map.put("msg",200);//查询成功 map.put("msg", 200);//查询成功
map.put("taskEntityList",taskEntityList); map.put("taskEntityList", taskEntityList);
map.put("num",num); map.put("num", num);
}else { } else {
map.put("msg",501);//查询失败 map.put("msg", 501);//查询失败
} }
return map; return map;
} }
@ -115,7 +115,7 @@ public class TaskListController {
@ApiOperation("保存") @ApiOperation("保存")
@LogOperation("保存") @LogOperation("保存")
@RequiresPermissions("taskList:tasklistcontroller:save") @RequiresPermissions("taskList:tasklistcontroller:save")
public Result save(@RequestBody TaskListControllerDTO dto){ public Result save(@RequestBody TaskListControllerDTO dto) {
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -128,7 +128,7 @@ public class TaskListController {
@ApiOperation("修改") @ApiOperation("修改")
@LogOperation("修改") @LogOperation("修改")
@RequiresPermissions("taskList:tasklistcontroller:update") @RequiresPermissions("taskList:tasklistcontroller:update")
public Result update(@RequestBody TaskListControllerDTO dto){ public Result update(@RequestBody TaskListControllerDTO dto) {
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -141,7 +141,7 @@ public class TaskListController {
@ApiOperation("删除") @ApiOperation("删除")
@LogOperation("删除") @LogOperation("删除")
@RequiresPermissions("taskList:tasklistcontroller:delete") @RequiresPermissions("taskList:tasklistcontroller:delete")
public Result delete(@RequestBody Long[] ids){ public Result delete(@RequestBody Long[] ids) {
//效验数据 //效验数据
AssertUtils.isArrayEmpty(ids, "id"); AssertUtils.isArrayEmpty(ids, "id");

View File

@ -20,15 +20,15 @@ public class ShangTangService {
//1.登录 //1.登录
//2.获取token //2.获取token
public String shangtangToken () { public String shangtangToken() {
String url = "http://10.132.191.54:10270/whale-open-api/tenant/token"; String url = "http://10.132.191.54:10270/whale-open-api/tenant/token";
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("accessKey","a1ddCV7z7Jhv0SBGx5O3hblO"); map.put("accessKey", "a1ddCV7z7Jhv0SBGx5O3hblO");
map.put("secretKey","glIixzORLgoFJz0VdF1aXICR"); map.put("secretKey", "glIixzORLgoFJz0VdF1aXICR");
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
try { try {
responseEntity = restTemplate.postForEntity(url,map,JSONObject.class); responseEntity = restTemplate.postForEntity(url, map, JSONObject.class);
JSONObject body = responseEntity.getBody(); JSONObject body = responseEntity.getBody();
JSONObject data = body.getJSONObject("data"); JSONObject data = body.getJSONObject("data");
String token = data.getString("token"); String token = data.getString("token");
@ -41,7 +41,7 @@ public class ShangTangService {
} }
//订阅任务下发接口 //订阅任务下发接口
public JSONObject subscribe(){ public JSONObject subscribe() {
String token = this.shangtangToken(); String token = this.shangtangToken();
String url = "https://10.132.191.54:10270/whale-open-api/subscribe"; String url = "https://10.132.191.54:10270/whale-open-api/subscribe";
@ -49,38 +49,39 @@ public class ShangTangService {
headers.setContentType(MediaType.APPLICATION_JSON); headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("token", token); headers.add("token", token);
headers.add("tid","default"); headers.add("tid", "default");
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("callBackUrl","https://15.2.23.163:7010/STapi/project/receive"); map.put("callBackUrl", "https://15.2.23.163:7010/STapi/project/receive");
// map.put("certPubKey",""); // map.put("certPubKey","");
map.put("subscribeType",3); map.put("subscribeType", 3);
// map.put("taskId","serial"); // map.put("taskId","serial");
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(map), headers); HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(map), headers);
try { try {
responseEntity = restTemplate.exchange(url, HttpMethod.POST,entity,JSONObject.class); responseEntity = restTemplate.exchange(url, HttpMethod.POST, entity, JSONObject.class);
JSONObject body = responseEntity.getBody(); JSONObject body = responseEntity.getBody();
return body; return body;
}catch (Exception e){ } catch (Exception e) {
log.info( "[subscribe] exception:{}",e.getMessage()); log.info("[subscribe] exception:{}", e.getMessage());
return null; return null;
} }
} }
//事件模板分页查询接口 //事件模板分页查询接口
public JSONObject template(){ public JSONObject template() {
String token = this.shangtangToken(); String token = this.shangtangToken();
String url = "http://10.132.191.54:10270/whale-open-api/scenario/event/template?pageNum=1&pageSize=1000"; String url = "http://10.132.191.54:10270/whale-open-api/scenario/event/template?pageNum=1&pageSize=1000";
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("token",token); headers.add("token", token);
headers.add("tid","default"); headers.add("tid", "default");
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
try { try {
responseEntity = restTemplate.exchange(url,HttpMethod.GET,new HttpEntity<>(headers),JSONObject.class); responseEntity = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(headers), JSONObject.class);
JSONObject jsonObject = responseEntity.getBody(); JSONObject jsonObject = responseEntity.getBody();
return jsonObject; return jsonObject;
} catch (Exception e) { } catch (Exception e) {
@ -91,7 +92,7 @@ public class ShangTangService {
} }
//场景任务列表查询接口 //场景任务列表查询接口
public JSONObject tasklist(String eventType){ public JSONObject tasklist(String eventType) {
String token = this.shangtangToken(); String token = this.shangtangToken();
String url = "http://10.132.191.54:10270/whale-open-api/scenario/event-task/list"; String url = "http://10.132.191.54:10270/whale-open-api/scenario/event-task/list";
@ -99,7 +100,7 @@ public class ShangTangService {
headers.setContentType(MediaType.APPLICATION_JSON); headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("token", token); headers.add("token", token);
headers.add("tid","default"); headers.add("tid", "default");
//需要传的参数 //需要传的参数
// "eventType": "${appletId}-${eventType}", // 事件唯一标识 // "eventType": "${appletId}-${eventType}", // 事件唯一标识
// "pageNum": "integer (int32)", // "pageNum": "integer (int32)",
@ -107,43 +108,43 @@ public class ShangTangService {
// "taskName": "string", //任务名称 // "taskName": "string", //任务名称
// "taskSerial": "string", //任务serial // "taskSerial": "string", //任务serial
// "taskStatus": "1:运行中,2:已结束,3:异常,4:待启动,5:已停止" // "taskStatus": "1:运行中,2:已结束,3:异常,4:待启动,5:已停止"
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("eventType",eventType); map.put("eventType", eventType);
map.put("pageNum",1); map.put("pageNum", 1);
map.put("pageSize",100); map.put("pageSize", 100);
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(map), headers); HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(map), headers);
try { try {
responseEntity = restTemplate.exchange(url, HttpMethod.POST,entity,JSONObject.class); responseEntity = restTemplate.exchange(url, HttpMethod.POST, entity, JSONObject.class);
JSONObject taskListBody = responseEntity.getBody(); JSONObject taskListBody = responseEntity.getBody();
return taskListBody; return taskListBody;
}catch (Exception e){ } catch (Exception e) {
log.info( "[tasklist] exception:{}",e.getMessage()); log.info("[tasklist] exception:{}", e.getMessage());
return null; return null;
} }
} }
//场景任务详情查询接口 //场景任务详情查询接口
public JSONObject tasklistDetail(String taskSerial){ public JSONObject tasklistDetail(String taskSerial) {
String token = this.shangtangToken(); String token = this.shangtangToken();
String url = "http://10.132.191.54:10270/whale-open-api/scenario/event-task/"+taskSerial; String url = "http://10.132.191.54:10270/whale-open-api/scenario/event-task/" + taskSerial;
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON); headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("token", token); headers.add("token", token);
headers.add("tid","default"); headers.add("tid", "default");
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
HttpEntity<String> entity = new HttpEntity<>( headers); HttpEntity<String> entity = new HttpEntity<>(headers);
try { try {
responseEntity = restTemplate.exchange(url, HttpMethod.GET,entity,JSONObject.class); responseEntity = restTemplate.exchange(url, HttpMethod.GET, entity, JSONObject.class);
JSONObject taskListDetailBody = responseEntity.getBody(); JSONObject taskListDetailBody = responseEntity.getBody();
return taskListDetailBody; return taskListDetailBody;
}catch (Exception e){ } catch (Exception e) {
log.info( "[tasklist] exception:{}",e.getMessage()); log.info("[tasklist] exception:{}", e.getMessage());
return null; return null;
} }
} }

View File

@ -67,6 +67,8 @@ hisense:
gateway: gateway:
url: http://devtest-security-app.hismarttv.com:8080 url: http://devtest-security-app.hismarttv.com:8080
qdyjj:
ipAndPort: 15.2.21.238:9015
##多数据源的配置需要引用renren-dynamic-datasource ##多数据源的配置需要引用renren-dynamic-datasource
#dynamic: #dynamic:

View File

@ -57,6 +57,9 @@ logging:
impl: impl:
persistence: persistence:
entity: debug entity: debug
qdyjj:
ipAndPort: 15.2.21.238:9015
mybatis-plus: mybatis-plus:
configuration: configuration:
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

View File

@ -5,12 +5,9 @@ spring:
druid: druid:
#MySQL #MySQL
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/shangtangapi?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false url: jdbc:mysql://127.0.0.1:3306/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false
username: root username: root
password: 123456 password: 123456
# driver-class-name: com.mysql.cj.jdbc.Driver # driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://15.2.21.238:3310/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false # url: jdbc:mysql://15.2.21.238:3310/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false
# username: root # username: root
@ -57,3 +54,6 @@ big_date:
hisense: hisense:
gateway: gateway:
url: http://devtest-security-app.hismarttv.com:8080 url: http://devtest-security-app.hismarttv.com:8080
qdyjj:
ipAndPort: 15.2.21.238:9015

View File

@ -47,4 +47,7 @@ big_date:
hisense: hisense:
gateway: gateway:
url: http://15.72.184.7:8080 url: http://devtest-security-app.hismarttv.com:8080
qdyjj:
ipAndPort: 15.2.21.238:9015

View File

@ -64,6 +64,9 @@ hisense:
gateway: gateway:
url: http://devtest-security-app.hismarttv.com:8080 url: http://devtest-security-app.hismarttv.com:8080
qdyjj:
ipAndPort: 15.2.21.238:9015
##多数据源的配置需要引用renren-dynamic-datasource ##多数据源的配置需要引用renren-dynamic-datasource
#dynamic: #dynamic:

View File

@ -44,3 +44,6 @@ resource:
big_date: big_date:
name: 青岛市大数据发展管理局 name: 青岛市大数据发展管理局
assignee_role_name: 部门审批人 assignee_role_name: 部门审批人
qdyjj:
ipAndPort: 15.2.21.238:9015

View File

@ -87,3 +87,16 @@ system:
yawei: yawei:
enable: true enable: true
#知识库
zsk:
url:
sign: https://cms.qingdao.gov.cn:9020/api-gateway/jpaas-jags-server/interface/createsign.do
gateway: https://cms.qingdao.gov.cn:9020/api-gateway/jpaas-jags-server/interface/gateway
appid: hxszzt
appkey: 120d6a3cc2cd45096abaa5700cb19d0779d5f22ff683436e6d3a7ff8a8d66f5e8307f31b192281831e9f6dc0b6a1f308
param:
charset: UTF-8
origin: 0
version: 1.0
methodId: jirdGetInfoByCatalog
catalogIds: c0645e03fb7e4cf3842e9ceedd8ab998,f49561afc7204f008c4bb3cd821eb6ba

View File

@ -24,6 +24,7 @@
WHERE WHERE
t1.id = #{businessKey} t1.id = #{businessKey}
</select> </select>
<select id="countApplyAll" resultType="java.lang.Long"> <select id="countApplyAll" resultType="java.lang.Long">
SELECT SELECT
COUNT( id ) COUNT( id )
@ -32,6 +33,7 @@
WHERE WHERE
approve_status = '通过' approve_status = '通过'
</select> </select>
<select id="getAmountGroupByType" resultType="java.util.Map"> <select id="getAmountGroupByType" resultType="java.util.Map">
SELECT SELECT
tbr.type AS type, tbr.type AS type,
@ -44,6 +46,7 @@
GROUP BY GROUP BY
tbr.type tbr.type
</select> </select>
<select id="selectDeptApplyCount" resultType="java.util.Map"> <select id="selectDeptApplyCount" resultType="java.util.Map">
SELECT SELECT
COUNT( COUNT(
@ -71,11 +74,13 @@
AND tda.attr_type = '应用领域' AND tda.attr_type = '应用领域'
AND tda.del_flag = 0 AND tda.del_flag = 0
AND temp.approve_status = '通过' AND temp.approve_status = '通过'
JOIN mysql.help_topic b ON b.help_topic_id &lt; ( LENGTH( tda.attr_value ) - LENGTH( REPLACE ( tda.attr_value, ';', '' ) ) + 1 ) JOIN mysql.help_topic b ON b.help_topic_id &lt; ( LENGTH( tda.attr_value ) - LENGTH( REPLACE ( tda.attr_value,
';', '' ) ) + 1 )
GROUP BY GROUP BY
temp.dept_id temp.dept_id
LIMIT #{n} LIMIT #{n}
</select> </select>
<select id="selectDeptApply" resultType="java.lang.String"> <select id="selectDeptApply" resultType="java.lang.String">
SELECT DISTINCT SELECT DISTINCT
( tda.attr_value ) ( tda.attr_value )
@ -102,4 +107,15 @@
AND tda.attr_type = '应用领域' AND tda.attr_type = '应用领域'
AND tda.del_flag = 0 AND tda.del_flag = 0
</select> </select>
<select id="countUserResourceApply" resultType="java.lang.Long">
SELECT
COUNT( id )
FROM
t_ability_application
WHERE
1 = 1
AND del_flag = 0
AND user_id = #{userId}
AND resource_id = #{resourceId}
</select>
</mapper> </mapper>

View File

@ -104,12 +104,11 @@
<select id="selectWithAttrs" resultMap="resourceDTO"> <select id="selectWithAttrs" resultMap="resourceDTO">
SELECT SELECT
tdr.*, tdr.*,
tda.*,
IFNULL(taa2.approve_status, '未申请') AS "applyState", IFNULL(taa2.approve_status, '未申请') AS "applyState",
IFNULL(trs.score, 0 ) AS "score", IFNULL(trs.score, 0 ) AS "score",
IFNULL(taa.applyCount, 0 ) AS "applyCount", IFNULL(taa.applyCount, 0 ) AS "applyCount",
IFNULL(trc.collectCount, 0) AS "collectCount", IFNULL(trc.collectCount, 0) AS "collectCount",
IFNULL(sd.name, '暂无部门信息') AS "deptName", IFNULL(sd.name, '暂无部门单位信息') AS "deptName",
IFNULL(trc2.isCollect, 'false') AS "isCollect", IFNULL(trc2.isCollect, 'false') AS "isCollect",
(IFNULL(tdr.visits / 100, 0) + IFNULL(trs.score, 0) + IFNULL(taa.applyCount, 0)+ IFNULL(trc.collectCount, 0)) AS (IFNULL(tdr.visits / 100, 0) + IFNULL(trs.score, 0) + IFNULL(taa.applyCount, 0)+ IFNULL(trc.collectCount, 0)) AS
total total
@ -123,21 +122,16 @@
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag
= 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id = 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id
LEFT JOIN ( SELECT resource_id, user_id, ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect" LEFT JOIN ( SELECT resource_id, user_id, ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect"
FROM tb_resource_collection WHERE FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 AND user_id = #{dto.creator} GROUP BY resource_id
1 = 1
AND del_flag = 0
AND user_id = #{dto.creator}
GROUP BY resource_id
) trc2 ON tdr.id = trc2.resource_id ) trc2 ON tdr.id = trc2.resource_id
LEFT JOIN ( SELECT resource_id, user_id, approve_status FROM t_ability_application WHERE LEFT JOIN ( SELECT resource_id, user_id, approve_status FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 AND user_id = #{dto.creator}
1 = 1 AND del_flag = 0 AND user_id = #{dto.creator}
GROUP BY id) taa2 ON tdr.id = taa2.resource_id GROUP BY id) taa2 ON tdr.id = taa2.resource_id
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
WHERE 1 = 1 WHERE 1 = 1
AND tdr.del_flag = 0
<if test="dto.type != null and dto.type != ''"> <if test="dto.type != null and dto.type != ''">
AND tdr.type LIKE CONCAT('%',#{dto.type},'%') AND tdr.type LIKE CONCAT('%',#{dto.type},'%')
</if> </if>
AND tdr.del_flag = 0
<if test="dto.name != null and dto.name != ''"> <if test="dto.name != null and dto.name != ''">
AND tdr.name LIKE CONCAT('%',#{dto.name},'%') AND tdr.name LIKE CONCAT('%',#{dto.name},'%')
</if> </if>
@ -184,9 +178,6 @@
FROM tb_data_resource FROM tb_data_resource
WHERE 1 = 1 WHERE 1 = 1
AND del_flag = 0 AND del_flag = 0
<if test="deptId != null and deptId != ''">
AND dept_id = #{deptId}
</if>
GROUP BY type GROUP BY type
ORDER BY type ORDER BY type
</select> </select>
@ -220,34 +211,67 @@
</select> </select>
<select id="selectDTOById" resultMap="resourceDTO"> <select id="selectDTOById" resultMap="resourceDTO">
<!-- SELECT-->
<!-- tdr.*,-->
<!--&lt;!&ndash; tda.*,&ndash;&gt;-->
<!-- IFNULL(trs.score, 0 ) AS "score",-->
<!-- IFNULL(taa.applyCount, 0 ) AS "applyCount",-->
<!-- IFNULL(trc.collectCount, 0) AS "collectCount",-->
<!-- sd.name as "deptName",-->
<!-- IFNULL(trc2.isCollect, 'false') AS "isCollect",-->
<!-- IFNULL(taa2.approve_status, '未申请') AS "applyState"-->
<!-- FROM-->
<!-- tb_data_resource tdr-->
<!--&lt;!&ndash; LEFT JOIN tb_data_attr tda ON tdr.id = tda.data_resource_id&ndash;&gt;-->
<!-- LEFT JOIN ( SELECT resource_id, AVG(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP-->
<!-- BY resource_id ) trs ON tdr.id = trs.resource_id-->
<!-- LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag =-->
<!-- 0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id-->
<!-- LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag-->
<!-- = 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id-->
<!-- LEFT JOIN ( SELECT resource_id, user_id, ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect"-->
<!-- FROM tb_resource_collection WHERE-->
<!-- 1 = 1 AND del_flag = 0 AND user_id = #{userId}-->
<!-- GROUP BY resource_id) trc2 ON tdr.id = trc2.resource_id-->
<!-- LEFT JOIN ( SELECT resource_id, approve_status FROM t_ability_application WHERE-->
<!-- 1 = 1 AND del_flag = 0 AND user_id = #{userId}-->
<!-- GROUP BY id LIMIT 1) taa2 ON tdr.id = taa2.resource_id-->
<!-- LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id-->
<!-- WHERE 1 = 1-->
<!-- AND tdr.id = #{id}-->
SELECT SELECT
tdr.*, tdr.*,
tda.*, IFNULL( trs.score, 0 ) AS "score",
IFNULL(trs.score, 0 ) AS "score", IFNULL( taa.applyCount, 0 ) AS "applyCount",
IFNULL(taa.applyCount, 0 ) AS "applyCount", IFNULL( trc.collectCount, 0 ) AS "collectCount",
IFNULL(trc.collectCount, 0) AS "collectCount", sd.NAME AS "deptName",
sd.name as "deptName", IFNULL( trc2.isCollect, 'false' ) AS "isCollect",
IFNULL(trc2.isCollect, 'false') AS "isCollect", IF
IFNULL(taa2.approve_status, '未申请') AS "applyState" ( taa2.approve_status &lt; 1, '未申请', "已申请" ) AS "applyState"
FROM FROM
tb_data_resource tdr tb_data_resource tdr
LEFT JOIN tb_data_attr tda ON tdr.id = tda.data_resource_id LEFT JOIN ( SELECT resource_id, AVG( score ) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trs ON tdr.id = trs.resource_id
LEFT JOIN ( SELECT resource_id, AVG(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP LEFT JOIN ( SELECT resource_id, COUNT( id ) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
BY resource_id ) trs ON tdr.id = trs.resource_id LEFT JOIN ( SELECT resource_id, COUNT( id ) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag = LEFT JOIN (
0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id SELECT
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag resource_id,
= 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id user_id,
LEFT JOIN ( SELECT resource_id, user_id, ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect" ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect"
FROM tb_resource_collection WHERE FROM
1 = 1 AND del_flag = 0 AND user_id = #{userId} tb_resource_collection
GROUP BY resource_id) trc2 ON tdr.id = trc2.resource_id WHERE
LEFT JOIN ( SELECT resource_id, approve_status FROM t_ability_application WHERE 1 = 1
1 = 1 AND del_flag = 0 AND user_id = #{userId} AND del_flag = 0
GROUP BY id) taa2 ON tdr.id = taa2.resource_id AND user_id = #{userId}
GROUP BY
resource_id
) trc2 ON tdr.id = trc2.resource_id
LEFT JOIN ( SELECT resource_id, COUNT( approve_status ) approve_status FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 AND user_id = #{userId} GROUP BY resource_id ) taa2 ON tdr.id = taa2.resource_id
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
WHERE 1 = 1 WHERE
<!-- AND tdr.del_flag = 0--> 1 = 1
AND tdr.id = #{id} AND tdr.id = #{id}
</select> </select>
@ -270,11 +294,9 @@
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag
= 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id = 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id
LEFT JOIN ( SELECT resource_id, user_id, ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect" LEFT JOIN ( SELECT resource_id, user_id, ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect"
FROM tb_resource_collection WHERE FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 AND user_id = #{dto.creator}
1 = 1 AND del_flag = 0 AND user_id = #{dto.creator}
GROUP BY resource_id) trc2 ON tdr.id = trc2.resource_id GROUP BY resource_id) trc2 ON tdr.id = trc2.resource_id
LEFT JOIN ( SELECT resource_id, approve_status FROM t_ability_application WHERE LEFT JOIN ( SELECT resource_id, approve_status FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 AND user_id = #{dto.creator}
1 = 1 AND del_flag = 0 AND user_id = #{dto.creator}
GROUP BY id) taa2 ON tdr.id = taa2.resource_id GROUP BY id) taa2 ON tdr.id = taa2.resource_id
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
WHERE 1 = 1 WHERE 1 = 1
@ -323,7 +345,6 @@
LEFT JOIN t_ability_application taa ON tda.data_resource_id = taa.resource_id LEFT JOIN t_ability_application taa ON tda.data_resource_id = taa.resource_id
AND taa.del_flag = 0 AND taa.del_flag = 0
AND taa.user_id = #{userId} AND taa.user_id = #{userId}
WHERE WHERE
1 = 1 1 = 1
AND tda.attr_type = '应用领域' AND tda.attr_type = '应用领域'
@ -349,6 +370,7 @@
GROUP BY GROUP BY
type type
</select> </select>
<select id="countAllDept" resultType="java.lang.Long"> <select id="countAllDept" resultType="java.lang.Long">
SELECT SELECT
COUNT( DISTINCT dept_id ) COUNT( DISTINCT dept_id )
@ -372,7 +394,7 @@
sr.id AS "districtId" sr.id AS "districtId"
FROM FROM
sys_dept sd sys_dept sd
LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag IN (0 ,5) LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0
<if test="type != null and type != ''"> <if test="type != null and type != ''">
AND type = #{type} AND type = #{type}
</if> </if>
@ -399,7 +421,7 @@
IFNULL( tdr.deptCount, 0 ) AS "deptCount" IFNULL( tdr.deptCount, 0 ) AS "deptCount"
FROM FROM
sys_dept sd sys_dept sd
LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag IN (0, 5) LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0
<if test="resourceType != null and resourceType != ''"> <if test="resourceType != null and resourceType != ''">
AND type = #{resourceType} AND type = #{resourceType}
</if> </if>
@ -441,7 +463,7 @@
FROM FROM
sys_dept sd sys_dept sd
LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource
WHERE 1 = 1 AND del_flag IN (0, 5) WHERE 1 = 1 AND del_flag = 0
<if test="resourceType != null and resourceType != ''"> <if test="resourceType != null and resourceType != ''">
AND type = #{resourceType} AND type = #{resourceType}
</if> </if>
@ -457,9 +479,10 @@
GROUP BY GROUP BY
temp2.type temp2.type
</select> </select>
<select id="countAllVisits" resultType="java.lang.Long"> <select id="countAllVisits" resultType="java.lang.Long">
SELECT SELECT
COUNT( visits ) SUM( visits )
FROM FROM
tb_data_resource tb_data_resource
</select> </select>

View File

@ -20,44 +20,44 @@
</resultMap> </resultMap>
<update id="deleteByIds"> <update id="deleteByIds">
update tb_resource_car UPDATE tb_resource_car
set del_flag = 1 , SET del_flag = 1 ,
update_date = now() update_date = now()
where 1 = 1 WHERE 1 = 1
and id in AND id IN
<foreach collection="ids" item="item" open="(" close=")" separator=","> <foreach collection="ids" item="item" open="(" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>
</update> </update>
<update id="delete4Resource"> <update id="delete4Resource">
update tb_resource_car UPDATE tb_resource_car
set del_flag = 1, SET del_flag = 1,
update_date = now() update_date = now()
where 1 = 1 WHERE 1 = 1
and resource_id in AND resource_id IN
<foreach collection="resourceIds" item="item" open="(" separator="," close=")"> <foreach collection="resourceIds" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</update> </update>
<select id="selectPageWithResource" resultType="io.renren.modules.resourceCar.dto.ResourceCarDTO"> <select id="selectPageWithResource" resultType="io.renren.modules.resourceCar.dto.ResourceCarDTO">
select trc.* SELECT trc.*
from tb_resource_car trc FROM tb_resource_car trc
<if test="(params.type != null and params.type != '') or (params.name != null and params.name != '')"> <if test="(params.type != null and params.type != '') or (params.name != null and params.name != '')">
left join tb_data_resource tdr on trc.resource_id = tdr.id and tdr.del_flag != 1 LEFT JOIN tb_data_resource tdr ON trc.resource_id = tdr.id AND tdr.del_flag != 1
</if> </if>
where 1 = 1 WHERE 1 = 1
and trc.del_flag = 0 AND trc.del_flag = 0
and user_id = #{params.userId} AND user_id = #{params.userId}
<if test="params.name != null and params.name != ''" > <if test="params.name != null and params.name != ''" >
and tdr.name like CONCAT('%',#{params.name},'%') AND tdr.name LIKE CONCAT('%',#{params.name},'%')
</if> </if>
<if test="params.type != null and params.type != ''"> <if test="params.type != null and params.type != ''">
and tdr.type = #{params.type} AND tdr.type = #{params.type}
</if> </if>
order by trc.update_date desc, trc.create_date desc ORDER BY trc.update_date DESC, trc.create_date DESC
limit ${pageNum}, ${pageSize} LIMIT ${pageNum}, ${pageSize}
</select> </select>
</mapper> </mapper>