| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683 |
- package com.goafanti.user.service.impl;
- import java.util.ArrayList;
- import java.util.Calendar;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import java.util.UUID;
- import org.apache.commons.lang3.StringUtils;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.BeanUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.cache.annotation.CacheEvict;
- import org.springframework.stereotype.Service;
- import com.goafanti.app.bo.ExpertsListBo;
- import com.goafanti.app.bo.consultantListBo;
- import com.goafanti.common.bo.ReletivelyIndustry;
- import com.goafanti.common.bo.Result;
- import com.goafanti.common.bo.fieldGlossoryBo;
- import com.goafanti.common.constant.AFTConstants;
- import com.goafanti.common.dao.DistrictGlossoryMapper;
- import com.goafanti.common.dao.IndustryCategoryMapper;
- import com.goafanti.common.dao.JtCollectSearchMapper;
- import com.goafanti.common.dao.NoticeMapper;
- import com.goafanti.common.dao.UserIdentityMapper;
- import com.goafanti.common.dao.UserInterestMapper;
- import com.goafanti.common.dao.UserMapper;
- import com.goafanti.common.dao.UserRoleMapper;
- import com.goafanti.common.enums.AchievementAuditStatus;
- import com.goafanti.common.enums.CertifySubmitType;
- import com.goafanti.common.enums.IdentityAuditStatus;
- import com.goafanti.common.enums.NoticeReadStatus;
- import com.goafanti.common.enums.NoticeStatus;
- import com.goafanti.common.enums.SocietyTagStatus;
- import com.goafanti.common.enums.UserLevel;
- import com.goafanti.common.enums.collectType;
- import com.goafanti.common.model.JtCollectSearch;
- import com.goafanti.common.model.Notice;
- import com.goafanti.common.model.User;
- import com.goafanti.common.model.UserIdentity;
- import com.goafanti.common.utils.LoggerUtils;
- import com.goafanti.core.mybatis.BaseMybatisDao;
- import com.goafanti.core.mybatis.page.Pagination;
- import com.goafanti.core.shiro.token.TokenManager;
- import com.goafanti.portal.bo.UserSubscriberListBo;
- import com.goafanti.user.bo.Advertisings;
- import com.goafanti.user.bo.AuditorUserIdentityDetailBo;
- import com.goafanti.user.bo.CustomerAuditListBo;
- import com.goafanti.user.bo.InputUserIdentity;
- import com.goafanti.user.bo.MyInterestedBo;
- import com.goafanti.user.bo.UserIdentityBo;
- import com.goafanti.user.bo.UserIdentityDetailAdminBo;
- import com.goafanti.user.service.UserIdentityService;
- @Service
- public class UserIdentityServiceImpl extends BaseMybatisDao<UserIdentityMapper> implements UserIdentityService {
- @Autowired
- private UserIdentityMapper userIdentityMapper;
- @Autowired
- private UserMapper userMapper;
- @Autowired
- private UserRoleMapper userRoleMapper;
- @Autowired
- private NoticeMapper noticeMapper;
- @Autowired
- DistrictGlossoryMapper districtGlossoryMapper;
- @Autowired
- IndustryCategoryMapper industryCategoryMapper;
- @Autowired
- UserInterestMapper userInterestMapper;
- @Autowired
- JtCollectSearchMapper jtCollectSearchMapper;
- @Value(value="${collect_flag}")
- private Boolean collectFlag ;
-
- private static final Logger logger = LoggerFactory.getLogger(UserIdentityServiceImpl.class);
- @Override
- public UserIdentity selectUserIdentityByUserId(String uid) {
- return userIdentityMapper.selectUserIdentityByUserId(uid);
- }
- @Override
- public UserIdentity insert(UserIdentity userIdentity) {
- userIdentityMapper.insert(userIdentity);
- return userIdentity;
- }
- @Override
- public int updateByPrimaryKeySelective(UserIdentity userIdentity) {
- return userIdentityMapper.updateByPrimaryKeySelective(userIdentity);
- }
- @Override
- public UserIdentityBo selectUserIdentityBoByUserId(String uid) {
- return userIdentityMapper.selectUserIdentityBoByUserId(uid);
- }
- @Override
- public int updateByPrimaryKey(UserIdentity u) {
- return userIdentityMapper.updateByPrimaryKey(u);
- }
- @Override
- public int saveUserIdentityProcess(Result res, UserIdentity userIdentity, String uid) {
- UserIdentity identity = userIdentityMapper.selectUserIdentityByUserId(uid);
- if (null == identity) {
- userIdentity.setId(UUID.randomUUID().toString());
- userIdentity.setUid(uid);
- userIdentity.setWrongCount(0);
- userIdentity.setAuditStatus(0);
- return userIdentityMapper.insert(userIdentity);
- } else {
- userIdentity.setId(identity.getId());
- if (null != userIdentity.getAuditStatus() && 5 == userIdentity.getAuditStatus()) {
- User u = new User();
- u.setId(userIdentity.getUid());
- u.setLvl(1);
- userMapper.updateByPrimaryKeySelective(u);
- }
- return userIdentityMapper.updateByPrimaryKeySelective(userIdentity);
- }
- }
- @Override
- public int updateUserDetail(UserIdentity u, String saveSign, Integer level) {
- User user = userMapper.selectByPrimaryKey(u.getUid());
- if (!UserLevel.GENERAL.getCode().equals(user.getLvl())
- && !CertifySubmitType.SUBMIT.getCode().equals(saveSign)) {
- user.setLvl(level);
- userMapper.updateByPrimaryKeySelective(user);
- }
- if (CertifySubmitType.SUBMIT.getCode().equals(saveSign)) {
- createAuditorNotice(user);
- }
- return userIdentityMapper.updateByPrimaryKeySelective(u);
- }
- @Override
- public int updateUserDetailByAuditAdmin(UserIdentity ui, String aid, String mid, Integer level) {
- // 审核员UPDATE_USER_DETAIL
- User user = userMapper.selectByPrimaryKey(ui.getUid());
- if (!IdentityAuditStatus.PASSED.getCode().equals(ui.getAuditStatus())) {
- user.setLvl(UserLevel.GENERAL.getCode());
- userMapper.updateByPrimaryKeySelective(user);
- createNotice(user, ui.getAuditStatus());
- }
- if (IdentityAuditStatus.PASSED.getCode().equals(ui.getAuditStatus())) {
- /*
- * if (UserLevel.GENERAL.getCode().equals(level)) {
- * user.setLvl(UserLevel.CERTIFIED.getCode()); }
- */
- user.setLvl(UserLevel.CERTIFIED.getCode());
- user.setAid(aid);
- user.setMid(mid);
- userMapper.updateByPrimaryKeySelective(user);
- createNotice(user, ui.getAuditStatus());
- }
- return userIdentityMapper.updateByPrimaryKeySelective(ui);
- }
- @Override
- public UserIdentity insertByAdmin(UserIdentity ui, String saveSign) {
- userIdentityMapper.insert(ui);
- User u = userMapper.selectByPrimaryKey(ui.getUid());
- if (!TokenManager.hasRole(AFTConstants.AUDITORADMIN) && !TokenManager.hasRole(AFTConstants.SUPERADMIN)
- && CertifySubmitType.SUBMIT.getCode().equals(saveSign)) {
- u.setAid(TokenManager.getAdminId());
- userMapper.updateByPrimaryKeySelective(u);
- createAuditorNotice(u);
- }
- return ui;
- }
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<UserSubscriberListBo> listSubscriber(String url,String name, Integer level, String field, Integer province,
- Integer city, Integer area, Integer international, Integer pNo, Integer pSize, Integer auditStatus) {
- Map<String, Object> params = new HashMap<>();
- if (StringUtils.isNotBlank(url)) {
- params.put("url", url);
- }
- if (StringUtils.isNotBlank(name)) {
- params.put("name", name);
- }
- if (null != level) {
- params.put("level", level);
- }
- if (StringUtils.isNotBlank(field)) {
- params.put("field", field);
- }
- if (null != province) {
- params.put("province", province);
- }
- if (null != city) {
- params.put("city", city);
- }
- if (null != area) {
- params.put("area", area);
- }
- if (null != international) {
- params.put("international", international);
- }
- if (pNo == null || pNo < 0) {
- pNo = 1;
- }
- if (pSize == null || pSize < 0 || pSize > 12) {
- pSize = 12;
- }
- if (null != auditStatus) {
- params.put("auditStatus", auditStatus);
- }
- return (Pagination<UserSubscriberListBo>) findPage("findSearchSubscriberListByPage",
- "findSearchSubscriberCount", params, pNo, pSize);
- }
- // 给业务员及客户经理发送通知
- private void createNotice(User u, Integer status) {
- if (!StringUtils.isBlank(u.getAid())) {
- Notice n = new Notice();
- n.setPid(u.getAid());
- n.setAid(u.getAid());
- n.setUid(u.getId());
- notice(n, status);
- }
- if (!StringUtils.isBlank(u.getMid())) {
- Notice n = new Notice();
- n.setUid(u.getId());
- n.setAid(u.getMid());
- if (!StringUtils.isBlank(u.getAid())) {
- n.setPid(u.getAid());
- }
- notice(n, status);
- }
- }
- // 给所有审核员发送审核通知
- private void createAuditorNotice(User u) {
- List<String> ids = userRoleMapper.listAuditor();
- List<Notice> list = new ArrayList<>();
- if (null != ids && ids.size() > 0) {
- for (String s : ids) {
- Notice n = new Notice();
- Calendar now = Calendar.getInstance();
- now.set(Calendar.MILLISECOND, 0);
- n.setId(UUID.randomUUID().toString());
- n.setCreateTime(now.getTime());
- n.setReaded(NoticeReadStatus.UNREAD.getCode());
- if (null != u) {
- n.setPid(u.getAid());
- }
- n.setUid(u.getId());
- n.setAid(s);
- n.setContent(NoticeStatus.PERSONALCERTIFY.getDesc() + " " + IdentityAuditStatus.COMMITTED.getDesc());
- n.setNoticeType(NoticeStatus.PERSONALCERTIFY.getCode());
- list.add(n);
- }
- noticeMapper.insertBatch(list);
- }
- }
- @Override
- public AuditorUserIdentityDetailBo selectAuditorUserIdentityByUserId(String uid) {
- return userIdentityMapper.selectAuditorUserIdentityByUserId(uid);
- }
- private void notice(Notice n, Integer status) {
- Calendar now = Calendar.getInstance();
- now.set(Calendar.MILLISECOND, 0);
- n.setId(UUID.randomUUID().toString());
- n.setCreateTime(now.getTime());
- n.setReaded(NoticeReadStatus.UNREAD.getCode());
- String content = NoticeStatus.PERSONALCERTIFY.getDesc();
- if (IdentityAuditStatus.UNCOMMITTED.getCode() == status) {
- content = content + " " + IdentityAuditStatus.UNCOMMITTED.getDesc();
- } else if (IdentityAuditStatus.COMMITTED.getCode() == status) {
- content = content + " " + IdentityAuditStatus.COMMITTED.getDesc();
- } else if (IdentityAuditStatus.UNPAID.getCode() == status) {
- content = content + " " + IdentityAuditStatus.UNPAID.getDesc();
- } else if (IdentityAuditStatus.PAID.getCode() == status) {
- content = content + " " + IdentityAuditStatus.PAID.getDesc();
- } else if (IdentityAuditStatus.PASSED.getCode() == status) {
- content = content + " " + IdentityAuditStatus.PASSED.getDesc();
- } else {
- content = content + " " + IdentityAuditStatus.NOTPASSED.getDesc();
- }
- n.setContent(content);
- n.setNoticeType(NoticeStatus.PERSONALCERTIFY.getCode());
- // noticeMapper.insert(n);
- }
- @Override
- public UserIdentityDetailAdminBo selectUserIdentityByUserIdAdmin(String uid) {
- UserIdentity ui = userIdentityMapper.selectUserIdentityByUserId(uid);
- User u = userMapper.selectByPrimaryKey(uid);
- UserIdentityDetailAdminBo bo = new UserIdentityDetailAdminBo();
- if (ui != null) {
- BeanUtils.copyProperties(ui, bo);
- }
- bo.setLevel(u.getLvl().toString());
- return bo;
- }
- @CacheEvict(value = "internationalUserList", allEntries = true)
- public void cleanInternationalUser() {
- LoggerUtils.debug(logger, "清除国际专家列表");
- }
- @Override
- public UserIdentityBo expertsDetail(String uid) {
- UserIdentityBo u=userIdentityMapper.selectUserIdentityByUid(uid);
- /* if (null!=u.getProvince()) {
- u.setProvince0(districtGlossoryMapper.selectByPrimaryKey(u.getProvince()).getName());
- }
- if (null!=u.getCity()) {
- u.setCity0(String.valueOf(districtGlossoryMapper.selectByPrimaryKey(u.getCity()).getName()));
- }
- if (null!=u.getArea()) {
- u.setArea0(String.valueOf(districtGlossoryMapper.selectByPrimaryKey(u.getArea()).getName()));
- }
- if (null!=u.getIndustry()) {
- u.setIndustry0(String.valueOf(industryCategoryMapper.selectByPrimaryKey(u.getIndustry()).getName()));
- }
- if (null!=u.getUid()) {
- u.setCountInterest(String.valueOf(userInterestMapper.countByToUid(u.getUid())));
- }
- String id=TokenManager.getUserId();
- if(TokenManager.isLogin()&&userInterestMapper.checkUidAndDid(uid,id)>0){
- u.setInterest("1");
- }else {
- u.setInterest("0");
- }
- */ return u;
- }
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<UserIdentityBo> expertsList(String name,String industry, Integer pNo, Integer pSize) {
- Map<String, Object> params = new HashMap<>();
- if (StringUtils.isNotBlank(industry)) {
- params.put("industry", industry);
- }
- if (StringUtils.isNotBlank(name)) {
- params.put("name", name);
- }
- if (pNo == null || pNo < 0) {
- pNo = 1;
- }
- if (pSize == null || pSize < 0 || pSize > 12) {
- pSize = 10;
- }
-
- Pagination<UserIdentityBo> p= (Pagination<UserIdentityBo>) findPage("findUserIdentityListByPage",
- "findUserIdentityCount", params, pNo, pSize);
- List<UserIdentityBo> l=(List<UserIdentityBo>) p.getList();
- /*for (UserIdentityBo u : l) {
- int i=userInterestMapper.countInterest(u.getUid());
- u.setCountInterest(String.valueOf(i));
- }*/
- return p;
- }
-
-
- @Override
- public List<fieldGlossoryBo> industryList() {
- List<fieldGlossoryBo> list=industryCategoryMapper.selectindustryList();
- return list;
- }
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<consultantListBo> consultantList(Integer pNo, Integer pSize) {
- Map<String, Object> params = new HashMap<>();
-
- if (pNo == null || pNo < 0) {
- pNo = 1;
- }
- if (pSize == null || pSize < 0 || pSize > 12) {
- pSize = 10;
- }
- Pagination<consultantListBo> p=(Pagination<consultantListBo>) findPage("findConsultantListByPage",
- "findConsultantCount", params, pNo, pSize);
-
- return p;
- }
- @Override
- public consultantListBo consultantDetail(String id) {
- consultantListBo c=userIdentityMapper.selectconsultantByUid(id);
- if (TokenManager.isLogin()&&userInterestMapper.checkUidAndDid(id, TokenManager.getUserId())>0) {
- c.setInterest("1");
- }else {
- c.setInterest("0");
- }
- return c;
- }
- @Override
- public List<Advertisings> advertising() {
- List<String> a=new ArrayList<>();
- a.add("关于开展2018年度高新技术企业认定专项审计机构申报工作的通知");
- a.add("转发四川省经济和信息化委员会关于开展2017年上市补助申报通知的通知");
- a.add("关于组织企业参加第十三届中国重庆高新技术成果交易会暨第九届中国国际军民两用技术博览会的通知");
- a.add("关于组织参加第十三届中国重庆高新技术交易会暨第九届中国国际军民两用技术博览会的通知");
- List<Advertisings> ads=new ArrayList<>();
- int i=0;
- List<String> l=new ArrayList<>();
- for (String s : a) {
- i++;
- l.add(s);
- if (i%2==0) {
- ads.add(new Advertisings(l));
- l=new ArrayList<>();
- }
- }
-
- return ads;
- }
-
-
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<consultantListBo> portalConsultantList(Integer pNo, Integer pSize) {
- Pagination<consultantListBo> p=(Pagination<consultantListBo>) findPage("findConsultantListByPage",
- "findConsultantCount", new HashMap<>(), pNo, pSize);
- List<consultantListBo> list=(List<consultantListBo>) p.getList();
- for (consultantListBo c : list) {
- if (StringUtils.isNotBlank(TokenManager.getUserId())&&userInterestMapper.checkUidAndDid(c.getId(), TokenManager.getUserId())>0) {
- c.setInterest("1");
- }else {
- c.setInterest("0");
- }
- }
- return p;
- }
- @Override
- public consultantListBo portalconsultantDetail(String id) {
- consultantListBo c=userIdentityMapper.selectconsultantByUid(id);
- if (StringUtils.isNotBlank(TokenManager.getUserId())&&userInterestMapper.checkUidAndDid(id, TokenManager.getUserId())>0) {
- c.setInterest("1");
- }else {
- c.setInterest("0");
- }
- return c;
- }
- @Override
- public List<fieldGlossoryBo> domainList() {
- List<fieldGlossoryBo> list=industryCategoryMapper.selectDomainList();
- return list;
- }
- @Override
- public List<consultantListBo> getConsultantList(int size) {
- return userIdentityMapper.getConsultantList(size);
- }
- @Override
- public List<UserIdentityBo> getExperts(Integer size) {
- return userIdentityMapper.getExperts( size);
- }
- @Override
- public List<ReletivelyIndustry> selectIndustryReletively() {
- return industryCategoryMapper.selectIndustryReletively();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<UserIdentityBo> listInterestedExpert(Integer pageNo, Integer pageSize) {
- if(pageNo==null || pageNo<1)pageNo=1;
- if(pageSize==null ||pageSize<1)pageSize=10;
- Map<String, Object> params=new HashMap<String,Object>();
- params.put("uid", TokenManager.getUserId());
- // params.put("uid", "1180fa62-7c42-44be-bc41-5583814d69f4");
- return (Pagination<UserIdentityBo>) findPage("listInterestedExpert", "listInterestedExpertCount", params, pageNo, pageSize);
- }
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<MyInterestedBo> appMyInterestedExpert(Integer type,Integer pageNo, Integer pageSize) {
- if(pageNo==null || pageNo<1)pageNo=1;
- if(pageSize==null ||pageSize<1)pageSize=10;
- Map<String, Object> params=new HashMap<String,Object>();
- params.put("uid", TokenManager.getUserId());
- params.put("type", type);
- // params.put("uid", "1180fa62-7c42-44be-bc41-5583814d69f4");
- return (Pagination<MyInterestedBo>) findPage("appMyInterestedExpertList", "appMyInterestedExpertCount", params, pageNo, pageSize);
- }
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<MyInterestedBo> getExpertAuditList(
- InputUserIdentity identity, Integer pageNo, Integer pageSize) {
- if(pageNo==null || pageNo<1)pageNo=1;
- if(pageSize==null ||pageSize<1)pageSize=10;
- Map<String, Object> params=new HashMap<String,Object>();
- //将查询参数弄到map中
- if(null != identity.getAuditStatus()) params.put("auditStatus", identity.getAuditStatus());
- if(null != identity.getIndustry()) params.put("industry", identity.getIndustry());
- if(null != identity.getExpert()) params.put("expert", identity.getExpert());
- if(null != identity.getConsultantType()) params.put("consultantType", identity.getConsultantType());
- if(StringUtils.isBlank(identity.getUsername())) params.put("username", identity.getIdentifyName());
- return (Pagination<MyInterestedBo>) findPage("getExpertAuditList", "getExpertAuditListCount", params, pageNo, pageSize);
- }
- @Override
- public UserIdentity getUserIdentityByUid(String uid) {
- //获得用户的认证信息
- UserIdentity u = userIdentityMapper.getUserIdentityByUid(uid);
- return u;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<CustomerAuditListBo> selectCustomerAuditList(String name, String type, String identity,
- Integer pageNo, Integer pageSize) {
- if(pageNo==null || pageNo<1)pageNo=1;
- if(pageSize==null ||pageSize<1)pageSize=10;
- Map<String, Object> params=new HashMap<String,Object>();
- if(StringUtils.isNotBlank(name))params.put("name", name);
- if(StringUtils.isNotBlank(type))params.put("type", type);
- if(StringUtils.isNotBlank(identity))params.put("identity", identity);
- return (Pagination<CustomerAuditListBo>) findPage("selectCustomerAuditList", "selectCustomerAuditCount", params, pageNo, pageSize);
- }
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<ExpertsListBo> appExpertsList(String name, String industry,Integer sortType, Integer pageNo, Integer pageSize) {
- if(pageNo==null || pageNo<1)pageNo=1;
- if(pageSize==null ||pageSize<1)pageSize=10;
- Map<String, Object> params=new HashMap<String,Object>();
- if(StringUtils.isNotBlank(name))params.put("name", name);
- if(StringUtils.isNotBlank(industry))params.put("industry", industry);
- if(null!=sortType)params.put("sortType", sortType);
- if(StringUtils.isNotBlank(TokenManager.getUserId()))params.put("uid", TokenManager.getUserId());
- return (Pagination<ExpertsListBo>) findPage("selectCustomerAuditList", "selectCustomerAuditCount", params, pageNo, pageSize);
- }
- @Override
- public ExpertsListBo selectExpertsDetail(String id) {
- ExpertsListBo expertsListBo=userIdentityMapper.selectAppExpertsDetail(id,TokenManager.getUserId());
- expertsListBo.setCommentDetailResult(userIdentityMapper.expertsCommentByUid(id));
- return expertsListBo;
- }
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<ExpertsListBo> consultantList(String name, Integer sortType, Integer consultantType,
- Integer province, Integer city, Integer area, Integer pageNo, Integer pageSize) {
- if(pageNo==null || pageNo<1)pageNo=1;
- if(pageSize==null ||pageSize<1)pageSize=10;
- Map<String, Object> params=new HashMap<String,Object>();
- if(StringUtils.isNotBlank(name))params.put("name", name);
- if(null!=province)params.put("province", province);
- if(null!=city)params.put("city", city);
- if(null!=area)params.put("area", area);
- if(null!=consultantType)params.put("consultantType", consultantType);
- if(null!=sortType)params.put("sortType", sortType);
- if(StringUtils.isNotBlank(TokenManager.getUserId()))params.put("uid", TokenManager.getUserId());
- return (Pagination<ExpertsListBo>) findPage("appConsultantList", "appConsultantCount", params, pageNo, pageSize);
- }
- @Override
- public Integer updateAuditing(UserIdentity identity) {
- /*int auditStatus = AchievementAuditStatus.AUDITED.getCode().intValue();
- if(identity.getAuditStatus().intValue() == 0) {
- auditStatus=AchievementAuditStatus.UNAUDITED.getCode().intValue();
- }
- else auditStatus=AchievementAuditStatus.AUDITED.getCode().intValue();
- identity.setAuditStatus(auditStatus);*/
- if(collectFlag){
- ExpertsListBo u=userIdentityMapper.selectByIdentityId(identity.getId());
- if (identity.getAuditStatus()==2) {
- JtCollectSearch r=new JtCollectSearch();
- if(u.getExpert()==1){
- r.setFromTable(collectType.EXPERT.getDesc());
- }
- if(u.getExpert()==2){
- r.setFromTable(collectType.ADVISER.getDesc());
- }
- r.setKeyword(SocietyTagStatus.getStatus(u.getKeyword()).getDesc());
- r.setTitle(u.getUsername());
- r.setRowId(u.getUid());
- String sum = u.getIntroduction();
- if(null != sum && sum.length() > 40){
- sum = sum.substring(0,40) + "...";
- }
- r.setSummary(sum);
- jtCollectSearchMapper.insertSelective(r);
- }
-
- if (identity.getAuditStatus()==4||identity.getAuditStatus()==3) {
- if(collectFlag)jtCollectSearchMapper.deleteByrowId(u.getUid());
- }
- }
- return userIdentityMapper.updateAuditing(identity);
- }
-
- @Override
- public Integer updateUserIdentityDetail(InputUserIdentity identity) {
- Integer count = 0;
- //修改用户信息
- User user = new User();
- BeanUtils.copyProperties(identity, user);
- user.setId(TokenManager.getUserId());
- count += userMapper.updateByPrimaryKeySelective(user);
-
- //获得用户的认证信信息
- UserIdentity u = userIdentityMapper.selectUserIdentityByUserId(user.getId());
-
- UserIdentity ui = new UserIdentity();
- BeanUtils.copyProperties(identity, ui);
-
- //如果是法律顾问
- if(null != identity.getConsultantType() && identity.getConsultantType() == 4){
- ui.setWorkUnit(identity.getWorkUnit1());
- }
- if (null == u) {
- ui.setId(UUID.randomUUID().toString());
- ui.setUid(user.getId());
- if (identity.getExpert() > 0 && (identity.getAuditStatus() == AchievementAuditStatus.CREATE.getCode().intValue() || identity.getAuditStatus() == AchievementAuditStatus.UNAUDITED.getCode().intValue())) {
- ui.setAuditStatus(AchievementAuditStatus.SUBMIT.getCode().intValue());
- }
- count += userIdentityMapper.insert(ui);
- } else {
- //暂不认证 或者认证审核中/通过,只修改认证信息中的用户信息 1, 2
- if(identity.getExpert() == 0 || u.getAuditStatus() == AchievementAuditStatus.SUBMIT.getCode().intValue()
- || u.getAuditStatus() == AchievementAuditStatus.AUDITED.getCode().intValue()){
- UserIdentity ui1 = new UserIdentity();
- ui1.setId(u.getId());// 认证表id
- //允许修改为空字符但是不能是null(以防引发空指针异常)
- if(null != ui.getQq()) ui1.setQq(ui.getQq());
- if(null != ui.getSex()) ui1.setSex(ui.getSex());
- if(null != ui.getIdNumber()) ui1.setIdNumber(ui.getIdNumber());
- if(null != ui.getPostalAddress()) ui1.setPostalAddress(ui.getPostalAddress());
- if(null != ui.getFixedTel()) ui1.setFixedTel(ui.getFixedTel());
- if(null != ui.getEmail()) ui1.setEmail(ui.getEmail());
- if(null != ui.getDateOfBirthYear()) ui1.setDateOfBirthYear(ui.getDateOfBirthYear());
- if(null != ui.getDateOfBirthMonth()) ui1.setDateOfBirthMonth(ui.getDateOfBirthMonth());
- if(null != ui.getProvince()) ui1.setProvince(ui.getProvince());
- if(null != ui.getCity()) ui1.setCity(ui.getCity());
- if(null != ui.getArea()) ui1.setArea(ui.getArea());
- if(null != ui.getIndustry()) ui1.setIndustry(ui.getIndustry());
- count += userIdentityMapper.updateByPrimaryKeySelective(ui1);
- }
- //判断审核状态 当未审核或者审核不通过时 0, 3
- if (identity.getExpert() > 0 && (identity.getAuditStatus() == AchievementAuditStatus.CREATE.getCode().intValue() || identity.getAuditStatus() == AchievementAuditStatus.UNAUDITED.getCode().intValue())) {
- ui.setId(u.getId());
- ui.setAuditStatus(AchievementAuditStatus.SUBMIT.getCode().intValue());
- count += userIdentityMapper.updateByPrimaryKeySelective(ui);
- }else{// 正在审核中或者审核通过
- count = -1;
- }
- }
- return count;
- }
-
- }
|