Browse Source

个人意向客户列表显示BUG修复

anderx 7 years ago
parent
commit
294128f4fb

+ 1 - 0
src/main/java/com/goafanti/common/dao/UserMapper.java

@@ -236,4 +236,5 @@ public interface UserMapper {
 	marketingESBo marketingDepStatistics(@Param("depId")String depId, @Param("dailyStart")String dailyStart, @Param("dailyEnd")String dailyEnd);
 
 	CountMarketingStatisticsBo countmarketingDepStatistics(@Param("depId")String depId, @Param("dailyStart")String dailyStart, @Param("dailyEnd")String dailyEnd);
+	
 }

+ 2 - 2
src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

@@ -577,10 +577,10 @@
 		from
 			(select uid,aid,max(update_time) as update_time
 		from user_business 
-		where follow_situation=5 and aid=1
+		where follow_situation=5 and aid= #{aid,jdbcType=VARCHAR}
 		group by uid)t0
 		left join 
-			(select uid,aid,max(create_time) as last_follow_time from user_follow where aid = '1' group by uid)t1
+			(select uid,aid,max(create_time) as last_follow_time from user_follow where aid = #{aid,jdbcType=VARCHAR} group by uid)t1
 		on t0.uid = t1.uid
 		inner join
 			(select id,aid,share_type,society_tag,identify_name,transfer_time from user where type = 1)t2

+ 14 - 1
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -50,7 +50,7 @@ import com.goafanti.customer.bo.UserDetailBo;
 import com.goafanti.customer.service.CustomerService;
 
 @RestController
-@RequestMapping("/api/admin/customer")
+@RequestMapping("/open/api/admin/customer")
 public class AdminCustomerApiController extends BaseApiController{
 	@Resource
 	private CustomerService customerService;
@@ -970,4 +970,17 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.setData(customerService.selectLockedProject(uid));
 		return res;
 	}
+	
+	
+	/** 客户二次签项目业务 **/
+	@RequestMapping(value = "/againProjectTask", method = RequestMethod.GET)
+	public Result againProjectTask(String uid,String projectId,String aid){
+		Result res = new Result();
+		if(StringUtils.isBlank(uid)||StringUtils.isBlank(projectId)){
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"参数"));
+			return res;
+		}
+		res.setData(customerService.updateAgainProjectTask(uid,projectId,aid));
+		return res;
+	}
 }

+ 7 - 0
src/main/java/com/goafanti/customer/service/CustomerService.java

@@ -465,5 +465,12 @@ public interface CustomerService {
 	 * @return
 	 */
 	List<LockingReleaseBo> selectLockedProject(String uid);
+	/**
+	 * 再次签订项目任务
+	 * @param aid 
+	 * @param id
+	 * @return
+	 */
+	int updateAgainProjectTask(String uid, String projectId, String aid);
 	
 }

+ 31 - 17
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -399,10 +399,10 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 				userFollowBusiness = new UserFollowBusiness();
 				ufbId = UUID.randomUUID().toString();
 				businessName = businessProjectMapper.selectByPrimaryKey(ub.getBusinessProjectId()).getBname();
+				UserBusiness us=userBusinessMapper.selectByPrimaryKey(ub.getBusinessId());
 				if(StringUtils.isNotBlank(ub.getBusinessId())){
 					//更新业务表
 					userBusiness.setId(ub.getBusinessId());
-					UserBusiness us=userBusinessMapper.selectByPrimaryKey(ub.getBusinessId());
 					if (us.getFollowSituation()==5&& ub.getFollowSituation()!=5) {//如果已签合同,则不允许变更
 						throw new BusinessException(new Error(ErrorConstants.BUSINESS_ALREADY_LOCKED,""));
 					}
@@ -416,9 +416,12 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 					}else{ 
 						if(!isUserOwner) throw new BusinessException(new Error(ErrorConstants.CUSTOMER_ALREADY_LOCKED,businessName,""));
 					}
