'提交代码'

dev-discount
199901012 4 years ago
parent 419ab18402
commit 5620edca7d
  1. 67
      hai-bweb/src/main/java/com/bweb/controller/HighApproveController.java
  2. 1
      hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java
  3. 31
      hai-service/src/main/java/com/hai/dao/HighApproveMapper.java
  4. 14
      hai-service/src/main/java/com/hai/dao/HighApproveSqlProvider.java
  5. 18
      hai-service/src/main/java/com/hai/entity/HighApprove.java
  6. 70
      hai-service/src/main/java/com/hai/entity/HighApproveExample.java
  7. 8
      hai-service/src/main/java/com/hai/service/HighApproveService.java
  8. 28
      hai-service/src/main/java/com/hai/service/impl/HighApproveServiceImpl.java

@ -1,6 +1,8 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
@ -9,12 +11,15 @@ import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighApprove;
import com.hai.entity.HighCoupon;
import com.hai.entity.HighCouponHandsel;
import com.hai.entity.HighMerchant;
import com.hai.enum_type.ApproveType;
import com.hai.model.HighCouponModel;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighApproveService;
import com.hai.service.HighCouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@ -22,14 +27,13 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* @ClassName HighApproveController
@ -50,6 +54,9 @@ public class HighApproveController {
@Resource
private HighApproveService highApproveService;
@Resource
private HighCouponService highCouponService;
@RequestMapping(value="/approveProcessed",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "审批")
@ -91,4 +98,56 @@ public class HighApproveController {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getApproveDetail",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询审批详情")
public ResponseData getApproveDetail(@RequestParam(name = "approveId", required = true) Long approveId) {
try {
// 查询审批记录
HighApprove approve = highApproveService.getApproveById(approveId);
if (approve == null) {
log.error("HighCouponController -> getApproveDetail() error!","未找到审批记录");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_APPROVE, "");
}
Map<String, Object> map = new HashMap<>();
map.put("approve", approve);
if (approve.getObjectType() == ApproveType.UP_SHELF_APPROVE.getType()) {
map.put("object", highCouponService.getCouponById(approve.getObjectId()));
}
return ResponseMsgUtil.success(map);
} catch (Exception e) {
log.error("HighCouponController -> getApproveDetail() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getApproveList",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询审批列表")
public ResponseData getApproveList(@RequestParam(name = "approveSerialNo", required = false) String approveSerialNo,
@RequestParam(name = "objectType", required = false) Integer objectType,
@RequestParam(name = "objectId", required = false) Long objectId,
@RequestParam(name = "objectName", required = false) String objectName,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) {
try {
Map<String, Object> map = new HashMap<>();
map.put("approveSerialNo", approveSerialNo);
map.put("objectType", approveSerialNo);
map.put("objectId", approveSerialNo);
map.put("objectName", approveSerialNo);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highApproveService.getApproveList(map)));
} catch (Exception e) {
log.error("HighCouponController -> getApproveDetail() error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -209,6 +209,7 @@ public class HighCouponController {
HighApprove approve = new HighApprove();
approve.setObjectType(ApproveType.UP_SHELF_APPROVE.getType());
approve.setObjectId(id);
approve.setObjectName(coupon.getCouponName());
approve.setApproveSerialNo(DateUtil.date2String(new Date(), "MMddhhmmss") + ((Math.random()*9+1)*10000));
approve.setStatus(1);
approve.setCreateTime(new Date());

@ -40,19 +40,19 @@ public interface HighApproveMapper extends HighApproveMapperExt {
@Insert({
"insert into high_approve (object_type, object_id, ",
"approve_serial_no, remarks, ",
"`status`, create_time, ",
"update_time, submit_operator_id, ",
"submit_operator_name, approve_operator_id, ",
"approve_operator_name, ext_1, ",
"ext_2, ext_3)",
"object_name, approve_serial_no, ",
"remarks, `status`, ",
"create_time, update_time, ",
"submit_operator_id, submit_operator_name, ",
"approve_operator_id, approve_operator_name, ",
"ext_1, ext_2, ext_3)",
"values (#{objectType,jdbcType=INTEGER}, #{objectId,jdbcType=BIGINT}, ",
"#{approveSerialNo,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{submitOperatorId,jdbcType=BIGINT}, ",
"#{submitOperatorName,jdbcType=VARCHAR}, #{approveOperatorId,jdbcType=BIGINT}, ",
"#{approveOperatorName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
"#{objectName,jdbcType=VARCHAR}, #{approveSerialNo,jdbcType=VARCHAR}, ",
"#{remarks,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{submitOperatorId,jdbcType=BIGINT}, #{submitOperatorName,jdbcType=VARCHAR}, ",
"#{approveOperatorId,jdbcType=BIGINT}, #{approveOperatorName,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighApprove record);
@ -66,6 +66,7 @@ public interface HighApproveMapper extends HighApproveMapperExt {
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="object_type", property="objectType", jdbcType=JdbcType.INTEGER),
@Result(column="object_id", property="objectId", jdbcType=JdbcType.BIGINT),
@Result(column="object_name", property="objectName", jdbcType=JdbcType.VARCHAR),
@Result(column="approve_serial_no", property="approveSerialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@ -83,8 +84,8 @@ public interface HighApproveMapper extends HighApproveMapperExt {
@Select({
"select",
"id, object_type, object_id, approve_serial_no, remarks, `status`, create_time, ",
"update_time, submit_operator_id, submit_operator_name, approve_operator_id, ",
"id, object_type, object_id, object_name, approve_serial_no, remarks, `status`, ",
"create_time, update_time, submit_operator_id, submit_operator_name, approve_operator_id, ",
"approve_operator_name, ext_1, ext_2, ext_3",
"from high_approve",
"where id = #{id,jdbcType=BIGINT}"
@ -93,6 +94,7 @@ public interface HighApproveMapper extends HighApproveMapperExt {
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="object_type", property="objectType", jdbcType=JdbcType.INTEGER),
@Result(column="object_id", property="objectId", jdbcType=JdbcType.BIGINT),
@Result(column="object_name", property="objectName", jdbcType=JdbcType.VARCHAR),
@Result(column="approve_serial_no", property="approveSerialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@ -121,6 +123,7 @@ public interface HighApproveMapper extends HighApproveMapperExt {
"update high_approve",
"set object_type = #{objectType,jdbcType=INTEGER},",
"object_id = #{objectId,jdbcType=BIGINT},",
"object_name = #{objectName,jdbcType=VARCHAR},",
"approve_serial_no = #{approveSerialNo,jdbcType=VARCHAR},",
"remarks = #{remarks,jdbcType=VARCHAR},",
"`status` = #{status,jdbcType=INTEGER},",

@ -36,6 +36,10 @@ public class HighApproveSqlProvider {
sql.VALUES("object_id", "#{objectId,jdbcType=BIGINT}");
}
if (record.getObjectName() != null) {
sql.VALUES("object_name", "#{objectName,jdbcType=VARCHAR}");
}
if (record.getApproveSerialNo() != null) {
sql.VALUES("approve_serial_no", "#{approveSerialNo,jdbcType=VARCHAR}");
}
@ -96,6 +100,7 @@ public class HighApproveSqlProvider {
}
sql.SELECT("object_type");
sql.SELECT("object_id");
sql.SELECT("object_name");
sql.SELECT("approve_serial_no");
sql.SELECT("remarks");
sql.SELECT("`status`");
@ -137,6 +142,10 @@ public class HighApproveSqlProvider {
sql.SET("object_id = #{record.objectId,jdbcType=BIGINT}");
}
if (record.getObjectName() != null) {
sql.SET("object_name = #{record.objectName,jdbcType=VARCHAR}");
}
if (record.getApproveSerialNo() != null) {
sql.SET("approve_serial_no = #{record.approveSerialNo,jdbcType=VARCHAR}");
}
@ -196,6 +205,7 @@ public class HighApproveSqlProvider {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("object_type = #{record.objectType,jdbcType=INTEGER}");
sql.SET("object_id = #{record.objectId,jdbcType=BIGINT}");
sql.SET("object_name = #{record.objectName,jdbcType=VARCHAR}");
sql.SET("approve_serial_no = #{record.approveSerialNo,jdbcType=VARCHAR}");
sql.SET("remarks = #{record.remarks,jdbcType=VARCHAR}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
@ -226,6 +236,10 @@ public class HighApproveSqlProvider {
sql.SET("object_id = #{objectId,jdbcType=BIGINT}");
}
if (record.getObjectName() != null) {
sql.SET("object_name = #{objectName,jdbcType=VARCHAR}");
}
if (record.getApproveSerialNo() != null) {
sql.SET("approve_serial_no = #{approveSerialNo,jdbcType=VARCHAR}");
}

@ -19,7 +19,7 @@ public class HighApprove implements Serializable {
private Long id;
/**
* 审批对象 1:卡券上架审批
* 审批对象 1:卡券上架审批 2:卡卷价格审批
*/
private Integer objectType;
@ -28,6 +28,11 @@ public class HighApprove implements Serializable {
*/
private Long objectId;
/**
* 审批对象名称
*/
private String objectName;
/**
* 审批流水号
*/
@ -105,6 +110,14 @@ public class HighApprove implements Serializable {
this.objectId = objectId;
}
public String getObjectName() {
return objectName;
}
public void setObjectName(String objectName) {
this.objectName = objectName;
}
public String getApproveSerialNo() {
return approveSerialNo;
}
@ -216,6 +229,7 @@ public class HighApprove implements Serializable {
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getObjectType() == null ? other.getObjectType() == null : this.getObjectType().equals(other.getObjectType()))
&& (this.getObjectId() == null ? other.getObjectId() == null : this.getObjectId().equals(other.getObjectId()))
&& (this.getObjectName() == null ? other.getObjectName() == null : this.getObjectName().equals(other.getObjectName()))
&& (this.getApproveSerialNo() == null ? other.getApproveSerialNo() == null : this.getApproveSerialNo().equals(other.getApproveSerialNo()))
&& (this.getRemarks() == null ? other.getRemarks() == null : this.getRemarks().equals(other.getRemarks()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
@ -237,6 +251,7 @@ public class HighApprove implements Serializable {
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getObjectType() == null) ? 0 : getObjectType().hashCode());
result = prime * result + ((getObjectId() == null) ? 0 : getObjectId().hashCode());
result = prime * result + ((getObjectName() == null) ? 0 : getObjectName().hashCode());
result = prime * result + ((getApproveSerialNo() == null) ? 0 : getApproveSerialNo().hashCode());
result = prime * result + ((getRemarks() == null) ? 0 : getRemarks().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
@ -261,6 +276,7 @@ public class HighApprove implements Serializable {
sb.append(", id=").append(id);
sb.append(", objectType=").append(objectType);
sb.append(", objectId=").append(objectId);
sb.append(", objectName=").append(objectName);
sb.append(", approveSerialNo=").append(approveSerialNo);
sb.append(", remarks=").append(remarks);
sb.append(", status=").append(status);

@ -305,6 +305,76 @@ public class HighApproveExample {
return (Criteria) this;
}
public Criteria andObjectNameIsNull() {
addCriterion("object_name is null");
return (Criteria) this;
}
public Criteria andObjectNameIsNotNull() {
addCriterion("object_name is not null");
return (Criteria) this;
}
public Criteria andObjectNameEqualTo(String value) {
addCriterion("object_name =", value, "objectName");
return (Criteria) this;
}
public Criteria andObjectNameNotEqualTo(String value) {
addCriterion("object_name <>", value, "objectName");
return (Criteria) this;
}
public Criteria andObjectNameGreaterThan(String value) {
addCriterion("object_name >", value, "objectName");
return (Criteria) this;
}
public Criteria andObjectNameGreaterThanOrEqualTo(String value) {
addCriterion("object_name >=", value, "objectName");
return (Criteria) this;
}
public Criteria andObjectNameLessThan(String value) {
addCriterion("object_name <", value, "objectName");
return (Criteria) this;
}
public Criteria andObjectNameLessThanOrEqualTo(String value) {
addCriterion("object_name <=", value, "objectName");
return (Criteria) this;
}
public Criteria andObjectNameLike(String value) {
addCriterion("object_name like", value, "objectName");
return (Criteria) this;
}
public Criteria andObjectNameNotLike(String value) {
addCriterion("object_name not like", value, "objectName");
return (Criteria) this;
}
public Criteria andObjectNameIn(List<String> values) {
addCriterion("object_name in", values, "objectName");
return (Criteria) this;
}
public Criteria andObjectNameNotIn(List<String> values) {
addCriterion("object_name not in", values, "objectName");
return (Criteria) this;
}
public Criteria andObjectNameBetween(String value1, String value2) {
addCriterion("object_name between", value1, value2, "objectName");
return (Criteria) this;
}
public Criteria andObjectNameNotBetween(String value1, String value2) {
addCriterion("object_name not between", value1, value2, "objectName");
return (Criteria) this;
}
public Criteria andApproveSerialNoIsNull() {
addCriterion("approve_serial_no is null");
return (Criteria) this;

@ -3,6 +3,7 @@ package com.hai.service;
import com.hai.entity.HighApprove;
import java.util.List;
import java.util.Map;
/**
* @Auther: 胡锐
@ -40,4 +41,11 @@ public interface HighApproveService {
**/
void approveProcessed(HighApprove highApprove);
/**
* @Author 胡锐
* @Description 审批列表
* @Date 2021/3/16 19:39
**/
List<HighApprove> getApproveList(Map<String, Object> map);
}

@ -5,17 +5,21 @@ import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.dao.HighApproveMapper;
import com.hai.entity.HighApprove;
import com.hai.entity.HighApproveExample;
import com.hai.entity.HighCoupon;
import com.hai.enum_type.ApproveType;
import com.hai.model.HighCouponModel;
import com.hai.service.HighApproveService;
import com.hai.service.HighCouponService;
import org.apache.commons.collections4.MapUtils;
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;
import java.util.Objects;
/**
@ -54,4 +58,28 @@ public class HighApproveServiceImpl implements HighApproveService {
highCouponService.upShelfApproveResult(highApprove);
}
}
@Override
public List<HighApprove> getApproveList(Map<String, Object> map) {
HighApproveExample example = new HighApproveExample();
HighApproveExample.Criteria criteria = example.createCriteria();
if (MapUtils.getString(map, "approveSerialNo") != null) {
criteria.andApproveSerialNoEqualTo(MapUtils.getString(map, "approveSerialNo"));
}
if (MapUtils.getInteger(map, "objectType") != null) {
criteria.andObjectTypeEqualTo(MapUtils.getInteger(map, "objectType"));
}
if (MapUtils.getInteger(map, "objectId") != null) {
criteria.andObjectTypeEqualTo(MapUtils.getInteger(map, "objectId"));
}
if (MapUtils.getString(map, "objectName") != null) {
criteria.andObjectNameLike("%" + MapUtils.getString(map, "objectName") + "%");
}
return highApproveMapper.selectByExample(example);
}
}

Loading…
Cancel
Save