Commit d4cc1045 authored by wanglong's avatar wanglong

安装、设计单位 上传监检资料时 约束

parent 2c4162dd
......@@ -22,6 +22,10 @@ public class XJConstant {
public static final String DEPT_WF_MAP_DIC_CODE = "DEPT_WF_MAP";
public static final String INSTALL_SUB_FORM="[{\"Symbol_key\":\"B83A18D2-FF89-47D2-BEA2-BAA097E09783\",\"subFormInstall\":\"设计文件1\",\"info\":\"\",\"type\":\"\"},{\"Symbol_key\":\"DB0306C1-3520-4BB4-93CE-44DA95AAD408\",\"subFormInstall\":\"设计文件2\",\"info\":\"\",\"type\":\"\"},{\"Symbol_key\":\"1939A00E-09D9-4023-8F3A-3B5B5A87CF2D\",\"subFormInstall\":\"设计文件3\",\"info\":\"\",\"type\":\"\"},{\"Symbol_key\":\"34DB64C7-1451-42D8-9AEE-012248B172A4\",\"subFormInstall\":\"设计文件4\",\"info\":\"\",\"type\":\"\"}]";
public static final String DESIGN_SUB_FORM="[{\"Symbol_key\":\"314C727B-A6A7-40F1-9CFC-C354748657F7\",\"subFormAttachment\":\"设计文件5\",\"attachmentUpload_8budyj0clb\":\"\",\"input_qz5m6foxlw\":\"\"},{\"Symbol_key\":\"5F3B660B-25A2-420C-919E-60F74CE1F36A\",\"subFormAttachment\":\"设计文件6\",\"attachmentUpload_8budyj0clb\":\"\",\"input_qz5m6foxlw\":\"\"},{\"Symbol_key\":\"8ACCE0AE-C889-47AA-98AB-ACF48FC823EB\",\"subFormAttachment\":\"设计文件7\",\"attachmentUpload_8budyj0clb\":\"\",\"input_qz5m6foxlw\":\"\"},{\"Symbol_key\":\"E6C05EBD-32C5-4655-BCFC-59A4A3E4453D\",\"subFormAttachment\":\"设计文件8\",\"attachmentUpload_8budyj0clb\":\"\",\"input_qz5m6foxlw\":\"\"}]";
/** 企业用户注册前缀 */
public static final String UGP_USER_TEL = "ugp_tel_";
......
......@@ -98,7 +98,9 @@ public class ProjectDto extends BaseDto {
*/
private String superviseDept;
private JSONArray subForm;
private JSONArray installSubForm;
private JSONArray designSubForm;
private String examineProjectState;
......
......@@ -46,4 +46,9 @@ public class Attachment extends BaseEntity {
@TableField("type")
private String type;
// //安装单位
// String subFormInstall;
// //设计单位
// String subFormAttachment;
}
......@@ -134,6 +134,14 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
}
public void saveProjectAttachment(JSONObject subForm,Long SequenceNbr){
AttachmentDto attachmentDto = new AttachmentDto();
attachmentDto.setInfo(JSON.toJSONString(subForm));
attachmentDto.setSourceId(SequenceNbr);
attachmentDto.setType("project");
attachmentServiceImpl.createWithModel(attachmentDto);
}
@Override
......
......@@ -173,12 +173,22 @@ public class ProjectServiceImpl extends BaseService<ProjectDto, Project, Project
ProjectDto project = projectMapper.getDetail(sequenceNbr);
LambdaQueryWrapper<Attachment> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Attachment::getSourceId,sequenceNbr);
try{
JSONArray jsonArray = JSON.parseArray(attachmentService.getOne(wrapper).getInfo());
project.setSubForm(jsonArray);
}catch (Exception e) {
System.out.println("该项目暂无附件");
// try{
JSONObject jsonObject = JSON.parseObject(attachmentService.getOne(wrapper).getInfo());
JSONArray installSubForm = JSON.parseArray(XJConstant.INSTALL_SUB_FORM);
JSONArray designSubForm = JSON.parseArray(XJConstant.DESIGN_SUB_FORM);
if(!ValidationUtil.isEmpty(jsonObject)){
installSubForm = jsonObject.getJSONArray("installSubForm");
designSubForm = jsonObject.getJSONArray("designSubForm");
}
project.setInstallSubForm(installSubForm);
project.setDesignSubForm(designSubForm);
// project.setSubForm(jsonArray);
// }catch (Exception e) {
// System.out.println("该项目暂无附件");
// }
project.getInstanceId();
getProjectState(project);
return project;
......@@ -186,13 +196,17 @@ public class ProjectServiceImpl extends BaseService<ProjectDto, Project, Project
public String saveOrUpdateFile(JSONObject jsonObject){
JSONArray subForm = jsonObject.getJSONArray("subForm");
JSONArray installSubForm = jsonObject.getJSONArray("installSubForm");
JSONArray designSubForm = jsonObject.getJSONArray("designSubForm");
JSONObject subForm = new JSONObject();
subForm.put("installSubForm",installSubForm);
subForm.put("designSubForm",designSubForm);
Long sequenceNbr = jsonObject.getLong("sequenceNbr");
LambdaQueryWrapper<Attachment> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Attachment::getSourceId,sequenceNbr);
Attachment attachment = attachmentService.getOne(wrapper);
if(ValidationUtil.isEmpty(attachment)){
equipmentService.saveAttachment(subForm,sequenceNbr);
equipmentService.saveProjectAttachment(subForm,sequenceNbr);
}else {
attachment.setInfo(JSON.toJSONString(subForm));
attachmentService.updateById(attachment);
......@@ -207,16 +221,29 @@ public class ProjectServiceImpl extends BaseService<ProjectDto, Project, Project
projectDto.setInsDep(jsonObject.getString("insPerson"));
projectDto.setProcessProjectState(jsonObject.getString(XJConstant.PROCESS_PROJECT_STATE));
boolean design=false,install=false;
for(Object object:subForm){
for(Object object:installSubForm){
JSONObject jo = JSON.parseObject(JSON.toJSONString(object));
String type = jo.getString("type");
if (OrgEnum.设计单位.getName().equals(type)){
design=true;
}
if (OrgEnum.安装单位.getName().equals(type)){
String info = jo.getString("info");
if (OrgEnum.安装单位.getName().equals(type) && ValidationUtil.isEmpty(info)){
install=true;
}else {
install=false;
break;
}
}
for(Object object:designSubForm){
JSONObject jo = JSON.parseObject(JSON.toJSONString(object));
String type = jo.getString("type");
String info = jo.getString("info");
if (OrgEnum.设计单位.getName().equals(type) && ValidationUtil.isEmpty(info)){
design=true;
}else {
design=false;
break;
}
}
String type = jsonObject.getString("type");
if (type != null) {
if (design && install) {
......
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