parent
c176ee986f
commit
18a2c33fee
@ -0,0 +1,160 @@ |
||||
package com.cweb.controller; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.github.pagehelper.PageHelper; |
||||
import com.github.pagehelper.PageInfo; |
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.common.security.UserCenter; |
||||
import com.hfkj.common.utils.ResponseMsgUtil; |
||||
import com.hfkj.entity.BsAudit; |
||||
import com.hfkj.entity.BsMer; |
||||
import com.hfkj.entity.BsMerSettleAcctApply; |
||||
import com.hfkj.entity.SecRegion; |
||||
import com.hfkj.model.ResponseData; |
||||
import com.hfkj.model.UserInfoModel; |
||||
import com.hfkj.service.BsAuditService; |
||||
import com.hfkj.service.BsMerService; |
||||
import com.hfkj.service.BsMerSettleAcctApplyService; |
||||
import com.hfkj.service.CommonService; |
||||
import com.hfkj.sysenum.*; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
@Controller |
||||
@Api(value = "商户审核") |
||||
@RequestMapping(value = "/audit") |
||||
public class BsAuditController { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(BsAuditController.class); |
||||
|
||||
@Resource |
||||
private UserCenter userCenter; |
||||
@Resource |
||||
private BsAuditService auditService; |
||||
|
||||
@RequestMapping(value="/approve",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "通过") |
||||
public ResponseData approve(@RequestBody JSONObject body) { |
||||
try { |
||||
if (body == null || StringUtils.isBlank(body.getString("auditNo"))) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); |
||||
if (userInfoModel == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); |
||||
} |
||||
|
||||
// 查询审核
|
||||
BsAudit audit = auditService.getAuditDetailByNo(body.getString("auditNo")); |
||||
if (audit == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的审批"); |
||||
} |
||||
if (!audit.getStatus().equals(AuditStatusEnum.status1.getNumber())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "操作失败,审批状态不处于待审批"); |
||||
} |
||||
if (!userInfoModel.getAgent().getId().equals(audit.getReviewedUserId())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "操作失败,审批审核人校验不通过"); |
||||
} |
||||
|
||||
auditService.approve(audit.getId()); |
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error(e.getMessage(), e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/reject",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "驳回") |
||||
public ResponseData reject(@RequestBody JSONObject body) { |
||||
try { |
||||
if (body == null || body.getString("auditNo") == null || StringUtils.isBlank(body.getString("rejectReason"))) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); |
||||
if (userInfoModel == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); |
||||
} |
||||
|
||||
// 查询审核
|
||||
BsAudit audit = auditService.getAuditDetailByNo(body.getString("auditNo")); |
||||
if (audit == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的审批"); |
||||
} |
||||
if (!audit.getStatus().equals(AuditStatusEnum.status1.getNumber())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "操作失败,审批状态不处于待审批"); |
||||
} |
||||
if (!userInfoModel.getAgent().getId().equals(audit.getReviewedUserId())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "操作失败,审批审核人校验不通过"); |
||||
} |
||||
|
||||
auditService.reject(audit.getId(), body.getString("rejectReason")); |
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error(e.getMessage(), e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/getAuditDetail",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询审核详情") |
||||
public ResponseData getAuditDetail(@RequestParam(value = "applyNo" , required = true) String applyNo) { |
||||
try { |
||||
|
||||
return ResponseMsgUtil.success(auditService.getAuditDetailByNo(applyNo)); |
||||
|
||||
} catch (Exception e) { |
||||
log.error(e.getMessage(), e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/getAuditList",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询审核列表") |
||||
public ResponseData getAuditList(@RequestParam(value = "auditNo" , required = false) String auditNo, |
||||
@RequestParam(value = "status" , required = false) Integer status, |
||||
@RequestParam(value = "pageNum" , required = true) Integer pageNum, |
||||
@RequestParam(value = "pageSize" , required = true) Integer pageSize) { |
||||
try { |
||||
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); |
||||
if (userInfoModel == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); |
||||
} |
||||
|
||||
Map<String,Object> param = new HashMap<>(); |
||||
param.put("auditNo", auditNo); |
||||
param.put("status", status); |
||||
if (userInfoModel.getSecUser().getObjectType().equals(SecUserTypeEnum.type2.getNumber())) { |
||||
param.put("reviewedUserId", userInfoModel.getAgent().getId()); |
||||
} else { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无权限访问"); |
||||
} |
||||
|
||||
PageHelper.startPage(pageNum, pageSize); |
||||
return ResponseMsgUtil.success(new PageInfo<>(auditService.getAuditList(param))); |
||||
|
||||
} catch (Exception e) { |
||||
log.error(e.getMessage(), e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,147 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.BsAudit; |
||||
import com.hfkj.entity.BsAuditExample; |
||||
import java.util.List; |
||||
import org.apache.ibatis.annotations.Delete; |
||||
import org.apache.ibatis.annotations.DeleteProvider; |
||||
import org.apache.ibatis.annotations.Insert; |
||||
import org.apache.ibatis.annotations.InsertProvider; |
||||
import org.apache.ibatis.annotations.Options; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.apache.ibatis.annotations.Result; |
||||
import org.apache.ibatis.annotations.Results; |
||||
import org.apache.ibatis.annotations.Select; |
||||
import org.apache.ibatis.annotations.SelectProvider; |
||||
import org.apache.ibatis.annotations.Update; |
||||
import org.apache.ibatis.annotations.UpdateProvider; |
||||
import org.apache.ibatis.type.JdbcType; |
||||
import org.springframework.stereotype.Repository; |
||||
|
||||
/** |
||||
* |
||||
* 代码由工具生成,请勿修改!!! |
||||
* 如果需要扩展请在其父类进行扩展 |
||||
* |
||||
**/ |
||||
@Repository |
||||
public interface BsAuditMapper extends BsAuditMapperExt { |
||||
@SelectProvider(type=BsAuditSqlProvider.class, method="countByExample") |
||||
long countByExample(BsAuditExample example); |
||||
|
||||
@DeleteProvider(type=BsAuditSqlProvider.class, method="deleteByExample") |
||||
int deleteByExample(BsAuditExample example); |
||||
|
||||
@Delete({ |
||||
"delete from bs_audit", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int deleteByPrimaryKey(Long id); |
||||
|
||||
@Insert({ |
||||
"insert into bs_audit (audit_no, vocational_work_type, ", |
||||
"vocational_work_type_name, audit_object_id, ", |
||||
"audit_object_name, op_user_id, ", |
||||
"op_user_name, reviewed_user_id, ", |
||||
"reviewed_user_name, `status`, ", |
||||
"reject_reason, create_time, ", |
||||
"update_time, ext_1, ", |
||||
"ext_2, ext_3)", |
||||
"values (#{auditNo,jdbcType=VARCHAR}, #{vocationalWorkType,jdbcType=INTEGER}, ", |
||||
"#{vocationalWorkTypeName,jdbcType=VARCHAR}, #{auditObjectId,jdbcType=BIGINT}, ", |
||||
"#{auditObjectName,jdbcType=VARCHAR}, #{opUserId,jdbcType=BIGINT}, ", |
||||
"#{opUserName,jdbcType=VARCHAR}, #{reviewedUserId,jdbcType=BIGINT}, ", |
||||
"#{reviewedUserName,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", |
||||
"#{rejectReason,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ", |
||||
"#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", |
||||
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" |
||||
}) |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insert(BsAudit record); |
||||
|
||||
@InsertProvider(type=BsAuditSqlProvider.class, method="insertSelective") |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insertSelective(BsAudit record); |
||||
|
||||
@SelectProvider(type=BsAuditSqlProvider.class, method="selectByExample") |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="audit_no", property="auditNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="vocational_work_type", property="vocationalWorkType", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="vocational_work_type_name", property="vocationalWorkTypeName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="audit_object_id", property="auditObjectId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="audit_object_name", property="auditObjectName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="op_user_id", property="opUserId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="op_user_name", property="opUserName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="reviewed_user_id", property="reviewedUserId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="reviewed_user_name", property="reviewedUserName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="reject_reason", property="rejectReason", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
List<BsAudit> selectByExample(BsAuditExample example); |
||||
|
||||
@Select({ |
||||
"select", |
||||
"id, audit_no, vocational_work_type, vocational_work_type_name, audit_object_id, ", |
||||
"audit_object_name, op_user_id, op_user_name, reviewed_user_id, reviewed_user_name, ", |
||||
"`status`, reject_reason, create_time, update_time, ext_1, ext_2, ext_3", |
||||
"from bs_audit", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="audit_no", property="auditNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="vocational_work_type", property="vocationalWorkType", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="vocational_work_type_name", property="vocationalWorkTypeName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="audit_object_id", property="auditObjectId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="audit_object_name", property="auditObjectName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="op_user_id", property="opUserId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="op_user_name", property="opUserName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="reviewed_user_id", property="reviewedUserId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="reviewed_user_name", property="reviewedUserName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="reject_reason", property="rejectReason", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
BsAudit selectByPrimaryKey(Long id); |
||||
|
||||
@UpdateProvider(type=BsAuditSqlProvider.class, method="updateByExampleSelective") |
||||
int updateByExampleSelective(@Param("record") BsAudit record, @Param("example") BsAuditExample example); |
||||
|
||||
@UpdateProvider(type=BsAuditSqlProvider.class, method="updateByExample") |
||||
int updateByExample(@Param("record") BsAudit record, @Param("example") BsAuditExample example); |
||||
|
||||
@UpdateProvider(type=BsAuditSqlProvider.class, method="updateByPrimaryKeySelective") |
||||
int updateByPrimaryKeySelective(BsAudit record); |
||||
|
||||
@Update({ |
||||
"update bs_audit", |
||||
"set audit_no = #{auditNo,jdbcType=VARCHAR},", |
||||
"vocational_work_type = #{vocationalWorkType,jdbcType=INTEGER},", |
||||
"vocational_work_type_name = #{vocationalWorkTypeName,jdbcType=VARCHAR},", |
||||
"audit_object_id = #{auditObjectId,jdbcType=BIGINT},", |
||||
"audit_object_name = #{auditObjectName,jdbcType=VARCHAR},", |
||||
"op_user_id = #{opUserId,jdbcType=BIGINT},", |
||||
"op_user_name = #{opUserName,jdbcType=VARCHAR},", |
||||
"reviewed_user_id = #{reviewedUserId,jdbcType=BIGINT},", |
||||
"reviewed_user_name = #{reviewedUserName,jdbcType=VARCHAR},", |
||||
"`status` = #{status,jdbcType=INTEGER},", |
||||
"reject_reason = #{rejectReason,jdbcType=VARCHAR},", |
||||
"create_time = #{createTime,jdbcType=TIMESTAMP},", |
||||
"update_time = #{updateTime,jdbcType=TIMESTAMP},", |
||||
"ext_1 = #{ext1,jdbcType=VARCHAR},", |
||||
"ext_2 = #{ext2,jdbcType=VARCHAR},", |
||||
"ext_3 = #{ext3,jdbcType=VARCHAR}", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int updateByPrimaryKey(BsAudit record); |
||||
} |
@ -0,0 +1,7 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
/** |
||||
* mapper扩展类 |
||||
*/ |
||||
public interface BsAuditMapperExt { |
||||
} |
@ -0,0 +1,402 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.BsAudit; |
||||
import com.hfkj.entity.BsAuditExample.Criteria; |
||||
import com.hfkj.entity.BsAuditExample.Criterion; |
||||
import com.hfkj.entity.BsAuditExample; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import org.apache.ibatis.jdbc.SQL; |
||||
|
||||
public class BsAuditSqlProvider { |
||||
|
||||
public String countByExample(BsAuditExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.SELECT("count(*)").FROM("bs_audit"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String deleteByExample(BsAuditExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.DELETE_FROM("bs_audit"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String insertSelective(BsAudit record) { |
||||
SQL sql = new SQL(); |
||||
sql.INSERT_INTO("bs_audit"); |
||||
|
||||
if (record.getAuditNo() != null) { |
||||
sql.VALUES("audit_no", "#{auditNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getVocationalWorkType() != null) { |
||||
sql.VALUES("vocational_work_type", "#{vocationalWorkType,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getVocationalWorkTypeName() != null) { |
||||
sql.VALUES("vocational_work_type_name", "#{vocationalWorkTypeName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getAuditObjectId() != null) { |
||||
sql.VALUES("audit_object_id", "#{auditObjectId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getAuditObjectName() != null) { |
||||
sql.VALUES("audit_object_name", "#{auditObjectName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getOpUserId() != null) { |
||||
sql.VALUES("op_user_id", "#{opUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getOpUserName() != null) { |
||||
sql.VALUES("op_user_name", "#{opUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getReviewedUserId() != null) { |
||||
sql.VALUES("reviewed_user_id", "#{reviewedUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getReviewedUserName() != null) { |
||||
sql.VALUES("reviewed_user_name", "#{reviewedUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getRejectReason() != null) { |
||||
sql.VALUES("reject_reason", "#{rejectReason,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String selectByExample(BsAuditExample example) { |
||||
SQL sql = new SQL(); |
||||
if (example != null && example.isDistinct()) { |
||||
sql.SELECT_DISTINCT("id"); |
||||
} else { |
||||
sql.SELECT("id"); |
||||
} |
||||
sql.SELECT("audit_no"); |
||||
sql.SELECT("vocational_work_type"); |
||||
sql.SELECT("vocational_work_type_name"); |
||||
sql.SELECT("audit_object_id"); |
||||
sql.SELECT("audit_object_name"); |
||||
sql.SELECT("op_user_id"); |
||||
sql.SELECT("op_user_name"); |
||||
sql.SELECT("reviewed_user_id"); |
||||
sql.SELECT("reviewed_user_name"); |
||||
sql.SELECT("`status`"); |
||||
sql.SELECT("reject_reason"); |
||||
sql.SELECT("create_time"); |
||||
sql.SELECT("update_time"); |
||||
sql.SELECT("ext_1"); |
||||
sql.SELECT("ext_2"); |
||||
sql.SELECT("ext_3"); |
||||
sql.FROM("bs_audit"); |
||||
applyWhere(sql, example, false); |
||||
|
||||
if (example != null && example.getOrderByClause() != null) { |
||||
sql.ORDER_BY(example.getOrderByClause()); |
||||
} |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByExampleSelective(Map<String, Object> parameter) { |
||||
BsAudit record = (BsAudit) parameter.get("record"); |
||||
BsAuditExample example = (BsAuditExample) parameter.get("example"); |
||||
|
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_audit"); |
||||
|
||||
if (record.getId() != null) { |
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getAuditNo() != null) { |
||||
sql.SET("audit_no = #{record.auditNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getVocationalWorkType() != null) { |
||||
sql.SET("vocational_work_type = #{record.vocationalWorkType,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getVocationalWorkTypeName() != null) { |
||||
sql.SET("vocational_work_type_name = #{record.vocationalWorkTypeName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getAuditObjectId() != null) { |
||||
sql.SET("audit_object_id = #{record.auditObjectId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getAuditObjectName() != null) { |
||||
sql.SET("audit_object_name = #{record.auditObjectName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getOpUserId() != null) { |
||||
sql.SET("op_user_id = #{record.opUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getOpUserName() != null) { |
||||
sql.SET("op_user_name = #{record.opUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getReviewedUserId() != null) { |
||||
sql.SET("reviewed_user_id = #{record.reviewedUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getReviewedUserName() != null) { |
||||
sql.SET("reviewed_user_name = #{record.reviewedUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getRejectReason() != null) { |
||||
sql.SET("reject_reason = #{record.rejectReason,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByExample(Map<String, Object> parameter) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_audit"); |
||||
|
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
sql.SET("audit_no = #{record.auditNo,jdbcType=VARCHAR}"); |
||||
sql.SET("vocational_work_type = #{record.vocationalWorkType,jdbcType=INTEGER}"); |
||||
sql.SET("vocational_work_type_name = #{record.vocationalWorkTypeName,jdbcType=VARCHAR}"); |
||||
sql.SET("audit_object_id = #{record.auditObjectId,jdbcType=BIGINT}"); |
||||
sql.SET("audit_object_name = #{record.auditObjectName,jdbcType=VARCHAR}"); |
||||
sql.SET("op_user_id = #{record.opUserId,jdbcType=BIGINT}"); |
||||
sql.SET("op_user_name = #{record.opUserName,jdbcType=VARCHAR}"); |
||||
sql.SET("reviewed_user_id = #{record.reviewedUserId,jdbcType=BIGINT}"); |
||||
sql.SET("reviewed_user_name = #{record.reviewedUserName,jdbcType=VARCHAR}"); |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
sql.SET("reject_reason = #{record.rejectReason,jdbcType=VARCHAR}"); |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
|
||||
BsAuditExample example = (BsAuditExample) parameter.get("example"); |
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByPrimaryKeySelective(BsAudit record) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_audit"); |
||||
|
||||
if (record.getAuditNo() != null) { |
||||
sql.SET("audit_no = #{auditNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getVocationalWorkType() != null) { |
||||
sql.SET("vocational_work_type = #{vocationalWorkType,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getVocationalWorkTypeName() != null) { |
||||
sql.SET("vocational_work_type_name = #{vocationalWorkTypeName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getAuditObjectId() != null) { |
||||
sql.SET("audit_object_id = #{auditObjectId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getAuditObjectName() != null) { |
||||
sql.SET("audit_object_name = #{auditObjectName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getOpUserId() != null) { |
||||
sql.SET("op_user_id = #{opUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getOpUserName() != null) { |
||||
sql.SET("op_user_name = #{opUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getReviewedUserId() != null) { |
||||
sql.SET("reviewed_user_id = #{reviewedUserId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getReviewedUserName() != null) { |
||||
sql.SET("reviewed_user_name = #{reviewedUserName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getRejectReason() != null) { |
||||
sql.SET("reject_reason = #{rejectReason,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
sql.WHERE("id = #{id,jdbcType=BIGINT}"); |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
protected void applyWhere(SQL sql, BsAuditExample example, boolean includeExamplePhrase) { |
||||
if (example == null) { |
||||
return; |
||||
} |
||||
|
||||
String parmPhrase1; |
||||
String parmPhrase1_th; |
||||
String parmPhrase2; |
||||
String parmPhrase2_th; |
||||
String parmPhrase3; |
||||
String parmPhrase3_th; |
||||
if (includeExamplePhrase) { |
||||
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; |
||||
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; |
||||
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||
} else { |
||||
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; |
||||
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; |
||||
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||
} |
||||
|
||||
StringBuilder sb = new StringBuilder(); |
||||
List<Criteria> oredCriteria = example.getOredCriteria(); |
||||
boolean firstCriteria = true; |
||||
for (int i = 0; i < oredCriteria.size(); i++) { |
||||
Criteria criteria = oredCriteria.get(i); |
||||
if (criteria.isValid()) { |
||||
if (firstCriteria) { |
||||
firstCriteria = false; |
||||
} else { |
||||
sb.append(" or "); |
||||
} |
||||
|
||||
sb.append('('); |
||||
List<Criterion> criterions = criteria.getAllCriteria(); |
||||
boolean firstCriterion = true; |
||||
for (int j = 0; j < criterions.size(); j++) { |
||||
Criterion criterion = criterions.get(j); |
||||
if (firstCriterion) { |
||||
firstCriterion = false; |
||||
} else { |
||||
sb.append(" and "); |
||||
} |
||||
|
||||
if (criterion.isNoValue()) { |
||||
sb.append(criterion.getCondition()); |
||||
} else if (criterion.isSingleValue()) { |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); |
||||
} |
||||
} else if (criterion.isBetweenValue()) { |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); |
||||
} |
||||
} else if (criterion.isListValue()) { |
||||
sb.append(criterion.getCondition()); |
||||
sb.append(" ("); |
||||
List<?> listItems = (List<?>) criterion.getValue(); |
||||
boolean comma = false; |
||||
for (int k = 0; k < listItems.size(); k++) { |
||||
if (comma) { |
||||
sb.append(", "); |
||||
} else { |
||||
comma = true; |
||||
} |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase3, i, j, k)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); |
||||
} |
||||
} |
||||
sb.append(')'); |
||||
} |
||||
} |
||||
sb.append(')'); |
||||
} |
||||
} |
||||
|
||||
if (sb.length() > 0) { |
||||
sql.WHERE(sb.toString()); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,312 @@ |
||||
package com.hfkj.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* bs_audit |
||||
* @author |
||||
*/ |
||||
/** |
||||
* |
||||
* 代码由工具生成 |
||||
* |
||||
**/ |
||||
public class BsAudit implements Serializable { |
||||
/** |
||||
* 主键 |
||||
*/ |
||||
private Long id; |
||||
|
||||
/** |
||||
* 审批编号 |
||||
*/ |
||||
private String auditNo; |
||||
|
||||
/** |
||||
* 业务类型 |
||||
*/ |
||||
private Integer vocationalWorkType; |
||||
|
||||
/** |
||||
* 业务类型名称 |
||||
*/ |
||||
private String vocationalWorkTypeName; |
||||
|
||||
/** |
||||
* 审核对象id |
||||
*/ |
||||
private Long auditObjectId; |
||||
|
||||
/** |
||||
* 审核对象名称 |
||||
*/ |
||||
private String auditObjectName; |
||||
|
||||
/** |
||||
* 提交人 |
||||
*/ |
||||
private Long opUserId; |
||||
|
||||
/** |
||||
* 提交人名称 |
||||
*/ |
||||
private String opUserName; |
||||
|
||||
/** |
||||
* 审核人id |
||||
*/ |
||||
private Long reviewedUserId; |
||||
|
||||
/** |
||||
* 审核人名称 |
||||
*/ |
||||
private String reviewedUserName; |
||||
|
||||
/** |
||||
* 状态 1:待审核 2:审核通过 3:审核驳回 |
||||
*/ |
||||
private Integer status; |
||||
|
||||
/** |
||||
* 驳回原因 |
||||
*/ |
||||
private String rejectReason; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 更新时间 |
||||
*/ |
||||
private Date updateTime; |
||||
|
||||
private String ext1; |
||||
|
||||
private String ext2; |
||||
|
||||
private String ext3; |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
public Long getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(Long id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public String getAuditNo() { |
||||
return auditNo; |
||||
} |
||||
|
||||
public void setAuditNo(String auditNo) { |
||||
this.auditNo = auditNo; |
||||
} |
||||
|
||||
public Integer getVocationalWorkType() { |
||||
return vocationalWorkType; |
||||
} |
||||
|
||||
public void setVocationalWorkType(Integer vocationalWorkType) { |
||||
this.vocationalWorkType = vocationalWorkType; |
||||
} |
||||
|
||||
public String getVocationalWorkTypeName() { |
||||
return vocationalWorkTypeName; |
||||
} |
||||
|
||||
public void setVocationalWorkTypeName(String vocationalWorkTypeName) { |
||||
this.vocationalWorkTypeName = vocationalWorkTypeName; |
||||
} |
||||
|
||||
public Long getAuditObjectId() { |
||||
return auditObjectId; |
||||
} |
||||
|
||||
public void setAuditObjectId(Long auditObjectId) { |
||||
this.auditObjectId = auditObjectId; |
||||
} |
||||
|
||||
public String getAuditObjectName() { |
||||
return auditObjectName; |
||||
} |
||||
|
||||
public void setAuditObjectName(String auditObjectName) { |
||||
this.auditObjectName = auditObjectName; |
||||
} |
||||
|
||||
public Long getOpUserId() { |
||||
return opUserId; |
||||
} |
||||
|
||||
public void setOpUserId(Long opUserId) { |
||||
this.opUserId = opUserId; |
||||
} |
||||
|
||||
public String getOpUserName() { |
||||
return opUserName; |
||||
} |
||||
|
||||
public void setOpUserName(String opUserName) { |
||||
this.opUserName = opUserName; |
||||
} |
||||
|
||||
public Long getReviewedUserId() { |
||||
return reviewedUserId; |
||||
} |
||||
|
||||
public void setReviewedUserId(Long reviewedUserId) { |
||||
this.reviewedUserId = reviewedUserId; |
||||
} |
||||
|
||||
public String getReviewedUserName() { |
||||
return reviewedUserName; |
||||
} |
||||
|
||||
public void setReviewedUserName(String reviewedUserName) { |
||||
this.reviewedUserName = reviewedUserName; |
||||
} |
||||
|
||||
public Integer getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(Integer status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public String getRejectReason() { |
||||
return rejectReason; |
||||
} |
||||
|
||||
public void setRejectReason(String rejectReason) { |
||||
this.rejectReason = rejectReason; |
||||
} |
||||
|
||||
public Date getCreateTime() { |
||||
return createTime; |
||||
} |
||||
|
||||
public void setCreateTime(Date createTime) { |
||||
this.createTime = createTime; |
||||
} |
||||
|
||||
public Date getUpdateTime() { |
||||
return updateTime; |
||||
} |
||||
|
||||
public void setUpdateTime(Date updateTime) { |
||||
this.updateTime = updateTime; |
||||
} |
||||
|
||||
public String getExt1() { |
||||
return ext1; |
||||
} |
||||
|
||||
public void setExt1(String ext1) { |
||||
this.ext1 = ext1; |
||||
} |
||||
|
||||
public String getExt2() { |
||||
return ext2; |
||||
} |
||||
|
||||
public void setExt2(String ext2) { |
||||
this.ext2 = ext2; |
||||
} |
||||
|
||||
public String getExt3() { |
||||
return ext3; |
||||
} |
||||
|
||||
public void setExt3(String ext3) { |
||||
this.ext3 = ext3; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object that) { |
||||
if (this == that) { |
||||
return true; |
||||
} |
||||
if (that == null) { |
||||
return false; |
||||
} |
||||
if (getClass() != that.getClass()) { |
||||
return false; |
||||
} |
||||
BsAudit other = (BsAudit) that; |
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) |
||||
&& (this.getAuditNo() == null ? other.getAuditNo() == null : this.getAuditNo().equals(other.getAuditNo())) |
||||
&& (this.getVocationalWorkType() == null ? other.getVocationalWorkType() == null : this.getVocationalWorkType().equals(other.getVocationalWorkType())) |
||||
&& (this.getVocationalWorkTypeName() == null ? other.getVocationalWorkTypeName() == null : this.getVocationalWorkTypeName().equals(other.getVocationalWorkTypeName())) |
||||
&& (this.getAuditObjectId() == null ? other.getAuditObjectId() == null : this.getAuditObjectId().equals(other.getAuditObjectId())) |
||||
&& (this.getAuditObjectName() == null ? other.getAuditObjectName() == null : this.getAuditObjectName().equals(other.getAuditObjectName())) |
||||
&& (this.getOpUserId() == null ? other.getOpUserId() == null : this.getOpUserId().equals(other.getOpUserId())) |
||||
&& (this.getOpUserName() == null ? other.getOpUserName() == null : this.getOpUserName().equals(other.getOpUserName())) |
||||
&& (this.getReviewedUserId() == null ? other.getReviewedUserId() == null : this.getReviewedUserId().equals(other.getReviewedUserId())) |
||||
&& (this.getReviewedUserName() == null ? other.getReviewedUserName() == null : this.getReviewedUserName().equals(other.getReviewedUserName())) |
||||
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) |
||||
&& (this.getRejectReason() == null ? other.getRejectReason() == null : this.getRejectReason().equals(other.getRejectReason())) |
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) |
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) |
||||
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) |
||||
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) |
||||
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); |
||||
result = prime * result + ((getAuditNo() == null) ? 0 : getAuditNo().hashCode()); |
||||
result = prime * result + ((getVocationalWorkType() == null) ? 0 : getVocationalWorkType().hashCode()); |
||||
result = prime * result + ((getVocationalWorkTypeName() == null) ? 0 : getVocationalWorkTypeName().hashCode()); |
||||
result = prime * result + ((getAuditObjectId() == null) ? 0 : getAuditObjectId().hashCode()); |
||||
result = prime * result + ((getAuditObjectName() == null) ? 0 : getAuditObjectName().hashCode()); |
||||
result = prime * result + ((getOpUserId() == null) ? 0 : getOpUserId().hashCode()); |
||||
result = prime * result + ((getOpUserName() == null) ? 0 : getOpUserName().hashCode()); |
||||
result = prime * result + ((getReviewedUserId() == null) ? 0 : getReviewedUserId().hashCode()); |
||||
result = prime * result + ((getReviewedUserName() == null) ? 0 : getReviewedUserName().hashCode()); |
||||
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); |
||||
result = prime * result + ((getRejectReason() == null) ? 0 : getRejectReason().hashCode()); |
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); |
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); |
||||
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); |
||||
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); |
||||
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
StringBuilder sb = new StringBuilder(); |
||||
sb.append(getClass().getSimpleName()); |
||||
sb.append(" ["); |
||||
sb.append("Hash = ").append(hashCode()); |
||||
sb.append(", id=").append(id); |
||||
sb.append(", auditNo=").append(auditNo); |
||||
sb.append(", vocationalWorkType=").append(vocationalWorkType); |
||||
sb.append(", vocationalWorkTypeName=").append(vocationalWorkTypeName); |
||||
sb.append(", auditObjectId=").append(auditObjectId); |
||||
sb.append(", auditObjectName=").append(auditObjectName); |
||||
sb.append(", opUserId=").append(opUserId); |
||||
sb.append(", opUserName=").append(opUserName); |
||||
sb.append(", reviewedUserId=").append(reviewedUserId); |
||||
sb.append(", reviewedUserName=").append(reviewedUserName); |
||||
sb.append(", status=").append(status); |
||||
sb.append(", rejectReason=").append(rejectReason); |
||||
sb.append(", createTime=").append(createTime); |
||||
sb.append(", updateTime=").append(updateTime); |
||||
sb.append(", ext1=").append(ext1); |
||||
sb.append(", ext2=").append(ext2); |
||||
sb.append(", ext3=").append(ext3); |
||||
sb.append(", serialVersionUID=").append(serialVersionUID); |
||||
sb.append("]"); |
||||
return sb.toString(); |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,19 @@ |
||||
package com.hfkj.model; |
||||
|
||||
import com.hfkj.entity.BsAudit; |
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @className: BsAuditModel |
||||
* @author: HuRui |
||||
* @date: 2023/5/9 |
||||
**/ |
||||
@Data |
||||
public class BsAuditModel extends BsAudit { |
||||
|
||||
/** |
||||
* 审核对象数据 |
||||
*/ |
||||
private Object auditObject; |
||||
|
||||
} |
@ -0,0 +1,74 @@ |
||||
package com.hfkj.service; |
||||
|
||||
import com.hfkj.entity.BsAudit; |
||||
import com.hfkj.model.BsAuditModel; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @className: BsAuditService |
||||
* @author: HuRui |
||||
* @date: 2023/5/9 |
||||
**/ |
||||
public interface BsAuditService { |
||||
|
||||
/** |
||||
* 编辑数据 |
||||
* @param audit |
||||
*/ |
||||
void editData(BsAudit audit); |
||||
|
||||
/** |
||||
* 创建审核 |
||||
* @param audit |
||||
*/ |
||||
BsAudit createAudit(BsAudit audit); |
||||
|
||||
/** |
||||
* 审核通过 |
||||
* @param auditId 审批id |
||||
*/ |
||||
void approve(Long auditId); |
||||
|
||||
/** |
||||
* 审批通过回调 |
||||
* @param audit |
||||
*/ |
||||
void approveCallback(BsAudit audit); |
||||
|
||||
/** |
||||
* 审核拒绝 |
||||
* @param auditId 审批id |
||||
* @param rejectReason 拒绝原因 |
||||
*/ |
||||
void reject(Long auditId, String rejectReason); |
||||
|
||||
/** |
||||
* 审批驳回回调 |
||||
* @param audit |
||||
*/ |
||||
void rejectCallback(BsAudit audit); |
||||
|
||||
/** |
||||
* 审核编号 |
||||
* @param auditId 审批id |
||||
* @return |
||||
*/ |
||||
BsAudit getAuditDetailById(Long auditId); |
||||
|
||||
/** |
||||
* 审核编号 |
||||
* @param auditNo 审批编号 |
||||
* @return |
||||
*/ |
||||
BsAuditModel getAuditDetailByNo(String auditNo); |
||||
|
||||
/** |
||||
* 查询审核列表 |
||||
* @param param |
||||
* @return |
||||
*/ |
||||
List<BsAudit> getAuditList(Map<String,Object> param); |
||||
} |
||||
|
@ -0,0 +1,162 @@ |
||||
package com.hfkj.service.impl; |
||||
|
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.dao.BsAuditMapper; |
||||
import com.hfkj.entity.BsAudit; |
||||
import com.hfkj.entity.BsAuditExample; |
||||
import com.hfkj.entity.BsMerSettleAcctApply; |
||||
import com.hfkj.model.BsAuditModel; |
||||
import com.hfkj.service.BsAuditService; |
||||
import com.hfkj.service.BsMerSettleAcctApplyService; |
||||
import com.hfkj.sysenum.AuditStatusEnum; |
||||
import com.hfkj.sysenum.AuditVocationalWorkType; |
||||
import com.hfkj.sysenum.MerSettleAcctApplyStatus; |
||||
import org.apache.commons.collections4.MapUtils; |
||||
import org.springframework.beans.BeanUtils; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Propagation; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @className: BsAuditServiceImpl |
||||
* @author: HuRui |
||||
* @date: 2023/5/9 |
||||
**/ |
||||
@Service("auditService") |
||||
public class BsAuditServiceImpl implements BsAuditService { |
||||
|
||||
@Resource |
||||
private BsAuditMapper auditMapper; |
||||
|
||||
@Resource |
||||
private BsMerSettleAcctApplyService merSettleAcctApplyService; |
||||
|
||||
@Override |
||||
public void editData(BsAudit audit) { |
||||
if (audit.getId() == null) { |
||||
audit.setCreateTime(new Date()); |
||||
audit.setUpdateTime(new Date()); |
||||
auditMapper.insert(audit); |
||||
} else { |
||||
audit.setUpdateTime(new Date()); |
||||
auditMapper.updateByPrimaryKey(audit); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public BsAudit createAudit(BsAudit audit) { |
||||
editData(audit); |
||||
return audit; |
||||
} |
||||
|
||||
@Override |
||||
public void approve(Long auditId) { |
||||
// 查询审核详情
|
||||
BsAudit audit = getAuditDetailById(auditId); |
||||
if (audit == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的审批"); |
||||
} |
||||
if (!audit.getStatus().equals(AuditStatusEnum.status1.getNumber())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "审批状态处于待审核"); |
||||
} |
||||
audit.setStatus(AuditStatusEnum.status2.getNumber()); |
||||
editData(audit); |
||||
|
||||
approveCallback(audit); |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(propagation= Propagation.REQUIRES_NEW) |
||||
public void approveCallback(BsAudit audit) { |
||||
if (audit.getVocationalWorkType().equals(AuditVocationalWorkType.type1.getNumber())) { |
||||
BsMerSettleAcctApply acctApply = merSettleAcctApplyService.getApplyById(audit.getAuditObjectId()); |
||||
if (acctApply != null) { |
||||
merSettleAcctApplyService.applyUpdateSettleAcct(acctApply); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void reject(Long auditId, String rejectReason) { |
||||
// 查询审核详情
|
||||
BsAudit audit = getAuditDetailById(auditId); |
||||
if (audit == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的审批"); |
||||
} |
||||
if (!audit.getStatus().equals(AuditStatusEnum.status1.getNumber())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "审批状态处于待审核"); |
||||
} |
||||
audit.setStatus(AuditStatusEnum.status3.getNumber()); |
||||
audit.setRejectReason(rejectReason); |
||||
editData(audit); |
||||
|
||||
rejectCallback(audit); |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(propagation= Propagation.REQUIRES_NEW) |
||||
public void rejectCallback(BsAudit audit) { |
||||
if (audit.getVocationalWorkType().equals(AuditVocationalWorkType.type1.getNumber())) { |
||||
BsMerSettleAcctApply acctApply = merSettleAcctApplyService.getApplyById(audit.getAuditObjectId()); |
||||
if (acctApply != null) { |
||||
acctApply.setRejectReason(audit.getRejectReason()); |
||||
acctApply.setStatus(MerSettleAcctApplyStatus.status4.getNumber()); |
||||
merSettleAcctApplyService.editData(acctApply); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public BsAudit getAuditDetailById(Long auditId) { |
||||
return auditMapper.selectByPrimaryKey(auditId); |
||||
} |
||||
|
||||
@Override |
||||
public BsAuditModel getAuditDetailByNo(String auditNo) { |
||||
BsAuditExample example = new BsAuditExample(); |
||||
example.createCriteria().andAuditNoEqualTo(auditNo).andStatusNotEqualTo(AuditStatusEnum.status0.getNumber()); |
||||
List<BsAudit> list = auditMapper.selectByExample(example); |
||||
if (list.size() == 0) { |
||||
return null; |
||||
} |
||||
BsAuditModel auditModel = new BsAuditModel(); |
||||
BeanUtils.copyProperties(list.get(0), auditModel); |
||||
|
||||
if (auditModel.getVocationalWorkType().equals(AuditVocationalWorkType.type1.getNumber())) { |
||||
auditModel.setAuditObject(merSettleAcctApplyService.getApplyById(auditModel.getAuditObjectId())); |
||||
} |
||||
return auditModel; |
||||
} |
||||
|
||||
@Override |
||||
public List<BsAudit> getAuditList(Map<String, Object> param) { |
||||
BsAuditExample example = new BsAuditExample(); |
||||
BsAuditExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(AuditStatusEnum.status0.getNumber()); |
||||
|
||||
if (MapUtils.getInteger(param, "auditNo") != null) { |
||||
criteria.andAuditNoLike("%" + MapUtils.getInteger(param, "auditNo") + "%"); |
||||
} |
||||
|
||||
if (MapUtils.getInteger(param, "status") != null) { |
||||
criteria.andStatusEqualTo(MapUtils.getInteger(param, "status")); |
||||
} |
||||
|
||||
if (MapUtils.getInteger(param, "opUserId") != null) { |
||||
criteria.andOpUserIdEqualTo(MapUtils.getLong(param, "opUserId")); |
||||
} |
||||
|
||||
if (MapUtils.getLong(param, "reviewedUserId") != null) { |
||||
criteria.andReviewedUserIdEqualTo(MapUtils.getLong(param, "reviewedUserId")); |
||||
} |
||||
|
||||
example.setOrderByClause("create_time desc"); |
||||
return auditMapper.selectByExample(example); |
||||
} |
||||
} |
@ -0,0 +1,40 @@ |
||||
package com.hfkj.sysenum; |
||||
|
||||
/** |
||||
* @className: BsAuditStatus |
||||
* @author: HuRui |
||||
* @date: 2023/5/9 |
||||
**/ |
||||
public enum AuditStatusEnum { |
||||
|
||||
status0(0, "不可用"), |
||||
status1(1, "待审核"), |
||||
status2(2, "通过"), |
||||
status3(3, "驳回"), |
||||
; |
||||
|
||||
private Integer number; |
||||
|
||||
private String name; |
||||
|
||||
AuditStatusEnum(int number, String name) { |
||||
this.number = number; |
||||
this.name = name; |
||||
} |
||||
|
||||
public Integer getNumber() { |
||||
return number; |
||||
} |
||||
|
||||
public void setNumber(Integer number) { |
||||
this.number = number; |
||||
} |
||||
|
||||
public String getName() { |
||||
return name; |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
} |
@ -0,0 +1,38 @@ |
||||
package com.hfkj.sysenum; |
||||
|
||||
/** |
||||
* @className: AuditVocationalWorkType |
||||
* @author: HuRui |
||||
* @date: 2023/5/9 |
||||
**/ |
||||
public enum AuditVocationalWorkType { |
||||
|
||||
type1(1, "修改商户结算"), |
||||
; |
||||
|
||||
private Integer number; |
||||
|
||||
private String name; |
||||
|
||||
AuditVocationalWorkType(int number, String name) { |
||||
this.number = number; |
||||
this.name = name; |
||||
} |
||||
|
||||
public Integer getNumber() { |
||||
return number; |
||||
} |
||||
|
||||
public void setNumber(Integer number) { |
||||
this.number = number; |
||||
} |
||||
|
||||
public String getName() { |
||||
return name; |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue