Commit 02d0d673 by lzxry
parent ae5d5155
......@@ -99,22 +99,22 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query(value = "select contract_code,my_body_code,sale,platform from contract where contract_code in ?1", nativeQuery = true)
List<Object[]> findByContractCode(List<String> codesList);
@Query(value = "select * from contract where ((start_date <= ?1 and end_date >= ?1) or (start_date <= ?2 and end_date >= ?2) or (start_date >= ?1 and end_date <= ?2) or (start_date <= ?1 and end_date >= ?2)) and platform=?3 and status!='del' and share_sign <> 0 ", nativeQuery = true)
@Query(value = "select * from contract where ((start_date <= ?1 and end_date >= ?1) or (start_date <= ?2 and end_date >= ?2) or (start_date >= ?1 and end_date <= ?2) or (start_date <= ?1 and end_date >= ?2)) and platform=?3 and status!='del' and (share_sign = 1 or share_sign is null) ", nativeQuery = true)
List<Contract> findShareContranctByDate3(String startDate, String endDate, String platform);
@Query(value = "select * from contract where ((start_date <= ?1 and end_date >= ?1) or (start_date <= ?2 and end_date >= ?2) or (start_date >= ?1 and end_date <= ?2) or (start_date <= ?1 and end_date >= ?2)) and platform=?3 and my_body_code = ?4 and status!='del' and share_sign <> 0 ", nativeQuery = true)
@Query(value = "select * from contract where ((start_date <= ?1 and end_date >= ?1) or (start_date <= ?2 and end_date >= ?2) or (start_date >= ?1 and end_date <= ?2) or (start_date <= ?1 and end_date >= ?2)) and platform=?3 and my_body_code = ?4 and status!='del' and (share_sign = 1 or share_sign is null) ", nativeQuery = true)
List<Contract> findShareContranctByDate2(String startDate, String endDate, String platform, String bodyCode);
@Query(value = "select * from contract where ((start_date <= ?1 and end_date >= ?1) or (start_date <= ?2 and end_date >= ?2) or (start_date >= ?1 and end_date <= ?2) or (start_date <= ?1 and end_date >= ?2)) and platform=?3 and (my_body_name like %?4% or customer_body like %?4% or contract_code like %?4%) and status!='del' and share_sign <> 0 ", nativeQuery = true)
@Query(value = "select * from contract where ((start_date <= ?1 and end_date >= ?1) or (start_date <= ?2 and end_date >= ?2) or (start_date >= ?1 and end_date <= ?2) or (start_date <= ?1 and end_date >= ?2)) and platform=?3 and (my_body_name like %?4% or customer_body like %?4% or contract_code like %?4%) and status!='del' and (share_sign = 1 or share_sign is null) ", nativeQuery = true)
List<Contract> findShareContranctByDateSerche(String startDate, String endDate, String platform, String serchName);
@Query(value = "select * from contract where ((start_date <= ?1 and end_date >= ?1) or (start_date <= ?2 and end_date >= ?2) or (start_date >= ?1 and end_date <= ?2) or (start_date <= ?1 and end_date >= ?2)) and platform=?3 and my_body_code = ?4 and (my_body_name like %?5% or customer_body like %?5% or contract_code like %?5%) and status!='del' and share_sign <> 0 ", nativeQuery = true)
@Query(value = "select * from contract where ((start_date <= ?1 and end_date >= ?1) or (start_date <= ?2 and end_date >= ?2) or (start_date >= ?1 and end_date <= ?2) or (start_date <= ?1 and end_date >= ?2)) and platform=?3 and my_body_code = ?4 and (my_body_name like %?5% or customer_body like %?5% or contract_code like %?5%) and status!='del' and (share_sign = 1 or share_sign is null) ", nativeQuery = true)
List<Contract> findShareContranctByDate1(String startDate, String endDate, String platform, String bodyCode, String serchName);
@Query(value = "select * from contract where ((start_date <= ?1 and end_date >= ?1) or (start_date <= ?2 and end_date >= ?2) or (start_date >= ?1 and end_date <= ?2) or (start_date <= ?1 and end_date >= ?2)) and platform=?3 and (my_body_name like %?4% or customer_body like %?4% or contract_code like %?5%) and my_body_code in ?5 and status!='del' and share_sign <> 0 ", nativeQuery = true)
@Query(value = "select * from contract where ((start_date <= ?1 and end_date >= ?1) or (start_date <= ?2 and end_date >= ?2) or (start_date >= ?1 and end_date <= ?2) or (start_date <= ?1 and end_date >= ?2)) and platform=?3 and (my_body_name like %?4% or customer_body like %?4% or contract_code like %?5%) and my_body_code in ?5 and status!='del' and (share_sign = 1 or share_sign is null) ", nativeQuery = true)
List<Contract> findShareContranctByDateSercheFinace(String startDate, String endDate, String platform, String serchName, List<String> financeBodies);
@Query(value = "select * from contract where ((start_date <= ?1 and end_date >= ?1) or (start_date <= ?2 and end_date >= ?2) or (start_date >= ?1 and end_date <= ?2) or (start_date <= ?1 and end_date >= ?2)) and platform=?3 and my_body_code in ?4 and status!='del' and share_sign <> 0 ", nativeQuery = true)
@Query(value = "select * from contract where ((start_date <= ?1 and end_date >= ?1) or (start_date <= ?2 and end_date >= ?2) or (start_date >= ?1 and end_date <= ?2) or (start_date <= ?1 and end_date >= ?2)) and platform=?3 and my_body_code in ?4 and status!='del' and (share_sign = 1 or share_sign is null) ", nativeQuery = true)
List<Contract> findShareContranctByDateFinace(String startDate, String endDate, String platform, List<String> financeBodies);
@Query(value = "select contract_code from contract where customer_body =?1 and contract_code <> ?2 and status in ('backfirst','normal','late') limit 3 ", nativeQuery = true)
......
......@@ -82,8 +82,11 @@ public class ContractServiceImpl implements ContractService {
private static final Map<String, String> SHEET_TITLE = new HashMap() {{
put("我方签约主体", "my_body_name");
put("客户签约主体", "customer_body");
put("行政区域", "barrio_id");
put("隶属集团", "belong_group");
put("行业分类", "trade_type");
put("合同金额", "money");
put("总点击次数", "track_flow");
put("客户主账号", "email");
put("合同编号", "contract_code");
put("签约类型", "contract_type");
......@@ -97,8 +100,11 @@ public class ContractServiceImpl implements ContractService {
private static final Map<String, String> SHEET_TITLE_RESERVE = new HashMap() {{
put("my_body_name", "我方签约主体");
put("customer_body", "客户签约主体");
put("barrio_id", "行政区域");
put("belong_group", "隶属集团");
put("trade_type", "行业分类");
put("money", "合同金额");
put("track_flow", "总点击次数");
put("email", "客户主账号");
put("contract_code", "合同编号");
put("contract_type", "签约类型");
......@@ -2218,7 +2224,12 @@ public class ContractServiceImpl implements ContractService {
public ResultModel uploadBatchInfo(MultipartFile file, String platform) {
InputStream stream = null;
try {
int row_length = 11;
int row_length;
if(platform.equals("tkio")){
row_length = 14;
}else{
row_length = 13;
}
stream = file.getInputStream();
Workbook workbook = WorkbookFactory.create(stream);
// Iterator<Sheet> sheetIter = workbook.sheetIterator();
......@@ -2262,7 +2273,13 @@ public class ContractServiceImpl implements ContractService {
.stream().collect(Collectors.toMap(TradeType::getName, TradeType::getId));
Map<String, Long> salseMap = salesRepository.findSaleByStatus(0)
.stream().collect(Collectors.toMap(Sales::getName, Sales::getId));
Map<String, Long> packageMap = null;
Map<String, Long> packageMap = packageBaseRepository.findByPlatAndStatus(platform, 1)
.stream().collect(Collectors.toMap(PackageBase::getPackageName, PackageBase::getId));
Map<Long, BarrioCity> barrioCityMap = barrioCityRepository.findAll()
.stream().collect(Collectors.toMap(BarrioCity::getId, Function.identity()));
/*Map<String, Long> packageMap = null;
if ("tkio".equals(platform) || "io".equals(platform)) {
packageMap = packageTypeRepository.findIsNewAll()
......@@ -2270,7 +2287,7 @@ public class ContractServiceImpl implements ContractService {
} else {
packageMap = packageBaseRepository.findByPlatAndStatus(platform, 1)
.stream().collect(Collectors.toMap(PackageBase::getPackageName, PackageBase::getId));
}
}*/
Map<String, String> cBodyMap = null;
if ("abtest".equals(platform) || "ads".equals(platform)) {
......@@ -2286,6 +2303,10 @@ public class ContractServiceImpl implements ContractService {
if (!parseRowData(row, row_length, null, titleKey)) {
return ResultModel.ERROR(ResultStatus.FORMAT_FILE_ERRO);
}
if(!platform.equals("tkio")){
titleKey.remove("总点击次数");
titleKey.remove("track_flow");
}
int row_already = titleKey.size();
String extend_row_sql = "platform,product,my_body_code,create_time,code_num,type,status,back_status,ds," +
......@@ -2360,11 +2381,15 @@ public class ContractServiceImpl implements ContractService {
s_data[w] = CONTRACT_TYPE_NAME.get(dataSTR);
}
} else if ("price_level".equals(sheetTitle)) {
if (packageMap != null && !packageMap.containsKey(dataSTR)) {
if (packageMap != null && (!packageMap.containsKey(dataSTR) && !packageMap.containsValue(Long.parseLong(dataSTR)))) {
return ResultModel.ERROR("第" + line_num + "行【套餐】错误");
} else {
if(platform.equals("tkio")){
s_data[w] = dataSTR;
}else{
s_data[w] = packageMap.get(dataSTR);
}
}
} else if ("start_date".equals(sheetTitle) || "end_date".equals(sheetTitle)) {
String dfmate = cell.getCellStyle().getDataFormatString();
......@@ -2394,6 +2419,12 @@ public class ContractServiceImpl implements ContractService {
} else if ("money".equals(sheetTitle)) {
s_data[w] = dataSTR.replace(",", "");
} else if ("barrio_id".equals(sheetTitle)) {
if(barrioCityMap.containsKey(Long.parseLong(dataSTR))){
s_data[w] = dataSTR;
}else{
return ResultModel.ERROR("第" + line_num + "行【行政区域】code错误");
}
} else {
s_data[w] = dataSTR;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment