Explorar el Código

已审批合同查看中因审批人丢失导致数据加载异常问题修复

fanxw hace 2 años
padre
commit
5407130383

+ 11 - 7
src/main/java/com/chinaitop/depot/act/service/ActTaskService.java

@@ -323,13 +323,17 @@ public class ActTaskService {
323 323
 				HistoryList historyList=new HistoryList();
324 324
 				historyList.setAssigneeName(actList.get(j).getHistIns().getAssignee());//审批人名字
325 325
 				
326
-				UserInfo userInfo = userInfoService.findById( Integer.valueOf(actList.get(j).getHistIns().getAssignee()));
327
-				Integer orgId = userInfo.getOrgId();
328
-				
329
-				OrgInfo orgInfo=orgInfoService.findById(orgId);
330
-				String departmentName=orgInfo.getOrgName();
331
-				historyList.setDepartment(departmentName);
332
-				
326
+				Integer userid = Integer.valueOf(actList.get(j).getHistIns().getAssignee());
327
+				if (null != userid) {
328
+					UserInfo userInfo = userInfoService.findById(userid);
329
+					if (null != userInfo) {
330
+						Integer orgId = userInfo.getOrgId();
331
+						OrgInfo orgInfo=orgInfoService.findById(orgId);
332
+						String departmentName=orgInfo.getOrgName();
333
+						historyList.setDepartment(departmentName);
334
+					}
335
+				}
336
+
333 337
 				historyList.setComment(actList.get(j).getComment());//审批意见
334 338
 				historyList.setStartTime(actList.get(j).getHistIns().getStartTime());//开始时间
335 339
 				historyList.setEndDate(actList.get(j).getHistIns().getEndTime());//结束时间

+ 29 - 27
src/main/java/com/chinaitop/depot/business/service/impl/ReceiveNoticeServiceImpl.java

@@ -1,5 +1,18 @@
1 1
 package com.chinaitop.depot.business.service.impl;
2 2
 
3
+import java.text.SimpleDateFormat;
4
+import java.util.Date;
5
+import java.util.HashMap;
6
+import java.util.List;
7
+import java.util.Map;
8
+
9
+import javax.annotation.Resource;
10
+
11
+import org.apache.commons.lang.ObjectUtils;
12
+import org.apache.commons.lang.StringUtils;
13
+import org.springframework.beans.factory.annotation.Value;
14
+import org.springframework.stereotype.Service;
15
+
3 16
 import com.alibaba.fastjson.JSONObject;
4 17
 import com.chinaitop.depot.business.mapper.BusinessNoticeReceiveMapper;
5 18
 import com.chinaitop.depot.business.model.BusinessNoticeReceive;
@@ -9,19 +22,6 @@ import com.chinaitop.depot.business.service.FeignAgileService;
9 22
 import com.chinaitop.depot.business.service.FeignBasicService;
10 23
 import com.chinaitop.depot.business.service.ReceiveNoticeService;
11 24
 import com.github.pagehelper.PageHelper;
12
-import org.apache.commons.lang.ObjectUtils;
13
-import org.apache.commons.lang.StringUtils;
14
-import org.springframework.beans.factory.annotation.Value;
15
-import org.springframework.stereotype.Service;
16
-
17
-import javax.annotation.Resource;
18
-import java.math.BigDecimal;
19
-
20
-import java.text.SimpleDateFormat;
21
-import java.util.Date;
22
-import java.util.HashMap;
23
-import java.util.List;
24
-import java.util.Map;
25 25
 
26 26
 @Service
27 27
 public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
@@ -191,6 +191,7 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
191 191
                             Integer grainDetailKind = (Integer) map.get("mxpz"); //明细品种
192 192
                             Integer grainGrade = (Integer) map.get("dj"); //等级
193 193
                             String inputTime = map.get("rq")+""; //入库时间
194
+                            Integer scnf = Integer.parseInt(map.get("scnf")+"");
194 195
                             Date date = null;
195 196
                             if(inputTime!=null){
196 197
                                 //String year=String.format("%tY", inputTime);
@@ -198,16 +199,18 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
198 199
                                 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
199 200
                                 date = sdf.parse(inputTime);
200 201
                                 // 获取String字符串中的年
201
-                                SimpleDateFormat y = new SimpleDateFormat("yyyy");
202
-                                System.out.println(y.format(date));
203
-                                String enumName = y.format(date);
204
-
205
-                                Integer parentId = 1004;
206
-                                Map<String, Object> basicMap = feignBasicService.getIdByNameAndParentId(parentId, enumName, null);//1004是生产年份的父ID
207
-                                Integer productiveYear = (Integer) basicMap.get("enumId");
208
-                                businessNoticeReceive.setProductiveYear(productiveYear);//生产年份
209
-                                businessNoticeReceive.setGrainAnnual(productiveYear);//收获年度
202
+                                //SimpleDateFormat y = new SimpleDateFormat("yyyy");
203
+                                //System.out.println(y.format(date));
204
+                                //String enumName = y.format(date);
205
+
206
+                                //Integer parentId = 1004;
207
+                                //Map<String, Object> basicMap = feignBasicService.getIdByNameAndParentId(parentId, enumName, null);//1004是生产年份的父ID
208
+                                //Integer productiveYear = (Integer) basicMap.get("enumId");
209
+
210
+                                businessNoticeReceive.setInputTime(date);//入库时间
210 211
                             }
212
+                            businessNoticeReceive.setProductiveYear(scnf);//生产年份
213
+                            businessNoticeReceive.setGrainAnnual(scnf);//收获年度
211 214
 
212 215
                             Integer grainProducingArea = (Integer) map.get("gb"); //产地
213 216
 
@@ -215,15 +218,14 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
215 218
                             businessNoticeReceive.setGrainDetailKind(grainDetailKind); //明细品种
216 219
                             businessNoticeReceive.setGrainGrade(grainGrade); //等级
217 220
                             businessNoticeReceive.setGrainAttribute(grainAttribute); //粮油性质
218
-                            businessNoticeReceive.setInputTime(date);//入库时间
219 221
                             businessNoticeReceive.setGrainProducingArea(grainProducingArea);//产地
220 222
 
221 223
                         }
