Преглед изворни кода

1.获取用户信息的接口
2.文件上传接口

ytf пре 3 година
родитељ
комит
ed46be29db

+ 17 - 1
krock-api/krock-api-all/src/main/java/com/ydw/yunbuyer/api/pm/entity/ProjectItem.java

@@ -24,7 +24,8 @@ public class ProjectItem extends DataModel {
24 24
 	private String archive_status;// 归档状态
25 25
 	private String bid_file_id;// 招标文件id
26 26
 	private String item_status = "未完成 "; // 事件状态 : 未完成 or 已完成
27
-
27
+	private String bidding_agreement_path;// 竞买协议文件路径
28
+	private String bidding_rules_path;// 竞买规则文件路径
28 29
 	/**
29 30
 	 * t_pm_item 复制过来的字段
30 31
 	 */
@@ -386,4 +387,19 @@ public class ProjectItem extends DataModel {
386 387
 		this.seller_bid_success_form_id = seller_bid_success_form_id;
387 388
 	}
388 389
 
390
+	public String getBidding_agreement_path() {
391
+		return bidding_agreement_path;
392
+	}
393
+
394
+	public void setBidding_agreement_path(String bidding_agreement_path) {
395
+		this.bidding_agreement_path = bidding_agreement_path;
396
+	}
397
+
398
+	public String getBidding_rules_path() {
399
+		return bidding_rules_path;
400
+	}
401
+
402
+	public void setBidding_rules_path(String bidding_rules_path) {
403
+		this.bidding_rules_path = bidding_rules_path;
404
+	}
389 405
 }

+ 40 - 3
krock-jcebid-cp/krock-web-cp-all/src/main/java/com/ydw/yunbuyer/web/cp/business/rest/ImgController2.java

@@ -120,7 +120,7 @@ public class ImgController2 extends ProjBaseAction {
120 120
 			//System.out.println(3);
121 121
 			//System.out.println(img);
122 122
 			if ("video/mp4".equals(file.getContent_type())) {
123
-				play(img, req, resp);
123
+				play(img, req, resp,file.getContent_type());
124 124
 			} else {
125 125
 				ImgTools.thumbnail_w_h(img, width, height, (OutputStream)os);
126 126
 			}
@@ -130,7 +130,44 @@ public class ImgController2 extends ProjBaseAction {
130 130
 			os.close();
131 131
 		}
132 132
 	}
