| | |
| | | import com.consum.base.pojo.LWhFormTransferGoodsInfoParam; |
| | | import com.consum.base.pojo.LWhProcureModelUserParam; |
| | | import com.consum.base.pojo.LWhTransferModelParam; |
| | | import com.consum.base.pojo.excel.TemplateExcelTransfer; |
| | | import com.consum.base.pojo.excel.TransferExcelTemplate; |
| | | import com.consum.base.pojo.query.TransferQry; |
| | | import com.consum.base.pojo.request.LWhFormTransferParam; |
| | | import com.consum.base.pojo.response.DepartGoodsUseInfo; |
| | |
| | | import com.consum.base.pojo.response.LWHFromTransferExtendVO; |
| | | import com.consum.model.po.*; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import org.apache.commons.compress.utils.Lists; |
| | |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/31 |
| | | */ |
| | | public Map<String, Object> export(Long id, Integer type) { |
| | | public List<TransferExcelTemplate> export(Long id, Integer type) { |
| | | String sql = "SELECT\n" |
| | | + "\tft.BUSINESS_FORM_CODE,\n" |
| | | + "\tft.OPERATOR_NAME,\n" |
| | | + "\tft.CREATE_TIME,\n" |
| | | + "\tft.IN_AGENCY_NAME,\n" |
| | | + "\tft.OUT_AGENCY_NAME,\n" |
| | | + "\tGOODS_NAME,\n" |
| | | + "\tpm.BASE_GOODS_MODELS_NAME,\n" |
| | | + "\tGOODS_NAME templateName,\n" |
| | | + "\tpm.BASE_GOODS_MODELS_NAME baseModelName,\n" |
| | | + "\tpm.COUNTS num,\n" |
| | | + "\tpm.PRICE,\n" |
| | | + "\tpm.total_amount,\n" |
| | | + "\tft.BEIZ1 remark\n" |
| | | + "FROM\n" |
| | |
| | | Map<String, Object> paramts = new HashMap<>(); |
| | | paramts.put("id", id); |
| | | List<Map<String, Object>> select = this.select(sql, paramts, new MapperUtil()); |
| | | List<TemplateExcelTransfer> list = Lists.newArrayList(); |
| | | List<TransferExcelTemplate> list = Lists.newArrayList(); |
| | | select.forEach(item -> { |
| | | TemplateExcelTransfer templateExcelTransfer = MapUtils.convertMapToObj(item, TemplateExcelTransfer.class); |
| | | TransferExcelTemplate templateExcelTransfer = MapUtils.convertMapToObj(item, TransferExcelTemplate.class); |
| | | if (type == 1) { |
| | | templateExcelTransfer.setTenantName(templateExcelTransfer.getOutAgencyName()); |
| | | } else { |
| | |
| | | list.add(templateExcelTransfer); |
| | | }); |
| | | |
| | | int countNum = list.stream().filter(item -> item.getNum() != null).mapToInt(TemplateExcelTransfer::getNum).sum(); |
| | | int totalAmount = list.stream().filter(export -> export.getTotalAmount() != null).mapToInt(TemplateExcelTransfer::getTotalAmount).sum(); |
| | | Optional<TemplateExcelTransfer> first = list.stream().findFirst(); |
| | | TemplateExcelTransfer entity = first.get(); |
| | | String businessFormCode = entity.getBusinessFormCode(); |
| | | Long createTime = entity.getCreateTime(); |
| | | String operatorName = entity.getOperatorName(); |
| | | String tenantName; |
| | | if (type == 1) { |
| | | tenantName = entity.getInAgencyName(); |
| | | } else { |
| | | tenantName = entity.getOutAgencyName(); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("code", businessFormCode); |
| | | map.put("date", DateUtils.toShowDate(createTime)); |
| | | map.put("tenantName", tenantName); |
| | | map.put("name", operatorName); |
| | | map.put("countNum", countNum); |
| | | map.put("totalAmount", totalAmount); |
| | | map.put("data", list); |
| | | |
| | | return map; |
| | | return list; |
| | | } |
| | | |
| | | /** |