好友列表添加根据日期查询。

master
kevin jiang 6 years ago
parent c65001312e
commit beec89218c

@ -440,7 +440,66 @@ public class CustomerService {
* @param search
* @param roleCode
*/
public Map<String, Object> listCustomer(Long userId, Long sellerId, String search, String roleCode, Integer type) throws Exception {
public Map<String, Object> listCustomerNew(Long userId, Long sellerId, String search, String roleCode, Integer type, Date startDate, Date endDate) throws Exception {
Map<String, Object> results = new HashMap<>();
// Date thisDate = new Date();
// DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
// Calendar calendar = Calendar.getInstance();
// calendar.set(Calendar.HOUR_OF_DAY, -24);
// Date lastDate = dateFormat.parse(dateFormat.format(calendar.getTime()));
// calendar.set(Calendar.HOUR_OF_DAY, -24);
// Date earlyDate = dateFormat.parse(dateFormat.format(calendar.getTime()));
List<StafferInfoVO> stafferInfoVOS = poiStoreStaffDOMapper.selectInfoById(userId);
if (CollectionUtils.isEmpty(stafferInfoVOS)) {
results.put("this", null);
// results.put("last", null);
// results.put("early", null);
return results;
}
Long shopId = stafferInfoVOS.get(0).getStoreId();
if (roleCode.equals(RoleEnum.ROLE_CODE_DZ.getRoleCode())) {
List<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, startDate, endDate, type);
thisList.forEach(friendDTO -> {
String inviteSellerName = opSellerCustomerRelationDOMapper.selectStaffName(friendDTO.getInviteSellerId());
if (StringUtils.isNotBlank(inviteSellerName)) {
friendDTO.setInviteSellerName(inviteSellerName);
}
});
// List<FriendDTO> lastList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, lastDate, lastDate, type);
// lastList.forEach(friendDTO -> {
// String inviteSellerName = opSellerCustomerRelationDOMapper.selectStaffName(friendDTO.getInviteSellerId());
// if (StringUtils.isNotBlank(inviteSellerName)) {
// friendDTO.setInviteSellerName(inviteSellerName);
// }
// });
// List<FriendDTO> earlyList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, null, earlyDate, type);
// earlyList.forEach(friendDTO -> {
// String inviteSellerName = opSellerCustomerRelationDOMapper.selectStaffName(friendDTO.getInviteSellerId());
// if (StringUtils.isNotBlank(inviteSellerName)) {
// friendDTO.setInviteSellerName(inviteSellerName);
// }
// });
results.put("this", thisList);
// results.put("last", lastList);
// results.put("early", earlyList);
} else {
List<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(userId, search, startDate, endDate, type);
results.put("this", thisList);
// List<FriendDTO> lastList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(userId, search, lastDate, lastDate, type);
// results.put("last", lastList);
// List<FriendDTO> earlyList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(userId, search, null, earlyDate, type);
// results.put("early", earlyList);
}
return results;
}
/**
* @param userId
* @param sellerId
* @param search
* @param roleCode
*/
public Map<String, Object> listCustomer(Long userId, Long sellerId, String search, String roleCode, Integer type, Date startDate, Date endDate) throws Exception {
Map<String, Object> results = new HashMap<>();
Date thisDate = new Date();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
@ -458,7 +517,7 @@ public class CustomerService {
}
Long shopId = stafferInfoVOS.get(0).getStoreId();
if (roleCode.equals(RoleEnum.ROLE_CODE_DZ.getRoleCode())) {
List<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, thisDate, thisDate, type);
List<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, startDate, endDate, type);
thisList.forEach(friendDTO -> {
String inviteSellerName = opSellerCustomerRelationDOMapper.selectStaffName(friendDTO.getInviteSellerId());
if (StringUtils.isNotBlank(inviteSellerName)) {
@ -483,7 +542,7 @@ public class CustomerService {
results.put("last", lastList);
results.put("early", earlyList);
} else {
List<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(userId, search, thisDate, thisDate, type);
List<FriendDTO> thisList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(userId, search, startDate, endDate, type);
results.put("this", thisList);
List<FriendDTO> lastList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(userId, search, lastDate, lastDate, type);
results.put("last", lastList);

@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -84,9 +85,17 @@ public class CustomerController extends BaseController {
@RequestParam(value = "sellerId",required = false)Long sellerId,
@RequestParam(value = "search",required = false)String search,
@RequestParam("roleCode")String roleCode,
@RequestParam("type") Integer type){
@RequestParam("type") Integer type,
Date startDate,
Date endDate,
String version){
try {
Map<String, Object> stringObjectMap = customerService.listCustomer(userId, sellerId, search, roleCode, type);
Map<String, Object> stringObjectMap;
if(StringUtils.isNotBlank(version)){
stringObjectMap = customerService.listCustomerNew(userId, sellerId, search, roleCode, type, startDate, endDate);
}else{
stringObjectMap = customerService.listCustomer(userId, sellerId, search, roleCode, type, startDate, endDate);
}
return data(stringObjectMap);
} catch (Exception e) {
log.error("修改客户信息异常:",e);

@ -0,0 +1,55 @@
package com.kiisoo.ic.generalize.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
/**
* @Description:
* @Author: dexiang.jiang
* @Date 2020/05/08 00:17
*/
@Data
@TableName ("privilage_organizational_domain")
public class PrivilageOrganizationalDomain {
/**
* id
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* ID
*/
private Long orgId;
/**
* ID
*/
private Long domainId;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
*
*/
private String createBy;
/**
*
*/
private String updateBy;
}

@ -0,0 +1,9 @@
package com.kiisoo.ic.generalize.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kiisoo.ic.generalize.entity.PrivilageOrganizationalDomain;
import org.springframework.stereotype.Repository;
@Repository
public interface PrivilageOrganizationalDomainMapper extends BaseMapper<PrivilageOrganizationalDomain> {
}

@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
import java.util.Set;
@Repository
@ -28,4 +29,15 @@ public interface RetailCompanyMapper extends BaseMapper<PrivilageOrganizational>
* list
*/
List<PrivilageOrganizationalRelationVO> selectAllOrgListByOrgIds(@Param("orgIds") List<Long> orgIds, @Param("regionId")Long regionId , @Param("companyId")Long companyId, @Param("customerId")Long customerId);
/**
*
* @param storeCode
* @return
* @author dexiang.jiang
* @date 2020/05/07 21:00
*/
List<Map<String,Object>> selectCustomerDOByStoreCode(@Param("storeCode") String storeCode);
}

@ -28,6 +28,7 @@ import com.kiisoo.ic.system.mapper.PrivilageUserDOMapper;
import com.kiisoo.ic.system.service.PrivilageAccountService;
import com.kiisoo.ic.system.service.PrivilageUserRoleService;
import com.kiisoo.ic.system.service.PrivilageUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@ -52,6 +53,7 @@ import static com.kiisoo.ic.store.constant.Constants.*;
/**
*
*/
@Slf4j
@Service
public class PoiStoreStaffService {
@ -83,6 +85,7 @@ public class PoiStoreStaffService {
private OpSellerCustomerRelationDOMapper opSellerCustomerRelationDOMapper;
@Autowired
private PrivilageAccountDOMapper privilageAccountDOMapper;
/**
*
*
@ -641,6 +644,11 @@ public class PoiStoreStaffService {
privilageDomainService.removeUserEntity(userId);
//删除账号
privilageAccountDOMapper.deleteByUserId(userId);
// 作废二维码
boolean bool = storeEmployeeService.cancelQrCodeFromBSD(poiStoreStaff.getStoreCode(), poiStoreStaff.getStaffCode());
if(!bool){
log.error("deleteStaff qrcode cancel function : " + poiStoreStaff.toString());
}
}
// int i = poiStoreStaffDOMapper.deleteById(staffId);
// if (i <= 0){
@ -660,62 +668,4 @@ public class PoiStoreStaffService {
wrapper.eq("user_id",userId);
return poiStoreStaffDOMapper.update(poiStoreStaff,wrapper);
}
/**
*
* @param poiStoreStaffVO
*/
public String addStaffNew(PoiStoreStaffVO poiStoreStaffVO) throws Exception {
String staffCode = poiStoreStaffVO.getStaffCode();
String mobil = poiStoreStaffVO.getMobil();
QueryWrapper<PoiStoreStaff> staffQw = new QueryWrapper<>();
staffQw.eq("staff_code", staffCode).eq("status", "1");
List<PoiStoreStaff> staffs = poiStoreStaffDOMapper.selectList(staffQw);
if (CollectionUtils.isNotEmpty(staffs)){
return "0002";
}
if (StringUtils.isNotBlank(mobil) && poiStoreStaffVO.getUserId().equals(0L)){
QueryWrapper<PrivilageUserDO> mobileUserQw = new QueryWrapper<>();
mobileUserQw.eq("mobil",mobil).eq("status", "1");
List<PrivilageUserDO> mobileUsers = privilageUserDOMapper.selectList(mobileUserQw);
if (CollectionUtils.isNotEmpty(mobileUsers)){
return "0003";
}
}
QueryWrapper<PrivilageAccountDO> loginUserQw = new QueryWrapper<>();
loginUserQw.eq("login",mobil).eq("type", "1").eq("status", "1");
List<PrivilageAccountDO> loginUsers = privilageAccountDOMapper.selectList(loginUserQw);
if (CollectionUtils.isNotEmpty(loginUsers)){
return "0004";
}
//添加一个用户
PrivilageUserDO privilageUserDO = new PrivilageUserDO();
BeanUtils.copyProperties(poiStoreStaffVO,privilageUserDO);
Long userId = privilageUserService.addUser(privilageUserDO);
if (null == userId ) return "0001";
QueryWrapper<PrivilageRoleDO> rowMapper = new QueryWrapper<>();
rowMapper.eq("code",poiStoreStaffVO.getRole());
PrivilageRoleDO privilageRoleDO = privilageRoleDOMapper.selectOne(rowMapper);
//添加用户和角色的关系
privilageUserRoleService.insertUserRoleRelation(userId,privilageRoleDO.getId());
if (StringUtils.isNotBlank(poiStoreStaffVO.getIsOpen())){
//添加一个账号
privilageAccountService.insertAccount(poiStoreStaffVO.getStaffCode(), AccountEnum.ACCOUNT_FIRST_PWD.getDescribe(), userId);
}
//去生成一个推广人员二维码
QrCodeDO qrCodeDO = parseQrCodeBSD(poiStoreStaffVO);
//添加一个店铺人员
PoiStoreStaff poiStoreStaff = new PoiStoreStaff();
BeanUtils.copyProperties(poiStoreStaffVO,poiStoreStaff);
poiStoreStaff.setUserId(userId);
if (privilageRoleDO.getCode().equals("DZ-DIANZHANG")){
poiStoreStaff.setType(1L);
}else if(privilageRoleDO.getCode().equals("DG-DAOGOU")){
poiStoreStaff.setType(4L);
}
poiStoreStaff.setEpWechatQrCode(qrCodeDO.getQrCode());
poiStoreStaffDOMapper.insert(poiStoreStaff);
return "0000";
}
}

@ -873,7 +873,7 @@ public class StoreEmployeeService {
* @author dexiang.jiang
* @date 2020/05/05 17:24
*/
public String cancelQrCodeFromBSD(String cpUserId,String state) {
public boolean cancelQrCodeFromBSD(String cpUserId,String state) {
String url = "";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Map<String, Object> params = new HashMap<>();
@ -882,9 +882,9 @@ public class StoreEmployeeService {
String message = HttpClientUtil.httpPost(cancelQrCode + MD5FileUtil.getMD5String("BOSIDENG" + sdf.format(new Date())), JSONObject.toJSONString(params)).getMessage();
JSONObject qrCodeJson = JSONObject.parseObject(message);
BsdShareCodeResponse bsdResponse = qrCodeJson.toJavaObject(BsdShareCodeResponse.class);
if (bsdResponse.getSuccess() && StringUtils.isNotBlank(bsdResponse.getData())){
url = bsdResponse.getData();
if(null == bsdResponse){
return false;
}
return url;
return bsdResponse.getSuccess();
}
}

@ -105,4 +105,10 @@
and customer.id = #{customerId}
</if>
</select>
<select id="selectCustomerDOByStoreCode" resultType="Map">
select t.id,t.name,t.`code` from privilage_organizational t,privilage_organizational_domain t2,privilage_domain_entity t3,poi_store t4
where t.id = t2.org_id and t3.domain_id = t2.domain_id and t3.entity_id = t4.id and t4.`code` = #{storeCode}
</select>
</mapper>

Loading…
Cancel
Save