ソースを参照

上报功能调整

user5 5 ヶ月 前
コミット
deb2c89b3b

+ 92 - 4
src/main/java/com/jeeplus/modules/projectrecord/web/AdminProjectReportedImportController.java

@@ -14,6 +14,7 @@ import com.jeeplus.modules.projectEngineering.service.ProjectEngineeringService;
 import com.jeeplus.modules.projectrecord.entity.AdminProjectReportedImport;
 import com.jeeplus.modules.projectrecord.enums.ProjectStatusEnum;
 import com.jeeplus.modules.projectrecord.service.AdminProjectReportedImportService;
+import com.jeeplus.modules.ruralprojectrecords.entity.ReportedConsultant;
 import com.jeeplus.modules.ruralprojectrecords.entity.RuralReportConsultant;
 import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectMessageNewService;
 import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectMessageService;
@@ -27,16 +28,15 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.ConstraintViolationException;
+import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -89,6 +89,7 @@ public class AdminProjectReportedImportController extends BaseController {
         Page<AdminProjectReportedImport> page = projectReportedImportService.findPage(new Page<AdminProjectReportedImport>(request, response), projectReportedImport);
 
         model.addAttribute("page", page);
+        model.addAttribute("projectReportedImport", projectReportedImport);
         model.addAttribute("moneyAll", projectReportedImportService.getMoneyAll(projectReportedImport));
         return "modules/ruralprojectrecords/reported/import/adminProjectReportedImportList";
     }
@@ -238,6 +239,93 @@ public class AdminProjectReportedImportController extends BaseController {
         return "redirect:"+Global.getAdminPath()+"/project/adminProjectReportedImport/?repage";
     }
 
