拉取记录列表获取-根据公司编码

release
wangzhikun 2 years ago
parent 6f93c5952d
commit f7085e8a94
  1. 7
      dxhy-extend/src/main/java/com/dxhy/extend/controller/ExtInvoicePoolController.java
  2. 92
      dxhy-extend/src/main/java/com/dxhy/extend/controller/VouncherSyncController.java
  3. 6
      dxhy-extend/src/main/java/com/dxhy/extend/entity/PullRecordReq.java
  4. 9
      dxhy-extend/src/main/resources/mapper/ExtInvoicePoolMapper.xml

@ -4,11 +4,13 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors;
import javax.annotation.Resource; import javax.annotation.Resource;
import com.dxhy.auth.client.annotation.IgnoreClientToken; import com.dxhy.auth.client.annotation.IgnoreClientToken;
import com.dxhy.auth.client.annotation.IgnoreUserToken; import com.dxhy.auth.client.annotation.IgnoreUserToken;
import com.dxhy.common.vo.TaxOrgCode;
import com.dxhy.extend.entity.PullRecordReq; import com.dxhy.extend.entity.PullRecordReq;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -260,6 +262,11 @@ public class ExtInvoicePoolController extends AbstractController {
if(pullRecordReq.getSm().equals("99")){ if(pullRecordReq.getSm().equals("99")){
pullRecordReq.setSm(""); pullRecordReq.setSm("");
} }
if(pullRecordReq.getCompanyCode().equals("99")){
List<TaxOrgCode> orgCodes = getUserInfo().getOrgCodes();
List<String> collect = orgCodes.stream().map(TaxOrgCode::getOrgCode).collect(Collectors.toList());
pullRecordReq.setOrgCode(collect);
}
return ResponseEntity.ok(R.ok().put("data",extInvoicePoolService.selectPullRecord(pullRecordReq))); return ResponseEntity.ok(R.ok().put("data",extInvoicePoolService.selectPullRecord(pullRecordReq)));
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();

@ -34,62 +34,70 @@ public class VouncherSyncController {
//是否全量 X为全量推送,空为增量推送。 //是否全量 X为全量推送,空为增量推送。
//全量推送逻辑为 查询出的符合条件的凭证全部推送,全量推送不再检查是否在自定义表中已传输。 //全量推送逻辑为 查询出的符合条件的凭证全部推送,全量推送不再检查是否在自定义表中已传输。
//增量推送,已传输的凭证数据不再推送(检查传输记录表是否已传输成功) //增量推送,已传输的凭证数据不再推送(检查传输记录表是否已传输成功)
try{
/**
* 传参逻辑 必传 期间只能传一个月的
*
*/
String ifAll=map.get("ifAll");
//公司代码
String companyCode = map.get("companyCode"); String companyCode = map.get("companyCode");
//开始日期 String[] split = companyCode.split(",");
String startTime= map.get("startTime"); StringBuilder sb = new StringBuilder();
String endTime = map.get("endTime"); for (String str:split){
if(startTime!=null && startTime!=""){ /**
startTime=startTime.replace("-",""); * 传参逻辑 必传 期间只能传一个月的
} *
if(endTime!=null && endTime!=""){ */
endTime=endTime.replace("-",""); String ifAll=map.get("ifAll");
} //公司代码
//结束日期
String month=map.get("monat"); //开始日期
//GJAHR nian String startTime= map.get("startTime");
String gjahr=map.get("gjahr"); String endTime = map.get("endTime");
if(startTime!=null && startTime!=""){
startTime=startTime.replace("-","");
}
if(endTime!=null && endTime!=""){
endTime=endTime.replace("-","");
}
//结束日期
String month=map.get("monat");
//GJAHR nian
String gjahr=map.get("gjahr");
SNSAPObject object = new SNSAPObject(); SNSAPObject object = new SNSAPObject();
object.setSYSID("FPXT"); object.setSYSID("FPXT");
object.setIFYWID("FI842"); object.setIFYWID("FI842");
object.setBSKEY(UUID.randomUUID().toString().replace("-", "")); object.setBSKEY(UUID.randomUUID().toString().replace("-", ""));
//object.setSAPKEY(""); //object.setSAPKEY("");
// object.setZFILED1(""); // object.setZFILED1("");
// object.setZFILED2(""); // object.setZFILED2("");
// object.setZFILED3(""); // object.setZFILED3("");
// object.setZFILED4(""); // object.setZFILED4("");
object.setZFILED5("200"); object.setZFILED5("200");
Map<String,String> requestMap = new HashMap<>(); Map<String,String> requestMap = new HashMap<>();
List<Object> list = new ArrayList<>(); List<Object> list = new ArrayList<>();
requestMap.put("ZGSDM",companyCode); requestMap.put("ZGSDM",companyCode);
requestMap.put("GJAHR",gjahr); requestMap.put("GJAHR",gjahr);
requestMap.put("MONAT",month); requestMap.put("MONAT",month);
requestMap.put("ZDATEF",startTime); requestMap.put("ZDATEF",startTime);
requestMap.put("ZDATET",endTime); requestMap.put("ZDATET",endTime);
requestMap.put("ZFLAG",ifAll); requestMap.put("ZFLAG",ifAll);
object.setZDATA(JSONObject.toJSONString(requestMap)); object.setZDATA(JSONObject.toJSONString(requestMap));
JSONObject request = new JSONObject(); JSONObject request = new JSONObject();
request.put("IS_INPUT",object); request.put("IS_INPUT",object);
try{
String s = vouncherSyncService.sendPo(JSONObject.toJSONString(request)); String s = vouncherSyncService.sendPo(JSONObject.toJSONString(request));
Map map1 = JSONObject.parseObject(s, Map.class); Map map1 = JSONObject.parseObject(s, Map.class);
Map output = (Map)map1.get("ES_OUTPUT"); Map output = (Map)map1.get("ES_OUTPUT");
String ztype =(String) output.get("ZTYPE"); String ztype =(String) output.get("ZTYPE");
if(ztype.equals("S")){ if(ztype.equals("S")){
return ResponseEntity.ok(R.ok().put("data","数据拉取成功"));
}else { }else {
return ResponseEntity.ok(R.error((String)output.get("ZDATA"))); sb.append(str+output.get("ZDATA"));
} }
}
if(sb.length()>0){
return ResponseEntity.ok(R.ok().put("data",sb));
}else{
return ResponseEntity.ok(R.ok().put("data","拉取成功"));
}
}catch (Exception e ){ }catch (Exception e ){
e.printStackTrace(); e.printStackTrace();
return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT)); return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));

@ -2,12 +2,16 @@ package com.dxhy.extend.entity;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
* @Author wangzhikun * @Author wangzhikun
* @Date 2023/4/14 2023/4/14 * @Date 2023/4/14 2023/4/14
*/ */
@Data @Data
public class PullRecordReq { public class PullRecordReq {
private String companyCode;
//公司名称 //公司名称
private String companyName; private String companyName;
//账期 //账期
@ -27,6 +31,8 @@ public class PullRecordReq {
//过账终止日期 //过账终止日期
private String accountEndDate; private String accountEndDate;
private List<String> orgCode;
private int curr; private int curr;
private int size; private int size;
} }

@ -561,6 +561,15 @@
<if test="companyName!=null and companyName != ''"> <if test="companyName!=null and companyName != ''">
and vr.butxt = #{companyName} and vr.butxt = #{companyName}
</if> </if>
<if test ="orgCode !=null and orgCode.size>0">
and vr.bukrs in
<foreach collection="orgCode" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="companyCode !=null and companyCode !=''">
and vr.bukrs = #{companyCode}
</if>
<if test ="accountPeriod !=null and accountPeriod !=''"> <if test ="accountPeriod !=null and accountPeriod !=''">
and CONCAT_WS("-",vr.gjahr,vr.monat) = #{accountPeriod} and CONCAT_WS("-",vr.gjahr,vr.monat) = #{accountPeriod}
</if> </if>

Loading…
Cancel
Save