@ -97,14 +97,16 @@ public class BsAgentPriceController {
} else if ( accountObjectType . equals ( SecUserObjectTypeEnum . type4 . getCode ( ) ) ) {
type = AgentPriceTypeEnum . type2 . getCode ( ) ;
agentPrice = agentPriceService . getDetail ( AgentPriceTypeEnum . type2 , body . getString ( "merNo" ) , body . getString ( "oilNo" ) ) ;
agentMer = agentMerService . getDetailByAgent ( userSession . getAccount ( ) . getObjectId ( ) , body . getString ( "merNo" ) ) ;
if ( agentMer ! = null ) {
agentPrice = agentPriceService . getDetail ( agentMer . getId ( ) , body . getString ( "oilNo" ) ) ;
}
} else if ( accountObjectType . equals ( SecUserObjectTypeEnum . type5 . getCode ( ) ) ) {
type = AgentPriceTypeEnum . type3 . getCode ( ) ;
agentPrice = agentPriceService . getDetail ( AgentPriceTypeEnum . type3 , body . getString ( "merNo" ) , body . getString ( "oilNo" ) ) ;
agentMer = agentMerService . getDetailByAgentStaff ( userSession . getAccount ( ) . getObjectId ( ) , body . getString ( "merNo" ) ) ;
if ( agentMer ! = null ) {
agentPrice = agentPriceService . getDetail ( agentMer . getId ( ) , body . getString ( "oilNo" ) ) ;
}
} else {
throw ErrorHelp . genException ( SysCode . System , ErrorCode . COMMON_ERROR , "未知的角色" ) ;
}
@ -114,8 +116,6 @@ public class BsAgentPriceController {
if ( oilNo = = null ) {
throw ErrorHelp . genException ( SysCode . System , ErrorCode . COMMON_ERROR , "未知的油号" ) ;
}
// 查询油站
if ( agentPrice = = null ) {
agentPrice = new BsAgentPrice ( ) ;
@ -154,7 +154,7 @@ public class BsAgentPriceController {
}
if ( body . getJSONArray ( "merNoList" ) = = null
| | body . getInteger ( "oilNo" ) = = null
| | StringUtils . isBlank ( body . getString ( "oilNo" ) )
| | body . getBigDecimal ( "priceRate" ) = = null ) {
throw ErrorHelp . genException ( SysCode . System , ErrorCode . REQ_PARAMS_ERROR , "" ) ;
}
@ -175,17 +175,23 @@ public class BsAgentPriceController {
BsAgentMer agentMer = null ;
if ( accountObjectType . equals ( SecUserObjectTypeEnum . type1 . getCode ( ) ) ) {
type = AgentPriceTypeEnum . type1 . getCode ( ) ;
agentPrice = agentPriceService . getDetail ( AgentPriceTypeEnum . type1 , mer . getString ( "merNo" ) , body . getString ( "oilNo" ) ) ;
agentPrice = agentPriceService . getDetail ( AgentPriceTypeEnum . type1 , merchant . getMerNo ( ) , body . getString ( "oilNo" ) ) ;
} else if ( accountObjectType . equals ( SecUserObjectTypeEnum . type4 . getCode ( ) ) ) {
type = AgentPriceTypeEnum . type2 . getCode ( ) ;
agentPrice = agentPriceService . getDetail ( AgentPriceTypeEnum . type2 , mer . getString ( "merNo" ) , body . getString ( "oilNo" ) ) ;
agentMer = agentMerService . getDetailByAgent ( userSession . getAccount ( ) . getObjectId ( ) , body . getString ( "merNo" ) ) ;
agentMer = agentMerService . getDetailByAgent ( userSession . getAccount ( ) . getObjectId ( ) , merchant . getMerNo ( ) ) ;
if ( agentMer = = null ) {
throw ErrorHelp . genException ( SysCode . System , ErrorCode . COMMON_ERROR , "未分配此油站" ) ;
}
agentPrice = agentPriceService . getDetail ( agentMer . getId ( ) , body . getString ( "oilNo" ) ) ;
} else if ( accountObjectType . equals ( SecUserObjectTypeEnum . type5 . getCode ( ) ) ) {
type = AgentPriceTypeEnum . type3 . getCode ( ) ;
agentPrice = agentPriceService . getDetail ( AgentPriceTypeEnum . type3 , mer . getString ( "merNo" ) , body . getString ( "oilNo" ) ) ;
agentMer = agentMerService . getDetailByAgentStaff ( userSession . getAccount ( ) . getObjectId ( ) , body . getString ( "merNo" ) ) ;
agentMer = agentMerService . getDetailByAgentStaff ( userSession . getAccount ( ) . getObjectId ( ) , merchant . getMerNo ( ) ) ;
if ( agentMer = = null ) {
throw ErrorHelp . genException ( SysCode . System , ErrorCode . COMMON_ERROR , "未分配此油站" ) ;
}
agentPrice = agentPriceService . getDetail ( agentMer . getId ( ) , body . getString ( "oilNo" ) ) ;
} else {
throw ErrorHelp . genException ( SysCode . System , ErrorCode . COMMON_ERROR , "未知的角色" ) ;
@ -235,16 +241,6 @@ public class BsAgentPriceController {
}
Integer accountObjectType = userSession . getAccount ( ) . getObjectType ( ) ;
AgentPriceTypeEnum type = null ;
if ( accountObjectType . equals ( SecUserObjectTypeEnum . type1 . getCode ( ) ) ) {
type = AgentPriceTypeEnum . type1 ;
} else if ( accountObjectType . equals ( SecUserObjectTypeEnum . type4 . getCode ( ) ) ) {
type = AgentPriceTypeEnum . type2 ;
} else if ( accountObjectType . equals ( SecUserObjectTypeEnum . type5 . getCode ( ) ) ) {
type = AgentPriceTypeEnum . type3 ;
} else {
throw ErrorHelp . genException ( SysCode . System , ErrorCode . COMMON_ERROR , "未知的角色" ) ;
}
// 查询商户
BsMerchant merchant = merchantService . getMerchant ( merNo ) ;
@ -252,6 +248,13 @@ public class BsAgentPriceController {
throw ErrorHelp . genException ( SysCode . System , ErrorCode . COMMON_ERROR , "未知的商户" ) ;
}
BsAgentMer agentMer = null ;
if ( accountObjectType . equals ( SecUserObjectTypeEnum . type4 . getCode ( ) ) ) {
agentMer = agentMerService . getDetailByAgent ( userSession . getAccount ( ) . getObjectId ( ) , merNo ) ;
} else if ( accountObjectType . equals ( SecUserObjectTypeEnum . type5 . getCode ( ) ) ) {
agentMer = agentMerService . getDetailByAgentStaff ( userSession . getAccount ( ) . getObjectId ( ) , merNo ) ;
}
List < Map < String , Object > > oilPriceMapList = new ArrayList < > ( ) ;
Map < String , Object > oilPriceMap ;
@ -265,13 +268,23 @@ public class BsAgentPriceController {
oilPriceMap . put ( "oilNo" , price . getOilNo ( ) ) ;
oilPriceMap . put ( "oilNoName" , price . getOilNoName ( ) ) ;
oilPriceMap . put ( "status" , price . getStatus ( ) ) ;
// 价格
BsAgentPrice priceRate = agentPriceService . getDetail ( type , merchant . getMerNo ( ) , price . getOilNo ( ) ) ;
if ( priceRate = = null ) {
oilPriceMap . put ( "priceRate" , 100L ) ;
if ( accountObjectType . equals ( SecUserObjectTypeEnum . type1 . getCode ( ) ) ) {
// 价格
BsAgentPrice priceRate = agentPriceService . getDetail ( AgentPriceTypeEnum . type1 , merchant . getMerNo ( ) , price . getOilNo ( ) ) ;
if ( priceRate ! = null ) {
oilPriceMap . put ( "priceRate" , priceRate . getPriceRate ( ) ) ;
}
} else {
if ( agentMer ! = null ) {
// 价格
BsAgentPrice priceRate = agentPriceService . getDetail ( agentMer . getId ( ) , price . getOilNo ( ) ) ;
if ( priceRate ! = null ) {
oilPriceMap . put ( "priceRate" , priceRate . getPriceRate ( ) ) ;
}
}
}
oilPriceMapList . add ( oilPriceMap ) ;
}
return ResponseMsgUtil . success ( oilPriceMapList ) ;