| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- package com.goafanti.user.service.impl;
- import java.text.ParseException;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.Map;
- import java.util.UUID;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import com.goafanti.common.dao.OrganizationIdentityMapper;
- import com.goafanti.common.dao.OrganizationInfoMapper;
- import com.goafanti.common.dao.PatentCostMapper;
- import com.goafanti.common.dao.UserMapper;
- import com.goafanti.common.model.OrganizationIdentity;
- import com.goafanti.common.model.OrganizationInfo;
- import com.goafanti.common.model.User;
- import com.goafanti.common.utils.DateUtils;
- import com.goafanti.core.mybatis.BaseMybatisDao;
- import com.goafanti.core.mybatis.page.Pagination;
- import com.goafanti.user.bo.OrgListBo;
- import com.goafanti.user.bo.UserDownLoadBo;
- import com.goafanti.user.bo.UserListBo;
- import com.goafanti.user.bo.UserPageHomeBo;
- import com.goafanti.user.service.UserService;
- @Service
- public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserService {
- @Autowired
- UserMapper userMapper;
- @Autowired
- OrganizationInfoMapper organizationInfoMapper;
- @Autowired
- OrganizationIdentityMapper organizationIdentityMapper;
-
-
- @Override
- public User insertRegister(User user,String contacts,String companyName,String uid) {
- userMapper.insert(user);
- if (1 == user.getType()){
- if (!StringUtils.isBlank(companyName)){
- OrganizationInfo organizationInfo = new OrganizationInfo();
- organizationInfo.setUid(uid);
- organizationInfo.setCompanyName(companyName);
- organizationInfo.setId(UUID.randomUUID().toString());
- organizationInfoMapper.insert(organizationInfo);
- }
- if (!StringUtils.isBlank(contacts)){
- OrganizationIdentity organizationIdentity = new OrganizationIdentity();
- organizationIdentity.setUid(uid);
- organizationIdentity.setId(UUID.randomUUID().toString());
- organizationIdentity.setContacts(contacts);
- organizationIdentityMapper.insert(organizationIdentity);
- }
-
- }
- return user;
- }
-
- @Override
- public User selectByMobieAndType(java.lang.String mobile, Integer type) {
- return userMapper.selectByMobieAndType(mobile,type);
- }
-
- @Override
- public User selectByPrimaryKey(String id) {
- return userMapper.selectByPrimaryKey(id);
- }
- @Override
- public int updateByPrimaryKeySelective(User u) {
- return userMapper.updateByPrimaryKeySelective(u);
- }
- @Override
- public User insert(User user) {
- userMapper.insert(user);
- return user;
- }
- @Override
- public int updateByPrimaryKey(User u) {
- return userMapper.updateByPrimaryKey(u);
- }
- @Override
- public UserPageHomeBo selectUserPageHomeBoByUserId(String uid) {
- return userMapper.selectUserPageHomeBoByUserId(uid);
- }
- @Override
- public UserDownLoadBo selectUserDownLoadBoByUserId(String id) {
- return userMapper.selectUserDownLoadBoByUserId(id);
- }
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<UserListBo> listUser(String mobile, String email, String[] pDate, Integer number,
- String aftUsername, Integer auditStatus, Integer pageNo, Integer pageSize) throws ParseException {
- Map<String, Object> params = new HashMap<>();
- Date pStart = null;
- Date pEnd = null;
-
- if (null != pDate ){
- pStart = DateUtils.parseDate(pDate[0], "yyyy-MM-dd");
- if (pDate.length == 2){
- pEnd = DateUtils.addDays(DateUtils.parseDate(pDate[1], "yyyy-MM-dd"), 1);
- }
- }
-
- if (null != pStart){
- params.put("pStart", pStart);
- }
-
- if (null != pEnd){
- params.put("pEnd", pEnd);
- }
-
- if (!StringUtils.isBlank(mobile)){
- params.put("mobile", mobile);
- }
-
- if (!StringUtils.isBlank(email)){
- params.put("email", email);
- }
-
- if (null != number ){
- params.put("number", number);
- }
-
- if (!StringUtils.isBlank(aftUsername)){
- params.put("aftUsername", aftUsername);
- }
-
- if (null != auditStatus){
- params.put("auditStatus", auditStatus);
- }
-
- if (pageNo == null || pageNo < 0) {
- pageNo = 1;
- }
- if (pageSize == null || pageSize < 0) {
- pageSize = 10;
- }
- return (Pagination<UserListBo>) findPage("findUserListByPage","findUserCount", params, pageNo,
- pageSize);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Pagination<OrgListBo> listOrg(String mobile, String email, String[] pDate, Integer number,
- String aftUsername, Integer auditStatus, Integer pageNo, Integer pageSize) throws ParseException {
- Map<String, Object> params = new HashMap<>();
- Date pStart = null;
- Date pEnd = null;
-
- if (null != pDate ){
- pStart = DateUtils.parseDate(pDate[0], "yyyy-MM-dd");
- if (pDate.length == 2){
- pEnd = DateUtils.addDays(DateUtils.parseDate(pDate[1], "yyyy-MM-dd"), 1);
- }
- }
-
- if (null != pStart){
- params.put("pStart", pStart);
- }
-
- if (null != pEnd){
- params.put("pEnd", pEnd);
- }
-
- if (!StringUtils.isBlank(mobile)){
- params.put("mobile", mobile);
- }
-
- if (!StringUtils.isBlank(email)){
- params.put("email", email);
- }
-
- if (null != number ){
- params.put("number", number);
- }
-
- if (!StringUtils.isBlank(aftUsername)){
- params.put("aftUsername", aftUsername);
- }
-
- if (null != auditStatus){
- params.put("auditStatus", auditStatus);
- }
-
- if (pageNo == null || pageNo < 0) {
- pageNo = 1;
- }
- if (pageSize == null || pageSize < 0) {
- pageSize = 10;
- }
- return (Pagination<OrgListBo>) findPage("findOrgListByPage","findOrgCount", params, pageNo,
- pageSize);
- }
-
-
-
-
-
-
-
-
-
-
-
- }
|