|
|
@@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import java.math.BigDecimal; |
|
|
import java.math.BigDecimal; |
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
@@ -115,7 +116,7 @@ public class DataInitController extends BaseController { |
|
|
try { |
|
|
try { |
|
|
MallUserInfo userInfo = getUser(); |
|
|
MallUserInfo userInfo = getUser(); |
|
|
if (userInfo.isFmSuperAdmin()) { |
|
|
if (userInfo.isFmSuperAdmin()) { |
|
|
doFixCredit4CUserBasic(); |
|
|
|
|
|
|
|
|
doFixCreditHistory(); |
|
|
return new ResultData(); |
|
|
return new ResultData(); |
|
|
} |
|
|
} |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
@@ -246,6 +247,52 @@ public class DataInitController extends BaseController { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void doFixCreditHistory() { |
|
|
|
|
|
SimpleDateFormat dataFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
String dateTime = "2019-09-16 22:00:00"; |
|
|
|
|
|
List<WxCreditHistory> cuUserList = creditHistoryMapper.findListAfter(null, null); // new ArrayList<>(); // |
|
|
|
|
|
//cuUserList.add(new WxCreditHistory(){{ |
|
|
|
|
|
// setCUserId(262738733739016192L); |
|
|
|
|
|
//}}); |
|
|
|
|
|
for (WxCreditHistory cuUser: cuUserList) { |
|
|
|
|
|
//cuUserList.stream().forEach(cuUser->{ |
|
|
|
|
|
WxCreditHistory q = new WxCreditHistory(); |
|
|
|
|
|
q.setCUserId(cuUser.getCUserId()); |
|
|
|
|
|
List<WxCreditHistory> creditHistories = creditHistoryMapper.findList(q); |
|
|
|
|
|
int amount = 0; |
|
|
|
|
|
boolean isError = false; |
|
|
|
|
|
for (WxCreditHistory creditHistory : creditHistories) { |
|
|
|
|
|
int oldamount = amount; |
|
|
|
|
|
if (creditHistory.getCreditType().equals(EnumScoreType.MEM_IMPORT.getCode())) { |
|
|
|
|
|
amount = creditHistory.getCreditNum(); |
|
|
|
|
|
} else { |
|
|
|
|
|
amount = amount + creditHistory.getCreditNum(); |
|
|
|
|
|
} |
|
|
|
|
|
if (!creditHistory.getCreditAmount().equals(amount)) { |
|
|
|
|
|
//log.error("credit hist err: {},{},{},{},{}", creditHistory.getId(), creditHistory.getCUserId(), creditHistory.getCreditAmount(), creditHistory.getCreditNum(), oldamount); |
|
|
|
|
|
WxCreditHistory updateRecord = new WxCreditHistory(); |
|
|
|
|
|
updateRecord.setId(creditHistory.getId()); |
|
|
|
|
|
updateRecord.setCreditAmount(amount); |
|
|
|
|
|
creditHistoryMapper.updateByPrimaryKeySelective(updateRecord); |
|
|
|
|
|
isError = true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (isError) { |
|
|
|
|
|
WxCUser cUser = new WxCUser(); |
|
|
|
|
|
cUser.setId(cuUser.getCUserId()); |
|
|
|
|
|
cUser.setCredit(amount); |
|
|
|
|
|
cUserMapper.updateByPrimaryKeySelective(cUser); |
|
|
|
|
|
WxCUserBasicInfo cUserBasicInfo = new WxCUserBasicInfo(); |
|
|
|
|
|
cUserBasicInfo.setId(cuUser.getCUserId()); |
|
|
|
|
|
cUserBasicInfo.setCredit(amount); |
|
|
|
|
|
cUserBasicInfoMapper.updateByPrimaryKeySelective(cUserBasicInfo); |
|
|
|
|
|
log.error("credit hist err: {}", cuUser.getCUserId()); |
|
|
|
|
|
} |
|
|
|
|
|
//}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void doFixVerifyCredit() { |
|
|
public void doFixVerifyCredit() { |
|
|
// 1 获取券码 |
|
|
// 1 获取券码 |
|
|
|