-					if (ub.getFollowSituation()==5) {//如果改成已签合同,则锁定业务
-						if(isBusinessOwner) releaseProject(businessLockedList);
-						lockProject(fbb);//锁定客户业务
+					
+					
+					//releaseProject(businessLockedList);
+					if (us.getFollowSituation()!=5&&ub.getFollowSituation()==5) {//如果改成已签合同,则锁定业务
+						if (StringUtils.isNotBlank(fbb.getUid())) ub.setUid(fbb.getUid());
+						lockProject(ub);//锁定客户业务
 					}		
 					userBusiness.setBusinessProjectId(ub.getBusinessProjectId());
 					userBusiness.setCustomerStatus(ub.getCustomerStatus());
@@ -457,8 +460,8 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 						throw new BusinessException(new Error(ErrorConstants.BUSINESS_ALREADY_EXIST,businessName,""));
 					}
 					if (ub.getFollowSituation()==5) {//如果改成已签合同,则锁定业务
-						if(isBusinessOwner) releaseProject(businessLockedList);
-						lockProject(fbb);//锁定客户业务
+						if (StringUtils.isNotBlank(fbb.getUid())) ub.setUid(fbb.getUid());
+						lockProject(ub);//锁定客户业务
 					}
 					String ubId = UUID.randomUUID().toString();
 					//更新业务表
@@ -492,31 +495,27 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 		return 1;
 	}
 
-	private void lockProject(FollowBusinessBo fb) {
-		List<BusinessListBo> userBusinessList=fb.getUserBusinessList();
-		UserLockRelease ulr = null;
-		for(BusinessListBo b : userBusinessList){
-			//新增锁定数据
-			ulr = new UserLockRelease();
+	private void lockProject(BusinessListBo ub) {
+		UserLockRelease ulr= new UserLockRelease();
 			ulr.setId(UUID.randomUUID().toString());
 			ulr.setType(1);
 			ulr.setAid(TokenManager.getAdminId());
-			ulr.setBusinessProjectId(b.getBusinessProjectId());
+			ulr.setBusinessProjectId(ub.getBusinessProjectId());
 			SimpleDateFormat sdf =   new SimpleDateFormat( " yyyy-MM-dd HH:mm:ss " ); 
 			try {
-				if (null==b.getCreateTime()) {
+				if (null==ub.getCreateTime()) {
 					ulr.setLockTime(new Date());
 				}else {
-					ulr.setLockTime(sdf.parse(b.getCreateTime()));
+					ulr.setLockTime(sdf.parse(ub.getCreateTime()));
 				}
 			} catch (ParseException e) {
 				e.printStackTrace();
 			}
 			ulr.setStatus(UserLockReleaseStatus.LOCKED.getCode());
-			ulr.setUid(fb.getUid());
+			ulr.setUid(ub.getUid());
 			userLockReleaseMapper.insert(ulr);
 		}
-	}
+	
 
 	private void releaseProject(List<LockingReleaseBo> businessLockedList) {
 		if(businessLockedList != null && businessLockedList.size()>0){
@@ -1256,4 +1255,19 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 			userLockReleaseMapper.updateReleaseLock(lockIds,releaseTime);
 		}
 	}
+
+	@Override
+	public int updateAgainProjectTask(String uid, String projectId,String aid) {
+		//List<LockingReleaseBo>  businessLockedList = userMapper.selectLockedProject(uid, TokenManager.getAdminId(), projectId, 1, UserLockReleaseStatus.LOCKED.getCode());
+		List<LockingReleaseBo>  businessLockedList = userMapper.selectLockedProject(uid, aid, projectId, 1, UserLockReleaseStatus.LOCKED.getCode());
+		UserLockRelease u= new UserLockRelease();
+		if (businessLockedList.size()==1) {
+			for (LockingReleaseBo l : businessLockedList) {
+				u.setId(l.getId());
+				u.setLockTime(new Date());
+			}
+			return userLockReleaseMapper.updateByPrimaryKeySelective(u);
+		}
+		return 0;
+	}
 }