@ -326,7 +326,7 @@ public class QCodeInfoServiceImpl {
LogUtil . WriteLog_Info ( "积分恢复=====流水记录已插入" , "QCodeInfoServiceImpl" ) ;
Map < String , Object > updateCafe = new HashMap < > ( ) ;
updateCafe . put ( "rollback" , "SUCCESS" ) ;
updateCafe . put ( "integralrollback" , ( maxId + 1 ) ) ;
updateCafe . put ( "integralrollback" , ( maxId + 1 0 ) ) ;
updateCafe . put ( "rollbackTime" , rollbackTime ) ;
updateCafe . put ( "orderId" , orderId ) ;
updateCafe . put ( "serverOperationId" , serverOperationId ) ;
@ -355,21 +355,19 @@ public class QCodeInfoServiceImpl {
double enabledTI = bd . doubleValue ( ) ;
double enabledTCp = Double . parseDouble ( obj1T . get ( "CPENABLEINTEGRATION" ) . toString ( ) ) ;
BigDecimal bdcp = BigDecimal . valueOf ( enabledTCp + Double . parseDouble ( payIntegral ) ) ;
bdcp = bdcp . setScale ( 1 , RoundingMode . HALF_UP ) ;
double enabledTICp = 0.0 ;
if ( "FC" . equals ( payType ) | | "FS" . equals ( payType ) ) {
BigDecimal bdcp = BigDecimal . valueOf ( enabledTCp + Double . parseDouble ( payIntegral ) ) ;
enabledTICp = bdcp . doubleValue ( ) ;
enabledIntegral = enabledTICp ;
} else {
enabledTICp = enabledTCp ;
}
double enabledTOG = Double . parseDouble ( obj1T . get ( "OGENABLEINTEGRATION" ) . toString ( ) ) ;
BigDecimal bdco = BigDecimal . valueOf ( enabledTOG + Double . parseDouble ( payIntegral ) ) ;
bdco = bdco . setScale ( 1 , RoundingMode . HALF_UP ) ;
double enabledTIOG = 0.0 ;
if ( "FG" . equals ( payType ) | | "FP" . equals ( payType ) ) {
BigDecimal bdco = BigDecimal . valueOf ( enabledTOG + Double . parseDouble ( payIntegral ) ) ;
enabledTIOG = bdco . doubleValue ( ) ;
enabledIntegral = enabledTIOG ;
} else {
@ -449,7 +447,7 @@ public class QCodeInfoServiceImpl {
"\tCOALESCE(TO_CHAR(ct.CAFTERTIME,'YYYY-MM-dd HH24:mi:ss'),'') AS CAFTERTIMEBAK,\n" +
"\t\tCOALESCE(TO_CHAR(ct.ROLLBACKTIME,'YYYY-MM-dd HH24:mi:ss'),'') AS ROLLBACKTIME,\n" +
"\t\tCOALESCE(TO_CHAR(ilt.PAYTIME,'YYYY-MM-dd HH24:mi:ss'),'') AS CAFTERTIME,\n" +
"\tROUND(ilt.PAYINTEGRATION/100, 1 ) AS PAYINTEGRATION,\n" +
"\tROUND(ilt.PAYINTEGRATION/100, 2 ) AS PAYINTEGRATION,\n" +
"\tilt.PAYTYPE,\n" +
"\tpt.TEXT AS PAYTYPENAME\n" +
"FROM\n" +
@ -467,7 +465,7 @@ public class QCodeInfoServiceImpl {
"\tCOALESCE(date_format(ct.CAFTERTIME, '%Y-%m-%d %H:%i:%s'),'') AS CAFTERTIMEBAK,\n" +
"\t\tCOALESCE(date_format(ct.ROLLBACKTIME,'%Y-%m-%d %H:%i:%s'),'') AS ROLLBACKTIME,\n" +
"\t\tCOALESCE(date_format(ilt.PAYTIME,'%Y-%m-%d %H:%i:%s'),'') AS CAFTERTIME,\n" +
"\tROUND(ilt.PAYINTEGRATION/100, 1 ) AS PAYINTEGRATION,\n" +
"\tROUND(ilt.PAYINTEGRATION/100, 2 ) AS PAYINTEGRATION,\n" +
"\tilt.PAYTYPE,\n" +
"\tpt.TEXT AS PAYTYPENAME\n" +
"FROM\n" +
@ -547,7 +545,7 @@ public class QCodeInfoServiceImpl {
List ret = null ; // -1 代表接口处理失败 1 处理成功
try {
String sqlTemp = "SELECT\n" +
"\tCOALESCE(ROUND(sum(ilt.PAYINTEGRATION)/100, 1 ),0) AS PAYINTEGRATION\n" +
"\tCOALESCE(ROUND(sum(ilt.PAYINTEGRATION)/100, 2 ),0) AS PAYINTEGRATION\n" +
"FROM\n" +
"\tCAFTER_TABLE ct,\n" +
"\tINTEGRATION_LIST_TABLE ilt,\n" +
@ -668,6 +666,15 @@ public class QCodeInfoServiceImpl {
String OGENABLEINTEGRATION = obj1 . get ( "OGENABLEINTEGRATION" ) . toString ( ) ; //加油、加气可用积分
String CPENABLEINTEGRATION = obj1 . get ( "CPENABLEINTEGRATION" ) . toString ( ) ; //餐饮、消费可用积分
userIdNew = Integer . parseInt ( obj1 . get ( "ID" ) . toString ( ) ) ; //人员id
//人员积分是否异常
if ( Double . parseDouble ( ENABLEINTEGRATION ) ! = ( Double . parseDouble ( OGENABLEINTEGRATION ) + Double . parseDouble ( CPENABLEINTEGRATION ) ) ) {
LogUtil . WriteLog_Info ( "人员积分异常:" + userIdNew , "QCodeInfoServiceImpl" ) ;
Long l = redisConfigUtil . delIntegral ( content ) ;
ret = "13" ;
retJo . put ( "ret" , ret ) ;
return retJo ;
}
if ( s > 30 ) {
Object contentNew = Consistant . map . get ( content ) ;
if ( ! PubTools . isEmpty ( contentNew ) ) {
@ -736,6 +743,11 @@ public class QCodeInfoServiceImpl {
}
}
if ( PubTools . isNull ( integrateType ) ) {
ret = "4" ;
retJo . put ( "ret" , ret ) ;
return retJo ;
}
//查询用户累积获取的总积分
double rebateIntegrateSave = 0.0 ;
switch ( integrateType ) {
@ -820,7 +832,6 @@ public class QCodeInfoServiceImpl {
if ( selectforlistFc . size ( ) > 0 ) {
Map < String , Object > o = ( Map < String , Object > ) selectforlistFc . get ( 0 ) ;
BigDecimal bd = BigDecimal . valueOf ( Double . parseDouble ( o . get ( "VALUE" ) . toString ( ) ) ) ;
bd = bd . setScale ( 1 , BigDecimal . ROUND_HALF_UP ) ;
rebateInFc = bd . intValue ( ) ;
}
//根据折扣金额计算积分
@ -856,7 +867,6 @@ public class QCodeInfoServiceImpl {
if ( selectforlistFs . size ( ) > 0 ) {
Map < String , Object > o = ( Map < String , Object > ) selectforlistFs . get ( 0 ) ;
BigDecimal bd = BigDecimal . valueOf ( Double . parseDouble ( o . get ( "VALUE" ) . toString ( ) ) ) ;
bd = bd . setScale ( 1 , BigDecimal . ROUND_HALF_UP ) ;
rebateInFs = bd . intValue ( ) ;
}
//根据折扣金额计算积分
@ -886,6 +896,7 @@ public class QCodeInfoServiceImpl {
default :
break ;
}
//进行积分核减
//1、积分流水记录新加
String sqlMax = "select COALESCE(max(ID),0) AS ID from integration_list_table" ;
@ -901,27 +912,20 @@ public class QCodeInfoServiceImpl {
integralList . put ( "maxid" , ( maxId + 10 ) ) ;
integralList . put ( "userId" , userIdNew ) ;
integralList . put ( "acarNo" , "" ) ;
integralList . put ( "lastintegration" , PubTools . doubleSave1 ( Double . parseDouble ( ENABLEINTEGRATION ) * 100 ) ) ;
integralList . put ( "payintegration" , PubTools . doubleSave1 ( rebateIntegrateSave * 100 ) ) ;
integralList . put ( "restintegration" , PubTools . doubleSave1 ( ( ( Double . parseDouble ( ENABLEINTEGRATION ) - rebateIntegrateSave ) * 100 ) ) ) ;
integralList . put ( "lastintegration" , new BigDecimal ( ENABLEINTEGRATION ) . multiply ( new BigDecimal ( "100" ) ) ) ;
integralList . put ( "payintegration" , new BigDecimal ( rebateIntegrateSave ) . multiply ( new BigDecimal ( "100" ) ) ) ;
integralList . put ( "restintegration" , ( new BigDecimal ( ENABLEINTEGRATION ) . subtract ( new BigDecimal ( rebateIntegrateSave ) ) ) . multiply ( new BigDecimal ( "100" ) ) ) ;
integralList . put ( "payTime" , rollbackTime ) ;
integralList . put ( "paytype" , integrateType ) ;
integralList . put ( "DBTYPE" , DBType ) ;
if ( "FP" . equals ( integrateType ) | | "FG" . equals ( integrateType ) ) {
integralList . put ( "cpenableintegration" , PubTools . doubleSave1 ( ( ( Double . parseDouble ( OGENABLEINTEGRATION ) - rebateIntegrateSave ) * 100 ) ) ) ;
integralList . put ( "ogenableintegration" , PubTools . doubleSave1 ( Double . parseDouble ( CPENABLEINTEGRATION ) * 100 ) ) ;
} else if ( "FC" . equals ( integrateType ) | | "FS" . equals ( integrateType ) ) {
integralList . put ( "cpenableintegration" , PubTools . doubleSave1 ( ( ( Double . parseDouble ( OGENABLEINTEGRATION ) ) * 100 ) ) ) ;
integralList . put ( "ogenableintegration" , PubTools . doubleSave1 ( ( Double . parseDouble ( CPENABLEINTEGRATION ) - rebateIntegrateSave ) * 100 ) ) ;
}
this . integrationListMapper . addIntegralList ( integralList ) ;
if ( "Y" . equals ( PropertiesUtil . getValue ( "BAKEnabled" ) ) ) {
String bakDBType = PropertiesUtil . getValue ( "BakDBType" ) ;
integralList . put ( "DBTYPEBAK" , bakDBType ) ;
this . integrationListMyMapper . addIntegralList ( integralList ) ;
integralList . put ( "cpenableintegration" , new BigDecimal ( CPENABLEINTEGRATION ) . multiply ( new BigDecimal ( "100" ) ) ) ;
integralList . put ( "ogenableintegration" , ( new BigDecimal ( OGENABLEINTEGRATION ) . subtract ( new BigDecimal ( rebateIntegrateSave ) ) ) . multiply ( new BigDecimal ( "100" ) ) ) ;
} else if ( "FC" . equals ( integrateType ) | | "FS" . equals ( integrateType ) ) {
integralList . put ( "cpenableintegration" , PubTools . doubleSave1 ( ( ( Double . parseDouble ( CPENABLEINTEGRATION ) - rebateIntegrateSave ) * 100 ) ) ) ;
integralList . put ( "ogenableintegration" , new BigDecimal ( OGENABLEINTEGRATION ) . multiply ( new BigDecimal ( "100" ) ) ) ;
}
LogUtil . WriteLog_Info ( "积分核减=====积分流水已插入" , "QCodeInfoServiceImpl" ) ;
//2、新加一条消费记录
String maxIdCafeSql = "select COALESCE(max(t.ID),0)+1 as ID from CAFTER_TABLE t" ;
List maxIdCafeSqlMax = this . mapperI . selectforlist ( maxIdCafeSql ) ;
@ -942,13 +946,6 @@ public class QCodeInfoServiceImpl {
cafetparam . put ( "orderId" , orderId ) ;
cafetparam . put ( "content" , content ) ;
cafetparam . put ( "DBTYPE" , DBType ) ;
this . cafterTableMapper . addcafter ( cafetparam ) ;
if ( "Y" . equals ( PropertiesUtil . getValue ( "BAKEnabled" ) ) ) {
String bakDBType = PropertiesUtil . getValue ( "BakDBType" ) ;
cafetparam . put ( "DBTYPEBAK" , bakDBType ) ;
this . cafterTableMyMapper . addcafter ( cafetparam ) ;
}
LogUtil . WriteLog_Info ( "积分核减=====消费记录已插入" , "QCodeInfoServiceImpl" ) ;
//3、计算用户可用积分
String sql = "select " +
" ut.ID ,ut.OPENID ,COALESCE(ut.ENABLEINTEGRATION,0) AS ENABLEINTEGRATION,COALESCE(ut.CPENABLEINTEGRATION,0) AS CPENABLEINTEGRATION,COALESCE(ut.OGENABLEINTEGRATION,0) AS OGENABLEINTEGRATION" +
@ -960,41 +957,59 @@ public class QCodeInfoServiceImpl {
Map < String , Object > obj1T = ( Map < String , Object > ) objT ;
double enabledT = Double . parseDouble ( obj1T . get ( "ENABLEINTEGRATION" ) . toString ( ) ) ;
BigDecimal bd = BigDecimal . valueOf ( enabledT - rebateIntegrateSave * 100 ) ;
bd = bd . setScale ( 1 , RoundingMode . HALF_UP ) ;
double enabledTI = bd . doubleValue ( ) ;
double enabledTCp = Double . parseDouble ( obj1T . get ( "CPENABLEINTEGRATION" ) . toString ( ) ) ;
BigDecimal bdcp = BigDecimal . valueOf ( enabledTCp - rebateIntegrateSave * 100 ) ;
bdcp = bdcp . setScale ( 1 , RoundingMode . HALF_UP ) ;
double enabledTICp = bdcp . doubleValue ( ) ;
double enabledTPG = Double . parseDouble ( obj1T . get ( "OGENABLEINTEGRATION" ) . toString ( ) ) ;
if ( "FP" . equals ( integrateType ) | | "FG" . equals ( integrateType ) ) {
BigDecimal bdcpPG = BigDecimal . valueOf ( enabledTPG - rebateIntegrateSave * 100 ) ;
BigDecimal bdcpPg = bdcpPG . setScale ( 1 , RoundingMode . HALF_UP ) ;
double enabledTIPG = bdcpPg . doubleValue ( ) ;
enabledTPG = bdcpPG . doubleValue ( ) ;
} else if ( "FC" . equals ( integrateType ) | | "FS" . equals ( integrateType ) ) {
BigDecimal bdcp = BigDecimal . valueOf ( enabledTCp - rebateIntegrateSave * 100 ) ;
enabledTCp = bdcp . doubleValue ( ) ;
} else {
ret = "4" ;
retJo . put ( "ret" , ret ) ;
return retJo ;
}
Map < String , Object > userParams = new HashMap < String , Object > ( ) ;
userParams . put ( "userId" , openId ) ;
userParams . put ( "enabledTI" , enabledTI ) ;
userParams . put ( "enabledTIOG" , enabledTPG ) ;
userParams . put ( "enabledTICp" , enabledTCp ) ;
if ( "FP" . equals ( integrateType ) | | "FG" . equals ( integrateType ) ) {
userParams . put ( "enabledTIPG" , enabledTIPG ) ;
enabledIntegral = PubTools . doubleSave1 ( enabledTIPG / 100 ) + "" ;
enabledIntegral = PubTools . doubleSave1 ( enabledTPG / 100 ) + "" ;
retJo . put ( "ENABLEINTEGRATION" , enabledIntegral ) ;
} else if ( "FC" . equals ( integrateType ) | | "FS" . equals ( integrateType ) ) {
userParams . put ( "enabledTICp" , enabledTICp ) ;
enabledIntegral = PubTools . doubleSave1 ( enabledTICp / 100 ) + "" ;
enabledIntegral = PubTools . doubleSave1 ( enabledTCp / 100 ) + "" ;
retJo . put ( "ENABLEINTEGRATION" , enabledIntegral ) ;
} else {
} else {
}
LogUtil . WriteLog_Info ( "积分核减=====消费类型:" + integrateType , "QCodeInfoServiceImpl" ) ;
userParams . put ( "DBTYPE" , DBType ) ;
this . integrationListMapper . addIntegralList ( integralList ) ;
if ( "Y" . equals ( PropertiesUtil . getValue ( "BAKEnabled" ) ) ) {
String bakDBType = PropertiesUtil . getValue ( "BakDBType" ) ;
integralList . put ( "DBTYPEBAK" , bakDBType ) ;
this . integrationListMyMapper . addIntegralList ( integralList ) ;
}
LogUtil . WriteLog_Info ( "积分核减=====积分流水已插入:" + integralList , "QCodeInfoServiceImpl" ) ;
this . cafterTableMapper . addcafter ( cafetparam ) ;
if ( "Y" . equals ( PropertiesUtil . getValue ( "BAKEnabled" ) ) ) {
String bakDBType = PropertiesUtil . getValue ( "BakDBType" ) ;
cafetparam . put ( "DBTYPEBAK" , bakDBType ) ;
this . cafterTableMyMapper . addcafter ( cafetparam ) ;
}
LogUtil . WriteLog_Info ( "积分核减=====消费记录已插入:" + cafetparam , "QCodeInfoServiceImpl" ) ;
this . userTableMapper . updateUserById ( userParams ) ;
if ( "Y" . equals ( PropertiesUtil . getValue ( "BAKEnabled" ) ) ) {
String bakDBType = PropertiesUtil . getValue ( "BakDBType" ) ;
userParams . put ( "DBTYPEBAK" , bakDBType ) ;
this . userTableMyMapper . updateUserById ( userParams ) ;
}
LogUtil . WriteLog_Info ( "用户更新可用积分完成" , "QCodeInfoServiceImpl" ) ;
LogUtil . WriteLog_Info ( "积分核减=====用户积分已修改:" + userParams . toString ( ) , "QCodeInfoServiceImpl" ) ;
}
Object contentNew = Consistant . map . get ( content ) ;
if ( ! PubTools . isEmpty ( contentNew ) ) {
Consistant . map . remove ( content ) ;