|
|
@@ -2,18 +2,30 @@ package com.onemap.api.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.onemap.api.domain.TSysOpenUser;
|
|
|
+import com.onemap.api.domain.tCgglRevise;
|
|
|
+import com.onemap.api.mapper.TCgglReviseMapper;
|
|
|
+import com.onemap.api.mapper.TSysOpenUserMapper;
|
|
|
import com.onemap.api.service.ResultSearchService;
|
|
|
import com.onemap.api.util.Md5Utils;
|
|
|
import com.onemap.api.util.RInterfaceUtil;
|
|
|
import com.onemap.common.core.utils.StringUtils;
|
|
|
import com.onemap.common.core.web.domain.RequestResult;
|
|
|
+import com.onemap.common.security.utils.SecurityUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.File;
|
|
|
+import java.io.IOException;
|
|
|
+import java.nio.file.Paths;
|
|
|
import java.util.*;
|
|
|
|
|
|
import static com.onemap.api.util.utils.getPlanType;
|
|
|
+import static com.onemap.api.util.utils.makedir;
|
|
|
|
|
|
|
|
|
@Service
|
|
|
@@ -37,6 +49,12 @@ public class ResultSearchServiceImpl implements ResultSearchService {
|
|
|
private String landGetRevisePageURI;
|
|
|
@Value("${Cggl.reuploadThirdpartyRevise}")
|
|
|
private String reuploadThirdpartyReviseURI;
|
|
|
+ @Value("${Cggl.temp}")
|
|
|
+ private String tempfolder;
|
|
|
+ @Autowired
|
|
|
+ private TSysOpenUserMapper tSysOpenUserMapper;
|
|
|
+ @Autowired
|
|
|
+ private TCgglReviseMapper tCgglReviseMapper;
|
|
|
|
|
|
@Override
|
|
|
public RequestResult getyb(String ghlx, Integer current, Integer size, String divisionCode, String subject) {
|
|
|
@@ -61,6 +79,8 @@ public class ResultSearchServiceImpl implements ResultSearchService {
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(divisionCode)) {
|
|
|
jsonObject.put("divisionCode", divisionCode);
|
|
|
+ } else {
|
|
|
+ jsonObject.put("divisionCode", getOpenUserXzqdm());
|
|
|
}
|
|
|
JSONObject res = getRequestData(landMyAttendsDataURI, jsonObject);
|
|
|
return changeResultObject(res, ghlx, null, null);
|
|
|
@@ -89,6 +109,8 @@ public class ResultSearchServiceImpl implements ResultSearchService {
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(divisionCode)) {
|
|
|
jsonObject.put("divisionCode", divisionCode);
|
|
|
+ } else {
|
|
|
+ jsonObject.put("divisionCode", getOpenUserXzqdm());
|
|
|
}
|
|
|
JSONObject res = getRequestData(landGetAllTasksURI, jsonObject);
|
|
|
return changeResultObject(res, ghlx, null, null);
|
|
|
@@ -113,11 +135,62 @@ public class ResultSearchServiceImpl implements ResultSearchService {
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(divisionCode)) {
|
|
|
jsonObject.put("divisionCode", divisionCode);
|
|
|
+ } else {
|
|
|
+ jsonObject.put("divisionCode", getOpenUserXzqdm());
|
|
|
}
|
|
|
JSONObject res = getRequestData(landGetRevisePageURI, jsonObject);
|
|
|
return changeResultObject(res, "村庄规划", null, null);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public RequestResult reuploadThirdpartyRevise(String id, String instid, MultipartFile file, String title) {
|
|
|
+ //TODO wanger 存储修编申请 旗县上报到市级 市级负责将修编申请上报到自治区
|
|
|
+ if (StringUtils.isEmpty(id)) {
|
|
|
+ return RequestResult.error("id参数不允许为空!");
|
|
|
+ } else if (StringUtils.isEmpty(instid)) {
|
|
|
+ return RequestResult.error("instid参数不允许为空!");
|
|
|
+ } else if (StringUtils.isEmpty(title)) {
|
|
|
+ return RequestResult.error("title参数不允许为空!");
|
|
|
+ }
|
|
|
+ TSysOpenUser user = getOpenUser();
|
|
|
+ if (user == null) {
|
|
|
+ return RequestResult.error("用户信息获取失败!");
|
|
|
+ }
|
|
|
+ QueryWrapper<tCgglRevise> wrapper = new QueryWrapper();
|
|
|
+ wrapper.eq("instid", instid);
|
|
|
+ wrapper.eq("shzt", "0");
|
|
|
+ List<tCgglRevise> tCgglReviseList = tCgglReviseMapper.selectList(wrapper);
|
|
|
+ if (tCgglReviseList.size() > 0) {
|
|
|
+ return RequestResult.error("该流程主键已存在修编申请,请勿重复提交!");
|
|
|
+ }
|
|
|
+ String filepath = "";
|
|
|
+ if (file != null) {
|
|
|
+ String folder = String.format("%s旗县修编申请\\%s\\%s\\", tempfolder, user.getXzqmc(), title);
|
|
|
+ makedir(folder);
|
|
|
+ filepath = folder + "" + file.getOriginalFilename();
|
|
|
+ try {
|
|
|
+ file.transferTo(Paths.get(filepath));
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tCgglRevise dto = new tCgglRevise();
|
|
|
+ dto.setId(id);
|
|
|
+ dto.setInstid(instid);
|
|
|
+ dto.setName(title);
|
|
|
+ dto.setPath(filepath);
|
|
|
+ dto.setUploadtime(new Date());
|
|
|
+ dto.setXzqdm(user.getXzqdm());
|
|
|
+ dto.setXzqmc(user.getXzqmc());
|
|
|
+ dto.setShzt("0");
|
|
|
+// dto.setShyh("");
|
|
|
+// dto.setShsj(new Date());
|
|
|
+// dto.setPlantype("村庄规划");
|
|
|
+// dto.setRemark("");
|
|
|
+ tCgglReviseMapper.insert(dto);
|
|
|
+ return RequestResult.success("操作成功!");
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public RequestResult getybspjl(String id, String instid) {
|
|
|
if (StringUtils.isEmpty(id) || StringUtils.isEmpty(instid)) {
|
|
|
@@ -274,4 +347,28 @@ public class ResultSearchServiceImpl implements ResultSearchService {
|
|
|
}
|
|
|
return token;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过当前登录用户token获取openuser表信息
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public TSysOpenUser getOpenUser() {
|
|
|
+ String username = SecurityUtils.getUsername();
|
|
|
+ QueryWrapper<TSysOpenUser> openUserWrapper = new QueryWrapper<>();
|
|
|
+ openUserWrapper.eq("name", username);
|
|
|
+ openUserWrapper.last(" and rownum = 1");
|
|
|
+ TSysOpenUser user = tSysOpenUserMapper.selectOne(openUserWrapper);
|
|
|
+ return user;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过当前登录用户token获取openuser的行政区代码
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getOpenUserXzqdm() {
|
|
|
+ TSysOpenUser user = getOpenUser();
|
|
|
+ return user.getXzqdm();
|
|
|
+ }
|
|
|
}
|