Compare commits

..

3 Commits

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CopilotChatHistory">
<option name="conversations">
<list>
<Conversation>
<option name="createTime" value="1754009144485" />
<option name="id" value="019863178ca57ca8b783a19d8d5598be" />
<option name="title" value="新对话 2025年8月01日 08:45:44" />
<option name="updateTime" value="1754009144485" />
</Conversation>
</list>
</option>
</component>
</project>

@ -0,0 +1,6 @@
<component name="ArtifactManager">
<artifact type="exploded-war" name="PetrolCafeteriaFee.war">
<output-path>$PROJECT_DIR$/out/artifacts/PetrolCafeteriaFee_war</output-path>
<root id="root" />
</artifact>
</component>

@ -0,0 +1,55 @@
package com.nmgs.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "INTEGRAL_CHECK")
public class IntegralCheck {
@TableId(value = "OPENID")
private String openid;
@TableField(value = "USERID")
private Integer userId;
@TableField(value = "CLASSDATE")
private Date classdate;
@TableField(value = "OPERATORTIME")
private Date operatorTime;
@TableField(value = "ENABLEINTEGRATION")
private BigDecimal enableintegration;
@TableField(value = "OGINTEGRATION")
private BigDecimal ogintegration;
@TableField(value = "CPINTEGRATION")
private BigDecimal cpintegration;
@TableField(value = "RESTINTEGRALTIONBEFORE")
private BigDecimal restintegraltionbefore;
@TableField(value = "OGINTEGRATIONBEFORE")
private BigDecimal ogintegrationbefore;
@TableField(value = "CPINTEGRATIONBEFORE")
private BigDecimal cpintegrationbefore;
@TableField(value = "RESTINTEGRALTIONDECODE")
private BigDecimal restintegraltiondecode;
@TableField(value = "OGINTEGRATIONDECODE")
private BigDecimal ogintegrationdecode;
@TableField(value = "CPINTEGRATIONDECODE")
private BigDecimal cpintegrationdecode;
@TableField(value = "OGINTEGRATIONADD")
private BigDecimal ogintegrationadd;
@TableField(value = "CPINTEGRATIONADD")
private BigDecimal cpintegrationadd;
@TableField(value = "RESTTEGRALTIONADD")
private BigDecimal resttegraltionadd;
@TableField(value = "OPERTOR")
private String opertor;
}

@ -0,0 +1,12 @@
package com.nmgs.mapper.bak;
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
import com.nmgs.entity.IntegralCheck;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface IntegralCheckBakMapper extends MppBaseMapper<IntegralCheck> {
}

@ -0,0 +1,19 @@
package com.nmgs.mapper.petrol;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
import com.nmgs.entity.Cafter;
import com.nmgs.entity.IntegralCheck;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
@Mapper
public interface IntegralCheckMapper extends MppBaseMapper<IntegralCheck> {
}

@ -9,6 +9,7 @@ import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -121,4 +122,30 @@ public interface IntegrationListMapper extends MppBaseMapper<IntegrationList> {
* @return
*/
List<Map<String, Object>> getIntegralGrow(@Param("params")Map<String, Object> params);
/**
* BMP
* @param params
* @return
*/
List<IntegrationList> getIntegralByPeriod(@Param("params") Map<String,Object> params);
/**
* BMP
* @param params
* @return
*/
List<IntegrationList> getNewIntegralByUserid(@Param("params") Map<String,Object> params);
/**
* 退,
* @param params
* @return
*/
List<IntegrationList> getTotalIntegralByPeriod(@Param("params") Map<String,Object> params);
/**
* 退
* @param params
* @return
*/
List<IntegrationList> getTotalTKIntegralByPeriod(@Param("params") Map<String,Object> params);
}

