|
@@ -1,6 +1,6 @@
|
|
|
package com.xt.jygl.gkyxtjyfx.hxhbtj.ctl;
|
|
|
|
|
|
-import java.math.BigDecimal;
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
@@ -27,10 +27,13 @@ import com.xt.jygl.ggfwxxgl.hxgl.service.HxglService;
|
|
|
import com.xt.jygl.gkjcxx.gk.entity.GkEntity;
|
|
|
import com.xt.jygl.gkjcxx.gk.service.GkService;
|
|
|
import com.xt.jygl.gkyxtjyfx.hxhbtj.entity.HxhbtjEntity;
|
|
|
+import com.xt.jygl.gkyxtjyfx.hxhbtj.entity.HxhbtjproEntity;
|
|
|
import com.xt.jygl.gkyxtjyfx.hxhbtj.service.HxhbtjService;
|
|
|
+import com.xt.jygl.gkyxtjyfx.hxhbtj.service.HxhbtjproService;
|
|
|
import com.xt.jygl.gkyxtjyfx.hxhbtj.vo.HxhbtjVo;
|
|
|
import com.xtframe.core.base.ctl.WebJsonResult;
|
|
|
import com.xtframe.core.support.SecurityMgr;
|
|
|
+import com.xtframe.sec.code.entity.CodeEntity;
|
|
|
import com.xtframe.sec.common.BaseEntity;
|
|
|
import com.xtframe.sec.common.QueryService;
|
|
|
import com.xtframe.sec.common.SimplePageRequest;
|
|
@@ -48,10 +51,12 @@ public class HxhbtjProCtl extends BaseWebCtl {
|
|
|
@Autowired
|
|
|
private HxhbtjService hxhbtjService;
|
|
|
@Autowired
|
|
|
+ private HxhbtjproService hxhbtjproService;
|
|
|
+ @Autowired
|
|
|
private QueryService query;
|
|
|
|
|
|
@RequestMapping(value = "/main")
|
|
|
- public String main(SimplePageRequest page, Model model, final HttpServletRequest request, final String rq, final String szgkid, final String menuid) throws JsonProcessingException {
|
|
|
+ public String main(SimplePageRequest page, Model model, String flag, final HttpServletRequest request, final String rq, final String szgkid, final String menuid) throws JsonProcessingException {
|
|
|
String start = "";
|
|
|
if (StringUtils.isEmpty(rq)) {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
@@ -76,6 +81,7 @@ public class HxhbtjProCtl extends BaseWebCtl {
|
|
|
}
|
|
|
|
|
|
list.add(cb.notEqual(root.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_DELETE));
|
|
|
+ list.add(cb.notEqual(root.get("recordStatus").as(Integer.class), BaseEntity.RECORE_STATE_COPY));
|
|
|
return cb.and(list.toArray(new Predicate[] {}));
|
|
|
}
|
|
|
};
|
|
@@ -103,39 +109,81 @@ public class HxhbtjProCtl extends BaseWebCtl {
|
|
|
// 翻页共通
|
|
|
putPageInfo(model, page, list);
|
|
|
} else {
|
|
|
- List<Object> slist = hxhbtjService.findAllSzd(rq != null ? rq : start);
|
|
|
List<HxhbtjVo> volist = new ArrayList<HxhbtjVo>();
|
|
|
- Object[] sum = new Object[10];
|
|
|
- if (slist != null && slist.size() > 0) {
|
|
|
- for (Object ob : slist) {
|
|
|
- Object[] e = (Object[]) ob;
|
|
|
- HxhbtjVo vo = new HxhbtjVo();
|
|
|
- vo.setSzd((String) e[0]);
|
|
|
- vo.setYyhxts(e[1].toString());
|
|
|
- vo.setYyhxhbs(e[2].toString());
|
|
|
- vo.setJyhxts(e[3].toString());
|
|
|
- vo.setJyhxhbs(e[4].toString());
|
|
|
- vo.setNzxts(e[5].toString());
|
|
|
- vo.setNzxhbs(e[6].toString());
|
|
|
- vo.setNmhxts(e[7].toString());
|
|
|
- vo.setNmhxhbs(e[8].toString());
|
|
|
- volist.add(vo);
|
|
|
- for (int j = 1; j < e.length; j++) {
|
|
|
- BigDecimal s = new BigDecimal(0.0000);
|
|
|
- if (sum[j] != null) {
|
|
|
- s = (BigDecimal) sum[j];
|
|
|
+ if (StringUtils.isEmpty(flag)) {
|
|
|
+ List<HxhbtjproEntity> list = hxhbtjproService.findByRq(rq != null ? rq : start);
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
+ for (HxhbtjproEntity entity : list) {
|
|
|
+ HxhbtjVo vo = new HxhbtjVo();
|
|
|
+ vo.setSzd(entity.getSzd().getText());
|
|
|
+ vo.setYyhxts(entity.getYyhxts().toString());
|
|
|
+ vo.setYyhxhbs(entity.getYyhxhbs().toString());
|
|
|
+ vo.setJyhxts(entity.getJyhxts().toString());
|
|
|
+ vo.setJyhxhbs(entity.getJyhxhbs().toString());
|
|
|
+ vo.setNzxts(entity.getNzxts().toString());
|
|
|
+ vo.setNzxhbs(entity.getNzxhbs().toString());
|
|
|
+ vo.setNmhxts(entity.getNmhxts().toString());
|
|
|
+ vo.setNmhxhbs(entity.getNmhxhbs().toString());
|
|
|
+ vo.setId(entity.getSzd().getId());
|
|
|
+ volist.add(vo);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ List<CodeEntity> clist = securityMgr.codeService().findByPid("900");
|
|
|
+ if (clist != null && clist.size() > 0) {
|
|
|
+ for (CodeEntity code : clist) {
|
|
|
+ HxhbtjVo vo = new HxhbtjVo();
|
|
|
+ vo.setSzd(code.getText());
|
|
|
+ vo.setYyhxts("0");
|
|
|
+ vo.setYyhxhbs("0");
|
|
|
+ vo.setJyhxts("0");
|
|
|
+ vo.setJyhxhbs("0");
|
|
|
+ vo.setNzxts("0");
|
|
|
+ vo.setNzxhbs("0");
|
|
|
+ vo.setNmhxts("0");
|
|
|
+ vo.setNmhxhbs("0");
|
|
|
+ vo.setId(code.getId());
|
|
|
+ volist.add(vo);
|
|
|
}
|
|
|
- BigDecimal ss = (BigDecimal) e[j];
|
|
|
- s = s.add(ss);
|
|
|
- sum[j] = s;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- for (int i = 0; i < sum.length; i++) {
|
|
|
- if (sum[i] != null) {
|
|
|
- model.addAttribute("a" + i, sum[i].toString());
|
|
|
+
|
|
|
+ } else {
|
|
|
+ List<Object> slist = hxhbtjService.findAllSzd(rq != null ? rq : start);
|
|
|
+
|
|
|
+ if (slist != null && slist.size() > 0) {
|
|
|
+ for (Object ob : slist) {
|
|
|
+ Object[] e = (Object[]) ob;
|
|
|
+ HxhbtjVo vo = new HxhbtjVo();
|
|
|
+ vo.setSzd((String) e[0]);
|
|
|
+ DecimalFormat df2 = (DecimalFormat) DecimalFormat.getInstance();
|
|
|
+ df2.applyPattern("0.0");
|
|
|
+ vo.setYyhxts(df2.format(e[1]));
|
|
|
+ vo.setYyhxhbs(df2.format(e[2]));
|
|
|
+ vo.setJyhxts(df2.format(e[3]));
|
|
|
+ vo.setJyhxhbs(df2.format(e[4]));
|
|
|
+ vo.setNzxts(df2.format(e[5]));
|
|
|
+ vo.setNzxhbs(df2.format(e[6]));
|
|
|
+ vo.setNmhxts(df2.format(e[7]));
|
|
|
+ vo.setNmhxhbs(df2.format(e[8]));
|
|
|
+ vo.setId(e[9].toString());
|
|
|
+ volist.add(vo);
|
|
|
+ /*
|
|
|
+ * for (int j = 1; j < e.length-1; j++) { BigDecimal s =
|
|
|
+ * new BigDecimal(0.0000); if (sum[j] != null) { s =
|
|
|
+ * (BigDecimal) sum[j]; } BigDecimal ss = new
|
|
|
+ * BigDecimal(0.0); ss = (BigDecimal) e[j]; s =
|
|
|
+ * s.add(ss); sum[j] = s; }
|
|
|
+ */
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+ /*
|
|
|
+ * for (int i = 0; i < sum.length; i++) { if (sum[i] != null) {
|
|
|
+ * model.addAttribute("a" + i, sum[i].toString()); } }
|
|
|
+ */
|
|
|
model.addAttribute("volist", volist);
|
|
|
model.addAttribute("rq", rq != null ? rq : start);
|
|
|
model.addAttribute("menuid", menuid);
|
|
@@ -201,7 +249,7 @@ public class HxhbtjProCtl extends BaseWebCtl {
|
|
|
model.addAttribute("menuid", menuid);
|
|
|
return "gkyxtjyfx/hxhbtj/hxhbtjproView";
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@RequestMapping(value = "/edit")
|
|
|
public String edit(Model model, String id, String path) {
|
|
|
if (!StringUtils.isEmpty(path)) {
|
|
@@ -264,7 +312,7 @@ public class HxhbtjProCtl extends BaseWebCtl {
|
|
|
model.addAttribute("szgkid", entity.getSzgk().getId());
|
|
|
return "gkyxtjyfx/hxhbtj/hxhbtjproEdit";
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@RequestMapping(value = "/save")
|
|
|
@ResponseBody
|
|
|
public WebJsonResult save(Model model, String path, String szgkid, String rq, HxhbtjEntity code) {
|
|
@@ -331,14 +379,14 @@ public class HxhbtjProCtl extends BaseWebCtl {
|
|
|
entity.setNmxkphxs(code.getNmxkphxs());
|
|
|
entity.setNmtkhxs(code.getNmtkhxs());
|
|
|
|
|
|
- if(!StringUtils.isEmpty(szgkid)){
|
|
|
+ if (!StringUtils.isEmpty(szgkid)) {
|
|
|
GkEntity szgk = gkService.findOne(szgkid);
|
|
|
entity.setSzgk(szgk);
|
|
|
entity.setSzd(szgk.getSzd());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
entity = hxhbtjService.save(entity);
|
|
|
-
|
|
|
+
|
|
|
if ("1".equals(path)) {
|
|
|
entity.setRecordStatus(code.getRecordStatus());
|
|
|
}
|
|
@@ -350,4 +398,89 @@ public class HxhbtjProCtl extends BaseWebCtl {
|
|
|
}
|
|
|
return wr;
|
|
|
}
|
|
|
+
|
|
|
+ @RequestMapping(value = "/saveMain")
|
|
|
+ @ResponseBody
|
|
|
+ public WebJsonResult saveMain(Model model, String szd, String yyhxts, String yyhxhbs, String jyhxts, String jyhxhbs, String nzxts, String nzxhbs, String nmhxts, String nmhxhbs, String rq) {
|
|
|
+ WebJsonResult wr = success();
|
|
|
+ String szds[] = szd.split(",");
|
|
|
+ String yyhxtss[] = yyhxts.split(",");
|
|
|
+ String yyhxhbss[] = yyhxhbs.split(",");
|
|
|
+ String jyhxtss[] = jyhxts.split(",");
|
|
|
+ String jyhxhbss[] = jyhxhbs.split(",");
|
|
|
+ String nzxtss[] = nzxts.split(",");
|
|
|
+ String nzxhbss[] = nzxhbs.split(",");
|
|
|
+ String nmhxtss[] = nmhxts.split(",");
|
|
|
+ String nmhxhbss[] = nmhxhbs.split(",");
|
|
|
+
|
|
|
+ if (!StringUtils.isEmpty(rq)) {
|
|
|
+ List<HxhbtjproEntity> list = hxhbtjproService.findByRq(rq);
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
+ for (HxhbtjproEntity entity : list) {
|
|
|
+ hxhbtjproService.logicDelete(entity.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < szds.length; i++) {
|
|
|
+ HxhbtjproEntity entity = new HxhbtjproEntity();
|
|
|
+ entity.setRq(rq);
|
|
|
+ CodeEntity code = securityMgr.codeService().findOne(szds[i]);
|
|
|
+ entity.setSzd(code);
|
|
|
+ entity.setSortno(code.getSortno());
|
|
|
+ if (!StringUtils.isEmpty(yyhxtss[i])) {
|
|
|
+ Double d = Double.valueOf(yyhxtss[i]);
|
|
|
+ entity.setYyhxts(d);
|
|
|
+ } else {
|
|
|
+ entity.setYyhxts(0d);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(yyhxhbss[i])) {
|
|
|
+ Double d = Double.valueOf(yyhxhbss[i]);
|
|
|
+ entity.setYyhxhbs(d);
|
|
|
+ } else {
|
|
|
+ entity.setYyhxhbs(0d);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(jyhxtss[i])) {
|
|
|
+ Double d = Double.valueOf(jyhxtss[i]);
|
|
|
+ entity.setJyhxts(d);
|
|
|
+ } else {
|
|
|
+ entity.setJyhxts(0d);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(jyhxhbss[i])) {
|
|
|
+ Double d = Double.valueOf(jyhxhbss[i]);
|
|
|
+ entity.setJyhxhbs(d);
|
|
|
+ } else {
|
|
|
+ entity.setJyhxhbs(0d);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(nzxtss[i])) {
|
|
|
+ Double d = Double.valueOf(nzxtss[i]);
|
|
|
+ entity.setNzxts(d);
|
|
|
+ } else {
|
|
|
+ entity.setNzxts(0d);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(nzxhbss[i])) {
|
|
|
+ Double d = Double.valueOf(nzxhbss[i]);
|
|
|
+ entity.setNzxhbs(d);
|
|
|
+ } else {
|
|
|
+ entity.setNzxhbs(0d);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(nmhxtss[i])) {
|
|
|
+ Double d = Double.valueOf(nmhxtss[i]);
|
|
|
+ entity.setNmhxts(d);
|
|
|
+ } else {
|
|
|
+ entity.setNmhxts(0d);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(nmhxhbss[i])) {
|
|
|
+ Double d = Double.valueOf(nmhxhbss[i]);
|
|
|
+ entity.setNmhxhbs(d);
|
|
|
+ } else {
|
|
|
+ entity.setNmhxhbs(0d);
|
|
|
+ }
|
|
|
+
|
|
|
+ hxhbtjproService.save(entity);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return wr;
|
|
|
+ }
|
|
|
}
|