Просмотр исходного кода

Merge branch 'test' of jishutao/kede-server into prod

anderx лет назад: 3
Родитель
Сommit
e6dca04b4e

+ 2 - 1
src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java

@@ -5,6 +5,7 @@ import java.util.*;
 import javax.annotation.Resource;
 
 import com.goafanti.admin.service.DepartmentService;
+import com.goafanti.admin.service.NewAdminService;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.Department;
@@ -53,7 +54,7 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 	@Resource(name = "passwordUtil")
 	private PasswordUtil					passwordUtil;
 	@Autowired
-	private NewAdminServiceImpl newAdminService;
+	private NewAdminService newAdminService;
 
 	@Autowired
 	private RedisUtil	redisUtil;

+ 68 - 68
src/main/java/com/goafanti/ambSystem/controller/AmbPaymentApiController.java

@@ -28,73 +28,73 @@ public class AmbPaymentApiController extends CertifyApiController {
 	 * @param bindingResult
 	 * @return
 	 */
-	@RequestMapping(value="/add",method = RequestMethod.POST)
-	public Result addAmb(@Validated InputAmbPayment in, BindingResult bindingResult){
-		Result res =new Result();
-		if (bindingResult.hasErrors()) {
-			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
-					ParamUtils.getParamName(in,bindingResult.getFieldError().getField())));
-			return res;
-		}
-		int i=ambPaymentService.checkAmbPayment(in);
-		if (i==-1){
-			res.getError().add(buildError(String.format("[%s]已存在,请确认后再新增",in.getName())));
-			return res;
-		}
-		res.data(ambService.addAmb(in));
-		return res;
-	}
-
-	@RequestMapping(value="/update",method = RequestMethod.POST)
-	public Result updateAmb( InputAmb in){
-		Result res =new Result();
-		if (in.getId()==null){
-			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"巴编号"));
-			return res;
-		}
-		res.data(ambService.updateAmb(in));
-		return res;
-	}
-
-	@RequestMapping(value="/delete",method = RequestMethod.POST)
-	public Result deleteAmb( InputAmb in){
-		Result res =new Result();
-		if (in.getId()==null){
-			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"巴编号"));
-			return res;
-		}
-		int i=ambService.checkAmb(in,2);
-		if (i==-1){
-			res.getError().add(buildError("巴存在子项目,请先删除所有子项"));
-			return res;
-		}
-		res.data(ambService.deleteAmb(in));
-		return res;
-	}
-
-	@RequestMapping(value="/details",method = RequestMethod.GET)
-	public Result detailsAmb( InputAmb in){
-		Result res =new Result();
-		if (in.getId()==null){
-			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"巴编号"));
-			return res;
-		}
-		res.data(ambService.detailsAmb(in));
-		return res;
-	}
-
-	@RequestMapping(value="/select",method = RequestMethod.GET)
-	public Result selectAmb( InputAmb in){
-		Result res =new Result();
-		res.data(ambService.selectAmb(in));
-		return res;
-	}
-
-	@RequestMapping(value="/selectAll",method = RequestMethod.GET)
-	public Result selectAll( ){
-		Result res =new Result();
-		res.data(ambService.selectAll());
-		return res;
-	}
+//	@RequestMapping(value="/add",method = RequestMethod.POST)
+//	public Result addAmb(@Validated InputAmbPayment in, BindingResult bindingResult){
+//		Result res =new Result();
+//		if (bindingResult.hasErrors()) {
+//			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+//					ParamUtils.getParamName(in,bindingResult.getFieldError().getField())));
+//			return res;
+//		}
+//		int i=ambPaymentService.checkAmbPayment(in);
+//		if (i==-1){
+//			res.getError().add(buildError(String.format("[%s]已存在,请确认后再新增",in.getName())));
+//			return res;
+//		}
+//		res.data(ambService.addAmb(in));
+//		return res;
+//	}
+//
+//	@RequestMapping(value="/update",method = RequestMethod.POST)
+//	public Result updateAmb( InputAmb in){
+//		Result res =new Result();
+//		if (in.getId()==null){
+//			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"巴编号"));
+//			return res;
+//		}
+//		res.data(ambService.updateAmb(in));
+//		return res;
+//	}
+//
+//	@RequestMapping(value="/delete",method = RequestMethod.POST)
+//	public Result deleteAmb( InputAmb in){
+//		Result res =new Result();
+//		if (in.getId()==null){
+//			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"巴编号"));
+//			return res;
+//		}
+//		int i=ambService.checkAmb(in,2);
+//		if (i==-1){
+//			res.getError().add(buildError("巴存在子项目,请先删除所有子项"));
+//			return res;
+//		}
+//		res.data(ambService.deleteAmb(in));
+//		return res;
+//	}
+//
+//	@RequestMapping(value="/details",method = RequestMethod.GET)
+//	public Result detailsAmb( InputAmb in){
+//		Result res =new Result();
+//		if (in.getId()==null){
+//			res.getError().add(buildErrorMessageParams(ErrorConstants.PARAM_EMPTY_ERROR,"巴编号"));
+//			return res;
+//		}
+//		res.data(ambService.detailsAmb(in));
+//		return res;
+//	}
+//
+//	@RequestMapping(value="/select",method = RequestMethod.GET)
+//	public Result selectAmb( InputAmb in){
+//		Result res =new Result();
+//		res.data(ambService.selectAmb(in));
+//		return res;
+//	}
+//
+//	@RequestMapping(value="/selectAll",method = RequestMethod.GET)
+//	public Result selectAll( ){
+//		Result res =new Result();
+//		res.data(ambService.selectAll());
+//		return res;
+//	}
 
 }

