Commit 0be32ad9 authored by liuchao's avatar liuchao

no message

parent bf9321cc
package com.qiankun.controller; package com.qiankun.controller;
import java.io.File;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -8,13 +9,17 @@ import javax.servlet.http.HttpServletResponse; ...@@ -8,13 +9,17 @@ import javax.servlet.http.HttpServletResponse;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.qiankun.entity.ActivityReg; import com.qiankun.entity.ActivityReg;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; 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.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import com.qiankun.annotation.Auth; import com.qiankun.annotation.Auth;
...@@ -32,6 +37,9 @@ public class ActivityController extends BaseController<Object>{ ...@@ -32,6 +37,9 @@ public class ActivityController extends BaseController<Object>{
@Autowired @Autowired
private ActivityService activityService; private ActivityService activityService;
private ResourceBundle rb = ResourceBundle.getBundle("system");
private String activityImagePath = File.separator + rb.getString("activityImage");
@Auth(verifyLogin = false,verifyURL = false) @Auth(verifyLogin = false,verifyURL = false)
@RequestMapping(value = "/wx/api/activity/list", method = RequestMethod.POST) @RequestMapping(value = "/wx/api/activity/list", method = RequestMethod.POST)
public @ResponseBody Map<String, Object> listformWX(@RequestBody ActivityVo activityVo, HttpServletResponse response, HttpServletRequest request) throws Exception { public @ResponseBody Map<String, Object> listformWX(@RequestBody ActivityVo activityVo, HttpServletResponse response, HttpServletRequest request) throws Exception {
...@@ -137,15 +145,8 @@ public class ActivityController extends BaseController<Object>{ ...@@ -137,15 +145,8 @@ public class ActivityController extends BaseController<Object>{
} }
@Auth(verifyLogin = false,verifyURL = false) @RequestMapping(value = "/api/activity/save", method = RequestMethod.POST)
@RequestMapping(value = "/wx/api/activity/save",method = RequestMethod.POST) public Map<String, Object> save(@RequestParam(value = "file", required = false) MultipartFile file, ActivityVo activityVo, HttpServletResponse response, HttpServletRequest request) throws Exception {
public @ResponseBody Map<String,Object> saveUserFormWX(@RequestBody ActivityVo activityVo, HttpServletResponse response, HttpServletRequest request) throws Exception{
return this.save(activityVo, response, request);
}
@RequestMapping("/api/activity/save")
public Map<String, Object> save(ActivityVo activityVo, HttpServletResponse response, HttpServletRequest request) throws Exception {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Activity activity = new Activity(); Activity activity = new Activity();
...@@ -158,6 +159,25 @@ public class ActivityController extends BaseController<Object>{ ...@@ -158,6 +159,25 @@ public class ActivityController extends BaseController<Object>{
map.put("status", 2); map.put("status", 2);
} }
if (file != null) {
String fileFullName = file.getOriginalFilename();
String[] originalFileName = fileFullName.split("\\.");
String fileName = System.currentTimeMillis() + "." + originalFileName[originalFileName.length-1];
String rootPath = rb.getString("file_path");
if (StringUtils.isNotBlank(activity.getUploadImage())) {
File oldFile = new File(rootPath + activity.getUploadImage());
if (oldFile.isFile())
FileUtils.forceDelete(oldFile);
}
File destFile = new File(rootPath + activityImagePath,fileName);
FileUtils.writeByteArrayToFile(destFile,file.getBytes());
activity.setUploadImage(activityImagePath + File.separator + fileName);
}
activity.setAddr(activityVo.getAddr()); activity.setAddr(activityVo.getAddr());
activity.setAvailable(activityVo.getAvailable()); activity.setAvailable(activityVo.getAvailable());
activity.setContacts(activityVo.getContacts()); activity.setContacts(activityVo.getContacts());
......
...@@ -78,8 +78,8 @@ public class RainbowPlanController extends BaseController<Object> { ...@@ -78,8 +78,8 @@ public class RainbowPlanController extends BaseController<Object> {
@Autowired @Autowired
private WxMaProperties propertis; private WxMaProperties propertis;
private ResourceBundle rb = ResourceBundle.getBundle("system"); private ResourceBundle rb = ResourceBundle.getBundle("system");
private String uploadAvatarPath = File.separator + "rainbowplan" + File.separator + "uploadAvatar"; private String uploadAvatarPath = File.separator + "rainbowplan" + File.separator + rb.getString("uploadAvatar");
private String uploadWishImagePath = File.separator + "rainbowplan" + File.separator + "wishUploadImage"; private String uploadWishImagePath = File.separator + "rainbowplan" + File.separator + rb.getString("wishUploadImage");
private String getAppid(){ private String getAppid(){
return propertis.getConfigs().get(0).getAppid(); return propertis.getConfigs().get(0).getAppid();
......
...@@ -57,6 +57,10 @@ public class RainbowPlanWebController extends BaseController<Object>{ ...@@ -57,6 +57,10 @@ public class RainbowPlanWebController extends BaseController<Object>{
@Autowired @Autowired
private ActivityService activityService; private ActivityService activityService;
private ResourceBundle rb = ResourceBundle.getBundle("system");
private String uploadAvatarPath = File.separator + "rainbowplan" + File.separator + rb.getString("uploadAvatar");
private String uploadWishImagePath = File.separator + "rainbowplan" + File.separator + rb.getString("wishUploadImage");
@RequestMapping("/rainbow/user/view") @RequestMapping("/rainbow/user/view")
public ModelAndView userAdd(String id, HttpServletResponse response, HttpServletRequest request) throws Exception { public ModelAndView userAdd(String id, HttpServletResponse response, HttpServletRequest request) throws Exception {
ModelAndView view = new ModelAndView(); ModelAndView view = new ModelAndView();
...@@ -72,9 +76,6 @@ public class RainbowPlanWebController extends BaseController<Object>{ ...@@ -72,9 +76,6 @@ public class RainbowPlanWebController extends BaseController<Object>{
@RequestMapping(value = "/rainbow/user/save",method = RequestMethod.POST) @RequestMapping(value = "/rainbow/user/save",method = RequestMethod.POST)
public ModelAndView saveUser(@RequestParam(value = "file", required = false) MultipartFile file, RainbowPlanUserVo vo, HttpServletResponse response, HttpServletRequest request) throws Exception { public ModelAndView saveUser(@RequestParam(value = "file", required = false) MultipartFile file, RainbowPlanUserVo vo, HttpServletResponse response, HttpServletRequest request) throws Exception {
ModelAndView view = new ModelAndView(); ModelAndView view = new ModelAndView();
String uploadImagePath = File.separator + "rainbowplan" + File.separator + "uploadAvatar";
ResourceBundle rb = ResourceBundle.getBundle("system");
RainbowPlanUser user = new RainbowPlanUser(); RainbowPlanUser user = new RainbowPlanUser();
if (StringUtils.isBlank(vo.getId())) { if (StringUtils.isBlank(vo.getId())) {
...@@ -103,9 +104,9 @@ public class RainbowPlanWebController extends BaseController<Object>{ ...@@ -103,9 +104,9 @@ public class RainbowPlanWebController extends BaseController<Object>{
FileUtils.forceDelete(oldFile); FileUtils.forceDelete(oldFile);
} }
File destFile = new File(rootPath + uploadImagePath,fileName); File destFile = new File(rootPath + uploadAvatarPath,fileName);
FileUtils.writeByteArrayToFile(destFile,file.getBytes()); FileUtils.writeByteArrayToFile(destFile,file.getBytes());
user.setAvatar(uploadImagePath + File.separator + fileName); user.setAvatar(uploadAvatarPath + File.separator + fileName);
} }
user.setName(vo.getName()); user.setName(vo.getName());
user.setConnectTel(vo.getConnectTel()); user.setConnectTel(vo.getConnectTel());
...@@ -218,9 +219,6 @@ public class RainbowPlanWebController extends BaseController<Object>{ ...@@ -218,9 +219,6 @@ public class RainbowPlanWebController extends BaseController<Object>{
@RequestMapping(value = "/rainbow/wish/save",method = RequestMethod.POST) @RequestMapping(value = "/rainbow/wish/save",method = RequestMethod.POST)
public ModelAndView saveWish(@RequestParam(value = "file", required = false) MultipartFile file, WishVo vo, HttpServletResponse response, HttpServletRequest request) throws Exception { public ModelAndView saveWish(@RequestParam(value = "file", required = false) MultipartFile file, WishVo vo, HttpServletResponse response, HttpServletRequest request) throws Exception {
ModelAndView view = new ModelAndView(); ModelAndView view = new ModelAndView();
String uploadWishImagePath = File.separator + "rainbowplan" + File.separator + "wishUploadImage";
ResourceBundle rb = ResourceBundle.getBundle("system");
Wish wish = new Wish(); Wish wish = new Wish();
if (StringUtils.isBlank(vo.getId())) { if (StringUtils.isBlank(vo.getId())) {
......
...@@ -55,6 +55,8 @@ public class Activity { ...@@ -55,6 +55,8 @@ public class Activity {
private String tel; //联系电话 private String tel; //联系电话
private String uploadImage;//活动照片路径
@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL}, orphanRemoval = true, mappedBy = "activity") @OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL}, orphanRemoval = true, mappedBy = "activity")
@JsonIgnore @JsonIgnore
private Set<ActivityReg> activityReg = new HashSet<ActivityReg>(); private Set<ActivityReg> activityReg = new HashSet<ActivityReg>();
...@@ -165,6 +167,14 @@ public class Activity { ...@@ -165,6 +167,14 @@ public class Activity {
this.createTime = createTime; this.createTime = createTime;
} }
public String getUploadImage() {
return uploadImage;
}
public void setUploadImage(String uploadImage) {
this.uploadImage = uploadImage;
}
......
...@@ -18,7 +18,9 @@ tjmdp.secret=69ea7217fc5cee04f274c872a86be5e7 ...@@ -18,7 +18,9 @@ tjmdp.secret=69ea7217fc5cee04f274c872a86be5e7
tjmdp.token= tjmdp.token=
tjmdp.aesKey= tjmdp.aesKey=
tjmdp.msgDataFormat=JSON tjmdp.msgDataFormat=JSON
wishUploadImage=wishUploadImage
activityImage=activityImage
uploadAvatar=uploadAvatar
nation=\u6c49\u65cf,\u8499\u53e4\u65cf,\u56de\u65cf,\u85cf\u65cf,\u7ef4\u543e\u5c14\u65cf,\u82d7\u65cf,\u5f5d\u65cf,\u58ee\u65cf,\u5e03\u4f9d\u65cf,\u671d\u9c9c\u65cf,\u6ee1\u65cf,\u4f97\u65cf,\u7476\u65cf,\u767d\u65cf,\u571f\u5bb6\u65cf,\u54c8\u5c3c\u65cf,\u54c8\u8428\u514b\u65cf,\u50a3\u65cf,\u9ece\u65cf,\u5088\u50f3\u65cf,\u4f64\u65cf,\u7572\u65cf,\u9ad8\u5c71\u65cf,\u62c9\u795c\u65cf,\u6c34\u65cf,\u4e1c\u4e61\u65cf,\u7eb3\u897f\u65cf,\u666f\u9887\u65cf,\u67ef\u5c14\u514b\u5b5c\u65cf,\u571f\u65cf,\u8fbe\u65a1\u5c14\u65cf,\u4eeb\u4f6c\u65cf,\u7f8c\u65cf,\u5e03\u6717\u65cf,\u6492\u62c9\u65cf,\u6bdb\u5357\u65cf,\u4ee1\u4f6c\u65cf,\u9521\u4f2f\u65cf,\u963f\u660c\u65cf,\u666e\u7c73\u65cf,\u5854\u5409\u514b\u65cf,\u6012\u65cf,\u4e4c\u5b5c\u522b\u514b\u65cf,\u4fc4\u7f57\u65af\u65cf,\u9102\u6e29\u514b\u65cf,\u5fb7\u6602\u65cf,\u4fdd\u5b89\u65cf,\u88d5\u56fa\u65cf,\u4eac\u65cf,\u5854\u5854\u5c14\u65cf,\u72ec\u9f99\u65cf,\u9102\u4f26\u6625\u65cf,\u8d6b\u54f2\u65cf,\u95e8\u5df4\u65cf,\u73de\u5df4\u65cf,\u57fa\u8bfa\u65cf nation=\u6c49\u65cf,\u8499\u53e4\u65cf,\u56de\u65cf,\u85cf\u65cf,\u7ef4\u543e\u5c14\u65cf,\u82d7\u65cf,\u5f5d\u65cf,\u58ee\u65cf,\u5e03\u4f9d\u65cf,\u671d\u9c9c\u65cf,\u6ee1\u65cf,\u4f97\u65cf,\u7476\u65cf,\u767d\u65cf,\u571f\u5bb6\u65cf,\u54c8\u5c3c\u65cf,\u54c8\u8428\u514b\u65cf,\u50a3\u65cf,\u9ece\u65cf,\u5088\u50f3\u65cf,\u4f64\u65cf,\u7572\u65cf,\u9ad8\u5c71\u65cf,\u62c9\u795c\u65cf,\u6c34\u65cf,\u4e1c\u4e61\u65cf,\u7eb3\u897f\u65cf,\u666f\u9887\u65cf,\u67ef\u5c14\u514b\u5b5c\u65cf,\u571f\u65cf,\u8fbe\u65a1\u5c14\u65cf,\u4eeb\u4f6c\u65cf,\u7f8c\u65cf,\u5e03\u6717\u65cf,\u6492\u62c9\u65cf,\u6bdb\u5357\u65cf,\u4ee1\u4f6c\u65cf,\u9521\u4f2f\u65cf,\u963f\u660c\u65cf,\u666e\u7c73\u65cf,\u5854\u5409\u514b\u65cf,\u6012\u65cf,\u4e4c\u5b5c\u522b\u514b\u65cf,\u4fc4\u7f57\u65af\u65cf,\u9102\u6e29\u514b\u65cf,\u5fb7\u6602\u65cf,\u4fdd\u5b89\u65cf,\u88d5\u56fa\u65cf,\u4eac\u65cf,\u5854\u5854\u5c14\u65cf,\u72ec\u9f99\u65cf,\u9102\u4f26\u6625\u65cf,\u8d6b\u54f2\u65cf,\u95e8\u5df4\u65cf,\u73de\u5df4\u65cf,\u57fa\u8bfa\u65cf
......
...@@ -42,6 +42,9 @@ ...@@ -42,6 +42,9 @@
<div class="row"> <div class="row">
<div class="col-xs-5"> <div class="col-xs-5">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 活动类型 </label> <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 活动类型 </label>
...@@ -157,7 +160,18 @@ ...@@ -157,7 +160,18 @@
</div> </div>
<div class="col-xs-5">
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1">图片</label>
<div class="col-sm-9">
<c:if test="${activity.uploadImage!=null}">
<img src="<webpath:path/>/wx/rainbowplan/loadResource?imageName=${activity.uploadImage}" width="200"/><br></c:if>
<input type="file" id="input_file" name="file" >
</div>
</div>
</div>
</div> </div>
......
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
<th width="">所属活动</th> <th width="">所属活动</th>
<th width="">状态</th> <th width="">状态</th>
<th width="5%">发布时间</th> <th width="5%">发布时间</th>
<th width="2%">操作</th> <th width="5%">操作</th>
</tr> </tr>
</thead> </thead>
...@@ -145,10 +145,12 @@ ...@@ -145,10 +145,12 @@
<div class="visible-md visible-lg hidden-sm hidden-xs btn-group"> <div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
<button class="btn btn-xs btn-info" onclick="window.location.href='<webpath:path/>/rainbow/wish/view?id=${wish.id}'"> <button class="btn btn-xs btn-info" onclick="window.location.href='<webpath:path/>/rainbow/wish/view?id=${wish.id}'">
<i class="icon-edit bigger-120"></i> <i class="icon-edit"></i>
</button> </button>
&nbsp; &nbsp;
<button class="btn btn-xs btn-info" title="修改小朋友信息" onclick="window.location.href='<webpath:path/>/rainbow/user/view?id=${wish.children.id}'">
<i class="icon-user"></i>
</button>
<%-- <a class="btn btn-xs btn-link" title="详细信息" href="<webpath:path/>/rainbow/wish/view?id=${wish.id}"> <%-- <a class="btn btn-xs btn-link" title="详细信息" href="<webpath:path/>/rainbow/wish/view?id=${wish.id}">
<i class="icon-list-alt bigger-120"></i> <i class="icon-list-alt bigger-120"></i>
</a> --%> </a> --%>
......
...@@ -92,71 +92,84 @@ $(document).ready(function(){ ...@@ -92,71 +92,84 @@ $(document).ready(function(){
var activity = { var activity = {
save : function(form){ save : function(form){
if (isSubmit){ if (isSubmit){
isSubmit = false; isSubmit = false;
var formData = new FormData();
formData.append('file', $('#input_file')[0].files[0]);
formData.append('id', $('#id').val());
formData.append('name', $('#name').val());
formData.append('type', $('#type').val());
formData.append('addr', $('#addr').val());
formData.append('content', $('#content').val());
formData.append('day', $('#day').val());
formData.append('max', $('#max').val());
formData.append('crowd', $('#crowd').val());
formData.append('available', $('#available').val());
formData.append('contacts', $('#contacts').val());
formData.append('tel', $('#tel').val());
$.ajax({ $.ajax({
type: 'POST', url: webPath + '/api/activity/save',
url: '/api/activity/save', type: 'POST',
dataType:'json', cache: false,
data: { data: formData,
id:$('#id').val(), processData: false,
name:$('#name').val(), contentType: false,
type:$('#type').val(), dataType:"json",
addr:$('#addr').val(), beforeSend: function(){
content:$('#content').val(),
day:$('#day').val(), },
max:$('#max').val(), success: function(data){
crowd:$('#crowd').val(), var status=data.status;
available:$('#available').val(),
contacts:$('#contacts').val(), if(status==1){//成功
tel:$('#tel').val() bootbox.dialog({
}, message:"新增活动成功",
success: function(data){ buttons:{
var status=data.status; "cancel":{
"label":"返回",
if(status==1){//注册成功 "className":"btn-sm btn-primary",
bootbox.dialog({ "callback": function () {
message:"新增活动成功", window.location.href = webPath + '/activity/list';
buttons:{ }
"cancel":{ },
"label":"返回", "success":{
"className":"btn-sm btn-primary", "label":"继续添加",
"callback": function () { "className":"btn-sm btn-primary",
window.location.href = webPath + '/activity/list'; "callback": function () {
} window.location.href = webPath + '/activity/add';
}, }
"success":{
"label":"继续添加",
"className":"btn-sm btn-primary",
"callback": function () {
window.location.href = webPath + '/activity/add';
}
}
} }
});
}
} else if (status == 2){ });
isSubmit = true;
bootbox.dialog({ } else if (status == 2){
message:"修改活动成功", isSubmit = true;
buttons:{ bootbox.dialog({
"success":{ message:"修改活动成功",
"label":"确定", buttons:{
"className":"btn-sm btn-primary", "success":{
"callback": function () { "label":"确定",
} "className":"btn-sm btn-primary",
} "callback": function () {
window.location.reload();
}
} }
});
}
});
}
}
}
}
}); });
} }
......
...@@ -118,7 +118,6 @@ var user = { ...@@ -118,7 +118,6 @@ var user = {
formData.append('connectTel', $('#connectTel').val()); formData.append('connectTel', $('#connectTel').val());
formData.append('receiveAddress', $('#receiveAddress').val()); formData.append('receiveAddress', $('#receiveAddress').val());
alert(user.type)
if(user.type == 0){ if(user.type == 0){
formData.append('nickName', $('#nickName').val()); formData.append('nickName', $('#nickName').val());
formData.append('gender', $('input:radio[name="gender"]:checked').val()); formData.append('gender', $('input:radio[name="gender"]:checked').val());
...@@ -128,9 +127,6 @@ var user = { ...@@ -128,9 +127,6 @@ var user = {
formData.append('status', $('#status').val()); formData.append('status', $('#status').val());
} }
$.ajax({ $.ajax({
url: webPath + "/rainbow/user/save", url: webPath + "/rainbow/user/save",
type: 'POST', type: 'POST',
......
var isSubmit = true; var isSubmit = true;
$(document).ready(function(){ $(document).ready(function(){
$("#activity").select2({ $("#activity").select2({
placeholder : "请选择", placeholder : "请选择所属活动",
allowClear : true allowClear : true
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment