java110
2023-08-25 18d1f4bc4f4f77c8883702a00896dd99469db648
Merge branch 'master' of http://git.homecommunity.cn/supervip/MicroCommunity
1个文件已添加
10个文件已修改
297 ■■■■ 已修改文件
java110-bean/src/main/java/com/java110/dto/resource/ResourceStoreTypeDto.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/dto/store/StorehouseDto.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-db/src/main/resources/mapper/store/ResourceStoreTypeServiceDaoImplMapper.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-db/src/main/resources/mapper/store/StorehouseServiceDaoImplMapper.xml 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-interface/src/main/java/com/java110/intf/store/IResourceStoreTypeInnerServiceSMO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-store/src/main/java/com/java110/store/cmd/resourceStore/ListResourceStoreTypeTreeCmd.java 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-store/src/main/java/com/java110/store/cmd/resourceStore/UpdateStorehouseCmd.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-store/src/main/java/com/java110/store/cmd/resourceStoreType/SaveResourceStoreTypeCmd.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-store/src/main/java/com/java110/store/dao/IResourceStoreTypeServiceDao.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-store/src/main/java/com/java110/store/dao/impl/ResourceStoreTypeServiceDaoImpl.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-store/src/main/java/com/java110/store/smo/impl/ResourceStoreTypeInnerServiceSMOImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/dto/resource/ResourceStoreTypeDto.java
@@ -4,6 +4,7 @@
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
 * @ClassName FloorDto
@@ -15,13 +16,20 @@
 **/
public class ResourceStoreTypeDto extends PageDto implements Serializable {
    private String parentRstId;
    private String parentName;
    private String parentDescription;
    private String rstId;
    private String name;
    private String description;
    private String storeId;
    private Date createTime;
    private String statusCd = "0";
    private String parentId = "0"; //父级id,默认为0
    private String parentId ; //父级id,默认为0
    private List<ResourceStoreTypeDto> subTypes;
    public String getRstId() {
        return rstId;
@@ -78,4 +86,36 @@
    public void setParentId(String parentId) {
        this.parentId = parentId;
    }
    public String getParentRstId() {
        return parentRstId;
    }
    public void setParentRstId(String parentRstId) {
        this.parentRstId = parentRstId;
    }
    public String getParentName() {
        return parentName;
    }
    public void setParentName(String parentName) {
        this.parentName = parentName;
    }
    public String getParentDescription() {
        return parentDescription;
    }
    public void setParentDescription(String parentDescription) {
        this.parentDescription = parentDescription;
    }
    public List<ResourceStoreTypeDto> getSubTypes() {
        return subTypes;
    }
    public void setSubTypes(List<ResourceStoreTypeDto> subTypes) {
        this.subTypes = subTypes;
    }
}
java110-bean/src/main/java/com/java110/dto/store/StorehouseDto.java
@@ -36,6 +36,10 @@
    private String allocationSwitch;
    private String allocationRafId;
    private String purchaseFlowName;
    private String useFlowName;
    private String allocationFlowName;
    public String getShDesc() {
        return shDesc;
    }
@@ -150,4 +154,28 @@
    public void setAllocationRafId(String allocationRafId) {
        this.allocationRafId = allocationRafId;
    }
    public String getPurchaseFlowName() {
        return purchaseFlowName;
    }
    public void setPurchaseFlowName(String purchaseFlowName) {
        this.purchaseFlowName = purchaseFlowName;
    }
    public String getUseFlowName() {
        return useFlowName;
    }
    public void setUseFlowName(String useFlowName) {
        this.useFlowName = useFlowName;
    }
    public String getAllocationFlowName() {
        return allocationFlowName;
    }
    public void setAllocationFlowName(String allocationFlowName) {
        this.allocationFlowName = allocationFlowName;
    }
}
java110-db/src/main/resources/mapper/store/ResourceStoreTypeServiceDaoImplMapper.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="resourceResourceStoreTypeTypeServiceDaoImpl">
<mapper namespace="resourceStoreTypeServiceDaoImpl">
    <!-- 保存物品类型信息 add by wuxw 2018-07-03 -->
    <insert id="saveBusinessResourceStoreTypeInfo" parameterType="Map">
@@ -150,4 +150,13 @@
            and t.parent_id= #{parentId}
        </if>
    </select>
    <select id="queryResourceStoreTypeTree" parameterType="Map" resultType="Map">
        select t.rst_id rstId,t.name,t.description ,rst.rst_id parentRstId,rst.name parentName,rst.description parentDescription
        from resource_store_type t
        left join resource_store_type rst on t.parent_id = rst.rst_id and rst.status_cd = '0'
        where 1=1
        and t.status_cd = '0'
        and t.store_id= #{storeId}
    </select>
</mapper>
java110-db/src/main/resources/mapper/store/StorehouseServiceDaoImplMapper.xml
@@ -5,27 +5,19 @@
<mapper namespace="storehouseServiceDaoImpl">
    <!-- 查询仓库信息 add by wuxw 2018-07-03 -->
    <select id="getStorehouseInfo" parameterType="Map" resultType="Map">
        select t.sh_desc,t.sh_desc shDesc,t.sh_type,t.sh_id,t.sh_id
        select t.sh_desc,t.sh_desc shDesc,t.sh_id,t.sh_id
        shId,t.status_cd,t.status_cd statusCd,t.sh_name,t.sh_name shName,t.store_id,t.store_id
        storeId,t.is_show,t.is_show isShow,t.create_time createTime,t.purchase_switch purchaseSwitch,
        t.purchase_raf_id purchaseRafId,t.use_switch useSwitch,t.use_raf_id useRafId,
        t.allocation_switch allocationSwitch,t.allocation_raf_id allocationRafId
        t.allocation_switch allocationSwitch,t.allocation_raf_id allocationRafId,raf.flow_name purchaseFlowName,
        raf1.flow_name useFlowName,raf2.flow_name allocationFlowName
        from storehouse t
        left join resource_audit_flow raf on t.purchase_raf_id = raf.raf_id and raf.status_cd = '0'
        left join resource_audit_flow raf1 on t.use_raf_id = raf1.raf_id and raf1.status_cd = '0'
        left join resource_audit_flow raf2 on t.allocation_raf_id = raf2.raf_id and raf2.status_cd = '0'
        where 1 =1
        <if test="shDesc !=null and shDesc != ''">
            and t.sh_desc= #{shDesc}
        </if>
        <if test="shType !=null and shType != ''">
            and t.sh_type= #{shType}
        </if>
        <if test="shObjId !=null and shObjId != ''">
            and t.sh_obj_id= #{shObjId}
        </if>
        <if test="shObjIds !=null">
            and t.sh_obj_id in
            <foreach collection="shObjIds" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="shId !=null and shId != ''">
            and t.sh_id= #{shId}
@@ -59,18 +51,7 @@
        <if test="shDesc !=null and shDesc != ''">
            and t.sh_desc= #{shDesc}
        </if>
        <if test="shType !=null and shType != ''">
            and t.sh_type= #{shType}
        </if>
        <if test="shObjId !=null and shObjId != ''">
            and t.sh_obj_id= #{shObjId}
        </if>
        <if test="shObjIds !=null">
            and t.sh_obj_id in
            <foreach collection="shObjIds" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="shId !=null and shId != ''">
            and t.sh_id= #{shId}
        </if>
java110-interface/src/main/java/com/java110/intf/store/IResourceStoreTypeInnerServiceSMO.java
@@ -39,4 +39,7 @@
     */
    @RequestMapping(value = "/queryResourceStoreTypesCount", method = RequestMethod.POST)
    int queryResourceStoreTypesCount(@RequestBody ResourceStoreTypeDto resourceResourceStoreTypeTypeDto);
    @RequestMapping(value = "/queryResourceStoreTypeTree", method = RequestMethod.POST)
    List<ResourceStoreTypeDto> queryResourceStoreTypeTree(@RequestBody ResourceStoreTypeDto resourceStoreTypeDto);
}
service-store/src/main/java/com/java110/store/cmd/resourceStore/ListResourceStoreTypeTreeCmd.java
New file
@@ -0,0 +1,109 @@
package com.java110.store.cmd.resourceStore;
import com.alibaba.fastjson.JSONObject;
import com.java110.core.annotation.Java110Cmd;
import com.java110.core.context.CmdContextUtils;
import com.java110.core.context.ICmdDataFlowContext;
import com.java110.core.event.cmd.Cmd;
import com.java110.core.event.cmd.CmdEvent;
import com.java110.dto.resource.ResourceStoreTypeDto;
import com.java110.intf.store.IResourceStoreTypeInnerServiceSMO;
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.Assert;
import com.java110.utils.util.BeanConvertUtil;
import com.java110.utils.util.StringUtil;
import com.java110.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import java.util.ArrayList;
import java.util.List;
/**
 * 查询类型树
 */
