Commit 9b423b0f by huluobin

bug fix

parent ad98a2b6
......@@ -11,15 +11,14 @@ public class CostPlanTempDto {
private Integer id; // 费用单表 id
private String costPlanNo; // 费用计划编号
private String tempNo; // 计划缓存编号
private String kindNo; // 小类编号
private String filePath; // 文件地址
private String fileName; // 文件名
private BigDecimal amount; // 费用总金额
private String costReason; // 付款理由
private String typeNo; // 大类编号
private String typeNo; // 大类编号
private String typeNameDto; // 大类标题
private String kindNameDto; // 小类标题
private String dic; // 币种
@ApiModelProperty("会计一级科目")
......@@ -29,5 +28,11 @@ public class CostPlanTempDto {
private String lendType;
@ApiModelProperty("项目")
private String projectType;
@ApiModelProperty("客户编号")
private String customerNum;
}
package com.blt.other.common.interceptor;
import com.bailuntec.common.SpringContextUtil;
import com.blt.other.common.base.SysUser;
import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.common.util.JwtUtil;
......@@ -7,6 +8,7 @@ import com.blt.other.common.util.SessionUtils;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
......@@ -18,17 +20,31 @@ import javax.servlet.http.HttpServletResponse;
@Slf4j
public class SessionHandlerInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
String token = Lists.newArrayList(request.getHeader("Cookie").split(";"))
.stream()
.filter(item -> item.contains("BailunToken"))
.findAny()
.map(item -> item.replaceAll("BailunToken=", ""))
.orElseThrow(() -> new BizRuntimeException("400", "请先登陆"));
SysUser sysUser = JwtUtil.validateToken(token);
SessionUtils.putSysUser(sysUser);
try {
String token = Lists.newArrayList(request.getHeader("Cookie").split(";"))
.stream()
.filter(item -> item.contains("BailunToken"))
.findAny()
.map(item -> item.replaceAll("BailunToken=", ""))
.orElseThrow(() -> new BizRuntimeException("400", "请先登陆"));
SysUser sysUser = JwtUtil.validateToken(token);
SessionUtils.putSysUser(sysUser);
} catch (Exception ex) {
String activeProfile = SpringContextUtil.getString("spring.profiles.active");
if (activeProfile.equals("test")) {
SysUser sysUser = new SysUser();
sysUser.setOaUserId(0);
sysUser.setUserName("sys");
SessionUtils.putSysUser(sysUser);
return true;
}
throw ex;
}
return true;
}
......
......@@ -2,21 +2,28 @@ package com.blt.other.database.model;
import com.bailuntec.common.SpringContextUtil;
import com.bailuntec.cost.api.dto.CostPlanTempDto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.blt.other.common.util.PathUtil;
import com.blt.other.module.cost.dao.CostTypeKindDao;
import com.blt.other.module.cost.dao.CostTypeDao;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import java.math.BigDecimal;
@TableName("cost_plan_temp")
@Data
public class CostPlanTempDomain {
// 费用单表 id
@TableId(type = IdType.AUTO)
private Integer id;
private String costPlanNo; // 费用计划编号
private String tempNo; // 计划缓存编号
private String kindNo; // 种类编号
private String filePath; // 文件地址
private BigDecimal amount; // 费用总金额
private String costReason; // 付款理由
......@@ -30,17 +37,21 @@ public class CostPlanTempDomain {
private String lendType;
@ApiModelProperty("项目")
private String projectType;
@ApiModelProperty("客户编号")
private String customerNum;
public CostPlanTempDto castToDto() {
CostTypeKindDao costTypeKindDao = SpringContextUtil.getBean(CostTypeKindDao.class);
CostTypeDao costTypeDao = SpringContextUtil.getBean(CostTypeDao.class);
CostPlanTempDto dto = new CostPlanTempDto();
BeanUtils.copyProperties(this, dto);
CostTypeKindDomain costTypeKindDomain = costTypeKindDao.selectByKindNo(this.getKindNo());
if (null != costTypeKindDomain) {
dto.setTypeNameDto(costTypeKindDomain.getTypeName());
dto.setKindNameDto(costTypeKindDomain.getKindName());
}
dto.setTypeNameDto(costTypeDao.selectByNo(typeNo).getTypeName());
dto.setFileName(PathUtil.getFileName(dto.getFilePath()));
return dto;
......
package com.blt.other.module.cost.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.blt.other.database.model.CostPlanTempDomain;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -9,20 +10,17 @@ import java.util.List;
@Mapper
@Repository
public interface CostPlanTempDao {
public interface CostPlanTempDao extends BaseMapper<CostPlanTempDomain> {
CostPlanTempDomain selectByNo(String tempNo);
Integer insert(CostPlanTempDomain costPlanTempDomain);
CostPlanTempDomain selectByPlanNoAndKindNo(@Param("costPlanNo") String costPlanNo, @Param("kindNo") String kindNo);
//获取费用计划子项
List<CostPlanTempDomain> selectListByPlanNo(String costPlanNo);
Integer deletedByPlanNoAndTempNo(@Param("costPlanNo") String costPlanNo, @Param("tempNo") String tempNo);
Integer update(CostPlanTempDomain domain);
void deletedFilePath(String tempNo);
List<CostPlanTempDomain> selectByPlanNoAndTypeNo(@Param("costPlanNo") String costPlanNo, @Param("typeNo") String typeNo);
......
......@@ -61,6 +61,12 @@ public class CostDetailDomain {
private String lendType;
@ApiModelProperty("项目")
private String projectType;
@ApiModelProperty("客户编号")
private String customerNum;
}
......@@ -51,7 +51,6 @@ public interface CostPlanTempService {
* @param tempNo 用计划单项编号
* @return 费用计划单项
*/
@NonNull
CostPlanTempDomain getByTempNo(@NonNull String tempNo);
/**
......
......@@ -10,7 +10,7 @@ import com.blt.other.module.auth.model.OaUser;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.model.CostTemplate;
import com.blt.other.module.sys.model.CostReviewer;
import org.springframework.beans.factory.annotation.Autowired;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
......@@ -27,10 +27,11 @@ import java.util.stream.Collectors;
* @author robbendev
* @since 2020/10/30 2:57 下午
*/
@Slf4j
@Component
public class DepartmentCheckState extends CostState {
@Autowired
@Resource
HrCheckState hrCheckState;
@Resource
OaDepartmentMapper oaDepartmentMapper;
......@@ -110,12 +111,10 @@ public class DepartmentCheckState extends CostState {
@Override
public void refuse(String rejectReason) {
log.info("部门审核拒绝 currentUserId:{},costNo:{}", costContext.currentUserId, costContext.costDomain.getCostNo());
CostDomain costDomain = costContext.costDomain;
Integer currentUserId = costContext.currentUserId;
OaUser costUser = oaUserMapper.selectByOaUserId(costDomain.getCreateUserid());
//check status
if (!costDomain.getCostStatus().equals(CostDomain.STATUS_DEPARTMENT_CHECK)) {
throw new BizRuntimeException("invalid status");
......@@ -126,10 +125,7 @@ public class DepartmentCheckState extends CostState {
throw new BizRuntimeException("current user no authority");
}
costLogService.save(costDomain.getCostNo(), currentUserId, "部门审核拒绝,理由:" + rejectReason, CostLogDomain.TYPE_UPDATE);
//sd
costContext.costService.reject(costDomain.getCostNo());
}
......@@ -144,7 +140,10 @@ public class DepartmentCheckState extends CostState {
.eq(CostReviewer::getReferId, costUser.getPrimaryDepartmentId())
.eq(CostReviewer::getType, CostReviewer.departmentReviewer));
String departmentReviewerNames = costReviewerList.stream().map(CostReviewer::getReviewerUserName).collect(Collectors.joining(","));
log.info("更新当前审核人为部门审核人:{}", departmentReviewerNames);
costCurrentReviewerService.updateByCostNoAndReviewer(costDomain.getCostNo(), costReviewerList);
costLogService.save(costDomain.getCostNo(), costContext.currentUserId, "部门审核人:" + costReviewerList.stream().map(CostReviewer::getReviewerUserName).collect(Collectors.joining(",")));
costLogService.save(costDomain.getCostNo(), costContext.currentUserId, "部门审核人:" + departmentReviewerNames);
}
}
......@@ -201,9 +201,9 @@ public abstract class AbstractCostPlanService implements CostPlanService {
BeanUtils.copyProperties(costPlanTempDomain, costDetailDomain);
costDetailDomain.setDetailNo(costPlanDomain.getCostPlanNo() + "-" + index);
CostTypeKindDomain costTypeKindDomain = costTypeKindDao.selectByKindNo(costPlanTempDomain.getKindNo());
costDetailDomain.setTypeNo(costTypeKindDomain.getTypeNo());
costDetailDomain.setTypeName(costTypeKindDomain.getTypeName());
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(costPlanTempDomain.getTypeNo());
costDetailDomain.setTypeNo(costTypeDomain.getTypeNo());
costDetailDomain.setTypeName(costTypeDomain.getTypeName());
return costDetailDomain;
}
......
......@@ -71,7 +71,7 @@ public class CostPlanNewPayServiceImpl extends AbstractCostPlanService implement
List<CostPlanTempDomain> costPlanTempDomains = costPlanTempDao.selectListByPlanNo(costPlanNo);
if (costPlanTempDomains.stream().anyMatch(temp -> null == temp.getTypeNo() || null == temp.getKindNo())) {
if (costPlanTempDomains.stream().anyMatch(temp -> null == temp.getTypeNo())) {
throw new RuntimeException("存在有金额、但是没有选择类型的子项目");
}
......
......@@ -7,7 +7,6 @@ import com.blt.other.common.util.PathUtil;
import com.blt.other.database.model.CostPlanDomain;
import com.blt.other.database.model.CostPlanTempDomain;
import com.blt.other.database.model.CostTypeDomain;
import com.blt.other.database.model.CostTypeKindDomain;
import com.blt.other.module.cost.dao.AccountingSubjectMapper;
import com.blt.other.module.cost.dao.CostPlanDao;
import com.blt.other.module.cost.dao.CostPlanTempDao;
......@@ -169,8 +168,8 @@ public class CostPlanTempServiceImpl implements CostPlanTempService {
public CostPlanTempDomain resetItem(ResetItemReq req) {
CostPlanTempDomain costPlanTempDomain = new CostPlanTempDomain();
com.bailuntec.common.BeanUtils.copyProperties(req, costPlanTempDomain);
CostPlanTempDomain costPlanTempDomain = costPlanTempDao.selectByNo(req.getTempNo());
com.bailuntec.common.BeanUtils.copyProperties(req, costPlanTempDomain, "id");
CostTypeDomain costTypeDomain = costTypeDao.selectByNo(req.getTypeNo());
AccountingSubject accountingSubject = accountingSubjectMapper.selectByNo(costTypeDomain.getAccountingSubjectNo());
......@@ -182,7 +181,7 @@ public class CostPlanTempServiceImpl implements CostPlanTempService {
if (req.getDelecteFile()) {
costPlanTempDao.deletedFilePath(req.getTempNo());
}
costPlanTempDao.update(costPlanTempDomain);
costPlanTempDao.updateById(costPlanTempDomain);
this.chalkResetDec(costPlanTempDomain.getCostPlanNo());
......
......@@ -2,9 +2,9 @@ spring:
# 数据源配置
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/bailun_other?useUnicode=true&characterEncoding=utf-8&useSSL=false&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true
url: jdbc:mysql://cdb-aanqm573.gz.tencentcdb.com:10120/bailun_other?useUnicode=true&characterEncoding=utf-8&useSSL=false&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true
username: root
password: '123456'
password: 'Aarob2020#'
thymeleaf:
prefix: classpath:/templates/
......@@ -36,16 +36,12 @@ logging:
#jb
cost:
url:
purchaseApplyCallbackUrlPost: http://api.fee.bailuntec.com/purchase/other/purchasing/list/detail/ApplyCallbackUrl
purchaseCashierCallbackUrlPost: http://api.fee.bailuntec.com/purchase/other/purchasing/list/detail/CashierCallbackUrl
costApplyCallbackUrlPost: http://api.fee.bailuntec.com/purchase/other/cost/check/ApplyCallbackUrl
costCashierCallbackUrlPost: http://api.fee.bailuntec.com/purchase/other/cost/check/CashierCallbackUrl
lendCostApplyCallBackUrlPost: http://api.fee.bailuntec.com/purchase/other/cost/check/lend/ApplyCallbackUrl
lendCostCashierCallbackUrlPost: http://api.fee.bailuntec.com/purchase/other/cost/check/lend/CashierCallbackUrl
getBuyDetailApi: http://api.fee.bailuntec.com/purchase/other/purchasing/buy/detail
getCostDetailApi: http://api.fee.bailuntec.com/purchase/other/cost/finansys/detail
buyUserApi: http://oa.bailuntec.com/Api/User/GetUser
logingUserApi: http://oa.bailuntec.com/Login/GetUserByBLUserAcct
GetDeparmentListApi: http://oa.bailuntec.com/api/User/GetDeparmentList
......
......@@ -42,16 +42,12 @@ logging:
#jb
cost:
url:
purchaseApplyCallbackUrlPost: http://api.fee.bailuntec.com/purchase/other/purchasing/list/detail/ApplyCallbackUrl
purchaseCashierCallbackUrlPost: http://api.fee.bailuntec.com/purchase/other/purchasing/list/detail/CashierCallbackUrl
costApplyCallbackUrlPost: http://api.fee.bailuntec.com/purchase/other/cost/check/ApplyCallbackUrl
costCashierCallbackUrlPost: http://api.fee.bailuntec.com/purchase/other/cost/check/CashierCallbackUrl
lendCostApplyCallBackUrlPost: http://api.fee.bailuntec.com/purchase/other/cost/check/lend/ApplyCallbackUrl
lendCostCashierCallbackUrlPost: http://api.fee.bailuntec.com/purchase/other/cost/check/lend/CashierCallbackUrl
getBuyDetailApi: http://api.fee.bailuntec.com/purchase/other/purchasing/buy/detail
getCostDetailApi: http://api.fee.bailuntec.com/purchase/other/cost/finansys/detail
buyUserApi: http://oa.bailuntec.com/Api/User/GetUser
logingUserApi: http://oa.bailuntec.com/Login/GetUserByBLUserAcct
GetDeparmentListApi: http://oa.bailuntec.com/api/User/GetDeparmentList
......
......@@ -3,104 +3,52 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.blt.other.module.cost.dao.CostPlanTempDao">
<select id="selectByNo" resultType="com.blt.other.database.model.CostPlanTempDomain">
SELECT
*
FROM
cost_plan_temp
WHERE
temp_no = #{tempNo}
SELECT *
FROM cost_plan_temp
WHERE temp_no = #{tempNo}
</select>
<insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
INSERT INTO
cost_plan_temp(
cost_plan_no,temp_no,kind_no,file_path,amount,cost_reason,dic,type_no
)
VALUE
(
#{costPlanNo},#{tempNo},#{kindNo},#{filePath},#{amount},#{costReason},#{dic},#{typeNo}
)
</insert>
<select id="selectByPlanNoAndKindNo" resultType="com.blt.other.database.model.CostPlanTempDomain">
SELECT
*
FROM
cost_plan_temp
WHERE
cost_plan_no = #{costPlanNo}
AND
kind_no = #{kindNo}
SELECT *
FROM cost_plan_temp
WHERE cost_plan_no = #{costPlanNo}
AND kind_no = #{kindNo}
</select>
<select id="selectListByPlanNo" resultType="com.blt.other.database.model.CostPlanTempDomain">
SELECT
*
FROM
cost_plan_temp
WHERE
cost_plan_no = #{costPlanNo}
ORDER BY
id DESC
SELECT *
FROM cost_plan_temp
WHERE cost_plan_no = #{costPlanNo}
ORDER BY id DESC
</select>
<!--parameterType="StudentEntity"-->
<delete id="deletedByPlanNoAndTempNo">
DELETE FROM
cost_plan_temp
WHERE
cost_plan_no = #{costPlanNo}
AND
temp_no = #{tempNo}
DELETE
FROM cost_plan_temp
WHERE cost_plan_no = #{costPlanNo}
AND temp_no = #{tempNo}
</delete>
<update id="update" parameterType="com.blt.other.database.model.CostPlanTempDomain">
UPDATE
cost_plan_temp
<set>
<if test=" costPlanNo!=null">cost_plan_no=#{costPlanNo},</if>
<if test=" kindNo!=null">kind_no=#{kindNo},</if>
<if test=" filePath!=null">file_path=#{filePath},</if>
<if test=" amount!=null">amount=#{amount},</if>
<if test=" dic!=null">dic=#{dic},</if>
<if test=" typeNo!=null">type_no=#{typeNo},</if>
<if test=" costReason!=null">cost_reason=#{costReason}</if>
</set>
WHERE
temp_no = #{tempNo}
</update>
<update id="deletedFilePath" parameterType="com.blt.other.database.model.CostPlanTempDomain">
UPDATE
cost_plan_temp
SET
file_path = NULL
WHERE
temp_no = #{tempNo}
cost_plan_temp
SET file_path = NULL
WHERE temp_no = #{tempNo}
</update>
<select id="selectByPlanNoAndTypeNo" resultType="com.blt.other.database.model.CostPlanTempDomain">
SELECT
*
FROM
cost_plan_temp
WHERE
cost_plan_no = #{costPlanNo}
AND
type_no = #{typeNo}
ORDER BY
id DESC
SELECT *
FROM cost_plan_temp
WHERE cost_plan_no = #{costPlanNo}
AND type_no = #{typeNo}
ORDER BY id DESC
</select>
<select id="selectByPlanNoAndTempNo" resultType="com.blt.other.database.model.CostPlanTempDomain">
SELECT
*
FROM
cost_plan_temp
WHERE
cost_plan_no = #{costPlanNo}
AND
temp_no = #{tempNo}
ORDER BY
id DESC
SELECT *
FROM cost_plan_temp
WHERE cost_plan_no = #{costPlanNo}
AND temp_no = #{tempNo}
ORDER BY id DESC
</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