|
|
@@ -32,7 +32,10 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
@@ -89,6 +92,8 @@ public class UseraccountServiceImpl extends ServiceImpl<IUseraccountMapper, User
|
|
|
private SystemmanagerServiceImpl systemmanagerService;
|
|
|
@Resource
|
|
|
private ITaaccountMapper iTaaccountMapper;
|
|
|
+ @Resource
|
|
|
+ private IRiskratiotypeMapper iRiskratiotypeMapper;
|
|
|
|
|
|
|
|
|
@Override
|
|
|
@@ -759,6 +764,87 @@ public class UseraccountServiceImpl extends ServiceImpl<IUseraccountMapper, User
|
|
|
return AjaxResult.success(Constants.Success_Code_Design, MessageType.MESSAGE_CODE_SYSTEM001.getCode(), request.getHeader("Accept-Language"));
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public PageResult<InvestorPersonalizedResult> queryPersonalized(String groupname, Integer pageNum, Integer pageSize, HttpServletRequest request) {
|
|
|
+ Systemmanager systemmanager = iSystemmanagerMapper.selectOne(new QueryWrapper<Systemmanager>().eq("LOGINCODE", iCommonService.getUserLoginCode(request)));
|
|
|
+ Long userid = null;
|
|
|
+ if (systemmanager.getReletype().intValue() == SysConstants.SYS_TYPE_CLIENT) {
|
|
|
+ userid = systemmanager.getAreauserid();
|
|
|
+ }
|
|
|
+ IPage<InvestorPersonalizedResult> page = new Page<>(pageNum, pageSize);
|
|
|
+ IPage<InvestorPersonalizedResult> modifyPage = iUseraccountMapper.queryPersonalized(page, groupname, userid);
|
|
|
+ PageResult<InvestorPersonalizedResult> pageResult = new PageResult<>();
|
|
|
+ pageResult.setCode(Constants.Success_Code_Design);
|
|
|
+ pageResult.setMessage(AjaxResult.dealMsg(MessageType.MESSAGE_CODE_SYSTEM001.getCode(), request.getHeader("Accept-Language")));
|
|
|
+ pageResult.setPages(modifyPage.getPages());
|
|
|
+ pageResult.setCurrent(modifyPage.getCurrent());
|
|
|
+ pageResult.setTotal(modifyPage.getTotal());
|
|
|
+ pageResult.setPageSize(modifyPage.getSize());
|
|
|
+ pageResult.setData(modifyPage.getRecords());
|
|
|
+ return pageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult<Riskratiotype> getRiskRatioTypeForMarketer(Integer customertype, HttpServletRequest request) {
|
|
|
+ Riskratiotype riskRatioType = iRiskratiotypeMapper.selectOne(new QueryWrapper<Riskratiotype>()
|
|
|
+ .eq("customertype", customertype)
|
|
|
+ .eq("riskcontrolmode", 1));
|
|
|
+
|
|
|
+ BigDecimal cNum = new BigDecimal(100);
|
|
|
+ if (riskRatioType.getRecovertraderiskratio() != null) {
|
|
|
+ riskRatioType.setRecovertraderiskratio(riskRatioType.getRecovertraderiskratio()
|
|
|
+ .multiply(cNum).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ }
|
|
|
+ if (riskRatioType.getNotemarginriskratio() != null) {
|
|
|
+ riskRatioType.setNotemarginriskratio(riskRatioType.getNotemarginriskratio()
|
|
|
+ .multiply(cNum).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ }
|
|
|
+ if (riskRatioType.getAddmarginriskratio() != null) {
|
|
|
+ riskRatioType.setAddmarginriskratio(riskRatioType.getAddmarginriskratio()
|
|
|
+ .multiply(cNum).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ }
|
|
|
+ if (riskRatioType.getCutriskratio() != null) {
|
|
|
+ riskRatioType.setCutriskratio(riskRatioType.getCutriskratio().multiply(cNum)
|
|
|
+ .setScale(2, RoundingMode.HALF_UP));
|
|
|
+ }
|
|
|
+ if (riskRatioType.getCutbackriskratio() != null) {
|
|
|
+ riskRatioType.setCutbackriskratio(riskRatioType.getCutbackriskratio()
|
|
|
+ .multiply(cNum).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ }
|
|
|
+
|
|
|
+ //安全度
|
|
|
+ if (riskRatioType.getNotesaferatio() != null) {
|
|
|
+ riskRatioType.setNotesaferatio(riskRatioType.getNotesaferatio().multiply(cNum)
|
|
|
+ .setScale(2, RoundingMode.HALF_UP));
|
|
|
+ }
|
|
|
+ if (riskRatioType.getAddsaferatio() != null) {
|
|
|
+ riskRatioType.setAddsaferatio(riskRatioType.getAddsaferatio().multiply(cNum)
|
|
|
+ .setScale(2, RoundingMode.HALF_UP));
|
|
|
+ }
|
|
|
+ if (riskRatioType.getRecoversaferatio() != null) {
|
|
|
+ riskRatioType.setRecoversaferatio(riskRatioType.getRecoversaferatio()
|
|
|
+ .multiply(cNum).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ }
|
|
|
+ if (riskRatioType.getCutsaferatio() != null) {
|
|
|
+ riskRatioType.setCutsaferatio(riskRatioType.getCutsaferatio()
|
|
|
+ .multiply(cNum).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Market> marketList = iMarketMapper.selectList(new QueryWrapper<Market>().in(StringUtils.isNotBlank(riskRatioType.getCutmarginseq()), "marketid",
|
|
|
+ Arrays.stream(riskRatioType.getCutmarginseq().split(",")).filter(s -> !s.trim().isEmpty()).map(Long::valueOf).collect(Collectors.toList())));
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
+ for (int i = 0; i < marketList.size(); i++) {
|
|
|
+ if (i == marketList.size() - 1) {
|
|
|
+ stringBuilder.append(marketList.get(i).getMarketname());
|
|
|
+ } else {
|
|
|
+ stringBuilder.append(marketList.get(i).getMarketname()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ riskRatioType.setMarkets(stringBuilder.toString());
|
|
|
+ return AjaxResult.success(Constants.Success_Code_Design, MessageType.MESSAGE_CODE_SYSTEM001.getCode(), request.getHeader("Accept-Language"),riskRatioType);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
private Integer getUserESignRecordCount(Long userid, Long areauserid) {
|
|
|
// 根据ESignTemplateConfig表生成UserESignRecord表记录
|
|
|
Map<String, Object> map = new HashMap<>();
|