Commit 255ed37e authored by liuchao's avatar liuchao

no message

parent 0330e93a
...@@ -329,7 +329,7 @@ public class UserController extends BaseController<Object>{ ...@@ -329,7 +329,7 @@ public class UserController extends BaseController<Object>{
@RequestMapping("/user/list") @RequestMapping("/user/list")
public ModelAndView userList(UserVo userVo, HttpServletResponse response, HttpServletRequest request) throws Exception { public ModelAndView userList(UserVo userVo, HttpServletResponse response, HttpServletRequest request) throws Exception {
ModelAndView view = new ModelAndView(); ModelAndView view = new ModelAndView();
IPageList<User> userPage = userService.findByUsers(userVo.getSearchStr(), userVo.getRole(), userVo.getStatus(), userVo.getOrder(), userVo.getSort(), IPageList<User> userPage = userService.findByUsers(userVo.getSearchStr(), userVo.getRole(), userVo.getStatus(), userVo.getChanged(), userVo.getOrder(), userVo.getSort(),
new Hints(getStartRow(request), getPageCount(request))); new Hints(getStartRow(request), getPageCount(request)));
view.getModelMap().addAttribute("userPage", userPage); view.getModelMap().addAttribute("userPage", userPage);
...@@ -353,6 +353,30 @@ public class UserController extends BaseController<Object>{ ...@@ -353,6 +353,30 @@ public class UserController extends BaseController<Object>{
return view; return view;
} }
@RequestMapping("/api/user/changed")
public ModelAndView changedUser(String id, HttpServletResponse response, HttpServletRequest request) throws Exception {
ModelAndView view = new ModelAndView();
User user = userService.findById(id);
user.setLastMobile(user.getMobile());
Set<Contacts> contacts = user.getContacts();
Iterator<Contacts> its = contacts.iterator();
//user.getContacts().clear();
while ( its.hasNext()) {
Contacts c = its.next();
c.setLastName(c.getName());
c.setLastMobile(c.getMobile());
//user.getContacts().add(c);
}
userService.save(user);
return view;
}
@RequestMapping("/user/importpage") @RequestMapping("/user/importpage")
public ModelAndView userImportPage(HttpServletResponse response, HttpServletRequest request) throws Exception { public ModelAndView userImportPage(HttpServletResponse response, HttpServletRequest request) throws Exception {
ModelAndView view = new ModelAndView(); ModelAndView view = new ModelAndView();
......
...@@ -11,7 +11,7 @@ public interface UserDao extends IDao<User, String> { ...@@ -11,7 +11,7 @@ public interface UserDao extends IDao<User, String> {
User findByPaperId(String paperId, String paperType); User findByPaperId(String paperId, String paperType);
IPageList<User> findUserPage(String searchStr, String role, String status, String order, String sort, Hints hints); IPageList<User> findUserPage(String searchStr, String role, String status, Boolean changed, String order, String sort, Hints hints);
User login(String userName, String password); User login(String userName, String password);
......
...@@ -13,7 +13,7 @@ import com.qiankun.pages.PageListImpl; ...@@ -13,7 +13,7 @@ import com.qiankun.pages.PageListImpl;
@Repository @Repository
public class UserDaoImpl extends AbsDao<User, String> implements UserDao { public class UserDaoImpl extends AbsDao<User, String> implements UserDao {
private static final String FIND_USER_PAGE = " from User where (mobile like ? or paperId like ? or name like ? or userName like ?) and remove=false "; private static final String FIND_USER_PAGE = " from User u join u.contacts c where (u.mobile like ? or u.paperId like ? or u.name like ? or u.userName like ?) and u.remove=false ";
// private static final String FIND_LASTUSER_BY_GROUP = " from User where groups = ? order by createTime desc"; // private static final String FIND_LASTUSER_BY_GROUP = " from User where groups = ? order by createTime desc";
...@@ -141,10 +141,10 @@ public class UserDaoImpl extends AbsDao<User, String> implements UserDao { ...@@ -141,10 +141,10 @@ public class UserDaoImpl extends AbsDao<User, String> implements UserDao {
@Override @Override
public IPageList<User> findUserPage(String searchStr, String role, String status,String order, String sort, Hints hints) { public IPageList<User> findUserPage(String searchStr, String role, String status, Boolean changed, String order, String sort, Hints hints) {
if (order == null){ if (order == null){
order = " createTime "; order = " u.createTime ";
} }
if (sort == null){ if (sort == null){
sort=" desc "; sort=" desc ";
...@@ -152,20 +152,26 @@ public class UserDaoImpl extends AbsDao<User, String> implements UserDao { ...@@ -152,20 +152,26 @@ public class UserDaoImpl extends AbsDao<User, String> implements UserDao {
String hql = ""; String hql = "";
if (role != null){ if (role != null){
hql += " and role = '" +role+ "' "; hql += " and u.role = '" +role+ "' ";
} }
if (status != null){ if (status != null){
hql += " and status = '" +status+ "' "; hql += " and u.status = '" +status+ "' ";
} }
if (searchStr == null) { if (searchStr == null) {
searchStr = "%"; searchStr = "%";
} }
String param = "%" + searchStr + "%"; String param = "%" + searchStr + "%";
if (changed != null && changed) {
hql += " and ( (u.mobile <> u.lastMobile) or (c.mobile <> c.lastMobile) or (c.name <> c.lastName) )";
}
IPageList<User> users = new PageListImpl<User>(); IPageList<User> users = new PageListImpl<User>();
users.setRecords(find(FIND_USER_PAGE + hql + sortHQL(order, sort), hints, param, param, param, param));
users.setRecordTotal(findCount(" select count(*) " + FIND_USER_PAGE + hql, param, param, param, param)); users.setRecords(find("select DISTINCT u " + FIND_USER_PAGE + hql + sortHQL(order, sort), hints, param, param, param, param));
users.setRecordTotal(findCount(" select count(DISTINCT u) " + FIND_USER_PAGE + hql, param, param, param, param));
return users; return users;
......
...@@ -79,7 +79,7 @@ public class User { ...@@ -79,7 +79,7 @@ public class User {
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; //是否删除用户,默认false
@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL}, orphanRemoval = true, mappedBy = "user") @OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL}, orphanRemoval = true, mappedBy = "user")
@JsonIgnore @JsonIgnore
...@@ -97,10 +97,6 @@ public class User { ...@@ -97,10 +97,6 @@ public class User {
@JsonIgnore @JsonIgnore
private Set<UserGift> gift = new HashSet<UserGift>(); private Set<UserGift> gift = new HashSet<UserGift>();
private Boolean isRemove=false;//是否删除用户,默认false
public String getId() { public String getId() {
return id; return id;
} }
...@@ -145,12 +141,7 @@ public class User { ...@@ -145,12 +141,7 @@ public class User {
public void setContacts(Set<Contacts> Contacts) { public void setContacts(Set<Contacts> Contacts) {
this.contacts = Contacts; this.contacts = Contacts;
} }
public Boolean getIsRemove() {
return isRemove;
}
public void setIsRemove(Boolean isRemove) {
this.isRemove = isRemove;
}
public String getName() { public String getName() {
return name; return name;
} }
......
...@@ -29,6 +29,12 @@ public class UserService { ...@@ -29,6 +29,12 @@ public class UserService {
return userDao.save(user); return userDao.save(user);
} }
@Transactional
public void update(User user) {
userDao.update(user);
}
@Transactional @Transactional
public void remove(String id) { public void remove(String id) {
userDao.remove(id); userDao.remove(id);
...@@ -39,8 +45,8 @@ public class UserService { ...@@ -39,8 +45,8 @@ public class UserService {
} }
public IPageList<User> findByUsers(String searchStr,String role, String status, String order,String sort, Hints hints){ public IPageList<User> findByUsers(String searchStr,String role, String status, Boolean changed, String order,String sort, Hints hints){
IPageList<User> users = userDao.findUserPage(searchStr, role, status, order, sort, hints); IPageList<User> users = userDao.findUserPage(searchStr, role, status, changed, order, sort, hints);
return users; return users;
} }
......
...@@ -74,6 +74,8 @@ public class UserVo { ...@@ -74,6 +74,8 @@ public class UserVo {
private String startbloodId; private String startbloodId;
private String endbloodId; private String endbloodId;
private Boolean changed;
public String getId() { public String getId() {
return id; return id;
} }
...@@ -451,6 +453,13 @@ public class UserVo { ...@@ -451,6 +453,13 @@ public class UserVo {
public void setLastContactsMobile2(String lastContactsMobile2) { public void setLastContactsMobile2(String lastContactsMobile2) {
this.lastContactsMobile2 = lastContactsMobile2; this.lastContactsMobile2 = lastContactsMobile2;
} }
public Boolean getChanged() {
return changed;
}
public void setChanged(Boolean changed) {
this.changed = changed;
}
} }
...@@ -48,7 +48,10 @@ ...@@ -48,7 +48,10 @@
</button> </button>
<button class="btn btn-sm btn-success" onclick="window.location.href='<webpath:path/>/user/list?changed=true'">
<i class="icon-user bigger-110"></i>
信息已变更的用户
</button>
</div> </div>
...@@ -173,6 +176,19 @@ ...@@ -173,6 +176,19 @@
<i class="icon-trash bigger-120"></i> <i class="icon-trash bigger-120"></i>
</button> </button>
<c:set var="contacts1" value="${user.getContacts().iterator().next()}" />
<c:set var="contacts2" value="${user.getContacts().iterator().next()}" />
<c:if test="${user.mobile != user.lastMobile || contacts1.getMobile() != contacts1.getLastMobile() || contacts2.getName() != contacts2.getLastName()}">
<button class="btn btn-xs btn-warning" onclick="user.changed('${user.id}')" title="变更处理">
<i class="icon-ok bigger-120"></i>
</button>
</c:if>
</div> </div>
......
...@@ -390,6 +390,37 @@ var user = { ...@@ -390,6 +390,37 @@ var user = {
}, },
//title: "bootbox confirm也可以添加标题哦", //title: "bootbox confirm也可以添加标题哦",
}); });
},
changed : 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 + '/api/user/changed?id='+id,
dataType:'json',
success: function(data){
window.location.reload();
}
})
} else {
}
},
//title: "bootbox confirm也可以添加标题哦",
});
} }
} }
......
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