Commit 7aa7eb63 authored by liuchao's avatar liuchao

no message

parent eb713584
package com.qiankun.controller;
import java.io.File;
import java.util.ResourceBundle;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
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.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import com.qiankun.controller.base.BaseController;
import com.qiankun.entity.Gift;
import com.qiankun.service.GiftService;
@Controller
public class GiftController extends BaseController<Object>{
@Autowired
private GiftService giftService;
private ResourceBundle rb = ResourceBundle.getBundle("system");
private String giftImagePath = File.separator + rb.getString("giftImage");
@RequestMapping("/gift/list")
public ModelAndView list(HttpServletResponse response, HttpServletRequest request) throws Exception {
ModelAndView view = new ModelAndView();
view.getModelMap().addAttribute("gifts", giftService.findAll());
view.setViewName("gift/list");
return view;
}
@RequestMapping("/gift/add")
public ModelAndView typeAdd(String id) throws Exception {
ModelAndView view = new ModelAndView();
Gift gift = new Gift();
if(StringUtils.isNotBlank(id)) {
gift = giftService.findById(id);
}
view.setViewName("gift/save");
view.getModel().put("gift", gift);
return view;
}
@RequestMapping(value = "/gift/save", method = RequestMethod.POST)
public ModelAndView saveType(@RequestParam(value = "file", required = false) MultipartFile file, Gift gift, HttpServletResponse response, HttpServletRequest request) throws Exception {
ModelAndView view = new ModelAndView();
Gift g = new Gift();
if (StringUtils.isNotEmpty(gift.getId())) {
g = giftService.findById(gift.getId());
view.getModelMap().addAttribute("status", 2);
} else {
view.getModelMap().addAttribute("status", 1);
}
g.setName(gift.getName());
g.setContent(gift.getContent());
g.setStock(gift.getStock());
g.setTotal(gift.getTotal());
g.setPoint(gift.getPoint());
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(g.getUploadImage())) {
File oldFile = new File(rootPath + g.getUploadImage());
if (oldFile.isFile())
FileUtils.forceDelete(oldFile);
}
File destFile = new File(rootPath + giftImagePath,fileName);
FileUtils.writeByteArrayToFile(destFile,file.getBytes());
g.setUploadImage(giftImagePath + File.separator + fileName);
}
giftService.save(g);
return view;
}
@RequestMapping("/gift/del")
public ModelAndView delActivity(String id, HttpServletResponse response, HttpServletRequest request) throws Exception {
ModelAndView view = new ModelAndView();
giftService.remove(id);
return view;
}
}
\ No newline at end of file
...@@ -50,6 +50,7 @@ public class PointsController extends BaseController<Object>{ ...@@ -50,6 +50,7 @@ public class PointsController extends BaseController<Object>{
t.setId(type.getId()); t.setId(type.getId());
t.setName(type.getName()); t.setName(type.getName());
t.setPoint(type.getPoint()); t.setPoint(type.getPoint());
pointsService.saveType(t);
view.getModelMap().addAttribute("status", 2); view.getModelMap().addAttribute("status", 2);
} else { } else {
pointsService.saveType(type); pointsService.saveType(type);
......
...@@ -161,6 +161,8 @@ public class UserController extends BaseController<Object>{ ...@@ -161,6 +161,8 @@ public class UserController extends BaseController<Object>{
User user = new User(); User user = new User();
Date date = new Date(); Date date = new Date();
Contacts contacts1 = new Contacts();
Contacts contacts2 = new Contacts();
if (StringUtils.isEmpty(userVo.getId())) { if (StringUtils.isEmpty(userVo.getId())) {
...@@ -177,6 +179,11 @@ public class UserController extends BaseController<Object>{ ...@@ -177,6 +179,11 @@ public class UserController extends BaseController<Object>{
map.put("message", "userIsExist_userName"); map.put("message", "userIsExist_userName");
return map; return map;
} }
user.setLastMobile(userVo.getMobile());
contacts1.setLastName(userVo.getLastContactsName1());
contacts1.setLastMobile(userVo.getLastContactsMobile1());
contacts2.setLastName(userVo.getLastContactsName2());
contacts2.setLastMobile(userVo.getLastContactsMobile2());
user.setCreateTime(date); user.setCreateTime(date);
map.put("status", 1); map.put("status", 1);
...@@ -238,7 +245,7 @@ public class UserController extends BaseController<Object>{ ...@@ -238,7 +245,7 @@ public class UserController extends BaseController<Object>{
user.setRole(userVo.getRole()); user.setRole(userVo.getRole());
user.setStatus(userVo.getStatus()); user.setStatus(userVo.getStatus());
Contacts contacts1 = new Contacts();
contacts1.setName(userVo.getContactsName1()); contacts1.setName(userVo.getContactsName1());
contacts1.setAddr(userVo.getContactsAddr1()); contacts1.setAddr(userVo.getContactsAddr1());
contacts1.setMobile(userVo.getContactsMobile1()); contacts1.setMobile(userVo.getContactsMobile1());
...@@ -249,7 +256,6 @@ public class UserController extends BaseController<Object>{ ...@@ -249,7 +256,6 @@ public class UserController extends BaseController<Object>{
contacts1.setUser(user); contacts1.setUser(user);
user.getContacts().add(contacts1); user.getContacts().add(contacts1);
Contacts contacts2 = new Contacts();
contacts2.setName(userVo.getContactsName2()); contacts2.setName(userVo.getContactsName2());
contacts2.setAddr(userVo.getContactsAddr2()); contacts2.setAddr(userVo.getContactsAddr2());
contacts2.setMobile(userVo.getContactsMobile2()); contacts2.setMobile(userVo.getContactsMobile2());
...@@ -412,7 +418,10 @@ public class UserController extends BaseController<Object>{ ...@@ -412,7 +418,10 @@ public class UserController extends BaseController<Object>{
u.setProfession(row.getCell(17).getStringCellValue()); u.setProfession(row.getCell(17).getStringCellValue());
u.setUnitAddr(row.getCell(18).getStringCellValue()); u.setUnitAddr(row.getCell(18).getStringCellValue());
u.setUnitTel(row.getCell(20).getStringCellValue()); u.setUnitTel(row.getCell(20).getStringCellValue());
u.setMobile(row.getCell(21).getStringCellValue()); u.setMobile(row.getCell(21).getStringCellValue());
u.setLastMobile(row.getCell(21).getStringCellValue());
u.setTel(row.getCell(22).getStringCellValue()); u.setTel(row.getCell(22).getStringCellValue());
u.setQq(row.getCell(23).getStringCellValue()); u.setQq(row.getCell(23).getStringCellValue());
u.setEmail(row.getCell(24).getStringCellValue()); u.setEmail(row.getCell(24).getStringCellValue());
...@@ -430,16 +439,20 @@ public class UserController extends BaseController<Object>{ ...@@ -430,16 +439,20 @@ public class UserController extends BaseController<Object>{
u.setRemark(row.getCell(30).getStringCellValue()); u.setRemark(row.getCell(30).getStringCellValue());
c1.setName(row.getCell(31).getStringCellValue()); c1.setName(row.getCell(31).getStringCellValue());
c1.setLastName(row.getCell(31).getStringCellValue());
c1.setRelation(row.getCell(32).getStringCellValue()); c1.setRelation(row.getCell(32).getStringCellValue());
c1.setAddr(row.getCell(33).getStringCellValue()); c1.setAddr(row.getCell(33).getStringCellValue());
c1.setMobile(row.getCell(35).getStringCellValue()); c1.setMobile(row.getCell(35).getStringCellValue());
c1.setLastMobile(row.getCell(35).getStringCellValue());
c1.setQq(row.getCell(36).getStringCellValue()); c1.setQq(row.getCell(36).getStringCellValue());
c1.setWeixin(row.getCell(38).getStringCellValue()); c1.setWeixin(row.getCell(38).getStringCellValue());
c1.setUser(u); c1.setUser(u);
c2.setName(row.getCell(40).getStringCellValue()); c2.setName(row.getCell(40).getStringCellValue());
c2.setLastName(row.getCell(40).getStringCellValue());
c2.setRelation(row.getCell(41).getStringCellValue()); c2.setRelation(row.getCell(41).getStringCellValue());
c2.setAddr(row.getCell(42).getStringCellValue()); c2.setAddr(row.getCell(42).getStringCellValue());
c2.setMobile(row.getCell(44).getStringCellValue()); c2.setMobile(row.getCell(44).getStringCellValue());
c2.setLastMobile(row.getCell(44).getStringCellValue());
c2.setQq(row.getCell(45).getStringCellValue()); c2.setQq(row.getCell(45).getStringCellValue());
c2.setWeixin(row.getCell(47).getStringCellValue()); c2.setWeixin(row.getCell(47).getStringCellValue());
c2.setUser(u); c2.setUser(u);
...@@ -491,7 +504,10 @@ public class UserController extends BaseController<Object>{ ...@@ -491,7 +504,10 @@ public class UserController extends BaseController<Object>{
u.setProfession(row.getCell(15).getStringCellValue()); u.setProfession(row.getCell(15).getStringCellValue());
u.setUnitAddr(row.getCell(16).getStringCellValue()); u.setUnitAddr(row.getCell(16).getStringCellValue());
u.setTel(row.getCell(18).getStringCellValue()); u.setTel(row.getCell(18).getStringCellValue());
u.setMobile(row.getCell(19).getStringCellValue()); u.setMobile(row.getCell(19).getStringCellValue());
u.setLastMobile(row.getCell(19).getStringCellValue());
u.setUnitTel(row.getCell(20).getStringCellValue()); u.setUnitTel(row.getCell(20).getStringCellValue());
u.setEmail(row.getCell(21).getStringCellValue()); u.setEmail(row.getCell(21).getStringCellValue());
if (StringUtils.isNotBlank(row.getCell(22).getStringCellValue())) { if (StringUtils.isNotBlank(row.getCell(22).getStringCellValue())) {
...@@ -515,10 +531,12 @@ public class UserController extends BaseController<Object>{ ...@@ -515,10 +531,12 @@ public class UserController extends BaseController<Object>{
c1.setName(row.getCell(35).getStringCellValue()); c1.setName(row.getCell(35).getStringCellValue());
c1.setLastName(row.getCell(35).getStringCellValue());
c1.setRelation(row.getCell(36).getStringCellValue()); c1.setRelation(row.getCell(36).getStringCellValue());
c1.setMobile(row.getCell(37).getStringCellValue()); c1.setMobile(row.getCell(37).getStringCellValue());
c1.setLastMobile(row.getCell(37).getStringCellValue());
c1.setQq(row.getCell(38).getStringCellValue()); c1.setQq(row.getCell(38).getStringCellValue());
c1.setMobile(row.getCell(39).getStringCellValue());
c1.setWeixin(row.getCell(40).getStringCellValue()); c1.setWeixin(row.getCell(40).getStringCellValue());
c1.setAddr(row.getCell(41).getStringCellValue()); c1.setAddr(row.getCell(41).getStringCellValue());
c1.setUser(u); c1.setUser(u);
...@@ -526,8 +544,9 @@ public class UserController extends BaseController<Object>{ ...@@ -526,8 +544,9 @@ public class UserController extends BaseController<Object>{
c2.setName(row.getCell(44).getStringCellValue()); c2.setName(row.getCell(44).getStringCellValue());
c2.setRelation(row.getCell(45).getStringCellValue()); c2.setRelation(row.getCell(45).getStringCellValue());
c2.setMobile(row.getCell(46).getStringCellValue()); c2.setMobile(row.getCell(46).getStringCellValue());
c2.setLastMobile(row.getCell(46).getStringCellValue());
c2.setQq(row.getCell(47).getStringCellValue()); c2.setQq(row.getCell(47).getStringCellValue());
c2.setMobile(row.getCell(48).getStringCellValue());
c2.setWeixin(row.getCell(49).getStringCellValue()); c2.setWeixin(row.getCell(49).getStringCellValue());
c2.setAddr(row.getCell(50).getStringCellValue()); c2.setAddr(row.getCell(50).getStringCellValue());
c2.setUser(u); c2.setUser(u);
......
package com.qiankun.dao;
import com.qiankun.dao.core.IDao;
import com.qiankun.entity.Gift;
public interface GiftDao extends IDao<Gift, String> {
}
package com.qiankun.dao;
import org.springframework.stereotype.Repository;
import com.qiankun.dao.core.AbsDao;
import com.qiankun.entity.Gift;
@Repository
public class GiftDaoImpl extends AbsDao<Gift, String> implements GiftDao {
}
package com.qiankun.entity; package com.qiankun.entity;
import java.util.Date; import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Inheritance; import javax.persistence.Inheritance;
import javax.persistence.InheritanceType; import javax.persistence.InheritanceType;
import javax.persistence.Lob; import javax.persistence.Lob;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import org.hibernate.annotations.Cache; import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity @Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
...@@ -45,7 +38,9 @@ public class Blood { ...@@ -45,7 +38,9 @@ public class Blood {
@ManyToOne @ManyToOne
private Activity activity = null; private Activity activity = null;
private Date updateTime = new Date(); private Date updateTime = new Date(); //采血时间
private Date createTime = new Date(); //数据创建时间
public String getId() { public String getId() {
return id; return id;
...@@ -111,5 +106,13 @@ public class Blood { ...@@ -111,5 +106,13 @@ public class Blood {
this.bloodCollect = bloodCollect; this.bloodCollect = bloodCollect;
} }
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
} }
...@@ -25,10 +25,12 @@ public class Contacts { ...@@ -25,10 +25,12 @@ public class Contacts {
private String id; private String id;
private String name; private String name;
private String lastName;
private String relation; //关系 private String relation; //关系
private String mobile;//手机 private String mobile;//手机
private String lastMobile;
private String qq; private String qq;
...@@ -43,6 +45,8 @@ public class Contacts { ...@@ -43,6 +45,8 @@ public class Contacts {
private Date updateTime = new Date(); private Date updateTime = new Date();
private Date createTime = new Date(); //数据创建时间
public String getId() { public String getId() {
return id; return id;
} }
...@@ -115,6 +119,30 @@ public class Contacts { ...@@ -115,6 +119,30 @@ public class Contacts {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getLastMobile() {
return lastMobile;
}
public void setLastMobile(String lastMobile) {
this.lastMobile = lastMobile;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
......
...@@ -28,6 +28,10 @@ public class Gift { ...@@ -28,6 +28,10 @@ public class Gift {
private String uploadImage;//礼物照片路径 private String uploadImage;//礼物照片路径
private Long total; //礼品总数
private Long stock; //库存
public String getId() { public String getId() {
return id; return id;
} }
...@@ -68,6 +72,22 @@ public class Gift { ...@@ -68,6 +72,22 @@ public class Gift {
this.uploadImage = uploadImage; this.uploadImage = uploadImage;
} }
public Long getTotal() {
return total;
}
public void setTotal(Long total) {
this.total = total;
}
public Long getStock() {
return stock;
}
public void setStock(Long stock) {
this.stock = stock;
}
......
...@@ -49,6 +49,7 @@ public class User { ...@@ -49,6 +49,7 @@ public class User {
private String profession; //职业 private String profession; //职业
private String mobile; //本人手机 private String mobile; //本人手机
private String lastMobile; //上一次的手机
private String email; //邮箱 private String email; //邮箱
private String tel; //固定电话 private String tel; //固定电话
private String qq; private String qq;
...@@ -75,7 +76,7 @@ public class User { ...@@ -75,7 +76,7 @@ public class User {
private String marrowCode; //骨髓编号 private String marrowCode; //骨髓编号
private Date createTime = new Date(); private Date createTime = new Date(); //数据创建时间
private Date updateTime = new Date(); private Date updateTime = new Date();
private boolean remove = false; private boolean remove = false;
...@@ -92,6 +93,10 @@ public class User { ...@@ -92,6 +93,10 @@ public class User {
@JsonIgnore @JsonIgnore
private Set<UserPoints> points = new HashSet<UserPoints>(); private Set<UserPoints> points = new HashSet<UserPoints>();
@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL}, orphanRemoval = true, mappedBy = "user")
@JsonIgnore
private Set<UserGift> gift = new HashSet<UserGift>();
private Boolean isRemove=false;//是否删除用户,默认false private Boolean isRemove=false;//是否删除用户,默认false
...@@ -377,6 +382,18 @@ public class User { ...@@ -377,6 +382,18 @@ public class User {
public void setMarrowCode(String marrowCode) { public void setMarrowCode(String marrowCode) {
this.marrowCode = marrowCode; this.marrowCode = marrowCode;
} }
public Set<UserGift> getGift() {
return gift;
}
public void setGift(Set<UserGift> gift) {
this.gift = gift;
}
public String getLastMobile() {
return lastMobile;
}
public void setLastMobile(String lastMobile) {
this.lastMobile = lastMobile;
}
} }
package com.qiankun.entity; package com.qiankun.entity;
import java.util.Date;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Inheritance; import javax.persistence.Inheritance;
import javax.persistence.InheritanceType; import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
import org.hibernate.annotations.Cache; import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.CacheConcurrencyStrategy;
...@@ -20,13 +23,18 @@ public class UserGift { ...@@ -20,13 +23,18 @@ public class UserGift {
@GeneratedValue(generator = "systemUUID") @GeneratedValue(generator = "systemUUID")
private String id; private String id;
private String name; //礼品名称 private String point; //礼品积分
private String content; //礼品介绍 @ManyToOne
private Gift gift = new Gift();
private String point; //礼品积分 @ManyToOne
private User user = new User();
private String uploadImage;//礼物照片路径 private Date updateTime = new Date();
private String expressCompany;//快递公司
private String expressCode;//快递单号
public String getId() { public String getId() {
return id; return id;
...@@ -36,38 +44,53 @@ public class UserGift { ...@@ -36,38 +44,53 @@ public class UserGift {
this.id = id; this.id = id;
} }
public String getName() { public String getPoint() {
return name; return point;
} }
public void setName(String name) { public void setPoint(String point) {
this.name = name; this.point = point;
} }
public String getContent() { public Gift getGift() {
return content; return gift;
} }
public void setContent(String content) { public void setGift(Gift gift) {
this.content = content; this.gift = gift;
} }
public String getPoint() { public User getUser() {
return point; return user;
} }
public void setPoint(String point) { public void setUser(User user) {
this.point = point; this.user = user;
} }
public String getUploadImage() { public Date getUpdateTime() {
return uploadImage; return updateTime;
} }
public void setUploadImage(String uploadImage) { public void setUpdateTime(Date updateTime) {
this.uploadImage = uploadImage; this.updateTime = updateTime;
} }
public String getExpressCompany() {
return expressCompany;
}
public void setExpressCompany(String expressCompany) {
this.expressCompany = expressCompany;
}
public String getExpressCode() {
return expressCode;
}
public void setExpressCode(String expressCode) {
this.expressCode = expressCode;
}
......
package com.qiankun.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.qiankun.dao.GiftDao;
import com.qiankun.entity.Gift;
@Service
public class GiftService {
@Autowired
private GiftDao giftDao;
public Gift findById(String id) {
Gift gift = giftDao.find(id);
return gift;
}
@Transactional
public Gift save(Gift gift) {
return giftDao.save(gift);
}
@Transactional
public void remove(String id) {
giftDao.remove(id);
}
public List<Gift> findAll() {
List<Gift> list = giftDao.findAll();
return list;
}
}
...@@ -23,6 +23,7 @@ public class UserVo { ...@@ -23,6 +23,7 @@ public class UserVo {
private String profession; //职业 private String profession; //职业
private String mobile; //本人手机 private String mobile; //本人手机
private String lastMobile; //上一次本人手机
private String email; //邮箱 private String email; //邮箱
private String tel; //固定电话 private String tel; //固定电话
private String qq; private String qq;
...@@ -37,16 +38,20 @@ public class UserVo { ...@@ -37,16 +38,20 @@ public class UserVo {
private String origin; //用户来源 小程序1 后台新增2 导入3 private String origin; //用户来源 小程序1 后台新增2 导入3
private String contactsName1; private String contactsName1;
private String lastContactsName1;
private String contactsQQ1; private String contactsQQ1;
private String contactsRelation1; private String contactsRelation1;
private String contactsWeixin1; private String contactsWeixin1;
private String contactsMobile1; private String contactsMobile1;
private String lastContactsMobile1;
private String contactsAddr1; private String contactsAddr1;
private String contactsName2; private String contactsName2;
private String lastContactsName2;
private String contactsQQ2; private String contactsQQ2;
private String contactsRelation2; private String contactsRelation2;
private String contactsWeixin2; private String contactsWeixin2;
private String contactsMobile2; private String contactsMobile2;
private String lastContactsMobile2;
private String contactsAddr2; private String contactsAddr2;
private String pwd; //密码 private String pwd; //密码
...@@ -416,6 +421,36 @@ public class UserVo { ...@@ -416,6 +421,36 @@ public class UserVo {
public void setEndbloodId(String endbloodId) { public void setEndbloodId(String endbloodId) {
this.endbloodId = endbloodId; this.endbloodId = endbloodId;
} }
public String getLastMobile() {
return lastMobile;
}
public void setLastMobile(String lastMobile) {
this.lastMobile = lastMobile;
}
public String getLastContactsName1() {
return lastContactsName1;
}
public void setLastContactsName1(String lastContactsName1) {
this.lastContactsName1 = lastContactsName1;
}
public String getLastContactsMobile1() {
return lastContactsMobile1;
}
public void setLastContactsMobile1(String lastContactsMobile1) {
this.lastContactsMobile1 = lastContactsMobile1;
}
public String getLastContactsName2() {
return lastContactsName2;
}
public void setLastContactsName2(String lastContactsName2) {
this.lastContactsName2 = lastContactsName2;
}
public String getLastContactsMobile2() {
return lastContactsMobile2;
}
public void setLastContactsMobile2(String lastContactsMobile2) {
this.lastContactsMobile2 = lastContactsMobile2;
}
} }
...@@ -22,6 +22,7 @@ wishUploadImage=wishUploadImage ...@@ -22,6 +22,7 @@ wishUploadImage=wishUploadImage
activityImage=activityImage activityImage=activityImage
uploadAvatar=uploadAvatar uploadAvatar=uploadAvatar
certificateImage=certificateImage certificateImage=certificateImage
giftImage=giftImage
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
......
...@@ -278,14 +278,14 @@ ...@@ -278,14 +278,14 @@
</li> </li>
<li> <li>
<a href="/points/type/list"> <a href="<webpath:path/>/points/type/list">
<i class="icon-list-alt"></i> <i class="icon-list-alt"></i>
<span class="menu-text"> 积分管理 </span> <span class="menu-text"> 积分管理 </span>
</a> </a>
</li> </li>
<li> <li>
<a href="#"> <a href="<webpath:path/>/gift/list">
<i class="icon-briefcase "></i> <i class="icon-briefcase "></i>
<span class="menu-text"> <span class="menu-text">
......
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="webpath" uri="/WEB-INF/tlds/path.tld"%>
<%@ taglib prefix="webpage" uri="/WEB-INF/tlds/pageview.tld"%>
<head>
</head>
<div class="main-content">
<div class="breadcrumbs" id="breadcrumbs">
<ul class="breadcrumb">
<li>
<i class="icon-home home-icon"></i>
<a href="#">首页</a>
</li>
<li class="active">礼物管理</li>
</ul><!-- .breadcrumb -->
</div>
<div class="page-content">
<div class="row">
<div class="col-xs-12">
<div class="widget-toolbox">
<div class="btn-group">
<button class="btn btn-sm btn-success" onclick="window.location.href='<webpath:path/>/gift/add'">
<i class="icon-plus-sign-alt bigger-110"></i>
新增
</button>
</div>
</div>
<div class="pull-left"></div>
<table id="table-data" class="table table-bordered ">
<thead>
<tr class="">
<th>礼物照片</th>
<th>礼品名称</th>
<th>详细信息</th>
<th>礼品积分</th>
<th>礼品总数</th>
<th>礼品库存</th>
<th width="100">操作</th>
</tr>
</thead>
<tbody>
<c:forEach var="gift" items="${gifts}">
<tr class="tr-highlight">
<td title=""><img alt="" src="<webpath:path/>/wx/rainbowplan/loadResource?imageName=${gift.uploadImage}" width="60" height="60"/></td>
<td title="">${gift.name}</td>
<td title="">${gift.content}</td>
<td title="">${gift.point}</td>
<td title="">${gift.total}</td>
<td title="">${gift.stock}</td>
<td>
<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/>/gift/add?id=${gift.id}'">
<i class="icon-edit bigger-120"></i>
</button>
&nbsp;
<button class="btn btn-xs btn-danger" onclick="gift.remove('${gift.id}')">
<i class="icon-trash bigger-120"></i>
</button>
</div>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script src="<webpath:path/>/resources/js/gift/gift.js" type="text/javascript"></script>
\ No newline at end of file
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="webpath" uri="/WEB-INF/tlds/path.tld"%>
<%@ taglib prefix="webpage" uri="/WEB-INF/tlds/pageview.tld"%>
<head>
</head>
<div class="main-content">
<div class="breadcrumbs" id="breadcrumbs">
<ul class="breadcrumb">
<li>
<i class="icon-home home-icon"></i>
<a href="#">首页</a>
</li>
<li class="active">礼物管理</li>
<li class="active">保存</li>
</ul><!-- .breadcrumb -->
</div>
<div class="page-content">
<div class="row">
<div class="col-xs-12">
<form action="#" id="giftForm" name="giftForm" method="post" onsubmit="return false" class="form-horizontal" role="form">
<input type="hidden" id="id" name="id" value="${gift.id}"/>
<div class="row">
<div class="col-xs-12">
<h3 class="header smaller lighter blue">礼物</h3></div>
</div>
<div class="row">
<div class="col-xs-5">
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> <font color="red">*</font> 名称 </label>
<div class="col-sm-9">
<input type="text" id="name" name="name" class="col-xs-10 col-sm-10" value="${gift.name}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 详细信息 </label>
<div class="col-sm-9">
<textarea rows="4" class="col-xs-10 col-sm-10" id="content" name="content">${gift.content}</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-2"> 积分</label>
<div class="col-sm-9">
<input type="text" id="point" name="point" class="col-xs-10 col-sm-10" value="${gift.point}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-2"> 总数</label>
<div class="col-sm-9">
<input type="text" id="total" name="total" class="col-xs-10 col-sm-10" value="${gift.total}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-2"> 库存</label>
<div class="col-sm-9">
<input type="text" id="stock" name="stock" class="col-xs-10 col-sm-10" value="${gift.stock}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1"><font color="red">*</font>图片</label>
<div class="col-sm-9">
<c:if test="${gift.uploadImage!=null}">
<img src="<webpath:path/>/wx/rainbowplan/loadResource?imageName=${gift.uploadImage}" /><br></c:if>
<input type="file" id="input_file" name="file" >
</div>
</div>
</div>
</div>
<div class="col-md-offset-3 col-md-9">
<button class="btn btn-sm btn-success" type="submit">
<i class="icon-save bigger-110"></i>
保存
</button>
&nbsp; &nbsp; &nbsp;
<a class="btn btn-sm btn-success" href="javascript:history.go(-1)">
<i class="icon-reply bigger-110"></i>
返回
</a>
</div>
</form>
</div>
</div>
</div>
</div>
<script src="<webpath:path/>/resources/js/gift/gift.js" type="text/javascript"></script>
\ No newline at end of file
var isSubmit = true;
$(document).ready(function(){
if ($('#giftForm').length>0){
$('#giftForm').validate({
rules : {
"name" : {
required : true
},
"content" : {
required : true
},
"point" : {
required : true
},
"total" : {
required : true
},
"stock" : {
required : true
}
},
messages:{
"name" : {
required : "不能为空"
},
"content" : {
required : "不能为空"
},
"point" : {
required : "不能为空"
},
"total" : {
required : "不能为空"
},
"stock" : {
required : "不能为空"
}
},
submitHandler: function(form){
gift.save(form);
}
});
}
})
var gift = {
remove : function(id){
bootbox.confirm({
buttons: {
cancel: {
label: '取消',
className: 'btn-default'
},
confirm: {
label: '确认',
className: 'btn-myStyle'
}
},
message: '请确认是否删除?',
callback: function(result) {
if(result) {
$.ajax({
type: 'GET',
url: webPath + '/gift/del?id='+id,
dataType:'json',
success: function(data){
window.location.reload();
}
})
} else {
}
},
title: "删除"
});
},
save : function(form){
if (isSubmit){
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('content', $('#content').val());
formData.append('point', $('#point').val());
formData.append('total', $('#total').val());
formData.append('stock', $('#stock').val());
$.ajax({
url: webPath + '/gift/save',
type: 'POST',
cache: false,
data: formData,
processData: false,
contentType: false,
dataType:"json",
beforeSend: function(){
},
success: function(data){
var status=data.status;
if(status==1){//成功
bootbox.dialog({
message:"新增成功",
buttons:{
"cancel":{
"label":"返回",
"className":"btn-sm btn-primary",
"callback": function () {
window.location.href = webPath + '/gift/list';
}
},
"success":{
"label":"继续添加",
"className":"btn-sm btn-primary",
"callback": function () {
window.location.href = webPath + '/gift/add';
}
}
}
});
} else if (status == 2){
isSubmit = true;
bootbox.dialog({
message:"修改成功",
buttons:{
"success":{
"label":"确定",
"className":"btn-sm btn-primary",
"callback": function () {
window.location.reload();
}
}
}
});
}
}
});
}
}
}
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