@Java110Cmd(serviceCode = "resourceStore.listResourceStoreTypeTree")
public class ListResourceStoreTypeTreeCmd extends Cmd {
    @Autowired
    private IResourceStoreTypeInnerServiceSMO resourceStoreTypeInnerServiceSMOImpl;
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
        String storeId = CmdContextUtils.getStoreId(context);
        Assert.hasLength(storeId, "未包含商户ID");
        reqJson.put("storeId", storeId);
    }
    @Override
    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
        ResourceStoreTypeDto resourceStoreTypeDto = BeanConvertUtil.covertBean(reqJson, ResourceStoreTypeDto.class);
        List<ResourceStoreTypeDto> storeTypeDtos = resourceStoreTypeInnerServiceSMOImpl.queryResourceStoreTypeTree(resourceStoreTypeDto);
        if (storeTypeDtos == null || storeTypeDtos.size() < 1) {
            return;
        }
        List<ResourceStoreTypeDto> storeTypes = new ArrayList<>();
        //todo 计算一级分类
        for (ResourceStoreTypeDto tmpResourceStoreTypeDto : storeTypeDtos) {
            if (!StringUtil.isEmpty(tmpResourceStoreTypeDto.getParentRstId())) {
                continue;
            }
            ResourceStoreTypeDto selfResourceStoreTypeDto = BeanConvertUtil.covertBean(tmpResourceStoreTypeDto, ResourceStoreTypeDto.class);
            selfResourceStoreTypeDto.setParentRstId(tmpResourceStoreTypeDto.getRstId());
            selfResourceStoreTypeDto.setParentName(tmpResourceStoreTypeDto.getName());
            selfResourceStoreTypeDto.setParentDescription(tmpResourceStoreTypeDto.getDescription());
            storeTypes.add(selfResourceStoreTypeDto);
        }
        //todo 计算二级分类
        ResourceStoreTypeDto tResourceStoreTypeDto = null;
        List<ResourceStoreTypeDto> subStoreTypes = null;
        for (ResourceStoreTypeDto tmpResourceStoreTypeDto : storeTypeDtos) {
            //todo 这个可能是一级分类
            if (StringUtil.isEmpty(tmpResourceStoreTypeDto.getParentRstId())) {
                continue;
            }
            //todo 一级分类
            tResourceStoreTypeDto = getParentResoureceStoreTypes(storeTypes, tmpResourceStoreTypeDto);
            //todo 说明没有 一级 分类 跳过,这种场景 除非改数据库不然不太可能存在
            if (tResourceStoreTypeDto == null) {
                continue;
            }
            if (tResourceStoreTypeDto.getSubTypes() == null) {
                tResourceStoreTypeDto.setSubTypes(new ArrayList<>());
            }
            subStoreTypes = tResourceStoreTypeDto.getSubTypes();
            subStoreTypes.add(tmpResourceStoreTypeDto);
        }
        context.setResponseEntity(ResultVo.createResponseEntity(storeTypes));
    }
    private ResourceStoreTypeDto getParentResoureceStoreTypes(List<ResourceStoreTypeDto> storeTypes, ResourceStoreTypeDto tmpResourceStoreTypeDto) {
        //todo 没有数据直接写入
        if (storeTypes.size() < 1) {
            return null;
        }
        for (ResourceStoreTypeDto storeType : storeTypes) {
            if (storeType.getRstId().equals(tmpResourceStoreTypeDto.getParentRstId())) {
                return storeType;
            }
        }
        return null;
    }
}
service-store/src/main/java/com/java110/store/cmd/resourceStore/UpdateStorehouseCmd.java
@@ -18,6 +18,7 @@
import com.alibaba.fastjson.JSONObject;
import com.java110.core.annotation.Java110Cmd;
import com.java110.core.annotation.Java110Transactional;
import com.java110.core.context.CmdContextUtils;
import com.java110.core.context.ICmdDataFlowContext;
import com.java110.core.event.cmd.Cmd;
import com.java110.core.event.cmd.CmdEvent;
@@ -55,9 +56,19 @@
    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
        Assert.hasKeyAndValue(reqJson, "shId", "shId不能为空");
        Assert.hasKeyAndValue(reqJson, "shName", "请求报文中未包含shName");
        Assert.hasKeyAndValue(reqJson, "shType", "请求报文中未包含shType");
        Assert.hasKeyAndValue(reqJson, "storeId", "请求报文中未包含storeId");
        String storeId = CmdContextUtils.getStoreId(cmdDataFlowContext);
        reqJson.put("storeId", storeId);
        if ("ON".equals(reqJson.getString("purchaseSwitch"))) {
            Assert.hasKeyAndValue(reqJson, "purchaseRafId", "请求报文中未包含采购流程");
        }
        if ("ON".equals(reqJson.getString("useSwitch"))) {
            Assert.hasKeyAndValue(reqJson, "useRafId", "请求报文中未包含领用流程");
        }
        if ("ON".equals(reqJson.getString("allocationSwitch"))) {
            Assert.hasKeyAndValue(reqJson, "allocationRafId", "请求报文中未包含调拨流程");
        }
    }
    @Override
service-store/src/main/java/com/java110/store/cmd/resourceStoreType/SaveResourceStoreTypeCmd.java
@@ -12,6 +12,7 @@
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.Assert;
import com.java110.utils.util.BeanConvertUtil;
import com.java110.utils.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import java.text.ParseException;
@@ -29,6 +30,16 @@
        Assert.hasKeyAndValue(reqJson, "name", "请求报文中未包含name");
        //Assert.hasKeyAndValue(reqJson, "storeId", "请求报文中未包含storeId");
        if(!reqJson.containsKey("parentId")){
            reqJson.put("parentId", "0");
        }
        String parentId = reqJson.getString("parentId");
        if(StringUtil.isEmpty(parentId)){
            reqJson.put("parentId", "0");
        }
        if (!reqJson.containsKey("storeId")) {
            String storeId = context.getReqHeaders().get("store-id");
            reqJson.put("storeId", storeId);
service-store/src/main/java/com/java110/store/dao/IResourceStoreTypeServiceDao.java
@@ -1,6 +1,7 @@
package com.java110.store.dao;
import com.java110.dto.resource.ResourceStoreTypeDto;
import com.java110.utils.exception.DAOException;
@@ -11,23 +12,24 @@
 * 物品类型组件内部之间使用,没有给外围系统提供服务能力
 * 物品类型服务接口类,要求全部以字符串传输,方便微服务化
 * 新建客户,修改客户,删除客户,查询客户等功能
 *
 * <p>
 * Created by wuxw on 2016/12/27.
 */
public interface IResourceStoreTypeServiceDao {
    /**
     * 保存 物品类型信息
     *
     * @param businessResourceStoreTypeInfo 物品类型信息 封装
     * @throws DAOException 操作数据库异常
     */
    void saveBusinessResourceStoreTypeInfo(Map businessResourceStoreTypeInfo) throws DAOException;
    /**
     * 查询物品类型信息(business过程)
     * 根据bId 查询物品类型信息
     *
     * @param info bId 信息
     * @return 物品类型信息
     * @throws DAOException DAO异常
@@ -35,21 +37,19 @@
    List<Map> getBusinessResourceStoreTypeInfo(Map info) throws DAOException;
    /**
     * 保存 物品类型信息 Business数据到 Instance中
     *
     * @param info
     * @throws DAOException DAO异常
     */
    void saveResourceStoreTypeInfoInstance(Map info) throws DAOException;
    /**
     * 查询物品类型信息(instance过程)
     * 根据bId 查询物品类型信息
     *
     * @param info bId 信息
     * @return 物品类型信息
     * @throws DAOException DAO异常
@@ -57,9 +57,9 @@
    List<Map> getResourceStoreTypeInfo(Map info) throws DAOException;
    /**
     * 修改物品类型信息
     *
     * @param info 修改信息
     * @throws DAOException DAO异常
     */
@@ -74,4 +74,11 @@
     */
    int queryResourceStoreTypesCount(Map info);
    /**
     * 查询类型树形
     *
     * @param info
     * @return
     */
    List<Map> queryResourceStoreTypeTree(Map info);
}
service-store/src/main/java/com/java110/store/dao/impl/ResourceStoreTypeServiceDaoImpl.java
@@ -1,6 +1,7 @@
package com.java110.store.dao.impl;
import com.alibaba.fastjson.JSONObject;
import com.java110.dto.resource.ResourceStoreTypeDto;
import com.java110.utils.constant.ResponseConstant;
import com.java110.utils.exception.DAOException;
import com.java110.utils.util.DateUtil;
@@ -68,7 +69,7 @@
    public void saveResourceStoreTypeInfoInstance(Map info) throws DAOException {
        logger.debug("保存物品类型信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.insert("resourceResourceStoreTypeTypeServiceDaoImpl.saveResourceStoreTypeInfoInstance",info);
        int saveFlag = sqlSessionTemplate.insert("resourceStoreTypeServiceDaoImpl.saveResourceStoreTypeInfoInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存物品类型信息Instance数据失败:"+ JSONObject.toJSONString(info));
@@ -86,7 +87,7 @@
    public List<Map> getResourceStoreTypeInfo(Map info) throws DAOException {
        logger.debug("查询物品类型信息 入参 info : {}",info);
        List<Map> businessResourceStoreTypeInfos = sqlSessionTemplate.selectList("resourceResourceStoreTypeTypeServiceDaoImpl.getResourceStoreTypeInfo",info);
        List<Map> businessResourceStoreTypeInfos = sqlSessionTemplate.selectList("resourceStoreTypeServiceDaoImpl.getResourceStoreTypeInfo",info);
        return businessResourceStoreTypeInfos;
    }
@@ -101,7 +102,7 @@
    public void updateResourceStoreTypeInfoInstance(Map info) throws DAOException {
        logger.debug("修改物品类型信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("resourceResourceStoreTypeTypeServiceDaoImpl.updateResourceStoreTypeInfoInstance",info);
        int saveFlag = sqlSessionTemplate.update("resourceStoreTypeServiceDaoImpl.updateResourceStoreTypeInfoInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改物品类型信息Instance数据失败:"+ JSONObject.toJSONString(info));
@@ -117,7 +118,7 @@
    public int queryResourceStoreTypesCount(Map info) {
        logger.debug("查询物品类型数据 入参 info : {}",info);
        List<Map> businessResourceStoreTypeInfos = sqlSessionTemplate.selectList("resourceResourceStoreTypeTypeServiceDaoImpl.queryResourceStoreTypesCount", info);
        List<Map> businessResourceStoreTypeInfos = sqlSessionTemplate.selectList("resourceStoreTypeServiceDaoImpl.queryResourceStoreTypesCount", info);
        if (businessResourceStoreTypeInfos.size() < 1) {
            return 0;
        }
@@ -125,5 +126,14 @@
        return Integer.parseInt(businessResourceStoreTypeInfos.get(0).get("count").toString());
    }
    @Override
    public List<Map> queryResourceStoreTypeTree(Map info) {
        logger.debug("查询物品类型数据 入参 info : {}",info);
        List<Map> infos = sqlSessionTemplate.selectList("resourceStoreTypeServiceDaoImpl.queryResourceStoreTypeTree", info);
        return infos;
    }
}
service-store/src/main/java/com/java110/store/smo/impl/ResourceStoreTypeInnerServiceSMOImpl.java
@@ -94,6 +94,12 @@
        return resourceResourceStoreTypeTypeServiceDaoImpl.queryResourceStoreTypesCount(BeanConvertUtil.beanCovertMap(resourceResourceStoreTypeTypeDto));
    }
    @Override
    public List<ResourceStoreTypeDto> queryResourceStoreTypeTree(@RequestBody ResourceStoreTypeDto resourceStoreTypeDto) {
        return BeanConvertUtil.covertBeanList(
                resourceResourceStoreTypeTypeServiceDaoImpl.queryResourceStoreTypeTree(BeanConvertUtil.beanCovertMap(resourceStoreTypeDto)), ResourceStoreTypeDto.class);
    }
    public IResourceStoreTypeServiceDao getResourceStoreTypeServiceDaoImpl() {
        return resourceResourceStoreTypeTypeServiceDaoImpl;
    }