Commit a731f446 authored by hongguangwu's avatar hongguangwu

MVP1.6.2-企微出差主逻辑

parent 25198d01
......@@ -168,6 +168,9 @@ public interface CacheConstants {
String FUND_IMPORT_HANDLE_LOCK = "fund_import_handle_handle_lock";
// 项目报销token的key
String WX_REIMBURSEMENT_TOKEN = "WX_REIMBURSEMENT_TOKEN";
public static final String WX_ACCOSS_TOKEN = "WX_ACCOSS_TOKEN";
/**
......
......@@ -152,4 +152,9 @@ public interface SecurityConstants {
**/
String WX_GET_MESSAGE_AUTH_URL = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_base&state=%s#wechat_redirect";
// 获取审批单号list hgw 2024-4-12 14:45:25
String WX_GET_APPROVAL_LIST = "https://qyapi.weixin.qq.com/cgi-bin/oa/getapprovalinfo?access_token={1}";
// 获取审核详情
String WX_GET_APPROVAL_DETAIL = "https://qyapi.weixin.qq.com/cgi-bin/oa/getapprovaldetail?access_token={1}";
}
......@@ -37,4 +37,19 @@ public class EkpPermissionTask {
log.info("-------------刷新EKP权限里的账号信息-定时任务结束------------");
}
/**
* @return
* @Author hgw
* @Description 每天1点,定时同步企业微信审批出差数据
* @Date 2024-4-15 18:24:06
* @Param
**/
public void doSaveQiWeiChuChai() throws Exception {
log.info("-------------获取企业微信出差数据-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprEkpPermissionProperties.getAppUrl(), daprEkpPermissionProperties.getAppId(),
"/qiWei/inner/everyDaySaveQiWeiChuChai", "", Object.class,
SecurityConstants.FROM_IN);
log.info("-------------获取企业微信出差数据-定时任务结束------------");
}
}
\ No newline at end of file
package com.yifu.cloud.plus.v1.yifu.permission.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* 企业微信出差
*/
@TableName(value = "ekp_qiwei_chuchai")
@Data
@Schema(description = "企业微信出差")
public class EkpQiwiChuchai {
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键", name = "fdId")
private String fdId;
@Schema(description = "审批编号")
@NotBlank(message = "审批编号不能为空")
private String spNo;
@Schema(description = "申请人姓名")
@NotBlank(message = "申请人姓名不能为空")
private String applyUserName;
@Schema(description = "申请人部门")
@NotBlank(message = "申请人部门不能为空")
private String applyUserDept;
@Schema(description = "申请日期")
@NotNull(message = "申请日期不能为空")
private LocalDateTime applyDate;
@Schema(description = "开始日期")
private LocalDate newBegin;
@Schema(description = "结束日期")
private LocalDate newEnd;
@Schema(description = "出差事由")
private String reason;
@Schema(description = "随行人员")
private String person;
@Schema(description = "出差地点")
private String address;
@Schema(description = "出行工具")
private String tools;
// status 0 初始;1已结算;
@Schema(description = "结算状态")
private String status;
@Schema(description = "关联结算ID")
private String settleFormId;
@Schema(description = "创建时间")
private LocalDateTime createTime;
}
\ No newline at end of file
package com.yifu.cloud.plus.v1.permission.controller;
import com.yifu.cloud.plus.v1.permission.service.QiWeiService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiChuchai;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 工资服务-获取微信
*
* @author hgw
* @date 2024-4-10 11:26:50
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/qiWei")
@Tag(name = "工资服务-获取微信")
public class QiWeiController {
private final QiWeiService wxSalaryService;
/**
* @Description: 每日获取当日企业微信审批里的出差
* @Author: hgw
* @Date: 2024-4-11 11:03:34
* @return: com.yifu.cloud.v1.common.core.util.R<java.util.List < com.yifu.cloud.v1.hrms.api.entity.TEventFeeDetail>>
**/
@GetMapping("/inner/everyDaySaveQiWeiChuChai")
@Inner
public R<List<EkpQiwiChuchai>> everyDaySaveQiWeiChuChai() {
String startDay = DateUtil.addDay(-29);
String endDay = DateUtil.addDay(0);
return wxSalaryService.getQiWeiChuChaiAndSave(startDay, endDay);
}
/**
* @param startTime
* @param endTime
* @Description: 获取企业微信审批里的出差
* @Author: hgw
* @Date: 2024-4-11 11:03:30
* @return: com.yifu.cloud.v1.common.core.util.R<java.util.List < com.yifu.cloud.v1.hrms.api.entity.TStatisticsProjectReimburse>>
**/
@Operation(description = "获取企业微信审批里的出差数据:startTime格式:2024-04-10")
@PostMapping("/getQiWeiChuCHaiInfoAndSave")
//@PreAuthorize("@pms.hasPermission('wxhr:wxsalaryauth')")
public R<List<EkpQiwiChuchai>> getQiWeiChuCHaiInfoAndSave(@RequestParam String startTime, @RequestParam String endTime) {
return wxSalaryService.getQiWeiChuChaiAndSave(startTime, endTime);
}
}
package com.yifu.cloud.plus.v1.permission.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiChuchai;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 企业微信出差
*
* @Entity generator.domain.TStatisticsProjectReimburse
*/
@Mapper
public interface EkpQiweiChuchaiMapper extends BaseMapper<EkpQiwiChuchai> {
/**
* @param status 状态
* @Description: 获取全部的列表,用来: 拉取企业微信时,不覆盖数据
* @Author: hgw
* @Date: 2021/7/28 18:05
* @return: java.util.List<com.yifu.cloud.v1.hrms.api.entity.salary.TStatisticsProjectReimburse>
**/
List<EkpQiwiChuchai> getAllInfo(@Param("status") String status);
}
package com.yifu.cloud.plus.v1.permission.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiChuchai;
import java.util.List;
/**
* 成本支出表
*
* @author hgw
* @date 2024-4-15 17:16:50
*/
public interface QiWeiService extends IService<EkpQiwiChuchai> {
/**
* @param startTime
* @param endTime
* @Description: 获取微信信息
* @Author: hgw
* @Date: 2021-7-28 17:46:01
* @return: com.yifu.cloud.v1.common.core.util.R<java.util.List < com.yifu.cloud.v1.hrms.api.entity.TStatisticsProjectReimburse>>
**/
R<List<EkpQiwiChuchai>> getQiWeiChuChaiAndSave(String startTime, String endTime);
}
......@@ -8,6 +8,8 @@ spring:
on-profile: dev
redis:
host: 127.0.0.1
port: 6379
password: '@yf_2017'
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
......
......@@ -83,3 +83,9 @@ springdoc:
- group: permission
#按包路径匹配
packagesToScan: com.yifu.cloud.plus.v1.permission.controller
wx:
corpid: wwbcb090af0dfe50e5
corpsecret: o3fLn0u9SFHh5_htpIRBSp2bOibTa8pZGcOJIJqvidQ
agentid: 1000019
authUrl: https://wmp.worfu.com/api
reimbursementCorpsecret: R0nKkvsY-oF41fuQvUXZ-kFG3_g_Ce0bpZt6mByx524
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.permission.mapper.EkpQiweiChuchaiMapper">
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.permission.entity.EkpQiwiChuchai">
<id property="fdId" column="fd_ID" />
<result property="spNo" column="SP_NO"/>
<result property="applyUserName" column="APPLY_USER_NAME"/>
<result property="applyUserDept" column="APPLY_USER_DEPT"/>
<result property="applyDate" column="APPLY_DATE"/>
<result property="newBegin" column="NEW_BEGIN"/>
<result property="newEnd" column="NEW_END"/>
<result property="reason" column="REASON"/>
<result property="person" column="PERSON"/>
<result property="address" column="ADDRESS"/>
<result property="tools" column="TOOLS"/>
<result property="status" column="STATUS"/>
<result property="settleFormId" column="SETTLE_FORM_ID"/>
</resultMap>
<sql id="Base_Column_List">
a.FD_ID,
a.SP_NO,
a.APPLY_USER_NAME,
a.APPLY_USER_DEPT,
a.APPLY_DATE,
a.NEW_BEGIN,
a.NEW_END,
a.REASON,
a.PERSON,
a.ADDRESS,
a.TOOLS,
a.STATUS,
a.SETTLE_FORM_ID
</sql>
<!--获取全部的,用来: 拉取企业微信时,不覆盖数据 -->
<select id="getAllInfo" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM ekp_qiwei_chuchai a
<where>
1=1
<if test="status != null and status.trim() != ''">
AND a.STATUS = #{status}
</if>
</where>
</select>
</mapper>
......@@ -131,11 +131,15 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
vo = readXls(inputStream, specialIdCardList, true, sheetName);
}
//数据保存
if (Common.isNotNull(vo.getErrorInfo())) {
return R.failed(vo);
}
return R.ok(vo);
} catch (IOException e) {
e.printStackTrace();
log.error("解析表头失败!"+ e.getMessage());
}
return null;
return R.failed("解析表头失败");
}
/**
......@@ -210,7 +214,11 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
} else if (CellType.BOOLEAN == cell.getCellType()) {
cellValue = String.valueOf(row.getCell(cellNum).getBooleanCellValue());
} else {
cellValue = row.getCell(cellNum).getStringCellValue();
try {
cellValue = row.getCell(cellNum).getStringCellValue();
} catch (Exception e) {
cellValue = String.valueOf(row.getCell(cellNum).getNumericCellValue());
}
}
} catch (Exception e) {
sheetVo.setErrorInfo("请注意单元格格式,第" + (i + 1) + "个sheet,第" + (rowNum + 1) + "行第" + (cellNum + 1) + "列。" + e.getMessage());
......
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