@ -10,9 +10,11 @@ import java.time.Instant;
import java.time.LocalDateTime ;
import java.time.LocalDateTime ;
import java.time.ZoneId ;
import java.time.ZoneId ;
import java.time.temporal.ChronoUnit ;
import java.time.temporal.ChronoUnit ;
import java.util.ArrayList ;
import java.util.HashMap ;
import java.util.HashMap ;
import java.util.List ;
import java.util.List ;
import java.util.Map ;
import java.util.Map ;
import java.util.stream.Collectors ;
import cn.hutool.core.convert.Convert ;
import cn.hutool.core.convert.Convert ;
import cn.hutool.core.util.IdUtil ;
import cn.hutool.core.util.IdUtil ;
@ -20,25 +22,23 @@ import com.alibaba.fastjson.JSON;
import com.zdxt.auth.dto.UserBean ;
import com.zdxt.auth.dto.UserBean ;
import com.zdxt.auth.feign.FileUploadApi ;
import com.zdxt.auth.feign.FileUploadApi ;
import com.zdxt.auth.feign.UserApi ;
import com.zdxt.auth.feign.UserApi ;
import com.zdxt.code.domain.EnterpriseMerchantAuthorization ;
import com.zdxt.auth.project.system.dict.mapper.DictDataMapper ;
import com.zdxt.code.domain.QrCodeGenerateHistory ;
import com.zdxt.code.domain.* ;
import com.zdxt.code.service.IEnterpriseMerchantAuthorizationService ;
import com.zdxt.code.service.IEnterpriseMerchantAuthorizationService ;
import com.zdxt.code.service.IQrCodeGenerateHistoryService ;
import com.zdxt.code.service.IQrCodeGenerateHistoryService ;
import com.zdxt.code.service.ISsztJbxx110497Service ;
import com.zdxt.code.service.ISsztJbxx110497Service ;
import com.zdxt.code.utils.CrawlerUtil ;
import com.zdxt.code.utils.CrawlerUtil ;
import com.zdxt.code.utils.HttpUtil ;
import com.zdxt.code.utils.PasswordTools ;
import com.zdxt.code.utils.PasswordTools ;
import com.zdxt.code.utils.QRCodeUtil ;
import com.zdxt.code.utils.QRCodeUtil ;
import com.zdxt.common.util.DateUtils ;
import com.zdxt.common.util.DateUtils ;
import com.zdxt.common.util.StringUtils ;
import com.zdxt.common.util.StringUtils ;
import lombok.extern.slf4j.Slf4j ;
import com.zdxt.domain.auth.DictData ;
import org.slf4j.Logger ;
import org.slf4j.Logger ;
import org.slf4j.LoggerFactory ;
import org.slf4j.LoggerFactory ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.beans.factory.annotation.Value ;
import org.springframework.beans.factory.annotation.Value ;
import org.springframework.stereotype.Service ;
import org.springframework.stereotype.Service ;
import com.zdxt.code.mapper.EnterpriseInformationMapper ;
import com.zdxt.code.mapper.EnterpriseInformationMapper ;
import com.zdxt.code.domain.EnterpriseInformation ;
import com.zdxt.code.service.IEnterpriseInformationService ;
import com.zdxt.code.service.IEnterpriseInformationService ;
import org.springframework.web.multipart.MultipartFile ;
import org.springframework.web.multipart.MultipartFile ;
@ -78,6 +78,9 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS
@Autowired
@Autowired
private ISsztJbxx110497Service ssztJbxx110497Service ;
private ISsztJbxx110497Service ssztJbxx110497Service ;
@Autowired
private DictDataMapper dictDataMapper ;
/ * *
/ * *
* 查询企业信息登记
* 查询企业信息登记
*
*
@ -85,17 +88,16 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS
* @return 企业信息登记
* @return 企业信息登记
* /
* /
@Override
@Override
public EnterpriseInformation selectEnterpriseInformationById ( String id )
public EnterpriseInformation selectEnterpriseInformationById ( String id ) {
{
EnterpriseInformation enterpriseInformation = enterpriseInformationMapper . selectEnterpriseInformationById ( id ) ;
EnterpriseInformation enterpriseInformation = enterpriseInformationMapper . selectEnterpriseInformationById ( id ) ;
QrCodeGenerateHistory qrCodeGenerateHistory =
QrCodeGenerateHistory qrCodeGenerateHistory =
iQrCodeGenerateHistoryService . selectQrCodeGenerateHistoryByNewest ( enterpriseInformation . getEnterpriseNumber ( ) ) ;
iQrCodeGenerateHistoryService . selectQrCodeGenerateHistoryByNewest ( enterpriseInformation . getEnterpriseNumber ( ) ) ;
enterpriseInformation . setQrCodeGenerateHistory ( qrCodeGenerateHistory ) ;
enterpriseInformation . setQrCodeGenerateHistory ( qrCodeGenerateHistory ) ;
return enterpriseInformation ;
return enterpriseInformation ;
}
}
@Override
@Override
public EnterpriseInformation selectEnterpriseInformationByNum ( String num )
public EnterpriseInformation selectEnterpriseInformationByNum ( String num ) {
{
EnterpriseInformation enterpriseInformation = enterpriseInformationMapper . selectEnterpriseInformationByNum ( num ) ;
EnterpriseInformation enterpriseInformation = enterpriseInformationMapper . selectEnterpriseInformationByNum ( num ) ;
QrCodeGenerateHistory qrCodeGenerateHistory =
QrCodeGenerateHistory qrCodeGenerateHistory =
iQrCodeGenerateHistoryService . selectQrCodeGenerateHistoryByNewest ( enterpriseInformation . getEnterpriseNumber ( ) ) ;
iQrCodeGenerateHistoryService . selectQrCodeGenerateHistoryByNewest ( enterpriseInformation . getEnterpriseNumber ( ) ) ;
@ -115,8 +117,7 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS
* @return 企业信息登记
* @return 企业信息登记
* /
* /
@Override
@Override
public List < EnterpriseInformation > selectEnterpriseInformationList ( EnterpriseInformation enterpriseInformation )
public List < EnterpriseInformation > selectEnterpriseInformationList ( EnterpriseInformation enterpriseInformation ) {
{
// if ("3".equals(enterpriseInformation.getReason())) {
// if ("3".equals(enterpriseInformation.getReason())) {
// Map<String, Object> tmp = new HashMap<>();
// Map<String, Object> tmp = new HashMap<>();
// tmp.put("reason", 3);
// tmp.put("reason", 3);
@ -124,9 +125,9 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS
// }
// }
return enterpriseInformationMapper . selectEnterpriseInformationList ( enterpriseInformation ) ;
return enterpriseInformationMapper . selectEnterpriseInformationList ( enterpriseInformation ) ;
}
}
@Override
@Override
public List < EnterpriseInformation > selectEnterpriseInformationList1 ( EnterpriseInformation enterpriseInformation )
public List < EnterpriseInformation > selectEnterpriseInformationList1 ( EnterpriseInformation enterpriseInformation ) {
{
// if ("3".equals(enterpriseInformation.getReason())) {
// if ("3".equals(enterpriseInformation.getReason())) {
// Map<String, Object> tmp = new HashMap<>();
// Map<String, Object> tmp = new HashMap<>();
// tmp.put("reason", 3);
// tmp.put("reason", 3);
@ -134,6 +135,7 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS
// }
// }
return enterpriseInformationMapper . selectEnterpriseInformationList1 ( enterpriseInformation ) ;
return enterpriseInformationMapper . selectEnterpriseInformationList1 ( enterpriseInformation ) ;
}
}
@Override
@Override
public List < EnterpriseInformation > selectEnterpriseInformationAndQrInfo ( EnterpriseInformation enterpriseInformation ) {
public List < EnterpriseInformation > selectEnterpriseInformationAndQrInfo ( EnterpriseInformation enterpriseInformation ) {
return enterpriseInformationMapper . selectEnterpriseInformationAndQrInfo ( enterpriseInformation ) ;
return enterpriseInformationMapper . selectEnterpriseInformationAndQrInfo ( enterpriseInformation ) ;
@ -146,8 +148,7 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS
* @return 结果
* @return 结果
* /
* /
@Override
@Override
public int insertEnterpriseInformation ( EnterpriseInformation enterpriseInformation )
public int insertEnterpriseInformation ( EnterpriseInformation enterpriseInformation ) {
{
enterpriseInformation . setCreateTime ( DateUtils . getNowDate ( ) ) ;
enterpriseInformation . setCreateTime ( DateUtils . getNowDate ( ) ) ;
enterpriseInformation . setId ( IdUtil . simpleUUID ( ) ) ;
enterpriseInformation . setId ( IdUtil . simpleUUID ( ) ) ;
// UserBean user = userApi.getCurrentUser();
// UserBean user = userApi.getCurrentUser();
@ -223,8 +224,7 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS
* @return 结果
* @return 结果
* /
* /
@Override
@Override
public int updateEnterpriseInformation ( EnterpriseInformation enterpriseInformation )
public int updateEnterpriseInformation ( EnterpriseInformation enterpriseInformation ) {
{
enterpriseInformation . setUpdateTime ( DateUtils . getNowDate ( ) ) ;
enterpriseInformation . setUpdateTime ( DateUtils . getNowDate ( ) ) ;
int i = enterpriseInformationMapper . updateEnterpriseInformation ( enterpriseInformation ) ;
int i = enterpriseInformationMapper . updateEnterpriseInformation ( enterpriseInformation ) ;
if ( i > 0 ) {
if ( i > 0 ) {
@ -252,8 +252,7 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS
* @return 结果
* @return 结果
* /
* /
@Override
@Override
public int deleteEnterpriseInformationByIds ( String ids )
public int deleteEnterpriseInformationByIds ( String ids ) {
{
return enterpriseInformationMapper . deleteEnterpriseInformationByIds ( Convert . toStrArray ( ids ) ) ;
return enterpriseInformationMapper . deleteEnterpriseInformationByIds ( Convert . toStrArray ( ids ) ) ;
}
}
@ -321,8 +320,7 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS
* @return 结果
* @return 结果
* /
* /
@Override
@Override
public int deleteEnterpriseInformationById ( String id )
public int deleteEnterpriseInformationById ( String id ) {
{
return enterpriseInformationMapper . deleteEnterpriseInformationById ( id ) ;
return enterpriseInformationMapper . deleteEnterpriseInformationById ( id ) ;
}
}
@ -353,6 +351,7 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS
//关闭输出流,释放资源
//关闭输出流,释放资源
outStream . close ( ) ;
outStream . close ( ) ;
}
}
public static byte [ ] readInputStream ( InputStream inStream ) throws Exception {
public static byte [ ] readInputStream ( InputStream inStream ) throws Exception {
ByteArrayOutputStream outStream = new ByteArrayOutputStream ( ) ;
ByteArrayOutputStream outStream = new ByteArrayOutputStream ( ) ;
//创建一个Buffer字符串
//创建一个Buffer字符串
@ -435,5 +434,89 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS
}
}
return null ;
return null ;
}
}
@Override
public List < StatisticsIndicator > enterpriseInformationAllListToQY ( SearchType searchType ) {
List < StatisticsIndicator > statisticsIndicatorList = new ArrayList < > ( ) ;
EnterpriseInformation enterpriseInformation = new EnterpriseInformation ( ) ;
List < String > qyNameList = new ArrayList < > ( ) ;
if ( searchType . getQy ( ) ! = null & & ! "" . equals ( searchType . getQy ( ) ) ) {
String qyName = dictDataMapper . selectDictLabel ( "address_type" , searchType . getQy ( ) ) ;
if ( searchType . getJd ( ) ! = null & & ! "" . equals ( searchType . getJd ( ) ) ) {
String jdName = dictDataMapper . selectDictLabel ( searchType . getQy ( ) , searchType . getJd ( ) ) ;
enterpriseInformation . setJd ( jdName ) ;
}
enterpriseInformation . setQy ( qyName ) ;
qyNameList . add ( qyName ) ;
} else {
List < DictData > dictDataListQY = dictDataMapper . selectDictDataByType ( "address_type" ) ;
for ( DictData dictData : dictDataListQY ) {
qyNameList . add ( dictData . getDictLabel ( ) ) ;
}
}
List < EnterpriseInformation > enterpriseInformationList = enterpriseInformationMapper . selectEnterpriseInformationList1 ( enterpriseInformation ) ;
for ( String qy : qyNameList ) {
StatisticsIndicator s = new StatisticsIndicator ( ) ;
System . out . println ( qy . substring ( 0 , qy . indexOf ( "区" ) ) ) ;
List < EnterpriseInformation > qyList = enterpriseInformationList . stream ( ) . filter ( item - > item . getEnterpriseAddress ( ) . startsWith ( "深圳市" + qy . substring ( 0 , qy . indexOf ( "区" ) ) + "区" ) | | item . getEnterpriseAddress ( ) . startsWith ( "深圳市" + qy . substring ( 0 , qy . indexOf ( "区" ) ) + "新区" ) ) . collect ( Collectors . toList ( ) ) ;
List < EnterpriseInformation > existList = qyList . stream ( ) . filter ( item - > item . getIsDelete ( ) = = 0 ) . collect ( Collectors . toList ( ) ) ;
List < EnterpriseInformation > logoutList = qyList . stream ( ) . filter ( item - > item . getIsDelete ( ) = = 1 ) . collect ( Collectors . toList ( ) ) ;
s . setName ( qy ) ;
s . setTotalNumber ( qyList . size ( ) ) ;
s . setNumInt ( existList . size ( ) ) ;
s . setValue ( logoutList . size ( ) ) ;
statisticsIndicatorList . add ( s ) ;
enterpriseInformationList = enterpriseInformationList . stream ( ) . filter ( item - > ! item . getEnterpriseAddress ( ) . startsWith ( "深圳市" + qy . substring ( 0 , qy . indexOf ( "区" ) ) + "区" ) & & ! item . getEnterpriseAddress ( ) . startsWith ( "深圳市" + qy . substring ( 0 , qy . indexOf ( "区" ) ) + "新区" ) ) . collect ( Collectors . toList ( ) ) ;
}
if ( enterpriseInformationList . size ( ) > 0 ) {
List < EnterpriseInformation > existList = enterpriseInformationList . stream ( ) . filter ( item - > item . getIsDelete ( ) = = 0 ) . collect ( Collectors . toList ( ) ) ;
List < EnterpriseInformation > logoutList = enterpriseInformationList . stream ( ) . filter ( item - > item . getIsDelete ( ) = = 1 ) . collect ( Collectors . toList ( ) ) ;
StatisticsIndicator s = new StatisticsIndicator ( ) ;
s . setName ( "其他" ) ;
s . setTotalNumber ( enterpriseInformationList . size ( ) ) ;
s . setNumInt ( existList . size ( ) ) ;
s . setValue ( logoutList . size ( ) ) ;
statisticsIndicatorList . add ( s ) ;
}
return statisticsIndicatorList ;
}
@Override
public List < StatisticsIndicator > enterpriseInformationAllListToJD ( SearchType searchType ) {
List < StatisticsIndicator > statisticsIndicatorList = new ArrayList < > ( ) ;
EnterpriseInformation enterpriseInformation = new EnterpriseInformation ( ) ;
enterpriseInformation . setQy ( searchType . getName ( ) ) ;
List < EnterpriseInformation > enterpriseInformationList = enterpriseInformationMapper . selectEnterpriseInformationList1 ( enterpriseInformation ) ;
String qyName = searchType . getName ( ) ;
DictData dictData = new DictData ( ) ;
dictData . setDictType ( "address_type" ) ;
dictData . setDictLabel ( qyName ) ;
DictData dictDataQY = dictDataMapper . selectDictData ( dictData ) ;
List < DictData > dictDataListJD = dictDataMapper . selectDictDataByType ( dictDataQY . getDictValue ( ) ) ;
for ( DictData d : dictDataListJD ) {
String jdName = d . getDictLabel ( ) ;
StatisticsIndicator s = new StatisticsIndicator ( ) ;
List < EnterpriseInformation > jdList = enterpriseInformationList . stream ( ) . filter ( item - > item . getEnterpriseAddress ( ) . startsWith ( "深圳市" + qyName . substring ( 0 , qyName . indexOf ( "区" ) ) + "区" + jdName ) | | item . getEnterpriseAddress ( ) . startsWith ( "深圳市" + qyName . substring ( 0 , qyName . indexOf ( "区" ) ) + "新区" + jdName ) ) . collect ( Collectors . toList ( ) ) ;
List < EnterpriseInformation > existList = jdList . stream ( ) . filter ( item - > item . getIsDelete ( ) = = 0 ) . collect ( Collectors . toList ( ) ) ;
List < EnterpriseInformation > logoutList = jdList . stream ( ) . filter ( item - > item . getIsDelete ( ) = = 1 ) . collect ( Collectors . toList ( ) ) ;
s . setName ( jdName ) ;
s . setAddress ( qyName ) ;
s . setTotalNumber ( jdList . size ( ) ) ;
s . setNumInt ( existList . size ( ) ) ;
s . setValue ( logoutList . size ( ) ) ;
statisticsIndicatorList . add ( s ) ;
enterpriseInformationList = enterpriseInformationList . stream ( ) . filter ( item - > ! item . getEnterpriseAddress ( ) . startsWith ( "深圳市" + qyName . substring ( 0 , qyName . indexOf ( "区" ) ) + "区" + jdName ) & & ! item . getEnterpriseAddress ( ) . startsWith ( "深圳市" + qyName . substring ( 0 , qyName . indexOf ( "区" ) ) + "新区" + jdName ) ) . collect ( Collectors . toList ( ) ) ;
}
if ( enterpriseInformationList . size ( ) > 0 ) {
StatisticsIndicator s = new StatisticsIndicator ( ) ;
List < EnterpriseInformation > existList = enterpriseInformationList . stream ( ) . filter ( item - > item . getIsDelete ( ) = = 0 ) . collect ( Collectors . toList ( ) ) ;
List < EnterpriseInformation > logoutList = enterpriseInformationList . stream ( ) . filter ( item - > item . getIsDelete ( ) = = 1 ) . collect ( Collectors . toList ( ) ) ;
s . setAddress ( qyName ) ;
s . setTotalNumber ( enterpriseInformationList . size ( ) ) ;
s . setNumInt ( existList . size ( ) ) ;
s . setValue ( logoutList . size ( ) ) ;
statisticsIndicatorList . add ( s ) ;
}
return statisticsIndicatorList ;
}
}
}