Compare commits

...

2 Commits

11 changed files with 201 additions and 20 deletions

View File

@ -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);
}
})
}

View File

@ -37,4 +37,25 @@ public interface DzInvoiceMapper {
boolean updateInvoiceCheckStatus(@ParamMapper("check_status") int checkStatus, boolean updateInvoiceCheckStatus(@ParamMapper("check_status") int checkStatus,
@ParamMapper("fieldId") String fieldId, @ParamMapper("fieldId") String fieldId,
@ParamMapper("fieldValue") Object fieldValue); @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();
} }

View File

@ -49,7 +49,7 @@ public class YearReviewController {
@Path("/getCreateOrOperateCount") @Path("/getCreateOrOperateCount")
@POST @POST
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String getCreateOrOperateCount(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Map<String,Object> param) { public String getCreateOrOperateCount(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Map<String,Object> param) {
try{ try{
log.info("into getCreateOrOperateCount success params ==> "+param); log.info("into getCreateOrOperateCount success params ==> "+param);
User loginUser = HrmUserVarify.getUser(request, response); User loginUser = HrmUserVarify.getUser(request, response);
@ -107,7 +107,7 @@ public class YearReviewController {
} }
/** /**
* <h2></h2> * <h2>top5</h2>
* @param request * @param request
* @param response * @param response
* @param param * @param param
@ -146,8 +146,8 @@ public class YearReviewController {
User loginUser = HrmUserVarify.getUser(request, response); User loginUser = HrmUserVarify.getUser(request, response);
param.put("workflowIds",workflowIds); param.put("workflowIds",workflowIds);
String type = Util.null2String(param.get("type")); String type = Util.null2String(param.get("type"));
String date = "create".equals(type) ? reviewService.getCreateTopDate(param, loginUser) : reviewService.getOperateTopDate(param, loginUser); Map<String,Object> dateMap = "create".equals(type) ? reviewService.getCreateTopDate(param, loginUser) : reviewService.getOperateTopDate(param, loginUser);
return ApiResult.success(date); return ApiResult.success(dateMap);
}catch (Exception e){ }catch (Exception e){
log.error("获取创建或处理流程总数异常 ==> "+Util.getErrString(e)); log.error("获取创建或处理流程总数异常 ==> "+Util.getErrString(e));
return ApiResult.error(e.getMessage()); return ApiResult.error(e.getMessage());

View File

@ -111,7 +111,7 @@ public interface ReviewMapper {
"where wr.creater = #{uid} and (createdate between #{param.startDate} and #{param.endDate}) " + "where wr.creater = #{uid} and (createdate between #{param.startDate} and #{param.endDate}) " +
" and workflowid not in (${param.workflowIds})" + " and workflowid not in (${param.workflowIds})" +
"group by workflowid " + "group by workflowid " +
"ORDER BY wcount " + "ORDER BY wcount desc" +
"limit 5") "limit 5")
List<Map<String, Object>> queryCreateTop5(@ParamMapper("param") Map<String,Object> param,@ParamMapper("uid") int uid); 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 * @param uid id
* @return * @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}) " + " where creater = #{uid} and (createdate between #{param.startDate} and #{param.endDate}) " +
" and workflowid not in (${param.workflowIds}) " + " and workflowid not in (${param.workflowIds}) " +
" group by createdate " + " group by createdate " +
" order by count(*) desc " + " order by count(*) desc " +
" limit 1") " 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> * <h2></h2>
@ -155,7 +155,7 @@ public interface ReviewMapper {
* @param uid id * @param uid id
* @return * @return
*/ */
@Select("select operatedate " + @Select("select operatedate,count(*) tcount " +
"from workflow_requestoperatelog wfo " + "from workflow_requestoperatelog wfo " +
"inner join workflow_requestbase wrb on wfo.requestid = wrb.requestid " + "inner join workflow_requestbase wrb on wfo.requestid = wrb.requestid " +
"inner join workflow_base wb on wrb.workflowid = wb.id " + "inner join workflow_base wb on wrb.workflowid = wb.id " +
@ -166,7 +166,7 @@ public interface ReviewMapper {
"group by operatedate " + "group by operatedate " +
"order by count(*) desc " + "order by count(*) desc " +
"limit 1") "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> * <h2></h2>

View File

@ -51,7 +51,7 @@ public interface ReviewService {
* @param loginUser * @param loginUser
* @return * @return
*/ */
String getCreateTopDate(Map<String, Object> param, User loginUser); Map<String,Object> getCreateTopDate(Map<String, Object> param, User loginUser);
/** /**
* <h2></h2> * <h2></h2>
@ -59,7 +59,7 @@ public interface ReviewService {
* @param loginUser * @param loginUser
* @return * @return
*/ */
String getOperateTopDate(Map<String, Object> param, User loginUser); Map<String,Object> getOperateTopDate(Map<String, Object> param, User loginUser);
/** /**
* <h2></h2> * <h2></h2>

View File

@ -58,12 +58,12 @@ public class ReviewServiceImpl implements ReviewService {
} }
@Override @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()); return reviewMapper.queryCreateTopDate(param,loginUser.getUID());
} }
@Override @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()); return reviewMapper.queryOperateTopDate(param,loginUser.getUID());
} }

View File

@ -9,6 +9,7 @@ import aiyh.utils.excention.CustomerException;
import aiyh.utils.httpUtil.ResponeVo; import aiyh.utils.httpUtil.ResponeVo;
import aiyh.utils.httpUtil.util.HttpUtils; import aiyh.utils.httpUtil.util.HttpUtils;
import com.api.bokang.xiao.dz_invoice.mapper.DzInvoiceMapper; import com.api.bokang.xiao.dz_invoice.mapper.DzInvoiceMapper;
import lombok.Setter;
import weaver.bokang.xiao.dz_invoice.mapper.WorkflowMapper; import weaver.bokang.xiao.dz_invoice.mapper.WorkflowMapper;
import weaver.hrm.User; import weaver.hrm.User;
import weaver.soa.workflow.request.RequestInfo; import weaver.soa.workflow.request.RequestInfo;
@ -17,7 +18,9 @@ import weaver.xiao.commons.config.service.DealWithMapping;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @ClassName InvoiceDeductionAction * @ClassName InvoiceDeductionAction
@ -25,6 +28,8 @@ import java.util.Map;
* @Date 2023/2/3 9:54 * @Date 2023/2/3 9:54
* @Description <h1>action</h1> * @Description <h1>action</h1>
**/ **/
@Setter
@ActionDesc(value = "抵扣勾选发票接口调用",author = "bokang.xiao") @ActionDesc(value = "抵扣勾选发票接口调用",author = "bokang.xiao")
public class InvoiceDeductionAction extends SafeCusBaseAction { public class InvoiceDeductionAction extends SafeCusBaseAction {
@ -32,6 +37,14 @@ public class InvoiceDeductionAction extends SafeCusBaseAction {
@PrintParamMark @PrintParamMark
private String requestUnique; private String requestUnique;
@RequiredMark("发票信息所属明细")
@PrintParamMark
private String invoiceDetailId;
@RequiredMark("发票字段名")
@PrintParamMark
private String invoiceField;
private final WorkflowMapper workflowMapper = Util.getMapper(WorkflowMapper.class); private final WorkflowMapper workflowMapper = Util.getMapper(WorkflowMapper.class);
private final DzInvoiceMapper dzInvoiceMapper = Util.getMapper(DzInvoiceMapper.class); private final DzInvoiceMapper dzInvoiceMapper = Util.getMapper(DzInvoiceMapper.class);
@ -45,11 +58,13 @@ public class InvoiceDeductionAction extends SafeCusBaseAction {
@Override @Override
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo){ 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("=================== {%s} begin ======================", this.getClass().getName()));
log.info(String.format("params:[requestId ==>%s],[requestUnique ==>%s]", requestId,requestUnique)); log.info(String.format("params:[requestId ==>%s],[requestUnique ==>%s]", requestId,requestUnique));
Map<String, Object> workflowMessage = workflowMapper.queryWorkflowByRequestId(requestId, billTable); Map<String, Object> workflowMessage = workflowMapper.queryWorkflowByRequestId(requestId, billTable);
RequestMappingConfig requestMappingConfig = dealWithMapping.treeDealWithUniqueCode(requestUnique); RequestMappingConfig requestMappingConfig = dealWithMapping.treeDealWithUniqueCode(requestUnique);
Map<String, Object> requestParam = dealWithMapping.getRequestParam(workflowMessage, requestMappingConfig); Map<String, Object> requestParam = dealWithMapping.getRequestParam(workflowMessage, requestMappingConfig);
dealWithMapping.setMainTable(billTable);
try { try {
ResponeVo responeVo = httpUtils.apiPost(requestMappingConfig.getRequestUrl(), requestParam); ResponeVo responeVo = httpUtils.apiPost(requestMappingConfig.getRequestUrl(), requestParam);
if(responeVo.getCode() == 200){ if(responeVo.getCode() == 200){
@ -58,6 +73,13 @@ public class InvoiceDeductionAction extends SafeCusBaseAction {
String describe = Util.null2String(result.get("describe")); String describe = Util.null2String(result.get("describe"));
if(!"E0000".equals(code)){ if(!"E0000".equals(code)){
throw new CustomerException("请求调用失败 ==>"+describe); 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 { }else {
throw new CustomerException("请求状态码不为200"); throw new CustomerException("请求状态码不为200");

View File

@ -4,6 +4,7 @@ import aiyh.utils.annotation.recordset.ParamMapper;
import aiyh.utils.annotation.recordset.Select; import aiyh.utils.annotation.recordset.Select;
import aiyh.utils.annotation.recordset.SqlMapper; import aiyh.utils.annotation.recordset.SqlMapper;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -23,4 +24,14 @@ public interface WorkflowMapper {
*/ */
@Select("select * from $t{tableName} where requestid = #{requestId}") @Select("select * from $t{tableName} where requestid = #{requestId}")
Map<String,Object> queryWorkflowByRequestId(@ParamMapper("requestId") String requestId,@ParamMapper("tableName") String tableName); 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);
} }

View File

@ -1,18 +1,75 @@
package weaver.bokang.xiao.dz_invoice.schedule; 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.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 * @Author
* @Date 2023/2/3 15:31 * @Date 2023/2/3 15:31
* @Description <h1></h1> * @Description <h1></h1>
**/ **/
@ActionDesc(value = "定时查询发票勾选状态", author = "bokang.xiao")
public class InvoiceQuerySchedule extends BaseCronJob { 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 @Override
public void execute() { 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));
}
} }
} }

View File

@ -53,6 +53,7 @@ public class RequestUtil {
headers.forEach(httpPut::setHeader); headers.forEach(httpPut::setHeader);
httpPut.setEntity(new StringEntity(JSON.toJSONString(requestInfo.getParams()),"UTF-8")); httpPut.setEntity(new StringEntity(JSON.toJSONString(requestInfo.getParams()),"UTF-8"));
result = apiSend(httpPut,tClass);}break; result = apiSend(httpPut,tClass);}break;
default:break;
} }
return result; return result;

View File

@ -1,5 +1,6 @@
package bokang.xiao; package bokang.xiao;
import aiyh.utils.GenerateFileUtil;
import aiyh.utils.Util; import aiyh.utils.Util;
import aiyh.utils.httpUtil.ResponeVo; import aiyh.utils.httpUtil.ResponeVo;
import aiyh.utils.httpUtil.util.HttpUtils; 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 com.api.bokang.xiao.porsche_review.service.impl.ReviewServiceImpl;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.junit.Test; 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.io.IOException;
import java.util.HashMap; import java.util.*;
import java.util.List; import java.util.stream.Collectors;
import java.util.Map;
/** /**
* @ClassName NormalTest * @ClassName NormalTest
@ -25,7 +27,8 @@ public class NormalTest extends BaseTest {
@Test @Test
public void testWord(){ public void testWord(){
GenerateFileUtil.createActionDocument(InvoiceDeductionAction.class);
GenerateFileUtil.createCronJobDocument(InvoiceQuerySchedule.class);
} }
@Test @Test
@ -42,8 +45,9 @@ public class NormalTest extends BaseTest {
param.put("startDate","2022-01-09"); param.put("startDate","2022-01-09");
param.put("endDate","2023-04-09"); param.put("endDate","2023-04-09");
param.put("workflowIds","0"); param.put("workflowIds","0");
String s1 = reviewMapper.queryCreateTopDate(param, 1); //String s1 = reviewMapper.queryCreateTopDate(param, 1);
System.out.println(s1); //System.out.println(s1);
} }
@Test @Test