|
@@ -1,10 +1,24 @@
|
|
|
package com.fuzamei.web;
|
|
|
|
|
|
+import java.util.LinkedHashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.fuzamei.constant.HintMSG;
|
|
|
+import com.fuzamei.constant.Role;
|
|
|
+import com.fuzamei.entity.UserDetail;
|
|
|
import com.fuzamei.service.ContractManagementService;
|
|
|
+import com.fuzamei.service.UserAuthoricationService;
|
|
|
+import com.fuzamei.utils.JSONUtil;
|
|
|
+import com.fuzamei.utils.PageDTO;
|
|
|
+import com.fuzamei.utils.ValidationUtil;
|
|
|
|
|
|
/**
|
|
|
* 合同管理模块
|
|
@@ -18,7 +32,104 @@ public class ContractManagementAction {
|
|
|
@Autowired
|
|
|
private ContractManagementService contractManagementService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private UserAuthoricationService userAuthoricationService;
|
|
|
+
|
|
|
+ private static final int ROW_NUM = 10; // 分页每页显示数据的数量
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @Title: queryContractStatusTracking
|
|
|
+ * @Description: TODO(查询合同状态跟踪表的信息,总表的信息)
|
|
|
+ * @param @param data
|
|
|
+ businessId:之前业务申报模块下来的id号
|
|
|
+ contractParty:签约方,也是在之前业务申报模块中获取的这个信息
|
|
|
+ {
|
|
|
+ "userId":"xxx",
|
|
|
+ "page":"1",
|
|
|
+ "businessId":"",
|
|
|
+ "contractParty":"",
|
|
|
+ "startTime":"",
|
|
|
+ "endTime":""
|
|
|
+ }
|
|
|
+ * @param @return 设定文件
|
|
|
+ * @return Map<String,Object> 返回类型
|
|
|
+ * @author ylx
|
|
|
+ * @date 2018年1月8日 上午11:30:09
|
|
|
+ * @throws
|
|
|
+ */
|
|
|
+ @RequestMapping(value="/queryContractStatusTracking",method=RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ private Map<String, Object> queryContractStatusTracking(@RequestBody String data){
|
|
|
+ try {
|
|
|
+ System.out.println("查询合同状态跟踪表....");
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ Map<String,Object> map = JSON.parseObject(data, Map.class);
|
|
|
+ int userId = ValidationUtil.checkAndAssignInt(map.get("userId"));
|
|
|
+ //只有管理员,省分行业务主管部门,省分行法律部才有权限可以查看
|
|
|
+ userAuthoricationService.checkUserAuthority(userId, Role.ADMIN,Role.BUSINESS_CHIEF_DEP_OF_PBB,Role.LAW_DEP_OF_PBB);
|
|
|
+ int page = ValidationUtil.checkMinAndAssignInt(map.get("page"),1);
|
|
|
+ Integer businessId = ValidationUtil.checkAndAssignNullIntegerIfIsBlank(map.get("businessId"));
|
|
|
+ String contractParty = ValidationUtil.checkBlankStringAndAssignEmptyIfIsBlank(map.get("contractParty"));
|
|
|
+ long startTime = ValidationUtil.checkAndAssignDefaultLong(map.get("startTime"), 0L);
|
|
|
+ long endTime = ValidationUtil.checkAndAssignDefaultLong(map.get("endTime"), Long.MAX_VALUE);
|
|
|
+ Map<String, Object> mapToService = new LinkedHashMap<String, Object>();
|
|
|
+ mapToService.put("startPage", (page - 1) * ROW_NUM);
|
|
|
+ mapToService.put("businessId", businessId);
|
|
|
+ mapToService.put("contractParty", contractParty);
|
|
|
+ //如果时间顺序错位,要重新进行排位
|
|
|
+ mapToService.put("startTime", startTime);
|
|
|
+ if (startTime <= endTime) {
|
|
|
+ mapToService.put("endTime", endTime);
|
|
|
+ } else {
|
|
|
+ mapToService.put("endTime", Long.MAX_VALUE);
|
|
|
+ }
|
|
|
+ mapToService.put("rowNum", ROW_NUM); // 默认每页显示数据是10条,可根据需求修改分页数量
|
|
|
+ PageDTO pageDto=contractManagementService.queryContractStatusTracking(mapToService);
|
|
|
+ return JSONUtil.getJsonMap(200, true, HintMSG.QUERY_SUCCESS, pageDto);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return JSONUtil.getJsonMap(500, false, HintMSG.QUERY_FAIL+":"+e.getMessage(), null);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @Title: queryContractRecordByBusinessId
|
|
|
+ * @Description: TODO(在合同状态跟踪表的基础上查询其中一条记录中的)
|
|
|
+ * @param @param data
|
|
|
+ {
|
|
|
+ "userId":"",
|
|
|
+ "page":"1",
|
|
|
+ "businessId":""
|
|
|
+ }
|
|
|
+ * @param @return 设定文件
|
|
|
+ * @return Map<String,Object> 返回类型
|
|
|
+ * @author ylx
|
|
|
+ * @date 2018年1月8日 下午2:50:36
|
|
|
+ * @throws
|
|
|
+ */
|
|
|
+ @RequestMapping(value="/queryContractRecordByBusinessId",method=RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public Map<String, Object> queryContractRecordByBusinessId(@RequestBody String data){
|
|
|
+ try {
|
|
|
+ System.out.println("查询合同状态跟踪表....");
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ Map<String,Object> map = JSON.parseObject(data, Map.class);
|
|
|
+ int userId = ValidationUtil.checkAndAssignInt(map.get("userId"));
|
|
|
+ //只有管理员,省分行业务主管部门,省分行法律部才有权限可以查看
|
|
|
+ userAuthoricationService.checkUserAuthority(userId, Role.ADMIN,Role.BUSINESS_CHIEF_DEP_OF_PBB,Role.LAW_DEP_OF_PBB);
|
|
|
+ int page = ValidationUtil.checkMinAndAssignInt(map.get("page"),1);
|
|
|
+ //这里的businessId是必查条件,所以不能默认为null,应该强制转换成int类型
|
|
|
+ Integer businessId = ValidationUtil.checkAndAssignInt(map.get("businessId"));
|
|
|
+ Map<String, Object> mapToService = new LinkedHashMap<String, Object>();
|
|
|
+ mapToService.put("startPage", (page - 1) * ROW_NUM);
|
|
|
+ mapToService.put("businessId", businessId);
|
|
|
+ mapToService.put("rowNum", ROW_NUM); // 默认每页显示数据是10条,可根据需求修改分页数量
|
|
|
+ PageDTO pageDto=contractManagementService.queryContractRecord(mapToService);
|
|
|
+ return JSONUtil.getJsonMap(200, true, HintMSG.QUERY_SUCCESS, pageDto);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return JSONUtil.getJsonMap(500, false, HintMSG.QUERY_FAIL+":"+e.getMessage(), null);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|