Merge branch 'feature/20200402_init_dev'

dev
kevin jiang 5 years ago
commit 28c65c13c1

@ -247,6 +247,12 @@
<useDefaultDelimiters>false</useDefaultDelimiters>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
<finalName>youke</finalName>

@ -1,6 +1,7 @@
package com.kiisoo.ic.customer;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@ -665,102 +666,50 @@ public class CustomerService {
return results;
}
Long shopId = stafferInfoVOS.get(0).getStoreId();
List<FriendDTO> thisList;
PageHelper.startPage(pageNum, pageSize);
IPage<FriendDTO> thisList;
// PageHelper.startPage(pageNum, pageSize);
com.baomidou.mybatisplus.extension.plugins.pagination.Page<FriendDTO> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageNum,pageSize);
if(startDate.getTime() == endDate.getTime()){
endDate = null;
}
if (roleCode.equals(RoleEnum.ROLE_CODE_DZ.getRoleCode())) {
// 0、新增好友 1、累计好友
if (flag == 0) {
thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(shopId, sellerId, search, startDate, endDate, type);
thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopId(page,shopId, sellerId, search, startDate, endDate, type);
} else {
thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopIdAndDate(shopId, sellerId, search, startDate, endDate, type);
thisList = opSellerCustomerRelationDOMapper.selectFriendListByShopIdAndDate(page, shopId, sellerId, search, startDate, endDate, type);
}
if (CollectionUtils.isNotEmpty(thisList)) {
for (int i = 0; i < thisList.size(); i++) {
if (CollectionUtils.isNotEmpty(thisList.getRecords())) {
for (int i = 0; i < thisList.getRecords().size(); i++) {
// 设置导购名称
if (!thisList.get(i).getInviteSellerId().equals(0L)) {
if (!thisList.getRecords().get(i).getInviteSellerId().equals(0L)) {
Map<String, Object> map = new HashMap<>();
map.put("id", thisList.get(i).getInviteSellerId());
String userName = poiStoreStaffDOMapper.selectUserNameById(thisList.get(i).getInviteSellerId());
map.put("id", thisList.getRecords().get(i).getInviteSellerId());
String userName = poiStoreStaffDOMapper.selectUserNameById(thisList.getRecords().get(i).getInviteSellerId());
if (StringUtils.isNotEmpty(userName)) {
thisList.get(i).setInviteSellerName(userName);
thisList.getRecords().get(i).setInviteSellerName(userName);
} else {
thisList.get(i).setInviteSellerName("");
thisList.getRecords().get(i).setInviteSellerName("");
}
} else {
thisList.get(i).setInviteSellerName("");
thisList.getRecords().get(i).setInviteSellerName("");
}
}
}
} else {
// 0、新增好友 1、累计好友
if (flag == 0) {
thisList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(userId, search, startDate, endDate, type);
thisList = opSellerCustomerRelationDOMapper.selectFriendListBySeller(page, userId, search, startDate, endDate, type);
} else {
thisList = opSellerCustomerRelationDOMapper.selectFriendListBySellerAndDate(userId, search, startDate, endDate, type);
thisList = opSellerCustomerRelationDOMapper.selectFriendListBySellerAndDate(page, userId, search, startDate, endDate, type);
}
}
results.put("this", new PageInfo<>(thisList));
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");
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);
}
results.put("this", new PageInfo<>(thisList.getRecords()));
return results;
}

