Commit d1b492f0 authored by lcl's avatar lcl

u

parent 617bcb01
......@@ -28,7 +28,7 @@ public class ContactInfoController extends BaseController {
/**
* 联系人列表
*/
// @PreAuthorize("@ss.hasPermi('contact:list')")
// @PreAuthorize("@ss.hasPermi('contact:info:list')")
@GetMapping("/list")
public TableDataInfo selectPageList(ContactInfoSearchDto dto){
startPage();
......@@ -47,7 +47,7 @@ public class ContactInfoController extends BaseController {
/**
* 添加用户联系人
*/
// @PreAuthorize("@ss.hasPermi('contact:add')")
// @PreAuthorize("@ss.hasPermi('contact:info:add')")
@PostMapping()
@RepeatSubmit()
public AjaxResult add(@RequestBody ContactInfo baen){
......@@ -57,7 +57,7 @@ public class ContactInfoController extends BaseController {
/**
* 编辑用户联系人
*/
// @PreAuthorize("@ss.hasPermi('contact:edit')")
// @PreAuthorize("@ss.hasPermi('contact:info:edit')")
@PutMapping()
@RepeatSubmit()
public AjaxResult edit(@RequestBody ContactInfo baen){
......@@ -67,7 +67,7 @@ public class ContactInfoController extends BaseController {
/**
* 删除用户联系人
*/
// @PreAuthorize("@ss.hasPermi('contact:del')")
// @PreAuthorize("@ss.hasPermi('contact:info:del')")
@DeleteMapping("/{id}")
@RepeatSubmit()
public AjaxResult del(@PathVariable("id") Long id){
......
package com.dsk.system.dskService;
import cn.hutool.core.bean.BeanException;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
......@@ -13,6 +14,7 @@ import com.dsk.common.core.redis.RedisCache;
import com.dsk.common.utils.DskOpenApiUtil;
import com.dsk.common.utils.EncodeIdUtil;
import com.dsk.system.domain.customer.vo.CustomerStatusListVo;
import com.dsk.system.searchService.BusinessOpportunityRadarService;
import com.dsk.system.service.ICustomerService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
......@@ -21,11 +23,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
......@@ -80,7 +80,7 @@ public class EnterpriseService {
Integer bondCreditRatingCode = MapUtils.getInteger(bondCreditRatingMap, "code", 300);
if (200 != bondCreditRatingCode) return R.ok(companyData);
List<Map<String, Object>> bondCreditRatingList = (List<Map<String, Object>>)MapUtils.getObject(bondCreditRatingMap, "data", new ArrayList<>());
List<Map<String, Object>> bondCreditRatingList = (List<Map<String, Object>>) MapUtils.getObject(bondCreditRatingMap, "data", new ArrayList<>());
if (CollectionUtils.isEmpty(bondCreditRatingList)) return R.ok(companyData);
companyData.put("bratingSubjectLevel", MapUtils.getString(bondCreditRatingList.get(0), "bratingSubjectLevel", null));
......@@ -248,8 +248,8 @@ public class EnterpriseService {
for (Object dataMap : list) {
String name = MapUtils.getString(CommonUtils.assertAsMap(dataMap), "companyName");
if (ObjectUtil.isNotEmpty(name) && ObjectUtil.isNotEmpty(body.getKeys())) {
name = name.replaceAll("<font color='red'>","");
name = name.replaceAll("</font>","");
name = name.replaceAll("<font color='red'>", "");
name = name.replaceAll("</font>", "");
companyNames.add(name);
} else {
companyNames.add(name);
......@@ -267,7 +267,7 @@ public class EnterpriseService {
if (codeRating.equals(HttpStatus.OK.value())) {
Object object = bondCreditRatingMap.get("data");
if (ObjectUtil.isNotEmpty(object)) {
objArrayList = (ArrayList)object;
objArrayList = (ArrayList) object;
}
}
......@@ -278,45 +278,45 @@ public class EnterpriseService {
String uipId = MapUtils.getString(companyMap, "uipId");
String companyName = MapUtils.getString(companyMap, "companyName", "");
if (ObjectUtil.isNotEmpty(companyName) && ObjectUtil.isNotEmpty(body.getKeys())) {
companyName = companyName.replace("<font color='red'>","");
companyName = companyName.replace("</font>","");
companyName = companyName.replace("<font color='red'>", "");
companyName = companyName.replace("</font>", "");
}
Long companyId = MapUtils.getLong(companyMap, "companyId");
companyMap.put("bondBalance",MapUtils.getDouble(companyMap, "bondBalance")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "bondBalance")));
companyMap.put("totalAssets",MapUtils.getDouble(companyMap, "totalAssets")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "totalAssets")));
companyMap.put("belongNetAssets",MapUtils.getDouble(companyMap, "belongNetAssets")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "belongNetAssets")));
companyMap.put("monetaryFunds",MapUtils.getDouble(companyMap, "monetaryFunds")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "monetaryFunds")));
companyMap.put("landAssets",MapUtils.getDouble(companyMap, "landAssets")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "landAssets")));
companyMap.put("restrictedAssets",MapUtils.getDouble(companyMap, "restrictedAssets")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "restrictedAssets")));
companyMap.put("accountsReceivable",MapUtils.getDouble(companyMap, "accountsReceivable")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "accountsReceivable")));
companyMap.put("otherReceivable",MapUtils.getDouble(companyMap, "otherReceivable")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "otherReceivable")));
companyMap.put("econData_001",MapUtils.getDouble(companyMap, "econData_001")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "econData_001")));
companyMap.put("govSubsidy",MapUtils.getDouble(companyMap, "govSubsidy")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "govSubsidy")));
companyMap.put("specialPayable",MapUtils.getDouble(companyMap, "specialPayable")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "specialPayable")));
companyMap.put("operatingIncome",MapUtils.getDouble(companyMap, "operatingIncome")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "operatingIncome")));
companyMap.put("belongNetProfit",MapUtils.getDouble(companyMap, "belongNetProfit")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "belongNetProfit")));
companyMap.put("roe",MapUtils.getDouble(companyMap, "roe")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "roe")));
companyMap.put("netOperatingCashFlow",MapUtils.getDouble(companyMap, "netOperatingCashFlow")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "netOperatingCashFlow")));
companyMap.put("netFinancingCashFlow",MapUtils.getDouble(companyMap, "netFinancingCashFlow")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "netFinancingCashFlow")));
companyMap.put("netInvestmentCashFlow",MapUtils.getDouble(companyMap, "netInvestmentCashFlow")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "netInvestmentCashFlow")));
companyMap.put("totalLiabilities",MapUtils.getDouble(companyMap, "totalLiabilities")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "totalLiabilities")));
companyMap.put("uipInterestBearingDebt",MapUtils.getDouble(companyMap, "uipInterestBearingDebt")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "uipInterestBearingDebt")));
companyMap.put("econData_002",MapUtils.getDouble(companyMap, "econData_002")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "econData_002")));
companyMap.put("ofcb",MapUtils.getDouble(companyMap, "ofcb")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "ofcb")));
companyMap.put("cashRatio",MapUtils.getDouble(companyMap, "cashRatio")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "cashRatio")));
companyMap.put("cashFlowRatio",MapUtils.getDouble(companyMap, "cashFlowRatio")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "cashFlowRatio")));
companyMap.put("cashDebtRatio",MapUtils.getDouble(companyMap, "cashDebtRatio")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "cashDebtRatio")));
companyMap.put("creditBalance",MapUtils.getDouble(companyMap, "creditBalance")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "creditBalance")));
companyMap.put("econData_003",MapUtils.getDouble(companyMap, "econData_003")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "econData_003")));
companyMap.put("ebitdaIcr",MapUtils.getDouble(companyMap, "ebitdaIcr")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "ebitdaIcr")));
companyMap.put("ppnBalanceProp",MapUtils.getDouble(companyMap, "ppnBalanceProp")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "ppnBalanceProp")));
companyMap.put("econData_004",MapUtils.getDouble(companyMap, "econData_004")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "econData_004")));
companyMap.put("econData_005",MapUtils.getDouble(companyMap, "econData_005")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "econData_005")));
companyMap.put("econData_006",MapUtils.getDouble(companyMap, "econData_006")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "econData_006")));
companyMap.put("nonStandardBalance",MapUtils.getDouble(companyMap, "nonStandardBalance")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "nonStandardBalance")));
companyMap.put("nonStandardRatio",MapUtils.getDouble(companyMap, "nonStandardRatio")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "nonStandardRatio")));
companyMap.put("guaranteeAmount",MapUtils.getDouble(companyMap, "guaranteeAmount")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "guaranteeAmount")));
companyMap.put("guaranteeRatio",MapUtils.getDouble(companyMap, "guaranteeRatio")==null?null:String.format("%.2f", MapUtils.getDouble(companyMap, "guaranteeRatio")));
companyMap.put("bondBalance", MapUtils.getDouble(companyMap, "bondBalance") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "bondBalance")));
companyMap.put("totalAssets", MapUtils.getDouble(companyMap, "totalAssets") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "totalAssets")));
companyMap.put("belongNetAssets", MapUtils.getDouble(companyMap, "belongNetAssets") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "belongNetAssets")));
companyMap.put("monetaryFunds", MapUtils.getDouble(companyMap, "monetaryFunds") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "monetaryFunds")));
companyMap.put("landAssets", MapUtils.getDouble(companyMap, "landAssets") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "landAssets")));
companyMap.put("restrictedAssets", MapUtils.getDouble(companyMap, "restrictedAssets") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "restrictedAssets")));
companyMap.put("accountsReceivable", MapUtils.getDouble(companyMap, "accountsReceivable") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "accountsReceivable")));
companyMap.put("otherReceivable", MapUtils.getDouble(companyMap, "otherReceivable") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "otherReceivable")));
companyMap.put("econData_001", MapUtils.getDouble(companyMap, "econData_001") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "econData_001")));
companyMap.put("govSubsidy", MapUtils.getDouble(companyMap, "govSubsidy") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "govSubsidy")));
companyMap.put("specialPayable", MapUtils.getDouble(companyMap, "specialPayable") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "specialPayable")));
companyMap.put("operatingIncome", MapUtils.getDouble(companyMap, "operatingIncome") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "operatingIncome")));
companyMap.put("belongNetProfit", MapUtils.getDouble(companyMap, "belongNetProfit") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "belongNetProfit")));
companyMap.put("roe", MapUtils.getDouble(companyMap, "roe") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "roe")));
companyMap.put("netOperatingCashFlow", MapUtils.getDouble(companyMap, "netOperatingCashFlow") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "netOperatingCashFlow")));
companyMap.put("netFinancingCashFlow", MapUtils.getDouble(companyMap, "netFinancingCashFlow") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "netFinancingCashFlow")));
companyMap.put("netInvestmentCashFlow", MapUtils.getDouble(companyMap, "netInvestmentCashFlow") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "netInvestmentCashFlow")));
companyMap.put("totalLiabilities", MapUtils.getDouble(companyMap, "totalLiabilities") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "totalLiabilities")));
companyMap.put("uipInterestBearingDebt", MapUtils.getDouble(companyMap, "uipInterestBearingDebt") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "uipInterestBearingDebt")));
companyMap.put("econData_002", MapUtils.getDouble(companyMap, "econData_002") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "econData_002")));
companyMap.put("ofcb", MapUtils.getDouble(companyMap, "ofcb") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "ofcb")));
companyMap.put("cashRatio", MapUtils.getDouble(companyMap, "cashRatio") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "cashRatio")));
companyMap.put("cashFlowRatio", MapUtils.getDouble(companyMap, "cashFlowRatio") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "cashFlowRatio")));
companyMap.put("cashDebtRatio", MapUtils.getDouble(companyMap, "cashDebtRatio") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "cashDebtRatio")));
companyMap.put("creditBalance", MapUtils.getDouble(companyMap, "creditBalance") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "creditBalance")));
companyMap.put("econData_003", MapUtils.getDouble(companyMap, "econData_003") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "econData_003")));
companyMap.put("ebitdaIcr", MapUtils.getDouble(companyMap, "ebitdaIcr") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "ebitdaIcr")));
companyMap.put("ppnBalanceProp", MapUtils.getDouble(companyMap, "ppnBalanceProp") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "ppnBalanceProp")));
companyMap.put("econData_004", MapUtils.getDouble(companyMap, "econData_004") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "econData_004")));
companyMap.put("econData_005", MapUtils.getDouble(companyMap, "econData_005") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "econData_005")));
companyMap.put("econData_006", MapUtils.getDouble(companyMap, "econData_006") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "econData_006")));
companyMap.put("nonStandardBalance", MapUtils.getDouble(companyMap, "nonStandardBalance") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "nonStandardBalance")));
companyMap.put("nonStandardRatio", MapUtils.getDouble(companyMap, "nonStandardRatio") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "nonStandardRatio")));
companyMap.put("guaranteeAmount", MapUtils.getDouble(companyMap, "guaranteeAmount") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "guaranteeAmount")));
companyMap.put("guaranteeRatio", MapUtils.getDouble(companyMap, "guaranteeRatio") == null ? null : String.format("%.2f", MapUtils.getDouble(companyMap, "guaranteeRatio")));
companyMap.put("claimStatus", null);
for (CustomerStatusListVo vo : claimStatusList) {
......@@ -371,6 +371,7 @@ public class EnterpriseService {
Map<String, Object> map = dskOpenApiUtil.requestBody("/operate/enterprise/bondCreditRating", BeanUtil.beanToMap(body, false, false));
return BeanUtil.toBean(map, R.class);
}
public R getUipIdByCid(List<Integer> body) throws Exception {
if (CollectionUtils.isEmpty(body)) return R.ok();
HashMap<String, Object> paramMap = new HashMap<>();
......@@ -396,9 +397,40 @@ public class EnterpriseService {
}
Object data = map.get("data");
if (ObjectUtil.isNotEmpty(data)) {
redisCache.setCacheList(redisKey, (List)data);
redisCache.setCacheList(redisKey, (List) data);
redisCache.expire(redisKey, 24, TimeUnit.HOURS);
}
return BeanUtil.toBean(map, R.class);
}
@Autowired
private BusinessOpportunityRadarService opportunityRadarService;
//企业id、uipId
public Map<String, Object> getCidAndUipIdByCompanyName(String companyName) {
Map<String, Object> result = new HashMap<>();
if (ObjectUtils.isEmpty(companyName)) return result;
try {
Map<String, Object> map = opportunityRadarService.enterpriseByName(companyName);
if (!ObjectUtils.isEmpty(map.get("data"))) {
result.put("companyId", MapUtil.getInt(BeanUtil.beanToMap(map.get("data")), "jskEid"));
}
if (!ObjectUtil.isEmpty(result.get("companyId"))) {
R res = this.getUipIdByCid(new ArrayList<>(MapUtils.getInteger(result, "companyId")));
if (!ObjectUtils.isEmpty(res.getData())) {
List<Map<String, Object>> data = (List<Map<String, Object>>) res.getData();
result.put("uipId", MapUtil.getStr(BeanUtil.beanToMap(data.get((0))), "uipId"));
}
}
if (ObjectUtil.isEmpty(result.get("uipId"))) {
R res = this.getUipId(companyName);
if (!ObjectUtils.isEmpty(res.getData())) {
result.put("uipId", MapUtil.getStr(BeanUtil.beanToMap(res.getData()), "uipId"));
}
}
} catch (Exception e) {
log.debug("获取企业id错误!error:{}", e.getMessage());
}
return result;
}
}
......@@ -100,11 +100,4 @@ public interface IBusinessInfoService
List<CustomerBusinessListVo> selectCustomerBusinessList(CustomerBusinessSearchDto dto);
/**
* 查询企业的城投id和建设库id
* @param companyName
* @return
*/
Map queryUipIdOrCid (String companyName);
}
......@@ -26,6 +26,7 @@ import com.dsk.system.domain.customer.vo.CustomerVo;
import com.dsk.system.domain.business.vo.BusinessBrowseVo;
import com.dsk.system.domain.business.vo.BusinessLabelVo;
import com.dsk.system.domain.business.vo.BusinessListVo;
import com.dsk.system.dskService.EnterpriseService;
import com.dsk.system.mapper.BusinessInfoMapper;
import com.dsk.system.mapper.BusinessLabelMapper;
import com.dsk.system.mapper.BusinessRelateCompanyMapper;
......@@ -66,6 +67,8 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService {
private DskOpenApiUtil dskOpenApiUtil;
@Autowired
private ICustomerService customerService;
@Autowired
private EnterpriseService enterpriseService;
/**
......@@ -98,8 +101,8 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService {
List<BusinessListVo> businessListVos = businessInfoMapper.selectBusinessInfoList(dto);
if (!CollectionUtils.isEmpty(businessListVos) && ObjectUtil.isNotEmpty(dto.getProjectName())) {
for (BusinessListVo vo : businessListVos) {
vo.setProjectName(StringUtils.markInRed(vo.getProjectName(),dto.getProjectName()));
vo.setOwnerCompany(StringUtils.markInRed(vo.getOwnerCompany(),dto.getProjectName()));
vo.setProjectName(StringUtils.markInRed(vo.getProjectName(), dto.getProjectName()));
vo.setOwnerCompany(StringUtils.markInRed(vo.getOwnerCompany(), dto.getProjectName()));
}
}
return businessListVos;
......@@ -144,7 +147,7 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService {
if (!CollectionUtils.isEmpty(list)) {
for (Map<String, Object> map : list) {
BusinessLikeProjectNameListVo vo = new BusinessLikeProjectNameListVo();
vo.setProjectName(StringUtils.markInRed(MapUtil.getStr(map, "projectName"),dto.getProjectName()));
vo.setProjectName(StringUtils.markInRed(MapUtil.getStr(map, "projectName"), dto.getProjectName()));
vo.setCompanyName(MapUtil.getStr(map, "tenderee"));
vo.setInvestmentAmount(Double.parseDouble(MapUtil.getStr(map, "projectContractAmount")));
vo.setProjectType(MapUtil.getStr(map, "projectType"));
......@@ -288,17 +291,12 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService {
if (!CheckUtils.isPhone(businessInfo.getConstructionPhone()) || !CheckUtils.isPhone(businessInfo.getSupervisorPhone()))
throw new BaseException("500", "请输入正确的电话号码");
}
// BusinessInfo info = businessInfoMapper.selectBusinessInfoById(businessInfo.getId());
//查询企业的城投id和建设库id
BusinessRelateCompany relateCompany = relateCompanyMapper.selectByProprietor(businessInfo.getId());
if (ObjectUtil.isNotEmpty(businessInfo.getConstructionUnit())) {
Map map = queryUipIdOrCid(businessInfo.getConstructionUnit());
if (map.containsKey("jskEid")) {
businessInfo.setConstructionUnitCid(MapUtils.getInteger(map, "jskEid", null));
} else {
businessInfo.setConstructionUnitUipId(MapUtils.getString(map, "uipId", null));
businessInfo.setConstructionUnitCid(MapUtils.getInteger(map, "companyId", null));
}
Map<String, Object> map = enterpriseService.getCidAndUipIdByCompanyName(businessInfo.getConstructionUnit());
businessInfo.setConstructionUnitUipId(MapUtils.getString(map, "uipId"));
businessInfo.setConstructionUnitCid(MapUtils.getInteger(map, "companyId"));
//相关企业
if (ObjectUtil.isEmpty(relateCompany)) {
relateCompanyMapper.insertBusinessRelateCompany(dealwithCustomer(businessInfo));
......@@ -309,16 +307,6 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService {
relateCompany.setCompanyName(businessInfo.getConstructionUnit());
relateCompanyMapper.updateBusinessRelateCompany(relateCompany);
}
// //客户信息
// if(ObjectUtil.isNotEmpty(info.getCustomerId())){
// CustomerVo customerVo = customerService.info(info.getCustomerId());
// customerVo
// customerService.edit(customerVo);
// }else {
// Customer customer = new Customer();
// customer.setCompanyName()
// customerService.add()
// }
}
if (ObjectUtil.isNotEmpty(relateCompany) &&
......@@ -382,43 +370,6 @@ public class BusinessInfoServiceImpl implements IBusinessInfoService {
return businessInfoMapper.selectCustomerBusinessList(dto);
}
@Override
public Map queryUipIdOrCid(String companyName) {
Map<Object, Object> map = MapUtil.builder().build();
if (StringUtils.isEmpty(companyName)) return map;
//查询城投企业
Map<String, Object> paramMap = MapUtil.<String, Object>builder().put("companyName", companyName).build();
Map<String, Object> resultMap = dskOpenApiUtil.requestBody("/urbanInvestment/detailsByCompanyName", paramMap);
Integer code = MapUtils.getInteger(resultMap, "code", 300);
if (code == HttpStatus.SUCCESS) {
Map data = MapUtils.getMap(resultMap, "data", null);
if (data != null) {
map.put("uipId", MapUtils.getString(data, "uipId", null));
map.put("companyId", MapUtils.getInteger(data, "companyId", null));
}
}
if (MapUtil.isEmpty(map)) {
//查村建设库企业
Map<String, Object> jskParamMap = MapUtil.<String, Object>builder()
.put("keyword", companyName)
.put("page", MapUtil.<String, Object>builder().put("page", 1).put("limit", 10).build())
.build();
Map<String, Object> jskResultMap = dskOpenApiUtil.requestBody("/enterprise/index", jskParamMap);
if (MapUtils.getInteger(resultMap, "code", 300).equals(HttpStatus.SUCCESS)) {
Map data = MapUtils.getMap(jskResultMap, "data", null);
if (data != null) {
List<Object> list = CommonUtils.assertAsArray(MapUtils.getObject(data, "list", ""));
if (CollectionUtil.isNotEmpty(list)) {
for (Object obj : list) {
map.put("jskEid", MapUtils.getInteger(BeanUtil.beanToMap(obj, false, false), "jskEid", null));
}
}
}
}
}
return map;
}
private BusinessRelateCompany dealwithCustomer(BusinessInfo bean) {
BusinessRelateCompany relateCompany = new BusinessRelateCompany();
relateCompany.setBusinessId(bean.getId());
......
......@@ -7,10 +7,12 @@ import com.dsk.common.exception.base.BaseException;
import com.dsk.common.utils.CheckUtils;
import com.dsk.common.utils.DateUtils;
import com.dsk.system.domain.business.dto.BusinessIdDto;
import com.dsk.system.dskService.EnterpriseService;
import com.dsk.system.mapper.BusinessRelateCompanyMapper;
import com.dsk.system.service.IBusinessInfoService;
import com.dsk.system.service.IBusinessRelateCompanyService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -32,6 +34,8 @@ public class BusinessRelateCompanyServiceImpl implements IBusinessRelateCompanyS
private BusinessRelateCompanyMapper businessRelateCompanyMapper;
@Resource
private IBusinessInfoService businessInfoService;
@Autowired
private EnterpriseService enterpriseService;
/**
* 查询项目关联单位
......@@ -70,13 +74,9 @@ public class BusinessRelateCompanyServiceImpl implements IBusinessRelateCompanyS
// if(!CheckUtils.isPhone(businessRelateCompany.getPhone())) throw new BaseException("500","请输入正确的电话号码");
businessRelateCompany.setCreateTime(DateUtils.getNowDate());
//查询企业的城投id和建设库id
Map map = businessInfoService.queryUipIdOrCid(businessRelateCompany.getCompanyName());
if(map.containsKey("jskEid")){
businessRelateCompany.setCompanyId(MapUtils.getInteger(map,"jskEid",null));
}else {
Map<String, Object> map = enterpriseService.getCidAndUipIdByCompanyName(businessRelateCompany.getCompanyName());
businessRelateCompany.setCompanyUipId(MapUtils.getString(map,"uipId",null));
businessRelateCompany.setCompanyId(MapUtils.getInteger(map,"companyId",null));
}
return businessRelateCompanyMapper.insertBusinessRelateCompany(businessRelateCompany);
}
......@@ -95,13 +95,9 @@ public class BusinessRelateCompanyServiceImpl implements IBusinessRelateCompanyS
}
businessRelateCompany.setUpdateTime(DateUtils.getNowDate());
//查询企业的城投id和建设库id
Map map = businessInfoService.queryUipIdOrCid(businessRelateCompany.getCompanyName());
if(map.containsKey("jskEid")){
businessRelateCompany.setCompanyId(MapUtils.getInteger(map,"jskEid",null));
}else {
Map<String, Object> map = enterpriseService.getCidAndUipIdByCompanyName(businessRelateCompany.getCompanyName());
businessRelateCompany.setCompanyUipId(MapUtils.getString(map,"uipId",null));
businessRelateCompany.setCompanyId(MapUtils.getInteger(map,"companyId",null));
}
return businessRelateCompanyMapper.updateBusinessRelateCompany(businessRelateCompany);
}
......
......@@ -6,14 +6,20 @@ import com.dsk.common.utils.SecurityUtils;
import com.dsk.system.domain.customer.ContactInfo;
import com.dsk.system.domain.customer.dto.ContactInfoSearchDto;
import com.dsk.system.domain.customer.vo.ContactInfoListVo;
import com.dsk.system.domain.customer.vo.CustomerVo;
import com.dsk.system.dskService.EnterpriseService;
import com.dsk.system.mapper.ContactInfoMapper;
import com.dsk.system.service.IContactInfoService;
import com.dsk.system.service.ICustomerService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* 用户联系人(CustomerContact)表服务实现类
......@@ -28,6 +34,12 @@ public class ContactInfoServiceImpl implements IContactInfoService {
@Resource
private ContactInfoMapper baseMapper;
@Autowired
private EnterpriseService enterpriseService;
@Resource
private ICustomerService customerService;
@Override
public List<ContactInfoListVo> selectList(ContactInfoSearchDto dto) {
return baseMapper.selectPageList(dto);
......@@ -41,6 +53,7 @@ public class ContactInfoServiceImpl implements IContactInfoService {
@Override
public boolean insert(ContactInfo bean) {
verifyParameter(bean);
bean.setCreateBy(bean.getUpdateBy());
return baseMapper.insert(bean) > 0;
}
......@@ -60,9 +73,18 @@ public class ContactInfoServiceImpl implements IContactInfoService {
* 参数验证
*/
private void verifyParameter(ContactInfo bean) {
// if (ObjectUtils.isEmpty(bean.getCustomerId())) throw new BeanException("客户id不能为空!");
if (!ObjectUtils.isEmpty(bean.getCompanyName()) && !ObjectUtils.isEmpty(bean.getProjectId())) {
Map<String, Object> map = enterpriseService.getCidAndUipIdByCompanyName(bean.getCompanyName());
bean.setCompanyId(MapUtils.getInteger(map, "companyId"));
bean.setUipId(MapUtils.getString(map, "uipId"));
}
if (!ObjectUtils.isEmpty(bean.getCustomerId()) && ObjectUtils.isEmpty(bean.getId())) {
CustomerVo info = customerService.info(bean.getCustomerId());
bean.setCompanyName(info.getCompanyName());
bean.setCompanyId(info.getCompanyId());
bean.setUipId(info.getUipId());
}
LoginUser loginUser = SecurityUtils.getLoginUser();
bean.setCreateBy(loginUser.getUser().getNickName());
bean.setUpdateId(loginUser.getUserId());
bean.setUpdateBy(loginUser.getUser().getNickName());
}
......
......@@ -10,8 +10,8 @@
from contact_info cc
left join business_info bi on cc.project_id = bi.id
<where>
<if test="cc.customerId != null and cc.customerId !='' "> and (cc.customer_id = #{customerId} or cc.company_name =#{companyName})</if>
<if test="cc.projectId != null "> and cc.project_id = #{projectId} </if>
<if test="customerId != null and customerId !='' "> and (cc.customer_id = #{customerId} or bi.customer_id = #{customerId})</if>
<if test="projectId != null "> and cc.project_id = #{projectId} </if>
</where>
order by cc.create_time desc
</select>
......
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