更新同步相关代码

dev
ic_excellent 2023-07-15 10:02:52 +08:00
parent 870d31fa40
commit 3a2c4a84f9
11 changed files with 199 additions and 21 deletions

View File

@ -45,7 +45,7 @@ public interface ConfigMapper {
* @param mainId id
* @return
*/
@Select("select * from uf_response_config_dt1 where mainid = #{mainId}")
@Select("select * from uf_response_config_dt1 where mainid = #{mainId} and enable = 0")
@CollectionMethod(1)
List<ResponseConfigAlias> queryResponseConfigAlias(@ParamMapper("mainId")int mainId);
@ -54,7 +54,7 @@ public interface ConfigMapper {
* @param mainId id
* @return
*/
@Select("select * from uf_response_config_dt3 where mainid = #{mainId}")
@Select("select * from uf_response_config_dt3 where mainid = #{mainId} and enable = 0")
@CollectionMethod(2)
List<ResponseConfigValueChange> queryResponseConfigValueChange(@ParamMapper("mainId")int mainId);

View File

@ -21,6 +21,7 @@ import java.util.stream.Collectors;
* @Description <h1></h1>
**/
public class InsertSate extends State{
@Override
public void handle() {
int tableType = this.context.getTableType();

View File

@ -15,6 +15,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -45,7 +46,11 @@ public class ReportController {
log.info("into getReportData success params ==> "+param);
User loginUser = HrmUserVarify.getUser(request, response);
List<Map<String, Object>> reportData = reportService.queryReportData(param, loginUser);
return ApiResult.success(reportData);
Map<String, Object> titleData = reportService.queryTitleData(param);
Map<String,Object> res = new HashMap<>();
res.put("titleData",titleData);
res.put("reportData",reportData);
return ApiResult.success(res);
}catch (Exception e){
log.error("getReportData error ==> "+Util.getErrString(e));
return ApiResult.error(e.getMessage());

View File

@ -37,4 +37,46 @@ public interface ReportMapper {
@CaseConversion(value = false)
List<Map<String, Object>> queryReportData2(@ParamMapper("param") Map<String,Object> param,@ParamMapper("uid") int uid);
@Select("select id,hbwb,ysclwb,gzrywb,gzclwb,ldrwb,sfsjyc,ddsjyc,dlsk,yslx,hbcc,sfsj,ddsj,sfd,ddd,wdwcl,dwcljsy,wdwclqt,xcap,lxr," +
" lxrdh,bz,gzcl,gzry,zs,dyjbr,djr,ldr,lddw,rwzt,ykdh,gbs, " +
" (select LISTAGG(concat(wb, ',', zw), '-') WITHIN GROUP (ORDER BY wb) from uf_zwfwdjjmb_dt1 where mainid = main.id) ysdx, " +
" dyjbr, (select lastname from hrmresource where id = dyjbr) dyjbr_span," +
" djr, (select lastname from hrmresource where id = djr) djr_span " +
" from uf_zwfwdjjmb main $t{param.whereSql} order by dlsk ")
@CaseConversion(value = false)
List<Map<String, Object>> queryReportData3(@ParamMapper("param") Map<String,Object> param,@ParamMapper("uid") int uid);
/**
*
* @param param
* @return
*/
@Select("select xxhm from uf_bjxxjmbd_dt1 where xxrq = #{currentDate}")
@CaseConversion(value = false)
List<String> queryTrafficControl(@ParamMapper("param") Map<String,Object> param);
/**
*
* @param param
* @return
*/
@Select("select hrm.lastname,ry.zblx,ry.zbry " +
" from uf_ryzbjlbzjb_dt1 ry " +
" inner join hrmresource hrm on ry.zbry = hrm.id" +
" where #{currentDate} >= ry.zbksrq and #{currentDate} <= ry.zbjsrq }")
@CaseConversion(value = false)
List<Map<String, Object>> queryDutyData(@ParamMapper("param") Map<String,Object> param);
/**
*
* @param param
* @return
*/
@Select("select hrm.lastname " +
" from uf_jsyzbap_dt1 jsy " +
" inner join hrmresource hrm on jsy.zbry = hrm.id" +
" where jsy.zblx = #{dutyType} and #{currentDate} >= jsy.zbksrq and #{currentDate} <= jsy.zbjsrq }")
@CaseConversion(value = false)
List<String> queryCarSchedule(@ParamMapper("param") Map<String,Object> param);
}

View File

@ -5,8 +5,11 @@ import com.api.bokang.xiao.sh_bigdata.mapper.ReportMapper;
import weaver.general.TimeUtil;
import weaver.hrm.User;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @ClassName ReviewService
@ -25,23 +28,88 @@ public class ReportService {
* @return
*/
public List<Map<String,Object>> queryReportData(Map<String,Object> param, User user){
param.put("whereSql",getWhereSql(param));
return reportMapper.queryReportData3(param,user.getUID());
}
private String getWhereSql(Map<String,Object> param){
String currentDate = Util.null2String(param.get("currentDate"));
String registrationPeople = Util.null2String(param.get("registrationPeople"));
String registrationPeopleSpan = Util.null2String(param.get("registrationPeopleSpan"));
param.put("whereSql","");
//迎送对象
String project = Util.null2String(param.get("project"));
//开始日期
String beginDate = Util.null2String(param.get("beginDate"));
//结束日期
String endData = Util.null2String(param.get("endData"));
//航班车次
String flightAndTrain = Util.null2String(param.get("flightAndTrain"));
String whereSql = "";
if(!"".equals(currentDate)){
whereSql += " and dlsk = #{param.currentDate} ";
if(!"".equals(beginDate) && !"".equals(endData)){
whereSql += " and (dlsk between #{param.beginDate} and #{param.endData} )";
}else {
param.put("today", TimeUtil.getCurrentDateString());
whereSql += " and dlsk >= #{param.today} ";
}
if(!"".equals(registrationPeople)){
whereSql += " and djr = #{param.registrationPeople} ";
whereSql += " and dyjbr = #{param.registrationPeople} ";
}
if(!"".equals(flightAndTrain)){
whereSql += " and hbwb = #{param.flightAndTrain} ";
}
if(!"".equals(project)){
whereSql += " and exits (select 1 from uf_zwfwdjjmb_dt1 where mainid = main.id and ysdx = #{param.project}) ";
}
whereSql = whereSql.replaceFirst(" and "," where ");
param.put("whereSql",whereSql);
return reportMapper.queryReportData2(param,user.getUID());
return whereSql;
}
public Map<String,Object> queryTitleData(Map<String,Object> param){
Map<String,Object> titleData = new HashMap<>();
//查询限行信息
List<String> trafficControlList = reportMapper.queryTrafficControl(param);
judgeEmptyAndPut(trafficControlList,titleData,"trafficControl");
//查询值班信息
List<Map<String, Object>> dutyData = reportMapper.queryDutyData(param);
if(Objects.nonNull(dutyData) && !dutyData.isEmpty()) {
Map<String, List<Map<String, Object>>> dutyTypeMap = dutyData.stream().collect(Collectors.groupingBy(item -> Util.null2String(item.get("zblx"))));
//带班值班员
filterAndPut(dutyTypeMap.get("0"),titleData,"headWatch");
//机关值班员
filterAndPut(dutyTypeMap.get("1"),titleData,"organWatch");
//今日迎送人员
filterAndPut(dutyTypeMap.get("2"),titleData,"todayWelcome");
}
titleData.put("dutyData",dutyData);
//查询当日送报人员
param.put("dutyType",1);
List<String> strings = reportMapper.queryCarSchedule(param);
judgeEmptyAndPut(strings,titleData,"currentNewsboy");
//查询驾驶值班员
param.put("dutyType",0);
List<String> pilots = reportMapper.queryCarSchedule(param);
judgeEmptyAndPut(pilots,titleData,"pilot");
//查询明日送报人员
param.put("dutyType",1);
String currentDate = Util.null2String(param.get("currentDate"));
currentDate = TimeUtil.dateAdd(currentDate,-1);
param.put("currentDate",currentDate);
List<String> tomorrowNewsboys = reportMapper.queryCarSchedule(param);
judgeEmptyAndPut(tomorrowNewsboys,titleData,"currentNewsboy");
return titleData;
}
private void filterAndPut(List<Map<String, Object>> data,Map<String,Object> map,String key){
if(Objects.nonNull(data) && !data.isEmpty()){
List<String> lastname = data.stream().map(item -> Util.null2String(item.get("lastname"))).collect(Collectors.toList());
judgeEmptyAndPut(lastname,map,key);
}
}
private void judgeEmptyAndPut(List<String> list,Map<String,Object> map,String key){
if(Objects.nonNull(list) && !list.isEmpty()) {
map.put(key,String.join(",", list));
}
}
}

View File

@ -8,6 +8,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.apache.log4j.Logger;
import weaver.bokang.xiao.zscq.store.TableNameStore;
import weaver.file.ImageFileManager;
import weaver.general.GCONST;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.xiao.commons.config.entity.WeaverFile;
@ -19,6 +20,10 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.StreamingOutput;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@ -67,13 +72,15 @@ public class ReserveSelectController {
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response downloadBatchFiles(@QueryParam("datePicker") String datePicker,
@QueryParam("checkResult") String checkResult,
@QueryParam("checkResultShow") String checkResultShow) {
@QueryParam("checkResultShow") String checkResultShow,
@QueryParam("region") String region) {
log.info("====== into downloadBatchFiles success =======");
log.info(String.format("====== datePicker:[%s] checkResult:[%s] checkResultShow:[%s] =======",datePicker,checkResult,checkResultShow));
log.info(String.format("====== datePicker:[%s] checkResult:[%s] checkResultShow:[%s] region:[%s] =======",datePicker,checkResult,checkResultShow,region));
Map<String,Object> param = new HashMap<>(8);
param.put("datePicker",datePicker);
param.put("checkResult",checkResult);
param.put("checkResultShow",checkResultShow);
param.put("region",region);
String zipFileName = reserveService.getFileName(param) + ".zip";
StreamingOutput streamingOutput = outputStream -> {
try {
@ -88,6 +95,33 @@ public class ReserveSelectController {
.build();
}
@GET
@Path("/batchDownloadTemp")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public String batchDownloadTemp(@QueryParam("datePicker") String datePicker,
@QueryParam("checkResult") String checkResult,
@QueryParam("checkResultShow") String checkResultShow,
@QueryParam("region") String region) {
log.info("====== into batchDownloadTemp success =======");
log.info(String.format("====== datePicker:[%s] checkResult:[%s] checkResultShow:[%s] region:[%s] =======",datePicker,checkResult,checkResultShow,region));
Map<String,Object> param = new HashMap<>(8);
param.put("datePicker",datePicker);
param.put("checkResult",checkResult);
param.put("checkResultShow",checkResultShow);
param.put("region",region);
String zipFileName = reserveService.getFileName(param) + ".zip";
try {
String filePath = "/data/filesystem";
String fileFullPath = filePath + File.separator + zipFileName;
OutputStream outputStream = Files.newOutputStream(new File(fileFullPath).toPath());
reserveService.batchDownload(param, outputStream);
}catch (Exception e){
log.error("下载文件异常 ==>"+Util.getErrString(e));
}
return ApiResult.successNoData();
}
@GET
@Path("/refreshStore")
public String refreshStore(@Context HttpServletRequest request, @Context HttpServletResponse response){

View File

@ -25,7 +25,7 @@ public interface QueryMapper {
" from uf_gjjtb gjj " +
" inner join hrmdepartment depart on gjj.xfqj = depart.id " +
" where concat(',',concat(sjpcdxk,',')) like concat('%,',concat(#{datePicker},',%')) " +
" and hcqkdx = #{checkResult} and gjj.xgfj is not null ")
" and hcqkdx = #{checkResult} and gjj.xgfj is not null $t{cusWhere} ")
@Associations( @Association(property = "weaverFile",column = "xgfj",id = @Id(value = Integer.class,methodId = 1)))
List<SendFileEntity> queryDownloadList(Map<String,Object> param);

View File

@ -7,6 +7,7 @@ import com.api.bokang.xiao.zscq.entity.WeaverFile;
import com.api.bokang.xiao.zscq.mapper.QueryMapper;
import com.api.bokang.xiao.zscq.mapper.ReserveSelectMapper;
import com.api.bokang.xiao.zscq.service.ReserveService;
import com.icbc.api.internal.apache.http.impl.cookie.S;
import weaver.bokang.xiao.zscq.config.service.ModeChangeService;
import weaver.conn.RecordSet;
import weaver.file.ImageFileManager;
@ -162,17 +163,24 @@ public class ReserveServiceImpl implements ReserveService {
@Override
public void batchDownload(Map<String,Object> param, OutputStream outputStream) throws IOException {
String region = Util.null2String(param.get("region"));
String cusWhere = "";
if(!"".equals(region)){
cusWhere = " and gjj.xfqj in ("+region+")";
}
param.put("cusWhere",cusWhere);
List<SendFileEntity> sendList = queryMapper.queryDownloadList(param);
if(Objects.isNull(sendList) || sendList.isEmpty()){
log.info("附件列表为空 attachment empty !!!");
//throw new CustomerException("附件列表查询为空");
return;
}
log.info("查询到的附件信息 query fileList ==>"+ JSON.toJSONString(sendList));
log.info("查询到的附件信息 query fileList ==>"+ sendList.size());
// 1. 将 SendFileEntity 按照 departName 分组
Map<String, List<SendFileEntity>> sendMap = sendList.stream().collect(Collectors.groupingBy(SendFileEntity::getDepartName));
// 2. 创建 ZipOutputStream
ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(outputStream));
String defaultFileType = ".txt";
// 3. 遍历 SendFileEntity
for (Map.Entry<String, List<SendFileEntity>> entry : sendMap.entrySet()) {
String departName = entry.getKey();
@ -185,7 +193,17 @@ public class ReserveServiceImpl implements ReserveService {
WeaverFile fileMsg = sendFileEntity.getWeaverFile();
int imageFileId = fileMsg.getImageFileId();
String fileName = fileMsg.getFileName();
String fileType = fileName.substring(fileName.lastIndexOf("."));
int index = fileName.lastIndexOf(".");
String fileType = "";
if(fileMsg.getFileSize() > 1048576){
log.info("文件大于 10M ==>"+JSON.toJSONString(sendFileEntity));
}
if(index == -1){
fileType = defaultFileType;
log.info("文件名有误 ==>"+JSON.toJSONString(sendFileEntity));
}else {
fileType = fileName.substring(index);
}
String tempFileName = sendFileEntity.getRequestNumber() + fileType;
InputStream inputStream = ImageFileManager.getInputStreamById(imageFileId);
// 6. 将单个附件写入 ZipOutputStream

View File

@ -1,9 +1,6 @@
package com.api.bokang.xiao.zxyh.generate_code.mapper;
import aiyh.utils.annotation.recordset.Delete;
import aiyh.utils.annotation.recordset.Select;
import aiyh.utils.annotation.recordset.SqlMapper;
import aiyh.utils.annotation.recordset.Update;
import aiyh.utils.annotation.recordset.*;
import java.util.Map;
@ -23,7 +20,7 @@ public interface GenerateMapper {
* @return
*/
@Update("update uf_contract_num_log set workflow_info = #{workflowInfo},file_info = #{fileInfo},detail_id = #{detailId}," +
"row_id = #{rowId},contract_name = #{contractName},contract_num = #{contractNum},flow_num = #{flowNum} where id = #{dataId}")
"row_id = #{rowId},contract_name = #{contractName},contract_num = #{contractNum},flow_num = #{flowNum},contract_month = #{contractMonth} where id = #{dataId}")
boolean updateContractLog(Map<String,Object> param);
/**
@ -33,6 +30,13 @@ public interface GenerateMapper {
@Select("select max(flow_num) from uf_contract_num_log")
int getMaxFlow();
/**
* <h2></h2>
* @return
*/
@Select("select max(flow_num) from uf_contract_num_log where contract_month = #{month}")
int getMaxFlowByMonth(@ParamMapper("month")int month);
/**
* <h2></h2>
* @param param

View File

@ -5,6 +5,7 @@ import com.api.bokang.xiao.zxyh.generate_code.mapper.GenerateMapper;
import org.apache.log4j.Logger;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
@ -29,7 +30,10 @@ public class GenerateContractNoService {
private final static Integer FLOW_LENGTH = 3;
public String generateCode(Map<String,Object> param){
int maxFlow = generateMapper.getMaxFlow();
Calendar calendar = Calendar.getInstance();
int month = calendar.get(Calendar.MONTH);
//int maxFlow = generateMapper.getMaxFlow();
int maxFlow = generateMapper.getMaxFlowByMonth(month);
maxFlow = Math.max(maxFlow,0);
maxFlow++;
String contractNo = "";
@ -47,6 +51,7 @@ public class GenerateContractNoService {
param.put("dataId",dataId);
param.put("contractNum",contractNo);
param.put("flowNum",maxFlow);
param.put("contractMonth",month);
boolean updateFlag = generateMapper.updateContractLog(param);
Util.rebuildModeDataShareByAsync(1,TABLE_NAME,dataId);
if(updateFlag){

View File

@ -45,6 +45,7 @@ import weaver.bokang.xiao.porsche.schedule.CompanyWriteBackSchedule;
import weaver.bokang.xiao.porsche.schedule.SalaryUpdateSchedule;
import weaver.bokang.xiao.sh_bigdata.action.DataPushAction;
import weaver.bokang.xiao.shtx.schedule.ExamineSchedule;
import weaver.bokang.xiao.shtx.schedule.SyncTeachDataSchedule;
import weaver.bokang.xiao.xhny_mode.search.CustomSearchDepart;
import weaver.bokang.xiao.xhny_report.entity.SourceTrackingData;
import weaver.bokang.xiao.xhny_report.schedule.GenerateReportSchedule;
@ -84,7 +85,7 @@ public class NormalTest extends BaseTest {
@Test
public void testWord(){
GenerateFileUtil.createCronJobDocument(ExamineSchedule.class);
GenerateFileUtil.createCronJobDocument(SyncTeachDataSchedule.class);
//GenerateFileUtil.createActionDocument(DataPushAction.class);
//GenerateFileUtil.createActionDocument(DateFieldUpdateAction.class);
}