提交代码

dev-discount
胡锐 2 years ago
parent c82ca24c2d
commit d46f4e848c
  1. 166
      hai-bweb/src/main/java/com/bweb/controller/HighGasClassGroupController.java
  2. 135
      hai-bweb/src/main/java/com/bweb/controller/HighGasClassGroupTaskController.java
  3. 125
      hai-service/src/main/java/com/hai/dao/HighGasClassGroupMapper.java
  4. 7
      hai-service/src/main/java/com/hai/dao/HighGasClassGroupMapperExt.java
  5. 332
      hai-service/src/main/java/com/hai/dao/HighGasClassGroupSqlProvider.java
  6. 134
      hai-service/src/main/java/com/hai/dao/HighGasClassGroupTaskMapper.java
  7. 58
      hai-service/src/main/java/com/hai/dao/HighGasClassGroupTaskMapperExt.java
  8. 360
      hai-service/src/main/java/com/hai/dao/HighGasClassGroupTaskSqlProvider.java
  9. 232
      hai-service/src/main/java/com/hai/entity/HighGasClassGroup.java
  10. 1013
      hai-service/src/main/java/com/hai/entity/HighGasClassGroupExample.java
  11. 264
      hai-service/src/main/java/com/hai/entity/HighGasClassGroupTask.java
  12. 1123
      hai-service/src/main/java/com/hai/entity/HighGasClassGroupTaskExample.java
  13. 36
      hai-service/src/main/java/com/hai/enum_type/GasClassGroupTaskStatus.java
  14. 129
      hai-service/src/main/java/com/hai/model/GasClassGroupTaskDataCount.java
  15. 62
      hai-service/src/main/java/com/hai/model/GasClassGroupTaskOilCount.java
  16. 13
      hai-service/src/main/java/com/hai/model/HighCouponCodeModel.java
  17. 40
      hai-service/src/main/java/com/hai/service/HighGasClassGroupService.java
  18. 64
      hai-service/src/main/java/com/hai/service/HighGasClassGroupTaskService.java
  19. 1
      hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java
  20. 77
      hai-service/src/main/java/com/hai/service/impl/HighGasClassGroupServiceImpl.java
  21. 181
      hai-service/src/main/java/com/hai/service/impl/HighGasClassGroupTaskServiceImpl.java