222 224
                         String  lsyqsl = jsonObject.getString("lsyqsl");
223
-                        BigDecimal s = new BigDecimal(1000);
224
-                        BigDecimal sumjhsl = new BigDecimal(lsyqsl);
225
-                        BigDecimal sumCkslss = sumjhsl.multiply(s);
226
-                        String count = sumCkslss.toString(); //吨转化为公斤
225
+//                        BigDecimal s = new BigDecimal(1000);
226
+//                        BigDecimal sumjhsl = new BigDecimal(lsyqsl);
227
+//                        BigDecimal sumCkslss = sumjhsl.multiply(s);
228
+                        //String count = sumCkslss.toString(); //吨转化为公斤
227 229
 
228 230
                         businessNoticeReceive.setCount(lsyqsl); //计划数量(吨)
229 231
                         businessNoticeReceive.setOutgoingPeriod(jsonObject.getString("ckqx")); //出库期限(日期格式)

+ 9 - 7
src/main/java/com/chinaitop/depot/business/service/impl/UserInfoServiceImpl.java

@@ -59,14 +59,16 @@ public class UserInfoServiceImpl implements UserInfoService {
59 59
 	public UserInfo findById(Integer userId) {
60 60
 		// TODO Auto-generated method stub
61 61
 		UserInfo userInfo =  UserInfoMapper.selectByPrimaryKey(userId);
62
-		UserRoleExample example = new UserRoleExample();
63
-		example.createCriteria().andUserIdEqualTo(userInfo.getUserId());
64
-		List<UserRole> urList = userRoleMapper.selectByExample(example);
65
-		List<String> roleIds = new ArrayList<>();
66
-		for (UserRole userRole : urList) {
67
-			roleIds.add(String.valueOf(userRole.getRoleId()));
62
+		if (null != userInfo) {
63
+			UserRoleExample example = new UserRoleExample();
64
+			example.createCriteria().andUserIdEqualTo(userInfo.getUserId());
65
+			List<UserRole> urList = userRoleMapper.selectByExample(example);
66
+			List<String> roleIds = new ArrayList<>();
67
+			for (UserRole userRole : urList) {
68
+				roleIds.add(String.valueOf(userRole.getRoleId()));
69
+			}
70
+			userInfo.setRoleIds(roleIds);
68 71
 		}
69
-		userInfo.setRoleIds(roleIds);
70 72
 		return userInfo;
71 73
 	}
72 74