@ -1,9 +1,14 @@
package com.engine.attendance.workflow.service.impl ;
import com.engine.attendance.workflow.cmd.GetBusinessTripsApplyListCmd ;
import com.engine.attendance.workflow.service.BusinessTripsApplyService ;
import com.engine.common.util.DbTools ;
import com.engine.core.impl.Service ;
import lombok.extern.slf4j.Slf4j ;
import weaver.general.Util ;
import java.util.ArrayList ;
import java.util.HashMap ;
import java.util.List ;
import java.util.Map ;
/ * *
@ -11,10 +16,52 @@ import java.util.Map;
* @Description : 出 差 申 请
* @Date : 2024 / 3 / 15
* * /
@Slf4j
public class BusinessTripsApplyServiceImpl extends Service implements BusinessTripsApplyService {
@Override
public Map < String , Object > getBusinessTripsApplyList ( Map < String , Object > params ) {
return commandExecutor . execute ( new GetBusinessTripsApplyListCmd ( params , user ) ) ;
// return commandExecutor.execute(new GetBusinessTripsApplyListCmd(params, user));
Map < String , Object > retmap = new HashMap < String , Object > ( ) ;
//获取主表id列表
String targetUserId = Util . null2String ( params . get ( "targetUserId" ) ) ;
String businessTripsType = Util . null2String ( params . get ( "businessTripsType" ) ) ;
String startDate = Util . null2String ( params . get ( "startDate" ) ) ;
String endDate = Util . null2String ( params . get ( "endDate" ) ) ;
log . info ( "targetUserId : {}, businessTripsType : {}, startDate : {}, endDate : {}" , targetUserId , businessTripsType , startDate , endDate ) ;
String sql = "select * from uf_jcl_kq_ccjl where ccr=" + targetUserId ;
if ( ! businessTripsType . equals ( "" ) ) {
sql + = "and cclx = " + businessTripsType ;
}
if ( ! startDate . equals ( "" ) ) {
sql + = "and ksrq >= " + startDate ;
}
if ( ! endDate . equals ( "" ) ) {
sql + = "and jsrq <= " + endDate ;
}
List < String > maidList = new ArrayList < > ( ) ;
if ( ! targetUserId . equals ( "" ) ) {
List < Map < String , Object > > datas = DbTools . getSqlToList ( sql ) ;
if ( datas . size ( ) > 0 ) {
datas . forEach ( f - > {
maidList . add ( f . get ( "id" ) . toString ( ) ) ;
} ) ;
}
}
log . info ( "maidList : [{}]" , maidList ) ;
//查询子表数据
if ( maidList . size ( ) > 0 ) {
String detailSql = "select a.id,a.cxcc,a.ksrq,a.kssj,a.jsrq,a.jssj,a.ccsc,a.qtcc,a.btcc,a.cxsm from uf_jcl_kq_ccjl_dt1 a where mainid in (" + String . join ( "," , maidList ) + ")" ;
List < Map < String , Object > > detailList = DbTools . getSqlToList ( detailSql ) ;
if ( detailList . size ( ) > 0 ) {
retmap . put ( "result" , detailList ) ;
} else {
retmap . put ( "result" , null ) ;
}
log . info ( "detailList : [{}]" , detailList ) ;
} else {
retmap . put ( "result" , null ) ;
}
return retmap ;
}
}