diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapperEx.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapperEx.java index 244539d5..9347f5ab 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapperEx.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapperEx.java @@ -53,20 +53,23 @@ public interface DepotItemMapperEx { @Param("type") String type, @Param("subType") String subType, @Param("MId") Long MId, - @Param("MonthTime") String MonthTime, + @Param("beginTime") String beginTime, + @Param("endTime") String endTime, @Param("sumType") String sumType); BigDecimal buyOrSalePrice( @Param("type") String type, @Param("subType") String subType, @Param("MId") Long MId, - @Param("MonthTime") String MonthTime, + @Param("beginTime") String beginTime, + @Param("endTime") String endTime, @Param("sumType") String sumType); BigDecimal inOrOutPrice( @Param("type") String type, @Param("subType") String subType, - @Param("MonthTime") String MonthTime); + @Param("beginTime") String beginTime, + @Param("endTime") String endTime); BigDecimal getStockCheckSum( @Param("depotId") Long depotId, diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java index 2fc17c8a..5b55d2d5 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java @@ -18,6 +18,7 @@ import com.jsh.erp.service.systemConfig.SystemConfigService; import com.jsh.erp.service.user.UserService; import com.jsh.erp.utils.QueryUtils; import com.jsh.erp.utils.StringUtil; +import com.jsh.erp.utils.Tools; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -259,13 +260,15 @@ public class DepotItemService { return result; } - public BigDecimal buyOrSale(String type, String subType, Long MId, String MonthTime, String sumType) throws Exception{ + public BigDecimal buyOrSale(String type, String subType, Long MId, String monthTime, String sumType) throws Exception{ BigDecimal result= BigDecimal.ZERO; try{ + String beginTime = monthTime + "-01 00:00:00"; + String endTime = Tools.lastDayOfMonth(monthTime) +" 23:59:59"; if (SUM_TYPE.equals(sumType)) { - result= depotItemMapperEx.buyOrSaleNumber(type, subType, MId, MonthTime, sumType); + result= depotItemMapperEx.buyOrSaleNumber(type, subType, MId, beginTime, endTime, sumType); } else { - result= depotItemMapperEx.buyOrSalePrice(type, subType, MId, MonthTime, sumType); + result= depotItemMapperEx.buyOrSalePrice(type, subType, MId, beginTime, endTime, sumType); } }catch(Exception e){ JshException.readFail(logger, e); @@ -278,14 +281,16 @@ public class DepotItemService { * 统计采购或销售的总金额 * @param type * @param subType - * @param MonthTime + * @param month * @return * @throws Exception */ - public BigDecimal inOrOutPrice(String type, String subType, String MonthTime) throws Exception{ + public BigDecimal inOrOutPrice(String type, String subType, String month) throws Exception{ BigDecimal result= BigDecimal.ZERO; try{ - result = depotItemMapperEx.inOrOutPrice(type, subType, MonthTime); + String beginTime = month + "-01 00:00:00"; + String endTime = Tools.lastDayOfMonth(month) +" 23:59:59"; + result = depotItemMapperEx.inOrOutPrice(type, subType, beginTime, endTime); }catch(Exception e){ JshException.readFail(logger, e); } diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/organization/OrganizationService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/organization/OrganizationService.java index fea29499..70c50f68 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/organization/OrganizationService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/organization/OrganizationService.java @@ -275,7 +275,7 @@ public class OrganizationService { * @return */ public List getOrgIdByParentId(Long orgId) { - List idList = new ArrayList(); + List idList = new ArrayList<>(); OrganizationExample example = new OrganizationExample(); example.createCriteria().andIdEqualTo(orgId).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); List orgList = organizationMapper.selectByExample(example); @@ -292,9 +292,8 @@ public class OrganizationService { * @return */ public void getOrgIdByParentNo(List idList,Long id) { - List list = new ArrayList(); OrganizationExample example = new OrganizationExample(); - example.createCriteria().andParentIdNotEqualTo(id).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); + example.createCriteria().andParentIdEqualTo(id).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); List orgList = organizationMapper.selectByExample(example); if(orgList!=null && orgList.size()>0) { for(Organization o: orgList) { diff --git a/jshERP-boot/src/main/resources/mapper_xml/DepotItemMapperEx.xml b/jshERP-boot/src/main/resources/mapper_xml/DepotItemMapperEx.xml index a052b9fd..8422a113 100644 --- a/jshERP-boot/src/main/resources/mapper_xml/DepotItemMapperEx.xml +++ b/jshERP-boot/src/main/resources/mapper_xml/DepotItemMapperEx.xml @@ -212,8 +212,8 @@ where di.header_id = dh.id and dh.type='${type}' and dh.sub_type='${subType}' and di.material_id =${MId} - and dh.oper_time >= '${MonthTime}-01 00:00:00' - and dh.oper_time <= '${MonthTime}-31 23:59:59' + and dh.oper_time >= #{beginTime} + and dh.oper_time <= #{endTime} and ifnull(dh.delete_flag,'0') !='1' and ifnull(di.delete_flag,'0') !='1' @@ -223,8 +223,8 @@ where di.header_id = dh.id and dh.type='${type}' and dh.sub_type='${subType}' and di.material_id =${MId} - and dh.oper_time >= '${MonthTime}-01 00:00:00' - and dh.oper_time <= '${MonthTime}-31 23:59:59' + and dh.oper_time >= #{beginTime} + and dh.oper_time <= #{endTime} and ifnull(dh.delete_flag,'0') !='1' and ifnull(di.delete_flag,'0') !='1' @@ -233,8 +233,8 @@ select ifnull(sum(discount_last_money),0) as allMoney from jsh_depot_head dh where 1=1 and dh.type='${type}' and dh.sub_type='${subType}' - and dh.oper_time >= '${MonthTime}-01 00:00:00' - and dh.oper_time <= '${MonthTime}-31 23:59:59' + and dh.oper_time >= #{beginTime} + and dh.oper_time <= #{endTime} and ifnull(dh.delete_flag,'0') !='1'