@ -640,7 +640,165 @@
</where>
GROUP BY list.PAYTIME) a GROUP BY PAYTIME order by PAYTIME
</select>
<!-- 获取用户某个时间段之内的积分列表 BMP -->
<select id="getIntegralByPeriod" resultType="com.nmgs.entity.IntegrationList">
select
list.USERID,
list.PAYTIME,
list.PAYINTEGRATION as payIntegration,
list.OGENABLEINTEGRATION as ogEnableIntegration,
list.CPENABLEINTEGRATION as cpEnableIntegration,
list.PAYTYPE as payType
from INTEGRATION_LIST_TABLE list
where list.USERID = #{params.userid}
<!-- 统计日期(起始)查询条件 -->
<if test="params.DBTYPE == 1">
AND list.PAYTIME >= dateadd(day,0,#{params.startTime})
</if>
<if test="params.DBTYPE == 2">
AND list.PAYTIME >= TO_DATE(#{params.startTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 3">
AND list.PAYTIME >= TO_DATE(#{params.startTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 4">
AND list.PAYTIME >= STR_TO_DATE(#{params.startTime}, '%Y-%m-%d %H:%i:%s')
</if>
<!-- 统计日期(终止)查询条件 -->
<if test="params.DBTYPE == 1">
AND list.PAYTIME &lt;= dateadd(day,0,#{params.endTime})
</if>
<if test="params.DBTYPE == 2">
AND list.PAYTIME &lt;= TO_DATE(#{params.endTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 3">
AND list.PAYTIME &lt;= TO_DATE(#{params.endTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 4">
AND list.PAYTIME &lt;= STR_TO_DATE(#{params.endTime}, '%Y-%m-%d %H:%i:%s')
</if>
<!-- 积分类型,需要直接注入 -->
${paytype}
</select>
<!-- 获取用户某个时间段之内的,不包含退款的,各消费类型的汇总积分 BMP -->
<select id="getTotalIntegralByPeriod" resultType="com.nmgs.entity.IntegrationList">
select
list.PAYTYPE as payType,
sum(list.PAYINTEGRATION) as payIntegration
from INTEGRATION_LIST_TABLE list
where list.USERID = #{params.userid}
<!-- 统计日期(起始)查询条件 -->
<if test="params.DBTYPE == 1">
AND list.PAYTIME >= dateadd(day,0,#{params.startTime})
</if>
<if test="params.DBTYPE == 2">
AND list.PAYTIME >= TO_DATE(#{params.startTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 3">
AND list.PAYTIME >= TO_DATE(#{params.startTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 4">
AND list.PAYTIME >= STR_TO_DATE(#{params.startTime}, '%Y-%m-%d %H:%i:%s')
</if>
<!-- 统计日期(终止)查询条件 -->
<if test="params.DBTYPE == 1">
AND list.PAYTIME &lt;= dateadd(day,0,#{params.endTime})
</if>
<if test="params.DBTYPE == 2">
AND list.PAYTIME &lt;= TO_DATE(#{params.endTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 3">
AND list.PAYTIME &lt;= TO_DATE(#{params.endTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 4">
AND list.PAYTIME &lt;= STR_TO_DATE(#{params.endTime}, '%Y-%m-%d %H:%i:%s')
</if>
<!-- 积分类型,需要直接注入 -->
${params.paytype}
group by list.PAYTYPE
</select>
<!-- 获取用户某个时间段退款的汇总积分 BMP -->
<select id="getTotalTKIntegralByPeriod" resultType="com.nmgs.entity.IntegrationList">
select
iltt.payType,
sum(iltt.PAYINTEGRATION) as payIntegration
from CAFTER_TABLE ct,integration_list_table iltt where ct.INTEGRATIONLISTID = iltt.ID and ct.ROLLBACKTIME is not null
AND ct.USERID = #{params.userid}
<!-- 统计日期(起始)查询条件 -->
<if test="params.DBTYPE == 1">
AND ct.ROLLBACKTIME >= dateadd(day,0,#{params.startTime})
</if>
<if test="params.DBTYPE == 2">
AND ct.ROLLBACKTIME >= TO_DATE(#{params.startTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 3">
AND ct.ROLLBACKTIME >= TO_DATE(#{params.startTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 4">
AND ct.ROLLBACKTIME >= STR_TO_DATE(#{params.startTime}, '%Y-%m-%d %H:%i:%s')
</if>
<!-- 统计日期(终止)查询条件 -->
<if test="params.DBTYPE == 1">
AND ct.ROLLBACKTIME &lt;= dateadd(day,0,#{params.endTime})
</if>
<if test="params.DBTYPE == 2">
AND ct.ROLLBACKTIME &lt;= TO_DATE(#{params.endTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 3">
AND ct.ROLLBACKTIME&lt;= TO_DATE(#{params.endTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 4">
AND ct.ROLLBACKTIME &lt;= STR_TO_DATE(#{params.endTime}, '%Y-%m-%d %H:%i:%s')
</if>
group by iltt.payType
</select>
<!-- 获取用户截至某个时间点最新的积分流水 BMP -->
<select id="getNewIntegralByUserid" resultType="com.nmgs.entity.IntegrationList">
select
list.PAYINTEGRATION as payIntegration,
list.RESTINTEGRATION as restIntegration,
list.OGENABLEINTEGRATION as ogEnableIntegration,
list.CPENABLEINTEGRATION as cpEnableIntegration,
list.PAYTYPE as payType
from integration_list_table list
where list.ID =(select max(ID) from integration_list_table list2 where list2.USERID= #{params.userid}
<!-- 统计日期(起始)查询条件 -->
<if test="params.startTime != null and params.startTime != ''">
<if test="params.DBTYPE == 1">
AND list2.PAYTIME >= dateadd(day,0,#{params.startTime})
</if>
<if test="params.DBTYPE == 2">
AND list2.PAYTIME >= TO_DATE(#{params.startTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 3">
AND list2.PAYTIME >= TO_DATE(#{params.startTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 4">
AND list2.PAYTIME >= STR_TO_DATE(#{params.startTime}, '%Y-%m-%d %H:%i:%s')
</if>
</if>
<!-- 统计日期(终止)查询条件 -->
<if test="params.endTime != null and params.endTime != ''">
<if test="params.DBTYPE == 1">
AND list2.PAYTIME &lt;= dateadd(day,0,#{params.endTime})
</if>
<if test="params.DBTYPE == 2">
AND list2.PAYTIME &lt;= TO_DATE(#{params.endTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 3">
AND list2.PAYTIME &lt;= TO_DATE(#{params.endTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 4">
AND list2.PAYTIME &lt;= STR_TO_DATE(#{params.endTime}, '%Y-%m-%d %H:%i:%s')
</if>
</if>
)
</select>
</mapper>

@ -223,5 +223,12 @@ public interface UserMapper extends MppBaseMapper<User> {
*/
List<Map<String, Object>> getRepeatUserIdData(HashMap<String, Object> params);
/**
*
* @param params
* @return
*/
List<User> getUserByInteralList(@Param("params") Map<String, Object> params);
}

@ -1433,5 +1433,36 @@
select ID,COUNT from (select id,count(1) as count from WEIXN_USER_TABLE GROUP BY id )a where count > 1
</select>
<select id="getUserByInteralList" resultType="com.nmgs.entity.User" parameterType="java.util.HashMap">
select distinct t.ID as id,t.OPENID as openId from WEIXN_USER_TABLE t where t.certification=1 and exists(
select 1 from INTEGRATION_LIST_TABLE ilt where ilt.userid = t.ID
<if test="params.DBTYPE == 1">
and ilt.paytime >=dateadd(day,0,#{params.startTime})
</if>
<if test="params.DBTYPE == 2">
and ilt.paytime >=TO_DATE(#{params.startTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 3">
and ilt.paytime >=TO_DATE(#{params.startTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 4">
and ilt.paytime >=STR_TO_DATE(#{params.startTime}, '%Y-%m-%d %H:%i:%s')
</if>
<if test="params.DBTYPE == 1">
AND ilt.paytime &lt;= dateadd(day,0,#{params.endTime})
</if>
<if test="params.DBTYPE == 2">
AND ilt.paytime &lt;= TO_DATE(#{params.endTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 3">
AND ilt.paytime &lt;= TO_DATE(#{params.endTime}, 'SYYYY-MM-DD HH24:MI:SS')
</if>
<if test="params.DBTYPE == 4">
AND ilt.paytime &lt;= STR_TO_DATE(#{params.endTime}, '%Y-%m-%d %H:%i:%s')
</if>
)
</select>
</mapper>

@ -0,0 +1,39 @@
package com.nmgs.service.impl;
import com.nmgs.entity.IntegralCheck;
import com.nmgs.mapper.bak.IntegralCheckBakMapper;
import com.nmgs.mapper.petrol.IntegralCheckMapper;
import com.nmgs.util.PropertiesUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class SolveCheckServiceImpl {
public IntegralCheckMapper integralCheckMapper;
@Autowired
public void setIntegralCheckMapper(IntegralCheckMapper integralCheckMapper) {
this.integralCheckMapper = integralCheckMapper;
}
public IntegralCheckBakMapper integralCheckBakMapper;
@Autowired
public void setIntegralCheckBakMapper(IntegralCheckBakMapper integralCheckBakMapper) {
this.integralCheckBakMapper = integralCheckBakMapper;
}
@Transactional(timeout = 1800)
public void solveCheck(List<IntegralCheck> list){
int i=1;
for(IntegralCheck integralCheck:list){
i++;
integralCheckMapper.insert(integralCheck);
if(PropertiesUtil.getValue("IsBak").equals("1")){
integralCheckBakMapper.insert(integralCheck);
}
System.out.println("次数===" + i);
}
}
}

@ -44,7 +44,7 @@ public class CallBackGreenIntegralTask {
@Autowired
private WebSocketServer webSocketServer;
@Scheduled(cron = " 0 0/3 * * * ? ")//15秒执行一次
//@Scheduled(cron = " 0 0/3 * * * ? ")//15秒执行一次
@Transactional
public synchronized void callBackGreen() {
try {

@ -0,0 +1,166 @@
package com.nmgs.task;
import com.nmgs.entity.IntegralCheck;
import com.nmgs.entity.IntegrationList;
import com.nmgs.entity.User;
import com.nmgs.mapper.petrol.IntegrationListMapper;
import com.nmgs.mapper.petrol.UserMapper;
import com.nmgs.service.impl.SolveCheckServiceImpl;
import com.nmgs.util.PropertiesUtil;
import com.nmgs.util.PubTools;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* author: BMP
* date: 20250731 11:00
*/
@Component
@Async
@Slf4j
public class ConsumeIntegralCheck {
public UserMapper usermapper;
@Autowired
public void setUsermapper(UserMapper usermapper) {
this.usermapper = usermapper;
}
public IntegrationListMapper integrationListMapper;
@Autowired
public void setIntegrationListMapper(IntegrationListMapper integrationListMapper) {
this.integrationListMapper = integrationListMapper;
}
public SolveCheckServiceImpl solveCheckService;
@Autowired
public void setSolveCheckService(SolveCheckServiceImpl solveCheckService) {
this.solveCheckService = solveCheckService;
}
@Scheduled(cron = " 0 0 11 * * ? ")//每日9点执行一次
public void check() {
try {
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
//1、查询昨日积分有变动的人员
Map<String,Object> params=new HashMap();
params.put("startTime", PubTools.getBeforeDaySSS(PubTools.getCurrentDateYYD(),1));
params.put("endTime", PubTools.getBeforeDaySSSEnd(PubTools.getCurrentDateYYD(),1));
params.put("DBTYPE", PropertiesUtil.getValue("DBType"));
List<User> selectforlist = usermapper.getUserByInteralList(params);
System.out.println("总人次数===" + selectforlist.size());
List<IntegralCheck> list=new ArrayList<>();
for (int i = 0; i < selectforlist.size(); i++) {
User userIdO = selectforlist.get(i);
int userId = userIdO.getId();
IntegralCheck integralCheck=new IntegralCheck();
integralCheck.setUserId(userId);
integralCheck.setOpenid(userIdO.getOpenId());
integralCheck.setOperatorTime(df.parse(PubTools.getCurrentDate()));
integralCheck.setClassdate(df.parse(PubTools.getBeforeDaySSS(PubTools.getCurrentDateYYD(),1)));
integralCheck.setCpintegrationadd(BigDecimal.ZERO);
integralCheck.setOgintegrationadd(BigDecimal.ZERO);
integralCheck.setResttegraltionadd(BigDecimal.ZERO);
//2、获取人员截至昨天最新的流水
BigDecimal RESTINTEGRALTION1 = BigDecimal.ZERO;//昨日剩余积分
BigDecimal OGENABLEINTEGRATION1= BigDecimal.ZERO;//昨日加油加气可用积分
BigDecimal CPENABLEINTEGRATION1 = BigDecimal.ZERO;//昨日商超可用积分
Map<String,Object> paramsAll1=new HashMap();
paramsAll1.put("endTime", PubTools.getBeforeDaySSSEnd(PubTools.getCurrentDateYYD(),1));
paramsAll1.put("DBTYPE", PropertiesUtil.getValue("DBType"));
paramsAll1.put("userid", userId);
List<IntegrationList> integralByPeriod1 = integrationListMapper.getNewIntegralByUserid(paramsAll1);
if (!integralByPeriod1.isEmpty()) {
IntegrationList o = integralByPeriod1.get(0);
RESTINTEGRALTION1 = o.getRestIntegration();//剩余积分
OGENABLEINTEGRATION1 = o.getOgEnableIntegration();//加油加气可用积分
CPENABLEINTEGRATION1 = o.getCpEnableIntegration();//商超可用积分
}
integralCheck.setEnableintegration(RESTINTEGRALTION1);
integralCheck.setOgintegration(OGENABLEINTEGRATION1);
integralCheck.setCpintegration(CPENABLEINTEGRATION1);
//3、根据人员ID查询两天前最后一条积分流水
BigDecimal RESTINTEGRALTIONBEFORE = BigDecimal.ZERO;//前日剩余积分
BigDecimal OGENABLEINTEGRATIONBEFORE = BigDecimal.ZERO;//前日加油加气可用积分
BigDecimal CPENABLEINTEGRATIONBEFORE = BigDecimal.ZERO;//前日商超可用积分
Map<String,Object> paramsAll=new HashMap();
paramsAll.put("endTime", PubTools.getBeforeDaySSSEnd(PubTools.getCurrentDateYYD(),2));
paramsAll.put("DBTYPE", PropertiesUtil.getValue("DBType"));
paramsAll.put("userid", userId);
List<IntegrationList> integralByPeriod = integrationListMapper.getNewIntegralByUserid(paramsAll);
if (!integralByPeriod.isEmpty()) {
IntegrationList o = integralByPeriod.get(0);
RESTINTEGRALTIONBEFORE = o.getRestIntegration();//剩余积分
OGENABLEINTEGRATIONBEFORE = o.getOgEnableIntegration();//加油加气可用积分
CPENABLEINTEGRATIONBEFORE = o.getCpEnableIntegration();//商超可用积分
}
integralCheck.setRestintegraltionbefore(RESTINTEGRALTIONBEFORE);
integralCheck.setOgintegrationbefore(OGENABLEINTEGRATIONBEFORE);
integralCheck.setCpintegrationbefore(CPENABLEINTEGRATIONBEFORE);
//获取用户时间段内各项消费积分
Map<String,Object> params3=new HashMap();
params3.put("startTime", PubTools.getBeforeDaySSS(PubTools.getCurrentDateYYD(),1));
params3.put("endTime", PubTools.getBeforeDaySSSEnd(PubTools.getCurrentDateYYD(),1));
params3.put("DBTYPE", PropertiesUtil.getValue("DBType"));
params3.put("userid", userId);
params3.put("paytype", " AND list.paytype IN ('FC','FS','FCA','FP','FG')");
List<IntegrationList> integralByPeriod2 = integrationListMapper.getTotalIntegralByPeriod(params3);
BigDecimal RESTINTEGRALTIONDECODE = BigDecimal.ZERO;//昨日总消费积分
BigDecimal OGENABLEINTEGRATIONDECODE= BigDecimal.ZERO;//昨日加油加气消费积分
BigDecimal CPENABLEINTEGRATIONDECODE = BigDecimal.ZERO;//昨日商超消费积分
//处理逻辑
for (int k = 0; k < integralByPeriod2.size(); k++) {
IntegrationList integrationList2=integralByPeriod2.get(k);
String PAYTYPE = integrationList2.getPayType();
BigDecimal payIntegraltion = integrationList2.getPayIntegration();
RESTINTEGRALTIONDECODE=RESTINTEGRALTIONDECODE.subtract(payIntegraltion);
if ("FC".equals(PAYTYPE) || "FS".equals(PAYTYPE) || "FCA".equals(PAYTYPE)) {//商超及餐饮预约
CPENABLEINTEGRATIONDECODE = CPENABLEINTEGRATIONDECODE.subtract(payIntegraltion);
} else if ("FP".equals(PAYTYPE) || "FG".equals(PAYTYPE)) {//加油加气
OGENABLEINTEGRATIONDECODE = OGENABLEINTEGRATIONDECODE.subtract(payIntegraltion);
}
}
//获取退款积分
List<IntegrationList> integralByPeriod4 = integrationListMapper.getTotalTKIntegralByPeriod(params3);
//处理逻辑
for (int k = 0; k < integralByPeriod4.size(); k++) {
IntegrationList integrationList2=integralByPeriod4.get(k);
String PAYTYPE = integrationList2.getPayType();
BigDecimal payIntegraltion = integrationList2.getPayIntegration();
RESTINTEGRALTIONDECODE=RESTINTEGRALTIONDECODE.add(payIntegraltion);
boolean updateCan = false;
if ("FC".equals(PAYTYPE) || "FS".equals(PAYTYPE) || "FCA".equals(PAYTYPE)) {//商超及餐饮预约
CPENABLEINTEGRATIONDECODE = CPENABLEINTEGRATIONDECODE.add(payIntegraltion);
} else if ("FP".equals(PAYTYPE) || "FG".equals(PAYTYPE)) {//加油加气
OGENABLEINTEGRATIONDECODE = OGENABLEINTEGRATIONDECODE.add(payIntegraltion);
}
}
integralCheck.setOgintegrationdecode(OGENABLEINTEGRATIONDECODE);
integralCheck.setCpintegrationdecode(CPENABLEINTEGRATIONDECODE);
integralCheck.setRestintegraltiondecode(RESTINTEGRALTIONDECODE);
integralCheck.setOpertor("BMP");
list.add(integralCheck);
System.out.println("处理完数据次数===" + i);
}
solveCheckService.solveCheck(list);
} catch (Exception e) {
System.out.println("接口异常了:"+e.getMessage());
e.printStackTrace();
}
}
}

@ -57,7 +57,7 @@ public class MileChangeMsgTask {
@Autowired
private WebSocketServer webSocketServer;
@Scheduled(cron = " 0 0/1 * * * ? ")//15秒执行一次
//@Scheduled(cron = " 0 0/1 * * * ? ")//15秒执行一次
@Transactional(timeout = 100)
public void MileChange() {
try {

@ -59,7 +59,7 @@ public class MileChangeTask {
@Autowired
private WebSocketServer webSocketServer;
@Scheduled(cron = " 0 0/4 * * * ? ")//15秒执行一次
//@Scheduled(cron = " 0 0/4 * * * ? ")//15秒执行一次
// @Transactional
public synchronized void MileChange() {
try {

@ -0,0 +1,347 @@
package com.nmgs.util;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import oracle.sql.CLOB;
import org.springframework.jdbc.core.JdbcTemplate;
import java.io.File;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.HttpURLConnection;
import java.net.URL;
import java.sql.Blob;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
public class PubTools {
static SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
static SimpleDateFormat dfYYD=new SimpleDateFormat("yyyy-MM-dd");
static SimpleDateFormat dfYMD = new SimpleDateFormat("yyyyMMdd");
public static JdbcTemplate jdbcTemplate = null;
public static String HTTPS = PropertiesUtil.getValue("domainInteger") + File.separator;
/**
*
* yyp 20190305
* @param anObject
* @return true :false:
*/
public static boolean isNull(String anObject ) {
if(null==anObject||"".equals(anObject)||"null".equals(anObject)){
return true;
}else{
return false;
}
}
public static boolean isEmpty(Object anObject ) {
if (anObject == null) return true;
else if (anObject instanceof CharSequence) return ((CharSequence) anObject).length() == 0;
else if (anObject instanceof Collection) return ((Collection) anObject).isEmpty();
else if (anObject instanceof Map) return ((Map) anObject).isEmpty();
//else if (anObject.getClass().isArray()) return Array.getLength(anObject) == 0;
return false;
}
/**
*
*
* @param IDCard
* @return
*/
public static Integer getAge(String IDCard) {
String age ="0";
Calendar cal = Calendar.getInstance();
int yearNow = cal.get(Calendar.YEAR);
int monthNow = cal.get(Calendar.MONTH)+1;
int dayNow = cal.get(Calendar.DATE);
String IDCardNew=((IDCard.length()==15)?IDCard.substring(0, 6)+"19"+IDCard.substring(6)+"0":IDCard);
System.out.println("IDCardNew==="+IDCardNew);
int year = Integer.valueOf(IDCardNew.substring(6,10));
int month = Integer.valueOf(IDCard.substring(10,12));
int day = Integer.valueOf(IDCard.substring(12,14));
System.out.println("year==="+year+"====month==="+month+"====day==="+day);
if ((month < monthNow) || (month == monthNow && day<= dayNow) ){
age = String.valueOf(yearNow - year);
}else {
age = String.valueOf(yearNow - year-1);
}
return Integer.parseInt(age);
}
public static JSONArray revertList(JSONObject json){
JSONArray listArray=new JSONArray();
listArray.add(json);
return listArray;
}
public static String getCurrentDate(){
return df.format(new Date());
}
public static String getCurrentDateNoStr(){
SimpleDateFormat df2=new SimpleDateFormat("yyyyMMddHHmmss");
return df2.format(new Date());
}
public static String getCurrentDateYYD(){
return dfYYD.format(new Date());
}
public static String getCurrentDateYMD() {
return dfYMD.format(new Date());
}
//拼接字符串
public static String StringToClob(String text) {
int content_length = text.length();
StringBuilder sb_temp = new StringBuilder();
int n = 1;
int max = content_length / 1999 + 1;
while (n < max) {
String temp = "";
temp = text.substring((n - 1) * 1999, n * 1999);
sb_temp.append("to_clob('" + temp + "')||");
n++;
}
sb_temp.append("to_clob('" + text.substring((n - 1) * 1999, content_length) + "')");
return sb_temp.toString();
}
//计算两个字符串日期相差秒数
/**
*
* @param startTime
* @param endTime
* @param diffType D S ,H M
* @return
*/
public static Long dateDiff(String startTime,String endTime,String diffType) {
long nd = 1000 * 24 * 60 * 60; //一天的毫秒数
long nh = 1000 * 60 * 60;//一小时的毫秒数据
long nm = 1000 * 60; //一分钟毫秒数
long ns = 1000;
long diff=0;
//获得两个时间的毫秒时间差异
try{
diff = df.parse(endTime).getTime() - df.parse(startTime).getTime();
}catch (Exception e){
e.printStackTrace();
}
// 计算差多少天
long day = diff / nd;
// 计算差多少小时
long hour = diff % nd / nh;
// 计算差多少分钟
long min = diff % nd % nh / nm;
// 计算差多少秒//输出结果
long sec = diff % nd % nh % nm / ns;
if("D".equals(diffType)){
return day;
}else if("H".equals(diffType)){
return hour;
}else if("M".equals(diffType)){
return min;
}else if("S".equals(diffType)){
return sec;
}else{
return 0l;
}
}
/**
* double
* @param number
* @return
*/
public static double doubleSave1(double number){
BigDecimal bd = BigDecimal.valueOf(number);
bd = bd.setScale(1, BigDecimal.ROUND_HALF_UP);
double roundedNumber = bd.doubleValue();
return roundedNumber;
}
/**
* 16
* @param hexStr
* @return
*/
public static String hexToString(String hexStr){
String[] split = hexStr.replace("|", ",").split(",");
Long dataStr = Long.valueOf(split[0], 16);
BigInteger bigint=new BigInteger(split[1], 16);
int series=bigint.intValue();
BigInteger bigint2=new BigInteger(split[2], 16);
int rebateInteger=bigint2.intValue();
BigInteger bigint3=new BigInteger(split[3], 16);
int checkStr=bigint.intValue();
return dataStr+"|"+series+"|"+rebateInteger+"|"+checkStr;
}
private static final String CHARACTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
public static List list=new ArrayList();
public static String generateRandomCode(int CODE_LENGTH) {
StringBuilder sb = new StringBuilder(CODE_LENGTH);
Random random = new Random();
for (int i = 0; i < CODE_LENGTH; i++) {
int index = random.nextInt(CHARACTERS.length());
sb.append(CHARACTERS.charAt(index));
}
if(list.contains(sb.toString())){
return generateRandomCode(6);
}else{
list.add(sb.toString());
return sb.toString();
}
}
/**
* 6
* @return
*/
public static String getlinkNo() {
String linkNo = "";
// 用字符数组的方式随机
String model = "0123ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char[] m = model.toCharArray();
for (int j = 0; j < 6; j++) {
char c = m[(int) (Math.random() * 30)];
// 保证六位随机数之间没有重复的
if (linkNo.contains(String.valueOf(c))) {
j--;
continue;
}
linkNo = linkNo + c;
}
return linkNo;
}
public static void main(String[] args) {
System.out.println(getCurrentDateYMD());
}
public static String ClobToString(Object clob) {
String reString = "";
try{
if(clob instanceof CLOB){
reString = ((CLOB)clob).getSubString((long) 1, (int) ((CLOB)clob).length());
}else if(clob instanceof Blob){
reString = clob.toString();
} else if (clob instanceof String) {
reString = clob.toString();
}
}catch (Exception e){
reString="";
}
return reString;
}
/**
* 访
*
* @param imageUrl
* @return
*/
public static boolean isImageExist(String imageUrl) {
try {
URL url = new URL(PubTools.HTTPS + imageUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("HEAD"); // 仅获取响应头‌:ml-citation{ref="3,8" data="citationList"}
conn.setConnectTimeout(5000);
int statusCode = conn.getResponseCode();
if (statusCode != 200) return false; // 非200状态码直接返回失败:ml-citation{ref="3,8" data="citationList"}
return true; // 验证是否为图片类型‌:ml-citation{ref="1,6" data="citationList"}
} catch (Exception e) {
return false;
}
}
/**
* 访
*
* @param imageUrl
* @return
*/
public static boolean isImageExistLocal(String imageUrl) {
try {
URL url = new URL(imageUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("HEAD"); // 仅获取响应头‌:ml-citation{ref="3,8" data="citationList"}
conn.setConnectTimeout(5000);
int statusCode = conn.getResponseCode();
if (statusCode != 200) return false; // 非200状态码直接返回失败:ml-citation{ref="3,8" data="citationList"}
return true; // 验证是否为图片类型‌:ml-citation{ref="1,6" data="citationList"}
} catch (Exception e) {
return false;
}
}
public static int getEnabledOcr() {
int a = 0;
String ocrenabled = PropertiesUtil.getValue("OCRENABLED");
if ("1".equals(ocrenabled)) {
a = 1;
}
return a;
}
/**
* ,
*
* @param startDay
* @param count
* @return
*/
public static String getBeforeDaySSSEnd(String startDay, int count) {
try {
Date date = dfYYD.parse(startDay);
Calendar cl = Calendar.getInstance();
cl.setTime(date);
cl.set(Calendar.DATE, cl.get(Calendar.DATE) - count);
return dfYYD.format(cl.getTime()) + " 23:59:59";
} catch (ParseException e) {
e.printStackTrace();
}
return "";
}
public static String getBeforeDaySSS(String startDay, int count) {
try {
Date date = dfYYD.parse(startDay);
Calendar cl = Calendar.getInstance();
cl.setTime(date);
cl.set(Calendar.DATE, cl.get(Calendar.DATE) - count);
return dfYYD.format(cl.getTime()) + " 00:00:00";
} catch (ParseException e) {
e.printStackTrace();
}
return "";
}
/**
*
*
* @param startDay
* @param count
* @return
*/
public static String getBeforeDay(String startDay, int count) {
try {
Date date = dfYYD.parse(startDay);
Calendar cl = Calendar.getInstance();
cl.setTime(date);
cl.set(Calendar.DATE, cl.get(Calendar.DATE) - count);
return dfYYD.format(cl.getTime());
} catch (ParseException e) {
e.printStackTrace();
}
return "";
}
}
Loading…
Cancel
Save