From b8ec2530b16d89056909ff2ececdf41340b51fff Mon Sep 17 00:00:00 2001 From: futian.liu <liufutianyoo@163.com> Date: 星期六, 02 十二月 2023 12:06:41 +0800 Subject: [PATCH] 部门分发详情,明细 --- consum-base/src/main/java/com/consum/base/service/BaseGoodsTemplateServiceImpl.java | 105 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 95 insertions(+), 10 deletions(-) diff --git a/consum-base/src/main/java/com/consum/base/service/BaseGoodsTemplateServiceImpl.java b/consum-base/src/main/java/com/consum/base/service/BaseGoodsTemplateServiceImpl.java index e1e7a75..3104725 100644 --- a/consum-base/src/main/java/com/consum/base/service/BaseGoodsTemplateServiceImpl.java +++ b/consum-base/src/main/java/com/consum/base/service/BaseGoodsTemplateServiceImpl.java @@ -2,11 +2,9 @@ import com.consum.base.Constants; import com.consum.base.core.CodeGeneratorService; +import com.consum.base.core.utils.IdUtil; import com.consum.base.pojo.BaseGoodsTemplateParam; -import com.consum.base.util.IdUtil; -import com.consum.model.po.BaseCategory; -import com.consum.model.po.BaseGoodsModels; -import com.consum.model.po.BaseGoodsTemplate; +import com.consum.model.po.*; import com.consum.model.vo.BaseGoodsTemplateVo; import com.iplatform.model.po.S_user_core; import com.walker.db.page.GenericPager; @@ -20,6 +18,7 @@ import java.util.HashMap; import java.util.List; +import java.util.Map; /** * @Description 鐗╁搧妯℃澘 @@ -61,7 +60,7 @@ * @Author 鍗㈠簡闃� * @Date 2023/10/24 */ - public int add(BaseGoodsTemplateParam param, S_user_core currentUser) { + public int add(BaseGoodsTemplateParam param, FinSysTenantUser currentUser) { //1.鏂板鐗╁搧妯℃澘 BaseGoodsTemplate baseGoodsTemplate = new BaseGoodsTemplate(); BeanUtils.copyProperties(param, baseGoodsTemplate); @@ -71,6 +70,7 @@ //鏍规嵁鍒嗙被id鏌ヨ鍒嗙被 BaseCategory baseCategory = this.baseCategoryService.get(new BaseCategory(param.getCategoryId())); if (baseCategory != null) { + baseGoodsTemplate.setCategoryName(baseCategory.getCategoryName()); String classification = baseCategory.getClassification(); //鐗╁搧缂栫爜 String goodsCode = codeGeneratorService.createGoodsTemplateCode(classification); @@ -82,7 +82,9 @@ //褰撳墠鏈烘瀯鐨勭埗绾ф満鏋勭紪鍙� //鏈烘瀯灞傜骇 //鏈烘瀯缂栧彿 + baseGoodsTemplate.setAgencyId(Long.valueOf(currentUser.getTenantId())); //鏈烘瀯鍚嶇О + baseGoodsTemplate.setAgencyName(currentUser.getTenantName()); //鍒涘缓鏃堕棿 long createTime = DateUtils.getDateTimeNumber(System.currentTimeMillis()); baseGoodsTemplate.setCreateDate(createTime); @@ -109,7 +111,7 @@ } /** - * @Description 鐗╁搧妯℃澘鍒楄〃鏌ヨ + * @Description 鐗╁搧妯℃澘鍒楄〃鏌ヨ * @Author 鍗㈠簡闃� * @Date 2023/10/24 */ @@ -146,8 +148,6 @@ if (param.getStates() != null) { sql.append(" and states =:states "); paramts.put("states", param.getStates()); - } else { - sql.append(" and states !=3 "); } sql.append(" ORDER BY CREATE_DATE DESC "); @@ -156,6 +156,7 @@ /** * 鏍规嵁鐗╁搧id鏌ヨ鐗╁搧璇︽儏 + * * @author 鍗㈠簡闃� * @date 2023/9/26 */ @@ -173,7 +174,7 @@ //3.灏佽 BaseGoodsTemplateVo vo = new BaseGoodsTemplateVo(); if (goodsTemplate != null) { - BeanUtils.copyProperties(goodsTemplate,vo); + BeanUtils.copyProperties(goodsTemplate, vo); } if (!CollectionUtils.isEmpty(modelsList)) { vo.setModels(modelsList); @@ -190,9 +191,18 @@ //1.淇敼鐗╁搧妯℃澘 BaseGoodsTemplate baseGoodsTemplate = new BaseGoodsTemplate(); BeanUtils.copyProperties(param, baseGoodsTemplate); + BaseCategory baseCategory = this.baseCategoryService.get(new BaseCategory(param.getCategoryId())); + if (baseCategory != null) { + baseGoodsTemplate.setCategoryName(baseCategory.getCategoryName()); + } int flag1 = this.update(baseGoodsTemplate); //2.淇敼瑙勬牸鍨嬪彿鐨勫崟浣� + // TODO id 鐗╁搧鍨嬪彿淇敼寰呮暣鐞� List<BaseGoodsModels> modelsList = param.getModels(); + for (BaseGoodsModels baseGoodsModel : modelsList) { + BaseGoodsModels baseGoodsModels = new BaseGoodsModels(); + BeanUtils.copyProperties(baseGoodsModel, baseGoodsModels); + } int flag2 = this.update(modelsList); if (flag1 > 0 && flag2 > 0) { @@ -203,7 +213,7 @@ } /** - * @Description 鏍规嵁鐗╁搧鍚嶇О鍜屽垎绫籭d鏌ヨ鐗╁搧 + * @Description 鏍规嵁鐗╁搧鍚嶇О鍜屽垎绫籭d鏌ヨ鐗╁搧 * @Author 鍗㈠簡闃� * @Date 2023/10/24 */ @@ -222,7 +232,30 @@ } /** + * 鏍规嵁鍨嬪彿ID鏌ヨ鐗╁搧淇℃伅 + * + * @param modelId + * @return + */ + private static String QUERY_GOODSINFO_BY_MODELID = "SELECT model.MODEL_NAME modelName,model.UNIT,temp.id goodsId, temp.GOODS_CODE goodsCode,temp.GOODS_NAME goodsName,temp.CLASSIFICATION classification,temp.CATEGORY_ID categoryId FROM BASE_GOODS_MODELS model LEFT JOIN BASE_GOODS_TEMPLATE temp ON model.GOODS_TEMPLATES_ID=temp.id WHERE 1=1 "; + + public Map<String, Object> queryGoodsInfoByModelId(Long modelId) { + StringBuilder sqlStr = new StringBuilder(QUERY_GOODSINFO_BY_MODELID); + Map<String, Object> params = new HashMap<>(); + if (modelId != null) { + sqlStr.append(" AND model.id=:modelId"); + params.put("modelId", modelId); + } + List<Map<String, Object>> tempGoodsInfo = this.select(sqlStr.toString(), params); + if (CollectionUtils.isEmpty(tempGoodsInfo)) { + return null; + } + return tempGoodsInfo.get(0); + } + + /** * 淇敼鐘舵�� + * * @author 鍗㈠簡闃� * @date 2023/10/25 */ @@ -244,4 +277,56 @@ goodsTemplate.setDUserName(currentUser.getUser_name()); return this.update(goodsTemplate); } + + /** + * @return + * @Description 鏌ヨ浠撳簱绫诲瀷(鏁版嵁瀛楀吀) + * @Author 鍗㈠簡闃� + * @Date 2023/10/30 + */ + public List<SDictData> queryClassificationCode() { + StringBuilder sql = new StringBuilder("SELECT * FROM s_dict_data WHERE dict_type = 'CLASSIFICATION_CODE' order by dict_sort"); + return this.select(sql.toString(), new Object[]{}, new SDictData()); + } + + /** + * @Description 鏍规嵁鍒嗙被id鏌ヨ鐗╁搧妯℃澘 + * @Author 鍗㈠簡闃� + * @Date 2023/10/30 + */ + public List<BaseGoodsTemplate> queryByCategoryId(Long categoryId) { + BaseGoodsTemplate goodsTemplate = new BaseGoodsTemplate(); + goodsTemplate.setCategoryId(categoryId); + return this.select(goodsTemplate); + } + + /** + * @param agencyId + * @param categoryId + * @param states + * @param goodsName 鍏ㄥ尮閰嶏紒锛侊紒 + * @return + */ + + public List<BaseGoodsTemplate> queryGoodsTemplateByCategoryId(Long agencyId, Long categoryId, Short states, String goodsName) { + StringBuilder sql = new StringBuilder("SELECT * FROM base_goods_template WHERE 1=1 "); + Map<String, Object> params = new HashMap<>(); + if (agencyId != null) { + sql.append("AND AGENCY_ID=:agencyId "); + params.put("agencyId", agencyId); + } + if (categoryId != null) { + sql.append("AND CATEGORY_ID=:categoryId "); + params.put("categoryId", categoryId); + } + if (states != null) { + sql.append("AND STATES=:states "); + params.put("states", states); + } + if (StringUtils.isNotEmpty(goodsName)) { + sql.append(" and GOODS_NAME =:goodsName "); + params.put("goodsName", goodsName); + } + return this.select(sql.toString(), params, new BaseGoodsTemplate()); + } } -- Gitblit v1.9.1