@ -19,9 +19,11 @@ import com.kiisoo.ic.activity.service.IPmnPromotionSrcService;
import com.kiisoo.ic.constants.Constants ;
import com.kiisoo.ic.store.entity.PoiStore ;
import com.kiisoo.ic.store.entity.PoiStoreStaff ;
import com.kiisoo.ic.store.entity.PoiStoreStaffVO ;
import com.kiisoo.ic.store.mapper.PoiStoreDOMapper ;
import com.kiisoo.ic.store.mapper.PoiStoreStaffDOMapper ;
import com.kiisoo.ic.store.service.StoreEmployeeService ;
import com.kiisoo.ic.system.bean.PrivilageUserBean ;
import com.kiisoo.ic.system.entity.PrivilageAccountDO ;
import com.kiisoo.ic.system.entity.PrivilageRoleDO ;
import com.kiisoo.ic.system.entity.PrivilageUserDO ;
@ -98,7 +100,7 @@ public class PmnPromotionSrcServiceImpl extends ServiceImpl<PmnPromotionSrcDOMap
} else {
return lists ;
}
if ( type . equals ( 2L ) ) {
if ( type . equals ( 2L ) ) {
userId = staff . getStoreId ( ) ;
}
List < PmnPromotionSrc > srcs = list ( Wrappers . < PmnPromotionSrc > lambdaQuery ( ) . eq ( PmnPromotionSrc : : getPromoterId , userId ) . eq ( PmnPromotionSrc : : getType , type ) ) ;
@ -126,7 +128,7 @@ public class PmnPromotionSrcServiceImpl extends ServiceImpl<PmnPromotionSrcDOMap
}
vo . setInstanceVO ( instance ) ;
vo . setQrCode ( "/activity/" + src . getCode ( ) + ".png" ) ;
if ( type . equals ( 2L ) ) {
if ( type . equals ( 2L ) ) {
QueryWrapper < PoiStoreStaff > wrapper = new QueryWrapper < > ( ) ;
//如果有店铺则查店铺
wrapper . eq ( "store_id" , staff . getStoreId ( ) ) ;
@ -134,16 +136,27 @@ public class PmnPromotionSrcServiceImpl extends ServiceImpl<PmnPromotionSrcDOMap
wrapper . eq ( "status" , 1 ) ;
wrapper . ne ( "user_id" , 0 ) ;
wrapper . orderByDesc ( "id" ) ;
wrapper . select ( " id") ;
wrapper . select ( " user_ id") ;
//返回店铺对应的导购
List < PoiStoreStaff > poiStoreStaffs = poiStoreStaffDOMapper . selectList ( wrapper ) ;
List < Long > userIds = poiStoreStaffs . stream ( ) . map ( PoiStoreStaff : : get Id) . collect ( Collectors . toList ( ) ) ;
List < Long > userIds = poiStoreStaffs . stream ( ) . map ( PoiStoreStaff : : get User Id) . collect ( Collectors . toList ( ) ) ;
List < PmnPromotionSrc > staffSrcs = pmnPromotionSrcService . list ( Wrappers . < PmnPromotionSrc > lambdaQuery ( ) . in ( PmnPromotionSrc : : getPromoterId , userIds ) . eq ( PmnPromotionSrc : : getType , 1 ) . select ( PmnPromotionSrc : : getPromoterId ) . eq ( PmnPromotionSrc : : getInstanceId , src . getInstanceId ( ) ) ) ;
List < Long > staffSrcUsers = staffSrcs . stream ( ) . map ( PmnPromotionSrc : : getPromoterId ) . collect ( Collectors . toList ( ) ) ;
List < PoiStoreStaff > storeStaffs ;
if ( staffSrcUsers . size ( ) > 0 ) {
storeStaffs = poiStoreStaffDOMapper . selectBatchIds ( staffSrcUsers ) ;
vo . setStoreStaffs ( storeStaffs ) ;
if ( staffSrcUsers . size ( ) > 0 ) {
storeStaffs = poiStoreStaffDOMapper . selectList ( Wrappers . < PoiStoreStaff > lambdaQuery ( ) . in ( PoiStoreStaff : : getUserId , staffSrcUsers ) ) ;
List < PoiStoreStaffVO > staffVOs = new ArrayList < > ( ) ;
for ( PoiStoreStaff s : storeStaffs ) {
PoiStoreStaffVO staffVO = new PoiStoreStaffVO ( ) ;
BeanUtils . copyProperties ( s , staffVO ) ;
PrivilageUserBean privilageUserBean = privilageUserDOMapper . selectUserInfoAndRoleInfo ( s . getUserId ( ) ) ;
if ( null ! = privilageUserBean ) {
staffVO . setName ( privilageUserBean . getName ( ) ) ;
staffVO . setMobil ( privilageUserBean . getMobil ( ) ) ;
}
staffVOs . add ( staffVO ) ;
}
vo . setStoreStaffs ( staffVOs ) ;
}
}
lists . add ( vo ) ;
@ -157,7 +170,7 @@ public class PmnPromotionSrcServiceImpl extends ServiceImpl<PmnPromotionSrcDOMap
try {
Long promoterId = staff . getUserId ( ) ;
int type = 1 ;
if ( staff . getType ( ) . equals ( 1L ) ) {
if ( staff . getType ( ) . equals ( 1L ) ) {
promoterId = staff . getStoreId ( ) ;
type = 0 ;
}
@ -180,7 +193,7 @@ public class PmnPromotionSrcServiceImpl extends ServiceImpl<PmnPromotionSrcDOMap
saveSrc . setUpdateTime ( new Date ( ) ) ;
saveSrc . setStatus ( 1L ) ;
String url = storeEmployeeService . createActivityQrCode ( staff . getStaffCode ( ) , staff . getStoreCode ( ) , type , instanceId , promoterId ) ;
if ( url = = null | | url . length ( ) < = 0 ) {
if ( url = = null | | url . length ( ) < = 0 ) {
url = "https://wework.qpic.cn/wwpic/789548_SW5hhAm-TgyEW0F_1590128879/0" ; //测试用
}
saveSrc . setQrCode ( url ) ;
@ -206,7 +219,7 @@ public class PmnPromotionSrcServiceImpl extends ServiceImpl<PmnPromotionSrcDOMap
List < PromotionSrcVO > srcs = new ArrayList < > ( ) ;
for ( PmnActivityStoreRelation store : storeRelations . getRecords ( ) ) {
PmnPromotionSrc src = getOne ( Wrappers . < PmnPromotionSrc > lambdaQuery ( ) . eq ( PmnPromotionSrc : : getPromoterId , store . getStoreId ( ) ) . eq ( PmnPromotionSrc : : getInstanceId , instanceId ) . eq ( PmnPromotionSrc : : getType , 2 ) . last ( "limit 0,1" ) ) ;
if ( src = = null | | src . getCode ( ) = = null ) {
if ( src = = null | | src . getCode ( ) = = null ) {
PoiStoreStaff staff = poiStoreStaffDOMapper . selectOne ( Wrappers . < PoiStoreStaff > lambdaQuery ( ) . eq ( PoiStoreStaff : : getStoreId , store . getStoreId ( ) ) . eq ( PoiStoreStaff : : getType , 1 ) . ne ( PoiStoreStaff : : getUserId , 0 ) . eq ( PoiStoreStaff : : getDeleted , 0 ) . eq ( PoiStoreStaff : : getStatus , 1 ) ) ;
src = createCode ( staff , instanceId ) ;
}