133
-	public void play(File file, HttpServletRequest request, HttpServletResponse response) {
133
+
134
+	@RequestMapping("/file/{file_id}")
135
+	public void downloadFile(@PathVariable String file_id, String mw, String mh,HttpServletRequest req,HttpServletResponse resp) throws Exception {
136
+		if (ChkTools.isNull(file_id)) {
137
+			return;
138
+		}
139
+		t_fk_file file = fileService.get(file_id);
140
+		ServletOutputStream os = resp.getOutputStream();
141
+		// 获取保存路径
142
+		String DATA_PATH = "/data/pm";
143
+		try {
144
+			File img = null;
145
+			if (file != null) {
146
+				img = new File(
147
+						DATA_PATH + File.separator + file.getFolder() + File.separator + file.getNew_file_name());
148
+			}
149
+
150
+			if (img == null || !img.exists()) {
151
+				img = new File(req.getSession().getServletContext().getRealPath("") + File.separator + "resource"
152
+						+ File.separator + "img", "file404.jpg");
153
+			}
154
+			int height = ChkTools.getInteger(mh);
155
+			int width = ChkTools.getInteger(mw);
156
+			height = height < 0 ? 0 : height;
157
+			width = width < 0 ? 0 : width;
158
+			// 设置页面不缓存
159
+			resp.setHeader("Pragma", "No-cache");
160
+			resp.setHeader("Cache-Control", "no-cache");
161
+			resp.setDateHeader("Expires", 0);
162
+			play(img, req, resp,file.getContent_type());
163
+		} catch (Exception e) {
164
+			logger.info("文件找不到:" + e);
165
+		} finally {
166
+			os.close();
167
+		}
168
+	}
169
+
170
+	public void play(File file, HttpServletRequest request, HttpServletResponse response,String content_type) {
134 171
 		ServletOutputStream servletOutputStream = null;
135 172
 		FileInputStream fileInputStream = null;
136 173
 		OutputStream outputStream = null;
@@ -138,7 +175,7 @@ public class ImgController2 extends ProjBaseAction {
138 175
 			servletOutputStream = response.getOutputStream();
139 176
 			fileInputStream = new FileInputStream(file);
140 177
 			byte[] cache = new byte[1024];
141
-			response.setHeader("Content-Type", "video/mp4");
178
+			response.setHeader("Content-Type", content_type);
142 179
 			response.setHeader("Content-Length", fileInputStream.available() + "");
143 180
 			int flag;
144 181
 			while ((flag = fileInputStream.read(cache)) != -1)

+ 18 - 0
krock-jcebid-cp/krock-web-cp-all/src/main/java/com/ydw/yunbuyer/web/cp/business/rest/UploadController2.java

@@ -5,6 +5,7 @@ import java.io.IOException;
5 5
 import java.util.HashMap;
6 6
 import java.util.Map;
7 7
 
8
+import io.swagger.annotations.Api;
8 9
 import org.springframework.beans.factory.annotation.Autowired;
9 10
 import org.springframework.context.annotation.Scope;
10 11
 import org.springframework.stereotype.Controller;
@@ -210,4 +211,21 @@ public class UploadController2 extends ProjBaseAction {
210 211
 		return JsonTools.toJson(end);
211 212
 	}
212 213
 
214
+
215
+	@RequestMapping("/upload/file")
216
+	@ResponseBody
217
+	public String upload_file(@RequestParam MultipartFile file,  String suff,String file_name)
218
+			throws IllegalStateException, IOException {
219
+		logger.info(file.getName());
220
+		t_fk_file tf = save_file(file, suff,file_name);
221
+		Map<String, Object> end = new HashMap<String, Object>();
222
+		// 发送保存结果
223
+		String path = "https://www.eqbidding.com/web-cp-all/img_pm/file/";
224
+		end.put("file_id", tf.getKid());
225
+		end.put("file_name", tf.getFile_name());
226
+		end.put("file_url", path+tf.getKid());
227
+		end.put("content_type", tf.getContent_type());
228
+		end.put("success", true);
229
+		return JsonTools.toJson(end);
230
+	}
213 231
 }

+ 0 - 1
krock-jcebid-cp/krock-web-cp-all/src/main/resources/application.yml

@@ -6,7 +6,6 @@ ydw:
6 6
   pub : public-service
7 7
   back-url: http://127.0.0.1:16027
8 8
   pub-url : http://127.0.0.1:16028
9
-  swagger : true
10 9
 server:
11 10
   port: 16025
12 11
   max-http-header-size: 30920

+ 32 - 7
krock-jcebid-cp/krock-web-cp-all/src/main/resources/static/view_cp_pm/pm/verify/select.js

@@ -2,7 +2,9 @@
2 2
 			buttonAlign : "center",
3 3
 			bodyStyle : "padding: 60px;",
4 4
 			defaultType : "textfield",
5
-			layout : 
5
+			width: 850,
6
+			height: 450,
7
+			layout :
6 8
 				{
7 9
 					type : 'table',
8 10
 					columns : 2
@@ -90,19 +92,42 @@
90 92
 					name : "price_guarantee",
91 93
 					labelWidth : 130,
92 94
 					editable : false,
93
-				}
95
+				},{
96
+					fieldLabel : "竞买协议",
97
+					name : "price_guarantee",
98
+					labelWidth : 130,
99
+					editable : false,
100
+					renderer : function(val){
101
+						return "<div><button onclick=\"getInfo('"+val+"')\">查看</button><button onclick=\"editInfo('price_guarantee')\">编辑</button></div>";
102
+					}
103
+				},{
104
+					fieldLabel : "竞买规则",
105
+					name : "bidding_rules_path",
106
+					labelWidth : 130,
107
+					editable : false,
108
+					renderer : function(val){
109
+						return "<div><button onccclick=\"getInfo('"+val+"')\">查看</button><button onclick=\"editInfo('bidding_rules_path')\">编辑</button></div>";
110
+					}
111
+				},
94 112
 			]
95 113
 		});
