Commit 23fe5823 authored by “yiyousong”'s avatar “yiyousong”
parents 85afb842 653ee3a9
......@@ -89,6 +89,11 @@ public final class Constant {
*/
public static final String GOV_FR_URL = "gov_fr_url";
/**
* 政务网乡镇主题服务地址
*/
public static final String GOV_TOWN_URL = "gov_town_url";
/**
* 政务网公共服务地址
*/
......
......@@ -70,9 +70,7 @@ public class SyncGovMatterDetailThread implements Runnable {
Rest<String> deptRest = deptService.syncDeptBySiteId(siteEntity, context);
log.info("同步站点部门:" + JSON.toJSONString(deptRest));
Rest<String> rest = siteService.syncMatterBySiteId(siteEntity, context);
AreaEntity areaEntity = areaService.getCache(siteEntity.getAreaCode());
log.info("同步事项列表:" + JSON.toJSONString(rest));
if (rest.getCode() == YesNoEnum.YES.getValue()) {
List<MatterEntity> matterEntityList = matterService.find(new MatterQuery().areaCode(siteEntity.getAreaCode()).source(SourceEnum.政务网.getValue()));
......@@ -110,7 +108,6 @@ public class SyncGovMatterDetailThread implements Runnable {
//省,市,区
Rest<String> themeRest = siteThemeService.syncThemeBySiteId(siteEntity, context);
log.info("同步站点主题:" + JSON.toJSONString(themeRest));
log.info("同步站点个人主题事项开始.....");
siteThemeMatterService.deleteGovBySiteId(siteEntity.getId(), context);
Rest<String> grRest = siteThemeMatterService.syncThemeMatterBySiteId(siteEntity.getId(), "2", context);
......@@ -120,6 +117,8 @@ public class SyncGovMatterDetailThread implements Runnable {
log.info("同步站点主题法人事项:" + JSON.toJSONString(frRest));
}else if(areaEntity.getAreaLevel()>3){
//街道,镇,乡
Rest<String> themeTownRest = siteThemeService.syncTownThemeBySiteId(siteEntity, context);
log.info("同步乡镇站点主题:" + JSON.toJSONString(themeTownRest));
}
......
......@@ -204,8 +204,23 @@ public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, L
}
@Override
protected void validData(AppEntity entity, Context context) throws AppException {
if (ObjectUtils.isEmpty(entity.getAppCode())) {
throw new AppException("应用编码不能为空!");
}
super.validData(entity, context);
}
@Override
protected void saveBefore(AppEntity entity, Context context) throws AppException {
//校验appCode是否唯一
Long siteId = entity.getSiteId();
String appCode = entity.getAppCode();
int count = this.count(new AppQuery().siteId(siteId).appCode(appCode), context);
if (count > 0) {
throw new AppException("当前站点已存在应用编码");
}
super.saveBefore(entity, context);
}
......@@ -217,7 +232,7 @@ public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, L
versionEntity.setAppId(entity.getId());
versionEntity.setAppName(entity.getAppName());
versionEntity.setVersion(entity.getVersion());
versionEntity.setNotes("应用初始创建!");
versionEntity.setNotes("".equals(entity.getNotes()) ? "应用初始创建!" : entity.getNotes());
versionEntity.setFileName(entity.getFileName());
versionEntity.setFilePath(entity.getFilePath());
versionEntity.setDistributeFilePath(entity.getDistributeFilePath());
......
......@@ -16,6 +16,14 @@ public interface SiteThemeService extends ICRUDService<SiteThemeEntity,Long>{
Rest<String> syncThemeBySiteId(SiteEntity siteEntity, Context context);
/**
* 乡镇主题同步
* @param siteEntity
* @param context
* @return
*/
Rest<String> syncTownThemeBySiteId(SiteEntity siteEntity, Context context);
void deleteGovBySiteId(Long siteId, Context context);
}
\ No newline at end of file
......@@ -65,6 +65,23 @@ public class SiteThemeServiceImpl extends AbstractCRUDServiceImpl<SiteThemeDao,
return Rest.ok("当前站点同步添加主题成功!");
}
@Override
public Rest<String> syncTownThemeBySiteId(SiteEntity siteEntity, Context context) {
String url = GlobalSysInfo.getParamValue(Constant.GOV_TOWN_URL, "http://www.sczwfw.gov.cn/jiq/front/item/town");
Long siteId = siteEntity.getId();
this.deleteGovBySiteId(siteId, context);
String areaCode = siteEntity.getAreaCode();
Map<String, String> params = new HashMap<>();
params.put("areaCode", areaCode);
Rest<String> townRest = buildTwonTheme(siteId, url, params, context);
if (townRest.getCode() != YesNoEnum.YES.getValue() ) {
log.info("服务结果:" + JSON.toJSONString(townRest));
return Rest.fail("同步乡镇主题失败!");
}
return Rest.ok("当前站点同步乡镇添加主题成功!");
}
private Rest<String> buildTheme(Long siteId, String userType, String url, Map<String, String> params, Context context) {
Rest<Map<String, String>> rest = MatterTypeHtmlParseUtil.getThemeList(params, url);
if (rest.getCode() == YesNoEnum.YES.getValue() && rest.getData().keySet().size() > 0) {
......@@ -96,6 +113,35 @@ public class SiteThemeServiceImpl extends AbstractCRUDServiceImpl<SiteThemeDao,
return Rest.ok(rest.getMsg());
}
private Rest<String> buildTwonTheme(Long siteId, String url, Map<String, String> params, Context context) {
Rest<Map<String, String>> rest = MatterTypeHtmlParseUtil.getTownThemeList(params, url);
if (rest.getCode() == YesNoEnum.YES.getValue() && rest.getData().keySet().size() > 0) {
Map<String, String> data = rest.getData();
for (Map.Entry<String, String> item : data.entrySet()) {
String[] vals = item.getKey().split("&");
String themeCode = vals[0];
String userType = vals[1];
String themeName = item.getValue();
int count = this.count(new SiteThemeQuery().siteId(siteId).userType(userType).themeCode(themeCode), context);
if (count == 0) {
SiteThemeEntity siteThemeEntity = new SiteThemeEntity();
siteThemeEntity.initAttrValue();
siteThemeEntity.setSiteId(siteId);
siteThemeEntity.setUserType(userType);
siteThemeEntity.setThemeCode(themeCode);
siteThemeEntity.setThemeName(themeName);
siteThemeEntity.setCreateTime(new Date());
siteThemeEntity.setCreateUserId(getContextUserId(context));
this.save(siteThemeEntity, context);
}
}
} else {
return Rest.fail(rest.getMsg());
}
return Rest.ok(rest.getMsg());
}
@Override
public void deleteGovBySiteId(Long siteId, Context context) {
Map<String, Object> condition = new HashMap<>();
......@@ -105,14 +151,14 @@ public class SiteThemeServiceImpl extends AbstractCRUDServiceImpl<SiteThemeDao,
public static void main(String[] args) {
String str="changeTheme('005', '1')";
String str = "changeTheme('005', '1')";
String reg="'.*?'";
String reg = "'.*?'";
Pattern compile = Pattern.compile(reg);
List<String> allGroups = ReUtil.findAllGroup0(compile, str);
allGroups.forEach(item->{
allGroups.forEach(item -> {
System.out.println(item);
});
......
......@@ -41,7 +41,7 @@ Content-Type: application/json
"type":1,
"downDevCount":0,
"shelves":0,
"fileName":"窗口屏.zip",
"fileName":"窗口屏3.zip",
"filePath":"/file/uploadfile/1661928678354.zip",
"summary":"vyk2sq"
}
......@@ -66,7 +66,7 @@ Content-Type: application/json
"type":1,
"downDevCount":0,
"shelves":0,
"fileName":"窗口屏1.zip",
"fileName":"窗口屏2.zip",
"filePath":"/file/uploadfile/1664180492089.zip",
"summary":"vyk2sq"
}
......
......@@ -62,12 +62,12 @@ Accept: application/json
###自助终端应用版本使用
POST {{baseUrl}}/app/version/used?appVersionId=4
POST {{baseUrl}}/app/version/used?appVersionId=7
Authorization: {{authToken}}
Accept: application/json
###自助终端应用版本预览
GET {{baseUrl}}/app/version/preview?appVersionId=4
GET {{baseUrl}}/app/version/preview?appVersionId=5
Authorization: {{authToken}}
Accept: application/json
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