Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

user5 před 3 roky
rodič
revize
2aa68fa6b3

+ 5 - 1
src/main/java/com/jeeplus/modules/projectAccessory/web/ProjectAccessoryController.java

@@ -24,6 +24,7 @@ import com.jeeplus.modules.projectEngineering.service.ProjectEngineeringService;
 import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportData;
 import com.jeeplus.modules.projectcontentinfo.service.ProjectBasedDataService;
 import com.jeeplus.modules.projectmaterialstorage.entity.ProjectMaterialStorage;
+import com.jeeplus.modules.projectmaterialstorage.service.ProjectMaterialStorageService;
 import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
 import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
 import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectRecordsService;
@@ -34,6 +35,7 @@ import com.jeeplus.modules.sys.utils.UserUtils;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientLinkman;
+import io.netty.util.internal.UnstableApi;
 import org.apache.shiro.authz.annotation.Logical;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -78,6 +80,8 @@ public class ProjectAccessoryController extends BaseController {
 	private ProjectBasedDataService projectBasedDataService;
 	@Autowired
 	private RuralProjectRecordsController ruralProjectRecordsController;
+	@Autowired
+	private ProjectMaterialStorageService projectMaterialStorageService;
 
 	@ModelAttribute
 	public ProjectAccessoryInfo get(@RequestParam(required=false) String id) {
@@ -455,7 +459,7 @@ public class ProjectAccessoryController extends BaseController {
 				ruralProjectRecords.setprojectMaterialStorageStatus("0");
 			}
 
-			ruralProjectRecordsController.modfiyRuralProjectRecordsMaterialStorageStatus(ruralProjectRecords);
+			projectMaterialStorageService.modifyProjectMaterialStorageStatus(ruralProjectRecords);
 		}
 
 		long t2 = System.currentTimeMillis();

+ 10 - 0
src/main/java/com/jeeplus/modules/projectmaterialstorage/dao/ProjectMaterialStorageDao.java

@@ -15,5 +15,15 @@ import com.jeeplus.modules.projectmaterialstorage.entity.ProjectMaterialStorage;
 public interface ProjectMaterialStorageDao extends CrudDao<ProjectMaterialStorage> {
 
 
+    /**
+     * 查询项目名称
+     * @param projectMaterialStorage
+     * @return
+     */
     public String getProjectName(ProjectMaterialStorage projectMaterialStorage);
+
+    /**
+     * 查询同项目名称、价格、材料名称的数量
+     */
+    public Integer selectCountAboutProjectMaterialStorage(ProjectMaterialStorage projectMaterialStorage);
 }

+ 38 - 0
src/main/java/com/jeeplus/modules/projectmaterialstorage/service/ProjectMaterialStorageService.java

@@ -2,16 +2,21 @@ package com.jeeplus.modules.projectmaterialstorage.service;
 
 
 import afu.org.checkerframework.checker.igj.qual.I;
+import afu.org.checkerframework.checker.igj.qual.ReadOnly;
 import com.jeeplus.common.persistence.Page;
 import com.jeeplus.common.service.CrudService;
+import com.jeeplus.common.utils.IdGen;
 import com.jeeplus.common.utils.MenuStatusEnum;
 import com.jeeplus.modules.projectmaterialstorage.dao.ProjectMaterialStorageDao;
 import com.jeeplus.modules.projectmaterialstorage.entity.ProjectMaterialStorage;
 import com.jeeplus.modules.projectmaterialstorage.entity.ProjectMaterialStorageExport;
+import com.jeeplus.modules.ruralprojectrecords.dao.RuralProjectRecordsDao;
 import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
 import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecordsExport;
 import com.jeeplus.modules.sys.utils.UserUtils;
+import com.sun.org.apache.xpath.internal.operations.Bool;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -29,6 +34,8 @@ public class ProjectMaterialStorageService extends CrudService<ProjectMaterialSt
 
     @Autowired
     private ProjectMaterialStorageDao projectMaterialStorageDao;
+    @Autowired
+    private RuralProjectRecordsDao ruralProjectRecordsDao;
 
     public ProjectMaterialStorage get(String id){
         return super.get(id);
@@ -64,4 +71,35 @@ public class ProjectMaterialStorageService extends CrudService<ProjectMaterialSt
     public  String getProjectName(ProjectMaterialStorage projectMaterialStorage){
        return projectMaterialStorageDao.getProjectName(projectMaterialStorage);
     }
+
+    /**
+     * 查询同项目名称、价格、材料名称的数量是否只有一个
+     */
+    public Boolean qureyCountAboutProjectMaterialStorage(ProjectMaterialStorage projectMaterialStorage){
+
+        if(projectMaterialStorageDao.selectCountAboutProjectMaterialStorage(projectMaterialStorage) != 1){
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * 逻辑删除
+     */
+    @Transactional(readOnly = false)
+    public Integer delectBylogic(ProjectMaterialStorage projectMaterialStorage){
+        return dao.deleteByLogic(projectMaterialStorage);
+    }
+
+
+    /**
+     * 修改项目表中的材料库状态信息
+     */
+    @Transactional(readOnly = false)
+    public String modifyProjectMaterialStorageStatus(RuralProjectRecords ruralProjectRecords){
+        if(ruralProjectRecordsDao.modfiyProjectMaterialStorageStatus(ruralProjectRecords) == 1){
+            return "修改成功";
+        }
+        return "修改失败";
+    }
 }

+ 11 - 6
src/main/java/com/jeeplus/modules/projectmaterialstorage/web/ProjectMaterialStorageController.java

@@ -80,18 +80,21 @@ public class ProjectMaterialStorageController extends BaseController {
     public String save(ProjectMaterialStorage projectMaterialStorage, Model model, RedirectAttributes redirectAttributes) throws Exception {
 
 //        projectNumber update_by  update_date create_by create_date
-        if(projectMaterialStorage.getProjectNumber()==null && projectMaterialStorage.getMaterialName() ==null  ){
-            addMessage(redirectAttributes, "添加失败失败,请重试");
+//       判断项目名称、材料名称、价格是否为空
+        if(projectMaterialStorage.getProjectNumber()==null && projectMaterialStorage.getMaterialName() ==null && projectMaterialStorage.getPrice() == null ){
+            addMessage(redirectAttributes, "项目名称、材料名称、价格等获取失败,请重试");
             return "redirect:"+Global.getAdminPath()+"/project/projectMaterialStorage/?repage";
         }
+//        进行项目名称、材料名称、价格重复的判断
         projectMaterialStorage.setIsNewRecord(true);
-        if(" " ==projectMaterialStorage.getRemarks()){
-            projectMaterialStorage.setRemarks(" ");
+        if(!projectMaterialStorageService.qureyCountAboutProjectMaterialStorage(projectMaterialStorage)){
+            addMessage(redirectAttributes, "当前的项目名称、材料名称、价格重复,请重试");
+            return "redirect:"+Global.getAdminPath()+"/project/projectMaterialStorage/?repage";
         }
         projectMaterialStorageService.save(projectMaterialStorage);
         RuralProjectRecords ruralProjectRecords = ruralProjectRecordsService.get(projectMaterialStorage.getProjectNumber());
         ruralProjectRecords.setprojectMaterialStorageStatus("2");
-        ruralProjectRecordsService.modfiyProjectMaterialStorageStatus(ruralProjectRecords);
+        projectMaterialStorageService.modifyProjectMaterialStorageStatus(ruralProjectRecords);
         return "redirect:"+Global.getAdminPath()+"/project/projectMaterialStorage/?repage";
     }
 
@@ -120,7 +123,9 @@ public class ProjectMaterialStorageController extends BaseController {
     @RequestMapping(value = "delete")
     public String delete(ProjectMaterialStorage projectMaterialStorage, RedirectAttributes redirectAttributes) {
 
-            projectMaterialStorageService.delete(projectMaterialStorage);
+           if(projectMaterialStorageService.delectBylogic(projectMaterialStorage) != 1){
+               addMessage(redirectAttributes, "删除失败,请重试");
+           }
             return "redirect:"+Global.getAdminPath()+"/project/projectMaterialStorage/?repage";
         }
 

+ 0 - 10
src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectRecordsService.java

@@ -4785,15 +4785,5 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
 		return c.getTime();
 	}
 
-	/**
-	 * 修改项目表中的材料库状态信息
-	 */
-	@Transactional(readOnly = false)
-	public String modfiyProjectMaterialStorageStatus(RuralProjectRecords ruralProjectRecords){
-		 if(ruralProjectRecordsDao.modfiyProjectMaterialStorageStatus(ruralProjectRecords) == 1){
-		 	return "修改成功";
-		 }
-		 return "修改失败";
-	}
 
 }

+ 11 - 16
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectRecordsController.java

@@ -1237,21 +1237,16 @@ public class RuralProjectRecordsController extends BaseController {
 			}
 		}
 	}
-	/**
-	 * 查询项目名称是否重复
-	 */
-	@RequestMapping(value = "reProjectName")
-	@ResponseBody
-	public Integer reProjectName(String projectName){
-		Integer count = projectRecordsService.reProjectName(projectName);
-		return count;
-	}
 
-	/**
-	 * 上传材料库文件修改项目材料库状态
-	 */
-	@RequestMapping(value = "")
-	public String modfiyRuralProjectRecordsMaterialStorageStatus(RuralProjectRecords ruralProjectRecords){
-		return projectRecordsService.modfiyProjectMaterialStorageStatus(ruralProjectRecords);
-	}
+//	/**
+//	 * 查询项目名称是否重复
+//	 */
+//	@RequestMapping(value = "reProjectName")
+//	@ResponseBody
+//	public Integer reProjectName(String projectName){
+//		Integer count = projectRecordsService.reProjectName(projectName);
+//		return count;
+//	}
+
+
 }

+ 17 - 14
src/main/java/com/jeeplus/modules/sys/web/WorkattachmentController.java

@@ -14,7 +14,9 @@ import com.jeeplus.common.utils.StringUtils;
 import com.jeeplus.common.utils.excel.ExportExcel;
 import com.jeeplus.common.utils.excel.ImportExcel;
 import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.projectmaterialstorage.service.ProjectMaterialStorageService;
 import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
+import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectRecordsService;
 import com.jeeplus.modules.ruralprojectrecords.web.RuralProjectRecordsController;
 import com.jeeplus.modules.sys.entity.Workattachment;
 import com.jeeplus.modules.sys.service.WorkattachmentService;
@@ -52,7 +54,9 @@ public class WorkattachmentController extends BaseController {
 	@Autowired
 	private WorkattachmentService workattachmentService;
 	@Autowired
-	private RuralProjectRecordsController ruralProjectRecordsController;
+	private RuralProjectRecordsService ruralProjectRecordsService;
+	@Autowired
+	private ProjectMaterialStorageService projectMaterialStorageService;
 
 	@ModelAttribute
 	public Workattachment get(@RequestParam(required=false) String id) {
@@ -249,29 +253,28 @@ public class WorkattachmentController extends BaseController {
 						sftpClientUtil.delete(workattachment.getUrl());
 					}else{
 						sftpClientUtil.delete(url);
-					}
+						}
 
-					if(workattachment != null){
-						workattachmentService.delete(workattachment);
+						if(workattachment != null){
+							workattachmentService.delete(workattachment);
+						}
+					} catch (Exception e) {
+						e.printStackTrace();
 					}
-				} catch (Exception e) {
-					e.printStackTrace();
 				}
 			}
-		}
-		HashMap<Object, Object> map = Maps.newHashMap();
-		map.put("str","success");
+			HashMap<Object, Object> map = Maps.newHashMap();
+			map.put("str","success");
 
