1、解决组织递归bug,2、解决月份最后一天bug

This commit is contained in:
季圣华
2021-06-08 22:00:51 +08:00
parent b156971bb9
commit f04dcd220c
4 changed files with 25 additions and 18 deletions

View File

@@ -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,

View File

@@ -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);
}

View File

@@ -275,7 +275,7 @@ public class OrganizationService {
* @return
*/
public List<Long> getOrgIdByParentId(Long orgId) {
List<Long> idList = new ArrayList<Long>();
List<Long> idList = new ArrayList<>();
OrganizationExample example = new OrganizationExample();
example.createCriteria().andIdEqualTo(orgId).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Organization> orgList = organizationMapper.selectByExample(example);
@@ -292,9 +292,8 @@ public class OrganizationService {
* @return
*/
public void getOrgIdByParentNo(List<Long> idList,Long id) {
List<Long> list = new ArrayList<Long>();
OrganizationExample example = new OrganizationExample();
example.createCriteria().andParentIdNotEqualTo(id).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.createCriteria().andParentIdEqualTo(id).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Organization> orgList = organizationMapper.selectByExample(example);
if(orgList!=null && orgList.size()>0) {
for(Organization o: orgList) {

View File

@@ -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 &gt;= '${MonthTime}-01 00:00:00'
and dh.oper_time &lt;= '${MonthTime}-31 23:59:59'
and dh.oper_time &gt;= #{beginTime}
and dh.oper_time &lt;= #{endTime}
and ifnull(dh.delete_flag,'0') !='1'
and ifnull(di.delete_flag,'0') !='1'
</select>
@@ -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 &gt;= '${MonthTime}-01 00:00:00'
and dh.oper_time &lt;= '${MonthTime}-31 23:59:59'
and dh.oper_time &gt;= #{beginTime}
and dh.oper_time &lt;= #{endTime}
and ifnull(dh.delete_flag,'0') !='1'
and ifnull(di.delete_flag,'0') !='1'
</select>
@@ -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 &gt;= '${MonthTime}-01 00:00:00'
and dh.oper_time &lt;= '${MonthTime}-31 23:59:59'
and dh.oper_time &gt;= #{beginTime}
and dh.oper_time &lt;= #{endTime}
and ifnull(dh.delete_flag,'0') !='1'
</select>