|
|
@@ -143,30 +143,34 @@ public class OrgInfoController {
|
|
143
|
143
|
* @throws JsonParseException
|
|
144
|
144
|
* @throws JsonMappingException
|
|
145
|
145
|
* @throws IOException
|
|
|
146
|
+ * dwdm 是单位的统一社会信用代码
|
|
146
|
147
|
*/
|
|
147
|
148
|
@RequestMapping(value="/save")
|
|
148
|
|
- public Map<String, Object> save(String orgInfoJson) throws JsonParseException, JsonMappingException, IOException {
|
|
|
149
|
+ public Map<String, Object> save(String orgInfoJson,String dwdm) throws JsonParseException, JsonMappingException, IOException {
|
|
149
|
150
|
Map<String, Object> modelMap = new HashMap<>();
|
|
150
|
151
|
// JSON字符串转对象
|
|
151
|
152
|
ObjectMapper mapper = new ObjectMapper();
|
|
152
|
153
|
OrgInfo orgInfo = (OrgInfo)mapper.readValue(orgInfoJson, OrgInfo.class);
|
|
|
154
|
+
|
|
153
|
155
|
if (orgInfo.getOrgId() == null) {
|
|
154
|
|
- if(!ObjectUtils.toString(orgInfo.getBirdsEye()).isEmpty()) {
|
|
155
|
|
- String path = uploadPath+orgInfo.getBirdsEye();
|
|
156
|
|
- byte[] file2byte = FileUtil.file2byte(path);
|
|
157
|
|
- String hexString = FileUtil.toHexString(file2byte);
|
|
158
|
|
- orgInfo.setWjl(hexString);
|
|
159
|
|
- }
|
|
|
156
|
+
|
|
160
|
157
|
/* 保存数据 */
|
|
161
|
158
|
orgInfoService.add(orgInfo);
|
|
162
|
159
|
|
|
163
|
|
- /* 生成库区标准编码 */
|
|
164
|
|
- String zzdm = orgInfo.getCreditCode();
|
|
165
|
|
- if ("".equals(zzdm)) {
|
|
166
|
|
- zzdm = orgInfo.getCompanyOrgCode();
|
|
|
160
|
+ /**
|
|
|
161
|
+ * 库区代码
|
|
|
162
|
+ * 库区代码 单位代码+3位库区顺序码
|
|
|
163
|
+ */
|
|
|
164
|
+ if(null != dwdm){
|
|
|
165
|
+ String kqbm = dwdm.concat(orgInfo.getOrgCode());
|
|
|
166
|
+ orgInfo.setKqbm(kqbm);
|
|
|
167
|
+ orgInfoService.updateSelective(orgInfo);
|
|
167
|
168
|
}
|
|
168
|
|
-// orgInfo.setKqbm(BusinessUtils.setBZkqbm(zzdm, orgInfo.getOrgId()));
|
|
169
|
|
-// orgInfoService.updateSelective(orgInfo);
|
|
|
169
|
+
|
|
|
170
|
+
|
|
|
171
|
+
|
|
|
172
|
+ /*orgInfo.setKqbm(BusinessUtils.setBZkqbm(zzdm, orgInfo.getOrgId()));
|
|
|
173
|
+ orgInfoService.updateSelective(orgInfo);*/
|
|
170
|
174
|
|
|
171
|
175
|
//默认给新建的机构创建一个系统管理员角色
|
|
172
|
176
|
RoleInfo roleInfo = new RoleInfo();
|
|
|
@@ -183,16 +187,23 @@ public class OrgInfoController {
|
|
183
|
187
|
List<ButtonInfo> buttonList = buttonInfoService.queryByExample(exampleButton);
|
|
184
|
188
|
roleButtonService.saveForList(roleInfo.getRoleId(), buttonList);
|
|
185
|
189
|
} else {
|
|
186
|
|
- if(!ObjectUtils.toString(orgInfo.getBirdsEye()).isEmpty()) {
|
|
187
|
|
- String path = uploadPath+orgInfo.getBirdsEye();
|
|
188
|
|
- byte[] file2byte = FileUtil.file2byte(path);
|
|
|
190
|
+ /*if(!ObjectUtils.toString(orgInfo.getBirdsEye()).isEmpty()) {
|
|
|
191
|
+ byte[] file2byte = FileUtil.file2byte(orgInfo.getBirdsEye());
|
|
189
|
192
|
String hexString = FileUtil.toHexString(file2byte);
|
|
190
|
193
|
orgInfo.setWjl(hexString);
|
|
191
|
|
- }
|
|
|
194
|
+ }*/
|
|
|
195
|
+
|
|
|
196
|
+ if(null != dwdm){
|
|
|
197
|
+ String kqbm = dwdm.concat(orgInfo.getOrgCode());
|
|
|
198
|
+ orgInfo.setKqbm(kqbm);
|
|
|
199
|
+ orgInfoService.updateSelective(orgInfo);
|
|
|
200
|
+ }
|
|
|
201
|
+
|
|
|
202
|
+
|
|
192
|
203
|
// orgInfo.setKqbm(BusinessUtils.setBZkqbm(orgInfo.getCreditCode(), orgInfo.getOrgId()));
|
|
193
|
204
|
// orgInfoService.update(orgInfo);
|
|
194
|
205
|
}
|
|
195
|
|
- if(orgInfo.getParentId() != 0) {//排除顶级机构
|
|
|
206
|
+ /*if(orgInfo.getParentId() != 0) {//排除顶级机构
|
|
196
|
207
|
//查询父机构id以及层级
|
|
197
|
208
|
OrgInfo orgParentInfo = orgInfoService.findById(orgInfo.getParentId());
|
|
198
|
209
|
//查询同级机构已存在的级别后2位
|
|
|
@@ -236,7 +247,7 @@ public class OrgInfoController {
|
|
236
|
247
|
orgInfoService.update(orgInfo);
|
|
237
|
248
|
}
|
|
238
|
249
|
}
|
|
239
|
|
- }
|
|
|
250
|
+ }*/
|
|
240
|
251
|
modelMap.put("status", "success");
|
|
241
|
252
|
modelMap.put("newOrgId", orgInfo.getOrgId());
|
|
242
|
253
|
return modelMap;
|
|
|
@@ -367,5 +378,10 @@ public class OrgInfoController {
|
|
367
|
378
|
return modelMap;
|
|
368
|
379
|
}*/
|
|
369
|
380
|
|
|
|
381
|
+ public static void main(String[] args) {
|
|
|
382
|
+ String a = "中国";
|
|
|
383
|
+ System.out.println(a.length());
|
|
|
384
|
+
|
|
|
385
|
+ }
|
|
370
|
386
|
|
|
371
|
387
|
}
|