diff --git a/src/com/engine/hty/web/HtyController.java b/src/com/engine/hty/web/HtyController.java index 92b5dd5..a94e5b2 100644 --- a/src/com/engine/hty/web/HtyController.java +++ b/src/com/engine/hty/web/HtyController.java @@ -4,6 +4,7 @@ import cn.hutool.core.convert.Convert; import com.engine.common.util.ParamUtil; import com.weaver.general.Util; import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import weaver.conn.RecordSet; import javax.servlet.http.HttpServletRequest; @@ -93,6 +94,85 @@ public class HtyController { } + return returnMap; + } + + @GET + @Path("/getData") + @Produces(MediaType.APPLICATION_JSON) + public Map getData(@Context HttpServletRequest request, @Context HttpServletResponse response) { + Map map = ParamUtil.request2Map(request); + Map returnMap = new HashMap<>(); + returnMap.put("api_status", true); + + String ffyf = Util.null2String((String) map.get("ffyf")); + String ffry = Util.null2String((String) map.get("ffry")); + String bm = Util.null2String((String) map.get("bm")); + if (StringUtils.isBlank(bm)) { + + } + + + String billId = Util.null2String((String) map.get("billId")); + RecordSet rs = new RecordSet(); + + String year = ffyf.substring(0, 4); + // 年月转化为季度 + String month = ffyf.substring(4, 6); + // 月份转化为季度 + String quarter = ""; + if (month.equals("01") || month.equals("02") || month.equals("03")) { + quarter = "0"; + } else if (month.equals("04") || month.equals("05") || month.equals("06")) { + quarter = "1"; + } else if (month.equals("07") || month.equals("08") || month.equals("09")) { + quarter = "2"; + } else if (month.equals("10") || month.equals("11") || month.equals("12")) { + quarter = "3"; + } + String sql = "select * from uf_htyjxhd where khnd =" + year + " and khjd =" + quarter + " and concat(',',khry,',') like '%," + ffry + ",%' order by id desc "; + rs.executeQuery(sql); + if (rs.next()) { + String id = rs.getString("id"); + rs.executeQuery("select * from uf_jxdjfb_dt2 where jxhd = ? and khry = ?", id, ffry); + if (rs.next()) { + map.put("khzzdf", rs.getString("khzzdf")); + map.put("khdj", rs.getString("khdj")); + } + } + + rs.executeQuery("select * from uf_jcl_yjjx where yjyf = ?", ffyf); + String jxyj = ""; + if (rs.next()) { + jxyj = rs.getString("jxyj"); + } + map.put("jxyj", jxyj); + + String xs = ""; + rs.executeQuery("select a.jjxs,b.mrjjxs from uf_jcl_jjfpfa_dt1 a inner join uf_jcl_jjfpfa b on a.mainid = b.id where a.ry = ?", ffry); + if (rs.next()) { + xs = rs.getString("jjxs"); + if (StringUtils.isBlank(xs)) { + xs = rs.getString("mrjjxs"); + } + } + + if (StringUtils.isBlank(xs)) { + rs.executeQuery("select a.jjxs,b.mrjjxs from uf_jcl_jjfpfa_dt1 a inner join uf_jcl_jjfpfa b on a.mainid = b.id where a.bm =?", bm); + if (rs.next()) { + xs = rs.getString("jjxs"); + if (StringUtils.isBlank(xs)) { + xs = rs.getString("mrjjxs"); + } + } + } + map.put("xs", xs); + if (StringUtils.isNotBlank(xs) && StringUtils.isNotBlank(jxyj)) { + BigDecimal decimal = new BigDecimal(xs).multiply(new BigDecimal(jxyj)).setScale(2, RoundingMode.HALF_UP); + map.put("bzjjje", decimal); + } + + return returnMap; } }