| | |
| | |
|
| | | import com.fgkj.dao.DAOHelper;
|
| | | import com.fgkj.dao.UinfDaoFactory;
|
| | | import com.fgkj.dto.BattInf;
|
| | | import com.fgkj.dto.BattMap_information;
|
| | | import com.fgkj.dto.ImageSize;
|
| | | import com.fgkj.dto.MyFile;
|
| | | import com.fgkj.dto.ServiceModel;
|
| | |
| | | }
|
| | |
|
| | | //上传机房视频接口
|
| | | public String uploadStationFile(){
|
| | | /*public String uploadStationFile(){
|
| | | BattInf binf = getGson().fromJson(json, BattInf.class);
|
| | | String fileRoot = "stationsrc";
|
| | | ServiceModel model = new ServiceModel();
|
| | |
| | | result = tojson(model);
|
| | | return SUCCESS;
|
| | | }
|
| | | |
| | | */
|
| | | /**
|
| | | *
|
| | | * 获取指定机房得资源
|
| | | */
|
| | | public String searchStationSource(){
|
| | | /*public String searchStationSource(){
|
| | | String fileRoot = "stationsrc"; //存放机房资源文件的文件夹
|
| | | BattInf binf = getGson().fromJson(json, BattInf.class);
|
| | | ServiceModel model = new ServiceModel();
|
| | |
| | | }
|
| | | result = tojson(model);
|
| | | return SUCCESS;
|
| | | }
|
| | | }*/
|
| | |
|
| | | //将文件复制到指定的目录
|
| | | public static void copyFile(File oldFile, String newPath){
|
| | |
| | | }
|
| | |
|
| | | //上传机房视频接口(手机端)
|
| | | public String uploadStationFile_mobile(){
|
| | | /*public String uploadStationFile_mobile(){
|
| | | BattInf binf = getGson().fromJson(json, BattInf.class);
|
| | | String fileRoot = "stationsrc";
|
| | | ServiceModel model = new ServiceModel();
|
| | |
| | | }
|
| | | result = tojson(model);
|
| | | return SUCCESS;
|
| | | }
|
| | | }*/
|
| | | //将获取到得图片加水印
|
| | | public static void GraphicsFile(Object obj, File file,String newImagePath) {
|
| | | /*public static void GraphicsFile(Object obj, File file,String newImagePath) {
|
| | | //InputStream is = null;
|
| | | OutputStream os = null;
|
| | | BattMap_information binfmation=(BattMap_information) obj;
|
| | |
| | | g.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
| | | g.drawImage(srcImg.getScaledInstance(srcImg.getWidth(null), srcImg.getHeight(null), java.awt.Image.SCALE_SMOOTH), 0, 0, null);
|
| | | // 4、设置水印旋转
|
| | | /*if (null != degree) {
|
| | | if (null != degree) {
|
| | | //System.out.println("buffImg.getWidth():"+buffImg.getWidth()+" buffImg.getHeight():"+buffImg.getHeight());
|
| | | g.rotate(Math.toRadians(degree), buffImg.getWidth()/10,buffImg.getHeight() /10);
|
| | | }*/
|
| | | }
|
| | | // 5、设置水印文字颜色
|
| | | g.setColor(new Color(255,0,0));//默认红色
|
| | | int font_size= buffImg.getHeight() /35;
|
| | |
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | /* try {
|
| | | try {
|
| | | if (null != is)
|
| | | is.close();
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }*/
|
| | | }
|
| | | try {
|
| | | if (null != os)
|
| | | os.close();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | }*/
|
| | | //计算水印文本长度
|
| | | //1、中文长度即文本长度 2、英文长度为文本长度二分之一
|
| | | public static int getTextLength(String text){
|
| | |
| | | File file = new File(filePath);
|
| | | System.out.println(ActionUtil.tojson(file));*/
|
| | | //GraphicsFile("我是鲁星伟","D:\\1.jpg","D:\\2.jpg",0,new Color(255,0,0),"JPG");
|
| | | BattMap_information binfmation=new BattMap_information();
|
| | | /*BattMap_information binfmation=new BattMap_information();
|
| | | binfmation.setStationId("42000001");
|
| | | binfmation.setStationName("广西省-百色-GX百色乐业县立新小区WF-BTS设备");
|
| | | binfmation.setAddress("百色市乐业县立新小区附近居民楼上");
|
| | |
| | | File file=new File("D:\\1.jpg");
|
| | | String filePath = "D:\\2.jpg";
|
| | | //String filename="2.jpg";
|
| | | GraphicsFile(binfmation,file,filePath);
|
| | | GraphicsFile(binfmation,file,filePath);*/
|
| | | }
|
| | | }
|