commit
09ea2f1bdb
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
* 发票勾选
|
||||
*/
|
||||
function checkInvoice(){
|
||||
let ids = ModeList.getCheckedID();
|
||||
if(!ids || ids === ""){
|
||||
ModeList.showConfirm("请勾选发票!");
|
||||
return;
|
||||
}
|
||||
let requestParam = {
|
||||
ids:ids,
|
||||
checkInvoiceUniqueCode:""
|
||||
};
|
||||
console.log("请求参数 ==>",requestParam)
|
||||
ModeList.showLoading(true,'large','发票勾选中...');
|
||||
$.ajax({
|
||||
url:"/api/xbk/dz_invoice/checkInvoice",
|
||||
type:"POST",
|
||||
headers:{'Content-Type':'application/json'},
|
||||
data:JSON.stringify(requestParam),
|
||||
success:function(res){
|
||||
console.log("result==>",res);
|
||||
ModeList.showLoading(false);
|
||||
ModeList.showMessage("操作成功", 3, 2); //提示信息,2s后消失
|
||||
ModeList.reloadTable();
|
||||
},
|
||||
error:function(err){
|
||||
console.log(err);
|
||||
ModeList.showLoading(false);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消勾选
|
||||
*/
|
||||
function unCheckInvoice(){
|
||||
let ids = ModeList.getCheckedID();
|
||||
if(!ids || ids === ""){
|
||||
ModeList.showConfirm("请勾选发票!");
|
||||
return;
|
||||
}
|
||||
let requestParam = {
|
||||
ids:ids,
|
||||
checkInvoiceUniqueCode:""
|
||||
};
|
||||
console.log("请求参数 ==>",requestParam)
|
||||
ModeList.showLoading(true,'large','发票取消勾选中...');
|
||||
$.ajax({
|
||||
url:"/api/xbk/dz_invoice/unCheckInvoice",
|
||||
type:"POST",
|
||||
headers:{'Content-Type':'application/json'},
|
||||
data:JSON.stringify(requestParam),
|
||||
success:function(res){
|
||||
console.log("result==>",res);
|
||||
ModeList.showLoading(false);
|
||||
ModeList.showMessage("操作成功", 3, 2); //提示信息,2s后消失
|
||||
ModeList.reloadTable();
|
||||
},
|
||||
error:function(err){
|
||||
console.log(err);
|
||||
ModeList.showLoading(false);
|
||||
}
|
||||
})
|
||||
}
|
|
@ -37,4 +37,25 @@ public interface DzInvoiceMapper {
|
|||
boolean updateInvoiceCheckStatus(@ParamMapper("check_status") int checkStatus,
|
||||
@ParamMapper("fieldId") String fieldId,
|
||||
@ParamMapper("fieldValue") Object fieldValue);
|
||||
|
||||
/**
|
||||
* <h2>更新发票勾选状态</h2>
|
||||
* @param checkStatus 勾选状态值
|
||||
* @param fieldId 字段名
|
||||
* @param fieldValue 字段值
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Update("update APInvoice set check_status = #{checkStatus} where $t{fieldId} in ${fieldValue}")
|
||||
boolean batchUpdateInvoiceCheckStatus(@ParamMapper("check_status") int checkStatus,
|
||||
@ParamMapper("fieldId") String fieldId,
|
||||
@ParamMapper("fieldValue") Object fieldValue);
|
||||
|
||||
|
||||
/**
|
||||
* <h2>查询已经勾选过的发票信息</h2>
|
||||
* @return 发票信息集合
|
||||
*/
|
||||
@Select("select * from APInvoice where check_status = 2 or check_status = 3")
|
||||
List<Map<String,Object>> queryOnChooseInvoices();
|
||||
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public class YearReviewController {
|
|||
}
|
||||
|
||||
/**
|
||||
* <h2>获取创建或处理流程的总数</h2>
|
||||
* <h2>获取创建或处理流程的top5</h2>
|
||||
* @param request 请求体
|
||||
* @param response 响应体
|
||||
* @param param 请求参数
|
||||
|
@ -146,8 +146,8 @@ public class YearReviewController {
|
|||
User loginUser = HrmUserVarify.getUser(request, response);
|
||||
param.put("workflowIds",workflowIds);
|
||||
String type = Util.null2String(param.get("type"));
|
||||
String date = "create".equals(type) ? reviewService.getCreateTopDate(param, loginUser) : reviewService.getOperateTopDate(param, loginUser);
|
||||
return ApiResult.success(date);
|
||||
Map<String,Object> dateMap = "create".equals(type) ? reviewService.getCreateTopDate(param, loginUser) : reviewService.getOperateTopDate(param, loginUser);
|
||||
return ApiResult.success(dateMap);
|
||||
}catch (Exception e){
|
||||
log.error("获取创建或处理流程总数异常 ==> "+Util.getErrString(e));
|
||||
return ApiResult.error(e.getMessage());
|
||||
|
|
|
@ -111,7 +111,7 @@ public interface ReviewMapper {
|
|||
"where wr.creater = #{uid} and (createdate between #{param.startDate} and #{param.endDate}) " +
|
||||
" and workflowid not in (${param.workflowIds})" +
|
||||
"group by workflowid " +
|
||||
"ORDER BY wcount " +
|
||||
"ORDER BY wcount desc" +
|
||||
"limit 5")
|
||||
List<Map<String, Object>> queryCreateTop5(@ParamMapper("param") Map<String,Object> param,@ParamMapper("uid") int uid);
|
||||
|
||||
|
@ -141,13 +141,13 @@ public interface ReviewMapper {
|
|||
* @param uid 用户id
|
||||
* @return 日期
|
||||
*/
|
||||
@Select("select createdate from workflow_requestbase " +
|
||||
@Select("select createdate,count(*) tcount from workflow_requestbase " +
|
||||
" where creater = #{uid} and (createdate between #{param.startDate} and #{param.endDate}) " +
|
||||
" and workflowid not in (${param.workflowIds}) " +
|
||||
" group by createdate " +
|
||||
" order by count(*) desc " +
|
||||
" limit 1")
|
||||
String queryCreateTopDate(@ParamMapper("param") Map<String, Object> param,@ParamMapper("uid") int uid);
|
||||
Map<String,Object> queryCreateTopDate(@ParamMapper("param") Map<String, Object> param,@ParamMapper("uid") int uid);
|
||||
|
||||
/**
|
||||
* <h2>查询操作流程最多的一天</h2>
|
||||
|
@ -155,7 +155,7 @@ public interface ReviewMapper {
|
|||
* @param uid 用户id
|
||||
* @return 日期
|
||||
*/
|
||||
@Select("select operatedate " +
|
||||
@Select("select operatedate,count(*) tcount " +
|
||||
"from workflow_requestoperatelog wfo " +
|
||||
"inner join workflow_requestbase wrb on wfo.requestid = wrb.requestid " +
|
||||
"inner join workflow_base wb on wrb.workflowid = wb.id " +
|
||||
|
@ -166,7 +166,7 @@ public interface ReviewMapper {
|
|||
"group by operatedate " +
|
||||
"order by count(*) desc " +
|
||||
"limit 1")
|
||||
String queryOperateTopDate(@ParamMapper("param") Map<String, Object> param,@ParamMapper("uid") int uid);
|
||||
Map<String,Object> queryOperateTopDate(@ParamMapper("param") Map<String, Object> param,@ParamMapper("uid") int uid);
|
||||
|
||||
/**
|
||||
* <h2>通过条件查询数量</h2>
|
||||
|
|
|
@ -51,7 +51,7 @@ public interface ReviewService {
|
|||
* @param loginUser 用户信息
|
||||
* @return 日期
|
||||
*/
|
||||
String getCreateTopDate(Map<String, Object> param, User loginUser);
|
||||
Map<String,Object> getCreateTopDate(Map<String, Object> param, User loginUser);
|
||||
|
||||
/**
|
||||
* <h2>获取操作流程最多的一天</h2>
|
||||
|
@ -59,7 +59,7 @@ public interface ReviewService {
|
|||
* @param loginUser 用户信息
|
||||
* @return 日期
|
||||
*/
|
||||
String getOperateTopDate(Map<String, Object> param, User loginUser);
|
||||
Map<String,Object> getOperateTopDate(Map<String, Object> param, User loginUser);
|
||||
|
||||
/**
|
||||
* <h2>获取流程的总数</h2>
|
||||
|
|
|
@ -58,12 +58,12 @@ public class ReviewServiceImpl implements ReviewService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getCreateTopDate(Map<String, Object> param, User loginUser) {
|
||||
public Map<String,Object> getCreateTopDate(Map<String, Object> param, User loginUser) {
|
||||
return reviewMapper.queryCreateTopDate(param,loginUser.getUID());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOperateTopDate(Map<String, Object> param, User loginUser) {
|
||||
public Map<String,Object> getOperateTopDate(Map<String, Object> param, User loginUser) {
|
||||
return reviewMapper.queryOperateTopDate(param,loginUser.getUID());
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import aiyh.utils.excention.CustomerException;
|
|||
import aiyh.utils.httpUtil.ResponeVo;
|
||||
import aiyh.utils.httpUtil.util.HttpUtils;
|
||||
import com.api.bokang.xiao.dz_invoice.mapper.DzInvoiceMapper;
|
||||
import lombok.Setter;
|
||||
import weaver.bokang.xiao.dz_invoice.mapper.WorkflowMapper;
|
||||
import weaver.hrm.User;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
@ -17,7 +18,9 @@ import weaver.xiao.commons.config.service.DealWithMapping;
|
|||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName InvoiceDeductionAction
|
||||
|
@ -25,6 +28,8 @@ import java.util.Map;
|
|||
* @Date 2023/2/3 9:54
|
||||
* @Description <h1>发票抵扣action</h1>
|
||||
**/
|
||||
|
||||
@Setter
|
||||
@ActionDesc(value = "抵扣勾选发票接口调用",author = "bokang.xiao")
|
||||
public class InvoiceDeductionAction extends SafeCusBaseAction {
|
||||
|
||||
|
@ -32,6 +37,14 @@ public class InvoiceDeductionAction extends SafeCusBaseAction {
|
|||
@PrintParamMark
|
||||
private String requestUnique;
|
||||
|
||||
@RequiredMark("发票信息所属明细")
|
||||
@PrintParamMark
|
||||
private String invoiceDetailId;
|
||||
|
||||
@RequiredMark("发票字段名")
|
||||
@PrintParamMark
|
||||
private String invoiceField;
|
||||
|
||||
private final WorkflowMapper workflowMapper = Util.getMapper(WorkflowMapper.class);
|
||||
|
||||
private final DzInvoiceMapper dzInvoiceMapper = Util.getMapper(DzInvoiceMapper.class);
|
||||
|
@ -45,11 +58,13 @@ public class InvoiceDeductionAction extends SafeCusBaseAction {
|
|||
|
||||
@Override
|
||||
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo){
|
||||
|
||||
log.info(String.format("=================== {%s} begin ======================", this.getClass().getName()));
|
||||
log.info(String.format("params:[requestId ==>%s],[requestUnique ==>%s]", requestId,requestUnique));
|
||||
Map<String, Object> workflowMessage = workflowMapper.queryWorkflowByRequestId(requestId, billTable);
|
||||
RequestMappingConfig requestMappingConfig = dealWithMapping.treeDealWithUniqueCode(requestUnique);
|
||||
Map<String, Object> requestParam = dealWithMapping.getRequestParam(workflowMessage, requestMappingConfig);
|
||||
dealWithMapping.setMainTable(billTable);
|
||||
try {
|
||||
ResponeVo responeVo = httpUtils.apiPost(requestMappingConfig.getRequestUrl(), requestParam);
|
||||
if(responeVo.getCode() == 200){
|
||||
|
@ -58,6 +73,13 @@ public class InvoiceDeductionAction extends SafeCusBaseAction {
|
|||
String describe = Util.null2String(result.get("describe"));
|
||||
if(!"E0000".equals(code)){
|
||||
throw new CustomerException("请求调用失败 ==>"+describe);
|
||||
}else {
|
||||
String detailTable = billTable + "_dt"+invoiceDetailId;
|
||||
List<Map<String, Object>> invoiceList = workflowMapper.queryDetailByMainId(Util.null2String(workflowMessage.get("id")), detailTable);
|
||||
String invoices = invoiceList.stream()
|
||||
.map(item -> Util.null2String(item.get(invoiceField)))
|
||||
.collect(Collectors.joining(","));
|
||||
dzInvoiceMapper.batchUpdateInvoiceCheckStatus(REQ_DEDUCTION,"id",invoices);
|
||||
}
|
||||
}else {
|
||||
throw new CustomerException("请求状态码不为200");
|
||||
|
|
|
@ -4,6 +4,7 @@ import aiyh.utils.annotation.recordset.ParamMapper;
|
|||
import aiyh.utils.annotation.recordset.Select;
|
||||
import aiyh.utils.annotation.recordset.SqlMapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -23,4 +24,14 @@ public interface WorkflowMapper {
|
|||
*/
|
||||
@Select("select * from $t{tableName} where requestid = #{requestId}")
|
||||
Map<String,Object> queryWorkflowByRequestId(@ParamMapper("requestId") String requestId,@ParamMapper("tableName") String tableName);
|
||||
|
||||
/**
|
||||
* <h2>通过mainId查询流程明细表数据</h2>
|
||||
* @param mainId mainId
|
||||
* @param tableName 流程表名
|
||||
* @return 流程数据
|
||||
*/
|
||||
@Select("select * from $t{tableName} where mainid = #{mainId}")
|
||||
List<Map<String,Object>> queryDetailByMainId(@ParamMapper("mainId") String mainId, @ParamMapper("tableName") String tableName);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,18 +1,75 @@
|
|||
package weaver.bokang.xiao.dz_invoice.schedule;
|
||||
|
||||
import aiyh.utils.Util;
|
||||
import aiyh.utils.annotation.ActionDesc;
|
||||
import aiyh.utils.annotation.PrintParamMark;
|
||||
import aiyh.utils.annotation.RequiredMark;
|
||||
import aiyh.utils.excention.CustomerException;
|
||||
import aiyh.utils.httpUtil.ResponeVo;
|
||||
import aiyh.utils.httpUtil.util.HttpUtils;
|
||||
import com.api.bokang.xiao.dz_invoice.mapper.DzInvoiceMapper;
|
||||
import org.apache.log4j.Logger;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
import weaver.xiao.commons.config.entity.RequestMappingConfig;
|
||||
import weaver.xiao.commons.config.service.DealWithMapping;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName InvoiceQuerySchecule
|
||||
* @ClassName InvoiceQuerySchedule
|
||||
* @Author 肖博亢
|
||||
* @Date 2023/2/3 15:31
|
||||
* @Description <h1>通过定时任务查询发票勾选状态</h1>
|
||||
**/
|
||||
|
||||
@ActionDesc(value = "定时查询发票勾选状态", author = "bokang.xiao")
|
||||
public class InvoiceQuerySchedule extends BaseCronJob {
|
||||
|
||||
@RequiredMark("发票查询接口唯一标识")
|
||||
@PrintParamMark
|
||||
private String requestUnique;
|
||||
|
||||
private final DealWithMapping dealWithMapping = new DealWithMapping();
|
||||
private final DzInvoiceMapper dzInvoiceMapper = Util.getMapper(DzInvoiceMapper.class);
|
||||
|
||||
private final HttpUtils httpUtils = new HttpUtils();
|
||||
|
||||
private final Logger logger = Util.getLogger();
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
try{
|
||||
logger.info(String.format("================== {%s} 定时任务开始执行 ================",this.getClass().getName()));
|
||||
logger.info(String.format("param: requestUnique ==>[%s]",requestUnique));
|
||||
Util.verifyRequiredField(this);
|
||||
List<Map<String, Object>> invoiceList = dzInvoiceMapper.queryOnChooseInvoices();
|
||||
RequestMappingConfig requestMappingConfig = dealWithMapping.treeDealWithUniqueCode(requestUnique);
|
||||
if(!invoiceList.isEmpty()){
|
||||
for (Map<String, Object> invoice : invoiceList) {
|
||||
Map<String, Object> requestParam = dealWithMapping.getRequestParam(invoice,requestMappingConfig);
|
||||
ResponeVo responeVo = httpUtils.apiPost(requestMappingConfig.getRequestUrl(), requestParam);
|
||||
if(responeVo.getCode() == 200){
|
||||
Map<String,Object> result = responeVo.getResponseEntity(Map.class);
|
||||
String code = Util.null2String(result.get("code"));
|
||||
if("E0000".equals(code)){
|
||||
List<Map<String,Object>> invoices = (List<Map<String, Object>>) result.get("data");
|
||||
if(!invoices.isEmpty()){
|
||||
for (Map<String, Object> map : invoices) {
|
||||
String checkStatus = Util.null2String(map.get("checkStatus"));
|
||||
dzInvoiceMapper.updateInvoiceCheckStatus(Util.getIntValue(checkStatus),"id",invoice.get("id"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
throw new CustomerException("请求状态码不为 200");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
logger.info("同步发生异常 ==>"+Util.getErrString(e));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ public class RequestUtil {
|
|||
headers.forEach(httpPut::setHeader);
|
||||
httpPut.setEntity(new StringEntity(JSON.toJSONString(requestInfo.getParams()),"UTF-8"));
|
||||
result = apiSend(httpPut,tClass);}break;
|
||||
default:break;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package bokang.xiao;
|
||||
|
||||
import aiyh.utils.GenerateFileUtil;
|
||||
import aiyh.utils.Util;
|
||||
import aiyh.utils.httpUtil.ResponeVo;
|
||||
import aiyh.utils.httpUtil.util.HttpUtils;
|
||||
|
@ -9,11 +10,12 @@ import com.api.bokang.xiao.porsche_review.mapper.ReviewMapper;
|
|||
import com.api.bokang.xiao.porsche_review.service.impl.ReviewServiceImpl;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.Test;
|
||||
import weaver.bokang.xiao.dz_invoice.action.InvoiceDeductionAction;
|
||||
import weaver.bokang.xiao.dz_invoice.schedule.InvoiceQuerySchedule;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName NormalTest
|
||||
|
@ -25,7 +27,8 @@ public class NormalTest extends BaseTest {
|
|||
|
||||
@Test
|
||||
public void testWord(){
|
||||
|
||||
GenerateFileUtil.createActionDocument(InvoiceDeductionAction.class);
|
||||
GenerateFileUtil.createCronJobDocument(InvoiceQuerySchedule.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -42,8 +45,9 @@ public class NormalTest extends BaseTest {
|
|||
param.put("startDate","2022-01-09");
|
||||
param.put("endDate","2023-04-09");
|
||||
param.put("workflowIds","0");
|
||||
String s1 = reviewMapper.queryCreateTopDate(param, 1);
|
||||
System.out.println(s1);
|
||||
//String s1 = reviewMapper.queryCreateTopDate(param, 1);
|
||||
//System.out.println(s1);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue