发票推送接口开发
parent
13415cbe4c
commit
e28150db85
|
@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import net.htjs.pt4.core.BaseController;
|
||||
import net.htjs.pt4.zzsxt.service.xxgl.xmkpgl.cgfp.IBoCgfpService;
|
||||
import net.htjs.pt4.zzsxt.service.xxgl.xmkpgl.kpsq.IBoKpsqService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
@ -26,6 +27,8 @@ public class ApiController extends BaseController {
|
|||
|
||||
@Autowired
|
||||
private IBoKpsqService iBoKpsqService;
|
||||
@Autowired
|
||||
private IBoCgfpService iBoCgfpService;
|
||||
|
||||
@PostMapping(value = "/list")
|
||||
public Object dkpdjzbcx(@RequestBody String jsonStr){
|
||||
|
@ -182,4 +185,21 @@ public class ApiController extends BaseController {
|
|||
map.put("data",jsonString);
|
||||
return JSON.toJSONString(map);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/jxfpts")
|
||||
public Object jxfpts(@RequestBody Map map , HttpSession session){
|
||||
Map mapModel = new HashMap();
|
||||
try {
|
||||
iBoCgfpService.saveZZSGL_XX_JXFP(map);
|
||||
mapModel.put("code","0");
|
||||
mapModel.put("message","成功");
|
||||
}catch (Exception e){
|
||||
mapModel.put("code","-1");
|
||||
mapModel.put("message","失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return mapModel;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,4 +23,6 @@ public interface CgfpMapper {
|
|||
* @date 2022-06-20
|
||||
**/
|
||||
Map selectInvoiceById(String invoiceId);
|
||||
|
||||
Map selectInvoiceByFpdmhm(Map userMap);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.htjs.pt4.zzsxt.service.impl.xxgl.xmkpgl.cgfp;
|
||||
|
||||
import com.alibaba.druid.support.json.JSONUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import net.htjs.pt4.core.ServiceException;
|
||||
|
@ -49,6 +50,37 @@ public class BoCgfpServiceImpl implements IBoCgfpService {
|
|||
return cgfpMapper.insertZZSGL_XX_JXFP(userMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer saveZZSGL_XX_JXFP(Map userMap) {
|
||||
|
||||
String jsonString = JSONUtils.toJSONString(userMap.get("invoices"));
|
||||
|
||||
jsonString = jsonString.replace("\\", "").replace("\"{", "{").replace("}\"", "}");
|
||||
|
||||
Map fpMap = JSON.parseObject(jsonString, Map.class);
|
||||
|
||||
Map<String,Object> fpxx = (Map) fpMap.get("fpxx");
|
||||
|
||||
Map<String,Object> fpxxMap = new HashMap<>();
|
||||
|
||||
fpxxMap.put("fpdm",fpxx.get("fpdm"));
|
||||
fpxxMap.put("fphm",fpxx.get("fphm"));
|
||||
fpxxMap.put("kprq",fpxx.get("kprq"));
|
||||
fpxxMap.put("bhsje",fpxx.get("hjje"));
|
||||
fpxxMap.put("se",fpxx.get("hjse"));
|
||||
fpxxMap.put("fplxdm",fpxx.get("pjlx"));
|
||||
fpxxMap.put("fylx",fpxx.get("fylx"));
|
||||
|
||||
Map map = cgfpMapper.selectInvoiceByFpdmhm(fpxxMap);
|
||||
|
||||
if (map == null){
|
||||
return this.insertZZSGL_XX_JXFP(fpxxMap);
|
||||
}else {
|
||||
fpxxMap.put("fpid",map.get("fpid"));
|
||||
return this.updateZZSGL_XX_JXFP(fpxxMap);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteZZSGL_XX_JXFP(Map userMap) {
|
||||
return cgfpMapper.deleteZZSGL_XX_JXFP(userMap);
|
||||
|
|
|
@ -12,6 +12,8 @@ public interface IBoCgfpService {
|
|||
|
||||
Integer insertZZSGL_XX_JXFP(Map userMap);
|
||||
|
||||
Integer saveZZSGL_XX_JXFP(Map userMap);
|
||||
|
||||
Integer deleteZZSGL_XX_JXFP(Map userMap);
|
||||
|
||||
Integer updateZZSGL_XX_JXFP(Map userMap);
|
||||
|
|
|
@ -20,7 +20,14 @@
|
|||
</select>
|
||||
|
||||
<insert id="insertZZSGL_XX_JXFP" parameterType="map">
|
||||
insert into ZZSGL_XX_JXFP (fpid,QYID,fplxdm,fpdm,fphm,kprq,bhsje,se,pzdh) values (#{fpid},#{QYID},#{fplxdm},#{fpdm},#{fphm},#{kprq},#{bhsje},#{se},#{pzdh})
|
||||
insert into ZZSGL_XX_JXFP (fpid,QYID,fplxdm,fpdm,fphm,kprq,bhsje,se,pzdh
|
||||
<if test="fylx!=null">
|
||||
,fylx
|
||||
</if>
|
||||
) values (#{fpid},#{QYID},#{fplxdm},#{fpdm},#{fphm},#{kprq},#{bhsje},#{se},#{pzdh}
|
||||
<if test="fylx!=null">
|
||||
,#{fylx}
|
||||
</if>)
|
||||
</insert>
|
||||
|
||||
<delete id="deleteZZSGL_XX_JXFP" parameterType="map">
|
||||
|
@ -88,4 +95,11 @@
|
|||
<select id="selectInvoiceById" resultType="map" parameterType="string">
|
||||
select * from ZZSGL_XX_JXFP where fpid=#{invoiceId}
|
||||
</select>
|
||||
|
||||
<select id="selectInvoiceByFpdmhm" resultType="map" parameterType="string">
|
||||
select * from ZZSGL_XX_JXFP where fphm=#{fphm}
|
||||
<if test="fpdm!=null and fpdm!=''">
|
||||
and fpdm = #{fpdm}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue