门店号管理

master
LegnaYet 6 years ago
parent c8bdaea6e6
commit d6d2feed2a

@ -176,7 +176,11 @@ public class CustomerService {
if (!turnBackDTOS.getEaCode().equals("") && !turnBackDTOS.getEaCode().equals("0")) { if (!turnBackDTOS.getEaCode().equals("") && !turnBackDTOS.getEaCode().equals("0")) {
//导购信息 //导购信息
QueryWrapper<PoiStoreStaff> wrapper = new QueryWrapper<>(); QueryWrapper<PoiStoreStaff> wrapper = new QueryWrapper<>();
wrapper.eq("staff_code", turnBackDTOS.getEaCode()).eq("status","1").eq("store_id", poiStore.getStoreId()).last("limit 1"); if (turnBackDTOS.getEaCode().matches("导购(.*)")){
wrapper.eq("staff_code", turnBackDTOS.getEaCode()).eq("status","1").last("limit 1");
}else{
wrapper.eq("staff_code", turnBackDTOS.getEaCode()).eq("status","1").eq("store_id", poiStore.getStoreId()).last("limit 1");
}
poiStoreStaff = poiStoreStaffDOMapper.selectOne(wrapper); poiStoreStaff = poiStoreStaffDOMapper.selectOne(wrapper);
} }
@ -186,10 +190,17 @@ public class CustomerService {
insertCustomer.setName(EmployeeService.filterEmoji(turnBackDTOS.getName())); insertCustomer.setName(EmployeeService.filterEmoji(turnBackDTOS.getName()));
insertCustomer.setAvatarUrl(turnBackDTOS.getWxData().getAvatarUrl()); insertCustomer.setAvatarUrl(turnBackDTOS.getWxData().getAvatarUrl());
insertCustomer.setPhone(turnBackDTOS.getPhone()); insertCustomer.setPhone(turnBackDTOS.getPhone());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
insertCustomer.setCreateTime(sdf.parse(turnBackDTOS.getJoinTime()));
if (null != opCustomer) { if (null != opCustomer) {
//更新一下 //更新一下
insertCustomer.setId(opCustomer.getId()); insertCustomer.setId(opCustomer.getId());
opCustomerDOMapper.updateById(insertCustomer); try {
opCustomerDOMapper.updateById(insertCustomer);
}catch (Exception e) {
System.out.println(insertCustomer.toString());
return;
}
if (poiStoreStaff != null) { if (poiStoreStaff != null) {
//存在--1.处理客户导购关系。 //存在--1.处理客户导购关系。
sellerCustomerRelation(opCustomer, turnBackDTOS.getEaCode(), poiStore.getStoreId(), poiStoreStaff.getId()); sellerCustomerRelation(opCustomer, turnBackDTOS.getEaCode(), poiStore.getStoreId(), poiStoreStaff.getId());
@ -199,7 +210,13 @@ public class CustomerService {
} else { } else {
insertCustomer.setCreateBy(Constants.SYS_OPERATION); insertCustomer.setCreateBy(Constants.SYS_OPERATION);
//不存在 //不存在
opCustomerDOMapper.insert(insertCustomer); try {
opCustomerDOMapper.insert(insertCustomer);
}catch (Exception e) {
System.out.println(insertCustomer.toString());
return;
}
if (poiStoreStaff != null) { if (poiStoreStaff != null) {
//添加关系 //添加关系
sellerCustomerRelation(insertCustomer, turnBackDTOS.getEaCode(), poiStore.getStoreId(), poiStoreStaff.getId()); sellerCustomerRelation(insertCustomer, turnBackDTOS.getEaCode(), poiStore.getStoreId(), poiStoreStaff.getId());

@ -123,4 +123,28 @@ public class OpCustomer {
private String externalUserid; private String externalUserid;
@Override
public String toString() {
return "OpCustomer{" +
"wechatOpenId='" + wechatOpenId + '\'' +
", wechatUniId='" + wechatUniId + '\'' +
", wechatXxxId='" + wechatXxxId + '\'' +
", memberId=" + memberId +
", type=" + type +
", name='" + name + '\'' +
", phone='" + phone + '\'' +
", desc='" + desc + '\'' +
", mail='" + mail + '\'' +
", brandId=" + brandId +
", createTime=" + createTime +
", updateTime=" + updateTime +
", createBy='" + createBy + '\'' +
", updateBy='" + updateBy + '\'' +
", registerTime=" + registerTime +
", shopId=" + shopId +
", validType=" + validType +
", avatarUrl='" + avatarUrl + '\'' +
", externalUserid='" + externalUserid + '\'' +
'}';
}
} }

@ -452,15 +452,25 @@ public class EmployeeService {
if (CollectionUtils.isNotEmpty(privilageCpUserStoreDOS)){ if (CollectionUtils.isNotEmpty(privilageCpUserStoreDOS)){
for (PrivilageCpUserStoreDO privilageCpUserStoreDO:privilageCpUserStoreDOS){ for (PrivilageCpUserStoreDO privilageCpUserStoreDO:privilageCpUserStoreDOS){
String cpUserId = privilageCpUserStoreDOMapper.selectCpUserIdByStoreId(privilageCpUserStoreDO.getStoreId()); String cpUserId = privilageCpUserStoreDOMapper.selectCpUserIdByStoreId(privilageCpUserStoreDO.getStoreId());
List<WxCpUserExternalContactInfo> customers = qwMailListManageService.getCustomer(cpUserId); if (StringUtils.isBlank(cpUserId)){
continue;
}
List<WxCpUserExternalContactInfo> customers = null;
try {
customers = qwMailListManageService.getCustomer(cpUserId);
}catch (Exception e) {
System.out.println("查询联系人失败:"+cpUserId);
continue;
}
if (CollectionUtils.isNotEmpty(customers)){ if (CollectionUtils.isNotEmpty(customers)){
for (WxCpUserExternalContactInfo customer:customers){ for (WxCpUserExternalContactInfo customer:customers){
System.out.println(customer.toString());
TurnBackDTO turnBackDTO = new TurnBackDTO(); TurnBackDTO turnBackDTO = new TurnBackDTO();
WxCpUserExternalContactInfo.ExternalContact externalContact = customer.getExternalContact(); WxCpUserExternalContactInfo.ExternalContact externalContact = customer.getExternalContact();
List<WxCpUserExternalContactInfo.FollowedUser> followedUsers = customer.getFollowedUsers(); List<WxCpUserExternalContactInfo.FollowedUser> followedUsers = customer.getFollowedUsers();
turnBackDTO.setEaCode("");
if (CollectionUtils.isNotEmpty(followedUsers)){ if (CollectionUtils.isNotEmpty(followedUsers)){
for (WxCpUserExternalContactInfo.FollowedUser followedUser:followedUsers){ for (WxCpUserExternalContactInfo.FollowedUser followedUser:followedUsers){
if (cpUserId.equals(followedUser.getUserId())){ if (cpUserId.equals(followedUser.getUserId())){
@ -481,7 +491,9 @@ public class EmployeeService {
} }
} }
Long joinTimeL = followedUser.getCreateTime(); Long joinTimeL = followedUser.getCreateTime();
turnBackDTO.setJoinTime(sdf.format(new Date(joinTimeL))); Long time=new Long(joinTimeL);
String joinTime = sdf.format(time*1000);
turnBackDTO.setJoinTime(joinTime);
} }
} }
} }
@ -495,7 +507,7 @@ public class EmployeeService {
wxDataDTO.setUnionId(externalContact.getUnionId()); wxDataDTO.setUnionId(externalContact.getUnionId());
turnBackDTO.setWxData(wxDataDTO); turnBackDTO.setWxData(wxDataDTO);
// customerService.turnBack(turnBackDTO); customerService.turnBack(turnBackDTO);
} }
} }
} }

@ -243,11 +243,13 @@ public class PoiStoreStaffService {
if (CollectionUtils.isNotEmpty(staffs)){ if (CollectionUtils.isNotEmpty(staffs)){
return "0002"; return "0002";
} }
QueryWrapper<PrivilageUserDO> mobileUserQw = new QueryWrapper<>(); if (StringUtils.isNotBlank(mobil)){
mobileUserQw.eq("mobil",mobil).eq("status", "1"); QueryWrapper<PrivilageUserDO> mobileUserQw = new QueryWrapper<>();
List<PrivilageUserDO> mobileUsers = privilageUserDOMapper.selectList(mobileUserQw); mobileUserQw.eq("mobil",mobil).eq("status", "1");
if (CollectionUtils.isNotEmpty(mobileUsers)){ List<PrivilageUserDO> mobileUsers = privilageUserDOMapper.selectList(mobileUserQw);
return "0003"; if (CollectionUtils.isNotEmpty(mobileUsers)){
return "0003";
}
} }
QueryWrapper<PrivilageAccountDO> loginUserQw = new QueryWrapper<>(); QueryWrapper<PrivilageAccountDO> loginUserQw = new QueryWrapper<>();
loginUserQw.eq("login",mobil).eq("type", "1").eq("status", "1"); loginUserQw.eq("login",mobil).eq("type", "1").eq("status", "1");

@ -6,7 +6,7 @@
SELECT t2.id,t2.`name`, SELECT t2.id,t2.`name`,
t2.member_id as idCard,t0.name as shopName,t0.code as shopCode, t2.member_id as idCard,t0.name as shopName,t0.code as shopCode,
t4.name as sellerName, t3.birthday, t2.phone, t4.name as sellerName, t3.birthday, t2.phone,
t3.name as vipName,t3.phone as vipPhone, t5.staff_code as sellerCode, t1.create_time as createTime t3.name as vipName,t3.phone as vipPhone, t5.staff_code as sellerCode, t2.create_time as createTime
from op_seller_customer_relation t1 from op_seller_customer_relation t1
left join poi_store t0 on t0.id = t1.store_id left join poi_store t0 on t0.id = t1.store_id
left join poi_store_staff t5 ON t5.store_id = t0.id and t1.user_id = t5.id left join poi_store_staff t5 ON t5.store_id = t0.id and t1.user_id = t5.id
@ -25,18 +25,18 @@
</otherwise> </otherwise>
</choose> </choose>
<if test="startDate != null"> <if test="startDate != null">
and t1.create_time >= #{startDate} and t2.create_time >= #{startDate}
</if> </if>
<if test="endDate != null"> <if test="endDate != null">
and t1.create_time <![CDATA[ < ]]> #{endDate} and t2.create_time <![CDATA[ < ]]> #{endDate}
</if> </if>
order by t1.create_time desc,t2.id desc,t1.user_id desc order by t2.create_time desc,t2.id desc,t1.user_id desc
</select> </select>
<select id="selectCustomerInfoBySellerId" resultType="com.kiisoo.ic.customer.bean.OpCustomerDTO"> <select id="selectCustomerInfoBySellerId" resultType="com.kiisoo.ic.customer.bean.OpCustomerDTO">
SELECT t2.id,t2.`name`, SELECT t2.id,t2.`name`,
t2.member_id as idCard,t0.name as shopName,t0.code as shopCode, t2.member_id as idCard,t0.name as shopName,t0.code as shopCode,
t4.name as sellerName, t3.birthday, t2.phone, t4.name as sellerName, t3.birthday, t2.phone,
t3.name as vipName,t3.phone as vipPhone, t5.staff_code as sellerCode, t1.create_time as createTime t3.name as vipName,t3.phone as vipPhone, t5.staff_code as sellerCode, t2.create_time as createTime
from op_seller_customer_relation t1 from op_seller_customer_relation t1
left join poi_store t0 on t0.id = t1.store_id left join poi_store t0 on t0.id = t1.store_id
left join poi_store_staff t5 ON t5.store_id = t0.id and t1.user_id = t5.id left join poi_store_staff t5 ON t5.store_id = t0.id and t1.user_id = t5.id
@ -45,19 +45,19 @@
LEFT JOIN privilage_user t4 ON t4.id = t5.user_id where 1 =1 LEFT JOIN privilage_user t4 ON t4.id = t5.user_id where 1 =1
and t1.user_id = #{sellerId} and t1.user_id = #{sellerId}
<if test="startDate != null"> <if test="startDate != null">
and t1.create_time >= #{startDate} and t2.create_time >= #{startDate}
</if> </if>
<if test="endDate != null"> <if test="endDate != null">
and t1.create_time <![CDATA[ < ]]> #{endDate} and t2.create_time <![CDATA[ < ]]> #{endDate}
</if> </if>
GROUP BY t2.id GROUP BY t2.id
order by t1.create_time desc,t2.id desc order by t2.create_time desc,t2.id desc
</select> </select>
<!--客户list--> <!--客户list-->
<select id="selectCustomerList" resultType="com.kiisoo.ic.customer.entity.OpCustomer"> <select id="selectCustomerList" resultType="com.kiisoo.ic.customer.entity.OpCustomer">
select t1.id as id, t1.`name` as name, t1.member_id as memberId, t1.phone as phone, select t1.id as id, t1.`name` as name, t1.member_id as memberId, t1.phone as phone,
t2.create_time as registerTime, t2.type as validType, t2.store_id as shopId t1.create_time as registerTime, t2.type as validType, t2.store_id as shopId
from op_customer t1, op_seller_customer_relation t2 from op_customer t1, op_seller_customer_relation t2
where t1.id=t2.customer_id where t1.id=t2.customer_id
<if test="memberId != null"> <if test="memberId != null">
@ -73,10 +73,10 @@
and t2.user_id=#{sellerId} and t2.user_id=#{sellerId}
</if> </if>
<if test="startDate != null and startDate != ''"> <if test="startDate != null and startDate != ''">
and t2.create_time <![CDATA[ >= ]]> #{startDate} and t1.create_time <![CDATA[ >= ]]> #{startDate}
</if> </if>
<if test="endDate != null and endDate != ''"> <if test="endDate != null and endDate != ''">
and t2.create_time <![CDATA[ <= ]]> #{endDate} and t1.create_time <![CDATA[ <= ]]> #{endDate}
</if> </if>
</select> </select>
@ -95,10 +95,10 @@
and t2.type = #{type} and t2.type = #{type}
</if> </if>
<if test="startDate != null and startDate != ''"> <if test="startDate != null and startDate != ''">
and t2.create_time <![CDATA[ >= ]]> #{startDate} and t1.create_time <![CDATA[ >= ]]> #{startDate}
</if> </if>
<if test="endDate != null and endDate != ''"> <if test="endDate != null and endDate != ''">
and t2.create_time <![CDATA[ <= ]]> #{endDate} and t1.create_time <![CDATA[ <= ]]> #{endDate}
</if> </if>
</select> </select>

@ -9,7 +9,7 @@
IFNULL(t3.phone,'') AS mobile, IFNULL(t3.phone,'') AS mobile,
t5.NAME AS inviteSellerName, t5.NAME AS inviteSellerName,
t4.id AS inviteSellerId, t4.id AS inviteSellerId,
t1.create_time AS addTime, t2.create_time AS addTime,
t2.avatar_url as avatar, t2.avatar_url as avatar,
t3.level as vipFlag t3.level as vipFlag
FROM FROM
@ -37,12 +37,12 @@
LIKE CONCAT('%',#{search},'%') LIKE CONCAT('%',#{search},'%')
</if> </if>
<if test="startDate != null"> <if test="startDate != null">
and DATE_FORMAT(t1.create_time,'%Y-%m-%d') &gt;= DATE_FORMAT(#{startDate},'%Y-%m-%d') and DATE_FORMAT(t2.create_time,'%Y-%m-%d') &gt;= DATE_FORMAT(#{startDate},'%Y-%m-%d')
</if> </if>
<if test="endDate != null"> <if test="endDate != null">
and DATE_FORMAT(t1.create_time,'%Y-%m-%d') &lt;= DATE_FORMAT(#{endDate},'%Y-%m-%d') and DATE_FORMAT(t2.create_time,'%Y-%m-%d') &lt;= DATE_FORMAT(#{endDate},'%Y-%m-%d')
</if> </if>
GROUP BY t4.id order by t1.create_time desc GROUP BY t4.id order by t2.create_time desc
</select> </select>
<select id="selectFriendListByShopId" resultType="com.kiisoo.ic.customer.bean.FriendDTO"> <select id="selectFriendListByShopId" resultType="com.kiisoo.ic.customer.bean.FriendDTO">
SELECT SELECT
@ -51,7 +51,7 @@
t2.id AS customerId, t2.id AS customerId,
IFNULL(t3.phone,'') AS mobile, IFNULL(t3.phone,'') AS mobile,
t1.user_id AS inviteSellerId, t1.user_id AS inviteSellerId,
t1.create_time AS addTime, t2.create_time AS addTime,
t2.avatar_url as avatar, t2.avatar_url as avatar,
t3.level as vipFlag t3.level as vipFlag
FROM FROM
@ -77,12 +77,12 @@
LIKE CONCAT('%',#{search},'%') LIKE CONCAT('%',#{search},'%')
</if> </if>
<if test="startDate != null"> <if test="startDate != null">
and DATE_FORMAT(t1.create_time,'%Y-%m-%d') &gt;= DATE_FORMAT(#{startDate},'%Y-%m-%d') and DATE_FORMAT(t2.create_time,'%Y-%m-%d') &gt;= DATE_FORMAT(#{startDate},'%Y-%m-%d')
</if> </if>
<if test="endDate != null"> <if test="endDate != null">
and DATE_FORMAT(t1.create_time,'%Y-%m-%d') &lt;= DATE_FORMAT(#{endDate},'%Y-%m-%d') and DATE_FORMAT(t2.create_time,'%Y-%m-%d') &lt;= DATE_FORMAT(#{endDate},'%Y-%m-%d')
</if> </if>
order by t1.create_time desc order by t2.create_time desc
</select> </select>
<!--根据导购id查询导购名--> <!--根据导购id查询导购名-->
<select id="selectStaffName" resultType="java.lang.String"> <select id="selectStaffName" resultType="java.lang.String">

@ -38,6 +38,7 @@
select t2.* from privilage_cp_user t1,privilage_cp_user_store t2 select t2.* from privilage_cp_user t1,privilage_cp_user_store t2
where t1.id = t2.cp_user_id where t1.id = t2.cp_user_id
and t1.cp_user_id = #{cpUser} and t1.cp_user_id = #{cpUser}
limit 1
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save