终于一周了
回想起来,天天都在加班。。。。
mybatisx插件
自动生成 entity、 mapper、service
有个问题需要手动处理
(1)路径问题
(2)entity属性没有驼峰命名
(3)接口没有加 I
(4)@Mapper注解 mapper接口的注解要自己加
审批流程
先占个位置 ,晚上改
审批有:单审、选审、会审
单审、选审:一个人通过就行
会审:多个人,半数通过即通过
/**
* 审批
*/
@ApiResponses({
@ApiResponse(code = 200, message = "OK"),
})
@ApiOperation(value = "POST", notes = "审批")
@ResponseBody
@RequestMapping(value = "/approvalMes", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
public Response approvalMes(@RequestBody @ApiParam(value = "quotationApprovalRecord", name = "quotationApprovalRecord", required = true) QuotationApprovalRecord quotationApprovalRecord) {
//record 得到 报价id
quotationApprovalRecord.setApprovalTime(new Date());
iQuotationApprovalRecordService.saveOrUpdate(quotationApprovalRecord);
QuotationMes mes = iquotationMesService.getById(quotationApprovalRecord.getQuotationId());
String quoteClassify = mes.getQuoteClassify();
// 类型决定了 规则
Integer ruleId = iQuotationClassifyService.query().eq("quotationClassify", quoteClassify).one().getQuotationRuleId();
// //规则 决定怎样审批
QuotationApprovalStatge statge = iQuotationApprovalStatgeService.query()
.eq("ruleId", ruleId)
.eq("approvalStage", mes.getApprovalStage()).one();
// QuotationApprovalStatge statge = iQuotationApprovalStatgeService.query()
// .eq("ruleId", 1)
// .eq("approvalStage", 1).one();
//直接批 未通过
if (quotationApprovalRecord.getApprovalResults() == 1){
mes.setApprovalStatus(2);
mes.setCurrentApprover("");
iquotationMesService.saveOrUpdate(mes);
}
else {
//通过
if (statge.getApprovalway() == 2){
String approver = statge.getApprover();
//总条数
String[] nums = approver.split(",");
List<QuotationApprovalRecord> records = iQuotationApprovalRecordService.query()
.eq("approvalStage", statge.getApprovalstage())
.eq("quotationId", mes.getId())
.eq("rulesId", ruleId)
.eq("approvalResults", 0)
.list();
//会审 通过
if ( nums.length / records.size() == 1){
mes.setCurrentApprover(approver);
mes.setApprovalStage(mes.getApprovalStage() + 1 ); ;
//判断是否又下个阶段
int i = mes.getApprovalStage() + 1;
QuotationApprovalStatge nextStage = iQuotationApprovalStatgeService.query()
.eq("ruleId", ruleId)
.eq("approvalStage", mes.getApprovalStage())
.one();
//没有下个阶段
if (nextStage == null){
mes.setApprovalStatus(1);
mes.setApprovalStage(0);
mes.setCurrentApprover("");
iquotationMesService.saveOrUpdate(mes);
return response.success(200, "已审批");
}
//下个阶段
mes.setApprovalStage(i);
mes.setCurrentApprover(nextStage.getApprover());
iquotationMesService.saveOrUpdate(mes);
return response.success(200, "已审批");
}else {
//会审未通过
mes.setCurrentApprover(mes.getCurrentApprover().replace(quotationApprovalRecord.getApprover()+",",""));
iquotationMesService.saveOrUpdate(mes);
}
}else {
int i = mes.getApprovalStage() + 1;
QuotationApprovalStatge one = iQuotationApprovalStatgeService.query().eq("approvalStage", i).eq("ruleId", ruleId).one();
//是否有下一阶段
//没有下一阶段
if (one == null){
mes.setApprovalStatus(0);
mes.setApprovalStage(0);
mes.setCurrentApprover("");
iquotationMesService.saveOrUpdate(mes);
}else {
//有下一阶段
mes.setCurrentApprover(one.getApprover());
mes.setApprovalStage(i);
iquotationMesService.saveOrUpdate(mes);
}
}
}
return response.success(200, "成功!");
}
今天终于第一次没有加班,六点半就下班了,就很爽