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,
......
......@@ -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();
}
}
......
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,
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,7 +110,7 @@ public class CostController {
@ApiOperation("获取所有费用单")
@GetMapping("/list/getAllCost")
public CostResult<PageInfo<CostDto>> getAllCost(@RequestParam Integer pageNum,
public CostPageResult getAllCost(@RequestParam Integer pageNum,
@RequestParam Integer pageSize,
@RequestParam Integer userId,
@RequestParam(defaultValue = "0", required = false) Integer authType,
......@@ -115,20 +119,16 @@ public class CostController {
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,32 +96,25 @@ 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,
......
......@@ -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);
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());
domains.add(supCost);
return new PageInfo<>(domains.stream().map(CostDomain::castToDto).collect(Collectors.toList()));
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,7 +98,7 @@ public abstract class AbstractCostService implements CostService {
}
@Override
public PageInfo<CostDto> getAllCost(Integer pageNum,
public CostPageResult getAllCost(Integer pageNum,
Integer pageSize,
Integer userId,
String projectTypes) {
......@@ -103,13 +108,36 @@ public abstract class AbstractCostService implements CostService {
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;
}
......
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