+ 224 - 0
src/main/java/com/goafanti/common/controller/TestPublicController.java

@@ -0,0 +1,224 @@
+package com.goafanti.common.controller;
+
+import com.goafanti.admin.service.AdminService;
+import com.goafanti.admin.service.AttachmentService;
+import com.goafanti.common.bo.Error;
+import com.goafanti.common.bo.OutUser;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.dao.TOrderMidMapper;
+import com.goafanti.common.dao.TOrderNewMapper;
+import com.goafanti.common.enums.UserType;
+import com.goafanti.common.error.BusinessException;
+import com.goafanti.common.model.TOrderNew;
+import com.goafanti.common.model.User;
+import com.goafanti.common.service.DistrictGlossoryService;
+import com.goafanti.common.service.IndustryCategoryService;
+import com.goafanti.common.utils.*;
+import com.goafanti.common.utils.excel.FileUtils;
+import com.goafanti.common.utils.excel.NewExcelUtil;
+import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.core.websocket.SystemWebSocketHandler;
+import com.goafanti.fragment.service.FragmentService;
+import com.goafanti.order.service.OrderProjectService;
+import com.goafanti.user.service.UserService;
+import org.apache.commons.collections4.map.HashedMap;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Scope;
+import org.springframework.http.MediaType;
+import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.socket.TextMessage;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.util.*;
+
+@Controller
+@RequestMapping("/open")
+public class TestPublicController extends CertifyApiController {
+
+    @Value(value = "${upload.path}")
+    private String		uploadPath			= null;
+
+    private String		targePath			="F:/data/public/upload/new_order_file/";
+
+    @Autowired
+    private TOrderNewMapper tOrderNewMapper;
+
+
+    private static final Logger logger	= LoggerFactory.getLogger(TestPublicController.class);
+
+    @RequestMapping("/pushOrderList")
+    @Transactional
+    public Result pushOrder() {
+      Result res= new Result();
+        List<TOrderNew> list = tOrderNewMapper.selectgetAll();
+        for (TOrderNew t : list) {
+            if (StringUtils.isNotBlank(t.getContractPictureUrl())||
+                    StringUtils.isNotBlank(t.getAgreementUrl())||
+                    StringUtils.isNotBlank(t.getServiceContent())){
+                TOrderNew neworder=new TOrderNew();
+                neworder.setOrderNo(t.getOrderNo());
+                try {
+                    if (StringUtils.isNotBlank(t.getContractPictureUrl())){
+                        String str= null;
+                        str = moveImg(t.getContractPictureUrl(),t.getOrderNo(),0,uploadPath);
+                        neworder.setContractPictureUrl(str);
+                    }
+                    if (StringUtils.isNotBlank(t.getAgreementUrl())){
+                        String str=moveImg(t.getAgreementUrl(),t.getOrderNo(),1,uploadPath);
+                        neworder.setAgreementUrl(str);
+                    }
+                    if (StringUtils.isNotBlank(t.getServiceContent())){
+                        String str=moveImg(t.getServiceContent(),t.getOrderNo(),2,uploadPath);
+                        neworder.setServiceContent(str);
+                    }
+                } catch (Exception e) {
+                    logger.debug("订单编号["+t.getOrderNo()+"]移动异常..."+e.getLocalizedMessage());
+                    continue;
+                }
+                logger.debug("订单编号["+t.getOrderNo()+"]移动成功\n"+t.getContractPictureUrl()+"\n"+neworder.getContractPictureUrl());
+                tOrderNewMapper.updateByPrimaryKeySelective(neworder);
+            }
+        }
+        return res;
+    }
+
+    @RequestMapping(value = "/pushOrder" ,method = RequestMethod.GET)
+    public Result pushOrder(String orderNo) {
+        Result res= new Result();
+        TOrderNew t = tOrderNewMapper.selectByPrimaryKey(orderNo);
+        TOrderNew neworder=new TOrderNew();
+        neworder.setOrderNo(t.getOrderNo());
+        try {
+            if (StringUtils.isNotBlank(t.getContractPictureUrl())){
+                String str= null;
+                    str = moveImg(t.getContractPictureUrl(),t.getOrderNo(),0,uploadPath);
+                neworder.setContractPictureUrl(str);
+            }
+            if (StringUtils.isNotBlank(t.getAgreementUrl())){
+                String str=moveImg(t.getAgreementUrl(),t.getOrderNo(),1,uploadPath);
+                neworder.setAgreementUrl(str);
+            }
+            if (StringUtils.isNotBlank(t.getServiceContent())){
+                String str=moveImg(t.getServiceContent(),t.getOrderNo(),2,uploadPath);
+                neworder.setServiceContent(str);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        tOrderNewMapper.updateByPrimaryKeySelective(neworder);
+        return res;
+    }
+
+
+
+    /**
+
+     * @param i 0订单合同
+     * @param uploadPath
+     * @return
+     */
+
+    private static String moveImg(String attURL ,String orderNo,Integer i,String uploadPath) throws Exception {
+        StringBuffer str =new StringBuffer();
+        String[] split = attURL.split(",");
+        for (String s : split) {
+            String url="";
+            if (s.contains("/")){
+                url=s.substring(s.lastIndexOf("/"));
+            }else {
+                url=s.substring(s.lastIndexOf("\\"));
+            }
+            String newURL="";
+            String frontName="/new_order_file/";
+            String rearName="";
+            if (i==0){
+                rearName="/contract";
+            }else if (i==1){
+                rearName="/agreement";
+
+            }else if (i==2){
+                rearName="/content";
+            }
+            newURL=frontName+orderNo+rearName;
+            moveFile(s, newURL,uploadPath,url);
+            str.append(newURL+url).append(",");
+        }
+        return str.substring(0,str.length()-1);
+    }
+
+
+
+    /**
+     *
+     * @param useURL 旧地址
+     * @param newURL 新地址
+     */
+    private static int moveFile(String useURL, String newURL,String uploadPath,String url) throws Exception {
+        String targePath=uploadPath+newURL;
+        useURL=uploadPath+useURL;
+        String targeUrl=targePath+url;
+        //目标文件夹路径(没有会自动创建)
+        File targetFile = new File(targePath);
+        File srcFile = new File(useURL);
+        if (!srcFile.exists()){
+            throw new BusinessException("文件不存在");
+        }
+        File destFile = new File(targeUrl);
+        //创建文件件
+        createFile(targetFile);
+        //复制文件
+        copyFile(srcFile,destFile);
+        //新地址有则删除旧数据删除源文件
+        if (destFile.exists()){
+            srcFile.delete();
+        }
+        return 1;
+    }
+
+    private static void createFile(File file) {
+        if (file.exists()) {
+        } else {
+            if (!file.exists()) {
+                //创建上级目录
+                file.mkdirs();
+            }
+        }
+    }
+
+    private static void copyFile(File srcFile,File destFile) throws IOException {
+        //该方法为复制文件,srcFile是原文件所在地址,destFile是目标文件所在地址
+
+        File[] fileArray1 = srcFile.listFiles();
+        File[] fileArray2 = destFile.listFiles();
+
+        BufferedInputStream bis = new BufferedInputStream(new FileInputStream(srcFile));
+        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(destFile));
+        byte[] bys = new byte[1024];
+        int len = 0;
+        while ((len = bis.read(bys)) != -1)
+        {
+            bos.write(bys, 0, len);
+        }
+        bos.close();
+        bis.close();
+    }
+}

+ 2 - 0
src/main/java/com/goafanti/common/dao/TOrderNewMapper.java

@@ -67,4 +67,6 @@ public interface TOrderNewMapper {
      */
     int updateExamineName(@Param("type")Integer type, @Param("depId")String depId, @Param("aid")String aid,
                           @Param("names")String names);
+
+    List<TOrderNew> selectgetAll();
 }

+ 6 - 2
src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml

@@ -1941,6 +1941,7 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
     where order_no = (select t_order_task.order_no from t_order_task where id=#{tid})
   </select>
 
+
   <update id="updateExamineName">
     update  t_order_new a
     <if test="names==null">
@@ -1959,8 +1960,11 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
         and a.order_dep = #{depId}
       </if>
     </if>
+    </update>
 
-
-  </update>
+  <select id="selectgetAll" resultType="com.goafanti.common.model.TOrderNew">
+    select order_no orderNo,contract_picture_url contractPictureUrl ,agreement_url agreementUrl ,service_content serviceContent
+    from t_order_new
+  </select>
 
 </mapper>

+ 34 - 14
src/main/java/com/goafanti/common/utils/excel/FileUtils.java

@@ -1,11 +1,6 @@
 package com.goafanti.common.utils.excel;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
+import java.io.*;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 import javax.servlet.http.HttpServletRequest;
@@ -16,13 +11,13 @@ import com.goafanti.common.utils.StringUtils;
 
 /**
  * 文件处理工具类
- * 
+ *
  * @author ruoyi
  */
 public class FileUtils extends org.apache.commons.io.FileUtils
 {
     public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";
-    
+
     public static final String[] DEFAULT_ALLOWED_EXTENSION = {
             // 图片
             "bmp", "gif", "jpg", "jpeg", "png",
@@ -35,7 +30,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils
 
     /**
      * 输出指定文件的byte数组
-     * 
+     *
      * @param filePath 文件路径
      * @param os 输出流
      * @return
@@ -91,7 +86,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils
 
     /**
      * 删除文件
-     * 
+     *
      * @param filePath 文件
      * @return
      */
@@ -108,9 +103,34 @@ public class FileUtils extends org.apache.commons.io.FileUtils
         return flag;
     }
 
+
+    /**
+     * 复制文件
+     * @param srcFile 源文件
+     * @param destFile 目标文件
+     * @throws IOException
+     */
+    public static void copyFile(File srcFile,File destFile) throws IOException {
+        //该方法为复制文件,srcFile是原文件所在地址,destFile是目标文件所在地址
+
+        File[] fileArray1 = srcFile.listFiles();
+        File[] fileArray2 = destFile.listFiles();
+
+        BufferedInputStream bis = new BufferedInputStream(new FileInputStream(srcFile));
+        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(destFile));
+        byte[] bys = new byte[1024];
+        int len = 0;
+        while ((len = bis.read(bys)) != -1)
+        {
+            bos.write(bys, 0, len);
+        }
+        bos.close();
+        bis.close();
+    }
+
     /**
      * 文件名称验证
-     * 
+     *
      * @param filename 文件名称
      * @return true 正常 false 非法
      */
@@ -121,7 +141,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils
 
     /**
      * 检查文件是否可下载
-     * 
+     *
      * @param resource 需要下载的文件
      * @return true 正常 false 非法
      */
@@ -145,7 +165,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils
 
     /**
      * 下载文件名重新编码
-     * 
+     *
      * @param request 请求对象
      * @param fileName 文件名
      * @return 编码后的文件名
@@ -215,7 +235,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils
         String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString());
         return encode.replaceAll("\\+", "%20");
     }
-    
+
     /**
      * 获取文件类型
      * <p>

+ 9 - 9
src/main/resources/props/config_local.properties

@@ -1,12 +1,12 @@
 dev.name=local
 jdbc.driverClassName=com.mysql.jdbc.Driver
 #jdbc.url=jdbc\:mysql://localhost:3306/aft20220318?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
-#jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
-#jdbc.username=root
-#jdbc.password=123456
-jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+jdbc.url=jdbc\:mysql://localhost:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 jdbc.username=root
-jdbc.password=aftdev
+jdbc.password=123456
+#jdbc.url=jdbc:mysql://101.37.32.31:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+#jdbc.username=root
+#jdbc.password=aftdev
 jdbc.validationQuery=SELECT 'x'
 jdbc.initialSize=3
 jdbc.maxActive=20
@@ -51,10 +51,10 @@ yxjl_max=100
 
 amb.maxLvl=6
 
-avatar.host=//static.jishutao.com
-static.host=//static.jishutao.com/1.2.53
-#avatar.host=//172.16.0.255:3000
-#static.host=//172.16.0.255:3000/1.2.27
+#avatar.host=//static.jishutao.com
+#static.host=//static.jishutao.com/1.2.53
+avatar.host=//172.16.0.255:3000
+static.host=//172.16.0.255:3000/1.2.53
 #static.host=http://172.16.1.187/prod/1.2.25
 
 wx.appId=wxff2f5720ed7d7f63