Browse Source

客户锁定与释放规则更改修改相关接口

anderx 7 years ago
parent
commit
c3670badac

+ 4 - 0
src/main/java/com/goafanti/common/mapper/UserMapper.xml

@@ -1470,4 +1470,8 @@
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
+  
+  <select id="selectUserByRoleName" parameterType="java.lang.String" resultMap="BaseResultMap">
+  	select c.id from role a left join user_role b on a.id = b.rid left join admin c on b.uid = c.id where a.role_name = #{roleName}
+  </select>
 </mapper>

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

@@ -560,8 +560,8 @@
 	</select>
 	<select id="selectSignOrganizationCustomerList" resultType="com.goafanti.customer.bo.CustomerListOut">
 		select 
-			t0.buyer_id as uid,
-			t0.last_sign_time as lastSignTime,
+			t0.uid as uid,
+			t0.update_time as lastSignTime,
 			t1.last_follow_time as lastFollowTime,
 			t2.society_tag as societyTag,
 			t2.identify_name as name,
@@ -575,14 +575,17 @@
 			c.name as industry,
 			d.name as adminName
 		from
-			(select buyer_id,salesman_id,max(sign_time) as last_sign_time from t_order where salesman_id = #{aid} and order_status = 3 and delete_sign != 1 group by buyer_id)t0
+			(select uid,aid,max(update_time) as update_time
+		from user_business 
+		where follow_situation=5 and aid=1
+		group by uid)t0
 		left join 
-			(select uid,aid,max(create_time) as last_follow_time from user_follow where aid = #{aid} group by uid)t1
-		on t0.buyer_id = t1.uid
+			(select uid,aid,max(create_time) as last_follow_time from user_follow where aid = '1' 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
-		on t0.buyer_id = t2.id
-		left join organization_identity b on t0.buyer_id = b.uid
+		on t0.uid = t2.id
+		left join organization_identity b on t0.uid = b.uid
 		left join district_glossory dg1 on b.location_province = dg1.id
 		left join district_glossory dg2 on b.location_city = dg2.id
 		left join district_glossory dg3 on b.location_area = dg3.id
@@ -619,11 +622,14 @@
 		select 
 			count(0)
 		from
-			(select buyer_id,salesman_id,max(sign_time) as last_sign_time from t_order where salesman_id = #{aid} and order_status = 3 and delete_sign != 1 group by buyer_id)t0
+			(select uid,aid,max(update_time) as update_time
+		from user_business 
+		where follow_situation=5 and aid=1
+		group by uid)t0
 		inner join
 			(select id,aid,share_type,society_tag,identify_name,transfer_time from user where type = 1)t2
-		on t0.buyer_id = t2.id
-		left join organization_identity b on t0.buyer_id = b.uid where 1 = 1
+		on t0.uid = t2.id
+		left join organization_identity b on t0.uid = b.uid where 1 = 1
 		<if test="name != null and name != ''">
 			and t2.identify_name like concat('%',#{name},'%')
 		</if>

+ 8 - 0
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -654,6 +654,10 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 	@Override
 	public int deleteFollow(String followId) {
 		UserFollow uf = new UserFollow();
+		List<BusinessListBo> list= userMapper.findBusinessByFollowId(followId);
+		for (BusinessListBo b : list) {
+			if(b.getFollowSituation()==5)throw new BusinessException(new Error(ErrorConstants.BUSINESS_ALREADY_LOCKED,""));;
+		}
 		uf.setId(followId);
 		uf.setEffective(DeleteStatus.DELETED.getCode());
 		return userFollowMapper.updateByPrimaryKeySelective(uf);
@@ -1059,6 +1063,10 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 
 	@Override
 	public int deleteFollowOneBusiness(String ufbId) {
+		UserFollowBusiness ufb=userFollowBusinessMapper.selectByPrimaryKey(ufbId);
+		if (ufb.getFollowSituation()==5) {//如果业务是已签合同则不允许删除
+			throw new BusinessException(new Error(ErrorConstants.BUSINESS_ALREADY_LOCKED,""));
+		}
 		return userFollowBusinessMapper.deleteByPrimaryKey(ufbId);
 	}