272 lines
6.7 KiB
Plaintext
272 lines
6.7 KiB
Plaintext
package com.bonus.registration.service;
|
|
|
|
import com.bonus.core.DateTimeHelper;
|
|
import com.bonus.core.StringHelper;
|
|
import com.bonus.registration.beans.RegistrationBean;
|
|
import com.bonus.registration.dao.RegistrationDao;
|
|
import com.bonus.seat.beans.SeatBean;
|
|
import com.bonus.sys.AjaxRes;
|
|
import com.bonus.sys.BaseServiceImp;
|
|
import com.bonus.sys.Page;
|
|
import com.bonus.sys.beans.UserBean;
|
|
import com.bonus.sys.dao.UserDao;
|
|
import com.sun.xml.internal.ws.message.StringHeader;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import java.util.List;
|
|
|
|
@Service("RegistrationService")
|
|
public class RegistrationServiceImp extends BaseServiceImp<RegistrationBean> implements RegistrationService {
|
|
|
|
@Autowired
|
|
RegistrationDao dao;
|
|
|
|
@Autowired
|
|
UserDao userDao;
|
|
|
|
@Override
|
|
public Page<RegistrationBean> findByPage(RegistrationBean o, Page<RegistrationBean> page){
|
|
page.setResults(dao.findByPage(o,page));
|
|
return page;
|
|
}
|
|
|
|
@Override
|
|
@Transactional
|
|
public AjaxRes findUserByIdAndTimes(String o) {
|
|
AjaxRes ar = getAjaxRes();
|
|
try {
|
|
List<RegistrationBean> lists = dao.findUserByIdAndTimes(o);
|
|
UserBean ubean = userDao.findByidcard(o);
|
|
|
|
if(lists.size() >= 1) {
|
|
String userName = lists.get(0).getName();
|
|
ar.setRes(2);
|
|
ar.setResMsg(userName+"已报名第"+lists.get(0).getTimes()+"场次,请修改后重新导入");
|
|
}else if(ubean==null){
|
|
ar.setResMsg("身份证号码:"+o+"未在人员库中找到,请修改后重新导入");
|
|
ar.setRes(3);
|
|
}else {
|
|
ar.setRes(1);
|
|
}
|
|
|
|
} catch(Exception e) {
|
|
e.printStackTrace();
|
|
ar.setFailMsg("新增失败");
|
|
}
|
|
return ar;
|
|
}
|
|
|
|
@Override
|
|
@Transactional
|
|
public AjaxRes addRegistration(RegistrationBean o) {
|
|
AjaxRes ar = getAjaxRes();
|
|
try {
|
|
int count = dao.insert(o);
|
|
if(count == 1)
|
|
ar.setSucceedMsg("新增成功");
|
|
else
|
|
ar.setFailMsg("新增失败!");
|
|
} catch(Exception e) {
|
|
e.printStackTrace();
|
|
ar.setFailMsg("新增失败");
|
|
}
|
|
return ar;
|
|
}
|
|
|
|
@Override
|
|
public RegistrationBean findById(RegistrationBean o) {
|
|
return dao.findById(o);
|
|
}
|
|
|
|
@Override
|
|
public AjaxRes updateRegistration(RegistrationBean o) {
|
|
AjaxRes ar = getAjaxRes();
|
|
try {
|
|
int count = dao.update(o);
|
|
if(count == 1)
|
|
ar.setSucceedMsg("修改成功");
|
|
else
|
|
ar.setFailMsg("修改失败!");
|
|
} catch(Exception e) {
|
|
e.printStackTrace();
|
|
ar.setFailMsg("修改失败");
|
|
}
|
|
return ar;
|
|
}
|
|
|
|
@Override
|
|
public AjaxRes deleteApply(RegistrationBean o) {
|
|
AjaxRes ar = getAjaxRes();
|
|
try {
|
|
int count = dao.deleteApply(o);
|
|
if(count == 1)
|
|
ar.setSucceedMsg("删除成功");
|
|
else
|
|
ar.setFailMsg("删除失败!");
|
|
} catch(Exception e) {
|
|
e.printStackTrace();
|
|
ar.setFailMsg("删除失败");
|
|
}
|
|
return ar;
|
|
}
|
|
|
|
@Override
|
|
public RegistrationBean findByidcard(String idCard) {
|
|
// TODO Auto-generated method stub
|
|
return dao.findByidcard(idCard);
|
|
}
|
|
|
|
@Override
|
|
public RegistrationBean findExamProfess(RegistrationBean o) {
|
|
return dao.findExamProfess(o);
|
|
}
|
|
|
|
@Override
|
|
public Integer insertExamProfess(RegistrationBean o) {
|
|
return dao.insertExamProfess(o);
|
|
}
|
|
|
|
@Override
|
|
public List<RegistrationBean> showExamPerson(String id) {
|
|
// TODO Auto-generated method stub
|
|
return dao.showExamPerson(id);
|
|
}
|
|
|
|
@Override
|
|
public List<RegistrationBean> showExamingPerson(String id) {
|
|
// TODO Auto-generated method stub
|
|
return dao.showExamingPerson(id);
|
|
}
|
|
|
|
@Override
|
|
public List<RegistrationBean> findExamPerson(String id) {
|
|
// TODO Auto-generated method stub
|
|
return dao.findExamPerson(id);
|
|
}
|
|
|
|
@Override
|
|
public List<RegistrationBean> findMissingTest(String id) {
|
|
// TODO Auto-generated method stub
|
|
return dao.findMissingTest(id);
|
|
}
|
|
|
|
@Override
|
|
public AjaxRes changeIsActive(UserBean user) {
|
|
AjaxRes ar = getAjaxRes();
|
|
try {
|
|
int count = dao.changeIsActive(user);
|
|
if(count == 1)
|
|
ar.setSucceedMsg("修改成功");
|
|
else
|
|
ar.setFailMsg("修改失败!");
|
|
} catch(Exception e) {
|
|
e.printStackTrace();
|
|
ar.setFailMsg("修改失败");
|
|
}
|
|
return ar;
|
|
}
|
|
|
|
@Override
|
|
public Integer toUpdateTimes(RegistrationBean o) {
|
|
// TODO Auto-generated method stub
|
|
Integer res=0;
|
|
res = dao.toUpdateTimes(o);
|
|
return res;
|
|
}
|
|
|
|
@Override
|
|
public Integer toUpdateIsActive(RegistrationBean o) {
|
|
// TODO Auto-generated method stub
|
|
Integer res=0;
|
|
res = dao.toUpdateIsActive(o);
|
|
return res;
|
|
}
|
|
|
|
@Override
|
|
public Integer insertMissingTest(RegistrationBean o) {
|
|
return dao.insertMissingTest(o);
|
|
}
|
|
|
|
@Override
|
|
public Integer judgeExamPerson(UserBean user) {
|
|
Integer res = 0;
|
|
RegistrationBean reg = dao.judgeExamPerson(user);
|
|
if(reg.getIsActive()==0){
|
|
res = 0;
|
|
}else{
|
|
res = 1;
|
|
}
|
|
return res;
|
|
}
|
|
|
|
@Override
|
|
public void setExamId(RegistrationBean reg) {
|
|
dao.setExamId(reg);
|
|
}
|
|
|
|
@Override
|
|
public List<RegistrationBean> showPersonScoreResult(String id) {
|
|
return dao.showPersonScoreResult(id);
|
|
}
|
|
|
|
@Override
|
|
public List<RegistrationBean> findExamingPerson(SeatBean o) {
|
|
return dao.findExamingPerson(o);
|
|
}
|
|
|
|
@Override
|
|
public void sitesave(RegistrationBean getinfo) {
|
|
String currentDateTime = DateTimeHelper.currentDateTimedetail();
|
|
getinfo.setDateNow(currentDateTime);
|
|
dao.sitesave(getinfo);
|
|
}
|
|
|
|
@Override
|
|
public List<RegistrationBean> selectseatinfo(RegistrationBean o) {
|
|
return dao.selectseatinfo(o);
|
|
}
|
|
|
|
@Override
|
|
public Integer findbynowDate(RegistrationBean bean) {
|
|
String nowDate = DateTimeHelper.getNowDate();
|
|
bean.setDateNow(nowDate);
|
|
return dao.findbynowDate(bean);
|
|
}
|
|
|
|
@Override
|
|
public void updatebyidcard(RegistrationBean jsonToBean) {
|
|
// TODO Auto-generated method stub
|
|
RegistrationBean be=new RegistrationBean();
|
|
String nowDate = DateTimeHelper.currentDateTimedetail();
|
|
jsonToBean.setDateNow(nowDate);
|
|
be.setDateNow(nowDate);
|
|
be.setIdcard(jsonToBean.getIdcard());
|
|
/*dao.updatebyidcard(be); 不能删除的代码
|
|
dao.updatebyidcard(jsonToBean);*/
|
|
|
|
dao.updateEnroll(jsonToBean);
|
|
}
|
|
|
|
@Override
|
|
public RegistrationBean findnameByidcard(String idcard) {
|
|
// TODO Auto-generated method stub
|
|
return dao.findnameByidcard(idcard);
|
|
}
|
|
|
|
@Override
|
|
public List<RegistrationBean> findAlltestinfo(String examId) {
|
|
// TODO Auto-generated method stub
|
|
return dao.findAlltestinfo(examId);
|
|
}
|
|
|
|
@Override
|
|
public List<RegistrationBean> getnewinfoBytime() {
|
|
// TODO Auto-generated method stub
|
|
return dao.getnewinfoBytime();
|
|
}
|
|
|
|
}
|