@ -1,17 +1,26 @@
package com.zdxt.code.service.impl ;
package com.zdxt.code.service.impl ;
import com.zdxt.auth.project.system.dept.service.IDeptService ;
import com.zdxt.code.domain.ComplaintStatistics ;
import com.zdxt.code.domain.ComplaintStatistics ;
import com.zdxt.code.domain.EnterpriseComplaint ;
import com.zdxt.code.mapper.ComplaintStatisticsMapper ;
import com.zdxt.code.mapper.ComplaintStatisticsMapper ;
import com.zdxt.code.service.ComplaintStatisticsService ;
import com.zdxt.code.service.ComplaintStatisticsService ;
import com.zdxt.domain.auth.Dept ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.stereotype.Service ;
import org.springframework.stereotype.Service ;
import javax.xml.crypto.Data ;
import java.text.SimpleDateFormat ;
import java.time.format.DateTimeFormatter ;
import java.util.Arrays ;
import java.util.List ;
import java.util.List ;
@Service
@Service
public class ComplaintStatisticsImpl implements ComplaintStatisticsService {
public class ComplaintStatisticsImpl implements ComplaintStatisticsService {
@Autowired
@Autowired
private ComplaintStatisticsMapper complaintStatisticsMapper ;
private ComplaintStatisticsMapper complaintStatisticsMapper ;
@Autowired
private IDeptService iDeptService ;
@Override
@Override
public List < ComplaintStatistics > selectComplaintStatisticsList ( ComplaintStatistics complaintStatistics ) {
public List < ComplaintStatistics > selectComplaintStatisticsList ( ComplaintStatistics complaintStatistics ) {
return complaintStatisticsMapper . selectComplaintStatisticsList ( complaintStatistics ) ;
return complaintStatisticsMapper . selectComplaintStatisticsList ( complaintStatistics ) ;
@ -25,4 +34,122 @@ public class ComplaintStatisticsImpl implements ComplaintStatisticsService {
public List < ComplaintStatistics > selectComplaintStatisticsGroupByType ( ComplaintStatistics complaintStatistics ) {
public List < ComplaintStatistics > selectComplaintStatisticsGroupByType ( ComplaintStatistics complaintStatistics ) {
return complaintStatisticsMapper . selectComplaintStatisticsGroupByType ( complaintStatistics ) ;
return complaintStatisticsMapper . selectComplaintStatisticsGroupByType ( complaintStatistics ) ;
}
}
@Override
public void insertComplaintStatistics ( EnterpriseComplaint enterpriseComplaint ) {
SimpleDateFormat str = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss" ) ;
/ * if ( enterpriseComplaint . getComplaintDepartmentIds ( ) ! = null & & ! "" . equals ( enterpriseComplaint . getComplaintDepartmentIds ( ) ) ) {
List < String > departmentIdList = Arrays . asList ( enterpriseComplaint . getComplaintDepartmentIds ( ) . split ( "," ) ) ;
if ( ! departmentIdList . isEmpty ( ) ) {
for ( String s : departmentIdList ) {
ComplaintStatistics complaintStatistics = new ComplaintStatistics ( ) ;
complaintStatistics . setCid ( enterpriseComplaint . getId ( ) ) ;
if ( enterpriseComplaint . getRelId ( ) ! = null & & ! "" . equals ( enterpriseComplaint . getRelId ( ) ) ) {
complaintStatistics . setRid ( enterpriseComplaint . getRelId ( ) ) ;
}
complaintStatistics . setComplaintTime ( str . format ( enterpriseComplaint . getCreateTime ( ) ) ) ; //同步投诉创建时间
if ( enterpriseComplaint . getComplaintType ( ) ! = null ) {
complaintStatistics . setComplaintType ( enterpriseComplaint . getComplaintType ( ) ) ;
}
if ( enterpriseComplaint . getEnterpriseName ( ) ! = null & & ! "" . equals ( enterpriseComplaint . getEnterpriseName ( ) ) ) {
complaintStatistics . setEnterpriseName ( enterpriseComplaint . getEnterpriseName ( ) ) ;
}
if ( enterpriseComplaint . getEnterpriseNumber ( ) ! = null & & ! "" . equals ( enterpriseComplaint . getEnterpriseNumber ( ) ) ) {
complaintStatistics . setEnterpriseNumber ( enterpriseComplaint . getEnterpriseNumber ( ) ) ;
}
complaintStatistics . setComplaintDepartmentId ( s ) ;
String sName = iDeptService . selectDeptById ( s ) . getDeptName ( ) ;
if ( sName ! = null & & ! "" . equals ( sName ) ) {
complaintStatistics . setComplaintDepartment ( sName ) ;
}
complaintStatisticsMapper . insertComplaintStatistics ( complaintStatistics ) ;
}
}
} * /
if ( enterpriseComplaint . getRelId ( ) = = null | | "" . equals ( enterpriseComplaint . getRelId ( ) ) ) { //入企不扫码
List < String > departmentIdList = Arrays . asList ( enterpriseComplaint . getComplaintItemCodes ( ) . split ( "," ) ) ;
if ( ! departmentIdList . isEmpty ( ) ) {
for ( String s : departmentIdList ) {
ComplaintStatistics complaintStatistics = new ComplaintStatistics ( ) ;
complaintStatistics . setCid ( enterpriseComplaint . getId ( ) ) ;
if ( enterpriseComplaint . getRelId ( ) ! = null & & ! "" . equals ( enterpriseComplaint . getRelId ( ) ) ) {
complaintStatistics . setRid ( enterpriseComplaint . getRelId ( ) ) ;
}
complaintStatistics . setComplaintTime ( str . format ( enterpriseComplaint . getCreateTime ( ) ) ) ; //同步投诉创建时间
if ( enterpriseComplaint . getComplaintType ( ) ! = null ) {
complaintStatistics . setComplaintType ( enterpriseComplaint . getComplaintType ( ) ) ;
}
if ( enterpriseComplaint . getEnforceType ( ) ! = null ) {
complaintStatistics . setEnforceType ( enterpriseComplaint . getEnforceType ( ) ) ;
}
if ( enterpriseComplaint . getEnterpriseName ( ) ! = null & & ! "" . equals ( enterpriseComplaint . getEnterpriseName ( ) ) ) {
complaintStatistics . setEnterpriseName ( enterpriseComplaint . getEnterpriseName ( ) ) ;
}
if ( enterpriseComplaint . getEnterpriseNumber ( ) ! = null & & ! "" . equals ( enterpriseComplaint . getEnterpriseNumber ( ) ) ) {
complaintStatistics . setEnterpriseNumber ( enterpriseComplaint . getEnterpriseNumber ( ) ) ;
}
if ( enterpriseComplaint . getProblemDescription ( ) ! = null & & ! "" . equals ( enterpriseComplaint . getProblemDescription ( ) ) ) {
complaintStatistics . setProblemDescription ( enterpriseComplaint . getProblemDescription ( ) ) ;
}
if ( enterpriseComplaint . getLinkman ( ) ! = null & & ! "" . equals ( enterpriseComplaint . getLinkman ( ) ) ) {
complaintStatistics . setLinkman ( enterpriseComplaint . getLinkman ( ) ) ;
}
if ( enterpriseComplaint . getLinkmanTel ( ) ! = null & & ! "" . equals ( enterpriseComplaint . getLinkmanTel ( ) ) ) {
complaintStatistics . setLinkmanTel ( enterpriseComplaint . getLinkmanTel ( ) ) ;
}
if ( enterpriseComplaint . getEnterpriseAddress ( ) ! = null & & ! "" . equals ( enterpriseComplaint . getEnterpriseAddress ( ) ) ) {
complaintStatistics . setEnterpriseAddress ( enterpriseComplaint . getEnterpriseAddress ( ) ) ;
}
Dept dept = iDeptService . selectDeptByCreditcode ( s . substring ( 0 , 18 ) ) ; //截取前18位即其组织机构代码
if ( dept ! = null ) {
complaintStatistics . setComplaintDepartmentId ( dept . getDeptId ( ) ) ;
if ( dept . getDeptName ( ) ! = null & & ! "" . equals ( dept . getDeptName ( ) ) ) {
complaintStatistics . setComplaintDepartment ( dept . getDeptName ( ) ) ;
}
}
complaintStatisticsMapper . insertComplaintStatistics ( complaintStatistics ) ;
}
}
} else { //检查事项投诉
List < String > departmentIdList = Arrays . asList ( enterpriseComplaint . getComplaintDepartmentIds ( ) . split ( "," ) ) ;
for ( String s : departmentIdList ) {
ComplaintStatistics complaintStatistics = new ComplaintStatistics ( ) ;
complaintStatistics . setCid ( enterpriseComplaint . getId ( ) ) ;
if ( enterpriseComplaint . getRelId ( ) ! = null & & ! "" . equals ( enterpriseComplaint . getRelId ( ) ) ) {
complaintStatistics . setRid ( enterpriseComplaint . getRelId ( ) ) ;
}
complaintStatistics . setComplaintTime ( str . format ( enterpriseComplaint . getCreateTime ( ) ) ) ; //同步投诉创建时间
if ( enterpriseComplaint . getComplaintType ( ) ! = null ) {
complaintStatistics . setComplaintType ( enterpriseComplaint . getComplaintType ( ) ) ;
}
if ( enterpriseComplaint . getEnforceType ( ) ! = null ) {
complaintStatistics . setEnforceType ( enterpriseComplaint . getEnforceType ( ) ) ;
}
if ( enterpriseComplaint . getEnterpriseName ( ) ! = null & & ! "" . equals ( enterpriseComplaint . getEnterpriseName ( ) ) ) {
complaintStatistics . setEnterpriseName ( enterpriseComplaint . getEnterpriseName ( ) ) ;
}
if ( enterpriseComplaint . getEnterpriseNumber ( ) ! = null & & ! "" . equals ( enterpriseComplaint . getEnterpriseNumber ( ) ) ) {
complaintStatistics . setEnterpriseNumber ( enterpriseComplaint . getEnterpriseNumber ( ) ) ;
}
if ( enterpriseComplaint . getProblemDescription ( ) ! = null & & ! "" . equals ( enterpriseComplaint . getProblemDescription ( ) ) ) {
complaintStatistics . setProblemDescription ( enterpriseComplaint . getProblemDescription ( ) ) ;
}
if ( enterpriseComplaint . getLinkman ( ) ! = null & & ! "" . equals ( enterpriseComplaint . getLinkman ( ) ) ) {
complaintStatistics . setLinkman ( enterpriseComplaint . getLinkman ( ) ) ;
}
if ( enterpriseComplaint . getLinkmanTel ( ) ! = null & & ! "" . equals ( enterpriseComplaint . getLinkmanTel ( ) ) ) {
complaintStatistics . setLinkmanTel ( enterpriseComplaint . getLinkmanTel ( ) ) ;
}
if ( enterpriseComplaint . getEnterpriseAddress ( ) ! = null & & ! "" . equals ( enterpriseComplaint . getEnterpriseAddress ( ) ) ) {
complaintStatistics . setEnterpriseAddress ( enterpriseComplaint . getEnterpriseAddress ( ) ) ;
}
complaintStatistics . setComplaintDepartmentId ( s ) ;
String sName = iDeptService . selectDeptById ( s ) . getDeptName ( ) ;
if ( sName ! = null & & ! "" . equals ( sName ) ) {
complaintStatistics . setComplaintDepartment ( sName ) ;
}
complaintStatisticsMapper . insertComplaintStatistics ( complaintStatistics ) ;
}
}
System . out . println ( "同步到投诉统计表" ) ;
}
}
}