| | |
| | | import com.consum.base.core.utils.CommonUtil; |
| | | import com.consum.base.core.utils.MapUtils; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.core.utils.PageUtil; |
| | | import com.consum.base.pojo.LWhFormOutputParam; |
| | | import com.consum.base.pojo.query.LWhFormOutputQry; |
| | | import com.consum.base.pojo.response.FormOutputGoodsVO; |
| | |
| | | import com.consum.base.pojo.response.LWhFormOutputExtendVO; |
| | | import com.consum.base.service.LWarehouseFlowService; |
| | | import com.consum.base.service.LWhFormOutputServiceImpl; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.base.service.LWhProcureModelService; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LWhFormOutput; |
| | | 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.web.ResponseValue; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.lang.reflect.Field; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.core.io.ClassPathResource; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | private LWhFormOutputServiceImpl lWhFormOutputService; |
| | | @Autowired |
| | | private LWhProcureModelService lWhProcureModelService; |
| | | @Autowired |
| | | private LWhGoodsService lWhGoodsService; |
| | | @Resource |
| | | private LWarehouseFlowService lWarehouseFlowService; |
| | | |
| | |
| | | if (currentUser == null) { |
| | | return ResponseValue.error("ç»å½ç¨æ·ä¿¡æ¯ä¸åå¨"); |
| | | } |
| | | GenericPager<Map<String, Object>> genericPager = lWarehouseFlowService.queryAllBusinessFlow(formOutputQry); |
| | | PageUtil genericPager = lWarehouseFlowService.queryAllBusinessFlow(formOutputQry); |
| | | return ResponseValue.success(genericPager); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "åºåºå导åº", notes = "åºåºå导åº") |
| | | @GetMapping("/list/export") |
| | | public void export(Long id, HttpServletRequest request, HttpServletResponse response) throws IOException { |
| | | TemplateExportParams params = new TemplateExportParams( |
| | | "import/éè´éè´§å.xls"); |
| | | public void export(Long id, HttpServletResponse response) throws IOException { |
| | | ClassPathResource classPathResource = new ClassPathResource("import/éè´éè´§å.xls"); |
| | | // è·åæä»¶è¾å
¥æµ |
| | | InputStream inputStream = classPathResource.getInputStream(); |
| | | Workbook wb = new HSSFWorkbook(inputStream); |
| | | TemplateExportParams params = new TemplateExportParams(); |
| | | params.setTemplateWb(wb); |
| | | |
| | | FinSysTenantUser sysInfo = this.getSysInfo(); |
| | | String userName = sysInfo.getUserName(); |
| | | |
| | | 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" |
| | | + "\tcounts num,\n" |
| | | + "\ttotal_amount sqje,\n" |
| | | + "\tBEIZ remark\n" |
| | | + "FROM\n" |
| | | + "\tl_wh_procure_model pm\n" |
| | | + "\tLEFT JOIN base_goods_models bgm ON pm.BASE_GOODS_MODELS_ID = bgm.id\n" |
| | | + "\tLEFT JOIN base_goods_template bgt ON bgm.GOODS_TEMPLATES_ID = bgt.id\n" |
| | | + "\tLEFT JOIN l_wh_form_output fo ON fo.ID = pm.BUSINESS_ID\n" |
| | | + "WHERE\n" |
| | | + "\tpm.BUSINESS_ID = 1393373943914496"; |
| | | |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("id", id); |
| | | List<Map<String, Object>> select = lWhFormOutputService.select(sql, param, new MapperUtil()); |
| | | |
| | | String dateForHuman = DateUtils.getDateForHuman(System.currentTimeMillis()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | //è·åselectä¸çBUSINESS_FORM_CODEå¼ï¼ |
| | | for (Map<String, Object> item : select) { |
| | | String businessFormCode = (String) item.get("businessFormCode"); |
| | | map.put("code", businessFormCode); |
| | | Object num = item.get("num"); |
| | | map.put("numCount", 100); |
| | | map.put("amountCount", 100); |
| | | Map<String, Object> map = lWhFormOutputService.getExportList(id, userName); |
| | | if (CollectionUtils.isEmpty(map)) { |
| | | throw new RuntimeException("æ°æ®ä¸ºç©º"); |
| | | } |
| | | List<Map<String, String>> listMap = new ArrayList<>(); |
| | | map.put("code", "è´°ä½°ä¸"); |
| | | map.put("date", dateForHuman); |
| | | map.put("name", userName); |
| | | // for (int i = 0; i < 4; i++) { |
| | | // Map<String, String> lm = new HashMap<>(); |
| | | // lm.put("tenantName", i + 1 + ""); |
| | | // lm.put("goodsName", "A001"); |
| | | // lm.put("goodsModeName", "设计"); |
| | | // lm.put("num", "EasyPoi " + i + "æ"); |
| | | // lm.put("price", "弿ºé¡¹ç®"); |
| | | // lm.put("sqje", i * 10000 + ""); |
| | | // lm.put("remark", i * 10000 + ""); |
| | | // listMap.add(lm); |
| | | // } |
| | | map.put("maplist", select); |
| | | |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, map); |
| | | downLoadExcel("111", response, workbook); |
| | | |
| | | try (OutputStream outputStream = response.getOutputStream()) { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("éè´éè´§å.xls", "utf-8")); |
| | | workbook.write(outputStream); |
| | | workbook.close(); |
| | | // try (OutputStream outputStream = response.getOutputStream()) { |
| | | // response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); |
| | | // response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("éè´éè´§å1.xlsx", "utf-8")); |
| | | // workbook.write(outputStream); |
| | | // workbook.close(); |
| | | // } |
| | | } |
| | | |
| | | private void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) throws IOException { |
| | | try (OutputStream out = response.getOutputStream()) { |
| | | response.setCharacterEncoding("UTF-8"); |
| | | response.setHeader("content-Type", "application/vnd.ms-excel"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName + ".xls", "UTF-8")); |
| | | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| | | workbook.write(baos); |
| | | response.setHeader("Content-Length", String.valueOf(baos.size())); |
| | | out.write(baos.toByteArray()); |
| | | } catch (Exception e) { |
| | | try { |
| | | throw new Exception(e.getMessage()); |
| | | } catch (Exception e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | package com.consum.base.controller; |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
| | | import cn.hutool.core.util.ReflectUtil; |
| | | import com.consum.base.BaseController; |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | |
| | | import com.consum.base.pojo.LWhFormProcureParam; |
| | | import com.consum.base.pojo.LWhProcureModelParam; |
| | | import com.consum.base.pojo.query.FormProcureQry; |
| | | import com.consum.base.pojo.response.*; |
| | | import com.consum.base.service.*; |
| | | import com.consum.model.po.*; |
| | | import com.consum.base.pojo.response.FormProcureVO; |
| | | import com.consum.base.pojo.response.FromProcureTemplateInfoVO; |
| | | import com.consum.base.pojo.response.GoodsModelVO; |
| | | import com.consum.base.pojo.response.LWhFormProcureExtendVO; |
| | | import com.consum.base.pojo.response.LWhFormProcureGoodsVO; |
| | | import com.consum.base.service.BaseGoodsTemplateServiceImpl; |
| | | import com.consum.base.service.BaseWarehouseServiceImpl; |
| | | import com.consum.base.service.LOrgSupplierServiceImpl; |
| | | import com.consum.base.service.LWhFormProcureCoreService; |
| | | import com.consum.base.service.LWhFormProcureGoodsService; |
| | | import com.consum.base.service.LWhFormProcureService; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.base.service.LWhProcureModelService; |
| | | import com.consum.model.po.BaseGoodsTemplate; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LOrgSupplier; |
| | | import com.consum.model.po.LWhFormProcure; |
| | | import com.consum.model.po.LWhFormProcureGoods; |
| | | import com.consum.model.po.LWhProcureModel; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.lang.reflect.Field; |
| | | import java.util.*; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @ClassName LWhFormProcureController |
| | |
| | | private LWhFormProcureService lWhFormProcureService; |
| | | @Resource |
| | | private BaseWarehouseServiceImpl baseWarehouseService; |
| | | @Resource |
| | | private FinSysTenantServiceImpl finSysTenantService; |
| | | @Resource |
| | | private CodeGeneratorService codeGeneratorService; |
| | | @Resource |
| | |
| | | */ |
| | | @ApiOperation(value = "éè´åå表æ¥è¯¢", notes = "éè´åå表æ¥è¯¢") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "param", value = "éè´æ¥è¯¢æ¡ä»¶", required = true, dataType = "FormProcureQryDto", paramType = "query") |
| | | @ApiImplicitParam(name = "param", value = "éè´æ¥è¯¢æ¡ä»¶", required = true, dataType = "FormProcureQryDto", paramType = "query") |
| | | }) |
| | | @GetMapping("/list") |
| | | public ResponseValue queryFormProcureList() { |
| | |
| | | |
| | | // æ¥è¯¢åå·æ°é |
| | | String sql = "select fpg.id,BASE_CATEGORY_ID ,BASE_GOODS_TEMPLATE_ID ,GOODS_TEMPLATE_NAME ,sum(counts) count " |
| | | + "from L_WH_FORM_PROCURE_GOODS fpg left join L_WH_PROCURE_MODEL pm on fpg.id = pm.FROM_PROCURE_GOODS_ID " |
| | | + "where fpg.WH_FORM_PROCURE_ID =:id group by pm.FROM_PROCURE_GOODS_ID"; |
| | | + "from L_WH_FORM_PROCURE_GOODS fpg left join L_WH_PROCURE_MODEL pm on fpg.id = pm.FROM_PROCURE_GOODS_ID " |
| | | + "where fpg.WH_FORM_PROCURE_ID =:id group by pm.FROM_PROCURE_GOODS_ID"; |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("id", item.getId()); |
| | | List<Map<String, Object>> procureModelList = lWhProcureModelService.select(sql, paramMap, new MapperUtil()); |
| | |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("formProcureGoodId", formProcureGood.getId()); |
| | | String sql = "SELECT\n" + "pm.BASE_GOODS_MODELS_ID,pm.BASE_GOODS_MODELS_NAME,pm.PRICE,pm.COUNTS,pm.WOREHOUSE_COUNT,bgm.unit " + "FROM\n" |
| | | + "\tl_wh_procure_model pm\n" |
| | | + "\tLEFT JOIN base_goods_models bgm on pm.BASE_GOODS_MODELS_ID = bgm.id where pm.FROM_PROCURE_GOODS_ID =:formProcureGoodId"; |
| | | + "\tl_wh_procure_model pm\n" |
| | | + "\tLEFT JOIN base_goods_models bgm on pm.BASE_GOODS_MODELS_ID = bgm.id where pm.FROM_PROCURE_GOODS_ID =:formProcureGoodId"; |
| | | List<Map<String, Object>> procureModelList = lWhProcureModelService.select(sql, paramMap, new MapperUtil()); |
| | | List<GoodsModelVO> goodsModelVOList = Lists.newArrayList(); |
| | | procureModelList.forEach(item -> { |
| | |
| | | GenericPager genericPager = lWhFormProcureService.queryFormProcureDetailList(formProcureQry); |
| | | return ResponseValue.success(genericPager); |
| | | } |
| | | |
| | | @ApiOperation(value = "éè´å导åº", notes = "éè´å导åº") |
| | | @GetMapping("/list/export") |
| | | public void export(Long id, HttpServletResponse response) throws IOException { |
| | | TemplateExportParams params = new TemplateExportParams( |
| | | "import/éè´å
¥åºå.xlsx"); |
| | | |
| | | FinSysTenantUser sysInfo = this.getSysInfo(); |
| | | String userName = sysInfo.getUserName(); |
| | | |
| | | Map<String, Object> map = lWhFormProcureService.getExportList(id, userName); |
| | | if (CollectionUtils.isEmpty(map)) { |
| | | throw new RuntimeException("æ°æ®ä¸ºç©º"); |
| | | } |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, map); |
| | | |
| | | try (OutputStream outputStream = response.getOutputStream()) { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("éè´å
¥åºå.xls", "utf-8")); |
| | | workbook.write(outputStream); |
| | | workbook.close(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.consum.base.core.utils; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author asus |
| | | * @version 1.0 |
| | | * @description: åºå
¥åºæç»ç¶æ |
| | | * @date 2023/11/14 16:19 |
| | | */ |
| | | public class MixType { |
| | | |
| | | private final static Map<String, String> map = new HashMap<>(); |
| | | |
| | | static { |
| | | // åæ®ç±»å 1 éè´2 è°æ¨ 3åºåº4é¨é¨åå |
| | | // 1=è°å¢ï¼2=è°å |
| | | //1éè´å
¥åº |
| | | map.put("1" + "1", "1"); |
| | | //2éè¿å
¥åº |
| | | map.put("2" + "1", "2"); |
| | | //3è°æ¨å
¥åº |
| | | map.put("3" + "1", "3"); |
| | | //4ççå
¥åº |
| | | map.put("7" + "1", "4"); |
| | | //5ç³é¢åºåº |
| | | map.put("4" + "2", "5"); |
| | | //6è°æ¨åºåº |
| | | map.put("2" + "2", "6"); |
| | | //7çäºåºåº |
| | | map.put("7" + "2", "7"); |
| | | //8æ¥åºåºåº |
| | | map.put("5" + "2", "8"); |
| | | //9å
¶ä»åºåº |
| | | map.put("3" + "2", "9"); |
| | | } |
| | | |
| | | public static String getMixType(String key) { |
| | | return map.get(key); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.consum.base.pojo.excel; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author asus |
| | | * @version 1.0 |
| | | * @description: 导åºè½¬æ¢å¯¹è±¡ |
| | | * @date 2023/11/27 15:31 |
| | | */ |
| | | @Data |
| | | public class TemplateExcelExport { |
| | | |
| | | |
| | | private String businessFormCode; |
| | | |
| | | private String tenantName; |
| | | |
| | | private String goodsName; |
| | | |
| | | private String goodsModeName; |
| | | |
| | | private Integer num; |
| | | |
| | | private Integer totalAmount; |
| | | |
| | | private String remark; |
| | | |
| | | private int price; |
| | | |
| | | private String warehouseName; |
| | | } |
| | |
| | | * ç©å模çåç§° |
| | | */ |
| | | @ApiModelProperty(value = "ç©å模çåç§°") |
| | | private String goodsTempName; |
| | | /** |
| | | * ç©å模çåç§° |
| | | */ |
| | | @ApiModelProperty(value = "ç©å模çid") |
| | | private String goodsTemplateId; |
| | | /** |
| | | * ç©å模çåç§° |
| | | */ |
| | | @ApiModelProperty(value = "ç©å模çåç§°") |
| | | private String goodsName; |
| | | /** |
| | | * ç©å模çåç§° |
| | | */ |
| | | @ApiModelProperty(value = "ç©å模çid") |
| | | private String baseGoodsId; |
| | | |
| | | /** |
| | | * æºæ |
| | | */ |
| | |
| | | * ç³é¢åºåº map.put("4" + "2", "7") |
| | | */ |
| | | @ApiModelProperty(value = "1éè´å
¥åº 2éè¿å
¥åº 3è°æ¨å
¥åº 4ççå
¥åº 5ç³é¢åºåº 6è°æ¨åºåº 7çäºåºåº 8æ¥åºåºåº 9å
¶ä»åºåº") |
| | | private Integer flowType; |
| | | |
| | | @ApiModelProperty(value = "ç¶æ") |
| | | private Integer states; |
| | | |
| | | /** |
| | |
| | | private String agencyName; |
| | | private String operatorName; |
| | | private Long operatorTime; |
| | | private Long warehouseFormCode; |
| | | private String warehouseFormCode; |
| | | |
| | | } |
| | |
| | | private String departmentName; |
| | | |
| | | @ApiModelProperty(value = "çµè¯") |
| | | private String tel; |
| | | private Long tel; |
| | | |
| | | private List<FormTransferGoodsVO> formTransferGoods; |
| | | } |
New file |
| | |
| | | package com.consum.base.pojo.response; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * @author asus |
| | | * @version 1.0 |
| | | * @description: TODO |
| | | * @date 2023/11/28 11:25 |
| | | */ |
| | | @NoArgsConstructor |
| | | @Data |
| | | public class OutAndInDetailVO { |
| | | |
| | | @JsonProperty("id") |
| | | private Long id; |
| | | @JsonProperty("thisType") |
| | | private Integer thisType; |
| | | @JsonProperty("dealTime") |
| | | private Long dealTime; |
| | | @JsonProperty("totalPrice") |
| | | private Integer totalPrice; |
| | | @JsonProperty("businessFormCode") |
| | | private String businessFormCode; |
| | | @JsonProperty("baseGoodsModelsName") |
| | | private String baseGoodsModelsName; |
| | | @JsonProperty("businessType") |
| | | private Integer businessType; |
| | | @JsonProperty("thisCount") |
| | | private Integer thisCount; |
| | | @JsonProperty("operatorName") |
| | | private String operatorName; |
| | | @JsonProperty("agencyName") |
| | | private String agencyName; |
| | | @JsonProperty("goodsTemplateName") |
| | | private String goodsTemplateName; |
| | | private String mixType; |
| | | } |
| | |
| | | |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.utils.MapRowMapper; |
| | | import com.consum.base.core.utils.MapUtils; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.core.utils.MixType; |
| | | import com.consum.base.core.utils.PageUtil; |
| | | import com.consum.base.pojo.LWarehouseFlowParam; |
| | | import com.consum.base.pojo.query.LWhFormOutputQry; |
| | | import com.consum.base.pojo.response.OutAndInDetailVO; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | |
| | | return selectSplit(sql.toString(), paramts, param.getPageNum(), param.getPageSize(), new MapRowMapper()); |
| | | } |
| | | |
| | | public GenericPager<Map<String, Object>> queryBusinessFlowDetail(LWhFormOutputQry param) { |
| | | StringBuilder sql = new StringBuilder(QUERY_BUSINESS_FLOW); |
| | | Map<String, Object> paramts = new HashMap<>(); |
| | | if (StringUtils.isNotEmpty(param.getBusinessFormCode())) { |
| | | sql.append("AND CASE WHEN flow.BUSINESS_TYPE = 1 THEN tCaiGou.BUSINESS_FORM_CODE=:businessFormCode" |
| | | + " WHEN flow.BUSINESS_TYPE = 3 THEN tFormOut.BUSINESS_FORM_CODE=:businessFormCode END "); |
| | | paramts.put("businessFormCode", param.getBusinessFormCode()); |
| | | } |
| | | if (StringUtils.isNotEmpty(param.getGoodsName())) { |
| | | sql.append("AND record.GOODS_TEMPLATE_NAME like :goodsTemplateName "); |
| | | paramts.put("goodsTemplateName", StringUtils.CHAR_PERCENT + param.getGoodsName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | |
| | | if (param.getBaseGoodsModelsId() != null) { |
| | | sql.append("AND record.BASE_GOODS_MODELS_ID =:baseGoodsModelsId "); |
| | | paramts.put("baseGoodsModelsId", param.getBaseGoodsModelsId()); |
| | | } |
| | | if (param.getAgencyId() != null) { |
| | | sql.append("AND tCaiGou.AGENCY_id=:agencyId "); |
| | | paramts.put("agencyId", param.getAgencyId()); |
| | | } |
| | | |
| | | if (StringUtils.isNotEmpty(param.getCreateName())) { |
| | | sql.append("AND CASE WHEN flow.BUSINESS_TYPE = 1 THEN tCaiGou.BUYER_NAME = :createdName" |
| | | + " WHEN flow.BUSINESS_TYPE = 3 THEN tFormOut.OPERATOR_NAME = :createdName END "); |
| | | paramts.put("createdName", param.getCreateName()); |
| | | } |
| | | if (param.getStartTime() != null) { |
| | | sql.append("and flow.DEAL_TIME >=:dealTimeStart "); |
| | | paramts.put("dealTimeStart", param.getStartTime() * 1000000); |
| | | } |
| | | if (param.getEndTime() != null) { |
| | | sql.append("and flow.DEAL_TIME <:dealTimeEnd "); |
| | | paramts.put("dealTimeEnd", param.getEndTime() * 1000000 + 240000); |
| | | } |
| | | if (param.getStates() != null) { |
| | | |
| | | switch (param.getStates()) { |
| | | case 1: |
| | | sql.append("and flow.BUSINESS_TYPE =:businessType"); |
| | | break; |
| | | case 2: |
| | | sql.append("and flow.FLOW_STATE = 2 "); |
| | | break; |
| | | default: |
| | | sql.append("and flow.FLOW_STATE = 3 "); |
| | | } |
| | | |
| | | } |
| | | |
| | | // if (param.getBusinessType() != null) { |
| | | // sql.append(" and flow.BUSINESS_TYPE =:businessType"); |
| | | // paramts.put("businessType", param.getBusinessType()); |
| | | // } |
| | | |
| | | return selectSplit(sql.toString(), paramts, param.getPageNum(), param.getPageSize(), new MapperUtil()); |
| | | } |
| | | |
| | | /** |
| | | * å°è´¦æ¥è¯¢ |
| | |
| | | } |
| | | |
| | | |
| | | public GenericPager<Map<String, Object>> queryAllBusinessFlow(LWhFormOutputQry param) { |
| | | public PageUtil queryAllBusinessFlow(LWhFormOutputQry param) { |
| | | StringBuilder sql = new StringBuilder("SELECT\n" |
| | | + "CASE WHEN flow.BUSINESS_TYPE=1 THEN tCaiGou.id \n" |
| | | + "WHEN (flow.BUSINESS_TYPE=2 OR flow.BUSINESS_TYPE=4 OR flow.BUSINESS_TYPE=6) THEN tTrans.id \n" |
| | |
| | | } |
| | | |
| | | //ç©ååç§° |
| | | if (StringUtils.isNotEmpty(param.getGoodsName())) { |
| | | if (StringUtils.isNotEmpty(param.getGoodsTempName())) { |
| | | sql.append(" AND record.GOODS_TEMPLATE_NAME like :goodsTemplateName"); |
| | | paramts.put("goodsTemplateName", StringUtils.CHAR_PERCENT + param.getGoodsName() + StringUtils.CHAR_PERCENT); |
| | | paramts.put("goodsTemplateName", StringUtils.CHAR_PERCENT + param.getGoodsTempName() + StringUtils.CHAR_PERCENT); |
| | | } |
| | | if (param.getBaseGoodsId() != null) { |
| | | sql.append(" AND record.BASE_GOODS_TEMPLATE_ID=:goodsTemplateId"); |
| | | paramts.put("goodsTemplateId", param.getBaseGoodsId()); |
| | | if (param.getGoodsTemplateId() != null) { |
| | | sql.append(" AND record.BASE_GOODS_TEMPLATE_ID =:goodsTemplateId"); |
| | | paramts.put("goodsTemplateId", param.getGoodsTemplateId()); |
| | | } |
| | | //è§æ ¼åå· |
| | | if (param.getBaseGoodsModelsId() != null) { |
| | |
| | | paramts.put("baseGoodsModelsId", param.getBaseGoodsModelsId()); |
| | | } |
| | | // åç 表ï¼1éè´å
¥åº 2éè¿å
¥åº 3è°æ¨å
¥åº 4ççå
¥åº 5ç³é¢åºåº 6è°æ¨åºåº 7çäºåºåº 8æ¥åºåºåº 9å
¶ä»åºåº |
| | | Integer flowType = param.getStates(); |
| | | Integer flowType = param.getFlowType(); |
| | | if (flowType != null) { |
| | | Map<String, Short> typeByFlowType = WhBusinessEnum.getTypeByFlowType(flowType.shortValue()); |
| | | //æ¬æ¬¡è°æ´ç±»åï¼1=è°å¢ï¼2=è°åï¼ |
| | |
| | | paramts.put("dealTimeEnd", param.getEndTime() * 1000000 + 240000); |
| | | } |
| | | sql.append(" ORDER BY record.DEAL_TIME desc,record.id DESC "); |
| | | return selectSplit(sql.toString(), paramts, param.getPageNum(), param.getPageSize(), new MapperUtil()); |
| | | GenericPager<Map<String, Object>> mapGenericPager = selectSplit(sql.toString(), paramts, param.getPageNum(), param.getPageSize(), new MapperUtil()); |
| | | PageUtil pageUtil = new PageUtil(mapGenericPager); |
| | | List<OutAndInDetailVO> result = Lists.newArrayList(); |
| | | mapGenericPager.getDatas().forEach(map -> { |
| | | OutAndInDetailVO outAndInDetailVO = MapUtils.convertMapToObj(map, OutAndInDetailVO.class); |
| | | Integer thisType = outAndInDetailVO.getThisType(); |
| | | Integer businessType = outAndInDetailVO.getBusinessType(); |
| | | String mixType = MixType.getMixType(businessType + "" + thisType); |
| | | outAndInDetailVO.setMixType(mixType); |
| | | result.add(outAndInDetailVO); |
| | | }); |
| | | pageUtil.setDatas(result); |
| | | return pageUtil; |
| | | } |
| | | } |
| | |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.param.BaseWarehouseParam1; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.core.utils.MapUtils; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | 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.query.LWhFormOutputQry; |
| | | import com.consum.model.po.BaseGoodsModels; |
| | | import com.consum.model.po.BaseWarehouse; |
| | |
| | | import com.consum.model.po.LWhProcureModel; |
| | | 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; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | |
| | | |
| | | } |
| | | |
| | | public Map<String, Object> getExportList(Long id, String userName) { |
| | | 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" |
| | | + "\tcounts num,\n" |
| | | + "\ttotal_amount totalAmount,\n" |
| | | + "\tBEIZ remark\n" |
| | | + "FROM\n" |
| | | + "\tl_wh_procure_model pm\n" |
| | | + "\tLEFT JOIN base_goods_models bgm ON pm.BASE_GOODS_MODELS_ID = bgm.id\n" |
| | | + "\tLEFT JOIN base_goods_template bgt ON bgm.GOODS_TEMPLATES_ID = bgt.id\n" |
| | | + "\tLEFT JOIN l_wh_form_output fo ON fo.ID = pm.BUSINESS_ID\n" |
| | | + "WHERE\n" |
| | | + "\tpm.BUSINESS_ID = :id"; |
| | | |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("id", id); |
| | | List<Map<String, Object>> select = this.select(sql, param, new MapperUtil()); |
| | | if (CollectionUtils.isEmpty(select)) { |
| | | return null; |
| | | } |
| | | List<TemplateExcelExport> 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()); |
| | | 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(); |
| | | |
| | | String dateForHuman = DateUtils.getDateForHuman(System.currentTimeMillis()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("code", businessFormCode); |
| | | map.put("date", dateForHuman); |
| | | map.put("name", userName); |
| | | map.put("sum", sum); |
| | | map.put("totalAmount", totalAmount); |
| | | map.put("data", list); |
| | | return map; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import com.consum.base.core.utils.MapUtils; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.core.utils.PageUtil; |
| | | import com.consum.base.pojo.excel.TemplateExcelExport; |
| | | import com.consum.base.pojo.query.FormProcureQry; |
| | | import com.consum.model.po.LWhFormProcure; |
| | | 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.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | |
| | | |
| | | } |
| | | |
| | | public Map<String, Object> getExportList(Long id, String userName) { |
| | | String sql = "SELECT\n" |
| | | + "\tfp.BUSINESS_FORM_CODE,\n" |
| | | + "\tfp.AGENCY_NAME tenantName,\n" |
| | | + "\tGOODS_NAME goodsName,\n" |
| | | + "\tpm.BASE_GOODS_MODELS_NAME goodsModeName,\n" |
| | | + "\tcounts num,\n" |
| | | + "\tprice,\n" |
| | | + "\ttotal_amount totalAmount,\n" |
| | | + "\tWAREHOUSE_NAME,\n" |
| | | + "\tBEIZ remark\n" |
| | | + "FROM\n" |
| | | + "\tl_wh_procure_model pm\n" |
| | | + "\tLEFT JOIN base_goods_models bgm ON pm.BASE_GOODS_MODELS_ID = bgm.id\n" |
| | | + "\tLEFT JOIN base_goods_template bgt ON bgm.GOODS_TEMPLATES_ID = bgt.id\n" |
| | | + "\tLEFT JOIN l_wh_form_procure fp ON fp.ID = pm.BUSINESS_ID\n" |
| | | + "WHERE\n" |
| | | + "\tpm.BUSINESS_ID = :id"; |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("id", id); |
| | | List<Map<String, Object>> select = this.select(sql, param, new MapperUtil()); |
| | | if (CollectionUtils.isEmpty(select)) { |
| | | return null; |
| | | } |
| | | |
| | | List<TemplateExcelExport> list = Lists.newArrayList(); |
| | | select.forEach(item -> { |
| | | TemplateExcelExport templateExcelExport = MapUtils.convertMapToObj(item, TemplateExcelExport.class); |
| | | templateExcelExport.setTotalAmount(templateExcelExport.getTotalAmount() == null ? 0 : templateExcelExport.getTotalAmount()); |
| | | templateExcelExport.setNum(templateExcelExport.getNum() == null ? 0 : templateExcelExport.getNum()); |
| | | templateExcelExport.setTenantName(StringUtils.isNotEmpty(templateExcelExport.getTenantName()) ? templateExcelExport.getTenantName() : ""); |
| | | templateExcelExport.setRemark(StringUtils.isNotEmpty(templateExcelExport.getRemark()) ? templateExcelExport.getRemark() : ""); |
| | | 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(); |
| | | |
| | | String dateForHuman = DateUtils.getDateForHuman(System.currentTimeMillis()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("code", businessFormCode); |
| | | map.put("date", dateForHuman); |
| | | map.put("name", userName); |
| | | map.put("sum", sum); |
| | | map.put("totalAmount", totalAmount); |
| | | map.put("data", list); |
| | | return map; |
| | | |
| | | } |
| | | } |
| | |
| | | //ä»å½åç»å½åºç®¡äººä»åºä¸åºåºï¼å
¥å°æéé¨é¨çä¸ |
| | | |
| | | //æ¥è¯¢åºç®¡åä¿¡æ¯åç¸å
³ä»åº |
| | | Long id = sysInfo.getSysUserId(); |
| | | Long id = sysInfo.getId(); |
| | | BaseWarehouseManager manager = new BaseWarehouseManager(); |
| | | manager.setManagerId(id); |
| | | List<BaseWarehouseManager> managerList = baseWarehouseManagerService.select(manager); |
| | | if (CollectionUtils.isEmpty(managerList)) { |
| | | log.error("åºç®¡åä¸åå¨"); |
| | | throw new Exception("åºç®¡åä¸åå¨"); |
| | | log.error("è¯¥ç¨æ·ä¸æ¯åºç®¡å"); |
| | | throw new Exception("è¯¥ç¨æ·ä¸æ¯åºç®¡å"); |
| | | } |
| | | Optional<BaseWarehouseManager> first = managerList.stream().findFirst(); |
| | | if (first.isPresent()) { |
| | |
| | | LWhFormTransfer lWhFormTransfer = this.get(new LWhFormTransfer(id)); |
| | | if (lWhFormTransfer != null) { |
| | | BeanUtils.copyProperties(lWhFormTransfer, result); |
| | | result.setDepartmentName(lWhFormTransfer.getInWarehouseName()); |
| | | } |
| | | |
| | | String sql = "SELECT bgt.id, CATEGORY_ID, CATEGORY_NAME, GOODS_NAME,bgt.CLASSIFICATION type " |
| | |
| | | }); |
| | | goodsModelVO.setUseInfo(departGoodsUseInfoList); |
| | | } |
| | | // TODO é¨é¨åç§° |
| | | // result.setDepartmentName(); |
| | | |
| | | } |
| | | goodsModelVOList.add(goodsModelVO); |
| | |
| | | HashMap<String, Object> paramts = new HashMap<>(); |
| | | StringBuilder sql = new StringBuilder( |
| | | "SELECT ft.id,ft.BUSINESS_FORM_CODE,bgt.GOODS_NAME,bgt.CLASSIFICATION type,bgm.id goodsModelId,bgm.MODEL_NAME goodsModelName,pm.COUNTS goodsCount,fst.`name` tenantName," |
| | | + "fstd.NAME departmentName,ft.OPERATOR_ID,ft.CREATE_TIME FROM l_wh_form_transfer ft " |
| | | + "ft.IN_WAREHOUSE_NAME departmentName,ft.OPERATOR_ID,ft.CREATE_TIME,ft.OPERATOR_NAME FROM l_wh_form_transfer ft " |
| | | + "inner JOIN l_wh_procure_model pm ON ft.ID = pm.BUSINESS_ID " + "inner JOIN base_goods_models bgm ON bgm.id = pm.BASE_GOODS_MODELS_ID " |
| | | + "inner JOIN base_goods_template bgt ON bgt.id = bgm.GOODS_TEMPLATES_ID " + "inner JOIN fin_sys_tenant_user fstu ON fstu.id = ft.OPERATOR_ID " |
| | | + "inner JOIN base_goods_template bgt ON bgt.id = bgm.GOODS_TEMPLATES_ID " |
| | | + "inner JOIN fin_sys_tenant_user fstu ON fstu.id = ft.OPERATOR_ID " |
| | | + "inner JOIN fin_sys_tenant_department fstd ON fstu.SYS_DEPT_ID = fstd.ID " |
| | | + "inner JOIN fin_sys_tenant fst ON fst.id = fstd.TENANT_ID where ft.BUSINESS_TYPE =1 "); |
| | | //åå· |