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

初始化站点资源

parent 9b2790f1
...@@ -21,11 +21,11 @@ import com.mortals.xhx.module.dept.model.DeptQuery; ...@@ -21,11 +21,11 @@ import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService; import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.matter.model.MatterEntity; import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.model.MatterQuery; import com.mortals.xhx.module.matter.model.MatterQuery;
import com.mortals.xhx.module.matter.service.MatterExtService;
import com.mortals.xhx.module.matter.service.MatterService; import com.mortals.xhx.module.matter.service.MatterService;
import com.mortals.xhx.module.site.model.SiteEntity; import com.mortals.xhx.module.site.model.*;
import com.mortals.xhx.module.site.model.SiteMatterEntity;
import com.mortals.xhx.module.site.model.SiteMatterQuery;
import com.mortals.xhx.module.site.service.SiteMatterService; import com.mortals.xhx.module.site.service.SiteMatterService;
import com.mortals.xhx.module.site.service.SiteService;
import com.mortals.xhx.module.site.service.SiteThemeMatterService; import com.mortals.xhx.module.site.service.SiteThemeMatterService;
import com.mortals.xhx.module.site.service.SiteThemeService; import com.mortals.xhx.module.site.service.SiteThemeService;
import com.mortals.xhx.module.window.model.WindowEntity; import com.mortals.xhx.module.window.model.WindowEntity;
...@@ -47,10 +47,7 @@ import org.springframework.util.ObjectUtils; ...@@ -47,10 +47,7 @@ import org.springframework.util.ObjectUtils;
import org.springframework.util.StopWatch; import org.springframework.util.StopWatch;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -82,6 +79,13 @@ public class DemoWebApiController { ...@@ -82,6 +79,13 @@ public class DemoWebApiController {
private AppDatasetService appDatasetService; private AppDatasetService appDatasetService;
@Autowired @Autowired
private AppInfoFieldService appInfoFieldService; private AppInfoFieldService appInfoFieldService;
@Autowired
private MatterExtService matterExtService;
@Autowired
private SiteService siteService;
@Autowired
private SiteThemeService siteThemeService;
@PostMapping(value = "testGov") @PostMapping(value = "testGov")
...@@ -322,6 +326,70 @@ public class DemoWebApiController { ...@@ -322,6 +326,70 @@ public class DemoWebApiController {
} }
@PostMapping(value = "saveSiteMatters")
@UnAuth
public Rest<String> saveSiteMatters(@RequestBody SiteQuery siteQuery) {
log.info("保存站点事项相关==");
//复制部门
Long copySiteId = siteQuery.getCopySiteId();
Long targetSiteId = siteQuery.getTargetSiteId();
List<DeptEntity> deptEntityList = deptService.find(new DeptQuery().siteId(copySiteId).source(SourceEnum.政务网.getValue()));
deptEntityList.stream().forEach(item -> {
item.setSiteId(targetSiteId);
item.setId(null);
item.setDeptNumber(item.getDeptNumber() + "_" + targetSiteId);
});
deptService.save(deptEntityList);
SiteEntity siteEntity = siteService.get(targetSiteId);
//保存站点事项
List<MatterEntity> matterList = matterService.getDao().getMatterListByAreaCode(new MatterQuery().areaCode(siteQuery.getAreaCode()).source(SourceEnum.政务网.getValue()));
List<SiteMatterEntity> targetSiteMatterEntities = new ArrayList<>();
for (MatterEntity matterEntity : matterList) {
DeptEntity deptEntity = deptService.getExtCache(matterEntity.getDeptCode());
SiteMatterEntity siteMatterEntity = new SiteMatterEntity();
siteMatterEntity.initAttrValue();
//SiteEntity siteEntity = siteService.get(siteId);
siteMatterEntity.setSiteId(siteEntity.getId());
siteMatterEntity.setSiteName(siteEntity.getSiteName());
siteMatterEntity.setMatterId(matterEntity.getId());
siteMatterEntity.setMatterCode(matterEntity.getMatterNo());
siteMatterEntity.setMatterName(matterEntity.getMatterName());
siteMatterEntity.setSource(matterEntity.getSource());
siteMatterEntity.setEventTypeShow(matterEntity.getEventTypeShow());
siteMatterEntity.setDeptName(deptEntity == null ? "" : deptEntity.getName());
siteMatterEntity.setDeptId(deptEntity == null ? -1L : deptEntity.getId());
siteMatterEntity.setDeptCode(deptEntity == null ? "" : deptEntity.getDeptNumber());
siteMatterEntity.setCreateUserId(1L);
siteMatterEntity.setCreateTime(new Date());
targetSiteMatterEntities.add(siteMatterEntity);
}
siteMatterService.save(targetSiteMatterEntities);
//同步主题
List<SiteThemeEntity> siteThemeEntities = siteThemeService.find(new SiteThemeQuery().siteId(copySiteId));
for (SiteThemeEntity siteThemeEntity : siteThemeEntities) {
siteThemeEntity.setId(null);
siteThemeEntity.setSiteId(targetSiteId);
}
siteThemeService.save(siteThemeEntities);
List<SiteThemeMatterEntity> siteThemeMatterEntities = siteThemeMatterService.find(new SiteThemeMatterQuery().siteId(copySiteId));
for (SiteThemeMatterEntity siteThemeMatterEntity : siteThemeMatterEntities) {
siteThemeMatterEntity.setId(null);
siteThemeMatterEntity.setSiteId(targetSiteId);
siteThemeMatterEntity.setSiteName(siteEntity.getSiteName());
}
siteThemeMatterService.save(siteThemeMatterEntities);
return Rest.ok();
}
@PostMapping(value = "limit") @PostMapping(value = "limit")
@UnAuth @UnAuth
//@TokenBucketLimit //@TokenBucketLimit
...@@ -354,7 +422,7 @@ public class DemoWebApiController { ...@@ -354,7 +422,7 @@ public class DemoWebApiController {
sb.append(String.format("INSERT INTO `mortals_sys_app_info_field`(`id`, `datasetId`, `fieldCode`, `fieldName`, `fieldType`, `fieldTypeValue`, `dataType`, `fieldValue`, `defaultValue`, `fieldLen`, `fieldNull`, `isList`, `fieldOrderNo`, `remark`, `createTime`, `createUserId`, `updateTime`, `updateUserId`, `serviceApi`, `serviceApiParams`) VALUES (null, %s, 'name', '政策全称', 'input', '', 'string', '', '', 128, 0, 1, 99, '', '2024-05-29 17:55:38', 1, '2024-05-29 17:55:38', 1, '', '');", appDatasetEntity.getId())); sb.append(String.format("INSERT INTO `mortals_sys_app_info_field`(`id`, `datasetId`, `fieldCode`, `fieldName`, `fieldType`, `fieldTypeValue`, `dataType`, `fieldValue`, `defaultValue`, `fieldLen`, `fieldNull`, `isList`, `fieldOrderNo`, `remark`, `createTime`, `createUserId`, `updateTime`, `updateUserId`, `serviceApi`, `serviceApiParams`) VALUES (null, %s, 'name', '政策全称', 'input', '', 'string', '', '', 128, 0, 1, 99, '', '2024-05-29 17:55:38', 1, '2024-05-29 17:55:38', 1, '', '');", appDatasetEntity.getId()));
sb.append("\n"); sb.append("\n");
} }
log.info("sql:{}",sb.toString()); log.info("sql:{}", sb.toString());
//INSERT INTO `mortals_sys_app_info_field`(`id`, `datasetId`, `fieldCode`, `fieldName`, `fieldType`, `fieldTypeValue`, `dataType`, `fieldValue`, `defaultValue`, `fieldLen`, `fieldNull`, `isList`, `fieldOrderNo`, `remark`, `createTime`, `createUserId`, `updateTime`, `updateUserId`, `serviceApi`, `serviceApiParams`) VALUES (null, 755, 'name', '政策全称', 'input', '', 'string', '', '', 128, 0, 1, 99, '', '2024-05-29 17:55:38', 1, '2024-05-29 17:55:38', 1, '', ''); //INSERT INTO `mortals_sys_app_info_field`(`id`, `datasetId`, `fieldCode`, `fieldName`, `fieldType`, `fieldTypeValue`, `dataType`, `fieldValue`, `defaultValue`, `fieldLen`, `fieldNull`, `isList`, `fieldOrderNo`, `remark`, `createTime`, `createUserId`, `updateTime`, `updateUserId`, `serviceApi`, `serviceApiParams`) VALUES (null, 755, 'name', '政策全称', 'input', '', 'string', '', '', 128, 0, 1, 99, '', '2024-05-29 17:55:38', 1, '2024-05-29 17:55:38', 1, '', '');
......
...@@ -197,33 +197,33 @@ public class SiteEntity extends SiteVo { ...@@ -197,33 +197,33 @@ public class SiteEntity extends SiteVo {
this.proCode = ""; this.proCode = "";
this.cityCode = ""; this.cityCode = "";
this.districtCode = ""; this.districtCode = "";
this.siteIp = ""; this.siteIp = "127.0.0.1";
this.sitePort = ""; this.sitePort = "80";
this.longitude = ""; this.longitude = "";
this.latitude = ""; this.latitude = "";
this.siteTel = ""; this.siteTel = "13808095770";
this.detailAddress = ""; this.detailAddress = "";
this.siteRemark = ""; this.siteRemark = "";
this.amWorkStartTime = null; this.amWorkStartTime = null;
this.amWorkEndTime = null; this.amWorkEndTime = null;
this.pmWorkStartTime = null; this.pmWorkStartTime = null;
this.pmWorkEndTime = null; this.pmWorkEndTime = null;
this.workday1 = 0; this.workday1 = 1;
this.workday2 = 0; this.workday2 = 1;
this.workday3 = 0; this.workday3 = 1;
this.workday4 = 0; this.workday4 = 1;
this.workday5 = 0; this.workday5 = 1;
this.workday6 = 0; this.workday6 = 0;
this.workday7 = 0; this.workday7 = 0;
this.onlineTake = 1; this.onlineTake = 1;
this.appointment = 1; this.appointment = 1;
this.gowMap = 1; this.gowMap = 1;
this.level = 0; this.level = 1;
this.building = 0; this.building = 1;
this.logoPath = ""; this.logoPath = "";
this.englishName = ""; this.englishName = "";
this.leadingOfficial = ""; this.leadingOfficial = "张三";
this.leadingOfficialTelephone = ""; this.leadingOfficialTelephone = "13808095770";
this.modelIds = ""; this.modelIds = "";
this.govAffairStyle = ""; this.govAffairStyle = "";
this.complaintHotline = ""; this.complaintHotline = "";
......
...@@ -34,4 +34,9 @@ public class SiteVo extends BaseEntityLong { ...@@ -34,4 +34,9 @@ public class SiteVo extends BaseEntityLong {
private List<String> modelData; private List<String> modelData;
private Long copySiteId;
private Long targetSiteId;
} }
\ No newline at end of file
...@@ -170,3 +170,6 @@ POST {{baseUrl}}/site/getSitesGroupByAreaLevel ...@@ -170,3 +170,6 @@ POST {{baseUrl}}/site/getSitesGroupByAreaLevel
Content-Type: application/json Content-Type: application/json
{"areaLevel":3,"siteName": "%翠屏区%"} {"areaLevel":3,"siteName": "%翠屏区%"}
...@@ -271,3 +271,10 @@ Content-Type: application/json ...@@ -271,3 +271,10 @@ Content-Type: application/json
} }
###保存站点事项与主题事项
POST {{baseUrl}}/test/saveSiteMatters
Content-Type: application/json
{"copySiteId":11,"targetSiteId": 50,"areaCode": "511523000000"}
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