@ -0,0 +1,166 @@
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;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighGasClassGroup;
import com.hai.entity.HighGasClassGroupTask;
import com.hai.enum_type.GasClassGroupTaskStatus;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighGasClassGroupService;
import com.hai.service.HighGasClassGroupTaskService;
import com.hai.service.HighMerchantStoreService;
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.List;
import java.util.Map;
/**
* 加油站班组
* @author hurui
*/
@Controller
@RequestMapping(value = "/gasClassGroup")
@Api(value = "加油站班组")
public class HighGasClassGroupController {
private static Logger log = LoggerFactory.getLogger(HighGasClassGroupController.class);
@Resource
private HighGasClassGroupService gasClassGroupService;
@Resource
private HighGasClassGroupTaskService gasClassGroupTaskService;
@Resource
private HighMerchantStoreService merchantStoreService;
@Resource
private UserCenter userCenter;
@RequestMapping(value = "/editClassGroup", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "编辑班组")
public ResponseData editClassGroup(@RequestBody JSONObject body) {
try {
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
if (userInfoModel == null || userInfoModel.getMerchantStore() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
if (body == null
|| StringUtils.isBlank(body.getString("name"))
|| StringUtils.isBlank(body.getString("principalName"))
|| StringUtils.isBlank(body.getString("principalPhone"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
HighGasClassGroup gasClassGroup;
if (body.getLong("id") != null) {
// 查询班组
gasClassGroup = gasClassGroupService.getDetailById(body.getLong("id"));
if (gasClassGroup == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
} else {
gasClassGroup = new HighGasClassGroup();
gasClassGroup.setMerchantStoreId(userInfoModel.getMerchantStore().getId());
gasClassGroup.setMerchantStoreName(userInfoModel.getMerchantStore().getStoreName());
}
gasClassGroup.setName(body.getString("name"));
gasClassGroup.setPrincipalName(body.getString("principalName"));
gasClassGroup.setPrincipalPhone(body.getString("principalPhone"));
gasClassGroupService.editGroup(gasClassGroup);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighGasClassGroupController --> editClassGroup() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/delClassGroup", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "删除班组")
public ResponseData delClassGroup(@RequestBody JSONObject body) {
try {
if (body == null || body.getLong("id") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
Map<String, Object> param = new HashMap<>();
param.put("gasClassGroupId", body.getLong("id"));
param.put("status", GasClassGroupTaskStatus.status1.getStatus());
List<HighGasClassGroupTask> groupTaskList = gasClassGroupTaskService.getGroupTaskList(param);
if (groupTaskList.size() > 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "班组有任务进行中,暂时无法删除");
}
gasClassGroupService.delGroup(body.getLong("id"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighGasClassGroupController --> delClassGroup() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getClassGroupById", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询班组详情")
public ResponseData getClassGroupById(@RequestParam(name = "groupId", required = true) Long groupId) {
try {
return ResponseMsgUtil.success(gasClassGroupService.getDetailById(groupId));
} catch (Exception e) {
log.error("HighGasClassGroupController --> getClassGroupById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getClassGroupList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询班组列表")
public ResponseData getClassGroupList(@RequestParam(name = "principalName", required = false) String principalName,
@RequestParam(name = "principalPhone", required = false) String principalPhone,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) {
try {
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
if (userInfoModel == null || userInfoModel.getMerchantStore() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
Map<String,Object> param = new HashMap<>();
param.put("merchantStoreId", userInfoModel.getMerchantStore().getId());
param.put("principalName", principalName);
param.put("principalPhone", principalPhone);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(gasClassGroupService.getGroupList(param)));
} catch (Exception e) {
log.error("HighGasClassGroupController --> getClassGroupList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -0,0 +1,135 @@
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;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.model.ResponseData;
import com.hai.service.HighGasClassGroupTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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;
/**
* 加油站班组任务
* @author hurui
*/
@Controller
@RequestMapping(value = "/gasClassGroupTask")
@Api(value = "加油站班组任务")
public class HighGasClassGroupTaskController {
private static Logger log = LoggerFactory.getLogger(HighGasClassGroupTaskController.class);
@Resource
private HighGasClassGroupTaskService gasClassGroupTaskService;
@Resource
private UserCenter userCenter;
@RequestMapping(value = "/startGroupTask", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "开启班组任务")
public ResponseData startGroupTask(@RequestBody JSONObject body) {
try {
if (body == null || body.getLong("gasId") == null || body.getLong("gasClassGroupId") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
gasClassGroupTaskService.startGroupTask(body.getLong("gasId"), body.getLong("gasClassGroupId"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighGasClassGroupTaskController --> startGroupTask() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/endGroupTask", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "结束班组任务")
public ResponseData endGroupTask(@RequestBody JSONObject body) {
try {
if (body == null || body.getLong("gasId") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
gasClassGroupTaskService.endGroupTask(body.getLong("gasId"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighGasClassGroupTaskController --> endGroupTask() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/swapGroupTask", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "交换班组任务")
public ResponseData swapGroupTask(@RequestBody JSONObject body) {
try {
if (body == null || body.getLong("gasId") == null || body.getLong("gasClassGroupId") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
gasClassGroupTaskService.swapGroupTask(body.getLong("gasId"), body.getLong("gasClassGroupId"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighGasClassGroupTaskController --> swapGroupTask() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getClassGroupTaskById", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询班组任务记录")
public ResponseData getClassGroupTaskById(@RequestParam(name = "gasClassGroupTaskId", required = true) Long gasClassGroupTaskId) {
try {
return ResponseMsgUtil.success(gasClassGroupTaskService.getDetailById(gasClassGroupTaskId));
} catch (Exception e) {
log.error("HighGasClassGroupTaskController --> getClassGroupTaskById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getClassGroupTaskList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询班组任务记录")
public ResponseData getClassGroupTaskList(@RequestParam(name = "gasClassGroupId", required = false) Long gasClassGroupId,
@RequestParam(name = "merchantStoreId", required = false) Long merchantStoreId,
@RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) {
try {
Map<String,Object> param = new HashMap<>();
param.put("gasClassGroupId", gasClassGroupId);
param.put("merchantStoreId", merchantStoreId);
param.put("status", status);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(gasClassGroupTaskService.getGroupTaskList(param)));
} catch (Exception e) {
log.error("HighGasClassGroupTaskController --> getClassGroupTaskList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -0,0 +1,125 @@
package com.hai.dao;
import com.hai.entity.HighGasClassGroup;
import com.hai.entity.HighGasClassGroupExample;
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 HighGasClassGroupMapper extends HighGasClassGroupMapperExt {
@SelectProvider(type=HighGasClassGroupSqlProvider.class, method="countByExample")
long countByExample(HighGasClassGroupExample example);
@DeleteProvider(type=HighGasClassGroupSqlProvider.class, method="deleteByExample")
int deleteByExample(HighGasClassGroupExample example);
@Delete({
"delete from high_gas_class_group",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into high_gas_class_group (merchant_store_id, merchant_store_name, ",
"`name`, principal_name, ",
"principal_phone, `status`, ",
"create_time, update_time, ",
"ext_1, ext_2, ext_3)",
"values (#{merchantStoreId,jdbcType=BIGINT}, #{merchantStoreName,jdbcType=VARCHAR}, ",
"#{name,jdbcType=VARCHAR}, #{principalName,jdbcType=VARCHAR}, ",
"#{principalPhone,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighGasClassGroup record);
@InsertProvider(type=HighGasClassGroupSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(HighGasClassGroup record);
@SelectProvider(type=HighGasClassGroupSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="merchant_store_id", property="merchantStoreId", jdbcType=JdbcType.BIGINT),
@Result(column="merchant_store_name", property="merchantStoreName", jdbcType=JdbcType.VARCHAR),
@Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
@Result(column="principal_name", property="principalName", jdbcType=JdbcType.VARCHAR),
@Result(column="principal_phone", property="principalPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@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<HighGasClassGroup> selectByExample(HighGasClassGroupExample example);
@Select({
"select",
"id, merchant_store_id, merchant_store_name, `name`, principal_name, principal_phone, ",
"`status`, create_time, update_time, ext_1, ext_2, ext_3",
"from high_gas_class_group",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="merchant_store_id", property="merchantStoreId", jdbcType=JdbcType.BIGINT),
@Result(column="merchant_store_name", property="merchantStoreName", jdbcType=JdbcType.VARCHAR),
@Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
@Result(column="principal_name", property="principalName", jdbcType=JdbcType.VARCHAR),
@Result(column="principal_phone", property="principalPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@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)
})
HighGasClassGroup selectByPrimaryKey(Long id);
@UpdateProvider(type=HighGasClassGroupSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") HighGasClassGroup record, @Param("example") HighGasClassGroupExample example);
@UpdateProvider(type=HighGasClassGroupSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") HighGasClassGroup record, @Param("example") HighGasClassGroupExample example);
@UpdateProvider(type=HighGasClassGroupSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(HighGasClassGroup record);
@Update({
"update high_gas_class_group",
"set merchant_store_id = #{merchantStoreId,jdbcType=BIGINT},",
"merchant_store_name = #{merchantStoreName,jdbcType=VARCHAR},",
"`name` = #{name,jdbcType=VARCHAR},",
"principal_name = #{principalName,jdbcType=VARCHAR},",
"principal_phone = #{principalPhone,jdbcType=VARCHAR},",
"`status` = #{status,jdbcType=INTEGER},",
"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(HighGasClassGroup record);
}

@ -0,0 +1,7 @@
package com.hai.dao;
/**
* mapper扩展类
*/
public interface HighGasClassGroupMapperExt {
}

@ -0,0 +1,332 @@
package com.hai.dao;
import com.hai.entity.HighGasClassGroup;
import com.hai.entity.HighGasClassGroupExample.Criteria;
import com.hai.entity.HighGasClassGroupExample.Criterion;
import com.hai.entity.HighGasClassGroupExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class HighGasClassGroupSqlProvider {
public String countByExample(HighGasClassGroupExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("high_gas_class_group");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(HighGasClassGroupExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("high_gas_class_group");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(HighGasClassGroup record) {
SQL sql = new SQL();
sql.INSERT_INTO("high_gas_class_group");
if (record.getMerchantStoreId() != null) {
sql.VALUES("merchant_store_id", "#{merchantStoreId,jdbcType=BIGINT}");
}
if (record.getMerchantStoreName() != null) {
sql.VALUES("merchant_store_name", "#{merchantStoreName,jdbcType=VARCHAR}");
}
if (record.getName() != null) {
sql.VALUES("`name`", "#{name,jdbcType=VARCHAR}");
}
if (record.getPrincipalName() != null) {
sql.VALUES("principal_name", "#{principalName,jdbcType=VARCHAR}");
}
if (record.getPrincipalPhone() != null) {
sql.VALUES("principal_phone", "#{principalPhone,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
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(HighGasClassGroupExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("merchant_store_id");
sql.SELECT("merchant_store_name");
sql.SELECT("`name`");
sql.SELECT("principal_name");
sql.SELECT("principal_phone");
sql.SELECT("`status`");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
sql.FROM("high_gas_class_group");
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) {
HighGasClassGroup record = (HighGasClassGroup) parameter.get("record");
HighGasClassGroupExample example = (HighGasClassGroupExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("high_gas_class_group");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getMerchantStoreId() != null) {
sql.SET("merchant_store_id = #{record.merchantStoreId,jdbcType=BIGINT}");
}
if (record.getMerchantStoreName() != null) {
sql.SET("merchant_store_name = #{record.merchantStoreName,jdbcType=VARCHAR}");
}
if (record.getName() != null) {
sql.SET("`name` = #{record.name,jdbcType=VARCHAR}");
}
if (record.getPrincipalName() != null) {
sql.SET("principal_name = #{record.principalName,jdbcType=VARCHAR}");
}
if (record.getPrincipalPhone() != null) {
sql.SET("principal_phone = #{record.principalPhone,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
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("high_gas_class_group");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("merchant_store_id = #{record.merchantStoreId,jdbcType=BIGINT}");
sql.SET("merchant_store_name = #{record.merchantStoreName,jdbcType=VARCHAR}");
sql.SET("`name` = #{record.name,jdbcType=VARCHAR}");
sql.SET("principal_name = #{record.principalName,jdbcType=VARCHAR}");
sql.SET("principal_phone = #{record.principalPhone,jdbcType=VARCHAR}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
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}");
HighGasClassGroupExample example = (HighGasClassGroupExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(HighGasClassGroup record) {
SQL sql = new SQL();
sql.UPDATE("high_gas_class_group");
if (record.getMerchantStoreId() != null) {
sql.SET("merchant_store_id = #{merchantStoreId,jdbcType=BIGINT}");
}
if (record.getMerchantStoreName() != null) {
sql.SET("merchant_store_name = #{merchantStoreName,jdbcType=VARCHAR}");
}
if (record.getName() != null) {
sql.SET("`name` = #{name,jdbcType=VARCHAR}");
}
if (record.getPrincipalName() != null) {
sql.SET("principal_name = #{principalName,jdbcType=VARCHAR}");
}
if (record.getPrincipalPhone() != null) {
sql.SET("principal_phone = #{principalPhone,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
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, HighGasClassGroupExample 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,134 @@
package com.hai.dao;
import com.hai.entity.HighGasClassGroupTask;
import com.hai.entity.HighGasClassGroupTaskExample;
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 HighGasClassGroupTaskMapper extends HighGasClassGroupTaskMapperExt {
@SelectProvider(type=HighGasClassGroupTaskSqlProvider.class, method="countByExample")
long countByExample(HighGasClassGroupTaskExample example);
@DeleteProvider(type=HighGasClassGroupTaskSqlProvider.class, method="deleteByExample")
int deleteByExample(HighGasClassGroupTaskExample example);
@Delete({
"delete from high_gas_class_group_task",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into high_gas_class_group_task (gas_class_group_id, gas_class_group_name, ",
"merchant_store_id, merchant_store_name, ",
"start_time, end_time, ",
"data_count, `status`, ",
"create_time, update_time, ",
"ext_1, ext_2, ext_3)",
"values (#{gasClassGroupId,jdbcType=BIGINT}, #{gasClassGroupName,jdbcType=VARCHAR}, ",
"#{merchantStoreId,jdbcType=BIGINT}, #{merchantStoreName,jdbcType=VARCHAR}, ",
"#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, ",
"#{dataCount,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighGasClassGroupTask record);
@InsertProvider(type=HighGasClassGroupTaskSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(HighGasClassGroupTask record);
@SelectProvider(type=HighGasClassGroupTaskSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="gas_class_group_id", property="gasClassGroupId", jdbcType=JdbcType.BIGINT),
@Result(column="gas_class_group_name", property="gasClassGroupName", jdbcType=JdbcType.VARCHAR),
@Result(column="merchant_store_id", property="merchantStoreId", jdbcType=JdbcType.BIGINT),
@Result(column="merchant_store_name", property="merchantStoreName", jdbcType=JdbcType.VARCHAR),
@Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="data_count", property="dataCount", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@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<HighGasClassGroupTask> selectByExample(HighGasClassGroupTaskExample example);
@Select({
"select",
"id, gas_class_group_id, gas_class_group_name, merchant_store_id, merchant_store_name, ",
"start_time, end_time, data_count, `status`, create_time, update_time, ext_1, ",
"ext_2, ext_3",
"from high_gas_class_group_task",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="gas_class_group_id", property="gasClassGroupId", jdbcType=JdbcType.BIGINT),
@Result(column="gas_class_group_name", property="gasClassGroupName", jdbcType=JdbcType.VARCHAR),
@Result(column="merchant_store_id", property="merchantStoreId", jdbcType=JdbcType.BIGINT),
@Result(column="merchant_store_name", property="merchantStoreName", jdbcType=JdbcType.VARCHAR),
@Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="data_count", property="dataCount", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@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)
})
HighGasClassGroupTask selectByPrimaryKey(Long id);
@UpdateProvider(type=HighGasClassGroupTaskSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") HighGasClassGroupTask record, @Param("example") HighGasClassGroupTaskExample example);
@UpdateProvider(type=HighGasClassGroupTaskSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") HighGasClassGroupTask record, @Param("example") HighGasClassGroupTaskExample example);
@UpdateProvider(type=HighGasClassGroupTaskSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(HighGasClassGroupTask record);
@Update({
"update high_gas_class_group_task",
"set gas_class_group_id = #{gasClassGroupId,jdbcType=BIGINT},",
"gas_class_group_name = #{gasClassGroupName,jdbcType=VARCHAR},",
"merchant_store_id = #{merchantStoreId,jdbcType=BIGINT},",
"merchant_store_name = #{merchantStoreName,jdbcType=VARCHAR},",
"start_time = #{startTime,jdbcType=TIMESTAMP},",
"end_time = #{endTime,jdbcType=TIMESTAMP},",
"data_count = #{dataCount,jdbcType=VARCHAR},",
"`status` = #{status,jdbcType=INTEGER},",
"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(HighGasClassGroupTask record);
}

@ -0,0 +1,58 @@
package com.hai.dao;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
/**
* mapper扩展类
*/
public interface HighGasClassGroupTaskMapperExt {
@Select("<script>" +
" select " +
" case when SUM(a.total_price) is not null then SUM(a.total_price) else 0 end refuelPrice," +
" COUNT(1) refuelNum," +
" case when SUM(a.gas_liters_preferences) is not null then SUM(a.gas_liters_preferences) else 0 end refuelLiters" +
" from high_child_order a" +
" LEFT JOIN high_order b on b.id = a.order_id" +
" where goods_type = 3 " +
" and gas_class_group_task_id = #{gasClassGroupTaskId} " +
" and child_orde_status in (2,3)" +
"</script>")
Map<String, Object> countRefuelData(@Param("gasClassGroupTaskId") Long gasClassGroupTaskId);
@Select("<script>" +
" select " +
" case when SUM(a.total_price) is not null then SUM(a.total_price) else 0 end refundPrice," +
" COUNT(1) refundNum," +
" case when SUM(a.gas_liters_preferences) is not null then SUM(a.gas_liters_preferences) else 0 end refundLiters" +
" from high_child_order a" +
" LEFT JOIN high_order b on b.id = a.order_id" +
" where goods_type = 3 " +
" and gas_class_group_task_id = #{gasClassGroupTaskId} " +
" and child_orde_status in (4)" +
"</script>")
Map<String, Object> countRefundData(@Param("gasClassGroupTaskId") Long gasClassGroupTaskId);
@Select("<script>" +
" SELECT" +
" a.oil_no," +
" case when b.refuelPrice is not null then b.refuelPrice else 0 end refuelPrice," +
" case when b.refuelNum is not null then b.refuelNum else 0 end refuelNum," +
" case when b.refuelLiters is not null then b.refuelLiters else 0 end refuelLiters" +
" FROM" +
" high_gas_oil_price a " +
" LEFT JOIN (select gas_oil_no," +
" case when SUM(a.total_price) is not null then SUM(a.total_price) else 0 end refuelPrice," +
" COUNT(1) refuelNum," +
" case when SUM(a.gas_liters_preferences) is not null then SUM(a.gas_liters_preferences) else 0 end refuelLiters" +
" from high_child_order a" +
" where gas_class_group_task_id = #{gasClassGroupTaskId} and goods_type = 3 and child_orde_status in (2,3)" +
" GROUP BY a.gas_oil_no) b on b.gas_oil_no = a.oil_no" +
" WHERE a.merchant_store_id = #{gasId} and `status` <> 0 " +
"</script>")
List<Map<String, Object>> countOilData(@Param("gasId") Long gasId, @Param("gasClassGroupTaskId") Long gasClassGroupTaskId);
}

@ -0,0 +1,360 @@
package com.hai.dao;
import com.hai.entity.HighGasClassGroupTask;
import com.hai.entity.HighGasClassGroupTaskExample.Criteria;
import com.hai.entity.HighGasClassGroupTaskExample.Criterion;
import com.hai.entity.HighGasClassGroupTaskExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class HighGasClassGroupTaskSqlProvider {
public String countByExample(HighGasClassGroupTaskExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("high_gas_class_group_task");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(HighGasClassGroupTaskExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("high_gas_class_group_task");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(HighGasClassGroupTask record) {
SQL sql = new SQL();
sql.INSERT_INTO("high_gas_class_group_task");
if (record.getGasClassGroupId() != null) {
sql.VALUES("gas_class_group_id", "#{gasClassGroupId,jdbcType=BIGINT}");
}
if (record.getGasClassGroupName() != null) {
sql.VALUES("gas_class_group_name", "#{gasClassGroupName,jdbcType=VARCHAR}");
}
if (record.getMerchantStoreId() != null) {
sql.VALUES("merchant_store_id", "#{merchantStoreId,jdbcType=BIGINT}");
}
if (record.getMerchantStoreName() != null) {
sql.VALUES("merchant_store_name", "#{merchantStoreName,jdbcType=VARCHAR}");
}
if (record.getStartTime() != null) {
sql.VALUES("start_time", "#{startTime,jdbcType=TIMESTAMP}");
}
if (record.getEndTime() != null) {
sql.VALUES("end_time", "#{endTime,jdbcType=TIMESTAMP}");
}
if (record.getDataCount() != null) {
sql.VALUES("data_count", "#{dataCount,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
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(HighGasClassGroupTaskExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("gas_class_group_id");
sql.SELECT("gas_class_group_name");
sql.SELECT("merchant_store_id");
sql.SELECT("merchant_store_name");
sql.SELECT("start_time");
sql.SELECT("end_time");
sql.SELECT("data_count");
sql.SELECT("`status`");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
sql.FROM("high_gas_class_group_task");
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) {
HighGasClassGroupTask record = (HighGasClassGroupTask) parameter.get("record");
HighGasClassGroupTaskExample example = (HighGasClassGroupTaskExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("high_gas_class_group_task");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getGasClassGroupId() != null) {
sql.SET("gas_class_group_id = #{record.gasClassGroupId,jdbcType=BIGINT}");
}
if (record.getGasClassGroupName() != null) {
sql.SET("gas_class_group_name = #{record.gasClassGroupName,jdbcType=VARCHAR}");
}
if (record.getMerchantStoreId() != null) {
sql.SET("merchant_store_id = #{record.merchantStoreId,jdbcType=BIGINT}");
}
if (record.getMerchantStoreName() != null) {
sql.SET("merchant_store_name = #{record.merchantStoreName,jdbcType=VARCHAR}");
}
if (record.getStartTime() != null) {
sql.SET("start_time = #{record.startTime,jdbcType=TIMESTAMP}");
}
if (record.getEndTime() != null) {
sql.SET("end_time = #{record.endTime,jdbcType=TIMESTAMP}");
}
if (record.getDataCount() != null) {
sql.SET("data_count = #{record.dataCount,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
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("high_gas_class_group_task");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("gas_class_group_id = #{record.gasClassGroupId,jdbcType=BIGINT}");
sql.SET("gas_class_group_name = #{record.gasClassGroupName,jdbcType=VARCHAR}");
sql.SET("merchant_store_id = #{record.merchantStoreId,jdbcType=BIGINT}");
sql.SET("merchant_store_name = #{record.merchantStoreName,jdbcType=VARCHAR}");
sql.SET("start_time = #{record.startTime,jdbcType=TIMESTAMP}");
sql.SET("end_time = #{record.endTime,jdbcType=TIMESTAMP}");
sql.SET("data_count = #{record.dataCount,jdbcType=VARCHAR}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
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}");
HighGasClassGroupTaskExample example = (HighGasClassGroupTaskExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(HighGasClassGroupTask record) {
SQL sql = new SQL();
sql.UPDATE("high_gas_class_group_task");
if (record.getGasClassGroupId() != null) {
sql.SET("gas_class_group_id = #{gasClassGroupId,jdbcType=BIGINT}");
}
if (record.getGasClassGroupName() != null) {
sql.SET("gas_class_group_name = #{gasClassGroupName,jdbcType=VARCHAR}");
}
if (record.getMerchantStoreId() != null) {
sql.SET("merchant_store_id = #{merchantStoreId,jdbcType=BIGINT}");
}
if (record.getMerchantStoreName() != null) {
sql.SET("merchant_store_name = #{merchantStoreName,jdbcType=VARCHAR}");
}
if (record.getStartTime() != null) {
sql.SET("start_time = #{startTime,jdbcType=TIMESTAMP}");
}
if (record.getEndTime() != null) {
sql.SET("end_time = #{endTime,jdbcType=TIMESTAMP}");
}
if (record.getDataCount() != null) {
sql.SET("data_count = #{dataCount,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
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, HighGasClassGroupTaskExample 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,232 @@
package com.hai.entity;
import java.io.Serializable;
import java.util.Date;
/**
* high_gas_class_group
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class HighGasClassGroup implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 加油站id
*/
private Long merchantStoreId;
/**
* 加油站名称
*/
private String merchantStoreName;
/**
* 班组名称
*/
private String name;
/**
* 负责人名称
*/
private String principalName;
/**
* 负责人电话
*/
private String principalPhone;
/**
* 状态 0删除 1正常
*/
private Integer status;
/**
* 创建时间
*/
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 Long getMerchantStoreId() {
return merchantStoreId;
}
public void setMerchantStoreId(Long merchantStoreId) {
this.merchantStoreId = merchantStoreId;
}
public String getMerchantStoreName() {
return merchantStoreName;
}
public void setMerchantStoreName(String merchantStoreName) {
this.merchantStoreName = merchantStoreName;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPrincipalName() {
return principalName;
}
public void setPrincipalName(String principalName) {
this.principalName = principalName;
}
public String getPrincipalPhone() {
return principalPhone;
}
public void setPrincipalPhone(String principalPhone) {
this.principalPhone = principalPhone;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
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;
}
HighGasClassGroup other = (HighGasClassGroup) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getMerchantStoreId() == null ? other.getMerchantStoreId() == null : this.getMerchantStoreId().equals(other.getMerchantStoreId()))
&& (this.getMerchantStoreName() == null ? other.getMerchantStoreName() == null : this.getMerchantStoreName().equals(other.getMerchantStoreName()))
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
&& (this.getPrincipalName() == null ? other.getPrincipalName() == null : this.getPrincipalName().equals(other.getPrincipalName()))
&& (this.getPrincipalPhone() == null ? other.getPrincipalPhone() == null : this.getPrincipalPhone().equals(other.getPrincipalPhone()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (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 + ((getMerchantStoreId() == null) ? 0 : getMerchantStoreId().hashCode());
result = prime * result + ((getMerchantStoreName() == null) ? 0 : getMerchantStoreName().hashCode());
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
result = prime * result + ((getPrincipalName() == null) ? 0 : getPrincipalName().hashCode());
result = prime * result + ((getPrincipalPhone() == null) ? 0 : getPrincipalPhone().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().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(", merchantStoreId=").append(merchantStoreId);
sb.append(", merchantStoreName=").append(merchantStoreName);
sb.append(", name=").append(name);
sb.append(", principalName=").append(principalName);
sb.append(", principalPhone=").append(principalPhone);
sb.append(", status=").append(status);
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();
}
}

@ -0,0 +1,264 @@
package com.hai.entity;
import java.io.Serializable;
import java.util.Date;
/**
* high_gas_class_group_task
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class HighGasClassGroupTask implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 班组id
*/
private Long gasClassGroupId;
/**
* 班组名称
*/
private String gasClassGroupName;
/**
* 加油站id
*/
private Long merchantStoreId;
/**
* 加油站名称
*/
private String merchantStoreName;
/**
* 开始时间
*/
private Date startTime;
/**
* 结束时间
*/
private Date endTime;
/**
* 数据统计
*/
private String dataCount;
/**
* 状态 0删除 1进行中 2已结束
*/
private Integer status;
/**
* 创建时间
*/
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 Long getGasClassGroupId() {
return gasClassGroupId;
}
public void setGasClassGroupId(Long gasClassGroupId) {
this.gasClassGroupId = gasClassGroupId;
}
public String getGasClassGroupName() {
return gasClassGroupName;
}
public void setGasClassGroupName(String gasClassGroupName) {
this.gasClassGroupName = gasClassGroupName;
}
public Long getMerchantStoreId() {
return merchantStoreId;
}
public void setMerchantStoreId(Long merchantStoreId) {
this.merchantStoreId = merchantStoreId;
}
public String getMerchantStoreName() {
return merchantStoreName;
}
public void setMerchantStoreName(String merchantStoreName) {
this.merchantStoreName = merchantStoreName;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public String getDataCount() {
return dataCount;
}
public void setDataCount(String dataCount) {
this.dataCount = dataCount;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
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;
}
HighGasClassGroupTask other = (HighGasClassGroupTask) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getGasClassGroupId() == null ? other.getGasClassGroupId() == null : this.getGasClassGroupId().equals(other.getGasClassGroupId()))
&& (this.getGasClassGroupName() == null ? other.getGasClassGroupName() == null : this.getGasClassGroupName().equals(other.getGasClassGroupName()))
&& (this.getMerchantStoreId() == null ? other.getMerchantStoreId() == null : this.getMerchantStoreId().equals(other.getMerchantStoreId()))
&& (this.getMerchantStoreName() == null ? other.getMerchantStoreName() == null : this.getMerchantStoreName().equals(other.getMerchantStoreName()))
&& (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime()))
&& (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime()))
&& (this.getDataCount() == null ? other.getDataCount() == null : this.getDataCount().equals(other.getDataCount()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (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 + ((getGasClassGroupId() == null) ? 0 : getGasClassGroupId().hashCode());
result = prime * result + ((getGasClassGroupName() == null) ? 0 : getGasClassGroupName().hashCode());
result = prime * result + ((getMerchantStoreId() == null) ? 0 : getMerchantStoreId().hashCode());
result = prime * result + ((getMerchantStoreName() == null) ? 0 : getMerchantStoreName().hashCode());
result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode());
result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode());
result = prime * result + ((getDataCount() == null) ? 0 : getDataCount().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().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(", gasClassGroupId=").append(gasClassGroupId);
sb.append(", gasClassGroupName=").append(gasClassGroupName);
sb.append(", merchantStoreId=").append(merchantStoreId);
sb.append(", merchantStoreName=").append(merchantStoreName);
sb.append(", startTime=").append(startTime);
sb.append(", endTime=").append(endTime);
sb.append(", dataCount=").append(dataCount);
sb.append(", status=").append(status);
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();
}
}

@ -0,0 +1,36 @@
package com.hai.enum_type;
/**
* 加油站员工状态
* @author hurui
*/
public enum GasClassGroupTaskStatus {
status0(0 , "删除"),
status1(1 , "进行中"),
status2(2 , "已结束"),
;
private Integer status;
private String name;
GasClassGroupTaskStatus(int status , String name) {
this.status = status;
this.name = name;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

@ -0,0 +1,129 @@
package com.hai.model;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 加油站 班组任务数据统计模型
* @author hurui
*/
public class GasClassGroupTaskDataCount {
/**
* 开始时间
*/
private Date startTime;
/**
* 结束时间
*/
private Date endTime;
/**
* 加油总金额
*/
private BigDecimal refuelPrice;
/**
* 加油总数量
*/
private Integer refuelNum;
/**
* 加油总升数
*/
private BigDecimal refuelLiters;
/**
* 退款总金额
*/
private BigDecimal refundPrice;
/**
* 退款总数量
*/
private Integer refundNum;
/**
* 退款总升数
*/
private BigDecimal refundLiters;
/**
* 班组油品数据统计
*/
List<GasClassGroupTaskOilCount> groupTaskOilCountList;
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public BigDecimal getRefuelPrice() {
return refuelPrice;
}
public void setRefuelPrice(BigDecimal refuelPrice) {
this.refuelPrice = refuelPrice;
}
public Integer getRefuelNum() {
return refuelNum;
}
public void setRefuelNum(Integer refuelNum) {
this.refuelNum = refuelNum;
}
public BigDecimal getRefuelLiters() {
return refuelLiters;
}
public void setRefuelLiters(BigDecimal refuelLiters) {
this.refuelLiters = refuelLiters;
}
public BigDecimal getRefundPrice() {
return refundPrice;
}
public void setRefundPrice(BigDecimal refundPrice) {
this.refundPrice = refundPrice;
}
public Integer getRefundNum() {
return refundNum;
}
public void setRefundNum(Integer refundNum) {
this.refundNum = refundNum;
}
public BigDecimal getRefundLiters() {
return refundLiters;
}
public void setRefundLiters(BigDecimal refundLiters) {
this.refundLiters = refundLiters;
}
public List<GasClassGroupTaskOilCount> getGroupTaskOilCountList() {
return groupTaskOilCountList;
}
public void setGroupTaskOilCountList(List<GasClassGroupTaskOilCount> groupTaskOilCountList) {
this.groupTaskOilCountList = groupTaskOilCountList;
}
}

@ -0,0 +1,62 @@
package com.hai.model;
import java.math.BigDecimal;
/**
* 加油站 班组任务加油统计
* @author hurui
*/
public class GasClassGroupTaskOilCount {
/**
* 油号
*/
private Integer oilNo;
/**
* 加油总金额
*/
private BigDecimal refuelPrice;
/**
* 加油总数量
*/
private Integer refuelNum;
/**
* 加油总升数
*/
private BigDecimal refuelLiters;
public Integer getOilNo() {
return oilNo;
}
public void setOilNo(Integer oilNo) {
this.oilNo = oilNo;
}
public BigDecimal getRefuelPrice() {
return refuelPrice;
}
public void setRefuelPrice(BigDecimal refuelPrice) {
this.refuelPrice = refuelPrice;
}
public Integer getRefuelNum() {
return refuelNum;
}
public void setRefuelNum(Integer refuelNum) {
this.refuelNum = refuelNum;
}
public BigDecimal getRefuelLiters() {
return refuelLiters;
}
public void setRefuelLiters(BigDecimal refuelLiters) {
this.refuelLiters = refuelLiters;
}
}

@ -1,13 +0,0 @@
package com.hai.model;
/**
* @ClassName HighCouponCodeModel
* @Description:
* @Author 胡锐
* @Date 2021/3/16
**/
public interface HighCouponCodeModel {
}

@ -0,0 +1,40 @@
package com.hai.service;
import com.hai.entity.HighGasClassGroup;
import java.util.List;
import java.util.Map;
/**
* 加油站班组服务
* @author hurui
*/
public interface HighGasClassGroupService {
/**
* 编辑班组
* @param gasClassGroup
*/
void editGroup(HighGasClassGroup gasClassGroup);
/**
* 删除班组
* @param groupId
*/
void delGroup(Long groupId);
/**
* 根据id查询详情
* @param groupId
* @return
*/
HighGasClassGroup getDetailById(Long groupId);
/**
* 查询班组列表
* @param param
* @return
*/
List<HighGasClassGroup> getGroupList(Map<String, Object> param);
}

@ -0,0 +1,64 @@
package com.hai.service;
import com.alibaba.fastjson.JSONObject;
import com.hai.entity.HighGasClassGroupTask;
import com.hai.model.GasClassGroupTaskDataCount;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 加油站班组任务
* @author hurui
*/
public interface HighGasClassGroupTaskService {
/**
* 开始班组
* @param gasId 油站id
* @param gasClassGroupId 班组id
*/
void startGroupTask(Long gasId, Long gasClassGroupId);
/**
* 结束班组任务
* @param gasId 油站id
*/
void endGroupTask(Long gasId);
/**
* 交接班组任务
* @param gasId 油站id
* @param gasClassGroupId 班组id
*/
void swapGroupTask(Long gasId, Long gasClassGroupId);
/**
* 统计班组任务数据
* @param groupTaskId
* @return
*/
GasClassGroupTaskDataCount countGroupTaskData(Long gasId, Long groupTaskId, Date startTime, Date endTime);
/**
* 编辑班组任务
* @param gasClassGroupTask
*/
void editGroupTask(HighGasClassGroupTask gasClassGroupTask);
/**
* 根据id查询详情
* @param groupTaskId
* @return
*/
HighGasClassGroupTask getDetailById(Long groupTaskId);
/**
* 查询班组任务列表
* @param param
* @return
*/
List<HighGasClassGroupTask> getGroupTaskList(Map<String, Object> param);
}

@ -7,7 +7,6 @@ import com.hai.common.exception.SysCode;
import com.hai.dao.HighCouponHandselMapper;
import com.hai.dao.HighCouponMapper;
import com.hai.entity.*;
import com.hai.model.HighCouponCodeModel;
import com.hai.model.HighCouponHandselModel;
import com.hai.model.HighCouponModel;
import com.hai.service.*;

@ -0,0 +1,77 @@
package com.hai.service.impl;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.dao.HighGasClassGroupMapper;
import com.hai.entity.HighGasClassGroup;
import com.hai.entity.HighGasClassGroupExample;
import com.hai.service.HighGasClassGroupService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service("gasClassGroupService")
public class HighGasClassGroupServiceImpl implements HighGasClassGroupService {
@Resource
private HighGasClassGroupMapper gasClassGroupMapper;
@Override
public void editGroup(HighGasClassGroup gasClassGroup) {
if (gasClassGroup.getId() == null) {
gasClassGroup.setStatus(1);
gasClassGroup.setCreateTime(new Date());
gasClassGroup.setUpdateTime(new Date());
gasClassGroupMapper.insert(gasClassGroup);
} else {
gasClassGroup.setUpdateTime(new Date());
gasClassGroupMapper.updateByPrimaryKey(gasClassGroup);
}
}
@Override
public void delGroup(Long groupId) {
HighGasClassGroup classGroup = getDetailById(groupId);
if (classGroup == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到班组");
}
classGroup.setStatus(0);
editGroup(classGroup);
}
@Override
public HighGasClassGroup getDetailById(Long groupId) {
return gasClassGroupMapper.selectByPrimaryKey(groupId);
}
@Override
public List<HighGasClassGroup> getGroupList(Map<String, Object> param) {
HighGasClassGroupExample example = new HighGasClassGroupExample();
HighGasClassGroupExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(0);
if (MapUtils.getLong(param, "merchantStoreId") != null) {
criteria.andMerchantStoreIdEqualTo(MapUtils.getLong(param, "merchantStoreId"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "merchantStoreName"))) {
criteria.andMerchantStoreNameLike("%" + MapUtils.getString(param, "merchantStoreId") + "%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "principalName"))) {
criteria.andPrincipalNameLike("%" + MapUtils.getString(param, "principalName") + "%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "principalPhone"))) {
criteria.andPrincipalPhoneLike("%" + MapUtils.getString(param, "principalPhone") + "%");
}
example.setOrderByClause("create_time desc");
return gasClassGroupMapper.selectByExample(example);
}
}

@ -0,0 +1,181 @@
package com.hai.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.dao.HighGasClassGroupTaskMapper;
import com.hai.entity.HighGasClassGroup;
import com.hai.entity.HighGasClassGroupTask;
import com.hai.entity.HighGasClassGroupTaskExample;
import com.hai.entity.HighMerchantStore;
import com.hai.enum_type.GasClassGroupTaskStatus;
import com.hai.model.GasClassGroupTaskDataCount;
import com.hai.model.GasClassGroupTaskOilCount;
import com.hai.service.HighGasClassGroupService;
import com.hai.service.HighGasClassGroupTaskService;
import com.hai.service.HighMerchantStoreService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
@Service("gasClassGroupTask")
public class HighGasClassGroupTaskServiceImpl implements HighGasClassGroupTaskService {
@Resource
private HighGasClassGroupTaskMapper gasClassGroupTaskMapper;
@Resource
private HighGasClassGroupService gasClassGroupService;
@Resource
private HighMerchantStoreService merchantStoreService;
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void startGroupTask(Long gasId, Long gasClassGroupId) {
// 查询加油站
HighMerchantStore merchantStore = merchantStoreService.getDetailById(gasId);
if (merchantStore == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到加油站信息");
}
// 查询进行中的任务
Map<String, Object> param = new HashMap<>();
param.put("merchantStoreId", merchantStore.getId());
param.put("status", GasClassGroupTaskStatus.status1.getStatus());
List<HighGasClassGroupTask> list = getGroupTaskList(param);
if (list.size() > 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已有班组正在进行中,请结束班组或交换班组");
}
// 查询班组信息
HighGasClassGroup group = gasClassGroupService.getDetailById(gasClassGroupId);
if (group == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到班组信息");
}
HighGasClassGroupTask groupTask = new HighGasClassGroupTask();
groupTask.setGasClassGroupId(group.getId());
groupTask.setGasClassGroupName(group.getName());
groupTask.setMerchantStoreId(merchantStore.getId());
groupTask.setMerchantStoreName(merchantStore.getStoreName());
groupTask.setStartTime(new Date());
editGroupTask(groupTask);
}
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void endGroupTask(Long gasId) {
// 查询进行中的任务
Map<String, Object> param = new HashMap<>();
param.put("merchantStoreId", gasId);
param.put("status", GasClassGroupTaskStatus.status1.getStatus());
List<HighGasClassGroupTask> list = getGroupTaskList(param);
if (list.size() > 0) {
HighGasClassGroupTask groupTask = list.get(0);
groupTask.setEndTime(new Date());
groupTask.setStatus(GasClassGroupTaskStatus.status2.getStatus());
groupTask.setDataCount(JSONObject.toJSONString(countGroupTaskData(gasId, groupTask.getId(), groupTask.getStartTime(), groupTask.getEndTime())));
editGroupTask(groupTask);
}
}
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void swapGroupTask(Long gasId, Long gasClassGroupId) {
// 任务结束
endGroupTask(gasId);
// 开启新的任务
startGroupTask(gasId, gasClassGroupId);
}
@Override
public GasClassGroupTaskDataCount countGroupTaskData(Long gasId, Long groupTaskId, Date startTime, Date endTime) {
GasClassGroupTaskDataCount dataCount = new GasClassGroupTaskDataCount();
dataCount.setStartTime(startTime);
dataCount.setEndTime(endTime);
// 加油汇总
Map<String, Object> refuelData = gasClassGroupTaskMapper.countRefuelData(groupTaskId);
dataCount.setRefuelPrice(new BigDecimal(MapUtils.getString(refuelData, "refuelPrice")));
dataCount.setRefuelNum(MapUtils.getInteger(refuelData, "refuelNum"));
dataCount.setRefuelLiters(new BigDecimal(MapUtils.getString(refuelData, "refuelLiters")));
// 退款汇总
Map<String, Object> refundData = gasClassGroupTaskMapper.countRefundData(groupTaskId);
dataCount.setRefundPrice(new BigDecimal(MapUtils.getString(refundData, "refundPrice")));
dataCount.setRefundNum(MapUtils.getInteger(refundData, "refuelNum"));
dataCount.setRefundLiters(new BigDecimal(MapUtils.getString(refundData, "refundLiters")));
// 油品汇总
List<Map<String, Object>> oilDataList = gasClassGroupTaskMapper.countOilData(gasId, groupTaskId);
List<GasClassGroupTaskOilCount> oilCountList = new ArrayList<>();
for (Map<String, Object> oilData : oilDataList) {
GasClassGroupTaskOilCount oilCount = new GasClassGroupTaskOilCount();
oilCount.setRefuelPrice(new BigDecimal(MapUtils.getString(refuelData, "refuelPrice")));
oilCount.setRefuelNum(MapUtils.getInteger(refuelData, "refuelNum"));
oilCount.setRefuelLiters(new BigDecimal(MapUtils.getString(refuelData, "refuelLiters")));
oilCountList.add(oilCount);
}
dataCount.setGroupTaskOilCountList(oilCountList);
return dataCount;
}
@Override
public void editGroupTask(HighGasClassGroupTask gasClassGroupTask) {
if (gasClassGroupTask.getId() == null) {
gasClassGroupTask.setStatus(GasClassGroupTaskStatus.status1.getStatus());
gasClassGroupTask.setCreateTime(new Date());
gasClassGroupTask.setUpdateTime(new Date());
gasClassGroupTaskMapper.insert(gasClassGroupTask);
} else {
gasClassGroupTask.setUpdateTime(new Date());
gasClassGroupTaskMapper.updateByPrimaryKey(gasClassGroupTask);
}
}
@Override
public HighGasClassGroupTask getDetailById(Long groupTaskId) {
return gasClassGroupTaskMapper.selectByPrimaryKey(groupTaskId);
}
@Override
public List<HighGasClassGroupTask> getGroupTaskList(Map<String, Object> param) {
HighGasClassGroupTaskExample example = new HighGasClassGroupTaskExample();
HighGasClassGroupTaskExample.Criteria criteria = example.createCriteria()
.andStatusNotEqualTo(GasClassGroupTaskStatus.status0.getStatus());
if (MapUtils.getLong(param, "gasClassGroupId") != null) {
criteria.andGasClassGroupIdEqualTo(MapUtils.getLong(param, "gasClassGroupId"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "gasClassGroupName"))) {
criteria.andGasClassGroupNameLike("%" + MapUtils.getString(param, "gasClassGroupName") + "%");
}
if (MapUtils.getLong(param, "merchantStoreId") != null) {
criteria.andMerchantStoreIdEqualTo(MapUtils.getLong(param, "merchantStoreId"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "gasClassGroupName"))) {
criteria.andGasClassGroupNameLike("%" + MapUtils.getString(param, "gasClassGroupName") + "%");
}
if (MapUtils.getInteger(param, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(param, "status"));
}
example.setOrderByClause("create_time desc");
return gasClassGroupTaskMapper.selectByExample(example);
}
}
Loading…
Cancel
Save