我的好友列表接口

master
yechenhao 6 years ago
parent 0edba6660d
commit 69f7f08995

@ -6,6 +6,7 @@ import com.github.pagehelper.PageHelper;
import com.kiisoo.ic.constants.Constants;
import com.kiisoo.ic.customer.bean.CustomerDTO;
import com.kiisoo.ic.customer.bean.CustomerModifyDTO;
import com.kiisoo.ic.customer.bean.FriendDTO;
import com.kiisoo.ic.customer.entity.OpCustomer;
import com.kiisoo.ic.customer.bean.OpCustomerDTO;
import com.kiisoo.ic.customer.entity.OpSellerCustomerRelation;
@ -20,6 +21,8 @@ import com.kiisoo.ic.store.service.PoiStoreService;
import com.kiisoo.ic.store.entity.PoiStoreStaff;
import com.kiisoo.ic.store.mapper.PoiStoreDOMapper;
import com.kiisoo.ic.store.mapper.PoiStoreStaffDOMapper;
import com.kiisoo.ic.system.enums.RoleEnum;
import com.kiisoo.ic.webappmy.vo.StafferInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -241,4 +244,34 @@ public class CustomerService {
opCustomerDOMapper.updateById(opCustomer);
}
/**
*
* @param userId
* @param startDate
* @param endDate
* @param lastStartDate
* @param lastEndDate
*/
public Map<String,Object> listCustomer(Long userId,Long sellerId,String search,String roleCode,Date startDate,Date endDate,Date lastStartDate,Date lastEndDate){
Map<String,Object> results = new HashMap<>();
if (roleCode.equals(RoleEnum.ROLE_CODE_DZ.getRoleCode())){
List<StafferInfoVO> stafferInfoVOS = poiStoreStaffDOMapper.selectInfoById(userId);
Long shopId = stafferInfoVOS.get(0).getStoreId();
List<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId,null,sellerId,search,startDate,endDate);
results.put("this",thisList);
List<FriendDTO> lastList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId,null,sellerId,search,lastStartDate,lastEndDate);
results.put("last",lastList);
List<FriendDTO> earlyList = opSellerCustomerRelationDOMapper.selectShopListByDate(shopId,null,sellerId,search,null,lastStartDate);
results.put("early",earlyList);
}else{
List<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectShopListByDate(null,userId,null,search,startDate,endDate);
results.put("this",thisList);
List<FriendDTO> lastList = opSellerCustomerRelationDOMapper.selectShopListByDate(null,userId,null,search,lastStartDate,lastEndDate);
results.put("last",lastList);
List<FriendDTO> earlyList = opSellerCustomerRelationDOMapper.selectShopListByDate(null,userId,null,search,null,lastStartDate);
results.put("early",earlyList);
}
return results;
}
}

@ -0,0 +1,51 @@
package com.kiisoo.ic.customer.bean;
import lombok.Data;
import java.sql.Date;
/**
* @ClassName: FriendDTO
* @Description:
* @Auther: yechenhao
* @Date: 2020/4/20 0008 16:46
* @Version:
*/
@Data
public class FriendDTO {
/**
* id
*/
private Long customerId;
/**
*
*/
private String customerName;
/**
*
*/
private String mobile;
/**
*
*/
private String inviteSellerName;
/**
* id
*/
private String inviteSellerId;
/**
*
*/
private Date addTime;
/**
*
*/
private String vipType;
}

@ -67,4 +67,25 @@ public class CustomerController extends BaseController {
return fail();
}
}
/**
*
* @param customerId id
* @param name
* @return
*/
@ResponseBody
@PostMapping("/list/friends")
public Map<String, Object> listCustomer(@RequestParam("userId") Long userId,@RequestParam(value = "sellerId",required = false)Long sellerId,
@RequestParam(value = "search",required = false)String search,@RequestParam("roleCode")String roleCode,
@RequestParam("startDate")Date startDate,@RequestParam("endDate")Date endDate,
@RequestParam("lastStartDate")Date lastStartDate,@RequestParam("lastEndDate")Date lastEndDate){
try {
Map<String, Object> stringObjectMap = customerService.listCustomer(userId, sellerId, search, roleCode, startDate, endDate, lastStartDate, lastEndDate);
return success();
} catch (Exception e) {
log.error("修改客户信息异常:",e);
return fail();
}
}
}