-	if(StringUtils.isNotBlank(workAttachment1.getProjectId())){
-			if("cf70486864254239b3533eba5c19c19e".equals(workAttachment1.getAttachmentId())){
-				String proId = workAttachment1.getProjectId();
-				RuralProjectRecords ruralProjectRecords = ruralProjectRecordsController.get(proId);
+		if(StringUtils.isNotBlank(workAttachment1.getProjectId())){
+				if("cf70486864254239b3533eba5c19c19e".equals(workAttachment1.getAttachmentId())){
+				RuralProjectRecords ruralProjectRecords = ruralProjectRecordsService.get(workAttachment1.getProjectId());
 				if(workattachmentService.queryMaterialListFile(workAttachment1) != 0){
 					ruralProjectRecords.setprojectMaterialStorageStatus("1");
 				}else{
 					ruralProjectRecords.setprojectMaterialStorageStatus("0");
 				}
-				ruralProjectRecordsController.modfiyRuralProjectRecordsMaterialStorageStatus(ruralProjectRecords);
+				projectMaterialStorageService.modifyProjectMaterialStorageStatus(ruralProjectRecords);
 		}
 		}
 

+ 11 - 0
src/main/resources/mappings/modules/projectMaterialStorage/ProjectMaterialStorageDao.xml

@@ -70,6 +70,9 @@
 			<if test="endDate !=null">
 				AND a.create_date &lt; #{endDate}
 			</if>
+			<if test="projectId !=null">
+				AND r.project_id like concat(concat('%',#{projectId}),'%')
+			</if>
 		</where>
 		<choose>
 			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
@@ -161,6 +164,14 @@
 	</select>
 
 
+	<select id="selectCountAboutProjectMaterialStorage" resultType="integer">
+		select count(1)
+		from project_material_storage
+		where project_number = #{projectNumber}
+		and material_name = #{materialName}
+		and price = #{price}
+	</select>
+
 
 
 

+ 11 - 3
src/main/webapp/webpage/modules/projectMaterialStorage/projectMaterialStorageList.jsp

@@ -303,7 +303,7 @@
 					<input id="toflag" name="toflag" type="hidden" value="1"/>
 					<table:sortColumn id="orderBy" name="orderBy" value="${page.orderBy}" callback="sortOrRefresh();"/><!-- 支持排序 -->
 					<div class="commonQuery lw6">
-						<div class="layui-item query athird">
+						<div class="layui-item query athird" style="margin-top: 10px">
 							<label class="layui-form-label">项目名称:</label>
 							<div class="layui-input-block">
 								<form:input path="projectName" htmlEscape="false" maxlength="64"  class=" form-control  layui-input"/>
@@ -313,7 +313,7 @@
 						<div class="layui-item query athird">
 							<label class="layui-form-label">材料名称:</label>
 							<div class="layui-input-block">
-								<form:input path="materialName" htmlEscape="false" maxlength="64"  class=" form-control  layui-input"/>
+								<form:input path="materialName" htmlEscape="false" maxlength="64"  class=" form-control  layui-input" />
 						</div>
 					</div>
 
@@ -332,6 +332,14 @@
 						<div style="    clear:both;"></div>
 					</div>
 					<div id="moresees" style="clear:both;display:none;" class="lw6">
+
+						<div class="layui-item query athird">
+							<label class="layui-form-label">报告号:</label>
+							<div class="layui-input-block with-icon">
+								<form:input path="projectId" htmlEscape="false" maxlength="64"  class=" form-control  layui-input"/>
+							</div>
+						</div>
+
 						<div class="layui-item query athird">
 							<label class="layui-form-label">地点:</label>
 							<div class="layui-input-block with-icon">
@@ -370,8 +378,8 @@
 				<div class="nav-btns">
 					<%--此处按钮样式包括 nav-btn-add nav-btn-refresh nav-btn-import nav-btn-export nav-btn-query nav-btn-reset--%>
 					<div class="layui-btn-group">
-						<button class="layui-btn layui-btn-sm" data-toggle="tooltip" data-placement="left" onclick="sortOrRefresh()" title="刷新"> 刷新</button>
 						<table:addRow url="${ctx}/project/projectMaterialStorage/formTwoPage" title="添加材料"></table:addRow><!-- 增加按钮 -->
+						<button class="layui-btn layui-btn-sm" data-toggle="tooltip" data-placement="left" onclick="sortOrRefresh()" title="刷新"> 刷新</button>
 						</div>
 <%--					<shiro:hasPermission name="ruralProject:ruralProjectRecords:add">--%>
 <%--						<table:addRow url="${ctx}/ruralProject/ruralProjectRecords/form" title="项目"></table:addRow><!-- 增加按钮 -->--%>

+ 3 - 3
src/main/webapp/webpage/modules/projectMaterialStorage/projectMaterialStorageTwoForm.jsp

@@ -100,19 +100,19 @@
 				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label"><span class="require-item invoicetype">*</span>材料名称</label>
 					<div class="layui-input-block">
-						<form:input id="materialName" path="materialName" htmlEscape="false"  placeholder="请输入材料名称"  class="form-control layui-input"  value="${projectMaterialStorage.materialName}"/>
+						<form:input id="materialName" path="materialName" htmlEscape="false"  placeholder="请输入材料名称"  class="form-control layui-input"  value="${projectMaterialStorage.materialName}" required="true"/>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label"><span class="require-item invoicetype" >*</span>材料单位</label>
 					<div class="layui-input-block">
-						<form:input id="unit" path="unit" htmlEscape="false"  placeholder="请输入材料单位"  class="form-control layui-input" value="${projectMaterialStorage.unit}" />
+						<form:input id="unit" path="unit" htmlEscape="false"  placeholder="请输入材料单位"  class="form-control layui-input" value="${projectMaterialStorage.unit}"  />
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label"><span class="require-item invoicetype">*</span>单价(元)</label>
 					<div class="layui-input-block">
-						<form:input id="price" path="price" htmlEscape="false"  placeholder="请输入单价"  class="form-control layui-input"  value="${projectMaterialStorage.price}"/>
+						<form:input id="price" path="price" htmlEscape="false"  placeholder="请输入单价"  class="form-control layui-input"  value="${projectMaterialStorage.price}" required="true" />
 					</div>
 				</div>