Commit df48e996 authored by liuchao's avatar liuchao

no message

parent b826ece5
package com.qiankun.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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.servlet.ModelAndView;
import com.qiankun.controller.base.BaseController;
import com.qiankun.entity.Points;
import com.qiankun.service.PointsService;
@Controller
public class PointsController extends BaseController<Object>{
@Autowired
private PointsService pointsService;
@RequestMapping("/points/type/list")
public ModelAndView list(HttpServletResponse response, HttpServletRequest request) throws Exception {
ModelAndView view = new ModelAndView();
view.getModelMap().addAttribute("typelist", pointsService.findAllType());
view.setViewName("points/typelist");
return view;
}
@RequestMapping("/points/type/add")
public ModelAndView typeAdd(String id) throws Exception {
ModelAndView view = new ModelAndView();
Points type = new Points();
if(StringUtils.isNotBlank(id)) {
type = pointsService.findById(id);
}
view.setViewName("points/savetype");
view.getModel().put("type", type);
return view;
}
@RequestMapping("/points/type/save")
public ModelAndView saveType(Points type, HttpServletResponse response, HttpServletRequest request) throws Exception {
ModelAndView view = new ModelAndView();
if (StringUtils.isNotEmpty(type.getId())) {
Points t = pointsService.findById(type.getId());
t.setAvailable(type.isAvailable());
t.setId(type.getId());
t.setName(type.getName());
t.setPoint(type.getPoint());
view.getModelMap().addAttribute("status", 2);
} else {
pointsService.saveType(type);
view.getModelMap().addAttribute("status", 1);
}
return view;
}
@RequestMapping("/points/type/del")
public ModelAndView delActivity(String id, HttpServletResponse response, HttpServletRequest request) throws Exception {
ModelAndView view = new ModelAndView();
pointsService.removeType(id);
return view;
}
}
\ No newline at end of file
...@@ -651,16 +651,12 @@ public class UserController extends BaseController<Object>{ ...@@ -651,16 +651,12 @@ public class UserController extends BaseController<Object>{
sheet.setColumnWidth(51,3000); sheet.setColumnWidth(51,3000);
sheet.setColumnWidth(52,3000); sheet.setColumnWidth(52,3000);
XSSFFont topfont = wb.createFont(); XSSFFont topfont = wb.createFont();
topfont.setFontName("宋体"); topfont.setFontName("宋体");
topfont.setFontHeightInPoints((short) 11); topfont.setFontHeightInPoints((short) 11);
topfont.setBold(true); //topfont.setBold(true);
//topfont.setBoldweight(Font.BOLDWEIGHT_BOLD); //topfont.setBoldweight(Font.BOLDWEIGHT_BOLD);
XSSFCellStyle cellTopStyle=wb.createCellStyle(); XSSFCellStyle cellTopStyle=wb.createCellStyle();
cellTopStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); cellTopStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
cellTopStyle.setBorderBottom(BorderStyle.THIN); //setBorderBottom(CellStyle.BORDER_THIN); cellTopStyle.setBorderBottom(BorderStyle.THIN); //setBorderBottom(CellStyle.BORDER_THIN);
...@@ -673,7 +669,7 @@ public class UserController extends BaseController<Object>{ ...@@ -673,7 +669,7 @@ public class UserController extends BaseController<Object>{
cellTopStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex()); cellTopStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());
XSSFRow row = sheet.createRow(0); XSSFRow row = sheet.createRow(0);
row.setHeightInPoints(30); row.setHeightInPoints(20);
row.setRowStyle(cellTopStyle); row.setRowStyle(cellTopStyle);
XSSFCell cell = row.createCell(0); XSSFCell cell = row.createCell(0);
cell.setCellValue("个人信息"); cell.setCellValue("个人信息");
...@@ -698,10 +694,221 @@ public class UserController extends BaseController<Object>{ ...@@ -698,10 +694,221 @@ public class UserController extends BaseController<Object>{
row = sheet.createRow(1); row = sheet.createRow(1);
row.setHeightInPoints(30); row.setHeightInPoints(30);
cell = row.createCell(0); cell = row.createCell(0);
cell.setCellValue("*姓名"); cell.setCellValue("*姓名");
cell.setCellStyle(cellTopStyle); cell.setCellStyle(cellTopStyle);
cell = row.createCell(1);
cell.setCellValue("是否用于科研");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(2);
cell.setCellValue("*性别");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(3);
cell.setCellValue("*出生日期");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(4);
cell.setCellValue("*证件类型");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(5);
cell.setCellValue("*证件号码");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(6);
cell.setCellValue("民族");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(7);
cell.setCellValue("*籍贯");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(8);
cell.setCellValue("国籍");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(9);
cell.setCellValue("*学历");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(10);
cell.setCellValue("户籍所在地");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(11);
cell.setCellValue("户籍所在地邮编");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(12);
cell.setCellValue("经常居住地");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(13);
cell.setCellValue("经常居住地邮编");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(14);
cell.setCellValue("工作单位/学校");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(15);
cell.setCellValue("职业");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(16);
cell.setCellValue("单位/学校地址");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(17);
cell.setCellValue("单位/学校邮编");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(18);
cell.setCellValue("单位/学校电话");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(19);
cell.setCellValue("*手机");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(20);
cell.setCellValue("固定电话");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(21);
cell.setCellValue("*QQ");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(22);
cell.setCellValue("E-mail");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(23);
cell.setCellValue("无偿献血次数");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(24);
cell.setCellValue("*血型");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(25);
cell.setCellValue("*身高");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(26);
cell.setCellValue("*体重");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(27);
cell.setCellValue("微信");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(28);
cell.setCellValue("备注");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(29);
cell.setCellValue("*姓名");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(30);
cell.setCellValue("*关系");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(31);
cell.setCellValue("住址");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(32);
cell.setCellValue("邮编");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(33);
cell.setCellValue("*手机");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(34);
cell.setCellValue("QQ");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(35);
cell.setCellValue("固定电话");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(36);
cell.setCellValue("微信");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(37);
cell.setCellValue("备注");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(38);
cell.setCellValue("姓名");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(39);
cell.setCellValue("关系");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(40);
cell.setCellValue("住址");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(41);
cell.setCellValue("邮编");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(42);
cell.setCellValue("手机");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(43);
cell.setCellValue("QQ");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(44);
cell.setCellValue("固定电话");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(45);
cell.setCellValue("微信");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(46);
cell.setCellValue("备注");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(47);
cell.setCellValue("*采样编号");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(48);
cell.setCellValue("采血者");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(49);
cell.setCellValue("*采样时间");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(50);
cell.setCellValue("信息初审者");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(51);
cell.setCellValue("数据录入者");
cell.setCellStyle(cellTopStyle);
cell = row.createCell(52);
cell.setCellValue("数据审核者");
cell.setCellStyle(cellTopStyle);
XSSFCellStyle cellStyle=wb.createCellStyle(); XSSFCellStyle cellStyle=wb.createCellStyle();
cellStyle.setWrapText(true); cellStyle.setWrapText(true);
...@@ -725,10 +932,9 @@ public class UserController extends BaseController<Object>{ ...@@ -725,10 +932,9 @@ public class UserController extends BaseController<Object>{
XSSFRow rows; XSSFRow rows;
XSSFCell cells; XSSFCell cells;
for (int i = 0; i < user.size(); i++) { for (int i = 0; i < user.size(); i++) {
// 第三步:在这个sheet页里创建一行
rows = sheet.createRow(i+2); rows = sheet.createRow(i+2);
rows.setHeightInPoints(70); //rows.setHeightInPoints(70);
// 第四步:在该行创建一个单元格
User data = user.get(i); User data = user.get(i);
...@@ -736,6 +942,265 @@ public class UserController extends BaseController<Object>{ ...@@ -736,6 +942,265 @@ public class UserController extends BaseController<Object>{
cells.setCellValue(data.getName()); cells.setCellValue(data.getName());
cells.setCellStyle(cellStyle); cells.setCellStyle(cellStyle);
cells = rows.createCell(1);
cells.setCellValue("");
cells.setCellStyle(cellStyle);
cells = rows.createCell(2);
cells.setCellValue(data.getGender());
cells.setCellStyle(cellStyle);
cells = rows.createCell(3);
cells.setCellValue(data.getBirthday());
cells.setCellStyle(cellStyle);
cells = rows.createCell(4);
cells.setCellValue(data.getPaperType());
cells.setCellStyle(cellStyle);
cells = rows.createCell(5);
cells.setCellValue(data.getPaperId());
cells.setCellStyle(cellStyle);
cells = rows.createCell(6);
cells.setCellValue(data.getNation());
cells.setCellStyle(cellStyle);
cells = rows.createCell(7);
cells.setCellValue(data.getNativePlace());
cells.setCellStyle(cellStyle);
cells = rows.createCell(8);
cells.setCellValue(data.getNationality());
cells.setCellStyle(cellStyle);
cells = rows.createCell(9);
cells.setCellValue(data.getEducation());
cells.setCellStyle(cellStyle);
cells = rows.createCell(10);
cells.setCellValue(data.getDomicilePlace());
cells.setCellStyle(cellStyle);
cells = rows.createCell(11);
cells.setCellValue("");
cells.setCellStyle(cellStyle);
cells = rows.createCell(12);
cells.setCellValue(data.getAddr());
cells.setCellStyle(cellStyle);
cells = rows.createCell(13);
cells.setCellValue("");
cells.setCellStyle(cellStyle);
cells = rows.createCell(14);
cells.setCellValue(data.getUnit());
cells.setCellStyle(cellStyle);
cells = rows.createCell(15);
cells.setCellValue(data.getProfession());
cells.setCellStyle(cellStyle);
cells = rows.createCell(16);
cells.setCellValue(data.getUnitAddr());
cells.setCellStyle(cellStyle);
cells = rows.createCell(17);
cells.setCellValue("");
cells.setCellStyle(cellStyle);
cells = rows.createCell(18);
cells.setCellValue(data.getUnitTel());
cells.setCellStyle(cellStyle);
cells = rows.createCell(19);
cells.setCellValue(data.getMobile());
cells.setCellStyle(cellStyle);
cells = rows.createCell(20);
cells.setCellValue(data.getTel());
cells.setCellStyle(cellStyle);
cells = rows.createCell(21);
cells.setCellValue(data.getQq());
cells.setCellStyle(cellStyle);
cells = rows.createCell(22);
cells.setCellValue(data.getEmail());
cells.setCellStyle(cellStyle);
cells = rows.createCell(23);
if (data.getDonateBloodCount()==null) {
cells.setCellValue(0);
} else {
cells.setCellValue(data.getDonateBloodCount());
}
cells.setCellStyle(cellStyle);
cells = rows.createCell(24);
cells.setCellValue(data.getBloodType());
cells.setCellStyle(cellStyle);
cells = rows.createCell(25);
cells.setCellValue(data.getHeight());
cells.setCellStyle(cellStyle);
cells = rows.createCell(26);
cells.setCellValue(data.getWeight());
cells.setCellStyle(cellStyle);
cells = rows.createCell(27);
cells.setCellValue(data.getWeixin());
cells.setCellStyle(cellStyle);
cells = rows.createCell(28);
cells.setCellValue(data.getRemark());
cells.setCellStyle(cellStyle);
Set<Contacts> contacts = data.getContacts();
Iterator<Contacts> its = contacts.iterator();
Integer count = 0;
while (its.hasNext()) {
Contacts c = its.next();
if (count == 0) {
cells = rows.createCell(29);
cells.setCellValue(c.getName());
cells.setCellStyle(cellStyle);
cells = rows.createCell(30);
cells.setCellValue(c.getRelation());
cells.setCellStyle(cellStyle);
cells = rows.createCell(31);
cells.setCellValue(c.getAddr());
cells.setCellStyle(cellStyle);
cells = rows.createCell(32);
cells.setCellValue("");
cells.setCellStyle(cellStyle);
cells = rows.createCell(33);
cells.setCellValue(c.getMobile());
cells.setCellStyle(cellStyle);
cells = rows.createCell(34);
cells.setCellValue(c.getQq());
cells.setCellStyle(cellStyle);
cells = rows.createCell(35);
cells.setCellValue("");
cells.setCellStyle(cellStyle);
cells = rows.createCell(36);
cells.setCellValue(c.getWeixin());
cells.setCellStyle(cellStyle);
cells = rows.createCell(37);
cells.setCellValue("");
cells.setCellStyle(cellStyle);
count ++;
} else {
cells = rows.createCell(38);
cells.setCellValue(c.getName());
cells.setCellStyle(cellStyle);
cells = rows.createCell(39);
cells.setCellValue(c.getRelation());
cells.setCellStyle(cellStyle);
cells = rows.createCell(40);
cells.setCellValue(c.getAddr());
cells.setCellStyle(cellStyle);
cells = rows.createCell(41);
cells.setCellValue("");
cells.setCellStyle(cellStyle);
cells = rows.createCell(42);
cells.setCellValue(c.getMobile());
cells.setCellStyle(cellStyle);
cells = rows.createCell(43);
cells.setCellValue(c.getQq());
cells.setCellStyle(cellStyle);
cells = rows.createCell(44);
cells.setCellValue("");
cells.setCellStyle(cellStyle);
cells = rows.createCell(45);
cells.setCellValue(c.getWeixin());
cells.setCellStyle(cellStyle);
cells = rows.createCell(46);
cells.setCellValue("");
cells.setCellStyle(cellStyle);
}
}
cells = rows.createCell(47);
cells.setCellValue("");
cells.setCellStyle(cellStyle);
cells = rows.createCell(48);
cells.setCellValue("");
cells.setCellStyle(cellStyle);
cells = rows.createCell(49);
cells.setCellValue("");
cells.setCellStyle(cellStyle);
cells = rows.createCell(50);
cells.setCellValue("");
cells.setCellStyle(cellStyle);
cells = rows.createCell(51);
cells.setCellValue("");
cells.setCellStyle(cellStyle);
cells = rows.createCell(52);
cells.setCellValue("");
cells.setCellStyle(cellStyle);
Set<Blood> blood = data.getBlood();
Iterator<Blood> bits = blood.iterator();
while (bits.hasNext()) {
Blood b = bits.next();
cells = rows.createCell(47);
cells.setCellValue(b.getBloodId());
cells.setCellStyle(cellStyle);
cells = rows.createCell(48);
cells.setCellValue(b.getBloodCollect());
cells.setCellStyle(cellStyle);
cells = rows.createCell(49);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
cells.setCellValue(sdf.format(b.getUpdateTime()));
cells.setCellStyle(cellStyle);
cells = rows.createCell(50);
cells.setCellValue("");
cells.setCellStyle(cellStyle);
cells = rows.createCell(51);
cells.setCellValue("");
cells.setCellStyle(cellStyle);
cells = rows.createCell(52);
cells.setCellValue(b.getReview());
cells.setCellStyle(cellStyle);
}
......
package com.qiankun.dao;
import com.qiankun.dao.core.IDao;
import com.qiankun.entity.Points;
public interface PointsTypeDao extends IDao<Points, String> {
}
package com.qiankun.dao;
import org.springframework.stereotype.Repository;
import com.qiankun.dao.core.AbsDao;
import com.qiankun.entity.Points;
@Repository
public class PointsTypeDaoImpl extends AbsDao<Points, String> implements PointsTypeDao {
}
package com.qiankun.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Gift {
@Id
@GenericGenerator(name = "systemUUID", strategy = "uuid2")
@GeneratedValue(generator = "systemUUID")
private String id;
private String name; //礼品名称
private String content; //礼品介绍
private String point; //礼品积分
private String uploadImage;//礼物照片路径
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getPoint() {
return point;
}
public void setPoint(String point) {
this.point = point;
}
public String getUploadImage() {
return uploadImage;
}
public void setUploadImage(String uploadImage) {
this.uploadImage = uploadImage;
}
}
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;
...@@ -25,14 +22,10 @@ public class Points { ...@@ -25,14 +22,10 @@ public class Points {
private String name; //名称 private String name; //名称
private String type; //积分类别 private Long point; //积分
private Integer point; //积分
@ManyToOne private boolean available; //是否可用
private User user = new User();
private Date updateTime = new Date();
public String getId() { public String getId() {
return id; return id;
...@@ -50,42 +43,21 @@ public class Points { ...@@ -50,42 +43,21 @@ public class Points {
this.name = name; this.name = name;
} }
public String getType() { public Long getPoint() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Integer getPoint() {
return point; return point;
} }
public void setPoint(Integer point) { public void setPoint(Long point) {
this.point = point; this.point = point;
} }
public User getUser() { public boolean isAvailable() {
return user; return available;
}
public void setUser(User user) {
this.user = user;
} }
public Date getUpdateTime() { public void setAvailable(boolean available) {
return updateTime; this.available = available;
} }
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
} }
...@@ -90,7 +90,7 @@ public class User { ...@@ -90,7 +90,7 @@ public class User {
@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL}, orphanRemoval = true, mappedBy = "user") @OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL}, orphanRemoval = true, mappedBy = "user")
@JsonIgnore @JsonIgnore
private Set<Points> points = new HashSet<Points>(); private Set<UserPoints> points = new HashSet<UserPoints>();
private Boolean isRemove=false;//是否删除用户,默认false private Boolean isRemove=false;//是否删除用户,默认false
...@@ -301,10 +301,10 @@ public class User { ...@@ -301,10 +301,10 @@ public class User {
public void setStatus(String status) { public void setStatus(String status) {
this.status = status; this.status = status;
} }
public Set<Points> getPoints() { public Set<UserPoints> getPoints() {
return points; return points;
} }
public void setPoints(Set<Points> points) { public void setPoints(Set<UserPoints> points) {
this.points = points; this.points = points;
} }
public String getWeixin() { public String getWeixin() {
......
package com.qiankun.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class UserGift {
@Id
@GenericGenerator(name = "systemUUID", strategy = "uuid2")
@GeneratedValue(generator = "systemUUID")
private String id;
private String name; //礼品名称
private String content; //礼品介绍
private String point; //礼品积分
private String uploadImage;//礼物照片路径
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getPoint() {
return point;
}
public void setPoint(String point) {
this.point = point;
}
public String getUploadImage() {
return uploadImage;
}
public void setUploadImage(String uploadImage) {
this.uploadImage = uploadImage;
}
}
package com.qiankun.entity;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class UserPoints {
@Id
@GenericGenerator(name = "systemUUID", strategy = "uuid2")
@GeneratedValue(generator = "systemUUID")
private String id;
@ManyToOne
private Points type = new Points(); //积分类别
private Long point; //积分
@ManyToOne
private User user = new User();
private Date updateTime = new Date();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Points getType() {
return type;
}
public void setType(Points type) {
this.type = type;
}
public Long getPoint() {
return point;
}
public void setPoint(Long point) {
this.point = point;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
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.PointsTypeDao;
import com.qiankun.entity.Points;
@Service
public class PointsService {
@Autowired
private PointsTypeDao typeDao;
public Points findById(String id) {
Points type = typeDao.find(id);
return type;
}
@Transactional
public Points saveType(Points type) {
return typeDao.save(type);
}
@Transactional
public void removeType(String id) {
typeDao.remove(id);
}
public List<Points> findAllType() {
List<Points> list = typeDao.findAll();
return list;
}
}
...@@ -278,14 +278,14 @@ ...@@ -278,14 +278,14 @@
</li> </li>
<li> <li>
<a href="widgets.html"> <a href="/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="calendar.html"> <a href="#">
<i class="icon-briefcase "></i> <i class="icon-briefcase "></i>
<span class="menu-text"> <span class="menu-text">
...@@ -306,14 +306,14 @@ ...@@ -306,14 +306,14 @@
<ul class="submenu"> <ul class="submenu">
<li> <li>
<a href="profile.html"> <a href="#">
<i class="icon-double-angle-right"></i> <i class="icon-double-angle-right"></i>
消息设置 消息设置
</a> </a>
</li> </li>
<li> <li>
<a href="inbox.html"> <a href="#">
<i class="icon-double-angle-right"></i> <i class="icon-double-angle-right"></i>
消息管理 消息管理
</a> </a>
......
<%@ 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="typeForm" name="typeForm" method="post" onsubmit="return false" class="form-horizontal" role="form">
<input type="hidden" id="id" name="id" value="${type.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="${type.name}"/>
</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="${type.point}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-input-readonly"> 状态 </label>
<div class="col-sm-9">
<select name="available" id="available" class="col-xs-10 col-sm-10">
<option value="true" <c:if test="${activity.available==true}">selected</c:if>>正常</option>
<option value="false" <c:if test="${activity.available==false}">selected</c:if>>关闭</option>
</select>
</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/points/points.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">
<div class="widget-toolbox">
<div class="btn-group">
<button class="btn btn-sm btn-success" onclick="window.location.href='<webpath:path/>/points/type/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 width="100">操作</th>
</tr>
</thead>
<tbody>
<c:forEach var="type" items="${typelist}">
<tr class="tr-highlight">
<td title="">${type.name}</td>
<td title="">${type.point}</td>
<td title=""> <c:if test="${type.available}"><font color=green>正常</font></c:if><c:if test="${!type.available}"><font color=red>关闭</font></c:if></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/>/points/type/add?id=${type.id}'">
<i class="icon-edit bigger-120"></i>
</button>
&nbsp;
<button class="btn btn-xs btn-danger" onclick="points.remove('${type.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/points/points.js" type="text/javascript"></script>
\ No newline at end of file
var isSubmit = true;
$(document).ready(function(){
if ($('#typeForm').length>0){
$('#typeForm').validate({
rules : {
"name" : {
required : true
},
"point" : {
required : true
}
},
messages:{
"name" : {
required : "不能为空"
},
"point" : {
required : "不能为空"
}
},
submitHandler: function(form){
points.save(form);
}
});
}
})
var points = {
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 + '/points/type/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('id', $('#id').val());
formData.append('name', $('#name').val());
formData.append('point', $('#point').val());
formData.append('available', $('#available').val());
$.ajax({
url: webPath + '/points/type/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 + '/points/type/list';
}
},
"success":{
"label":"继续添加",
"className":"btn-sm btn-primary",
"callback": function () {
window.location.href = webPath + '/points/type/add';
}
}
}
});
} else if (status == 2){
isSubmit = true;
bootbox.dialog({
message:"修改成功",
buttons:{
"success":{
"label":"确定",
"className":"btn-sm btn-primary",
"callback": function () {
window.location.reload();
}
}
}
});
}
}
});
}
},
search : function(){
var type = $("#type").val();
var searchStr = $("#searchStr").val();
var url = webPath + "/activity/list";
if(type!="" || searchStr!=""){
var param = "?"
if (type != ""){
param = param + "type=" + type ;
}
if (searchStr != ""){
if (param == "?"){
param = param + "searchStr=" + searchStr;
} else {
param = param + "&searchStr=" + searchStr;
}
}
url = url + param;
}
window.location.href = url;
}
}
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