Przeglądaj źródła

发起客户档案完善修改

anderx 1 rok temu
rodzic
commit
da87df9e2f

+ 25 - 39
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -24,7 +24,6 @@ import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.beanutils.PropertyUtils;
 import org.apache.ibatis.builder.BuilderException;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -42,13 +41,13 @@ import java.util.*;
 
 @Service
 public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements CustomerService {
-	@Autowired
+	@Resource
 	private UserMapper userMapper;
-	@Autowired
+	@Resource
 	private UserIdentityMapper userIdentityMapper;
-	@Autowired
+	@Resource
 	private OrganizationIdentityMapper organizationIdentityMapper;
-	@Autowired
+	@Resource
 	private OrganizationContactBookMapper organizationContactBookMapper;
 	@Resource(name = "passwordUtil")
 	private PasswordUtil passwordUtil;
@@ -108,13 +107,13 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 	private PublicReleaseLogMapper publicReleaseLogMapper;
 	@Resource
 	private PublicReleaseMapper publicReleaseMapper;
-	@Autowired
+	@Resource
 	private SystemWebSocketHandler systemWebSocketHandler;
-	@Autowired
+	@Resource
 	private AdminUserCountMapper adminUserCountMapper;
-	@Autowired
+	@Resource
 	private RestrictProjectMapper restrictProjectMapper;
-	@Autowired
+	@Resource
 	private	AsyncUtils asyncUtils;
 
 
@@ -123,7 +122,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 	@Value(value = "${upload.path}")
 	private String uploadPath = null;
 
-	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<CustomerListOut> listPrivatePersonalCustomer(CustomerListIn cli, Integer pageNo,
 			Integer pageSize) {
@@ -138,7 +136,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		return list;
 	}
 
-	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<CustomerListOut> listPublicPersonalCustomer(CustomerListIn cli, Integer pageNo,
 			Integer pageSize) {
@@ -149,7 +146,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		return list;
 	}
 
-	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<CustomerListOut> listAllPersonalCustomer(CustomerListIn cli, Integer pageNo, Integer pageSize) {
 		cli.setType(AFTConstants.USER_TYPE_PERSONAL);
@@ -159,7 +155,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		return list;
 	}
 
-	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<CustomerListOut> listAllManagePersonalCustomer(CustomerListIn cli, Integer pageNo,
 			Integer pageSize) {
@@ -171,7 +166,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		return list;
 	}
 
-	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<CustomerListOut> listPrivateOrganizationCustomer(CustomerListIn cli, Integer sort,
 			Integer sortType, Integer power, Integer pageNo, Integer pageSize) {
@@ -213,7 +207,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		return list;
 	}
 
-	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<CustomerListOut> listPublicOrganizationCustomer(CustomerListIn cli, Integer pageNo,
 			Integer pageSize) {
@@ -225,7 +218,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		return p;
 	}
 
-	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<CustomerListOut> listAllOrganizationCustomer(CustomerListIn cli, Integer pageNo,
 			Integer pageSize) {
@@ -278,8 +270,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		String newstr1=name.replaceAll(" ",","); //先把所有空格替换成 逗号。
 		String newstr2=newstr1.replaceAll("\t",",");  //再把所有的制表符替换成逗号。
 		String newstr3=newstr2.replaceAll(",+", ","); //把所有重复的逗号合并成一个逗号。
-		String[] strings=newstr3.split(",");     //按逗号分解该字符串。
-		return strings;
+        return newstr3.split(",");
 	}
 
 	@Override
@@ -289,11 +280,9 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		cli.setShareType(String.valueOf(AFTConstants.USER_SHARE_PRIVATE));
 		cli.setAid(TokenManager.getAdminId());
 		Map<String, Object> params = disposeParams(cli);
-		@SuppressWarnings("unchecked")
-		Pagination<CustomerListOut> list = (Pagination<CustomerListOut>) findPage(
+        return (Pagination<CustomerListOut>) findPage(
 				"selectManageOrganizationCustomerList", "selectManageOrganizationCustomerCount", params, pageNo,
 				pageSize);
-		return list;
 	}
 
 	private Map<String, Object> disposeParams(CustomerListIn cli) {
@@ -476,12 +465,11 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		String startTime=DateUtils.formatDate(transferTime,AFTConstants.YYYYMMDD);
 		String endTime=startTime+" 23:59:59";
 		AdminUserCount adminUserCount=getAdminUserCount(aid,startTime);
-		if (adminUserCount==null){
-			AdminUserCount selectAUC=userMapper.selectByaidAndDate(aid,startTime,endTime);
-			if(selectAUC!=null) adminUserCountMapper.insertSelective(selectAUC);
+        AdminUserCount selectAUC=userMapper.selectByaidAndDate(aid,startTime,endTime);
+        if (adminUserCount==null){
+            if(selectAUC!=null) adminUserCountMapper.insertSelective(selectAUC);
 		}else {
-			AdminUserCount selectAUC=userMapper.selectByaidAndDate(aid,startTime,endTime);
-			AdminUserCount newAUC=new AdminUserCount();
+            AdminUserCount newAUC=new AdminUserCount();
 			newAUC.setId(adminUserCount.getId());
 			if (selectAUC==null){
 				newAUC.setPrivateCount(0);
@@ -1007,16 +995,15 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 			String endTime=startTime+" 23:59:59";
 			AdminUserCount adminUserCount = getAdminUserCount(aid,startTime);
 			Integer count = userFollowMapper.selectByaidAndDate(aid, startTime, endTime);
-			if (adminUserCount==null){
-				AdminUserCount selectAUC=userMapper.selectByaidAndDate(aid,startTime,endTime);
-				if (selectAUC==null)selectAUC=new AdminUserCount();
+            AdminUserCount selectAUC=userMapper.selectByaidAndDate(aid,startTime,endTime);
+            if (adminUserCount==null){
+                if (selectAUC==null)selectAUC=new AdminUserCount();
 				selectAUC.setFollowCount(count);
 				selectAUC.setAid(aid);
 				selectAUC.setDateTime(transferTime);
 				adminUserCountMapper.insertSelective(selectAUC);
 			}else {
-				AdminUserCount selectAUC=userMapper.selectByaidAndDate(aid,startTime,endTime);
-				AdminUserCount newAUC=new AdminUserCount();
+                AdminUserCount newAUC=new AdminUserCount();
 				newAUC.setId(adminUserCount.getId());
 				newAUC.setFollowCount(count);
 				if (selectAUC==null){
@@ -1397,6 +1384,9 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		List<User> useList=new ArrayList<>();
 		List<User> newList=new ArrayList<>();
 		//领取
+		boolean typeFlag = AFTConstants.USER_TRANSFER_TO_OTHER.equals(operatorType)
+				|| AFTConstants.SIGN_USER_TRANSFER_TO_OTHER.equals(operatorType)
+				|| AFTConstants.CHANNEL_USER_TRANSFER_TO_OTHER.equals(operatorType);
 		if (AFTConstants.USER_RECEIVE.equals(operatorType)) {
 			User use = userMapper.selectByPrimaryKey(uid);
 			user.setAid(TokenManager.getAdminId());
@@ -1412,9 +1402,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 			updateUserMid(aid,uid,0,null);
 			organizationContactBookMapper.updateAdmin(uid,aid);
 			//转交
-		} else if (AFTConstants.USER_TRANSFER_TO_OTHER.equals(operatorType)
-				|| AFTConstants.SIGN_USER_TRANSFER_TO_OTHER .equals(operatorType)
-				|| AFTConstants.CHANNEL_USER_TRANSFER_TO_OTHER .equals(operatorType)) {
+		} else if (typeFlag) {
 
 			if (!isUs) {
 				user.setAid(aid);
@@ -1477,7 +1465,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 						throw new BusinessException(new Error(ErrorConstants.CUSTOMER_TRANSFER_FAIL, ""));
 				}
 			}
-			Integer type = 2;
+			int type = 2;
 			if (AFTConstants.SIGN_USER_TRANSFER_TO_OTHER == operatorType)type = 7;
 
 			addUserTransferLog(uid, aid,oldAid, type, null, now, uList);
@@ -1485,7 +1473,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 			transferUser(uList,aid,uid);
 		}
 		if (isUs) {
-			if (AFTConstants.USER_RECEIVE == operatorType) {
+			if (AFTConstants.USER_RECEIVE.equals(operatorType)) {
 				userMapper.updateList(aid, null, 3, null, 2, uList,null);
 			} else {
 				userMapper.updateList(aid, null, 3, null, null, uList,data);
@@ -1497,9 +1485,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		if (AFTConstants.USER_RECEIVE.equals(operatorType)){
 			updateAdminUserCount(user.getAid(),user.getTransferTime());
 		}
-		if (AFTConstants.USER_TRANSFER_TO_OTHER.equals(operatorType)
-				|| AFTConstants.SIGN_USER_TRANSFER_TO_OTHER .equals(operatorType)
-				|| AFTConstants.CHANNEL_USER_TRANSFER_TO_OTHER .equals(operatorType)) {
+		if (typeFlag) {
 			updateAdminUserCountTransfer(useList,newList);
 		}
 		return errors;