Commit 2d34535d by huluobin

Roll Back !!

parent 0543ddbf
......@@ -84,6 +84,10 @@ public class CostDto {
//客户编号
private String customerNum;
@ApiModelProperty("能否审核")
@TableField(exist = false)
private Boolean canAudit;
@TableField(typeHandler = JacksonTypeHandler.class)
@ApiModelProperty("附加字段")
private List<CostAttach> attach;
......
......@@ -52,7 +52,6 @@
<select id="getCostList" resultType="com.blt.other.other_cost.dto.CostDto">
select * from cost where last_modify_date &gt;= #{startDate} and last_modify_date &lt;= #{endDate}
</select>
<!--管理成本:查询付款单+收款单+借还单+采购单-->
<select id="selectManageCost" resultType="com.blt.other.other_cost.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,
......@@ -187,4 +186,4 @@
<if test="endDate != null">AND b.pay_time <![CDATA[<]]>#{endDate}</if>
</select>
</mapper>
\ No newline at end of file
</mapper>
......@@ -254,6 +254,7 @@
<serverId>bailuntec-docker</serverId>
</configuration>
</plugin>
</plugins>
<!--配置资源文件目录-->
......
package com.blt.other.common.interceptor;
import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
/**
* <p>
* spring mvc拦截器配置
* </p>
*
* @author robbendev
*/
@Configuration
@AllArgsConstructor
public class MvcInterceptorConfig extends WebMvcConfigurationSupport {
private final SessionHandlerInterceptor sessionHandlerInterceptor;
@Override
protected void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(sessionHandlerInterceptor);
super.addInterceptors(registry);
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
//swagger增加url映射
registry.addResourceHandler("/swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
registry.addResourceHandler("/doc.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
package com.blt.other.common.interceptor;
import com.blt.other.common.util.SessionUtils;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Component
@AllArgsConstructor
@Slf4j
public class SessionHandlerInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
try {
String userid = request.getHeader("userid");
SessionUtils.putCurrentUserId(Integer.valueOf(userid));
}catch (Exception ignore){
}
return true;
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
SessionUtils.removeCurrentUserId();
}
}
package com.blt.other.common.job;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.blt.other.module.auth.dao.UserDao;
import com.blt.other.module.cost.dao.CostDao;
import com.blt.other.module.cost.dao.CostLogDao;
import com.bailuntec.cost.api.dto.CostDto;
import com.blt.other.module.cost.service.CostService;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostService;
import com.blt.other.module.database.model.CostLogDomain;
import com.blt.other.module.database.model.UserDomain;
import org.quartz.JobExecutionContext;
......@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
......@@ -39,24 +40,27 @@ public class CostStatusSyncJob extends QuartzJobBean {
@Override
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
logger.info("系统自动作废驳回费用单");
List<CostDto> costDtoList = costDao.getCostByRejectStatus();
for(CostDto costDto : costDtoList) {
CostDomain costDomain = new CostDomain();
costDomain.setCostNo(costDto.getCostNo());
costDomain.setCostStatus(5);
int result = costDao.updateByNo(costDomain);
if(result > 0) {
List<CostDomain> costDomainList = costDao.selectList(new LambdaQueryWrapper<CostDomain>()
.eq(CostDomain::getCostStatus, CostDomain.STATUS_REJECT)
.eq(CostDomain::getRejectType, 1)
.lt(CostDomain::getRejectTime, LocalDateTime.now().minusDays(1)));
costDomainList.forEach(costDomain -> {
costDomain.setCostStatus(CostDomain.STATUS_DELETE);
int result = costDao.updateById(costDomain);
if (result > 0) {
CostLogDomain costLog = new CostLogDomain();
costLog.setCostNo(costDto.getCostNo());
costLog.setCostNo(costDomain.getCostNo());
costLog.setUpdateTime(new Date());
UserDomain user = userDao.selectByuserid(2493);
costLog.setUpdateUsercode(user.getUsercode());
costLog.setUpdateUserid(2493);
costLog.setUpdateUsername(user.getUsername());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
costLog.setUpdateNote(sdf.format(costLog.getUpdateTime())+" 过期财务驳回单系统自动作废 更新人:"+user.getUsername());
costLog.setUpdateNote(sdf.format(costLog.getUpdateTime()) + " 过期财务驳回单系统自动作废 更新人:" + user.getUsername());
costLogDao.insert(costLog);
}
}
});
}
}
package com.blt.other.common.util;
/**
* 应用会话管理工具类
*/
public class SessionUtils {
/*当前登录用户id*/
private static final ThreadLocal<Integer> useridThreadLocal = new ThreadLocal<>();
public static void putCurrentUserId(Integer currentUserId) {
useridThreadLocal.set(currentUserId);
}
public static Integer getCurrentUserId() {
return useridThreadLocal.get();
}
public static void removeCurrentUserId() {
useridThreadLocal.remove();
}
}
......@@ -6,8 +6,8 @@ import com.bailuntec.cost.api.dto.LogisticsCostDto;
import com.bailuntec.cost.api.dto.ManageCostDto;
import com.bailuntec.cost.api.dto.WageCostDto;
import com.bailuntec.cost.api.response.CostResult;
import com.blt.other.module.cost.service.CostApiService;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostApiService;
import io.swagger.annotations.ApiOperation;
import lombok.SneakyThrows;
import org.slf4j.Logger;
......@@ -166,12 +166,8 @@ public class CostApiController implements CostApi {
@ApiOperation("查询原来传输到数据中心时为待支付状态 变成 已支付状态后的费用单")
@GetMapping("/noPayCost")
public CostResult<List<CostDto>> getNoPayCost(@RequestParam(name = "costNoList") List<String> costNoList) {
if (costNoList != null && costNoList.size() > 0) {
List<CostDomain> costDomainList = costApiService.getNoPayCost(costNoList);
return CostResult.success(costDomainList.stream().map(CostDomain::castToDto).collect(Collectors.toList()));
} else {
return CostResult.error();
}
List<CostDomain> costDomainList = costApiService.getNoPayCost(costNoList);
return CostResult.success(costDomainList.stream().map(CostDomain::castToDto).collect(Collectors.toList()));
}
......
package com.blt.other.module.cost.controller.cost;
import com.bailuntec.cost.api.dto.CostDto;
import com.bailuntec.cost.api.response.CostResult;
import com.blt.other.common.util.AxiosUtil;
import com.blt.other.module.cost.dto.CostApiDto;
import com.blt.other.module.cost.model.CostDomain;
......@@ -27,9 +28,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Api(tags = "费用审核接口")
@RestController
......@@ -138,13 +136,10 @@ public class CostCheckController {
return resp;
}
@ApiOperation("出纳单附件下载")
@GetMapping("downCashierAnnex")
public Map<String, Object> downCashierAnnex(HttpServletRequest request, HttpServletResponse response) {
AxiosUtil.setCors(response, request);
Map<String, Object> result = new HashMap<>();
List<String> list = costCashiercallbackService.downCashierAnnex();
result.put("success", true);
result.put("msg", "出纳单附件下载完成");
return result;
public CostResult<String> downCashierAnnex() {
costCashiercallbackService.downCashierAnnex();
return CostResult.success("出纳单附件下载完成", null);
}
}
......@@ -9,6 +9,7 @@ import com.blt.other.common.util.MyMapperUtil;
import com.blt.other.common.util.PathUtil;
import com.blt.other.module.cost.dao.CostDao;
import com.blt.other.module.cost.dto.CostApiDto;
import com.blt.other.module.cost.dto.CostPageResult;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostExportService;
import com.blt.other.module.cost.service.CostListSearchService;
......@@ -64,26 +65,29 @@ public class CostController {
@ApiOperation("获取前端要打印的费用单列表")
@PostMapping("/list/print/list")
public CostResult<List<CostListPrintDto>> printList(@RequestBody CostListPrintVo costListPrintVo) {
public CostApiDto.PrintListResp printList(@RequestBody CostListPrintVo costListPrintVo) {
costService = CostServiceFactory.getCostService();
List<CostListPrintDto> listPrintDtos = costService.printList(costListPrintVo.getPrintNos());
return CostResult.success(listPrintDtos);
CostApiDto.PrintListResp resp = new CostApiDto.PrintListResp();
resp.setSuccess(true);
resp.setPrintList(listPrintDtos);
return resp;
}
@ApiOperation("搜索")
@PostMapping("/list/search/key")
public CostResult<PageInfo<CostDto>> getByKey(@RequestParam Integer pageNum,
@RequestParam Integer pageSize,
@RequestParam String key) {
public CostApiDto.GetByKeyResp getByKey(@RequestParam Integer pageNum,
@RequestParam Integer pageSize,
@RequestParam String key) {
costService = CostServiceFactory.getCostService();
PageInfo<CostDto> pageInfo = costListSearchService.searchByKey(key, pageNum, pageSize);
return CostResult.success(pageInfo);
return costListSearchService.searchByKey(key, pageNum, pageSize);
}
@ApiOperation("搜索?")
@PostMapping("/list/search/keys")
public CostResult<PageInfo<CostDto>> getByKeys(@RequestBody CostListSearchKeysVo searchKeysVo) {
public CostApiDto.GetByKeyResp getByKeys(@RequestBody CostListSearchKeysVo searchKeysVo) {
costService = CostServiceFactory.getCostService();
if (null != searchKeysVo.getParams().getKeys().getCostForm() && 3 == searchKeysVo.getParams().getKeys().getCostForm()) {
......@@ -93,8 +97,8 @@ public class CostController {
searchKeysVo.getParams().getKeys().setCostForm(3);
searchKeysVo.getParams().getKeys().setIsLend(2);
}
PageInfo<CostDto> pageInfo = costListSearchService.searchByKeys(searchKeysVo);
return CostResult.success(pageInfo);
return costListSearchService.searchByKeys(searchKeysVo);
}
@ApiOperation("获取借支单列表")
......@@ -106,29 +110,25 @@ public class CostController {
@ApiOperation("获取所有费用单")
@GetMapping("/list/getAllCost")
public CostResult<PageInfo<CostDto>> getAllCost(@RequestParam Integer pageNum,
@RequestParam Integer pageSize,
@RequestParam Integer userId,
@RequestParam(defaultValue = "0", required = false) Integer authType,
@RequestParam(required = false) String projectTypes) {
public CostPageResult getAllCost(@RequestParam Integer pageNum,
@RequestParam Integer pageSize,
@RequestParam Integer userId,
@RequestParam(defaultValue = "0", required = false) Integer authType,
@RequestParam(required = false) String projectTypes) {
if (authType != 0) {
userId = null;
}
costService = CostServiceFactory.getCostService();
PageInfo<CostDto> pageInfo = costService.getAllCost(pageNum, pageSize, userId, projectTypes);
return CostResult.success(pageInfo);
return costService.getAllCost(pageNum, pageSize, userId, projectTypes);
}
@ApiOperation("获取费用详情")
@PostMapping("/list/getCostDetail")
public CostResp.GetCostDetailResp getCostDetail(@RequestParam String costNo) {
CostResp.GetCostDetailResp resp = new CostResp.GetCostDetailResp();
public CostResult<CostDto> getCostDetail(@RequestParam String costNo) {
costService = CostServiceFactory.getCostService(costNo);
CostDomain costDomain = costService.getCostByCostNo(costNo);
resp.setMsg("success");
resp.setCost(costDomain.castToDto());
return resp;
return CostResult.success(costDomain.castToDto());
}
@ApiOperation("修改发票附件")
......
package com.blt.other.module.cost.dao;
import com.bailuntec.cost.api.dto.CostDto;
import com.bailuntec.cost.api.dto.ManageCostDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -29,52 +28,17 @@ public interface CostDao extends BaseMapper<CostDomain> {
*/
CostDomain selectByCostNo(String costNo);
/**
* 修改费用单信息
*
* @param costDomain
* @return
*/
Integer updateByNo(CostDomain costDomain);
/**
* 获取 status >= costStatus(param) 的费用单
*
* @return
*/
List<CostDomain> selectByStatus(Integer costStatus);
/**
* 根据借支类型获取费用列表
*
* @param isLend
* @return
*/
List<CostDomain> selectByLend(Integer isLend);
/**
* 根据关键字获取费用单
*
* @return
*/
List<CostDomain> selectByKey(@Param("searchKey") String searchKey, @Param("costStatus") Integer costStatus);
List<CostDomain> selectByCostStatus(Integer costStatus);
List<CostDomain> selectByLendStatus(Integer lendStatus);
List<CostDomain> selectByCostForm(Integer costForm);
List<CostDomain> selectByCostFormAndStatus(@Param("costForm") Integer costForm, @Param("costStatus") Integer costStatus);
List<CostDomain> selectBySupCostNo(String supCostNo);
List<CostDomain> selectByKeys(CostDomain costDomain);
List<CostDomain> selectByLendAndStatus(@Param("isLend") Integer isLend, @Param("costStatus") Integer costStatus);
List<CostDomain> selectByCostPlanNo(String costPlanNo);
/**
* 查询最近一次费用单
*
* @return 费用单
*/
CostDomain selectLastCost();
List<CostDomain> selectLinkLendCost(@Param("createuserid") Integer createuserid);
......@@ -132,35 +96,28 @@ public interface CostDao extends BaseMapper<CostDomain> {
/**
* 查询资产负债表相关费用单
*
* @param startDate
* @param endDate
* @return
* @param startDate date
* @param endDate date
* @return 资产负债表相关费用单
*/
List<CostDomain> selectBalanceSheetCost(@Param("startDate") Date startDate, @Param("endDate") Date endDate);
/**
* 查询原来传输到数据中心时为待支付状态 变成 已支付状态后的费用单
*
* @param costNoList 费用单号
* @return 费用单
*/
List<CostDomain> selectNoPayCost(@Param("list") List<String> costNoList);
Integer selectCostStatusByNo(@Param("costNo") String costNo);
List<CostDto> getCostByRejectStatus();
List<String> listCostNo();
List<String> listCostNoAll(CostExportVo costExportVo);
Integer updateCashierAnnex(@Param("costNo") String costNo, @Param("filePath") String filePath, @Param("downloadUrl") String downloadUrl);
List<CostDto> getCostList(@Param("startDate") String startDate, @Param("endDate") String endDate);
/**
* 审核列表查询
*
* @param page page
* @param type type
* @param status status
* @param userid userid
* @param isManage ismange
* @return
*/
IPage<CostDomain> checkCostList(@Param("page") IPage<CostDomain> page,
@Param("type") Integer type,
@Param("status") Integer status,
@Param("userid") Integer userid,
@Param("isManage") Boolean isManage);
@Param("type") Integer type,
@Param("status") Integer status,
@Param("userid") Integer userid,
@Param("isManage") Boolean isManage);
}
......@@ -19,6 +19,7 @@ import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
......@@ -44,6 +45,9 @@ public class CostDomain implements Serializable {
public final static int STATUS_UN_PAY = 2;
public final static int STATUS_PAYED = 4;
public final static int STATUS_REJECT = 3;
public final static int STATUS_DELETE = 5;
// 费用单编号
@TableId(type = IdType.AUTO)
private Integer id;
......@@ -240,6 +244,12 @@ public class CostDomain implements Serializable {
@TableField(exist = false)
private CostTemplate costTemplate;
private LocalDateTime lastModifyDate;
@ApiModelProperty("能否审核")
@TableField(exist = false)
private Boolean canAudit;
public CostDto castToDto() {
StatusMapper statusMapper = SpringContextUtil.getBean(StatusMapper.class);
......
......@@ -80,15 +80,15 @@ public class CostTemplate implements Serializable {
public boolean shouldDepartmentAutoCheck() {
return enableAutoReview && enableDepartmentReview;
return enableAutoReview && enableDepartmentReview && !isDefault;
}
public boolean shouldFinanciaAutoCheck() {
return enableAutoReview && enableFinancialAutoReview;
public boolean shouldFinancialAutoCheck() {
return enableAutoReview && enableFinancialAutoReview && !isDefault;
}
public boolean shouldFinalAutoCheck() {
return enableAutoReview && enableFinalReview;
return enableAutoReview && enableFinalReview && !isDefault;
}
public boolean shouldFinalCheck(BigDecimal amount) {
......
......@@ -4,8 +4,8 @@ import com.bailuntec.cost.api.dto.CostDto;
import com.bailuntec.cost.api.dto.LogisticsCostDto;
import com.bailuntec.cost.api.dto.ManageCostDto;
import com.bailuntec.cost.api.dto.WageCostDto;
import com.blt.other.module.database.model.CostDomain;
import org.springframework.cglib.core.Local;
import com.blt.other.module.cost.model.CostDomain;
import java.io.IOException;
import java.time.LocalDateTime;
......@@ -57,7 +57,7 @@ public interface CostApiService {
* @param payUserId 支付用户id
* @return 单据
*/
List<ManageCostDto> getLogisticsCostList(LocalDateTime startDateS, LocalDateTime endDateStr, String feeSuperType, String feeSubType, Integer companyValue, String companyName, String departmentName, Integer createUserId, Integer payUserId) throws Exception;
List<ManageCostDto> getLogisticsCostList(LocalDateTime startDateStr, LocalDateTime endDateStr, String feeSuperType, String feeSubType, Integer companyValue, String companyName, String departmentName, Integer createUserId, Integer payUserId) throws Exception;
/**
* 查询资产负债表相关费用单
......
package com.blt.other.module.cost.service;
import com.bailuntec.cost.api.dto.CostDto;
import com.blt.other.module.cost.dto.CostApiDto;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.vo.CostListSearchKeysVo;
import com.github.pagehelper.PageInfo;
import java.util.List;
......@@ -16,7 +14,7 @@ public interface CostListSearchService {
* @param key key
* @return res
*/
PageInfo<CostDto> searchByKey(String key, int pageNum, int pageSize);
CostApiDto.GetByKeyResp searchByKey(String key, int pageNum, int pageSize);
/**
* 多条件筛选
......@@ -24,7 +22,7 @@ public interface CostListSearchService {
* @param searchKeysVo param
* @return res
*/
PageInfo<CostDto> searchByKeys(CostListSearchKeysVo searchKeysVo);
CostApiDto.GetByKeyResp searchByKeys(CostListSearchKeysVo searchKeysVo);
/**
* 获取借支单列表
......
......@@ -2,14 +2,12 @@ package com.blt.other.module.cost.service;
import com.bailuntec.cost.api.dto.CostDto;
import com.bailuntec.cost.api.dto.CostListPrintDto;
import com.bailuntec.cost.api.response.CostResult;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.blt.other.module.cost.dto.CostApiDto;
import com.blt.other.module.cost.dto.CostPageResult;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.vo.ApplyCallbackUrlVo;
import com.blt.other.module.cost.vo.CashierCallbackUrlVo;
import com.github.pagehelper.PageInfo;
import java.util.List;
......@@ -29,7 +27,7 @@ public interface CostService {
*
* @return allCost
*/
PageInfo<CostDto> getAllCost(Integer pageNum, Integer pageSize, Integer userId, String projectTypes);
CostPageResult getAllCost(Integer pageNum, Integer pageSize, Integer userId, String projectTypes);
/**
* 根据 costNo 获取 cost
......
package com.blt.other.module.cost.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.blt.other.module.cost.model.CostDetailDomain;
import com.blt.other.module.cost.model.CostDomain;
import com.bailuntec.cost.api.dto.*;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.blt.other.common.util.CurUtils;
import com.blt.other.common.util.HttpUtil;
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.model.CostDetailDomain;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostApiService;
import com.blt.other.module.cost.service.CostService;
import com.blt.other.module.cost.service.UserCostFinansysService;
import com.blt.other.module.cost.utils.CostFileUtil;
import com.blt.other.module.cost.utils.CostUtils;
import com.blt.other.module.database.model.*;
import com.blt.other.module.database.model.CostCompanyDomain;
import com.blt.other.module.database.model.CostLogDomain;
import com.blt.other.module.database.model.CostTypeKindDomain;
import com.blt.other.module.database.model.UserDomain;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
......@@ -31,6 +35,7 @@ import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class CostApiServiceImpl implements CostApiService {
......@@ -255,7 +260,10 @@ public class CostApiServiceImpl implements CostApiService {
@Override
public List<CostDomain> getNoPayCost(List<String> costNoList) {
return costDao.selectNoPayCost(costNoList);
return costDao.selectList(new LambdaQueryWrapper<CostDomain>()
.eq(CostDomain::getCostForm, CostDomain.COST_FROM_1)
.eq(CostDomain::getCostStatus, CostDomain.STATUS_PAYED)
.in(CostDomain::getCostNo, costNoList));
}
@Override
......@@ -357,6 +365,11 @@ public class CostApiServiceImpl implements CostApiService {
@Override
public List<CostDto> getCostList(String startDate, String endDate) {
return this.costDao.getCostList(startDate, endDate);
return this.costDao.selectList(new LambdaQueryWrapper<CostDomain>()
.ge(CostDomain::getLastModifyDate, startDate)
.le(CostDomain::getLastModifyDate, endDate))
.stream()
.map(CostDomain::castToDto)
.collect(Collectors.toList());
}
}
package com.blt.other.module.cost.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.blt.other.common.util.PathUtil;
import com.blt.other.module.cost.dao.CostCashiercallbackDao;
import com.blt.other.module.cost.dao.CostDao;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostCashiercallbackService;
import com.blt.other.module.cost.service.CostService;
import com.blt.other.module.database.model.CostCashiercallbackDomain;
......@@ -24,6 +26,7 @@ import java.io.IOException;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.stream.Collectors;
@Service
public class CostCashiercallbackServiceImpl implements CostCashiercallbackService {
......@@ -42,6 +45,7 @@ public class CostCashiercallbackServiceImpl implements CostCashiercallbackServic
@Autowired
CostDao costDao;
@Override
public Integer saveCostCashiercallbackResponse(CostCashiercallbackDomain costCashiercallbackDomain) {
return costCashiercallbackDao.insert(costCashiercallbackDomain);
......@@ -54,7 +58,14 @@ public class CostCashiercallbackServiceImpl implements CostCashiercallbackServic
@Override
public List<String> downCashierAnnex() {
List<String> costNoList = costDao.listCostNo();
List<String> costNoList = costDao.selectList(new LambdaQueryWrapper<CostDomain>()
.eq(CostDomain::getCostForm, CostDomain.COST_FROM_1)
.eq(CostDomain::getCostStatus, CostDomain.STATUS_PAYED)
.eq(CostDomain::getCashierFilePath, ""))
.stream()
.map(CostDomain::getCostNo)
.collect(Collectors.toList());
HttpHeaders headers = new HttpHeaders();
HttpEntity<Resource> httpEntity = new HttpEntity<>(headers);
for (String costNo : costNoList) {
......
......@@ -3,6 +3,7 @@ package com.blt.other.module.cost.service.impl;
import com.bailuntec.cost.api.dto.CostDto;
import com.blt.other.module.cost.dao.CostDao;
import com.blt.other.module.cost.dao.CostListSearchDao;
import com.blt.other.module.cost.dto.CostApiDto;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.service.CostListSearchService;
import com.blt.other.module.cost.service.CostService;
......@@ -13,6 +14,7 @@ import com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
......@@ -28,27 +30,41 @@ public class CostListSearchServiceImpl implements CostListSearchService {
CostDao costDao;
@Override
public PageInfo<CostDto> searchByKey(String key, int pageNum, int pageSize) {
public CostApiDto.GetByKeyResp searchByKey(String key, int pageNum, int pageSize) {
CostApiDto.GetByKeyResp resp = new CostApiDto.GetByKeyResp();
PageHelper.startPage(pageNum, pageSize);
List<CostDto> costDtos = costListSearchDao.selectByKey(Lists.newArrayList(key.split(","))
.stream()
.filter(Objects::nonNull)
.collect(Collectors.toList()))
.stream()
.map(CostDomain::castToDto)
.collect(Collectors.toList());
return new PageInfo<>(costDtos);
List<CostDomain> costDomains = costListSearchDao.selectByKey(Lists.newArrayList(key.split(",")).stream().filter(Objects::nonNull).collect(Collectors.toList()));
List<CostDto> dtos = costDomains.stream().map(CostDomain::castToDto).collect(Collectors.toList());
PageInfo<CostDomain> pageInfo = new PageInfo<>(costDomains);
resp.setCosts(dtos);
resp.setPageInfo(pageInfo);
resp.setSuccess(true);
return resp;
}
@Override
public PageInfo<CostDto> searchByKeys(CostListSearchKeysVo searchKeysVo) {
public CostApiDto.GetByKeyResp searchByKeys(CostListSearchKeysVo searchKeysVo) {
CostApiDto.GetByKeyResp resp = new CostApiDto.GetByKeyResp();
PageHelper.startPage(searchKeysVo.getParams().getPageNum(), searchKeysVo.getParams().getPageSize());
List<CostDomain> domains = costListSearchDao.selectByKeys(searchKeysVo);
CostDomain supCost = costDao.selectByCostNo(searchKeysVo.getParams().getKeys().getLinkCost());
domains.add(supCost);
return new PageInfo<>(domains.stream().map(CostDomain::castToDto).collect(Collectors.toList()));
PageInfo<CostDomain> pageInfo = new PageInfo<>(domains);
if (null != searchKeysVo.getParams().getKeys().getLinkCost() && !searchKeysVo.getParams().getKeys().getLinkCost().isEmpty()) {
List<CostDomain> list = new ArrayList<>();
CostDomain supCost = costDao.selectByCostNo(searchKeysVo.getParams().getKeys().getLinkCost());
list.add(supCost);
if (null != domains && domains.size() >= 1) {
list.addAll(domains);
}
resp.setCosts(list.stream().map(CostDomain::castToDto).collect(Collectors.toList()));
} else {
resp.setCosts(domains.stream().map(CostDomain::castToDto).collect(Collectors.toList()));
}
resp.setPageInfo(pageInfo);
resp.setSuccess(true);
return resp;
}
@Override
......
......@@ -3,6 +3,7 @@ package com.blt.other.module.cost.service.impl.cost;
import com.bailuntec.api.bailuntec.cw.CwApi;
import com.bailuntec.api.bailuntec.cw.request.PostApplyReq;
import com.bailuntec.common.JsonUtilByJackson;
import com.bailuntec.common.ListUtil;
import com.bailuntec.cost.api.dto.CostDto;
import com.bailuntec.cost.api.dto.CostListPrintDto;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -11,14 +12,18 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.common.util.CurUtils;
import com.blt.other.common.util.MoneyUtil;
import com.blt.other.common.util.SessionUtils;
import com.blt.other.module.auth.dao.CostReviewerMapper;
import com.blt.other.module.auth.dao.OaUserMapper;
import com.blt.other.module.auth.model.CostReviewer;
import com.blt.other.module.auth.model.OaUser;
import com.blt.other.module.auth.service.UserService;
import com.blt.other.module.cost.dao.CostCompanyDao;
import com.blt.other.module.cost.dao.CostDao;
import com.blt.other.module.cost.dao.CostDetailDao;
import com.blt.other.module.cost.dao.CostTypeKindDao;
import com.blt.other.module.cost.dao.*;
import com.blt.other.module.cost.dto.CostApiDto;
import com.blt.other.module.cost.dto.CostPageResult;
import com.blt.other.module.cost.model.CostDetailDomain;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.model.CostTemplateBaseCol;
import com.blt.other.module.cost.service.*;
import com.blt.other.module.cost.vo.ApplyCallbackUrlDataDataVo;
import com.blt.other.module.cost.vo.ApplyCallbackUrlVo;
......@@ -93,23 +98,46 @@ public abstract class AbstractCostService implements CostService {
}
@Override
public PageInfo<CostDto> getAllCost(Integer pageNum,
Integer pageSize,
Integer userId,
String projectTypes) {
public CostPageResult getAllCost(Integer pageNum,
Integer pageSize,
Integer userId,
String projectTypes) {
PageHelper.startPage(pageNum, pageSize);
List<String> projectTypeList = new ArrayList<>();
if (!StringUtils.isEmpty(projectTypes)) {
projectTypeList = Lists.newArrayList(projectTypes.split(",")).stream().filter(str -> !StringUtils.isEmpty(str)).collect(Collectors.toList());
}
List<CostDomain> costDomains = costDao.selectAll(userId, projectTypeList);
return new PageInfo<>(costDomains.stream().map(CostDomain::castToDto).collect(Collectors.toList()));
CostPageResult result = new CostPageResult();
result.setCosts(costDomains.stream().map(CostDomain::castToDto).collect(Collectors.toList()));
result.setPageInfo(new PageInfo<>(costDomains));
return result;
}
@Resource
CostReviewerMapper costReviewerMapper;
@Resource
OaUserMapper oaUserMapper;
@Override
public CostDomain getCostByCostNo(String costNo) {
CostDomain costDomain = costDao.selectByCostNo(costNo);
costDomain.setCostTemplate(costTemplateService.queryDetail(costDomain.getCostTemplateId()));
CostCompanyDomain costCompany = costCompanyDao.selectByNo(costDomain.getCompanyNo());
Integer currentUserId = SessionUtils.getCurrentUserId();
OaUser costUser = oaUserMapper.selectByOaUserId(currentUserId);
if (costDomain.getCostStatus().equals(CostDomain.STATUS_DEPARTMENT_CHECK)) {
costDomain.setCanAudit(costReviewerMapper.queryOne(costUser.getPrimaryDepartmentId(), CostReviewer.departmentReviewer, currentUserId) != null);
} else if (costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.financialReviewer, currentUserId) != null) {
costDomain.setCanAudit(costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.financialReviewer, currentUserId) != null);
} else if (costDomain.getCostStatus().equals(CostDomain.STATUS_FINAL_CHECK)) {
costDomain.setCanAudit(costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.finalReviewer, currentUserId) != null);
} else {
costDomain.setCanAudit(false);
}
return costDomain;
}
......@@ -130,6 +158,9 @@ public abstract class AbstractCostService implements CostService {
}
@Resource
CostTemplateBaseColMapper costTemplateBaseColMapper;
private void setCostDomain(CostDomain costDomain) {
if (null != costDomain.getCompanyNo()) {
costDomain.setCompanyName(costCompanyDao.selectByNo(costDomain.getCompanyNo()).getCompanyName());
......@@ -142,6 +173,14 @@ public abstract class AbstractCostService implements CostService {
costDomain.setTypeNo(costTypeKindDomain.getTypeNo());
}
}
if (ListUtil.isNotEmpty(costDomain.getAttach())) {
costDomain.getAttach().forEach(costAttach -> {
CostTemplateBaseCol costTemplateBaseCol = costTemplateBaseColMapper.selectById(costAttach.getCostTemplateBaseColId());
BeanUtils.copyProperties(costTemplateBaseCol, costAttach, "id");
});
}
}
......@@ -165,7 +204,8 @@ public abstract class AbstractCostService implements CostService {
costDomain.setCostNo(costNo);
costDomain.setAmount(amount);
costDomain.setKindName(costDetailDomains.get(0).getKindName() + " 等 " + costDetailDomains.size() + " 项");
costDao.updateByNo(costDomain);
costDao.update(costDomain, new LambdaQueryWrapper<CostDomain>()
.eq(CostDomain::getCostNo, costDomain.getCostNo()));
}
}
......@@ -174,7 +214,8 @@ public abstract class AbstractCostService implements CostService {
CostDomain costDomain = new CostDomain();
costDomain.setCostNo(costNo);
costDomain.setCostStatus(i);
return costDao.updateByNo(costDomain);
return costDao.update(costDomain, new LambdaQueryWrapper<CostDomain>()
.eq(CostDomain::getCostNo, costDomain.getCostNo()));
}
@Override
......@@ -184,7 +225,10 @@ public abstract class AbstractCostService implements CostService {
@Override
public void updateCashierAnnex(String costNo, String filePath, String downloadUrl) {
costDao.updateCashierAnnex(costNo, filePath, downloadUrl);
CostDomain costDomain = costDao.selectByCostNo(costNo);
costDomain.setCashierFilePath(filePath);
costDomain.setCashierDownloadPath(downloadUrl);
costDao.updateById(costDomain);
}
@Override
......
......@@ -34,6 +34,13 @@ public class DepartmentCheckState extends CostState {
throw new BizRuntimeException("invalid status");
}
//如果是默认模版 不需要部门审核
if (costTemplate.getIsDefault()) {
//流转状态
nextState(financialCheckState);
costSubscribe.subscribe(costContext);
}
//需要自动审核
if (costTemplate.shouldDepartmentAutoCheck()) {
//自动审核通过
......
......@@ -38,6 +38,15 @@ public class FinalCheckState extends CostState {
throw new BizRuntimeException("invalid status");
}
//如果是默认模版 不需要最终审核
if (costTemplate.getIsDefault()) {
//流转状态
nextState(unPayState);
//通知财务系统
costContext.costService.toFinancial(costDomain);
}
//如果不需要审核 直接通过
if (!costTemplate.shouldFinalCheck(costDomain.getAmount())) {
costDomain.setCostStatus(CostDomain.STATUS_UN_PAY);
......@@ -67,7 +76,7 @@ public class FinalCheckState extends CostState {
CostCompanyDomain costCompany = costCompanyDao.selectByNo(costDomain.getCompanyNo());
//人工审核通过
if (costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.financialReviewer, currentUserId) != null) {
if (costReviewerMapper.queryOne(costCompany.getId(), CostReviewer.finalReviewer, currentUserId) != null) {
costDomain.setCostStatus(CostDomain.STATUS_UN_PAY);
costDao.updateById(costDomain);
......
......@@ -40,7 +40,7 @@ public class FinancialCheckState extends CostState {
}
//需要自动审核
if (costTemplate.shouldFinalAutoCheck()) {
if (costTemplate.shouldFinancialAutoCheck()) {
//自动审核通过
if (this.autoCheck(costDomain)) {
costDomain.setCostStatus(CostDomain.STATUS_FINAL_CHECK);
......
......@@ -190,7 +190,8 @@ public class CostPlanNewLend2ServiceImpl extends AbstractCostPlanService impleme
supCost.setCompensate(new BigDecimal(0));
}
supCost.setCompensate(supCost.getCompensate().add(payPlan.getPlanAmount()));
costDao.updateByNo(supCost);
costDao.update(supCost, new LambdaQueryWrapper<CostDomain>()
.eq(CostDomain::getCostNo, supCost.getCostNo()));
} else {
log.info("生成一张补差额的付款单失败:" + costDomain1);
......
......@@ -3,6 +3,7 @@ package com.blt.other.module.purchasing.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.bailuntec.cost.api.domain.BuyDomain;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.blt.other.common.util.BuyUtils;
import com.blt.other.common.util.CurUtils;
import com.blt.other.common.util.MoneyUtil;
......@@ -391,7 +392,8 @@ public class BuyServiceImpl implements BuyService {
costDao.insert(backCost);
costLogService.save(backCost.getCostNo(), updateUserId, "采购单【" + buyListDto.getBuyno() + "】冲销借支单【" + linkLendCost.getCostNo() + "】时由系统自动生成");
costDao.updateByNo(linkLendCost);
costDao.update(linkLendCost, new LambdaQueryWrapper<CostDomain>()
.eq(CostDomain::getCostNo, linkLendCost.getCostNo()));
costLogService.save(linkLendCost.getCostNo(), updateUserId, "财务审核:" + result);
return result;
}
......
......@@ -3,33 +3,13 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.blt.other.module.cost.dao.CostDao">
<insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
INSERT INTO cost(cost_no, company_no, company_name, type_no, type_name, subject_code, kind_no, kind_name,
create_usercode, create_username, cost_remark,
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.database.model.CostDomain">
<resultMap id="cost" type="com.blt.other.module.cost.model.CostDomain">
<result column="attach" jdbcType="VARCHAR" property="attach"
typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>
</resultMap>
<select id="selectAll" resultMap="cost">
SELECT
*
FROM
......@@ -47,7 +27,7 @@
id DESC
</select>
<select id="selectByCostNo" resultType="com.blt.other.module.database.model.CostDomain">
<select id="selectByCostNo" resultMap="cost">
SELECT *
FROM cost
WHERE cost_no = #{costNo}
......@@ -55,193 +35,7 @@
DESC
</select>
<update id="update" 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=" subLogisticsSupplierId!=null">sub_logistics_supplier_id=#{subLogisticsSupplierId},</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="rejectTime != null">reject_time = #{rejectTime},</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
cost_no = #{costNo}
</update>
<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 *
FROM cost
WHERE cost_status >= #{costStatus}
ORDER BY id DESC
</select>
<select id="selectByLend" resultType="com.blt.other.module.database.model.CostDomain">
SELECT *
FROM cost
WHERE is_lend = #{isLend}
ORDER BY id DESC
</select>
<select id="selectByLendAndStatus" resultType="com.blt.other.module.database.model.CostDomain">
SELECT *
FROM cost
WHERE cost_status >= #{costStatus}
AND is_lend = #{isLend}
ORDER BY id DESC
</select>
<select id="selectByCostStatus" resultType="com.blt.other.module.database.model.CostDomain">
SELECT *
FROM cost
WHERE cost_status = #{costStatus}
ORDER BY id DESC
</select>
<select id="selectByLendStatus" resultType="com.blt.other.module.database.model.CostDomain">
SELECT *
FROM cost
WHERE lend_status = #{lendStatus}
ORDER BY id DESC
</select>
<select id="selectByCostForm" resultType="com.blt.other.module.database.model.CostDomain">
SELECT *
FROM cost
WHERE cost_form = #{costForm}
ORDER BY id DESC
</select>
<select id="selectByCostFormAndStatus" resultType="com.blt.other.module.database.model.CostDomain">
SELECT *
FROM cost
WHERE cost_status >= #{costStatus}
AND cost_form = #{costForm}
ORDER BY id DESC
</select>
<select id="selectBySupCostNo" resultType="com.blt.other.module.database.model.CostDomain">
SELECT *
FROM cost
WHERE sup_cost_no = #{supCostNo}
ORDER BY id DESC
</select>
<select id="selectByKeys" resultType="com.blt.other.module.database.model.CostDomain">
<select id="selectByKeys" resultType="com.blt.other.module.cost.model.CostDomain">
SELECT
*
FROM
......@@ -259,42 +53,21 @@
id DESC
</select>
<select id="selectByKey" resultType="com.blt.other.module.database.model.CostDomain">
SELECT *
FROM cost
WHERE cost_status >= #{costStatus}
AND (
cost_no = #{searchKey}
OR
cost_plan_no = #{searchKey}
OR
create_username LIKE CONCAT('%', #{searchKey}, '%')
OR
type_name LIKE CONCAT('%', #{searchKey}, '%')
OR
kind_name LIKE CONCAT('%', #{searchKey}, '%')
OR
company_name LIKE CONCAT('%', #{searchKey}, '%')
)
ORDER BY id DESC
</select>
<select id="selectByCostPlanNo" resultType="com.blt.other.module.database.model.CostDomain">
<select id="selectByCostPlanNo" resultMap="cost">
SELECT *
FROM cost
WHERE cost_plan_no = #{costPlanNo}
ORDER BY id DESC
</select>
<select id="selectLastCost" resultType="com.blt.other.module.database.model.CostDomain">
<select id="selectLastCost" resultMap="cost">
SELECT *
FROM cost
ORDER BY id DESC
LIMIT 1
</select>
<select id="selectLinkLendCost" resultType="com.blt.other.module.database.model.CostDomain">
<select id="selectLinkLendCost" resultMap="cost">
SELECT *
FROM cost
WHERE cost_status = 4
......@@ -320,8 +93,10 @@
<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,
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
......@@ -353,46 +128,82 @@
</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 ('百伦咨询服务费','物流费')
<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="departmentName != null and departmentName != ''">AND u.departmentname1 = #{departmentName}</if>
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 cost c
left join user u on c.create_userid = u.userid
left join cost_detail d on c.cost_no = d.cost_no
left join type_relation t on t.fee_type = c.type_name
WHERE 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 ('百伦咨询服务费','物流费')
<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="departmentName != null and departmentName != ''">
AND u.departmentname1 = #{departmentName}
</if>
<if test="companyValueList != null and companyValueList.size() > 0">
AND c.company_value in
<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>
</if>
<if test="companyName != null and companyName != ''">AND c.company_name = #{companyName}</if>
<if test="createUserId != null and createUserId != ''">AND c.create_userid = #{createUserId}</if>
<if test="payUserId != null and payUserId != ''">AND c.pay_user_id = #{payUserId}</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="companyName != null and companyName != ''">
AND c.company_name = #{companyName}
</if>
<if test="createUserId != null and createUserId != ''">
AND c.create_userid = #{createUserId}
</if>
<if test="payUserId != null and payUserId != ''">
AND c.pay_user_id = #{payUserId}
</if>
<if test="startDate != null">
AND c.pay_time <![CDATA[>=]]> #{startDate}
</if>
<if test="endDate != null">
AND c.pay_time <![CDATA[<]]>#{endDate}
</if>
UNION
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,
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 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 ('百伦咨询服务费')
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 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 ('百伦咨询服务费')
<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="departmentName != null and departmentName != ''">AND u.departmentname1 = #{departmentName}</if>
<if test="companyValueList != null and companyValueList.size() > 0">
AND c.company_value in
<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>
</if>
<if test="companyName != null and companyName != ''">AND c.company_name = #{companyName}</if>
......@@ -401,8 +212,10 @@
<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,
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
......@@ -416,7 +229,7 @@
<if test="companyValueList != null and companyValueList.size() > 0">
AND c1.company_value in
<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>
</if>
<if test="companyName != null and companyName != ''">AND c1.company_name = #{companyName}</if>
......@@ -425,12 +238,15 @@
<if test="startDate != null">AND c1.pay_time <![CDATA[>=]]> #{startDate}</if>
<if test="endDate != null">AND c1.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,
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.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 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 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)
......@@ -440,7 +256,7 @@
<if test="companyValueList != null and companyValueList.size() > 0">
AND c1.company_value in
<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>
</if>
<if test="companyName != null and companyName != ''">AND c1.company_name = #{companyName}</if>
......@@ -449,19 +265,23 @@
<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,
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.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 ('百伦咨询服务费')
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.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
('百伦咨询服务费')
<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="departmentName != null and departmentName != ''">AND u.departmentname1 = #{departmentName}</if>
<if test="companyValueList != null and companyValueList.size() > 0">
AND c.company_value in
<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>
</if>
<if test="companyName != null and companyName != ''">AND c.company_name = #{companyName}</if>
......@@ -470,11 +290,13 @@
<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,
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, b.id as costId
FROM buy b
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 ('固定资产','低值易耗品')
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
<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>
......@@ -482,7 +304,7 @@
<if test="companyValueList != null and companyValueList.size() > 0">
AND b.company_value in
<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>
</if>
<if test="companyName != null and companyName != ''">AND b.company = #{companyName}</if>
......@@ -499,7 +321,7 @@
4、待出纳付款状态的所有费用类型付款单
5、已完成状态的费用类型为"借款-其他应付款"、"收款-其他应付款"的还款单
-->
<select id="selectBalanceSheetCost" resultType="com.blt.other.module.database.model.CostDomain">
<select id="selectBalanceSheetCost" resultType="com.blt.other.module.cost.model.CostDomain">
SELECT *
FROM cost
WHERE cost_form = 3
......@@ -540,36 +362,7 @@
AND kind_name IN ('借款--其他应付款', '收款--其他应付款')
</select>
<!--查询原来传输到数据中心时为待支付状态 变成 已支付状态后的费用单-->
<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
<foreach collection="list" item="costNo" index="index" open="(" close=")" separator=",">
#{costNo}
</foreach>
</select>
<select id="selectCostStatusByNo" resultType="integer">
select cost_status
from cost
where cost_no = #{costNo}
</select>
<select id="getCostByRejectStatus" resultType="com.bailuntec.cost.api.dto.CostDto">
select *
from cost
where cost_status = 3
and reject_type = 1
and reject_time <![CDATA[<]]> date_sub(now(), INTERVAL 1 DAY)
</select>
<select id="listCostNo" resultType="java.lang.String">
select cost_no
from cost
where cost_form = 1
and cost_status = 4
and cashier_file_path = ''
</select>
<select id="listCostNoAll" resultType="java.lang.String">
select cost_no from cost
WHERE
......@@ -618,10 +411,34 @@
</select>
<update id="updateCashierAnnex">
update cost
set cashier_file_path = #{filePath},
cashier_download_path = #{downloadUrl}
where cost_no = #{costNo}
</update>
<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>
</mapper>
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