Commit a5b3fad5 authored by “yiyousong”'s avatar “yiyousong”
parents ac190666 1f4e70d2
......@@ -348,5 +348,6 @@ PRIMARY KEY (`id`)
ALTER TABLE mortals_sys_dept ADD COLUMN `inNum` int(9) DEFAULT '0' COMMENT '入驻事项数量' AFTER updateTime;
INSERT INTO mortals_xhx_task VALUES (null, '同步全部站点事项材料附件', 'SyncMatterDaumFileTask', 0, 'SyncMatterDaumFileTask', '', '', 1, 3600, '16:05', '', '192.168.1.107', '2024-05-18 16:05:00', 0, '2024-03-01 10:59:53', 1, '系统管理员');
......@@ -24,7 +24,7 @@ import java.util.List;
@Aspect
@Slf4j
@Component
//@Component
public class DataPermissionAspect {
@Autowired
......
......@@ -58,6 +58,10 @@ public class UploadServiceImpl implements UploadService {
throw new AppException("文件上传大小超过限制!");
}
if (null != fileName && fileName.length() > 50) {
throw new AppException("文件名称过长,无法上传!");
}
String rootPath = this.filePath.endsWith("/") ? this.filePath : this.filePath + "/";
String filePath = rootPath + (StringUtils.isEmpty(prePath) ? "" : prePath + "/");
......@@ -170,4 +174,14 @@ public class UploadServiceImpl implements UploadService {
}
}
public static void main(String[] args) {
String fileName="好.txt";
System.out.println(fileName.length());
}
}
\ No newline at end of file
......@@ -123,6 +123,29 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
this.doHandlerUser(entity);
}
@Override
protected void saveAfter(UserEntity entity, Context context) throws AppException {
//新增角色
updateUserRole(entity);
super.saveAfter(entity, context);
}
@Override
protected void updateAfter(UserEntity entity, Context context) throws AppException {
updateUserRole(entity);
super.updateAfter(entity, context);
}
private void updateUserRole(UserEntity entity) {
if (!ObjectUtils.isEmpty(entity.getId()) && entity.getId().longValue() != SysConstains.ADMIN_ID && !ObjectUtils.isEmpty(entity.getRoleIds())) {
RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserId(entity.getId());
List<Long> idList = Arrays.asList(entity.getRoleIds().split(",")).stream().map(Long::parseLong).collect(Collectors.toList());
roleUserQuery.setRoleIdList(idList);
roleUserService.doDistributionRole(roleUserQuery);
}
}
@Override
protected UserEntity findBefore(UserEntity params, Context context) throws AppException {
// if (StringUtils.isNotEmpty(params.getDeptIds())) {
......
......@@ -17,6 +17,7 @@ import com.mortals.xhx.common.code.UserStatus;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
......@@ -58,13 +59,13 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
}
}
@Override
/* @Override
protected void saveBefore(UserEntity entity, Map<String, Object> model, Context context) throws AppException {
if (service.existUser(entity.getLoginName(), entity.getId())) {
if (!ObjectUtils.isEmpty(entity.getLoginName())&&service.existUser(entity.getLoginName(), entity.getId())) {
throw new AppException("登录名已存在!");
}
super.saveBefore(entity, model, context);
}
}*/
@RequestMapping(value = "change/password", method = RequestMethod.POST)
......
......@@ -50,6 +50,11 @@ public class SyncMatterTaskImpl implements ITaskExcuteService {
stopWatch.stop();
log.info("同步站点部门完成,耗时:{}s", stopWatch.getLastTaskTimeMillis() / 1000);
log.info("开始同步事项==》{}", siteEntity.getSiteName());
stopWatch.start("同步删除本地多余的政务事项");
log.info("同步删除本地多余的政务事项");
matterExtService.syncDelMatterBySiteId(siteEntity, null);
stopWatch.stop();
log.info("同步删除本地多余的政务事项完成,耗时:{}s", stopWatch.getLastTaskTimeMillis() / 1000);
stopWatch.start("开始同步事项方法");
matterExtService.syncMatterBySiteId(siteEntity, null);
......
......@@ -30,11 +30,6 @@ import java.util.stream.Collectors;
@Service("areaService")
public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaEntity, Long> implements AreaService {
@Autowired
private SiteService siteService;
@Autowired
private BaseAreaService baseAreaService;
@Override
public void putCache(String key, AreaEntity data) {
......
......@@ -23,4 +23,12 @@ public interface MatterExtService extends ICRUDService<MatterExtEntity,Long>{
void deleteByMatterId(Long matterId, Context context);
/**
* 同步删除 已经没有的站点事项
* @param siteEntity
* @param context
* @return
*/
Rest<String> syncDelMatterBySiteId(SiteEntity siteEntity, Context context);
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.common.Rest;
import com.mortals.framework.util.ThreadPool;
import com.mortals.xhx.common.code.DxTypeEnum;
import com.mortals.xhx.common.code.SourceEnum;
import com.mortals.xhx.common.code.YesNoEnum;
......@@ -18,10 +19,7 @@ import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.model.MatterQuery;
import com.mortals.xhx.module.matter.service.MatterService;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.model.SiteMatterEntity;
import com.mortals.xhx.module.site.model.SiteMatterQuery;
import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.site.model.*;
import com.mortals.xhx.module.site.service.SiteMatterService;
import com.mortals.xhx.module.site.service.SiteService;
import com.mortals.xhx.module.site.service.SiteThemeMatterService;
......@@ -58,13 +56,11 @@ public class MatterExtServiceImpl extends AbstractCRUDServiceImpl<MatterExtDao,
@Autowired
private MatterService matterService;
@Autowired
private SiteService siteService;
@Autowired
private SiteMatterService siteMatterService;
@Autowired
private SiteThemeMatterService siteThemeMatterService;
@Autowired
private SiteThemeService siteThemeService;
@Autowired
private SiteMatterService siteMatterService;
/**
......@@ -76,30 +72,7 @@ public class MatterExtServiceImpl extends AbstractCRUDServiceImpl<MatterExtDao,
*/
@Override
public Rest<String> syncMatterBySiteId(SiteEntity siteEntity, Context context) {
AreaEntity areaEntity = areaService.getCache(siteEntity.getAreaCode());
List<DeptEntity> deptEntities = deptService.find(new DeptQuery().siteId(siteEntity.getId()).source(SourceEnum.政务网.getValue()));
List<MatterEntity> govMatterList = deptEntities.parallelStream().flatMap(deptEntity -> {
HashMap<String, String> params = new HashMap<>();
params.put("areaCode", areaEntity.getAreaCode());
params.put("dxType", "6");
params.put("deptCode", deptEntity.getDeptNumber());
params.put("searchtext", "");
params.put("taskType", "");
List<MatterEntity> deptMatterList = this.getMatters(params, context);
return deptMatterList.stream();
}).collect(Collectors.toList());
/* for (DeptEntity deptEntity : deptEntities) {
HashMap<String, String> params = new HashMap<>();
params.put("areaCode", areaEntity.getAreaCode());
params.put("dxType", "6");
params.put("deptCode", deptEntity.getDeptNumber());
params.put("searchtext", "");
params.put("taskType", "");
List<MatterEntity> deptMatterList = this.getMatters(params, context);
if (!ObjectUtils.isEmpty(deptMatterList)) {
govMatterList.addAll(deptMatterList);
}
}*/
List<MatterEntity> govMatterList = getMatterEntities(siteEntity, context);
//当前本地区事项全部事项
log.info("计算差集");
MatterQuery matterQuery = new MatterQuery();
......@@ -128,17 +101,37 @@ public class MatterExtServiceImpl extends AbstractCRUDServiceImpl<MatterExtDao,
}
log.info("开始更新事项详细!");
for (MatterEntity matterEntity : matterList) {
Rest<String> rest = matterService.buildMatterDetail(matterEntity, null);
if (rest.getCode() == YesNoEnum.YES.getValue()) {
// log.info("更新详细事项==>{},id===>{},localVersion===>{}", matterEntity.getMatterName(),matterEntity.getId(),matterEntity.getMatterEdition());
//matterEntity.setUrl(null);
matterEntity.setUpdateTime(new Date());
matterService.update(matterEntity, null);
}
Runnable runnable = new Runnable() {
@Override
public void run() {
Rest<String> rest = matterService.buildMatterDetail(matterEntity, null);
if (rest.getCode() == YesNoEnum.YES.getValue()) {
matterEntity.setUpdateTime(new Date());
matterService.update(matterEntity, null);
}
}
};
ThreadPool.getInstance().execute(runnable);
}
return Rest.ok();
}
private List<MatterEntity> getMatterEntities(SiteEntity siteEntity, Context context) {
AreaEntity areaEntity = areaService.getCache(siteEntity.getAreaCode());
List<DeptEntity> deptEntities = deptService.find(new DeptQuery().siteId(siteEntity.getId()).source(SourceEnum.政务网.getValue()));
List<MatterEntity> govMatterList = deptEntities.parallelStream().flatMap(deptEntity -> {
HashMap<String, String> params = new HashMap<>();
params.put("areaCode", areaEntity.getAreaCode());
params.put("dxType", "6");
params.put("deptCode", deptEntity.getDeptNumber());
params.put("searchtext", "");
params.put("taskType", "");
List<MatterEntity> deptMatterList = this.getMatters(params, context);
return deptMatterList.stream();
}).collect(Collectors.toList());
return govMatterList;
}
/**
* 同步站点主题事项
*
......@@ -191,7 +184,6 @@ public class MatterExtServiceImpl extends AbstractCRUDServiceImpl<MatterExtDao,
return firstList.parallelStream().filter(item -> !secondSet.contains(item.getMatterNo())).collect(Collectors.toList());
}
private List<MatterEntity> getMatters(HashMap<String, String> params, Context context) {
String url = GlobalSysInfo.getParamValue(Constant.GOV_MATTER_PAGELIST_URL, "http://www.sczwfw.gov.cn/jiq/interface/item/tags");
Rest<Map<String, Integer>> restStat = MatterHtmlParseUtil.statSiteMatterCount(params, url);
......@@ -234,5 +226,52 @@ public class MatterExtServiceImpl extends AbstractCRUDServiceImpl<MatterExtDao,
this.dao.delete(condition);
}
/**
* @param siteEntity
* @param context
* @return
*/
@Override
public Rest<String> syncDelMatterBySiteId(SiteEntity siteEntity, Context context) {
//
List<MatterEntity> govMatterList = getMatterEntities(siteEntity, context);
log.info("计算差集");
MatterQuery matterQuery = new MatterQuery();
matterQuery.setAreaCode(siteEntity.getAreaCode());
matterQuery.setSource(SourceEnum.政务网.getValue());
//本地事项
List<MatterEntity> matterList = matterService.getDao().getMatterListByAreaCode(matterQuery);
log.info("本地事项总数:{}", matterList.size());
//政务网存在set
Set<String> matterExistSet = govMatterList.parallelStream().map(i -> i.getMatterNo()).collect(Collectors.toSet());
List<MatterEntity> delList = this.subListSet(matterList, matterExistSet);
log.info("抓取事项总数:{} ,需要删除事项数量:{}", govMatterList.size(), delList.size());
//删除matter 和siteMatter
if (!ObjectUtils.isEmpty(delList)) {
Long[] delMatterIds = delList.parallelStream().map(i -> i.getId()).toArray(Long[]::new);
matterService.remove(delMatterIds, context);
SiteMatterQuery siteMatterQuery = new SiteMatterQuery();
siteMatterQuery.setMatterIdList(Arrays.asList(delMatterIds));
List<SiteMatterEntity> delSiteMatterList = siteMatterService.find(siteMatterQuery);
if (!ObjectUtils.isEmpty(delSiteMatterList)) {
log.info("删除站点事项数量:{}", delSiteMatterList.size());
siteMatterService.removeList(delSiteMatterList, context);
}
SiteThemeMatterQuery siteThemeMatterQuery = new SiteThemeMatterQuery();
siteThemeMatterQuery.setMatterIdList(Arrays.asList(delMatterIds));
List<SiteThemeMatterEntity> delSiteThemeMatterList = siteThemeMatterService.find(siteThemeMatterQuery);
if (!ObjectUtils.isEmpty(delSiteThemeMatterList)) {
log.info("删除站点主题事项数量:{}", delSiteThemeMatterList.size());
siteThemeMatterService.removeList(delSiteThemeMatterList, context);
}
}
return Rest.ok("同步删除成功!");
}
}
\ No newline at end of file
......@@ -1069,7 +1069,7 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
if (matterEditionLocal >= matterEditionRemote) {
//bool = true;
msg = "本地事项版本大于等于远端,不需要更新!!";
// break;
// break;
// return Rest.fail("本地事项版本大于等于远端,不需要更新!");
}
......
package com.mortals.xhx.module.matter.web;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
......@@ -16,10 +19,7 @@ import com.mortals.xhx.module.matter.service.MatterDatumFileService;
import com.mortals.xhx.module.matter.service.MatterDatumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
......@@ -98,13 +98,14 @@ public class MatterDatumController extends BaseCRUDJsonBodyMappingController<Mat
List<MatterDatumEntity> matterDatumEntities = (List<MatterDatumEntity>) model.get(KEY_RESULT_DATA);
//去重复
List<MatterDatumEntity> collect = matterDatumEntities.stream().distinct().collect(Collectors.toList());
model.put(KEY_RESULT_DATA,collect);
model.put(KEY_RESULT_DATA, collect);
return super.doListAfter(query, model, context);
}
/**
* 查询的材料 名称去重 并且
*
* @param query
* @return
*/
......@@ -134,4 +135,33 @@ public class MatterDatumController extends BaseCRUDJsonBodyMappingController<Mat
return ret;
}
/**
* 解密下载地址
*
* @param encryptId 文件加密id
* @return
*/
@GetMapping(value = "decodeDownloadUrl")
@UnAuth
public Rest<String> decodeDownloadUrl(@RequestParam(name = "encryptId") String encryptId) {
Map<String, Object> model = new HashMap<>();
String busiDesc = "查询材料" + this.getModuleDesc();
try {
String encryUrl = "http://www.sczwfw.gov.cn/jiq/interface/item/annex/encryptUrl?id=" + encryptId;
String resp = HttpUtil.get(encryUrl);
JSONObject obj = JSON.parseObject(resp);
String code = obj.getString("code");
String data = obj.getString("data");
if ("0".equals(code)) {
return Rest.ok("获取附件链接成功!",data);
} else {
return Rest.fail("获取链接失败");
}
} catch (Exception e) {
this.doException(request, busiDesc, model, e);
return Rest.fail(e.getMessage());
}
}
}
\ No newline at end of file
package com.mortals.xhx.module.matter.web;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.matter.model.MatterQuery;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.site.service.SiteService;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -31,10 +39,13 @@ import static com.mortals.framework.ap.SysConstains.*;
*/
@RestController
@RequestMapping("matter/ext")
@Slf4j
public class MatterExtController extends BaseCRUDJsonBodyMappingController<MatterExtService,MatterExtEntity,Long> {
@Autowired
private ParamService paramService;
@Autowired
private SiteService siteService;
public MatterExtController(){
super.setModuleDesc( "事项扩展");
......@@ -47,4 +58,32 @@ public class MatterExtController extends BaseCRUDJsonBodyMappingController<Matte
}
@GetMapping(value = "delMattersBySiteId")
@UnAuth
public Rest<Object> delMattersBySiteId() {
Rest<Object> ret = new Rest<>();
Map<String, Object> model = new HashMap<>();
String busiDesc = "删除" + this.getModuleDesc();
int code = VALUE_RESULT_SUCCESS;
try {
List<SiteEntity> siteEntities = siteService.find(new SiteEntity());
for (SiteEntity siteEntity : siteEntities) {
log.info("开始同步删除站点事项==》{}", siteEntity.getSiteName());
this.service.syncDelMatterBySiteId(siteEntity, getContext());
}
model.put(MESSAGE_INFO, busiDesc + "成功");
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
this.doException(request, busiDesc, model, e);
}
ret.setCode(code);
ret.setData(model);
ret.setMsg(model.get(MESSAGE_INFO) == null ? "" : model.remove(MESSAGE_INFO).toString());
return ret;
}
}
\ No newline at end of file
......@@ -21,6 +21,7 @@ import com.mortals.xhx.module.site.service.SiteBusinessService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
......@@ -39,9 +40,11 @@ import java.util.stream.Collectors;
public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBusinessDao, SiteBusinessEntity, Long> implements SiteBusinessService {
@Autowired
@Lazy
private BusinessService businessService;
@Autowired
@Lazy
private BusinessMatterService businessMatterService;
/**
......
......@@ -62,6 +62,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
......@@ -86,14 +87,17 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
* 根据用户id 暂存对应站点树 默认0为全站点树
*/
private Map<Long, List<SiteTreeSelect>> siteTreeMap = new HashMap<>();
@Autowired
@Lazy
private AreaService areaService;
@Autowired
@Lazy
private ModelService modelService;
@Autowired
@Lazy
private IUserFeign userFeign;
@Autowired
@Lazy
private UserService userService;
@Autowired
private DeptService deptService;
......
......@@ -7,6 +7,7 @@ import com.mortals.xhx.module.window.model.WindowEntity;
import com.mortals.xhx.module.window.model.WindowQuery;
import com.mortals.xhx.module.window.service.WindowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
......@@ -31,6 +32,7 @@ import java.util.stream.Collectors;
public class WindowHallServiceImpl extends AbstractCRUDCacheServiceImpl<WindowHallDao, WindowHallEntity, Long> implements WindowHallService {
@Autowired
@Lazy
private WindowService windowService;
/**
......@@ -48,16 +50,5 @@ public class WindowHallServiceImpl extends AbstractCRUDCacheServiceImpl<WindowHa
WindowEntity windowEntity = collectWin.get(item.getWindowId());
item.setFromnum(windowEntity == null ? "" : windowEntity.getFromnum());
});
/* List<Long> collect = list.stream().map(i -> i.getWindowId()).distinct().collect(Collectors.toList());
if (!ObjectUtils.isEmpty(collect)) {
WindowQuery windowQuery = new WindowQuery();
windowQuery.setIdList(collect);
Map<Long, WindowEntity> collectWin = windowService.find(windowQuery).stream().collect(Collectors.toMap(x -> x.getId(), y -> y, (o, n) -> n));
list.forEach(item -> {
WindowEntity windowEntity = collectWin.get(item.getWindowId());
item.setFromnum(windowEntity == null ? "" : windowEntity.getFromnum());
});
}*/
}
}
\ No newline at end of file
......@@ -30,6 +30,7 @@ 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.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.window.dao.WindowDao;
......@@ -55,14 +56,13 @@ public class WindowServiceImpl extends AbstractCRUDCacheServiceImpl<WindowDao, W
@Autowired
private WorkmanService workmanService;
@Autowired
private WindowBusinessService windowBusinessService;
@Autowired
private WindowMatterService windowMatterService;
@Autowired
@Lazy
private WindowHallService windowHallService;
@Autowired
private BusinessService businessService;
......
......@@ -19,7 +19,7 @@
</plugin>
<plugin interceptor="com.mortals.framework.thirty.mybatis.LogInterceptor">
<property name="enableExecutorTime" value="false" />
<property name="showSql" value="false" />
<property name="showSql" value="true" />
</plugin>
</plugins>
</configuration>
\ No newline at end of file
......@@ -387,9 +387,6 @@
<!-- 条件映射-代参数 -->
<sql id="_condition_param_">
<bind name="conditionParamRef" value="${_conditionParam_}"/>
<if test="permissionSql != null and permissionSql != ''">
${permissionSql}
</if>
<if test="conditionParamRef.containsKey('id')">
<if test="conditionParamRef.id != null">
......
......@@ -27,15 +27,19 @@ POST {{baseUrl}}/app/dataset/list
Content-Type: application/json
{
"appId": 20,
"appId": 84,
"orConditionList": [
{
"fieldName": "制定机关",
"fieldValue": "%四川省人民政府%"
"fieldName": "部门",
"fieldValue": "市公安局"
},{
"fieldName": "标题",
"fieldValue": "%管理办法%"
"fieldName": "员工姓名",
"fieldValue": "%黄%"
},
{
"fieldValueList": ["员工姓名"]
}
],
"page": 1,
"size": 10
......
......@@ -54,7 +54,7 @@ POST {{baseUrl}}/base/area/genSubAreaByAreaName
Content-Type: application/json
{
"areaCode": "510921000000"
"areaCode": "513232000000"
}
......
......@@ -4,8 +4,8 @@ POST {{baseUrl}}/site/business/interlist
Content-Type: application/json
{
"siteId": 22
"siteId": 1,
"size":100
}
......
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