dev_0531
郑皇 5 years ago
parent 3f5187892e
commit ef80305b0c

@ -0,0 +1,21 @@
package com.kiisoo.ic.store.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.kiisoo.ic.store.entity.PoiStore;
import lombok.Data;
import java.util.Date;
/**
* @Description:
* @Author: Caps
* @Date 2020-04-08
*/
@Data
public class PoiStoreDTO extends PoiStore {
private Long companyId;
private Long parentId;
}

@ -59,6 +59,34 @@ public class PoiStoreController extends BaseController {
}
/**
* idid
* @return
*/
@RequestMapping(value = "/user/shopDTO",method = RequestMethod.POST)
@ResponseBody
public Map<String,Object> getUserShopDTO(@RequestParam("userId")long userId, @RequestParam(value = "customerIds",required =false)String customerIds){
try {
List<Long> customers = null;
if (StringUtils.isNotBlank(customerIds)){
String[] split = customerIds.replace("[", "").replace("]", "").split(",");
List<String> strings = Arrays.asList(split);
if (CollectionUtils.isNotEmpty(strings)){
customers = new ArrayList<>();
for (String customerId:strings){
if (StringUtils.isNotBlank(customerId)){
customers.add(Long.parseLong(customerId));
}
}
}
}
return data(poiStoreService.getRegionShopDTO(userId,customers));
}catch (Exception e){
log.error("获取用户店铺失败",e);
return fail();
}
}
/**
*
*

@ -3,11 +3,14 @@ package com.kiisoo.ic.store.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kiisoo.ic.generalize.entity.CompanyStoreDO;
import com.kiisoo.ic.generalize.entity.ShopRegionDO;
import com.kiisoo.ic.store.bean.PoiStoreDTO;
import com.kiisoo.ic.store.entity.PoiStore;
import com.kiisoo.ic.system.entity.PrivilageUserDO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@ -33,6 +36,8 @@ public interface PoiStoreDOMapper extends BaseMapper<PoiStore> {
ShopRegionDO selectShopMsg(Long shopId);
List<PoiStoreDTO> selectDTOBatchIds(@Param("shopIds") Collection<? extends Serializable> shopIds);
CompanyStoreDO selectCompanyStore(Long sellerId);
List<PoiStore> selectShopByCompany(Long orgId);

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kiisoo.ic.customer.service.CustomerViewService;
import com.kiisoo.ic.domain.service.PrivilageDomainService;
import com.kiisoo.ic.generalize.service.RetailCompanyService;
import com.kiisoo.ic.store.bean.PoiStoreDTO;
import com.kiisoo.ic.store.bean.PoiStoreStaffDTO;
import com.kiisoo.ic.store.entity.PoiStore;
import com.kiisoo.ic.store.entity.PoiStoreStaff;
@ -76,6 +77,35 @@ public class PoiStoreService {
return poiStores;
}
/**
* id
* @param regionId
*/
public List<PoiStoreDTO> getRegionShopDTO(long userId,List<Long> customerIds){
List<PoiStoreDTO> poiStores = new ArrayList<>();
//找到店铺集合
List<Long> shopsIds = privilageDomainService.listUserDatePermission(userId);
if(null != customerIds && customerIds.size()>0){
Set<Long> shopIds = new HashSet<>();
customerIds.forEach(customerId -> {
Set<Long> shops = customerViewService.getCompanyShop(customerId,userId);
if (CollectionUtils.isNotEmpty(shops)){
shopIds.addAll(shops);
}
});
if(shopIds.size() > 0){
List<PoiStoreDTO> regionPoiStores = poiStoreDOMapper.selectDTOBatchIds(shopIds);
for(PoiStoreDTO item : regionPoiStores){
if(shopsIds.contains(item.getId())){
poiStores.add(item);
}
}
}
}else{
poiStores = poiStoreDOMapper.selectDTOBatchIds(shopsIds);
}
return poiStores;
}
/**
*
*

@ -48,7 +48,31 @@
and t2.entity_id = t3.id
and t2.type = 3
</select>
<select id="selectDTOBatchIds" resultType="com.kiisoo.ic.store.bean.PoiStoreDTO">
SELECT
t.*,
t1.domain_id,
t2.org_id AS company_id,
t3.parent_id
FROM
poi_store t
LEFT JOIN privilage_domain_entity t1 ON t.id = t1.entity_id
LEFT JOIN privilage_organizational_domain t2 ON t1.domain_id = t2.domain_id
LEFT JOIN privilage_organizational t3 ON t2.org_id = t3.id
WHERE
1 = 1
<choose>
<when test="shopIds != null and shopIds.size > 0">
and t.id in
<foreach collection="shopIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</when>
<otherwise>
and 1 = 0
</otherwise>
</choose>
</select>
<select id="selectCustomerShopByCompany" resultType="com.kiisoo.ic.store.entity.PoiStore">
select t3.id,t3.name
from privilage_organizational t,
@ -76,7 +100,7 @@
<choose>
<when test="customerIds != null and customerIds.size > 0">
and t1.org_id in
<foreach collection="customerIds" index="index" item="item" open="(" separator="," close=")">
<foreach collection="customerIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</when>
@ -105,7 +129,7 @@
select t1.id,t1.name,t1.type,t1.code from poi_store t1
<if test="name != null and name != ''">
where (t1.name LIKE CONCAT('%',#{name},'%') OR t1.code LIKE
CONCAT('%',#{name},'%'))
CONCAT('%',#{name},'%'))
</if>
</select>
@ -130,46 +154,45 @@
</select>
<select id="selectShopByCustomerIdAndStore" resultType="com.kiisoo.ic.store.entity.PoiStore">
select t3.id,t3.name,t3.code
from privilage_organizational_domain t1 join privilage_domain_entity t2 on t1.domain_id = t2.domain_id and t2.type = 3
from privilage_organizational_domain t1 join privilage_domain_entity t2 on t1.domain_id = t2.domain_id and
t2.type = 3
join poi_store t3 on t2.entity_id = t3.id
<where>
<if test="null != storeId and storeId != 0">
and t2.entity_id = #{storeId}
</if>
<if test="null != code and code != ''">
and (t3.name LIKE CONCAT('%',#{code},'%') OR t3.code LIKE
CONCAT('%',#{code},'%'))
</if>
<if test="customerIds != null and customerIds.size > 0">
and t1.org_id in
<foreach collection="customerIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
<where>
<if test="null != storeId and storeId != 0">
and t2.entity_id = #{storeId}
</if>
<if test="null != code and code != ''">
and (t3.name LIKE CONCAT('%',#{code},'%') OR t3.code LIKE
CONCAT('%',#{code},'%'))
</if>
<if test="customerIds != null and customerIds.size > 0">
and t1.org_id in
<foreach collection="customerIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
<!-- <choose>-->
<!-- <when test="customerIds != null and customerIds.size > 0">-->
<!-- and t1.org_id in-->
<!-- <foreach collection= <foreaindex="index" item <foreaindex="index" ite," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- and 0 = 0-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- <if test="customerIds != null and customerIds.size > 0">-->
<!-- and t1.org_id in-->
<!-- <foreach collection="customerIds" index="index"="customerIds" index="index"="customerIds" index separator="," close=")">-->
<!-- #{reach>-->
<!-- </if>-->
<!-- <choose>-->
<!-- <when test="customerIds != null and customerIds.size > 0">-->
<!-- and t1.org_id in-->
<!-- <foreach collection= <foreaindex="index" item <foreaindex="index" ite," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- and 0 = 0-->
<!-- </otherwise>-->
<!-- </choose>-->
<!-- <if test="customerIds != null and customerIds.size > 0">-->
<!-- and t1.org_id in-->
<!-- <foreach collection="customerIds" index="index"="customerIds" index="index"="customerIds" index separator="," close=")">-->
<!-- #{reach>-->
<!-- </if>-->
</select>

@ -148,13 +148,13 @@ public class OrganizationInit {
//查看用户
PrivilageUserDO userdo = new PrivilageUserDO();
userdo.setMobil(phone);
userdo.setMobile(phone);
PrivilageUserDO us = privilageUserDOMapper.selectOne(new QueryWrapper<>(userdo));
if (null == us) {
//如果没有用户就增加
us = new PrivilageUserDO();
us.setName(v.getName());
us.setMobil(phone);
us.setMobile(phone);
us.setEmail(v.getEmail());
us.setAddress(v.getAdress());
us.setStatus(1);

@ -129,12 +129,12 @@ public class OrganizationInitPhone {
//查看用户
PrivilageUserDO userdo = new PrivilageUserDO();
userdo.setMobil(userI);
userdo.setMobile(userI);
if(StringUtils.isNotBlank(userI)){
try{
PrivilageUserDO us = privilageUserDOMapper.selectOne(new QueryWrapper<>(userdo));
if (null != us) {
us.setMobil(phone);
us.setMobile(phone);
us.setUpdateTime(new Date());
privilageUserDOMapper.updateById(us);
}

@ -290,11 +290,11 @@ public class InitDataTest {
//查看用户
PrivilageUserDO userdo = new PrivilageUserDO();
userdo.setMobil(phone);
userdo.setMobile(phone);
// 用户手机号码更新
PrivilageUserDO us = privilageUserDOMapper.selectOne(new QueryWrapper<>(userdo));
if (null != us) {
us.setMobil(newPhone);
us.setMobile(newPhone);
privilageUserDOMapper.updateById(us);
} else {
return;
@ -893,13 +893,13 @@ public class InitDataTest {
//查看用户
PrivilageUserDO userdo = new PrivilageUserDO();
userdo.setMobil(phone);
userdo.setMobile(phone);
PrivilageUserDO us = privilageUserDOMapper.selectOne(new QueryWrapper<>(userdo));
if (null == us) {
//如果没有用户就增加
us = new PrivilageUserDO();
us.setName(name);
us.setMobil(phone);
us.setMobile(phone);
us.setEmail("");
us.setAddress("");
us.setStatus(1);
@ -1137,7 +1137,7 @@ public class InitDataTest {
// System.out.println("没有对应用户" + ArrayUtils.toString(arr));
PrivilageUserDO userDOEntity = new PrivilageUserDO();
userDOEntity.setMobil(phone);
userDOEntity.setMobile(phone);
userDOEntity.setName(name);
userDOEntity.setAbbreviation(abName);
userDOEntity.setStatus(1);

Loading…
Cancel
Save