+    /**
+     * 保存报告并提交审核
+     * @param request
+     * @param response
+     * @param redirectAttributes
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping(value = "batchReport")
+    public Map<String, Object> batchReport(HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) throws Exception {
+        Map<String, Object> result = new HashMap<>();
+        if(!BaseController.REPORTSWITCH){
+            // 业务逻辑处理
+            result.put("message", "项目上报失败:上报管理员已关闭上报模块");
+            result.put("success",false);
+        }
+
+        String listIds = request.getParameter("listId");
+        List<String> idList = Arrays.asList(listIds.split(","));
+
+        StringBuilder successStr = new StringBuilder("项目上报成功");
+        StringBuilder errorStr = new StringBuilder("造价记录编号为:");
+
+        for (String id : idList) {
+            AdminProjectReportedImport projectReportedImport = null;
+            if (StringUtils.isNotBlank(id)){
+                projectReportedImport = projectReportedImportService.get(id);
+            }
+            if (null != projectReportedImport ){
+                if("5".equals(projectReportedImport.getReportStatus())){
+                    continue;
+                }
+
+                projectReportedImportService.disposeListImport(projectReportedImport);
+
+
+                //根据上报id查询上报咨询员的信息
+                List<RuralReportConsultant> reportedConsultants=ruralProjectMessageS.getReportedConsultantsList(projectReportedImport.getId());
+                //查询报告咨询员的信息
+                //对上报的咨询员进行处理
+                List<RuralReportConsultant> consultantList = ruralProjectMessageS.disposereportedConsultant(reportedConsultants);
+                if(consultantList.size()>0){
+                    List<ReportedConsultant> reportedConsultantList = Lists.newArrayList();
+
+                    for (RuralReportConsultant ruralReportConsultant : consultantList) {
+                        ReportedConsultant reportedConsultant = new ReportedConsultant();
+                        reportedConsultant.setWcyysr(ruralReportConsultant.getWcyysr());
+                        reportedConsultant.setZixunyuan(ruralReportConsultant.getZixunyuan());
+                        reportedConsultant.setIdCard(ruralReportConsultant.getIdCard());
+                        reportedConsultant.setWcyysrbl(ruralReportConsultant.getWcyysrbl());
+                        reportedConsultant.setWcyysr(ruralReportConsultant.getWcyysr());
+                        reportedConsultant.setRoleFlag(ruralReportConsultant.getRoleFlag());
+                        reportedConsultant.setId(ruralReportConsultant.getId());
+                        reportedConsultantList.add(reportedConsultant);
+                    }
+                    projectReportedImport.setReportedConsultantList(reportedConsultantList);
+                }
+
+                String str = "";
+                if(!projectReportedImport.getIsNewRecord()){//编辑表单保存
+                    AdminProjectReportedImport t = projectReportedImportService.getRuralProjectRecordsReported(projectReportedImport.getId());;//从数据库取出记录的值
+                    MyBeanUtils.copyBeanNotNull2Bean(projectReportedImport, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+                    str = projectReportedImportService.saveReportedInfo(t);
+                }else{//新增表单保存
+                    str = projectReportedImportService.saveReportedInfo(projectReportedImport);
+                }
+
+                if (StringUtils.isNotBlank(str)){
+                    errorStr.append(projectReportedImport.getDangABH()).append(",");
+                }
+            }
+        }
+        if(StringUtils.isNotBlank(errorStr.toString()) && errorStr.toString().length()>8){
+            errorStr.deleteCharAt(errorStr.length() - 1);
+            errorStr.append("。 数据存在错误,请单独进行上报");
+            // 业务逻辑处理
+            result.put("message", errorStr.toString());
+        }else{
+
+            // 业务逻辑处理
+            result.put("message", successStr.toString());
+            result.put("success",true);
+        }
+
+        return result;
+    }
+
 
 
     /**

+ 3 - 1
src/main/java/com/jeeplus/modules/workcontractinfo/service/WorkContractInfoService.java

@@ -205,7 +205,9 @@ public class WorkContractInfoService extends CrudService<WorkContractInfoDao, Wo
 			if(list1!=null && list1.size()>0){
 				for(WorkContractClient w :list1){
 					WorkClientInfo workClientInfo = workClientInfoService.getById(w.getClientId());
-					list2.add(workClientInfo);
+					if(null != workClientInfo){
+						list2.add(workClientInfo);
+					}
 				}
 			}
 			if ("5".equals(workContractInfo.getContractState())){

+ 24 - 3
src/main/resources/mappings/modules/projectrecord/AdminProjectReportedImportDao.xml

@@ -119,10 +119,17 @@
 				AND a.DangABH like concat(concat('%',#{DangABH}),'%')
 			</if>
 
+			<if test="beginDate !=null">
+				AND a.BaoGaoShuQianFaDate >= #{beginDate}
+			</if>
+			<if test="endDate !=null">
+				AND a.BaoGaoShuQianFaDate &lt; #{endDate}
+			</if>
+
 			<if test="reportedState !=null and reportedState !=''">
 				<choose>
 					<when test="reportedState == 0">
-						AND a.report_status is null
+						AND (a.report_status is null or a.report_status = 0)
 					</when>
 					<otherwise>
 						AND a.report_status = #{reportedState}
@@ -163,10 +170,17 @@
 				AND a.DangABH like concat(concat('%',#{DangABH}),'%')
 			</if>
 
+			<if test="beginDate !=null">
+				AND a.BaoGaoShuQianFaDate >= #{beginDate}
+			</if>
+			<if test="endDate !=null">
+				AND a.BaoGaoShuQianFaDate &lt; #{endDate}
+			</if>
+
 			<if test="reportedState !=null and reportedState !=''">
 				<choose>
 					<when test="reportedState == 0">
-						AND a.report_status is null
+						AND (a.report_status is null or a.report_status = 0)
 					</when>
 					<otherwise>
 						AND a.report_status = #{reportedState}
@@ -197,10 +211,17 @@
 				AND a.DangABH like concat(concat('%',#{DangABH}),'%')
 			</if>
 
+			<if test="beginDate !=null">
+				AND a.BaoGaoShuQianFaDate >= #{beginDate}
+			</if>
+			<if test="endDate !=null">
+				AND a.BaoGaoShuQianFaDate &lt; #{endDate}
+			</if>
+
 			<if test="reportedState !=null and reportedState !=''">
 				<choose>
 					<when test="reportedState == 0">
-						AND a.report_status is null
+						AND (a.report_status is null or a.report_status = 0)
 					</when>
 					<otherwise>
 						AND a.report_status = #{reportedState}

+ 60 - 24
src/main/webapp/webpage/modules/ruralprojectrecords/reported/import/adminProjectReportedImportList.jsp

@@ -271,7 +271,7 @@
 					<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
 					<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
 					<table:sortColumn id="orderBy" name="orderBy" value="${page.orderBy}" callback="sortOrRefresh();"/><!-- 支持排序 -->
-					<div class="commonQuery lw6">
+					<div class="commonQuery lw8">
 						<div class="layui-item query athird">
 							<label class="layui-form-label">项目名称:</label>
 							<div class="layui-input-block">
@@ -295,7 +295,7 @@
 						</div>
 						<div style="    clear:both;"></div>
 					</div>
-					<div id="moresees" style="clear:both;display:none;" class="lw6">
+					<div id="moresees" style="clear:both;display:none;" class="lw8">
 						<div class="layui-item query athird ">
 							<label class="layui-form-label double-line">造价记录编号:</label>
 							<div class="layui-input-block">
@@ -312,27 +312,25 @@
 								</form:select>
 							</div>
 						</div>
-							<%--<div class="layui-item query athird ">
-                                <label class="layui-form-label">创建时间:</label>
-                                <div class="layui-input-block readOnlyFFF">
-                                    <input id="beginDate" name="beginDate" placeholder="开始时间" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
-                                           value="<fmt:formatDate value="${projectRecords.beginDate}" pattern="yyyy-MM-dd"/>"/>
-                                    </input>
-                                    <span class="group-sep">-</span>
-                                    <input id="endDate" name="endDate" placeholder="结束时间" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
-                                           value="<fmt:formatDate value="${projectRecords.endDate}" pattern="yyyy-MM-dd"/>"/>
-                                    </input>
-                                </div>
-                            </div>
-                            <div class="layui-item query athird ">
-                                <label class="layui-form-label">状态:</label>
-                                <div class="layui-input-block">
-                                    <form:select path="projectStatus" class=" form-control  simple-select">
-                                        <form:option value="" label=""/>
-                                        <form:options items="${fns:getDictList('audit_state')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
-                                    </form:select>
-                                </div>
-                            </div>--%>
+						<div class="layui-item query athird ">
+							<label class="layui-form-label">咨询报告日期:</label>
+							<div class="layui-input-block readOnlyFFF">
+								<input id="beginDate" name="beginDate" placeholder="开始时间" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
+									   value="<fmt:formatDate value="${projectReportedImport.beginDate}" pattern="yyyy-MM-dd"/>"/>
+								</input>
+								<span class="group-sep">-</span>
+								<input id="endDate" name="endDate" placeholder="结束时间" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
+									   value="<fmt:formatDate value="${projectReportedImport.endDate}" pattern="yyyy-MM-dd"/>"/>
+								</input>
+							</div>
+						</div>
+
+						<div class="layui-item query athird ">
+							<label class="layui-form-label">委托单位:</label>
+							<div class="layui-input-block">
+								<form:input path="WeiTuoDW" htmlEscape="false" maxlength="255"  class=" form-control layui-input"/>
+							</div>
+						</div>
 						<div style="clear:both;"></div>
 					</div>
 				</form:form>
@@ -356,6 +354,11 @@
 						<shiro:hasPermission name="project:adminProjectReportedImport:export">
 							<table:exportExcel url="${ctx}/project/projectRecords/export"></table:exportExcel><!-- 导出按钮 -->
 						</shiro:hasPermission>
+
+						<shiro:hasPermission name="project:adminProjectReportedImport:import">
+							<button type="button" data-toggle="tooltip" data-placement="top" class="layui-btn layui-btn-sm layui-bg-blue" id="batchReport"> 批量上报</button>
+						</shiro:hasPermission>
+
 						<shiro:hasPermission name="project:projectRecords:lockProject">
 							<button type="button" data-toggle="tooltip" data-placement="top" class="layui-btn layui-btn-sm layui-bg-blue" id="lockProject"> 锁定</button>
 						</shiro:hasPermission>
@@ -497,7 +500,40 @@
 			layer.msg("解除锁定成功", {icon: 1})
 			return true;
 		});
-    })
+
+		$("#batchReport").bind("click", function () {
+			var checkList = layui.table.checkStatus('checkboxTable').data;
+			var listId = [];
+			$.each(checkList, function (i, data) {
+				listId.push(data.id);
+			});
+
+			if (listId.length <= 0) {
+				layer.msg("请选择需要上报的项目信息", {icon: 2});
+			} else {
+				$.ajax({
+					type: "POST",
+					url: "${ctx}/project/adminProjectReportedImport/batchReport",
+					data: {listId: listId.join(",")},
+					success: function (response) {
+						if(response.success){
+							layer.msg(response.message, {icon: 1, time: 2000}, function () {
+								location.reload(); // 刷新页面
+							});
+						}else{
+							layer.msg(response.message, {icon: 5, time: 2000}, function () {
+								location.reload(); // 刷新页面
+							});
+						}
+					},
+					error: function () {
+						layer.msg("上报失败,请稍后重试", {icon: 2});
+					}
+				});
+			}
+		});
+
+	})
 
     resizeListTable();
     $("a").on("click",addLinkVisied);