96
-		
97
-		
98
-		
99
-		
114
+
115
+
116
+
117
+
100 118
 		var edit_form_panel_win = Ext.create("Ext.Window", {
101 119
 			title : "标的物详情 ",
102 120
 			closeAction : "hide",
103 121
 			items : edit_form_panel
104 122
 		});
105
-		
123
+
124
+function getInfo(url){
125
+		window.location.href = url;
126
+}
127
+function editInfo(type){
128
+	var editKid =edit_form_panel.getForm().findField("kid").getValue();
129
+	console.log(editKid+"  "+type);
130
+}
106 131
 
107 132
 function details(kid){
108 133
 	

+ 0 - 1
krock-jcebid/krock-service-pubservices/src/main/resources/application.yml

@@ -1,7 +1,6 @@
1 1
 ydw:
2 2
   env: dev
3 3
   env_old: d
4
-  swagger: true
5 4
 mock:
6 5
   mock: true
7 6
 gcjs: 

+ 17 - 1
krock-pm/krock-api-pm/src/main/java/com/ydw/yunbuyer/api/pm/entity/ProjectItem.java

@@ -24,7 +24,8 @@ public class ProjectItem extends DataModel {
24 24
 	private String archive_status;// 归档状态
25 25
 	private String bid_file_id;// 招标文件id
26 26
 	private String item_status = "未完成 "; // 事件状态 : 未完成 or 已完成
27
-
27
+	private String bidding_agreement_path;// 竞买协议文件路径
28
+	private String bidding_rules_path;// 竞买规则文件路径
28 29
 	/**
29 30
 	 * t_pm_item 复制过来的字段
30 31
 	 */
@@ -386,4 +387,19 @@ public class ProjectItem extends DataModel {
386 387
 		this.seller_bid_success_form_id = seller_bid_success_form_id;
387 388
 	}
388 389
 
390
+	public String getBidding_agreement_path() {
391
+		return bidding_agreement_path;
392
+	}
393
+
394
+	public void setBidding_agreement_path(String bidding_agreement_path) {
395
+		this.bidding_agreement_path = bidding_agreement_path;
396
+	}
397
+
398
+	public String getBidding_rules_path() {
399
+		return bidding_rules_path;
400
+	}
401
+
402
+	public void setBidding_rules_path(String bidding_rules_path) {
403
+		this.bidding_rules_path = bidding_rules_path;
404
+	}
389 405
 }

+ 2 - 0
krock-pm/krock-web-pm/src/main/java/com/ydw/yunbuyer/web/pm/config/Knife4jPmConfiguration.java

@@ -4,6 +4,7 @@ package com.ydw.yunbuyer.web.pm.config;
4 4
 import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
5 5
 import com.google.common.base.Predicate;
6 6
 import io.swagger.annotations.Api;
7
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
7 8
 import org.springframework.context.annotation.Bean;
8 9
 import org.springframework.context.annotation.Configuration;
9 10
 import springfox.documentation.builders.ApiInfoBuilder;
@@ -17,6 +18,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
17 18
 @Configuration
18 19
 @EnableSwagger2
19 20
 @EnableKnife4j
21
+@ConditionalOnProperty(prefix = "ydw", name = "swagger", havingValue = "true")
20 22
 public class Knife4jPmConfiguration {
21 23
     // 组织Docket对象,翻译过来就是摘要的意思,它是生成API文档的核心对象,里面配置一些必要的信息
22 24
     @Bean

+ 22 - 2
krock-pm/krock-web-pm/src/main/java/com/ydw/yunbuyer/web/pm/controller_wxapp/WxPmController.java

@@ -15,6 +15,7 @@ import com.ydw.yunbuyer.common.utils.live.LiveTools;
15 15
 import com.ydw.yunbuyer.web.pm.base.ProjBaseAction;
16 16
 import com.ydw.yunbuyer.web.pm.base.Tip;
17 17
 import com.ydw.yunbuyer.web.pm.entity.*;
18
+import com.ydw.yunbuyer.web.pm.entity.user.UserInfoDto;
18 19
 import com.ydw.yunbuyer.web.pm.entity.user.t_receive_address;
19 20
 import com.ydw.yunbuyer.web.pm.service.*;
20 21
 import com.ydw.yunbuyer.web.pm.utils.OrderTools;
@@ -26,6 +27,7 @@ import io.swagger.annotations.ApiOperation;
26 27
 import org.apache.http.client.ClientProtocolException;
27 28
 import org.springframework.beans.factory.annotation.Autowired;
28 29
 import org.springframework.context.annotation.Scope;
30
+import org.springframework.web.bind.annotation.GetMapping;
29 31
 import org.springframework.web.bind.annotation.RequestMapping;
30 32
 import org.springframework.web.bind.annotation.RestController;
31 33
 import org.tmsps.ne4spring.utils.ChkUtil;
@@ -143,7 +145,7 @@ public class WxPmController extends ProjBaseAction {
143 145
 	 * @return
144 146
 	 */
145 147
 	@ApiOperation("查询分类")
146
-	@RequestMapping(value = "/list_item_classify")
148
+	@RequestMapping("/list_item_classify")
147 149
 	public String list_item_classify() {
148 150
 		List<Map<String, Object>> list = pmItemService.list_item_classify();
149 151
 		LinkedList<Map<String, Object>> list1 = new LinkedList<Map<String, Object>>();
@@ -182,7 +184,7 @@ public class WxPmController extends ProjBaseAction {
182 184
 	 * @return
183 185
 	 */
184 186
 	@ApiOperation("更新用户信息")
185
-	@RequestMapping(value = "/update_userinfo")
187
+	@GetMapping("/update_userinfo")
186 188
 	public String update_userinfo(String userinfo) {
187 189
 		JSONObject json1 = sessionWxService.getCurrentLoginPersion();
188 190
 		JSONObject json = JsonUtil.jsonStrToJsonObject(userinfo);
@@ -207,6 +209,24 @@ public class WxPmController extends ProjBaseAction {
207 209
 	}
208 210
 
209 211
 	/**
212
+	 * 获取用户信息
213
+	 *
214
+	 * @param userinfo
215
+	 * @return
216
+	 */
217
+	@ApiOperation("获取用户信息")
218
+	@GetMapping(value = "/get_userinfo")
219
+	public String getUserinfo(){
220
+		JSONObject json1 = sessionWxService.getCurrentLoginPersion();
221
+		String kid = json1.getString("kid");
222
+		Persion persion = persionApi.get(kid);
223
+		UserInfoDto userInfoDto = new UserInfoDto();
224
+		BeanUtils.copyProperties(persion,userInfoDto);
225
+		result.put("UserInfoDto", userInfoDto);
226
+		return result.toJSONString();
227
+	}
228
+
229
+	/**
210 230
 	 * 获取我的中拍信息
211 231
 	 * 
212 232
 	 * @return

+ 19 - 0
krock-pm/krock-web-pm/src/main/java/com/ydw/yunbuyer/web/pm/entity/t_project_item.java

@@ -24,6 +24,9 @@ public class t_project_item extends DataModel {
24 24
 	private String archive_status;// 归档状态
25 25
 	private String bid_file_id;// 招标文件id
26 26
 	private String item_status = "未完成 "; // 事件状态 : 未完成 or 已完成
27
+	private String bidding_agreement_path;// 竞买协议文件路径
28
+	private String bidding_rules_path;// 竞买规则文件路径
29
+
27 30
 
28 31
 	/**
29 32
 	 * t_pm_item 复制过来的字段
@@ -386,6 +389,22 @@ public class t_project_item extends DataModel {
386 389
 		this.seller_bid_success_form_id = seller_bid_success_form_id;
387 390
 	}
388 391
 
392
+	public String getBidding_agreement_path() {
393
+		return bidding_agreement_path;
394
+	}
395
+
396
+	public void setBidding_agreement_path(String bidding_agreement_path) {
397
+		this.bidding_agreement_path = bidding_agreement_path;
398
+	}
399
+
400
+	public String getBidding_rules_path() {
401
+		return bidding_rules_path;
402
+	}
403
+
404
+	public void setBidding_rules_path(String bidding_rules_path) {
405
+		this.bidding_rules_path = bidding_rules_path;
406
+	}
407
+
389 408
 	public String getAuction_type() {
390 409
 		return auction_type;
391 410
 	}

+ 118 - 0
krock-pm/krock-web-pm/src/main/java/com/ydw/yunbuyer/web/pm/entity/user/UserInfoDto.java

@@ -0,0 +1,118 @@
1
+package com.ydw.yunbuyer.web.pm.entity.user;
2
+
3
+import com.alibaba.fastjson.annotation.JSONField;
4
+import com.ydw.yunbuyer.common.utils.date.CreatedTools;
5
+import org.tmsps.ne4spring.annotation.FieldType;
6
+import org.tmsps.ne4spring.annotation.NotMap;
7
+import org.tmsps.ne4spring.annotation.PK;
8
+import org.tmsps.ne4spring.annotation.Table;
9
+import org.tmsps.ne4spring.orm.model.DataModel;
10
+import org.tmsps.ne4spring.utils.JsonUtil;
11
+
12
+import java.math.BigDecimal;
13
+
14
+@Table
15
+public class UserInfoDto extends DataModel {
16
+
17
+	// 城市
18
+	private String city;
19
+	// 微信昵称
20
+	private String nickName;
21
+	// 性别
22
+	private String gender;
23
+	// 省份
24
+	private String province;
25
+	// 国家
26
+	private String country;
27
+	// 头像
28
+	private String avatarUrl;
29
+
30
+
31
+	@PK
32
+	@FieldType
33
+	private String kid;
34
+	private int status;
35
+	private long created = System.currentTimeMillis();
36
+
37
+	@NotMap
38
+	private static final long serialVersionUID = 1L;
39
+
40
+	// ======= get / set ()=====================
41
+
42
+	public String getCity() {
43
+		return city;
44
+	}
45
+
46
+	public void setCity(String city) {
47
+		this.city = city;
48
+	}
49
+
50
+	public String getNickName() {
51
+		return nickName;
52
+	}
53
+
54
+	public void setNickName(String nickName) {
55
+		this.nickName = nickName;
56
+	}
57
+
58
+	public String getGender() {
59
+		return gender;
60
+	}
61
+
62
+	public void setGender(String gender) {
63
+		this.gender = gender;
64
+	}
65
+
66
+	public String getProvince() {
67
+		return province;
68
+	}
69
+
70
+	public void setProvince(String province) {
71
+		this.province = province;
72
+	}
73
+
74
+	public String getCountry() {
75
+		return country;
76
+	}
77
+
78
+	public void setCountry(String country) {
79
+		this.country = country;
80
+	}
81
+
82
+	public String getAvatarUrl() {
83
+		return avatarUrl;
84
+	}
85
+
86
+	public void setAvatarUrl(String avatarUrl) {
87
+		this.avatarUrl = avatarUrl;
88
+	}
89
+
90
+	public String getKid() {
91
+		return kid;
92
+	}
93
+
94
+	public void setKid(String kid) {
95
+		this.kid = kid;
96
+	}
97
+
98
+	public int getStatus() {
99
+		return status;
100
+	}
101
+
102
+	@Override
103
+	public void setStatus(int status) {
104
+		this.status = status;
105
+	}
106
+
107
+	public long getCreated() {
108
+		return created;
109
+	}
110
+
111
+	public void setCreated(long created) {
112
+		this.created = created;
113
+	}
114
+
115
+	public static long getSerialVersionUID() {
116
+		return serialVersionUID;
117
+	}
118
+}

+ 1 - 0
krock-pm/krock-web-pm/src/main/resources/application-test.yml

@@ -3,6 +3,7 @@ ydw:
3 3
   domain: yun
4 4
 #  res: H:\data\static
5 5
   res: /data/webapp_krock/web-pm/static
6
+  swagger: true
6 7
 server:
7 8
   port: 16032
8 9
   servlet:

+ 7 - 1
krock-pm/krock-web-pm/src/main/resources/sql/数据库修改语句.sql

@@ -1,2 +1,8 @@
1 1
 ALTER TABLE `krock-service-pm`.`t_pm_offline_apply`
2
-ADD COLUMN `file_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' AFTER `company_name`;
2
+ADD COLUMN `file_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' AFTER `company_name`;
3
+
4
+-- 添加竞买
5
+ALTER TABLE `krock-service-pm`.`t_project_item`
6
+ADD COLUMN `bidding_agreement_path` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '竞买协议文件路径' AFTER `auction_type`;
7
+ALTER TABLE `krock-service-pm`.`t_project_item`
8
+ADD COLUMN `bidding_rules_path` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '竞买规则文件路径' AFTER `auction_type`;