| | |
| | | import com.consum.base.pojo.LWFormsOutputGoodsInfoParam; |
| | | import com.consum.base.pojo.LWFormsOutputGoodsModelParam; |
| | | import com.consum.base.pojo.LWhFormOutputParam; |
| | | import com.consum.base.pojo.excel.TemplateExcelExport; |
| | | import com.consum.base.pojo.excel.OutputExcelTemplate; |
| | | import com.consum.base.pojo.query.LWhFormOutputQry; |
| | | import com.consum.model.po.BaseGoodsModels; |
| | | import com.consum.model.po.BaseWarehouse; |
| | |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | } |
| | | |
| | | public Map<String, Object> getExportList(Long id, String userName) { |
| | | public List<OutputExcelTemplate> getExportList(Long id) { |
| | | String sql = "SELECT\n" |
| | | + "\tfo.BUSINESS_FORM_CODE,\n" |
| | | + "\tfo.AGENCY_NAME tenantName,\n" |
| | | + "\tGOODS_NAME goodsName,\n" |
| | | + "\tpm.BASE_GOODS_MODELS_NAME goodsModeName,\n" |
| | | + "\tGOODS_NAME templateName,\n" |
| | | + "\tpm.BASE_GOODS_MODELS_NAME baseModelName,\n" |
| | | + "\tcounts num,\n" |
| | | + "\ttotal_amount totalAmount,\n" |
| | | + "\tfo.DEAL_TIME createTime,\n" |
| | |
| | | if (CollectionUtils.isEmpty(select)) { |
| | | return null; |
| | | } |
| | | List<TemplateExcelExport> list = Lists.newArrayList(); |
| | | List<OutputExcelTemplate> list = Lists.newArrayList(); |
| | | select.forEach(item -> { |
| | | TemplateExcelExport templateExcelExport = MapUtils.convertMapToObj(item, TemplateExcelExport.class); |
| | | templateExcelExport.setTenantName(StringUtils.isNotEmpty(templateExcelExport.getTenantName()) ? templateExcelExport.getTenantName() : ""); |
| | | templateExcelExport.setRemark(StringUtils.isNotEmpty(templateExcelExport.getRemark()) ? templateExcelExport.getRemark() : ""); |
| | | templateExcelExport.setTotalAmount(templateExcelExport.getTotalAmount() == null ? 0 : templateExcelExport.getTotalAmount()); |
| | | templateExcelExport.setNum(templateExcelExport.getNum() == null ? 0 : templateExcelExport.getNum()); |
| | | OutputExcelTemplate templateExcelExport = MapUtils.convertMapToObj(item, OutputExcelTemplate.class); |
| | | list.add(templateExcelExport); |
| | | }); |
| | | int sum = list.stream().filter(item -> item.getNum() != null).mapToInt(TemplateExcelExport::getNum).sum(); |
| | | int totalAmount = list.stream().filter(export -> export.getTotalAmount() != null).mapToInt(TemplateExcelExport::getTotalAmount).sum(); |
| | | Optional<TemplateExcelExport> first = list.stream().findFirst(); |
| | | TemplateExcelExport templateExcelExport = first.get(); |
| | | String businessFormCode = templateExcelExport.getBusinessFormCode(); |
| | | Long createTime = templateExcelExport.getCreateTime(); |
| | | String operatorName = templateExcelExport.getOperatorName(); |
| | | return list; |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("code", businessFormCode); |
| | | map.put("date", DateUtils.toShowDate(createTime)); |
| | | map.put("name", operatorName); |
| | | map.put("sum", sum); |
| | | map.put("totalAmount", totalAmount); |
| | | map.put("data", list); |
| | | return map; |
| | | } |
| | | |
| | | } |