@ -1,13 +1,29 @@
package com.kiisoo.ic.customer.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kiisoo.ic.customer.bean.FriendDTO;
import com.kiisoo.ic.customer.entity.OpSellerCustomerRelation;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
*
*/
@Repository
public interface OpSellerCustomerRelationDOMapper extends BaseMapper<OpSellerCustomerRelation> {
/**
*
* @param shopId
* @param sellerId
* @param search
* @param startDate
* @param endDate
* @return
*/
List<FriendDTO> selectShopListByDate(@Param("shopId") Long shopId, @Param("userId")Long userId, @Param("sellerId")Long sellerId,
@Param("search")String search, @Param("startDate")Date startDate, @Param("endDate")Date endDate);
}

@ -69,7 +69,7 @@ public class StoreEmployeeController extends BaseController {
*
* @param response
*/
@RequestMapping(value = "download/store/code",method = RequestMethod.GET)
@RequestMapping(value = "download/store/code",method = RequestMethod.POST)
@ResponseBody
public void downloadCode(HttpServletResponse response) {
try {
@ -83,7 +83,7 @@ public class StoreEmployeeController extends BaseController {
*
* @param response
*/
@RequestMapping(value = "download/store/seller/code",method = RequestMethod.GET)
@RequestMapping(value = "download/store/seller/code",method = RequestMethod.POST)
@ResponseBody
public void downloadSellerCode(HttpServletResponse response) {
try {

@ -23,4 +23,9 @@ public class StafferInfoVO {
*
*/
private String shopName;
/**
* id
*/
private Long storeId;
}

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.kiisoo.ic.customer.mapper.OpSellerCustomerRelationDOMapper">
<select id="selectShopListByDate" resultType="com.kiisoo.ic.customer.bean.FriendDTO">
select t2.name as customerName,t2.id as customerId,t2.phone as mobile,t5.name as inviteSellerName,t4.id as inviteSellerId,t1.create_time as addTime
from op_seller_customer_relation t1,op_customer t2,poi_store_staff t4,privilage_user t5
where t1.customer_id = t2.id
and t1.user_id = t5.userId
and t1.user_id = t4.user_id
and t1.store_id = t4.store_id
<if test="userId != null">
t1.user_id = #{userId}
</if>
<if test="shopId != null">
t1.store_id = #{shopId}
</if>
<if test="sellerId != null">
t4.id = #{sellerId}
</if>
<if test="search != null and search !=''">
and
CONCAT(IFNULL(t2.name,''),IFNULL(t2.phone,''))
LIKE CONCAT('%',#{search},'%')
</if>
<if test="startDate != null">
DATE_FORMAT(t1.create_time,'%Y-%m-%d') &gt;= DATE_FORMAT(#{startDate},'%Y-%m-%d')
</if>
<if test="endDate != null">
DATE_FORMAT(t1.create_time,'%Y-%m-%d') &lt;= DATE_FORMAT(#{endDate},'%Y-%m-%d')
</if>
</select>
</mapper>

@ -32,7 +32,7 @@
</select>
<select id="selectInfoById" resultType="com.kiisoo.ic.webappmy.vo.StafferInfoVO">
select t2.staff_code as stafferNo,t1.`name`,t3.`name` as shopName
select t2.staff_code as stafferNo,t1.`name`,t3.`name` as shopName,t3.id as storeId
from privilage_user t1, poi_store_staff t2, poi_store t3
where t1.id = t2.user_id and t2.`status` = 1 and t2.store_code = t3.`code`
</select>

Loading…
Cancel
Save