|
@@ -9,12 +9,16 @@ import com.sqx.modules.app.entity.UserEntity;
|
|
import com.sqx.modules.app.service.UserService;
|
|
import com.sqx.modules.app.service.UserService;
|
|
import com.sqx.modules.creditRecord.dao.CreditRecordDao;
|
|
import com.sqx.modules.creditRecord.dao.CreditRecordDao;
|
|
import com.sqx.modules.creditRecord.entity.CreditRecord;
|
|
import com.sqx.modules.creditRecord.entity.CreditRecord;
|
|
|
|
+import com.sqx.modules.creditRecord.entity.CreditRecordEntity;
|
|
import com.sqx.modules.creditRecord.service.CreditRecordService;
|
|
import com.sqx.modules.creditRecord.service.CreditRecordService;
|
|
import com.sqx.modules.sys.entity.SysUserEntity;
|
|
import com.sqx.modules.sys.entity.SysUserEntity;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
|
+import java.util.LinkedHashMap;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -29,6 +33,8 @@ public class CreditRecordServiceImpl extends ServiceImpl<CreditRecordDao, Credit
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private UserService userService;
|
|
private UserService userService;
|
|
|
|
+ @Resource
|
|
|
|
+ private CreditRecordDao creditRecordDao;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public IPage<CreditRecord> getCreditRecordList(Integer page, Integer limit, CreditRecord creditRecord) {
|
|
public IPage<CreditRecord> getCreditRecordList(Integer page, Integer limit, CreditRecord creditRecord) {
|
|
@@ -43,7 +49,7 @@ public class CreditRecordServiceImpl extends ServiceImpl<CreditRecordDao, Credit
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void updateUserCreditRecord(UserEntity userEntity, Integer type, Integer score, String remark) {
|
|
|
|
|
|
+ public void updateUserCreditRecord(UserEntity userEntity, Integer type, Integer score, String remark,Integer isDriver) {
|
|
CreditRecord creditRecord = new CreditRecord();
|
|
CreditRecord creditRecord = new CreditRecord();
|
|
creditRecord.setCreateTime(LocalDateTime.now());
|
|
creditRecord.setCreateTime(LocalDateTime.now());
|
|
creditRecord.setLastCreditScore(userEntity.getCreditScore());
|
|
creditRecord.setLastCreditScore(userEntity.getCreditScore());
|
|
@@ -68,9 +74,29 @@ public class CreditRecordServiceImpl extends ServiceImpl<CreditRecordDao, Credit
|
|
creditRecord.setSysUserName(userEntity.getUserName());
|
|
creditRecord.setSysUserName(userEntity.getUserName());
|
|
}
|
|
}
|
|
creditRecord.setReason(remark);
|
|
creditRecord.setReason(remark);
|
|
|
|
+ creditRecord.setIsDriver(isDriver);
|
|
baseMapper.insert(creditRecord);
|
|
baseMapper.insert(creditRecord);
|
|
|
|
|
|
- userEntity.setCreditScore(nowScore);
|
|
|
|
|
|
+ if (isDriver == 0){
|
|
|
|
+ userEntity.setCreditScore(nowScore);
|
|
|
|
+ }else {
|
|
|
|
+ userEntity.setCreditScoreSf(nowScore);
|
|
|
|
+ }
|
|
userService.updateById(userEntity);
|
|
userService.updateById(userEntity);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public CreditRecordEntity getScore(Long userId, Integer isDriver){
|
|
|
|
+ return creditRecordDao.getScore(userId,isDriver);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public Map<String,Object> getFilledScore(Long userId, Integer isDriver,Integer several){
|
|
|
|
+
|
|
|
|
+ Map<String, Object> orderedMap = new LinkedHashMap<>();
|
|
|
|
+ creditRecordDao.getFilledScore(userId,isDriver,several).entrySet().stream()
|
|
|
|
+ .sorted(Map.Entry.comparingByKey()) // 按月份排序;如不需要可删除
|
|
|
|
+ .forEachOrdered(e -> orderedMap.put(e.getKey(), e.getValue()));
|
|
|
|
+
|
|
|
|
+ return orderedMap;
|
|
|
|
+ }
|
|
}
|
|
}
|