Commit db83f983 authored by lcl's avatar lcl

客户认领相关功能

parent 29fffbba
...@@ -125,6 +125,8 @@ public class CustomerController extends BaseController { ...@@ -125,6 +125,8 @@ public class CustomerController extends BaseController {
} }
} }
/** /**
* 编辑客户 * 编辑客户
*/ */
...@@ -190,4 +192,23 @@ public class CustomerController extends BaseController { ...@@ -190,4 +192,23 @@ public class CustomerController extends BaseController {
success.put("successCount", successCount); success.put("successCount", successCount);
return success; return success;
} }
/**
* 取消认领
*/
@PutMapping("/cancelClaim/{customerId}")
@RepeatSubmit
public AjaxResult cancelClaim(@PathVariable String customerId) {
return toAjax(baseService.cancelClaim(customerId));
}
/**
* 历史认领
*/
@PutMapping("/historyClaim/{customerId}")
@RepeatSubmit
public AjaxResult historyClaim(@PathVariable String customerId) {
return toAjax(baseService.historyClaim(customerId));
}
} }
...@@ -18,5 +18,9 @@ public class CustomerSearchDto implements Serializable { ...@@ -18,5 +18,9 @@ public class CustomerSearchDto implements Serializable {
* 用户id * 用户id
*/ */
private Long userId; private Long userId;
/**
* 客户状态 0:正常 1:历史
*/
private Integer status;
} }
...@@ -31,4 +31,8 @@ public interface ICustomerService { ...@@ -31,4 +31,8 @@ public interface ICustomerService {
List<String> selectUipIdList(List<String> uipIds); List<String> selectUipIdList(List<String> uipIds);
boolean cancelClaim(String customerId);
boolean historyClaim(String customerId);
} }
...@@ -48,6 +48,7 @@ public class CustomerServiceImpl implements ICustomerService { ...@@ -48,6 +48,7 @@ public class CustomerServiceImpl implements ICustomerService {
@Override @Override
public List<CustomerListVo> selectList(CustomerSearchDto dto) { public List<CustomerListVo> selectList(CustomerSearchDto dto) {
dto.setUserId(SecurityUtils.getUserId()); dto.setUserId(SecurityUtils.getUserId());
dto.setStatus(ObjectUtils.isEmpty(dto.getStatus()) ? 0 : dto.getStatus());
return baseMapper.selectList(dto); return baseMapper.selectList(dto);
} }
...@@ -124,4 +125,24 @@ public class CustomerServiceImpl implements ICustomerService { ...@@ -124,4 +125,24 @@ public class CustomerServiceImpl implements ICustomerService {
return baseMapper.selectUipIdList(uipIds, SecurityUtils.getUserId()); return baseMapper.selectUipIdList(uipIds, SecurityUtils.getUserId());
} }
@Override
public boolean cancelClaim(String customerId) {
return updateClaimStatus(customerId,1);
}
@Override
public boolean historyClaim(String customerId) {
return updateClaimStatus(customerId,0);
}
//修改客户认领状态
private boolean updateClaimStatus(String customerId,Integer status) {
CustomerUser customerUser = customerUserMapper.selectOne(Wrappers.<CustomerUser>lambdaQuery()
.eq(CustomerUser::getCustomerId, customerId)
.eq(CustomerUser::getUserId, SecurityUtils.getUserId()));
customerUser.setStatus(status);
return customerUserMapper.updateById(customerUser) == 1;
}
} }
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
left join ( left join (
select count(status) num,customer_id from business_info where `status` = 2 group by customer_id select count(status) num,customer_id from business_info where `status` = 2 group by customer_id
) bi3 on bi3.customer_id = ct.customer_id ) bi3 on bi3.customer_id = ct.customer_id
where ctu.user_id = #{dto.userId} where ctu.user_id = #{dto.userId} and ctu.status = #{dto.status}
<if test="dto.companyName != null and dto.companyName != '' "> and ct.company_name like concat('%',#{dto.companyName},'%')</if> <if test="dto.companyName != null and dto.companyName != '' "> and ct.company_name like concat('%',#{dto.companyName},'%')</if>
order by ct.create_time desc order by ct.create_time desc
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment