Compare commits
3 Commits
a05f76b580
...
2f3fefaf86
| Author | SHA1 | Date |
|---|---|---|
|
|
2f3fefaf86 | 4 months ago |
|
|
b3f5bcdf3d | 4 months ago |
|
|
c4c9ff7f18 | 4 months ago |
@ -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> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue