mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
update 分成功能
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SplitConfigDTO {
|
||||
private String merchantId;
|
||||
|
||||
private String stationId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SplitDetailDTO {
|
||||
// 汇付会员id
|
||||
private String adapayMemberId;
|
||||
|
||||
// 电量分成比例
|
||||
private String electricitySplitRatio;
|
||||
|
||||
// 服务费分成比例
|
||||
private String serviceSplitRatio;
|
||||
|
||||
// 是否承担手续费承担方
|
||||
private String isServiceCharge;
|
||||
}
|
||||
@@ -1,5 +1,15 @@
|
||||
package com.jsowell.pile.mapper;
|
||||
|
||||
import com.jsowell.pile.domain.StationSplitConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface StationSplitConfigMapper {
|
||||
|
||||
/**
|
||||
* 根据站点编号查询
|
||||
* @param stationId
|
||||
* @return
|
||||
*/
|
||||
List<StationSplitConfig> queryByStationId(String stationId);
|
||||
}
|
||||
@@ -60,23 +60,44 @@ public class PileSnGenerateService {
|
||||
// 缓存中没有,从数据库中取
|
||||
PileBasicInfo pileInfo = pileBasicInfoService.getMaxNumPileInfo();
|
||||
String pileSn = pileInfo.getSn();
|
||||
// 将前四位截取,并将后面转为long
|
||||
Long pileSnNum = Long.parseLong(StringUtils.substring(pileSn, 4, pileSn.length()));
|
||||
// String pileSnNum = StringUtils.substring(pileSn, 4, pileSn.length());
|
||||
// 将前四位截取,并将后面转为int
|
||||
pileNum = Integer.parseInt(StringUtils.substring(pileSn, 4, pileSn.length()));
|
||||
// 再将该值存入数据库
|
||||
redisCache.setCacheObject(key, pileSnNum.intValue());
|
||||
redisCache.setCacheObject(key, pileNum);
|
||||
}
|
||||
Long increNum = redisCache.increment(key, 1);
|
||||
// 年份
|
||||
int year = LocalDate.now().getYear() - 2000;
|
||||
//不足补位
|
||||
increResult = prefix + year + String.format("%1$010d", increNum);
|
||||
|
||||
// 保存到字典中
|
||||
savePileSn2Dict(pileNum);
|
||||
} catch (Exception e) {
|
||||
logger.error("获取序列号失败", e);
|
||||
}
|
||||
return increResult;
|
||||
}
|
||||
|
||||
private void savePileSn2Dict(long pileSnNum) {
|
||||
SysDictData queryData = new SysDictData();
|
||||
queryData.setDictType(pile_sn_generate_type);
|
||||
queryData.setDictLabel(EV_PILE_SN_LABEL);
|
||||
List<SysDictData> sysDictData = dictDataService.selectDictDataList(queryData);
|
||||
if (CollectionUtils.isNotEmpty(sysDictData)) {
|
||||
SysDictData dictData = sysDictData.get(0);
|
||||
dictData.setDictValue(pileSnNum + "");
|
||||
dictDataService.updateDictData(dictData);
|
||||
} else {
|
||||
SysDictData dictData = new SysDictData();
|
||||
dictData.setDictType(pile_sn_generate_type);
|
||||
dictData.setDictLabel(EBIKE_PILE_SN_LABEL);
|
||||
dictData.setDictValue(pileSnNum + "");
|
||||
dictData.setListClass(Constants.DEFAULT);
|
||||
dictData.setCreateBy(Constants.SYSTEM);
|
||||
dictDataService.insertDictData(dictData);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量生成sn号
|
||||
@@ -131,18 +152,18 @@ public class PileSnGenerateService {
|
||||
pileSnNum += 1;
|
||||
// 再将该值存入数据库
|
||||
increResult = prefix + year + String.format("%1$04d", pileSnNum);
|
||||
save2Dict(year, pileSnNum);
|
||||
saveEBikeSn2Dict(year, pileSnNum);
|
||||
} else {
|
||||
// 没有值, 从1开始, 并保存到字典中
|
||||
Long pileSnNum = 1L;
|
||||
increResult = prefix + year + String.format("%1$04d", pileSnNum);
|
||||
save2Dict(year, pileSnNum);
|
||||
saveEBikeSn2Dict(year, pileSnNum);
|
||||
}
|
||||
return increResult;
|
||||
}
|
||||
|
||||
|
||||
private void save2Dict(int year, long pileSnNum) {
|
||||
private void saveEBikeSn2Dict(int year, long pileSnNum) {
|
||||
SysDictData queryData = new SysDictData();
|
||||
queryData.setDictType(pile_sn_generate_type);
|
||||
queryData.setDictLabel(EBIKE_PILE_SN_LABEL + year);
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
package com.jsowell.pile.service;
|
||||
|
||||
import com.jsowell.pile.domain.StationSplitConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface StationSplitConfigService{
|
||||
|
||||
// 根据站点id查询站点分账配置信息
|
||||
List<StationSplitConfig> queryByStationId(String stationId);
|
||||
|
||||
// 插入站点分账配置信息
|
||||
int insert(StationSplitConfig record);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
package com.jsowell.pile.service.impl;
|
||||
|
||||
import com.jsowell.pile.domain.StationSplitConfig;
|
||||
import com.jsowell.pile.mapper.StationSplitConfigMapper;
|
||||
import com.jsowell.pile.service.StationSplitConfigService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class StationSplitConfigServiceImpl implements StationSplitConfigService{
|
||||
|
||||
@Resource
|
||||
private StationSplitConfigMapper stationSplitConfigMapper;
|
||||
|
||||
@Override
|
||||
public List<StationSplitConfig> queryByStationId(String stationId) {
|
||||
return stationSplitConfigMapper.queryByStationId(stationId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user