@ -90,12 +90,7 @@ public class CustomerController extends BaseController {
Date endDate,
String version, @RequestParam("flag") int flag,int pageNum, int pageSize){
try {
Map<String, Object> stringObjectMap;
if(StringUtils.isNotBlank(version)){
stringObjectMap = customerService.listCustomerNew(userId, sellerId, search, roleCode, type, startDate, endDate, flag, pageNum, pageSize);
}else{
stringObjectMap = customerService.listCustomer(userId, sellerId, search, roleCode, type, startDate, endDate);
}
Map<String, Object> stringObjectMap = customerService.listCustomerNew(userId, sellerId, search, roleCode, type, startDate, endDate, flag, pageNum, pageSize);
return data(stringObjectMap);
} catch (Exception e) {
log.error("查询好友列表:",e);

@ -1,6 +1,8 @@
package com.kiisoo.ic.customer.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kiisoo.ic.customer.bean.FriendDTO;
import com.kiisoo.ic.customer.entity.OpSellerCustomerRelation;
import org.apache.ibatis.annotations.Param;
@ -25,7 +27,7 @@ public interface OpSellerCustomerRelationDOMapper extends BaseMapper<OpSellerCus
* @param type
* @return
*/
List<FriendDTO> selectFriendListBySeller(@Param("userId") Long userId,
IPage<FriendDTO> selectFriendListBySeller(Page<FriendDTO> page,@Param("userId") Long userId,
@Param("search") String search,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@ -41,12 +43,12 @@ public interface OpSellerCustomerRelationDOMapper extends BaseMapper<OpSellerCus
* @param type
* @return
*/
List<FriendDTO> selectFriendListByShopId(@Param("shopId") Long shopId,
@Param("sellerId") Long sellerId,
@Param("search") String search,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@Param("type") Integer type);
IPage<FriendDTO> selectFriendListByShopId(Page<FriendDTO> page, @Param("shopId") Long shopId,
@Param("sellerId") Long sellerId,
@Param("search") String search,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@Param("type") Integer type);
/**
* id
@ -73,7 +75,7 @@ public interface OpSellerCustomerRelationDOMapper extends BaseMapper<OpSellerCus
* @author dexiang.jiang
* @date 2020/05/10 21:50
*/
List<FriendDTO> selectFriendListByShopIdAndDate(@Param("shopId") Long shopId,
IPage<FriendDTO> selectFriendListByShopIdAndDate(Page<FriendDTO> page, @Param("shopId") Long shopId,
@Param("sellerId") Long sellerId,
@Param("search") String search,
@Param("startDate") Date startDate,
@ -91,7 +93,7 @@ public interface OpSellerCustomerRelationDOMapper extends BaseMapper<OpSellerCus
* @author dexiang.jiang
* @date 2020/05/10 22:01
*/
List<FriendDTO> selectFriendListBySellerAndDate(@Param("userId") Long userId,
IPage<FriendDTO> selectFriendListBySellerAndDate(Page<FriendDTO> page,@Param("userId") Long userId,
@Param("search") String search,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@ -99,7 +101,6 @@ public interface OpSellerCustomerRelationDOMapper extends BaseMapper<OpSellerCus
Long selectSellerCustomerRelation(@Param("customerId") Long customerId, @Param("userId") Long userId, @Param("storeId") Long storeId);
Integer countStoreCustomers(@Param("customerId") Long customerId, @Param("userId") Long userId, @Param("storeId") Long storeId);
List<Map<String, Object>> selectCustomersByCpUserId();

@ -665,18 +665,23 @@ public class CustomerViewService {
shopIdList = list1.stream().map(PoiStore::getId).collect(Collectors.toList());
List<String> cpUserIds = privilageCpUserStoreDOMapper.selectCpUserIdsByStoreIds(shopIdList);
Long all = privilageCpUserDOMapper.selectStoresCount(cpUserIds);
Long dis = privilageCpUserDOMapper.selectDistinctStoresCount(cpUserIds);
List<Map<String, Object>> dis = privilageCpUserDOMapper.selectDistinctStoresCount(cpUserIds);
result.setAllCustomer(all);
result.setAllValidCustomer(dis);
if(null != dis){
result.setAllValidCustomer(Long.parseLong(dis.get(0).get("rows").toString()));
}
}
//管理员/总运营人员
else if (privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_GLY.getRoleCode()) || privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_ALL_YYRY.getRoleCode())) {
Long all = privilageCpUserDOMapper.selectAllCount();
Long dis = privilageCpUserDOMapper.selectDistinctAllCount();
List<Map<String, Object>> dis = privilageCpUserDOMapper.selectDistinctAllCount();
result.setAllCustomer(all);
result.setAllValidCustomer(dis);
if(null != dis){
result.setAllValidCustomer(Long.parseLong(dis.get(0).get("rows").toString()));
}
}
return result;

@ -197,9 +197,11 @@ public class EmployeeController extends BaseController {
*/
@RequestMapping(value = "update",method = RequestMethod.POST)
@ResponseBody
public Map<String,Object> updateUser(@RequestBody EmployeeDO employee){
public Map<String,Object> updateUser(@RequestParam("id")Long id,@RequestParam("mobile")String mobile,
@RequestParam("cpUserName")String cpUserName,@RequestParam("cpUserId")String cpUserId,
@RequestParam("alias")String alias){
try {
Boolean hasAdd = employeeService.updateUser(employee);
Boolean hasAdd = employeeService.updateUser(id,cpUserId,mobile,cpUserName,alias);
return data(hasAdd);
}catch (Exception e){
log.error("修改用户失败",e);

@ -28,6 +28,10 @@ public class EmployeeDO {
*
*/
private String name;
/**
*
*/
private String cpUserName;
/**
* id,20(idid)
*/

@ -19,7 +19,7 @@ public interface PrivilageCpUserDOMapper extends BaseMapper<PrivilageCpUserDO> {
Long selectAllCount();
Long selectDistinctAllCount();
List<Map<String, Object>> selectDistinctAllCount();
List<String> selectCustomerIdsByCpUserId(@Param("cpUserId")String cpUserId);
@ -29,7 +29,7 @@ public interface PrivilageCpUserDOMapper extends BaseMapper<PrivilageCpUserDO> {
Long selectStoresCount(@Param("cpUserIds")List<String> cpUserIds);
Long selectDistinctStoresCount(@Param("cpUserIds")List<String> cpUserIds);
List<Map<String, Object>> selectDistinctStoresCount(@Param("cpUserIds")List<String> cpUserIds);
Long selectStoresCountById(@Param("shopIds")List<Long> shopIds);

@ -33,6 +33,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
@ -257,36 +258,34 @@ public class EmployeeService {
/**
*
*
* @param employee
* @param id
* @param cpUserId
* @param mobile
* @param cpUserName
* @param alias
* @return
* @throws WxErrorException
*/
@Transactional(rollbackFor = Exception.class)
public Boolean updateUser(EmployeeDO employee) throws Exception {
public Boolean updateUser(Long id, String cpUserId,String mobile,String cpUserName,String alias) throws Exception {
PrivilageCpUserDO privilageCpUserDO = new PrivilageCpUserDO();
BeanUtils.copyProperties(employee, privilageCpUserDO);
privilageCpUserDO.setCpUserId(employee.getUserId());
privilageCpUserDO.setId(id);
privilageCpUserDO.setMobile(mobile);
privilageCpUserDO.setName(cpUserName);
privilageCpUserDO.setAlias(alias);
int update = privilageCpUserDOMapper.updateById(privilageCpUserDO);
if (update == 0) {
throw new Exception("修改成员失败");
}
//维护部门关系——删除原有部门关系
QueryWrapper<PrivilageCpUserDepartmentDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(DATABASE_CP_USER_ID_KEY, privilageCpUserDO.getId());
privilageCpUserDepartmentDOMapper.delete(queryWrapper);
Long[] departIds = employee.getDepartIds();
Integer[] orders = employee.getOrders();
Integer[] isLeaderInDept = employee.getIsLeaderInDept();
for (int i = 0; i < departIds.length; i++) {
PrivilageCpUserDepartmentDO relation = new PrivilageCpUserDepartmentDO(privilageCpUserDO.getId(), departIds[i], orders[i], isLeaderInDept[i]);
privilageCpUserDepartmentDOMapper.insert(relation);
}
//成功则添加用户到企业微信
EmployeeDO employee = new EmployeeDO();
employee.setName(cpUserName);
employee.setId(id);
employee.setAlias(alias);
employee.setUserId(cpUserId);
employee.setMobile(mobile);
qwMailListManageService.updateUser(employee);
return true;
}

@ -1,6 +1,7 @@
package com.kiisoo.ic.job.detail;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kiisoo.ic.common.utils.RedisUtil;
import com.kiisoo.ic.customer.CustomerService;
import com.kiisoo.ic.customer.entity.OpSellerCustomerRelation;
import com.kiisoo.ic.customer.mapper.OpSellerCustomerRelationDOMapper;
@ -55,6 +56,9 @@ public class CustomerDataJob {
@Autowired
private CustomerService customerService;
@Autowired
private RedisUtil redisUtil;
public void handle(String cpUserIds) {
@ -128,6 +132,7 @@ public class CustomerDataJob {
opSellerCustomerRelationDOMapper.delete(relationQueryWrapper);
Long storeId = privilageCpUserStoreDOMapper.selectOneByCpUserId(cpUserId);
ProduceDTO produceDTO = new ProduceDTO();
produceDTO.setIndex(index);
produceDTO.setStoreId(storeId);

@ -2,10 +2,12 @@ package com.kiisoo.ic.store.bean;
import com.kiisoo.ic.store.entity.PoiStoreStaff;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class PoiStoreStaffDTO extends PoiStoreStaff {
/**名称*/

@ -18,6 +18,18 @@ public class StoreUserDTO extends PoiStore{
*
*/
private String cpUserId;
/**
*
*/
private String cpUserName;
/**
*
*/
private String alias;
/**
*
*/
private String mobile;
/**
* privilage_cp_user id
*/

@ -1,6 +1,6 @@
logging:
level:
root: warn
root: info
mybatis:
mapperLocations: classpath:mapper/*.xml

@ -37,10 +37,10 @@
CONCAT('%',#{search},'%'))
</if>
<if test="startDate != null">
and date(t1.create_time) &gt;= #{startDate}
and t1.create_time &gt;= #{startDate}
</if>
<if test="endDate != null">
and date(t1.create_time) &lt;= #{endDate}
and t1.create_time &lt;= #{endDate}
</if>
order by t1.create_time desc
</select>
@ -79,10 +79,10 @@
CONCAT('%',#{search},'%'))
</if>
<if test="startDate != null">
and date(t1.create_time) &gt;= #{startDate}
and t1.create_time &gt;= #{startDate}
</if>
<if test="endDate != null">
and date(t1.create_time) &lt;= #{endDate}
and t1.create_time &lt;= #{endDate}
</if>
order by t1.create_time desc
</select>

@ -22,8 +22,8 @@
select count(id) from op_cp_user_customer_relation
</select>
<select id="selectDistinctAllCount" resultType="java.lang.Long">
select count(distinct customer_user_id) from op_cp_user_customer_relation
<select id="selectDistinctAllCount" resultType="java.util.Map">
EXPLAIN select count(distinct customer_user_id) from op_cp_user_customer_relation
</select>
<select id="selectStoreCount" resultType="java.lang.Long">
@ -38,8 +38,8 @@
</foreach>
</select>
<select id="selectDistinctStoresCount" resultType="java.lang.Long">
select count(distinct customer_user_id) from op_cp_user_customer_relation where cp_user_id in
<select id="selectDistinctStoresCount" resultType="java.util.Map">
EXPLAIN select count(distinct customer_user_id) from op_cp_user_customer_relation where cp_user_id in
<foreach collection="cpUserIds" separator="," item="item" close=")" index="index" open="(">
#{item}
</foreach>

@ -3,8 +3,16 @@
<mapper namespace="com.kiisoo.ic.store.mapper.PrivilageCpUserStoreDOMapper">
<select id="selectCpUserByShops" resultType="com.kiisoo.ic.store.entity.StoreUserDTO">
select distinct pcu.cp_user_id as cpUserId,pcu.qr_code as qrCodeAction,pcus.store_id as id,pcu.id as userId ,t.name,t.code
select distinct
pcu.cp_user_id as cpUserId,
pcu.qr_code as qrCodeAction,
pcus.store_id as id,
pcu.id as userId ,
pcu.name as cpUserName ,
pcu.mobile as mobile ,
pcu.alias as alias ,
t.name,
t.code
from poi_store t join privilage_domain_entity t2 on t.id = t2.entity_id and t2.type = 3
left join privilage_cp_user_store pcus on t.id = pcus.store_id
left join privilage_cp_user pcu on pcus.cp_user_id = pcu.id and pcu.status in (1,4)
@ -17,8 +25,7 @@
</foreach>
</if>
</where>
order by pcu.id desc
order by pcu.id desc
</select>
<select id="selectOneByCpUserId" resultType="java.lang.Long">

Loading…
Cancel
Save