| @@ -1,8 +1,10 @@ | |||
| package com.iformall.controller.market; | |||
| import com.iformall.annotation.TenantIgnore; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.WxEnergyFees; | |||
| import com.iformall.domain.po.WxFinancePrintData; | |||
| import com.iformall.domain.po.WxFinancePrintTemplate; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| @@ -21,6 +23,8 @@ import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| @@ -38,7 +42,6 @@ public class WxFinancePrintController extends BaseController { | |||
| private WxFinancePrintService wxFinancePrintService; | |||
| /** | |||
| * 账单类型(非能源) | |||
| * @return | |||
| */ | |||
| @GetMapping("types") | |||
| @@ -69,6 +72,15 @@ public class WxFinancePrintController extends BaseController { | |||
| return new ResultData(wxFinancePrintService.printTemplateList(record)); | |||
| } | |||
| @ApiOperation("费用区间列表") | |||
| @PostMapping("saveTemplates") | |||
| @TenantIgnore | |||
| public ResultData saveFees(@RequestBody WxFinancePrintTemplate record) { | |||
| if (null == record.getTenantId()) { | |||
| return new ResultData(Result.ERROR,"参数不对"); | |||
| } | |||
| wxFinancePrintService.saveOrUpdate(record); | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -3,7 +3,9 @@ package com.iformall.print; | |||
| import lombok.Data; | |||
| import java.io.Serializable; | |||
| import java.util.ArrayList; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| @@ -28,6 +30,7 @@ public class PrintDataHandler implements Serializable { | |||
| txt.setIsEdit(data.getIsEdit()); | |||
| txt.setName(dataJson.getString("fieldName")); | |||
| txt.setValue("{"+data.getName()+"}"); | |||
| txt.setDefaultValue(txt.getTitle()); | |||
| return txt; | |||
| }else if ("braid-table".equals(data.getPrintDataType())) { | |||
| PrintDataBraidTable table = new PrintDataBraidTable(); | |||
| @@ -38,12 +41,15 @@ public class PrintDataHandler implements Serializable { | |||
| List<PrintDataBraidTableColumns> columnsAttr = new ArrayList<PrintDataBraidTableColumns>(); | |||
| JSONArray columns = dataJson.getJSONArray("columns"); | |||
| if (null != columns) { | |||
| List<Map> defaultvalues = new ArrayList<Map>(); | |||
| Map dv = new HashMap(); | |||
| for (int i = 0 ; i < columns.size() ; i ++) { | |||
| JSONObject o = columns.getJSONObject(i); | |||
| PrintDataBraidTableColumns tc = new PrintDataBraidTableColumns(); | |||
| tc.setTitle(o.getString("title")); | |||
| tc.setValue("{"+tc.getTitle()+"}"); | |||
| tc.setName(o.getString("fieldName")); | |||
| dv.put(tc.getName(), tc.getTitle()); | |||
| columnsAttr.add(tc); | |||
| JSONObject trsets = o.getJSONObject("trSet"); | |||
| if (null != trsets) { | |||
| @@ -53,8 +59,9 @@ public class PrintDataHandler implements Serializable { | |||
| ptrset.setMargin(trsets.getString("margin")); | |||
| tc.setTrSet(ptrset); | |||
| } | |||
| } | |||
| defaultvalues.add(dv); | |||
| table.setDefaultValue(defaultvalues); | |||
| } | |||
| table.setColumnsAttr(columnsAttr); | |||
| return table; | |||
| @@ -4,11 +4,13 @@ import lombok.Data; | |||
| import java.io.Serializable; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.domain.po.WxFinancePrintData; | |||
| import com.iformall.enums.EnumFinancePrintDataType; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.print.entity.PrintDataBraidTable; | |||
| import com.iformall.print.entity.PrintDataBraidTableColumns; | |||
| @@ -20,45 +22,11 @@ public class PrintDataParseHandler implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| public static Object parseData(WxFinancePrintData data) { | |||
| JSONObject dataJson = JSON.parseObject(data.getPrintDataJson()); | |||
| if("braid-txt".equals(data.getPrintDataType())) { | |||
| PrintDataBraidTxt txt = new PrintDataBraidTxt(); | |||
| txt.setTitle(data.getName()); | |||
| txt.setIsEdit(data.getIsEdit()); | |||
| txt.setName(dataJson.getString("fieldName")); | |||
| txt.setValue("{"+data.getName()+"}"); | |||
| return txt; | |||
| }else if ("braid-table".equals(data.getPrintDataType())) { | |||
| PrintDataBraidTable table = new PrintDataBraidTable(); | |||
| table.setTitle(data.getName()); | |||
| table.setIsEdit(data.getIsEdit()); | |||
| table.setName(dataJson.getString("fieldName")); | |||
| table.setValue("{"+data.getName()+"}"); | |||
| List<PrintDataBraidTableColumns> columnsAttr = new ArrayList<PrintDataBraidTableColumns>(); | |||
| JSONArray columns = dataJson.getJSONArray("columns"); | |||
| if (null != columns) { | |||
| for (int i = 0 ; i < columns.size() ; i ++) { | |||
| JSONObject o = columns.getJSONObject(i); | |||
| PrintDataBraidTableColumns tc = new PrintDataBraidTableColumns(); | |||
| tc.setTitle(o.getString("title")); | |||
| tc.setValue("{"+tc.getTitle()+"}"); | |||
| tc.setName(o.getString("fieldName")); | |||
| columnsAttr.add(tc); | |||
| JSONObject trsets = o.getJSONObject("trSet"); | |||
| if (null != trsets) { | |||
| PrintDataBraidTableColumnsTrSet ptrset = new PrintDataBraidTableColumnsTrSet(); | |||
| ptrset.setTitle(trsets.getString("title")); | |||
| ptrset.setCol(trsets.getInteger("col")); | |||
| ptrset.setMargin(trsets.getString("margin")); | |||
| tc.setTrSet(ptrset); | |||
| } | |||
| } | |||
| } | |||
| table.setColumnsAttr(columnsAttr); | |||
| return table; | |||
| } | |||
| //根据类型来解析传进来的对象 | |||
| private Map<String,Object> getComponentValuesMap(EnumFinancePrintDataType type,Object object) { | |||
| return null; | |||
| } | |||
| public static JSONObject parseData(EnumFinancePrintDataType type,WxFinancePrintData data,Map<String,Object> valueMap) { | |||
| return null; | |||
| } | |||
| @@ -20,7 +20,7 @@ public class PrintDataBraidTable implements Serializable { | |||
| //打印项内容 | |||
| private String value; | |||
| //打印项默认内容 | |||
| private List<Object> defaultValue; | |||
| private List defaultValue; | |||
| private String tabelHtml; | |||
| //表格列 | |||
| private List<PrintDataBraidTableColumns> columnsAttr; | |||
| @@ -0,0 +1,36 @@ | |||
| package com.iformall.print.entity; | |||
| import lombok.Data; | |||
| import java.io.Serializable; | |||
| @Data | |||
| public class PrintTemplate implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| private Integer defaultValue = 0; | |||
| //是否可编辑 | |||
| private String title; | |||
| //类型 | |||
| private Integer type; | |||
| //动态打印项数据名称(对应打印数据 key-name) | |||
| private String name; | |||
| //打印项内容 | |||
| private String value; | |||
| // //是否可拖拽 | |||
| // private Boolean dragable; | |||
| // //尺寸是否可变 | |||
| // private Boolean resizable; | |||
| // //打印项宽度(px) | |||
| // private BigDecimal width; | |||
| // //打印项高度(px) | |||
| // private BigDecimal height; | |||
| // //左偏移量(px) | |||
| // private BigDecimal left; | |||
| // //上偏移量(px) | |||
| // private BigDecimal top; | |||
| //LODOP 默认打印项样式 | |||
| //private lodopStyle; | |||
| } | |||
| @@ -10,5 +10,7 @@ public interface WxFinancePrintService { | |||
| List<WxFinancePrintData> printDataList(WxFinancePrintData record); | |||
| List<WxFinancePrintTemplate> printTemplateList(WxFinancePrintTemplate record); | |||
| WxFinancePrintTemplate getTemplateById(Long id); | |||
| void saveOrUpdate(WxFinancePrintTemplate record); | |||
| } | |||
| @@ -38,5 +38,10 @@ public class WxFinancePrintServiceImpl implements WxFinancePrintService { | |||
| return wxFinancePrintTemplateMapper.selectById(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxFinancePrintTemplate record) { | |||
| } | |||
| } | |||