|
@@ -15,6 +15,7 @@ import org.activiti.engine.TaskService;
|
|
|
import org.activiti.engine.runtime.ProcessInstance;
|
|
|
import org.activiti.engine.task.Task;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.apache.logging.log4j.util.PropertiesUtil;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.constant.CommonConstant;
|
|
@@ -35,7 +36,10 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.IOException;
|
|
|
+import java.io.InputStreamReader;
|
|
|
+import java.sql.*;
|
|
|
import java.util.*;
|
|
|
+import java.util.Date;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -396,12 +400,24 @@ public class ActBusinessController {
|
|
|
|
|
|
try {
|
|
|
|
|
|
+ String responsibility_company = busiData.get("responsibility_company") == null || busiData.get("responsibility_company") == "" ? "" : busiData.get("responsibility_company").toString();
|
|
|
int isConfirm = busiData.get("is_confirm") == null ? 0 : (Integer) busiData.get("is_confirm");
|
|
|
- if(isConfirm != 1){
|
|
|
- return Result.error("该事故单供应商还未确认,请确认后再次提交");
|
|
|
+ String ticketId = busiData.get("id").toString();
|
|
|
+
|
|
|
+ if(isConfirm != 1 && StringUtils.isNotBlank(responsibility_company)){
|
|
|
+
|
|
|
+ int countNum = sysBaseAPI.getIncidentTicket(ticketId);
|
|
|
+ if(countNum > 0){
|
|
|
+ List<Map<String,String>> countSupplier = getSupplierSrm(responsibility_company);
|
|
|
+ if(countSupplier.size() > 0 ){
|
|
|
+ return Result.error("该事故单供应商还未确认,请确认后再次提交");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
- return Result.error("该事故单供应商还未确认,请确认后再次提交");
|
|
|
+ return Result.error("该事故单供应商还未确认,请刷新后重试");
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1109,4 +1125,91 @@ public class ActBusinessController {
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取固定文件配置信息
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static String getProjectConfigActive(String key){
|
|
|
+ Properties pros = new Properties();
|
|
|
+ String value = "";
|
|
|
+ try {
|
|
|
+ PropertiesUtil.class.getResourceAsStream("/application.yml");
|
|
|
+ pros.load(new InputStreamReader(PropertiesUtil.class.getResourceAsStream("/application.yml"), "UTF-8"));
|
|
|
+ value = pros.getProperty(key);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return e.getMessage();
|
|
|
+ }
|
|
|
+ return value;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<Map<String,String>> getSupplierSrm(String supplierName) {
|
|
|
+ String active = getProjectConfigActive("active");
|
|
|
+ List<Map<String,String>> supplierList = new ArrayList<>();
|
|
|
+
|
|
|
+ String URL="jdbc:sqlserver://192.168.1.253:14330;DatabaseName=srm_prod";
|
|
|
+
|
|
|
+ if(!active.equals("senyu")){
|
|
|
+ URL="jdbc:sqlserver://192.168.5.170:14330;DatabaseName=srm_prod";
|
|
|
+ }
|
|
|
+
|
|
|
+ String USER="sa";
|
|
|
+ String PASSWORD="Windows2008R2";
|
|
|
+ Statement sta=null;
|
|
|
+ Connection con=null;
|
|
|
+ ResultSet rs =null;
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
|
|
|
+ con= DriverManager.getConnection(URL,USER,PASSWORD);
|
|
|
+ sta =con.createStatement();
|
|
|
+
|
|
|
+ String sql="select short_name from bm_supplier where del_flag=0 and short_name='"+supplierName+"'";
|
|
|
+
|
|
|
+ rs =sta.executeQuery(sql);
|
|
|
+ while(rs.next()) {
|
|
|
+ Map<String,String> map = new HashMap<>();
|
|
|
+ String name=rs.getString("short_name");
|
|
|
+ map.put("label",name);
|
|
|
+ map.put("value",name);
|
|
|
+ supplierList.add(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (ClassNotFoundException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (SQLException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ finally {
|
|
|
+ if(rs!=null)
|
|
|
+ try {
|
|
|
+ rs.close();
|
|
|
+ } catch (SQLException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ if(sta!=null)
|
|
|
+ try {
|
|
|
+ sta.close();
|
|
|
+ } catch (SQLException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ if(con!=null)
|
|
|
+ try {
|
|
|
+ con.close();
|
|
|
+ } catch (SQLException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return supplierList;
|
|
|
+
|
|
|
+ }
|
|
|
}
|