询价发行--询价投资者确定
parent
82bc5b7226
commit
6cd1be684d
@ -0,0 +1,46 @@
|
|||||||
|
package com.sztzjy.fund_investment.entity.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tz
|
||||||
|
* @date 2023/12/5 14:09
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AllotmentObjectDTO {
|
||||||
|
@ApiModelProperty("询价ID")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty("配售对象编码")
|
||||||
|
private String allotmentObjectCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("流程ID")
|
||||||
|
private String flowId;
|
||||||
|
|
||||||
|
@ApiModelProperty("配售对象名称")
|
||||||
|
private String allotmentObjectName;
|
||||||
|
|
||||||
|
@ApiModelProperty("配售对象类型")
|
||||||
|
private String allotmentObjectType;
|
||||||
|
|
||||||
|
@ApiModelProperty("投资者编码")
|
||||||
|
private Integer investorCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("投资者名称")
|
||||||
|
private String investorName;
|
||||||
|
|
||||||
|
@ApiModelProperty("投资者类型")
|
||||||
|
private String investorType;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("逻辑删除(0、不展示 1、展示)")
|
||||||
|
private Integer logic;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否确定")
|
||||||
|
private String sure;
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.sztzjy.fund_investment.service;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.sztzjy.fund_investment.entity.AllotmentObject;
|
||||||
|
import com.sztzjy.fund_investment.entity.dto.AllotmentObjectDTO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tz
|
||||||
|
* @date 2023/12/5 8:58
|
||||||
|
*/
|
||||||
|
public interface InquiryIssuanceService {
|
||||||
|
PageInfo<AllotmentObjectDTO> queryInquiryInvestors(String flowId, Integer size, Integer index);
|
||||||
|
|
||||||
|
// List<AllotmentObject> queryBuiltIn(String flowId);
|
||||||
|
|
||||||
|
void insertInquiryInvestors(String[] ids,String flowId);
|
||||||
|
|
||||||
|
void deleteInquiryInvestors(String[] ids, String flowId);
|
||||||
|
}
|
@ -0,0 +1,121 @@
|
|||||||
|
package com.sztzjy.fund_investment.service.serviceImpl;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.sztzjy.fund_investment.entity.AllotmentObject;
|
||||||
|
import com.sztzjy.fund_investment.entity.AllotmentObjectExample;
|
||||||
|
import com.sztzjy.fund_investment.entity.dto.AllotmentObjectDTO;
|
||||||
|
import com.sztzjy.fund_investment.mapper.AllotmentObjectMapper;
|
||||||
|
import com.sztzjy.fund_investment.service.InquiryIssuanceService;
|
||||||
|
import com.sztzjy.fund_investment.util.ConvertUtil;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author tz
|
||||||
|
* @date 2023/12/5 8:58
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class InquiryIssuanceServiceImpl implements InquiryIssuanceService {
|
||||||
|
@Resource
|
||||||
|
AllotmentObjectMapper allotmentObjectMapper;
|
||||||
|
@Resource
|
||||||
|
ConvertUtil convertUtil;
|
||||||
|
@Override
|
||||||
|
public PageInfo<AllotmentObjectDTO> queryInquiryInvestors(String flowId, Integer size, Integer index) {
|
||||||
|
//开启分页
|
||||||
|
PageHelper.startPage(size,index);
|
||||||
|
AllotmentObjectExample allotmentObjectExample=new AllotmentObjectExample();
|
||||||
|
allotmentObjectExample.createCriteria().andFlowIdEqualTo(flowId);
|
||||||
|
List<AllotmentObject> allotmentObjects = allotmentObjectMapper.selectByExample(allotmentObjectExample);
|
||||||
|
List<AllotmentObjectDTO> allotmentObjectDTOS =new ArrayList<>();
|
||||||
|
if(allotmentObjects.isEmpty()){
|
||||||
|
AllotmentObjectExample allotmentObjectExample1=new AllotmentObjectExample();
|
||||||
|
allotmentObjectExample1.createCriteria().andFlowIdIsNull();
|
||||||
|
List<AllotmentObject> list = allotmentObjectMapper.selectByExample(allotmentObjectExample1);
|
||||||
|
if(list.size()>0){
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
list.get(i).setId(String.valueOf(UUID.randomUUID()));
|
||||||
|
list.get(i).setLogic(1);
|
||||||
|
list.get(i).setFlowId(flowId);
|
||||||
|
allotmentObjectMapper.insert(list.get(i));
|
||||||
|
AllotmentObjectDTO allotmentObjectDTO = convertUtil.entityToDTO(list.get(i), AllotmentObjectDTO.class);
|
||||||
|
allotmentObjectDTO.setSure("是");
|
||||||
|
allotmentObjectDTOS.add(allotmentObjectDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PageInfo<AllotmentObjectDTO> pageInfo=new PageInfo<>(allotmentObjectDTOS);
|
||||||
|
return pageInfo;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < allotmentObjects.size(); i++) {
|
||||||
|
AllotmentObjectDTO allotmentObjectDTO = convertUtil.entityToDTO(allotmentObjects.get(i), AllotmentObjectDTO.class);
|
||||||
|
if(allotmentObjects.get(i).getLogic()==1){
|
||||||
|
allotmentObjectDTO.setSure("是");
|
||||||
|
allotmentObjectDTOS.add(allotmentObjectDTO);
|
||||||
|
}
|
||||||
|
if(allotmentObjects.get(i).getLogic()==0){
|
||||||
|
allotmentObjectDTO.setSure("否");
|
||||||
|
allotmentObjectDTOS.add(allotmentObjectDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PageInfo<AllotmentObjectDTO> pageInfo=new PageInfo<>(allotmentObjectDTOS);
|
||||||
|
return pageInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public List<AllotmentObject> queryBuiltIn(String flowId) {
|
||||||
|
// AllotmentObjectExample allotmentObjectExample=new AllotmentObjectExample();
|
||||||
|
// allotmentObjectExample.createCriteria().andFlowIdEqualTo(flowId);
|
||||||
|
// List<AllotmentObject> allotmentObjects = allotmentObjectMapper.selectByExample(allotmentObjectExample);
|
||||||
|
// if (allotmentObjects.isEmpty()){ //判断是否有已操作过的数据 没有则展示默认数据
|
||||||
|
// allotmentObjectExample.createCriteria().andFlowIdIsNull();
|
||||||
|
// List<AllotmentObject> allotmentObjects1 = allotmentObjectMapper.selectByExample(allotmentObjectExample);
|
||||||
|
// return allotmentObjects1;
|
||||||
|
// }
|
||||||
|
// //有则配售对象编码在最近一次新增的基础上自增
|
||||||
|
// allotmentObjectExample.setOrderByClause("create_time desc");
|
||||||
|
// List<AllotmentObject> allotmentObjects1 = allotmentObjectMapper.selectByExample(allotmentObjectExample);
|
||||||
|
// if(allotmentObjects1.size()>0){
|
||||||
|
// AllotmentObject allotmentObject = allotmentObjects1.get(0);
|
||||||
|
// List<AllotmentObject> list=new ArrayList<>();
|
||||||
|
// //取到配售对象编码
|
||||||
|
// String allotmentObjectCode = allotmentObject.getAllotmentObjectCode();
|
||||||
|
// String substring = allotmentObjectCode.substring(1); //取到第二位
|
||||||
|
// String s = substring.replaceAll("^(0+)", ""); //从第一个不为0的开始截取
|
||||||
|
// Integer i = Integer.valueOf(s);
|
||||||
|
// i++; //第一个配售对象编码自增
|
||||||
|
// String number = String.format("I" + "%09d", i);
|
||||||
|
// allotmentObject.setAllotmentObjectCode(number);
|
||||||
|
// list.add(allotmentObject);
|
||||||
|
// i++; //第二个配售对象编码自增
|
||||||
|
// String number1 = String.format("I" + "%09d", i);
|
||||||
|
// allotmentObject.setAllotmentObjectCode(number1);
|
||||||
|
// list.add(allotmentObject);
|
||||||
|
// return list;
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertInquiryInvestors(String[] ids,String flowId) {
|
||||||
|
for (int i = 0; i < ids.length; i++) {
|
||||||
|
AllotmentObject allotmentObject = allotmentObjectMapper.selectByPrimaryKey(ids[i]);
|
||||||
|
allotmentObject.setLogic(1);
|
||||||
|
allotmentObjectMapper.updateByPrimaryKey(allotmentObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteInquiryInvestors(String[] ids, String flowId) {
|
||||||
|
for (int i = 0; i < ids.length; i++) {
|
||||||
|
AllotmentObject allotmentObject = allotmentObjectMapper.selectByPrimaryKey(ids[i]);
|
||||||
|
allotmentObject.setLogic(0);
|
||||||
|
allotmentObjectMapper.updateByPrimaryKey(allotmentObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,117 @@
|
|||||||
|
package com.sztzjy.fund_investment.util;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author tanzheng
|
||||||
|
* @Description 类型转换: Entity - DTO互转
|
||||||
|
* @Date 2023/8/9
|
||||||
|
* @Param [params]
|
||||||
|
**/
|
||||||
|
@Component
|
||||||
|
public class ConvertUtil {
|
||||||
|
public static final Logger logger = LoggerFactory.getLogger(ConvertUtil.class);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entity转DTO
|
||||||
|
* @param source
|
||||||
|
* @param target
|
||||||
|
* @return
|
||||||
|
* @param <T>
|
||||||
|
*/
|
||||||
|
public <T> T entityToDTO(Object source, Class<T> target) {
|
||||||
|
if (source == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
T targetObject = null;
|
||||||
|
try {
|
||||||
|
targetObject = target.newInstance();
|
||||||
|
BeanUtils.copyProperties(source, targetObject);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return targetObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DTO转Entity
|
||||||
|
* @param source
|
||||||
|
* @param target
|
||||||
|
* @return
|
||||||
|
* @param <T>
|
||||||
|
*/
|
||||||
|
public <T> T DTOToEntity(Object source, Class<T> target) {
|
||||||
|
if (source == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
T targetObject = null;
|
||||||
|
try {
|
||||||
|
targetObject = target.newInstance();
|
||||||
|
BeanUtils.copyProperties(source, targetObject);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return targetObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表实体转DTO
|
||||||
|
* @param sourceList
|
||||||
|
* @param target
|
||||||
|
* @return
|
||||||
|
* @param <T>
|
||||||
|
*/
|
||||||
|
public <T> List<T> entityToDTOList(Collection<?> sourceList, Class<T> target) {
|
||||||
|
if (sourceList == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<T> targetList = new ArrayList<>(sourceList.size());
|
||||||
|
|
||||||
|
try {
|
||||||
|
for (Object source : sourceList) {
|
||||||
|
T targetObject = target.newInstance();
|
||||||
|
BeanUtils.copyProperties(source, targetObject);
|
||||||
|
targetList.add(targetObject);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("convert error ", e);
|
||||||
|
}
|
||||||
|
return targetList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DTO转列表实体
|
||||||
|
* @param sourceList
|
||||||
|
* @param target
|
||||||
|
* @return
|
||||||
|
* @param <T>
|
||||||
|
*/
|
||||||
|
public <T> List<T> DTOListToEntity(Collection<?> sourceList, Class<T> target) {
|
||||||
|
if (sourceList == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<T> targetList = new ArrayList<>(sourceList.size());
|
||||||
|
|
||||||
|
try {
|
||||||
|
for (Object source : sourceList) {
|
||||||
|
T targetObject = target.newInstance();
|
||||||
|
BeanUtils.copyProperties(source, targetObject);
|
||||||
|
targetList.add(targetObject);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("convert error ", e);
|
||||||
|
}
|
||||||
|
return targetList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue