Commit 0543ddbf by huluobin

Merge branch 'cost-check-flow-master' into cost-check-flow

# Conflicts:
#	bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/CostApiService.java
#	bailuntec-cost-core/src/main/resources/mapper/Cost.xml
parents 068665af e737220c
...@@ -9,6 +9,7 @@ import com.bailuntec.cost.api.response.CostResult; ...@@ -9,6 +9,7 @@ import com.bailuntec.cost.api.response.CostResult;
import com.blt.other.module.cost.service.CostApiService; import com.blt.other.module.cost.service.CostApiService;
import com.blt.other.module.cost.model.CostDomain; import com.blt.other.module.cost.model.CostDomain;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.SneakyThrows;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -17,6 +18,8 @@ import org.springframework.web.bind.annotation.*; ...@@ -17,6 +18,8 @@ import org.springframework.web.bind.annotation.*;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -75,6 +78,7 @@ public class CostApiController implements CostApi { ...@@ -75,6 +78,7 @@ public class CostApiController implements CostApi {
} }
@SneakyThrows
@ApiOperation("查询所有的费用单和采购单") @ApiOperation("查询所有的费用单和采购单")
@Override @Override
@GetMapping("/manageCostList") @GetMapping("/manageCostList")
...@@ -87,18 +91,21 @@ public class CostApiController implements CostApi { ...@@ -87,18 +91,21 @@ public class CostApiController implements CostApi {
@RequestParam(name = "departmentName", required = false) String departmentName, @RequestParam(name = "departmentName", required = false) String departmentName,
@RequestParam(name = "createUserId", required = false) Integer createUserId, @RequestParam(name = "createUserId", required = false) Integer createUserId,
@RequestParam(name = "payUserId", required = false) Integer payUserId) { @RequestParam(name = "payUserId", required = false) Integer payUserId) {
try {
if (!StringUtils.isEmpty(departmentName)) { if (!StringUtils.isEmpty(departmentName)) {
departmentName = departmentName.toLowerCase(); departmentName = departmentName.toLowerCase();
}
List<ManageCostDto> manageCostDtoList = costApiService.getMangeCostList(startDateStr, endDateStr, feeSuperType, feeSubType, companyValue, companyName, departmentName, createUserId, payUserId);
return CostResult.success(manageCostDtoList);
} catch (Exception e) {
e.printStackTrace();
return CostResult.error();
} }
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime startDate = LocalDateTime.parse(startDateStr, df);
LocalDateTime endDate = LocalDateTime.parse(endDateStr, df);
List<ManageCostDto> manageCostDtoList = costApiService.getMangeCostList(startDate, endDate, feeSuperType, feeSubType, companyValue, companyName, departmentName, createUserId, payUserId);
return CostResult.success(manageCostDtoList);
} }
@SneakyThrows
@ApiOperation("查询所有的物流费用单和采购单") @ApiOperation("查询所有的物流费用单和采购单")
@Override @Override
@GetMapping("/logisticsCostList") @GetMapping("/logisticsCostList")
...@@ -111,16 +118,17 @@ public class CostApiController implements CostApi { ...@@ -111,16 +118,17 @@ public class CostApiController implements CostApi {
@RequestParam(name = "departmentName", required = false) String departmentName, @RequestParam(name = "departmentName", required = false) String departmentName,
@RequestParam(name = "createUserId", required = false) Integer createUserId, @RequestParam(name = "createUserId", required = false) Integer createUserId,
@RequestParam(name = "payUserId", required = false) Integer payUserId) { @RequestParam(name = "payUserId", required = false) Integer payUserId) {
try { if (!StringUtils.isEmpty(departmentName)) {
if (!StringUtils.isEmpty(departmentName)) { departmentName = departmentName.toLowerCase();
departmentName = departmentName.toLowerCase();
}
List<ManageCostDto> manageCostDtoList = costApiService.getLogisticsCostList(startDateStr, endDateStr, feeSuperType, feeSubType, companyValue, companyName, departmentName, createUserId, payUserId);
return CostResult.success(manageCostDtoList);
} catch (Exception e) {
e.printStackTrace();
return CostResult.error();
} }
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime startDate = LocalDateTime.parse(startDateStr, df);
LocalDateTime endDate = LocalDateTime.parse(endDateStr, df);
List<ManageCostDto> manageCostDtoList = costApiService.getLogisticsCostList(startDate, endDate, feeSuperType, feeSubType, companyValue, companyName, departmentName, createUserId, payUserId);
return CostResult.success(manageCostDtoList);
} }
......
...@@ -8,6 +8,7 @@ import com.blt.other.module.cost.model.CostDomain; ...@@ -8,6 +8,7 @@ import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.vo.CostExportVo; import com.blt.other.module.cost.vo.CostExportVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -92,8 +93,8 @@ public interface CostDao extends BaseMapper<CostDomain> { ...@@ -92,8 +93,8 @@ public interface CostDao extends BaseMapper<CostDomain> {
* @param payUserId payUserId * @param payUserId payUserId
* @return * @return
*/ */
List<ManageCostDto> selectManageCost(@Param("startDate") Date startDate, List<ManageCostDto> selectManageCost(@Param("startDate") LocalDateTime startDate,
@Param("endDate") Date endDate, @Param("endDate") LocalDateTime endDate,
@Param("feeSuperType") String feeSuperType, @Param("feeSuperType") String feeSuperType,
@Param("feeSubType") String feeSubType, @Param("feeSubType") String feeSubType,
@Param("companyValueList") List<Integer> companyValueList, @Param("companyValueList") List<Integer> companyValueList,
...@@ -118,8 +119,8 @@ public interface CostDao extends BaseMapper<CostDomain> { ...@@ -118,8 +119,8 @@ public interface CostDao extends BaseMapper<CostDomain> {
* @param payUserId payUserId * @param payUserId payUserId
* @return * @return
*/ */
List<ManageCostDto> getLogisticsCostList(@Param("startDate") Date startDate, List<ManageCostDto> getLogisticsCostList(@Param("startDate") LocalDateTime startDate,
@Param("endDate") Date endDate, @Param("endDate") LocalDateTime endDate,
@Param("feeSuperType") String feeSuperType, @Param("feeSuperType") String feeSuperType,
@Param("feeSubType") String feeSubType, @Param("feeSubType") String feeSubType,
@Param("companyValueList") List<Integer> companyValueList, @Param("companyValueList") List<Integer> companyValueList,
......
...@@ -4,9 +4,11 @@ import com.bailuntec.cost.api.dto.CostDto; ...@@ -4,9 +4,11 @@ import com.bailuntec.cost.api.dto.CostDto;
import com.bailuntec.cost.api.dto.LogisticsCostDto; import com.bailuntec.cost.api.dto.LogisticsCostDto;
import com.bailuntec.cost.api.dto.ManageCostDto; import com.bailuntec.cost.api.dto.ManageCostDto;
import com.bailuntec.cost.api.dto.WageCostDto; import com.bailuntec.cost.api.dto.WageCostDto;
import com.blt.other.module.cost.model.CostDomain; import com.blt.other.module.database.model.CostDomain;
import org.springframework.cglib.core.Local;
import java.io.IOException; import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -36,7 +38,7 @@ public interface CostApiService { ...@@ -36,7 +38,7 @@ public interface CostApiService {
* @param payUserId 支付用户id * @param payUserId 支付用户id
* @return 单据 * @return 单据
*/ */
List<ManageCostDto> getMangeCostList(String startDateStr, String endDateStr, String feeSuperType, String feeSubType, Integer companyValue, String companyName, String departmentName, Integer createUserId, Integer payUserId) throws Exception; List<ManageCostDto> getMangeCostList(LocalDateTime startDateStr, LocalDateTime endDateStr, String feeSuperType, String feeSubType, Integer companyValue, String companyName, String departmentName, Integer createUserId, Integer payUserId) throws Exception;
/** /**
...@@ -55,7 +57,7 @@ public interface CostApiService { ...@@ -55,7 +57,7 @@ public interface CostApiService {
* @param payUserId 支付用户id * @param payUserId 支付用户id
* @return 单据 * @return 单据
*/ */
List<ManageCostDto> getLogisticsCostList(String startDateStr, String endDateStr, String feeSuperType, String feeSubType, Integer companyValue, String companyName, String departmentName, Integer createUserId, Integer payUserId) throws Exception; List<ManageCostDto> getLogisticsCostList(LocalDateTime startDateS, LocalDateTime endDateStr, String feeSuperType, String feeSubType, Integer companyValue, String companyName, String departmentName, Integer createUserId, Integer payUserId) throws Exception;
/** /**
* 查询资产负债表相关费用单 * 查询资产负债表相关费用单
......
...@@ -4,11 +4,10 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,11 +4,10 @@ import com.alibaba.fastjson.JSONObject;
import com.blt.other.module.cost.model.CostDetailDomain; import com.blt.other.module.cost.model.CostDetailDomain;
import com.blt.other.module.cost.model.CostDomain; import com.blt.other.module.cost.model.CostDomain;
import com.bailuntec.cost.api.dto.*; import com.bailuntec.cost.api.dto.*;
import com.blt.other.module.auth.dao.UserDao;
import com.blt.other.common.util.CurUtils; import com.blt.other.common.util.CurUtils;
import com.blt.other.common.util.DateTimeUtil;
import com.blt.other.common.util.HttpUtil; import com.blt.other.common.util.HttpUtil;
import com.blt.other.common.util.PathUtil; import com.blt.other.common.util.PathUtil;
import com.blt.other.module.auth.dao.UserDao;
import com.blt.other.module.cost.dao.*; import com.blt.other.module.cost.dao.*;
import com.blt.other.module.cost.service.CostApiService; import com.blt.other.module.cost.service.CostApiService;
import com.blt.other.module.cost.service.CostService; import com.blt.other.module.cost.service.CostService;
...@@ -23,12 +22,12 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -23,12 +22,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -153,8 +152,8 @@ public class CostApiServiceImpl implements CostApiService { ...@@ -153,8 +152,8 @@ public class CostApiServiceImpl implements CostApiService {
} }
@Override @Override
public List<ManageCostDto> getMangeCostList(String startDateStr, public List<ManageCostDto> getMangeCostList(LocalDateTime startDateStr,
String endDateStr, LocalDateTime endDateStr,
String feeSuperType, String feeSuperType,
String feeSubType, String feeSubType,
Integer companyValue, Integer companyValue,
...@@ -162,14 +161,7 @@ public class CostApiServiceImpl implements CostApiService { ...@@ -162,14 +161,7 @@ public class CostApiServiceImpl implements CostApiService {
String departmentName, String departmentName,
Integer createUserId, Integer createUserId,
Integer payUserId) { Integer payUserId) {
Date startDate = null;
Date endDate = null;
if (!StringUtils.isEmpty(startDateStr)) {
startDate = DateTimeUtil.stringToDate(startDateStr, DateTimeUtil.DATE_FORMAT);
}
if (!StringUtils.isEmpty(endDateStr)) {
endDate = DateTimeUtil.stringToDate(endDateStr, DateTimeUtil.DATE_FORMAT);
}
ArrayList<Integer> companyValueList = new ArrayList<>(6); ArrayList<Integer> companyValueList = new ArrayList<>(6);
if (companyValue != null) { if (companyValue != null) {
companyValueList.add(companyValue); companyValueList.add(companyValue);
...@@ -179,11 +171,18 @@ public class CostApiServiceImpl implements CostApiService { ...@@ -179,11 +171,18 @@ public class CostApiServiceImpl implements CostApiService {
companyValueList.add(60); companyValueList.add(60);
companyValueList.add(61); companyValueList.add(61);
companyValueList.add(66); companyValueList.add(66);
companyValueList.add(78);
companyValueList.add(72);
companyValueList.add(71);
companyValueList.add(67);
companyValueList.add(58);
companyValueList.add(64);
companyValueList.add(46);
} }
} }
List<ManageCostDto> manageCostDtoList = costDao.selectManageCost(startDate, DateTimeUtil.addDays(endDate, 1), feeSuperType, feeSubType, companyValueList, companyName, departmentName, createUserId, payUserId); List<ManageCostDto> manageCostDtoList = costDao.selectManageCost(startDateStr, endDateStr, feeSuperType, feeSubType, companyValueList, companyName, departmentName, createUserId, payUserId);
if (manageCostDtoList != null && !manageCostDtoList.isEmpty()) { if (manageCostDtoList != null && !manageCostDtoList.isEmpty()) {
for (ManageCostDto manageCostDto : manageCostDtoList) { for (ManageCostDto manageCostDto : manageCostDtoList) {
if (!manageCostDto.getCurrency().equals("CNY")) { if (!manageCostDto.getCurrency().equals("CNY")) {
...@@ -225,15 +224,9 @@ public class CostApiServiceImpl implements CostApiService { ...@@ -225,15 +224,9 @@ public class CostApiServiceImpl implements CostApiService {
} }
@Override @Override
public List<ManageCostDto> getLogisticsCostList(String startDateStr, String endDateStr, String feeSuperType, String feeSubType, Integer companyValue, String companyName, String departmentName, Integer createUserId, Integer payUserId) throws Exception { public List<ManageCostDto> getLogisticsCostList(LocalDateTime startDateStr, LocalDateTime endDateStr, String feeSuperType, String feeSubType, Integer companyValue, String companyName, String departmentName, Integer createUserId, Integer payUserId) throws Exception {
Date startDate = null;
Date endDate = null;
if (!StringUtils.isEmpty(startDateStr)) {
startDate = DateTimeUtil.stringToDate(startDateStr, DateTimeUtil.DATE_FORMAT);
}
if (!StringUtils.isEmpty(endDateStr)) {
endDate = DateTimeUtil.stringToDate(endDateStr, DateTimeUtil.DATE_FORMAT);
}
ArrayList<Integer> companyValueList = new ArrayList<>(6); ArrayList<Integer> companyValueList = new ArrayList<>(6);
if (companyValue != null) { if (companyValue != null) {
companyValueList.add(companyValue); companyValueList.add(companyValue);
...@@ -243,9 +236,16 @@ public class CostApiServiceImpl implements CostApiService { ...@@ -243,9 +236,16 @@ public class CostApiServiceImpl implements CostApiService {
companyValueList.add(60); companyValueList.add(60);
companyValueList.add(61); companyValueList.add(61);
companyValueList.add(66); companyValueList.add(66);
companyValueList.add(78);
companyValueList.add(72);
companyValueList.add(71);
companyValueList.add(67);
companyValueList.add(58);
companyValueList.add(64);
companyValueList.add(46);
} }
} }
return costDao.getLogisticsCostList(startDate, DateTimeUtil.addDays(endDate, 1), feeSuperType, feeSubType, companyValueList, companyName, departmentName, createUserId, payUserId); return costDao.getLogisticsCostList(startDateStr, endDateStr, feeSuperType, feeSubType, companyValueList, companyName, departmentName, createUserId, payUserId);
} }
@Override @Override
......
...@@ -3,12 +3,33 @@ ...@@ -3,12 +3,33 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" > "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.blt.other.module.cost.dao.CostDao"> <mapper namespace="com.blt.other.module.cost.dao.CostDao">
<resultMap id="cost" type="com.blt.other.module.cost.model.CostDomain"> <insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
<result column="attach" jdbcType="VARCHAR" property="attach" INSERT INTO cost(cost_no, company_no, company_name, type_no, type_name, subject_code, kind_no, kind_name,
typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/> create_usercode, create_username, cost_remark,
</resultMap> create_time, son_cost_no, sup_cost_no, cost_status, file_path, mor_file_path, amount,
create_userid, sub_logistics_supplier_id, logistics_supplier_id,
bank_name, bank_card, bank_card_user, mor_remark, cost_form, cost_reason, is_lend, had_pay,
lend_status, compensate, counteract, lend_balance,
reject_reason, bank_company, cost_plan_no, dic, pay_counteract, pay_lend_balance,
pay_plan_amount, pay_dic, pay_cur, is_tax,
detail_key, pay_user_id, pay_time, amount_rmb, to_rmb_rate, company_value, audit_time,
source_from, project_type, customer_num)
VALUE
(
#{costNo}, #{companyNo}, #{companyName}, #{typeNo}, #{typeName}, #{subjectCode}, #{kindNo}, #{kindName},
#{createUsercode}, #{createUsername}, #{costRemark},
#{createTime}, #{sonCostNo}, #{supCostNo}, #{costStatus}, #{filePath}, #{morFilePath}, #{amount},
#{createUserid}, #{subLogisticsSupplierId}, #{logisticsSupplierId},
#{bankName}, #{bankCard}, #{bankCardUser}, #{morRemark}, #{costForm}, #{costReason}, #{isLend}, #{hadPay},
#{lendStatus}, #{compensate}, #{counteract}, #{lendBalance},
#{rejectReason}, #{bankCompany}, #{costPlanNo}, #{dic}, #{payCounteract}, #{payLendBalance},
#{payPlanAmount}, #{payDic}, #{payCur}, #{isTax},
#{detailKey}, #{payUserId}, #{payTime}, #{amountRmb}, #{toRmbRate}, #{companyValue}, #{auditTime},
#{sourceFrom}, #{projectType}, #{customerNum}
)
</insert>
<select id="selectAll" resultType="com.blt.other.module.cost.model.CostDomain"> <select id="selectAll" resultType="com.blt.other.module.database.model.CostDomain">
SELECT SELECT
* *
FROM FROM
...@@ -26,7 +47,7 @@ ...@@ -26,7 +47,7 @@
id DESC id DESC
</select> </select>
<select id="selectByCostNo" resultMap="cost"> <select id="selectByCostNo" resultType="com.blt.other.module.database.model.CostDomain">
SELECT * SELECT *
FROM cost FROM cost
WHERE cost_no = #{costNo} WHERE cost_no = #{costNo}
...@@ -34,7 +55,7 @@ ...@@ -34,7 +55,7 @@
DESC DESC
</select> </select>
<update id="updateByNo" parameterType="com.blt.other.module.cost.model.CostDomain"> <update id="update" parameterType="com.blt.other.module.database.model.CostDomain">
UPDATE UPDATE
cost cost
<set> <set>
...@@ -99,21 +120,84 @@ ...@@ -99,21 +120,84 @@
cost_no = #{costNo} cost_no = #{costNo}
</update> </update>
<select id="selectByStatus" resultMap="cost"> <update id="updateById" parameterType="com.blt.other.module.database.model.CostDomain">
UPDATE
cost
<set>
<if test=" costNo!=null">cost_no=#{costNo},</if>
<if test=" companyNo!=null">company_no=#{companyNo},</if>
<if test=" companyName!=null">company_name=#{companyName},</if>
<if test=" typeNo!=null">type_no=#{typeNo},</if>
<if test=" typeName!=null">type_name=#{typeName},</if>
<if test=" subjectCode!=null">subject_code=#{subjectCode},</if>
<if test=" kindNo!=null">kind_no=#{kindNo},</if>
<if test=" kindName!=null">kind_name=#{kindName},</if>
<if test=" createUserid!=null">create_userid=#{createUserid},</if>
<if test=" createUsercode!=null">create_usercode=#{createUsercode},</if>
<if test=" createUsername!=null">create_username=#{createUsername},</if>
<if test=" costRemark!=null">cost_remark=#{costRemark},</if>
<if test=" createTime!=null">create_time=#{createTime},</if>
<if test=" sonCostNo!=null">son_cost_no=#{sonCostNo},</if>
<if test=" supCostNo!=null">sup_cost_no=#{supCostNo},</if>
<if test=" costStatus!=null">cost_status=#{costStatus},</if>
<if test=" filePath!=null">file_path=#{filePath},</if>
<if test=" morFilePath!=null">mor_file_path=#{morFilePath},</if>
<if test=" amount!=null">amount=#{amount},</if>
<if test=" logisticsSupplierId!=null">logistics_supplier_id=#{logisticsSupplierId},</if>
<if test=" bankName!=null">bank_name=#{bankName},</if>
<if test=" bankCard!=null">bank_card=#{bankCard},</if>
<if test=" bankCardUser!=null">bank_card_user=#{bankCardUser},</if>
<if test=" morRemark!=null">mor_remark=#{morRemark},</if>
<if test=" costForm!=null">cost_form=#{costForm},</if>
<if test=" costReason!=null">cost_reason=#{costReason},</if>
<if test=" isLend!=null">is_lend=#{isLend},</if>
<if test=" hadPay!=null">had_pay=#{hadPay},</if>
<if test=" lendStatus!=null">lend_status=#{lendStatus},</if>
<if test=" compensate!=null">compensate=#{compensate},</if>
<if test=" counteract!=null">counteract=#{counteract},</if>
<if test=" lendBalance!=null">lend_balance=#{lendBalance},</if>
<if test=" rejectReason!=null">reject_reason=#{rejectReason},</if>
<if test=" costPlanNo!=null">cost_plan_no=#{costPlanNo},</if>
<if test=" dic!=null">dic=#{dic},</if>
<if test=" payCounteract!=null">pay_counteract=#{payCounteract},</if>
<if test=" payLendBalance!=null">pay_lend_balance=#{payLendBalance},</if>
<if test=" payPlanAmount!=null">pay_plan_amount=#{payPlanAmount},</if>
<if test=" payDic!=null">pay_dic=#{payDic},</if>
<if test=" payCur!=null">pay_cur=#{payCur},</if>
<if test=" isTax!=null">is_tax=#{isTax},</if>
<if test=" detailKey!=null">detail_key=#{detailKey},</if>
<if test=" bankCompany!=null">bank_company=#{bankCompany},</if>
<if test=" payUserId!=null">pay_user_id=#{payUserId},</if>
<if test=" payTime!=null">pay_time=#{payTime},</if>
<if test=" toRmbRate!=null">to_rmb_rate=#{toRmbRate},</if>
<if test=" amountRmb!=null">amount_rmb=#{amountRmb},</if>
<if test=" companyValue!=null">company_value=#{companyValue},</if>
<if test=" auditTime!=null">audit_time=#{auditTime},</if>
<if test="hasInvoice != null">has_invoice = #{hasInvoice},</if>
<if test="rejectType != null">reject_type = #{rejectType},</if>
<if test="sourceFrom != null">source_from = #{sourceFrom},</if>
<if test="projectType != null">project_type = #{projectType},</if>
<if test="customerNum != null">customer_num = #{customerNum}</if>
</set>
WHERE
id = #{id}
</update>
<select id="selectByStatus" resultType="com.blt.other.module.database.model.CostDomain">
SELECT * SELECT *
FROM cost FROM cost
WHERE cost_status >= #{costStatus} WHERE cost_status >= #{costStatus}
ORDER BY id DESC ORDER BY id DESC
</select> </select>
<select id="selectByLend" resultType="com.blt.other.module.cost.model.CostDomain"> <select id="selectByLend" resultType="com.blt.other.module.database.model.CostDomain">
SELECT * SELECT *
FROM cost FROM cost
WHERE is_lend = #{isLend} WHERE is_lend = #{isLend}
ORDER BY id DESC ORDER BY id DESC
</select> </select>
<select id="selectByLendAndStatus" resultType="com.blt.other.module.cost.model.CostDomain"> <select id="selectByLendAndStatus" resultType="com.blt.other.module.database.model.CostDomain">
SELECT * SELECT *
FROM cost FROM cost
WHERE cost_status >= #{costStatus} WHERE cost_status >= #{costStatus}
...@@ -121,28 +205,28 @@ ...@@ -121,28 +205,28 @@
ORDER BY id DESC ORDER BY id DESC
</select> </select>
<select id="selectByCostStatus" resultType="com.blt.other.module.cost.model.CostDomain"> <select id="selectByCostStatus" resultType="com.blt.other.module.database.model.CostDomain">
SELECT * SELECT *
FROM cost FROM cost
WHERE cost_status = #{costStatus} WHERE cost_status = #{costStatus}
ORDER BY id DESC ORDER BY id DESC
</select> </select>
<select id="selectByLendStatus" resultType="com.blt.other.module.cost.model.CostDomain"> <select id="selectByLendStatus" resultType="com.blt.other.module.database.model.CostDomain">
SELECT * SELECT *
FROM cost FROM cost
WHERE lend_status = #{lendStatus} WHERE lend_status = #{lendStatus}
ORDER BY id DESC ORDER BY id DESC
</select> </select>
<select id="selectByCostForm" resultType="com.blt.other.module.cost.model.CostDomain"> <select id="selectByCostForm" resultType="com.blt.other.module.database.model.CostDomain">
SELECT * SELECT *
FROM cost FROM cost
WHERE cost_form = #{costForm} WHERE cost_form = #{costForm}
ORDER BY id DESC ORDER BY id DESC
</select> </select>
<select id="selectByCostFormAndStatus" resultType="com.blt.other.module.cost.model.CostDomain"> <select id="selectByCostFormAndStatus" resultType="com.blt.other.module.database.model.CostDomain">
SELECT * SELECT *
FROM cost FROM cost
WHERE cost_status >= #{costStatus} WHERE cost_status >= #{costStatus}
...@@ -150,14 +234,14 @@ ...@@ -150,14 +234,14 @@
ORDER BY id DESC ORDER BY id DESC
</select> </select>
<select id="selectBySupCostNo" resultType="com.blt.other.module.cost.model.CostDomain"> <select id="selectBySupCostNo" resultType="com.blt.other.module.database.model.CostDomain">
SELECT * SELECT *
FROM cost FROM cost
WHERE sup_cost_no = #{supCostNo} WHERE sup_cost_no = #{supCostNo}
ORDER BY id DESC ORDER BY id DESC
</select> </select>
<select id="selectByKeys" resultType="com.blt.other.module.cost.model.CostDomain"> <select id="selectByKeys" resultType="com.blt.other.module.database.model.CostDomain">
SELECT SELECT
* *
FROM FROM
...@@ -175,7 +259,7 @@ ...@@ -175,7 +259,7 @@
id DESC id DESC
</select> </select>
<select id="selectByKey" resultType="com.blt.other.module.cost.model.CostDomain"> <select id="selectByKey" resultType="com.blt.other.module.database.model.CostDomain">
SELECT * SELECT *
FROM cost FROM cost
WHERE cost_status >= #{costStatus} WHERE cost_status >= #{costStatus}
...@@ -195,21 +279,22 @@ ...@@ -195,21 +279,22 @@
ORDER BY id DESC ORDER BY id DESC
</select> </select>
<select id="selectByCostPlanNo" resultType="com.blt.other.module.cost.model.CostDomain"> <select id="selectByCostPlanNo" resultType="com.blt.other.module.database.model.CostDomain">
SELECT * SELECT *
FROM cost FROM cost
WHERE cost_plan_no = #{costPlanNo} WHERE cost_plan_no = #{costPlanNo}
ORDER BY id DESC ORDER BY id DESC
</select> </select>
<select id="selectLastCost" resultType="com.blt.other.module.cost.model.CostDomain"> <select id="selectLastCost" resultType="com.blt.other.module.database.model.CostDomain">
SELECT * SELECT *
FROM cost FROM cost
ORDER BY id DESC ORDER BY id DESC
LIMIT 1 LIMIT 1
</select> </select>
<select id="selectLinkLendCost" resultType="com.blt.other.module.cost.model.CostDomain">
<select id="selectLinkLendCost" resultType="com.blt.other.module.database.model.CostDomain">
SELECT * SELECT *
FROM cost FROM cost
WHERE cost_status = 4 WHERE cost_status = 4
...@@ -222,8 +307,7 @@ ...@@ -222,8 +307,7 @@
ORDER BY id DESC ORDER BY id DESC
</select> </select>
<!--管理成本:查询付款单+收款单+借还单+采购单--> <select id="getLogisticsCostList" resultType="com.bailuntec.cost.api.dto.ManageCostDto">
<select id="selectManageCost" resultType="com.bailuntec.cost.api.dto.ManageCostDto">
SELECT c.cost_no no,c.bank_company receiveUnit,d.cost_reason reason,c.pay_time payTime,c.cost_form SELECT c.cost_no no,c.bank_company receiveUnit,d.cost_reason reason,c.pay_time payTime,c.cost_form
manageCostType,u.departmentname1 departmentName, manageCostType,u.departmentname1 departmentName,
c.company_value companyValue,c.company_name companyName,t.manage_cost_type feeSuperType,d.kind_name c.company_value companyValue,c.company_name companyName,t.manage_cost_type feeSuperType,d.kind_name
...@@ -232,6 +316,54 @@ ...@@ -232,6 +316,54 @@
FROM user u, cost c, cost_detail d, type_relation t FROM user u, cost c, cost_detail d, type_relation t
WHERE c.create_userid = u.userid AND c.cost_no = d.cost_no AND t.fee_type = c.type_name AND c.cost_form = 1 AND WHERE c.create_userid = u.userid AND c.cost_no = d.cost_no AND t.fee_type = c.type_name AND c.cost_form = 1 AND
c.cost_status = 4 c.cost_status = 4
AND d.kind_name = '物流费'
<if test="startDate != null">AND c.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND c.pay_time <![CDATA[<]]>#{endDate}</if>
UNION
SELECT c1.cost_no no,c1.bank_company receiveUnit,c1.cost_reason reason,c1.pay_time payTime,c1.cost_form manageCostType,u.departmentname1 departmentName,
c1.company_value companyValue,c1.company_name companyName,t.manage_cost_type feeSuperType,c1.kind_name feeSubType,-c1.amount amount,c1.dic currency,
-c1.amount * c1.to_rmb_rate amountRmb, 0 as costId1, c1.id as costId
FROM user u, type_relation t ,cost c1
WHERE c1.create_userid = u.userid AND t.fee_type = c1.type_name AND c1.cost_form = 2 AND c1.cost_status = 4
AND c1.kind_name = '物流费'
<if test="startDate != null">AND c1.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND c1.pay_time <![CDATA[<]]>#{endDate}</if>
UNION
SELECT c.cost_no no,c.bank_company receiveUnit,c.cost_reason reason,c.pay_time payTime,c.cost_form
manageCostType,u.departmentname1 departmentName,
c.company_value companyValue,c.company_name companyName,t.manage_cost_type feeSuperType,c.kind_name
feeSubType,c.amount amount,c.dic currency,
c.amount * c.to_rmb_rate amountRmb, 0 as costId1, c.id as costId
FROM user u, cost c, type_relation t
WHERE c.create_userid = u.userid AND t.fee_type = c.type_name AND c.cost_form = 3 AND c.is_lend = 2 AND
c.cost_status = 4
AND c.kind_name = '物流费'
<if test="startDate != null">AND c.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND c.pay_time <![CDATA[<]]>#{endDate}</if>
UNION
SELECT b.buyno no,b.suppliername receiveUnit,b.note reason,b.pay_time payTime,0 as
manageCostType,b.departmentname departmentName,
b.company_value companyValue,b.company companyName,b.sku_type_name feeSuperType,b.sku_type_name feeSubType,
b.amount amount,'CNY',b.amount amountRmb, 0 as costId1, 0 as costId
FROM buy b
WHERE b.sku_type_name = '物流费'
and b.buystatus <![CDATA[>]]> 3 and b.buystatus <![CDATA[<]]> 7 and b.buy_type <![CDATA[<]]> 3
<if test="startDate != null">AND b.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND b.pay_time <![CDATA[<]]>#{endDate}</if>
</select>
<select id="getCostList" resultType="com.bailuntec.cost.api.dto.CostDto">
select * from cost where last_modify_date &gt;= #{startDate} and last_modify_date &lt;= #{endDate}
</select>
<!--管理成本:查询付款单+收款单+借还单+采购单-->
<select id="selectManageCost" resultType="com.bailuntec.cost.api.dto.ManageCostDto">
SELECT c.cost_no no,c.bank_company receiveUnit,d.cost_reason reason,c.pay_time payTime,c.cost_form manageCostType,u.departmentname1 departmentName,
c.company_value companyValue,c.company_name companyName,t.manage_cost_type feeSuperType,d.kind_name feeSubType,d.amount amount,c.dic currency,
d.amount * c.to_rmb_rate amountRmb, d.id as costId1, c.id as costId
FROM user u, cost c, cost_detail d, type_relation t
WHERE c.create_userid = u.userid AND c.cost_no = d.cost_no AND t.fee_type = c.type_name AND c.cost_form = 1 AND c.cost_status = 4
AND c.logistics_supplier_id is null AND c.company_value =2 AND d.kind_name not in ('百伦咨询服务费','物流费') AND c.logistics_supplier_id is null AND c.company_value =2 AND d.kind_name not in ('百伦咨询服务费','物流费')
<if test="feeSuperType != null and feeSuperType != ''">AND t.manage_cost_type = #{feeSuperType}</if> <if test="feeSuperType != null and feeSuperType != ''">AND t.manage_cost_type = #{feeSuperType}</if>
<if test="feeSubType != null and feeSubType != ''">AND d.kind_name = #{feeSubType}</if> <if test="feeSubType != null and feeSubType != ''">AND d.kind_name = #{feeSubType}</if>
...@@ -239,7 +371,7 @@ ...@@ -239,7 +371,7 @@
<if test="companyValueList != null and companyValueList.size() > 0"> <if test="companyValueList != null and companyValueList.size() > 0">
AND c.company_value in AND c.company_value in
<foreach collection="companyValueList" item="companyValue" index="index" open="(" close=")" separator=","> <foreach collection="companyValueList" item="companyValue" index="index" open="(" close=")" separator=",">
<if test="companyValue != null and companyValue != 0">#{companyValue}</if> <if test="companyValue != null and companyValue != 0"> #{companyValue}</if>
</foreach> </foreach>
</if> </if>
<if test="companyName != null and companyName != ''">AND c.company_name = #{companyName}</if> <if test="companyName != null and companyName != ''">AND c.company_name = #{companyName}</if>
...@@ -248,23 +380,19 @@ ...@@ -248,23 +380,19 @@
<if test="startDate != null">AND c.pay_time <![CDATA[>=]]> #{startDate}</if> <if test="startDate != null">AND c.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND c.pay_time <![CDATA[<]]>#{endDate}</if> <if test="endDate != null">AND c.pay_time <![CDATA[<]]>#{endDate}</if>
UNION UNION
SELECT c.cost_no no,c.bank_company receiveUnit,d.cost_reason reason,c.pay_time payTime,c.cost_form SELECT c.cost_no no,c.bank_company receiveUnit,d.cost_reason reason,c.pay_time payTime,c.cost_form manageCostType,u.departmentname1 departmentName,
manageCostType,u.departmentname1 departmentName, c.company_value companyValue,c.company_name companyName,t.manage_cost_type feeSuperType,d.kind_name feeSubType,d.amount amount,c.dic currency,
c.company_value companyValue,c.company_name companyName,t.manage_cost_type feeSuperType,d.kind_name
feeSubType,d.amount amount,c.dic currency,
d.amount * c.to_rmb_rate amountRmb, d.id as costId1, c.id as costId d.amount * c.to_rmb_rate amountRmb, d.id as costId1, c.id as costId
FROM user u, cost c, cost_detail d, type_relation t FROM user u, cost c, cost_detail d, type_relation t
WHERE c.create_userid = u.userid AND c.cost_no = d.cost_no AND t.fee_type = c.type_name AND c.cost_form = 1 AND WHERE c.create_userid = u.userid AND c.cost_no = d.cost_no AND t.fee_type = c.type_name AND c.cost_form = 1 AND c.cost_status = 4
c.cost_status = 4 AND c.logistics_supplier_id is null AND c.company_value in (1,3,5,7,8,11,46,48,50,53,59,60,61,66,69,78,72,71,67,58,64,46) AND d.kind_name not in ('百伦咨询服务费')
AND c.logistics_supplier_id is null AND c.company_value in (1,3,5,7,8,11,46,48,50,53,59,60,61,66,69) AND
d.kind_name not in ('百伦咨询服务费')
<if test="feeSuperType != null and feeSuperType != ''">AND t.manage_cost_type = #{feeSuperType}</if> <if test="feeSuperType != null and feeSuperType != ''">AND t.manage_cost_type = #{feeSuperType}</if>
<if test="feeSubType != null and feeSubType != ''">AND d.kind_name = #{feeSubType}</if> <if test="feeSubType != null and feeSubType != ''">AND d.kind_name = #{feeSubType}</if>
<if test="departmentName != null and departmentName != ''">AND u.departmentname1 = #{departmentName}</if> <if test="departmentName != null and departmentName != ''">AND u.departmentname1 = #{departmentName}</if>
<if test="companyValueList != null and companyValueList.size() > 0"> <if test="companyValueList != null and companyValueList.size() > 0">
AND c.company_value in AND c.company_value in
<foreach collection="companyValueList" item="companyValue" index="index" open="(" close=")" separator=","> <foreach collection="companyValueList" item="companyValue" index="index" open="(" close=")" separator=",">
<if test="companyValue != null and companyValue != 0">#{companyValue}</if> <if test="companyValue != null and companyValue != 0"> #{companyValue}</if>
</foreach> </foreach>
</if> </if>
<if test="companyName != null and companyName != ''">AND c.company_name = #{companyName}</if> <if test="companyName != null and companyName != ''">AND c.company_name = #{companyName}</if>
...@@ -273,10 +401,8 @@ ...@@ -273,10 +401,8 @@
<if test="startDate != null">AND c.pay_time <![CDATA[>=]]> #{startDate}</if> <if test="startDate != null">AND c.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND c.pay_time <![CDATA[<]]>#{endDate}</if> <if test="endDate != null">AND c.pay_time <![CDATA[<]]>#{endDate}</if>
UNION UNION
SELECT c1.cost_no no,c1.bank_company receiveUnit,c1.cost_reason reason,c1.pay_time payTime,c1.cost_form SELECT c1.cost_no no,c1.bank_company receiveUnit,c1.cost_reason reason,c1.pay_time payTime,c1.cost_form manageCostType,u.departmentname1 departmentName,
manageCostType,u.departmentname1 departmentName, c1.company_value companyValue,c1.company_name companyName,t.manage_cost_type feeSuperType,c1.kind_name feeSubType,-c1.amount amount,c1.dic currency,
c1.company_value companyValue,c1.company_name companyName,t.manage_cost_type feeSuperType,c1.kind_name
feeSubType,-c1.amount amount,c1.dic currency,
-c1.amount * c1.to_rmb_rate amountRmb, 0 as costId1, c1.id as costId -c1.amount * c1.to_rmb_rate amountRmb, 0 as costId1, c1.id as costId
FROM user u, type_relation t ,cost c1 FROM user u, type_relation t ,cost c1
WHERE c1.create_userid = u.userid AND t.fee_type = c1.type_name AND c1.cost_form = 2 AND c1.cost_status = 4 WHERE c1.create_userid = u.userid AND t.fee_type = c1.type_name AND c1.cost_form = 2 AND c1.cost_status = 4
...@@ -290,7 +416,7 @@ ...@@ -290,7 +416,7 @@
<if test="companyValueList != null and companyValueList.size() > 0"> <if test="companyValueList != null and companyValueList.size() > 0">
AND c1.company_value in AND c1.company_value in
<foreach collection="companyValueList" item="companyValue" index="index" open="(" close=")" separator=","> <foreach collection="companyValueList" item="companyValue" index="index" open="(" close=")" separator=",">
<if test="companyValue != null and companyValue != 0">#{companyValue}</if> <if test="companyValue != null and companyValue != 0"> #{companyValue}</if>
</foreach> </foreach>
</if> </if>
<if test="companyName != null and companyName != ''">AND c1.company_name = #{companyName}</if> <if test="companyName != null and companyName != ''">AND c1.company_name = #{companyName}</if>
...@@ -299,14 +425,12 @@ ...@@ -299,14 +425,12 @@
<if test="startDate != null">AND c1.pay_time <![CDATA[>=]]> #{startDate}</if> <if test="startDate != null">AND c1.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND c1.pay_time <![CDATA[<]]>#{endDate}</if> <if test="endDate != null">AND c1.pay_time <![CDATA[<]]>#{endDate}</if>
UNION UNION
SELECT c1.cost_no no,c1.bank_company receiveUnit,c1.cost_reason reason,c1.pay_time payTime,c1.cost_form SELECT c1.cost_no no,c1.bank_company receiveUnit,c1.cost_reason reason,c1.pay_time payTime,c1.cost_form manageCostType,u.departmentname1 departmentName,
manageCostType,u.departmentname1 departmentName, c1.company_value companyValue,c1.company_name companyName,t.manage_cost_type feeSuperType,c1.kind_name feeSubType,-c1.amount amount,c1.dic currency,
c1.company_value companyValue,c1.company_name companyName,t.manage_cost_type feeSuperType,c1.kind_name
feeSubType,-c1.amount amount,c1.dic currency,
-c1.amount * c1.to_rmb_rate amountRmb, 0 as costId1, c1.id as costId -c1.amount * c1.to_rmb_rate amountRmb, 0 as costId1, c1.id as costId
FROM user u, type_relation t ,cost c1 FROM user u, type_relation t ,cost c1
WHERE c1.create_userid = u.userid AND t.fee_type = c1.type_name AND c1.cost_form = 2 AND c1.cost_status = 4 WHERE c1.create_userid = u.userid AND t.fee_type = c1.type_name AND c1.cost_form = 2 AND c1.cost_status = 4
AND c1.company_value in (1,3,5,7,8,11,46,48,50,53,59,60,61,66,69) AND c1.kind_name not in ('百伦咨询服务费') AND c1.company_value in (1,3,5,7,8,11,46,48,50,53,59,60,61,66,69,78,72,71,67,58,64,46) AND c1.kind_name not in ('百伦咨询服务费')
AND exists (SELECT 1 FROM cost c2 WHERE c1.company_value = c2.company_value AND c1.type_name = c2.type_name AND exists (SELECT 1 FROM cost c2 WHERE c1.company_value = c2.company_value AND c1.type_name = c2.type_name
AND c2.create_userid = u.userid AND t.fee_type = c2.type_name AND c2.cost_form = 1 AND c2.cost_status = 4 AND c2.create_userid = u.userid AND t.fee_type = c2.type_name AND c2.cost_form = 1 AND c2.cost_status = 4
AND c2.logistics_supplier_id is null) AND c2.logistics_supplier_id is null)
...@@ -316,7 +440,7 @@ ...@@ -316,7 +440,7 @@
<if test="companyValueList != null and companyValueList.size() > 0"> <if test="companyValueList != null and companyValueList.size() > 0">
AND c1.company_value in AND c1.company_value in
<foreach collection="companyValueList" item="companyValue" index="index" open="(" close=")" separator=","> <foreach collection="companyValueList" item="companyValue" index="index" open="(" close=")" separator=",">
<if test="companyValue != null and companyValue != 0">#{companyValue}</if> <if test="companyValue != null and companyValue != 0"> #{companyValue}</if>
</foreach> </foreach>
</if> </if>
<if test="companyName != null and companyName != ''">AND c1.company_name = #{companyName}</if> <if test="companyName != null and companyName != ''">AND c1.company_name = #{companyName}</if>
...@@ -325,22 +449,19 @@ ...@@ -325,22 +449,19 @@
<if test="startDate != null">AND c1.pay_time <![CDATA[>=]]> #{startDate}</if> <if test="startDate != null">AND c1.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND c1.pay_time <![CDATA[<]]>#{endDate}</if> <if test="endDate != null">AND c1.pay_time <![CDATA[<]]>#{endDate}</if>
UNION UNION
SELECT c.cost_no no,c.bank_company receiveUnit,c.cost_reason reason,c.pay_time payTime,c.cost_form SELECT c.cost_no no,c.bank_company receiveUnit,c.cost_reason reason,c.pay_time payTime,c.cost_form manageCostType,u.departmentname1 departmentName,
manageCostType,u.departmentname1 departmentName, c.company_value companyValue,c.company_name companyName,t.manage_cost_type feeSuperType,c.kind_name feeSubType,c.amount amount,c.dic currency,
c.company_value companyValue,c.company_name companyName,t.manage_cost_type feeSuperType,c.kind_name
feeSubType,c.amount amount,c.dic currency,
c.amount * c.to_rmb_rate amountRmb, 0 as costId1, c.id as costId c.amount * c.to_rmb_rate amountRmb, 0 as costId1, c.id as costId
FROM user u, cost c, type_relation t FROM user u, cost c, type_relation t
WHERE c.create_userid = u.userid AND t.fee_type = c.type_name AND c.cost_form = 3 AND c.is_lend = 2 AND WHERE c.create_userid = u.userid AND t.fee_type = c.type_name AND c.cost_form = 3 AND c.is_lend = 2 AND c.cost_status = 4
c.cost_status = 4 AND c.company_value in (1,2,3,5,7,8,11,46,48,50,53,59,60,61,66,69,78,72,71,67,58,64,46) AND c.kind_name not in ('百伦咨询服务费')
AND c.company_value in (1,2,3,5,7,8,11,46,48,50,53,59,60,61,66,69) AND c.kind_name not in ('百伦咨询服务费')
<if test="feeSuperType != null and feeSuperType != ''">AND t.manage_cost_type = #{feeSuperType}</if> <if test="feeSuperType != null and feeSuperType != ''">AND t.manage_cost_type = #{feeSuperType}</if>
<if test="feeSubType != null and feeSubType != ''">AND c.kind_name = #{feeSubType}</if> <if test="feeSubType != null and feeSubType != ''">AND c.kind_name = #{feeSubType}</if>
<if test="departmentName != null and departmentName != ''">AND u.departmentname1 = #{departmentName}</if> <if test="departmentName != null and departmentName != ''">AND u.departmentname1 = #{departmentName}</if>
<if test="companyValueList != null and companyValueList.size() > 0"> <if test="companyValueList != null and companyValueList.size() > 0">
AND c.company_value in AND c.company_value in
<foreach collection="companyValueList" item="companyValue" index="index" open="(" close=")" separator=","> <foreach collection="companyValueList" item="companyValue" index="index" open="(" close=")" separator=",">
<if test="companyValue != null and companyValue != 0">#{companyValue}</if> <if test="companyValue != null and companyValue != 0"> #{companyValue}</if>
</foreach> </foreach>
</if> </if>
<if test="companyName != null and companyName != ''">AND c.company_name = #{companyName}</if> <if test="companyName != null and companyName != ''">AND c.company_name = #{companyName}</if>
...@@ -349,12 +470,11 @@ ...@@ -349,12 +470,11 @@
<if test="startDate != null">AND c.pay_time <![CDATA[>=]]> #{startDate}</if> <if test="startDate != null">AND c.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND c.pay_time <![CDATA[<]]>#{endDate}</if> <if test="endDate != null">AND c.pay_time <![CDATA[<]]>#{endDate}</if>
UNION UNION
SELECT b.buyno no,b.suppliername receiveUnit,b.note reason,b.pay_time payTime,0 as SELECT b.buyno no,b.suppliername receiveUnit,b.note reason,b.pay_time payTime,0 as manageCostType,b.departmentname departmentName,
manageCostType,b.departmentname departmentName,
b.company_value companyValue,b.company companyName,b.sku_type_name feeSuperType,b.sku_type_name feeSubType, b.company_value companyValue,b.company companyName,b.sku_type_name feeSuperType,b.sku_type_name feeSubType,
b.amount amount,'CNY',b.amount amountRmb, 0 as costId1, b.id as costId b.amount amount,'CNY',b.amount amountRmb, 0 as costId1, b.id as costId
FROM buy b FROM buy b
WHERE b.company_value in (1,2,3,5,7,8,11,46,48,50,53,59,60,61,66,69) AND b.sku_type_name in ('固定资产','低值易耗品') WHERE b.company_value in (1,2,3,5,7,8,11,46,48,50,53,59,60,61,66,69,78,72,71,67,58,64,46) AND b.sku_type_name in ('固定资产','低值易耗品')
and b.buystatus <![CDATA[>]]> 3 and b.buystatus <![CDATA[<]]> 7 and b.buy_type <![CDATA[<]]> 3 and b.buystatus <![CDATA[>]]> 3 and b.buystatus <![CDATA[<]]> 7 and b.buy_type <![CDATA[<]]> 3
<if test="feeSuperType != null and feeSuperType != ''">AND b.sku_type_name = #{feeSuperType}</if> <if test="feeSuperType != null and feeSuperType != ''">AND b.sku_type_name = #{feeSuperType}</if>
<if test="feeSubType != null and feeSubType != ''">AND b.sku_type_name = #{feeSubType}</if> <if test="feeSubType != null and feeSubType != ''">AND b.sku_type_name = #{feeSubType}</if>
...@@ -362,7 +482,7 @@ ...@@ -362,7 +482,7 @@
<if test="companyValueList != null and companyValueList.size() > 0"> <if test="companyValueList != null and companyValueList.size() > 0">
AND b.company_value in AND b.company_value in
<foreach collection="companyValueList" item="companyValue" index="index" open="(" close=")" separator=","> <foreach collection="companyValueList" item="companyValue" index="index" open="(" close=")" separator=",">
<if test="companyValue != null and companyValue != 0">#{companyValue}</if> <if test="companyValue != null and companyValue != 0"> #{companyValue}</if>
</foreach> </foreach>
</if> </if>
<if test="companyName != null and companyName != ''">AND b.company = #{companyName}</if> <if test="companyName != null and companyName != ''">AND b.company = #{companyName}</if>
...@@ -371,55 +491,6 @@ ...@@ -371,55 +491,6 @@
<if test="endDate != null">AND b.pay_time <![CDATA[<]]>#{endDate}</if> <if test="endDate != null">AND b.pay_time <![CDATA[<]]>#{endDate}</if>
</select> </select>
<!--查询所有的物流费用单和采购单-->
<select id="getLogisticsCostList" resultType="com.bailuntec.cost.api.dto.ManageCostDto">
SELECT c.cost_no no,c.bank_company receiveUnit,d.cost_reason reason,c.pay_time payTime,c.cost_form
manageCostType,u.departmentname1 departmentName,
c.company_value companyValue,c.company_name companyName,t.manage_cost_type feeSuperType,d.kind_name
feeSubType,d.amount amount,c.dic currency,
d.amount * c.to_rmb_rate amountRmb, d.id as costId1, c.id as costId
FROM user u, cost c, cost_detail d, type_relation t
WHERE c.create_userid = u.userid AND c.cost_no = d.cost_no AND t.fee_type = c.type_name AND c.cost_form = 1 AND
c.cost_status = 4
AND d.kind_name = '物流费'
<if test="startDate != null">AND c.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND c.pay_time <![CDATA[<]]>#{endDate}</if>
UNION
SELECT c1.cost_no no,c1.bank_company receiveUnit,c1.cost_reason reason,c1.pay_time payTime,c1.cost_form
manageCostType,u.departmentname1 departmentName,
c1.company_value companyValue,c1.company_name companyName,t.manage_cost_type feeSuperType,c1.kind_name
feeSubType,-c1.amount amount,c1.dic currency,
-c1.amount * c1.to_rmb_rate amountRmb, 0 as costId1, c1.id as costId
FROM user u, type_relation t ,cost c1
WHERE c1.create_userid = u.userid AND t.fee_type = c1.type_name AND c1.cost_form = 2 AND c1.cost_status = 4
AND c1.kind_name = '物流费'
<if test="startDate != null">AND c1.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND c1.pay_time <![CDATA[<]]>#{endDate}</if>
UNION
SELECT c.cost_no no,c.bank_company receiveUnit,c.cost_reason reason,c.pay_time payTime,c.cost_form
manageCostType,u.departmentname1 departmentName,
c.company_value companyValue,c.company_name companyName,t.manage_cost_type feeSuperType,c.kind_name
feeSubType,c.amount amount,c.dic currency,
c.amount * c.to_rmb_rate amountRmb, 0 as costId1, c.id as costId
FROM user u, cost c, type_relation t
WHERE c.create_userid = u.userid AND t.fee_type = c.type_name AND c.cost_form = 3 AND c.is_lend = 2 AND
c.cost_status = 4
AND c.kind_name = '物流费'
<if test="startDate != null">AND c.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND c.pay_time <![CDATA[<]]>#{endDate}</if>
UNION
SELECT b.buyno no,b.suppliername receiveUnit,b.note reason,b.pay_time payTime,0 as
manageCostType,b.departmentname departmentName,
b.company_value companyValue,b.company companyName,b.sku_type_name feeSuperType,b.sku_type_name feeSubType,
b.amount amount,'CNY',b.amount amountRmb, 0 as costId1, 0 as costId
FROM buy b
WHERE b.sku_type_name = '物流费'
and b.buystatus <![CDATA[>]]> 3 and b.buystatus <![CDATA[<]]> 7 and b.buy_type <![CDATA[<]]> 3
<if test="startDate != null">AND b.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND b.pay_time <![CDATA[<]]>#{endDate}</if>
</select>
<!-- <!--
资产负债表相关费用单 资产负债表相关费用单
1、已完成状态的所有费用类型借支单 1、已完成状态的所有费用类型借支单
...@@ -428,7 +499,7 @@ ...@@ -428,7 +499,7 @@
4、待出纳付款状态的所有费用类型付款单 4、待出纳付款状态的所有费用类型付款单
5、已完成状态的费用类型为"借款-其他应付款"、"收款-其他应付款"的还款单 5、已完成状态的费用类型为"借款-其他应付款"、"收款-其他应付款"的还款单
--> -->
<select id="selectBalanceSheetCost" resultType="com.blt.other.module.cost.model.CostDomain"> <select id="selectBalanceSheetCost" resultType="com.blt.other.module.database.model.CostDomain">
SELECT * SELECT *
FROM cost FROM cost
WHERE cost_form = 3 WHERE cost_form = 3
...@@ -470,13 +541,14 @@ ...@@ -470,13 +541,14 @@
</select> </select>
<!--查询原来传输到数据中心时为待支付状态 变成 已支付状态后的费用单--> <!--查询原来传输到数据中心时为待支付状态 变成 已支付状态后的费用单-->
<select id="selectNoPayCost" resultType="com.blt.other.module.cost.model.CostDomain"> <select id="selectNoPayCost" resultType="com.blt.other.module.database.model.CostDomain">
SELECT * FROM cost WHERE cost_form = 1 AND cost_status = 4 AND cost_no in SELECT * FROM cost WHERE cost_form = 1 AND cost_status = 4 AND cost_no in
<foreach collection="list" item="costNo" index="index" open="(" close=")" separator=","> <foreach collection="list" item="costNo" index="index" open="(" close=")" separator=",">
#{costNo} #{costNo}
</foreach> </foreach>
</select> </select>
<select id="selectCostStatusByNo" resultType="integer"> <select id="selectCostStatusByNo" resultType="integer">
select cost_status select cost_status
from cost from cost
...@@ -498,7 +570,6 @@ ...@@ -498,7 +570,6 @@
and cost_status = 4 and cost_status = 4
and cashier_file_path = '' and cashier_file_path = ''
</select> </select>
<select id="listCostNoAll" resultType="java.lang.String"> <select id="listCostNoAll" resultType="java.lang.String">
select cost_no from cost select cost_no from cost
WHERE WHERE
...@@ -546,43 +617,6 @@ ...@@ -546,43 +617,6 @@
</if> </if>
</select> </select>
<select id="getCostList" resultType="com.bailuntec.cost.api.dto.CostDto">
select *
from cost
where last_modify_date &gt;= #{startDate}
and last_modify_date &lt;= #{endDate}
</select>
<select id="checkCostList" resultMap="cost">
select t1.*
from cost t1
left join cost_log cl on t1.cost_no = cl.cost_no
where true
/*财务 或者 最终审核*/
<if test="type==1">
/*待审核*/
<if test=" status == 2 ">
and (t1.cost_status = 7 or t1.cost_status = 8)
</if>
</if>
/*部门审核*/
<if test="type==2">
/*待审核*/
<if test=" status == 2 ">
and t1.cost_status = 6
</if>
/*已手动审核*/
<if test=" status == 3 ">
and cl.type = 5
</if>
/*已自动审核*/
<if test=" status == 4 ">
and cl.type = 4
</if>
</if>
group by
t1.id
</select>
<update id="updateCashierAnnex"> <update id="updateCashierAnnex">
update cost update cost
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment