提交代码

master
胡锐 8 months ago
parent 3396738145
commit 80bb643c6c
  1. 4
      bweb/src/main/java/com/bweb/config/AuthConfig.java
  2. 189
      bweb/src/main/java/com/bweb/controller/BsGasClassGroupController.java
  3. 246
      bweb/src/main/java/com/bweb/controller/BsGasClassGroupTaskController.java
  4. 16
      bweb/src/main/java/com/bweb/controller/BsGasStaffController.java
  5. 17
      bweb/src/main/java/com/bweb/controller/CommonController.java
  6. 4
      bweb/src/main/java/com/bweb/controller/LoginController.java
  7. 31
      bweb/src/main/java/com/bweb/controller/SecUserController.java
  8. 30
      service/src/main/java/com/hfkj/config/SpPrinterTemplate.java
  9. 125
      service/src/main/java/com/hfkj/dao/BsGasClassGroupMapper.java
  10. 7
      service/src/main/java/com/hfkj/dao/BsGasClassGroupMapperExt.java
  11. 332
      service/src/main/java/com/hfkj/dao/BsGasClassGroupSqlProvider.java
  12. 136
      service/src/main/java/com/hfkj/dao/BsGasClassGroupTaskMapper.java
  13. 59
      service/src/main/java/com/hfkj/dao/BsGasClassGroupTaskMapperExt.java
  14. 374
      service/src/main/java/com/hfkj/dao/BsGasClassGroupTaskSqlProvider.java
  15. 232
      service/src/main/java/com/hfkj/entity/BsGasClassGroup.java
  16. 1013
      service/src/main/java/com/hfkj/entity/BsGasClassGroupExample.java
  17. 280
      service/src/main/java/com/hfkj/entity/BsGasClassGroupTask.java
  18. 1183
      service/src/main/java/com/hfkj/entity/BsGasClassGroupTaskExample.java
  19. 155
      service/src/main/java/com/hfkj/model/GasClassGroupTaskDataCount.java
  20. 62
      service/src/main/java/com/hfkj/model/GasClassGroupTaskOilCount.java
  21. 7
      service/src/main/java/com/hfkj/service/BsDeviceService.java
  22. 56
      service/src/main/java/com/hfkj/service/CommonService.java
  23. 40
      service/src/main/java/com/hfkj/service/gas/BsGasClassGroupService.java
  24. 70
      service/src/main/java/com/hfkj/service/gas/BsGasClassGroupTaskService.java
  25. 81
      service/src/main/java/com/hfkj/service/gas/impl/BsGasClassGroupServiceImpl.java
  26. 223
      service/src/main/java/com/hfkj/service/gas/impl/BsGasClassGroupTaskServiceImpl.java
  27. 4
      service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceOfficialServiceImpl.java
  28. 8
      service/src/main/java/com/hfkj/service/impl/BsDeviceServiceImpl.java
  29. 1
      service/src/main/java/com/hfkj/service/impl/BsMerchantServiceImpl.java
  30. 142
      service/src/main/java/com/hfkj/service/impl/CommonServiceImpl.java
  31. 36
      service/src/main/java/com/hfkj/sysenum/gas/GasClassGroupTaskStatus.java

@ -87,7 +87,9 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/**/swagger-ui.html")
.excludePathPatterns("/client/*")
.excludePathPatterns("/sms/*")
.excludePathPatterns("/login/*")
.excludePathPatterns("/common/*")
.excludePathPatterns("/secUser/login")
.excludePathPatterns("/secUser/loginOut")
;
}

@ -0,0 +1,189 @@
package com.bweb.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.BsGasClassGroup;
import com.hfkj.entity.BsGasClassGroupTask;
import com.hfkj.entity.BsGasStaff;
import com.hfkj.entity.BsMerchant;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.BsMerchantService;
import com.hfkj.service.gas.BsGasClassGroupService;
import com.hfkj.service.gas.BsGasClassGroupTaskService;
import com.hfkj.service.gas.BsGasStaffService;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
import com.hfkj.sysenum.gas.GasClassGroupTaskStatus;
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 BsGasClassGroupController {
private static Logger log = LoggerFactory.getLogger(BsGasClassGroupController.class);
@Resource
private BsGasClassGroupService gasClassGroupService;
@Resource
private BsGasClassGroupTaskService gasClassGroupTaskService;
@Resource
private BsGasStaffService gasStaffService;
@Resource
private BsMerchantService merchantService;
@Resource
private UserCenter userCenter;
@RequestMapping(value = "/editClassGroup", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "编辑班组")
public ResponseData editClassGroup(@RequestBody JSONObject body) {
try {
SecUserSessionObject userInfoModel = userCenter.getSessionModel(SecUserSessionObject.class);
if (userInfoModel == null
|| userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR);
}
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, "");
}
BsGasClassGroup 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 BsGasClassGroup();
// 查询商户
BsMerchant merchant = merchantService.getMerchant(userInfoModel.getAccount().getObjectId());
if (merchant == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
gasClassGroup.setMerId(merchant.getId());
gasClassGroup.setMerName(merchant.getMerName());
}
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<BsGasClassGroupTask> 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 = "name", required = false) String name,
@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 {
SecUserSessionObject userInfoModel = userCenter.getSessionModel(SecUserSessionObject.class);
if (userInfoModel == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
Map<String,Object> param = new HashMap<>();
if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) {
param.put("merchantStoreId", userInfoModel.getAccount().getObjectId());
} else if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) {
// 查询油站工作人员
BsGasStaff gasStaff = gasStaffService.getStaffDetailById(userInfoModel.getAccount().getObjectId());
if (gasStaff == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
param.put("merchantStoreId", gasStaff.getMerId());
}
param.put("name", name);
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,246 @@
package com.bweb.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.config.SpPrinterConfig;
import com.hfkj.config.SpPrinterTemplate;
import com.hfkj.entity.BsDevice;
import com.hfkj.entity.BsGasClassGroupTask;
import com.hfkj.entity.BsGasStaff;
import com.hfkj.model.GasClassGroupTaskDataCount;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.BsDeviceService;
import com.hfkj.service.gas.BsGasClassGroupTaskService;
import com.hfkj.service.gas.BsGasStaffService;
import com.hfkj.sysenum.DeviceTypeEnum;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
import com.hfkj.sysenum.gas.GasClassGroupTaskStatus;
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.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 加油站班组任务
* @author hurui
*/
@Controller
@RequestMapping(value = "/gasClassGroupTask")
@Api(value = "加油站班组任务")
public class BsGasClassGroupTaskController {
private static Logger log = LoggerFactory.getLogger(BsGasClassGroupTaskController.class);
@Resource
private BsGasClassGroupTaskService gasClassGroupTaskService;
@Resource
private BsDeviceService deviceService;
@Resource
private BsGasStaffService gasStaffService;
/* @Resource
private MqttProviderConfig mqttProviderConfig;*/
@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 = "/getCurrentClassGroupTask", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询当前班次")
public ResponseData getCurrentClassGroupTask(@RequestParam(name = "gasId", required = true) Long gasId) {
try {
GasClassGroupTaskDataCount dataCount;
Map<String,Object> param = new HashMap<>();
param.put("merchantStoreId", gasId);
param.put("status", GasClassGroupTaskStatus.status1.getStatus());
List<BsGasClassGroupTask> list = gasClassGroupTaskService.getGroupTaskList(param);
if (list.size() > 0) {
dataCount = gasClassGroupTaskService.countGroupTaskData(gasId,
list.get(0).getClassNum(),
list.get(0).getId(),
list.get(0).getStatus(),
list.get(0).getStartTime(),
null
);
return ResponseMsgUtil.success(dataCount);
}
dataCount = new GasClassGroupTaskDataCount();
dataCount.setStatus(0);
dataCount.setRefuelPrice(new BigDecimal("0"));
dataCount.setRefuelNum(0);
dataCount.setRefuelLiters(new BigDecimal("0"));
dataCount.setRefundPrice(new BigDecimal("0"));
dataCount.setRefundNum(0);
dataCount.setRefundLiters(new BigDecimal("0"));
return ResponseMsgUtil.success(dataCount);
} catch (Exception e) {
log.error("HighGasClassGroupTaskController --> getCurrentClassGroupTask() 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<>();
SecUserSessionObject userInfoModel = userCenter.getSessionModel(SecUserSessionObject.class);
if (userInfoModel == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, "");
}
if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) {
param.put("merchantStoreId", userInfoModel.getAccount().getObjectId());
} else if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) {
// 查询油站工作人员
BsGasStaff gasStaff = gasStaffService.getStaffDetailById(userInfoModel.getAccount().getObjectId());
if (gasStaff == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
param.put("merchantStoreId", gasStaff.getMerId());
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, "");
}
param.put("gasClassGroupId", gasClassGroupId);
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);
}
}
@RequestMapping(value = "/print", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "打印小票")
public ResponseData print(@RequestParam(name = "gasClassGroupTaskId", required = true) Long gasClassGroupTaskId) {
try {
BsGasClassGroupTask groupTask = gasClassGroupTaskService.getDetailById(gasClassGroupTaskId);
if (groupTask == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到班次");
}
GasClassGroupTaskDataCount dataCount = JSONObject.parseObject(groupTask.getDataCount(), GasClassGroupTaskDataCount.class);
// 查询加油站打印机
List<BsDevice> deviceList = deviceService.getDeviceByMer(groupTask.getMerId());
for (BsDevice device : deviceList) {
if (device.getType().equals(DeviceTypeEnum.type1.getType())) {
new Thread(() -> {
try {
// 推送打印机
SpPrinterConfig spPrinterConfig = new SpPrinterConfig();
spPrinterConfig.print(device.getDeviceSn(), SpPrinterTemplate.classGroupCountTemp(dataCount, true), 1);
} catch (Exception e) {
e.printStackTrace();
}
}).start();
}
}
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighGasClassGroupTaskController --> getClassGroupTaskById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -27,6 +27,7 @@ import com.hfkj.sysenum.gas.GasStaffStatus;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
@ -122,27 +123,18 @@ public class BsGasStaffController {
}
}
@RequestMapping(value="/queryQrCode",method = RequestMethod.POST)
@RequestMapping(value="/queryQrCode",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询二维码")
public ResponseData queryQrCode(@RequestBody JSONObject body) {
public ResponseData queryQrCode(@RequestParam(name = "staffId", required = true) Long staffId) {
try {
if (body.getLong("gasStaffId") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询员工信息
BsGasStaff gasStaff = gasStaffService.getStaffDetailById(body.getLong("gasStaffId"));
BsGasStaff gasStaff = gasStaffService.getStaffDetailById(staffId);
if (gasStaff == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到员工信息");
}
if (StringUtils.isBlank(gasStaff.getQrCodeImgUrl())) {
// 查询加油站
BsMerchant merchantStore = merchantService.getMerchant(gasStaff.getMerId());
if (merchantStore == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到加油站信息");
}
// 员工ID签名
String signId = AESEncodeUtil.aesEncrypt(gasStaff.getId().toString());

@ -2,6 +2,7 @@ package com.bweb.controller;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.model.ResponseData;
import com.hfkj.service.CommonService;
import com.hfkj.service.sec.SecDictionaryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -23,6 +24,22 @@ public class CommonController {
Logger log = LoggerFactory.getLogger(CommonController.class);
@Resource
private SecDictionaryService secDictionaryService;
@Resource
private CommonService commonService;
@RequestMapping(value="/getRegion",method= RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "分级查询区域信息")
public ResponseData getRegion(@RequestParam(name = "regionId", required = false) Long regionId){
try {
if (regionId == null){
return ResponseMsgUtil.success(commonService.getCities());
}
return ResponseMsgUtil.success(commonService.getRegionsByParentId(regionId));
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/queryDictionary",method = RequestMethod.GET)
@ResponseBody

@ -25,7 +25,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@Controller
@RequestMapping(value = "/login")
@RequestMapping(value = "/secUser")
@Api(value = "登录")
public class LoginController {
@ -56,7 +56,7 @@ public class LoginController {
}
}
@RequestMapping(value="/queryUser",method = RequestMethod.POST)
@RequestMapping(value="/queryUser",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询账户")
public ResponseData queryUser() {

@ -153,6 +153,37 @@ public class SecUserController {
}
}
@RequestMapping(value="/updatePwd",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "修改密码")
public ResponseData updatePwd(@RequestBody JSONObject body) {
try {
if (body == null
|| body.getLong("userId") == null
|| StringUtils.isBlank(body.getString("oldPassword"))
|| StringUtils.isBlank(body.getString("newPassword"))
) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询用户
SecUser secUser = secUserService.getDetail(body.getLong("userId"));
if (secUser == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的用户");
}
if (!secUser.getPassword().equals(MD5Util.encode(body.getString("oldPassword").getBytes()))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "旧密码错误");
}
secUser.setPassword(MD5Util.encode(body.getString("newPassword").getBytes()));
secUserService.editUser(secUser);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/disable",method = RequestMethod.POST)
@ResponseBody

@ -1,28 +1,23 @@
/*
package com.hfkj.config;
import com.hai.common.utils.DateUtil;
import com.hai.model.GasClassGroupTaskDataCount;
import com.hai.model.GasClassGroupTaskOilCount;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.model.GasClassGroupTaskDataCount;
import com.hfkj.model.GasClassGroupTaskOilCount;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.Date;
import java.util.Map;
*/
/**
* 商鹏打印机模板
* @author hurui
*//*
*/
public class SpPrinterTemplate {
*/
/**
/**
* 加油站收银员存根模板
*//*
*/
public static String classGroupCountTemp(GasClassGroupTaskDataCount dataCount, boolean makeUp) throws Exception {
String str = "<C>" + dataCount.getClassNum() + "班结流水" + (makeUp?"(补打)":"") + "</C> <BR> " +
"===============================<BR>" +
@ -50,8 +45,7 @@ public class SpPrinterTemplate {
return str;
}
*/
/**
/**
* 加油站收银员存根模板
* @param gasName 油站名称
* @param orderNo 订单号
@ -63,8 +57,7 @@ public class SpPrinterTemplate {
* @param receiptMap 小票配置
* @param makeUp 重复打印
* @return
*//*
*/
public static String oilCashierStubTemp(String gasName,
String orderNo,
String payTime,
@ -98,8 +91,7 @@ public class SpPrinterTemplate {
return str;
}
*/
/**
/**
* 加油站客户存根模板
* @param gasName 油站名称
* @param orderNo 订单号
@ -111,8 +103,7 @@ public class SpPrinterTemplate {
* @param receiptMap 小票配置
* @param makeUp 重复打印
* @return
*//*
*/
public static String oilClientStubTemp(String gasName,
String orderNo,
String payTime,
@ -146,4 +137,3 @@ public class SpPrinterTemplate {
}
}
*/

@ -0,0 +1,125 @@
package com.hfkj.dao;
import com.hfkj.entity.BsGasClassGroup;
import com.hfkj.entity.BsGasClassGroupExample;
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 BsGasClassGroupMapper extends BsGasClassGroupMapperExt {
@SelectProvider(type=BsGasClassGroupSqlProvider.class, method="countByExample")
long countByExample(BsGasClassGroupExample example);
@DeleteProvider(type=BsGasClassGroupSqlProvider.class, method="deleteByExample")
int deleteByExample(BsGasClassGroupExample example);
@Delete({
"delete from bs_gas_class_group",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into bs_gas_class_group (mer_id, mer_name, ",
"`name`, principal_name, ",
"principal_phone, `status`, ",
"create_time, update_time, ",
"ext_1, ext_2, ext_3)",
"values (#{merId,jdbcType=BIGINT}, #{merName,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(BsGasClassGroup record);
@InsertProvider(type=BsGasClassGroupSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(BsGasClassGroup record);
@SelectProvider(type=BsGasClassGroupSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_name", property="merName", 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<BsGasClassGroup> selectByExample(BsGasClassGroupExample example);
@Select({
"select",
"id, mer_id, mer_name, `name`, principal_name, principal_phone, `status`, create_time, ",
"update_time, ext_1, ext_2, ext_3",
"from bs_gas_class_group",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_name", property="merName", 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)
})
BsGasClassGroup selectByPrimaryKey(Long id);
@UpdateProvider(type=BsGasClassGroupSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") BsGasClassGroup record, @Param("example") BsGasClassGroupExample example);
@UpdateProvider(type=BsGasClassGroupSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") BsGasClassGroup record, @Param("example") BsGasClassGroupExample example);
@UpdateProvider(type=BsGasClassGroupSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(BsGasClassGroup record);
@Update({
"update bs_gas_class_group",
"set mer_id = #{merId,jdbcType=BIGINT},",
"mer_name = #{merName,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(BsGasClassGroup record);
}

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

@ -0,0 +1,332 @@
package com.hfkj.dao;
import com.hfkj.entity.BsGasClassGroup;
import com.hfkj.entity.BsGasClassGroupExample.Criteria;
import com.hfkj.entity.BsGasClassGroupExample.Criterion;
import com.hfkj.entity.BsGasClassGroupExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class BsGasClassGroupSqlProvider {
public String countByExample(BsGasClassGroupExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("bs_gas_class_group");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(BsGasClassGroupExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("bs_gas_class_group");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(BsGasClassGroup record) {
SQL sql = new SQL();
sql.INSERT_INTO("bs_gas_class_group");
if (record.getMerId() != null) {
sql.VALUES("mer_id", "#{merId,jdbcType=BIGINT}");
}
if (record.getMerName() != null) {
sql.VALUES("mer_name", "#{merName,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(BsGasClassGroupExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("mer_id");
sql.SELECT("mer_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("bs_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) {
BsGasClassGroup record = (BsGasClassGroup) parameter.get("record");
BsGasClassGroupExample example = (BsGasClassGroupExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("bs_gas_class_group");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getMerId() != null) {
sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}");
}
if (record.getMerName() != null) {
sql.SET("mer_name = #{record.merName,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("bs_gas_class_group");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}");
sql.SET("mer_name = #{record.merName,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}");
BsGasClassGroupExample example = (BsGasClassGroupExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(BsGasClassGroup record) {
SQL sql = new SQL();
sql.UPDATE("bs_gas_class_group");
if (record.getMerId() != null) {
sql.SET("mer_id = #{merId,jdbcType=BIGINT}");
}
if (record.getMerName() != null) {
sql.SET("mer_name = #{merName,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, BsGasClassGroupExample 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,136 @@
package com.hfkj.dao;
import com.hfkj.entity.BsGasClassGroupTask;
import com.hfkj.entity.BsGasClassGroupTaskExample;
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 BsGasClassGroupTaskMapper extends BsGasClassGroupTaskMapperExt {
@SelectProvider(type=BsGasClassGroupTaskSqlProvider.class, method="countByExample")
long countByExample(BsGasClassGroupTaskExample example);
@DeleteProvider(type=BsGasClassGroupTaskSqlProvider.class, method="deleteByExample")
int deleteByExample(BsGasClassGroupTaskExample example);
@Delete({
"delete from bs_gas_class_group_task",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into bs_gas_class_group_task (gas_class_group_id, gas_class_group_name, ",
"mer_id, mer_name, class_num, ",
"start_time, end_time, ",
"data_count, `status`, ",
"create_time, update_time, ",
"ext_1, ext_2, ext_3)",
"values (#{gasClassGroupId,jdbcType=BIGINT}, #{gasClassGroupName,jdbcType=VARCHAR}, ",
"#{merId,jdbcType=BIGINT}, #{merName,jdbcType=VARCHAR}, #{classNum,jdbcType=INTEGER}, ",
"#{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(BsGasClassGroupTask record);
@InsertProvider(type=BsGasClassGroupTaskSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(BsGasClassGroupTask record);
@SelectProvider(type=BsGasClassGroupTaskSqlProvider.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="mer_id", property="merId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR),
@Result(column="class_num", property="classNum", jdbcType=JdbcType.INTEGER),
@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<BsGasClassGroupTask> selectByExample(BsGasClassGroupTaskExample example);
@Select({
"select",
"id, gas_class_group_id, gas_class_group_name, mer_id, mer_name, class_num, start_time, ",
"end_time, data_count, `status`, create_time, update_time, ext_1, ext_2, ext_3",
"from bs_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="mer_id", property="merId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR),
@Result(column="class_num", property="classNum", jdbcType=JdbcType.INTEGER),
@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)
})
BsGasClassGroupTask selectByPrimaryKey(Long id);
@UpdateProvider(type=BsGasClassGroupTaskSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") BsGasClassGroupTask record, @Param("example") BsGasClassGroupTaskExample example);
@UpdateProvider(type=BsGasClassGroupTaskSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") BsGasClassGroupTask record, @Param("example") BsGasClassGroupTaskExample example);
@UpdateProvider(type=BsGasClassGroupTaskSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(BsGasClassGroupTask record);
@Update({
"update bs_gas_class_group_task",
"set gas_class_group_id = #{gasClassGroupId,jdbcType=BIGINT},",
"gas_class_group_name = #{gasClassGroupName,jdbcType=VARCHAR},",
"mer_id = #{merId,jdbcType=BIGINT},",
"mer_name = #{merName,jdbcType=VARCHAR},",
"class_num = #{classNum,jdbcType=INTEGER},",
"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(BsGasClassGroupTask record);
}

@ -0,0 +1,59 @@
package com.hfkj.dao;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
/**
* mapper扩展类
*/
public interface BsGasClassGroupTaskMapperExt {
@Select("<script>" +
" select " +
" case when SUM(a.gas_refuel_price) is not null then SUM(a.gas_refuel_price) else 0 end refuelPrice," +
" COUNT(1) refuelNum," +
" case when SUM(a.gas_oil_liters) is not null then SUM(a.gas_oil_liters) else 0 end refuelLiters" +
" from bs_gas_order a" +
" where a.gas_class_group_task_id = #{gasClassGroupTaskId} " +
" and a.status in (2)" +
"</script>")
Map<String, Object> countRefuelData(@Param("gasClassGroupTaskId") Long gasClassGroupTaskId);
@Select("<script>" +
" select" +
" case when SUM(a.gas_refuel_price) is not null then SUM(a.gas_refuel_price) else 0 end refundPrice," +
" COUNT(1) refundNum," +
" case when SUM(a.gas_oil_liters) is not null then SUM(a.gas_oil_liters) else 0 end refundLiters" +
" from bs_gas_order a" +
" where a.gas_class_group_task_id = #{gasClassGroupTaskId}" +
" and a.status in (4)" +
"</script>")
Map<String, Object> countRefundData(@Param("gasClassGroupTaskId") Long gasClassGroupTaskId);
@Select("<script>" +
" SELECT" +
" a.oil_no oilNo," +
" 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" +
" bs_gas_oil_price a " +
" LEFT JOIN (select gas_oil_no," +
" case when SUM(a.gas_refuel_price) is not null then SUM(a.gas_refuel_price) else 0 end refuelPrice," +
" COUNT(1) refuelNum," +
" case when SUM(a.gas_oil_liters) is not null then SUM(a.gas_oil_liters) else 0 end refuelLiters" +
" from bs_gas_order a" +
" where a.gas_class_group_task_id = #{gasClassGroupTaskId} and a.status in (4)" +
" GROUP BY a.gas_oil_no) b on b.gas_oil_no = a.oil_no" +
" WHERE a.merchant_store_id = #{gasId} and <![CDATA[ `status` <> 0 ]]> " +
"</script>")
List<Map<String, Object>> countOilData(@Param("gasId") Long gasId, @Param("gasClassGroupTaskId") Long gasClassGroupTaskId);
@Select("select count(1) from bs_gas_class_group_task where merchant_store_id = #{gasId} and `status` <> 0")
int getLatestClassNum(@Param("gasId") Long gasId);
}

@ -0,0 +1,374 @@
package com.hfkj.dao;
import com.hfkj.entity.BsGasClassGroupTask;
import com.hfkj.entity.BsGasClassGroupTaskExample.Criteria;
import com.hfkj.entity.BsGasClassGroupTaskExample.Criterion;
import com.hfkj.entity.BsGasClassGroupTaskExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class BsGasClassGroupTaskSqlProvider {
public String countByExample(BsGasClassGroupTaskExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("bs_gas_class_group_task");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(BsGasClassGroupTaskExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("bs_gas_class_group_task");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(BsGasClassGroupTask record) {
SQL sql = new SQL();
sql.INSERT_INTO("bs_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.getMerId() != null) {
sql.VALUES("mer_id", "#{merId,jdbcType=BIGINT}");
}
if (record.getMerName() != null) {
sql.VALUES("mer_name", "#{merName,jdbcType=VARCHAR}");
}
if (record.getClassNum() != null) {
sql.VALUES("class_num", "#{classNum,jdbcType=INTEGER}");
}
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(BsGasClassGroupTaskExample 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("mer_id");
sql.SELECT("mer_name");
sql.SELECT("class_num");
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("bs_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) {
BsGasClassGroupTask record = (BsGasClassGroupTask) parameter.get("record");
BsGasClassGroupTaskExample example = (BsGasClassGroupTaskExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("bs_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.getMerId() != null) {
sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}");
}
if (record.getMerName() != null) {
sql.SET("mer_name = #{record.merName,jdbcType=VARCHAR}");
}
if (record.getClassNum() != null) {
sql.SET("class_num = #{record.classNum,jdbcType=INTEGER}");
}
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("bs_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("mer_id = #{record.merId,jdbcType=BIGINT}");
sql.SET("mer_name = #{record.merName,jdbcType=VARCHAR}");
sql.SET("class_num = #{record.classNum,jdbcType=INTEGER}");
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}");
BsGasClassGroupTaskExample example = (BsGasClassGroupTaskExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(BsGasClassGroupTask record) {
SQL sql = new SQL();
sql.UPDATE("bs_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.getMerId() != null) {
sql.SET("mer_id = #{merId,jdbcType=BIGINT}");
}
if (record.getMerName() != null) {
sql.SET("mer_name = #{merName,jdbcType=VARCHAR}");
}
if (record.getClassNum() != null) {
sql.SET("class_num = #{classNum,jdbcType=INTEGER}");
}
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, BsGasClassGroupTaskExample 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.hfkj.entity;
import java.io.Serializable;
import java.util.Date;
/**
* bs_gas_class_group
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class BsGasClassGroup implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 加油站id
*/
private Long merId;
/**
* 加油站名称
*/
private String merName;
/**
* 班组名称
*/
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 getMerId() {
return merId;
}
public void setMerId(Long merId) {
this.merId = merId;
}
public String getMerName() {
return merName;
}
public void setMerName(String merName) {
this.merName = merName;
}
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;
}
BsGasClassGroup other = (BsGasClassGroup) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getMerId() == null ? other.getMerId() == null : this.getMerId().equals(other.getMerId()))
&& (this.getMerName() == null ? other.getMerName() == null : this.getMerName().equals(other.getMerName()))
&& (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 + ((getMerId() == null) ? 0 : getMerId().hashCode());
result = prime * result + ((getMerName() == null) ? 0 : getMerName().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(", merId=").append(merId);
sb.append(", merName=").append(merName);
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,280 @@
package com.hfkj.entity;
import java.io.Serializable;
import java.util.Date;
/**
* bs_gas_class_group_task
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class BsGasClassGroupTask implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 班组id
*/
private Long gasClassGroupId;
/**
* 班组名称
*/
private String gasClassGroupName;
/**
* 加油站id
*/
private Long merId;
/**
* 加油站名称
*/
private String merName;
/**
* 班次
*/
private Integer classNum;
/**
* 开始时间
*/
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 getMerId() {
return merId;
}
public void setMerId(Long merId) {
this.merId = merId;
}
public String getMerName() {
return merName;
}
public void setMerName(String merName) {
this.merName = merName;
}
public Integer getClassNum() {
return classNum;
}
public void setClassNum(Integer classNum) {
this.classNum = classNum;
}
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;
}
BsGasClassGroupTask other = (BsGasClassGroupTask) 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.getMerId() == null ? other.getMerId() == null : this.getMerId().equals(other.getMerId()))
&& (this.getMerName() == null ? other.getMerName() == null : this.getMerName().equals(other.getMerName()))
&& (this.getClassNum() == null ? other.getClassNum() == null : this.getClassNum().equals(other.getClassNum()))
&& (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 + ((getMerId() == null) ? 0 : getMerId().hashCode());
result = prime * result + ((getMerName() == null) ? 0 : getMerName().hashCode());
result = prime * result + ((getClassNum() == null) ? 0 : getClassNum().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(", merId=").append(merId);
sb.append(", merName=").append(merName);
sb.append(", classNum=").append(classNum);
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,155 @@
package com.hfkj.model;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 加油站 班组任务数据统计模型
* @author hurui
*/
public class GasClassGroupTaskDataCount {
/**
* 班次
*/
private Integer classNum;
/**
* 开始时间
*/
private Date startTime;
/**
* 结束时间
*/
private Date endTime;
/**
* 班次状态
*/
private Integer status;
/**
* 加油总金额
*/
private BigDecimal refuelPrice;
/**
* 加油总笔数
*/
private Integer refuelNum;
/**
* 加油总升数
*/
private BigDecimal refuelLiters;
/**
* 退款总金额
*/
private BigDecimal refundPrice;
/**
* 退款总笔数
*/
private Integer refundNum;
/**
* 退款总升数
*/
private BigDecimal refundLiters;
/**
* 班组油品数据统计
*/
List<GasClassGroupTaskOilCount> groupTaskOilCountList;
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getClassNum() {
return classNum;
}
public void setClassNum(Integer classNum) {
this.classNum = classNum;
}
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.hfkj.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;
}
}

@ -25,6 +25,13 @@ public interface BsDeviceService {
*/
BsDevice getDetailById(Long deviceId);
/**
* 查询商户设备
* @param merId
* @return
*/
List<BsDevice> getDeviceByMer(Long merId);
/**
* 查询设备列表
* @param param

@ -1,12 +1,4 @@
package com.hfkj.service;
/**
* @ClassName: CommonService
* @Description:TODO(共用接口)
* @author: 杜江
* @date: 2020年07月07日 15:35:43
* @Copyright: 2018 www.shinwoten.com Inc. All rights reserved.
*/
import com.alibaba.fastjson.JSONObject;
import com.hfkj.entity.SecDictionary;
import com.hfkj.entity.SecRegion;
@ -14,13 +6,7 @@ import com.hfkj.entity.SecRegion;
import java.util.List;
import java.util.Map;
/**
*@ClassName CommonService
*@Description 共用接口
*@Author 杜江
*@Date 2020/7/7 15:35
*@Version 1.0
*/
public interface CommonService {
/**
@ -32,7 +18,7 @@ public interface CommonService {
* @return: List<BaseDictionary>
* @throws
*/
Map<String, Map<String, SecDictionary>> getDictionaries();
Map<String, List<SecDictionary>> getDictionaries();
/**
* @Title: getDictionary
@ -68,18 +54,7 @@ public interface CommonService {
* @createTime 14:53 2021/6/23
**/
Boolean findValue(String codeType, String codeValue);
/**
*
* @Title: mappingSysName
* @Description: 根据codetypecodeName获取系统字典数据
* @author: 杜江
* @Date: 2020/8/21 14:13
* @param: [codeType, codeName]
* @return: com.shinwoten.train.entity.SecDictionary
* @throws
*/
SecDictionary mappingSysName(String codeType, String codeName);
/**
* @ClassName CommonService.java
@ -117,12 +92,6 @@ public interface CommonService {
*/
List<SecRegion> getCities();
/**
* 查询省级列表
* @return
*/
List<SecRegion> getProvinceList();
/**
*
* @Title: getCities
@ -171,23 +140,4 @@ public interface CommonService {
*/
String getRegionName(Long regionId);
/**
*
* @Title: findByName
* @Description: 通过区域名称查询
* @author: 杜江
* @Date: 2020/7/10 15:43
* @param: [name]
* @return: java.util.List<com.shinwoten.plat.entity.SecRegion>
* @throws
*/
List<SecRegion> findByName(String name);
SecRegion getParentByRegion(Long regionId);
void updateDictionary(SecDictionary secDictionary);
SecRegion getRegionsByName(String regionName);
}

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

@ -0,0 +1,70 @@
package com.hfkj.service.gas;
import com.hfkj.entity.BsGasClassGroupTask;
import com.hfkj.model.GasClassGroupTaskDataCount;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 加油站班组任务
* @author hurui
*/
public interface BsGasClassGroupTaskService {
/**
* 开始班组
* @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, Integer classNum, Long groupTaskId, Integer status, Date startTime, Date endTime);
/**
* 编辑班组任务
* @param gasClassGroupTask
*/
void editGroupTask(BsGasClassGroupTask gasClassGroupTask);
/**
* 根据id查询详情
* @param groupTaskId
* @return
*/
BsGasClassGroupTask getDetailById(Long groupTaskId);
/**
* 查询班组任务列表
* @param param
* @return
*/
List<BsGasClassGroupTask> getGroupTaskList(Map<String, Object> param);
/**
* 跟油站 获取当前班组任务
* @param merId
* @return
*/
BsGasClassGroupTask getCurrentTaskByMerId(Long merId);
}

@ -0,0 +1,81 @@
package com.hfkj.service.gas.impl;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.dao.BsGasClassGroupMapper;
import com.hfkj.entity.BsGasClassGroup;
import com.hfkj.entity.BsGasClassGroupExample;
import com.hfkj.service.gas.BsGasClassGroupService;
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 BsGasClassGroupServiceImpl implements BsGasClassGroupService {
@Resource
private BsGasClassGroupMapper gasClassGroupMapper;
@Override
public void editGroup(BsGasClassGroup 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) {
BsGasClassGroup classGroup = getDetailById(groupId);
if (classGroup == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到班组");
}
classGroup.setStatus(0);
editGroup(classGroup);
}
@Override
public BsGasClassGroup getDetailById(Long groupId) {
return gasClassGroupMapper.selectByPrimaryKey(groupId);
}
@Override
public List<BsGasClassGroup> getGroupList(Map<String, Object> param) {
BsGasClassGroupExample example = new BsGasClassGroupExample();
BsGasClassGroupExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(0);
if (MapUtils.getLong(param, "merId") != null) {
criteria.andMerIdEqualTo(MapUtils.getLong(param, "merId"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "merName"))) {
criteria.andMerNameLike("%" + MapUtils.getString(param, "merName") + "%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "name"))) {
criteria.andNameLike("%" + MapUtils.getString(param, "name") + "%");
}
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,223 @@
package com.hfkj.service.gas.impl;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.config.SpPrinterConfig;
import com.hfkj.config.SpPrinterTemplate;
import com.hfkj.dao.BsGasClassGroupTaskMapper;
import com.hfkj.entity.*;
import com.hfkj.model.GasClassGroupTaskDataCount;
import com.hfkj.model.GasClassGroupTaskOilCount;
import com.hfkj.service.BsDeviceService;
import com.hfkj.service.BsMerchantService;
import com.hfkj.service.gas.BsGasClassGroupService;
import com.hfkj.service.gas.BsGasClassGroupTaskService;
import com.hfkj.sysenum.DeviceTypeEnum;
import com.hfkj.sysenum.gas.GasClassGroupTaskStatus;
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 BsGasClassGroupTaskServiceImpl implements BsGasClassGroupTaskService {
@Resource
private BsGasClassGroupTaskMapper gasClassGroupTaskMapper;
@Resource
private BsGasClassGroupService gasClassGroupService;
@Resource
private BsMerchantService merchantService;
@Resource
private BsDeviceService deviceService;
/* @Resource
private MqttProviderConfig mqttProviderConfig;*/
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void startGroupTask(Long gasId, Long gasClassGroupId) {
// 查询加油站
BsMerchant merchant = merchantService.getMerchant(gasId);
if (merchant == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到加油站信息");
}
// 查询进行中的任务
Map<String, Object> param = new HashMap<>();
param.put("merchantStoreId", merchant.getId());
param.put("status", GasClassGroupTaskStatus.status1.getStatus());
List<BsGasClassGroupTask> list = getGroupTaskList(param);
if (!list.isEmpty()) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已有班组正在进行中,请结束班组或交换班组");
}
// 查询班组信息
BsGasClassGroup group = gasClassGroupService.getDetailById(gasClassGroupId);
if (group == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到班组信息");
}
BsGasClassGroupTask groupTask = new BsGasClassGroupTask();
groupTask.setGasClassGroupId(group.getId());
groupTask.setGasClassGroupName(group.getName());
groupTask.setMerId(merchant.getId());
groupTask.setMerName(merchant.getMerName());
groupTask.setStartTime(new Date());
groupTask.setClassNum(gasClassGroupTaskMapper.getLatestClassNum(merchant.getId()) + 1);
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<BsGasClassGroupTask> list = getGroupTaskList(param);
if (!list.isEmpty()) {
BsGasClassGroupTask groupTask = list.get(0);
groupTask.setEndTime(new Date());
groupTask.setStatus(GasClassGroupTaskStatus.status2.getStatus());
// 统计
GasClassGroupTaskDataCount dataCount = countGroupTaskData(gasId, groupTask.getClassNum(), groupTask.getId(), groupTask.getStatus(), groupTask.getStartTime(), groupTask.getEndTime());
groupTask.setDataCount(JSONObject.toJSONString(dataCount));
editGroupTask(groupTask);
// 查询加油站打印机
List<BsDevice> deviceList = deviceService.getDeviceByMer(gasId);
for (BsDevice device : deviceList) {
if (device.getType().equals(DeviceTypeEnum.type1.getType())) {
new Thread(() -> {
try {
// 推送打印机
SpPrinterConfig spPrinterConfig = new SpPrinterConfig();
spPrinterConfig.print(device.getDeviceSn(), SpPrinterTemplate.classGroupCountTemp(dataCount, false), 1);
} catch (Exception e) {
e.printStackTrace();
}
}).start();
}
}
}
}
@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, Integer classNum, Long groupTaskId, Integer status, Date startTime, Date endTime) {
GasClassGroupTaskDataCount dataCount = new GasClassGroupTaskDataCount();
dataCount.setClassNum(classNum);
dataCount.setStatus(status);
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, "refundNum"));
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.setOilNo(MapUtils.getInteger(oilData, "oilNo"));
oilCount.setRefuelPrice(new BigDecimal(MapUtils.getString(oilData, "refuelPrice")));
oilCount.setRefuelNum(MapUtils.getInteger(oilData, "refuelNum"));
oilCount.setRefuelLiters(new BigDecimal(MapUtils.getString(oilData, "refuelLiters")));
oilCountList.add(oilCount);
}
dataCount.setGroupTaskOilCountList(oilCountList);
return dataCount;
}
@Override
public void editGroupTask(BsGasClassGroupTask 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 BsGasClassGroupTask getDetailById(Long groupTaskId) {
return gasClassGroupTaskMapper.selectByPrimaryKey(groupTaskId);
}
@Override
public List<BsGasClassGroupTask> getGroupTaskList(Map<String, Object> param) {
BsGasClassGroupTaskExample example = new BsGasClassGroupTaskExample();
BsGasClassGroupTaskExample.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, "merId") != null) {
criteria.andMerIdEqualTo(MapUtils.getLong(param, "merId"));
}
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);
}
@Override
public BsGasClassGroupTask getCurrentTaskByMerId(Long merId) {
BsGasClassGroupTaskExample example = new BsGasClassGroupTaskExample();
example.createCriteria()
.andMerIdEqualTo(merId)
.andStatusEqualTo(GasClassGroupTaskStatus.status1.getStatus());
List<BsGasClassGroupTask> list = gasClassGroupTaskMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
}

@ -95,7 +95,7 @@ public class BsGasOilPriceOfficialServiceImpl implements BsGasOilPriceOfficialSe
heardParam.put("Authorization", "APPCODE d7fb8449b8424fdbb60f01f53a04ce90");
JSONObject dataObject = HttpsUtils.doGet("http://ali-todayoil.showapi.com/todayoil", new HashMap<>(), heardParam);
if (dataObject.getInteger("showapi_res_code").equals(0)) {
/* if (dataObject.getInteger("showapi_res_code").equals(0)) {
JSONObject resBody = dataObject.getJSONObject("showapi_res_body");
JSONArray oilArray = resBody.getJSONArray("list");
@ -126,7 +126,7 @@ public class BsGasOilPriceOfficialServiceImpl implements BsGasOilPriceOfficialSe
}
}
}
}*/
}
@Override

@ -37,6 +37,14 @@ public class BsDeviceServiceImpl implements BsDeviceService {
return deviceMapper.selectByPrimaryKey(deviceId);
}
@Override
public List<BsDevice> getDeviceByMer(Long merId) {
BsDeviceExample example = new BsDeviceExample();
example.createCriteria().andMerIdEqualTo(merId).andStatusNotEqualTo(0);
example.setOrderByClause("create_time desc");
return deviceMapper.selectByExample(example);
}
@Override
public List<BsDevice> getDeviceList(Map<String, Object> param) {
BsDeviceExample example = new BsDeviceExample();

@ -71,6 +71,7 @@ public class BsMerchantServiceImpl implements BsMerchantService {
secUser.setPassword(MD5Util.encode("123456".getBytes()));
secUser.setObjectType(SecUserObjectTypeEnum.type2.getCode());
secUser.setObjectId(merchant.getId());
secUser.setRoleId(3L);
secUser.setStatus(1);
secUser.setCreateTime(new Date());
secUser.setUpdateTime(new Date());

@ -8,6 +8,8 @@ import com.alicp.jetcache.anno.CreateCache;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.common.utils.RedisUtil;
import com.hfkj.dao.SecDictionaryMapper;
import com.hfkj.dao.SecRegionMapper;
import com.hfkj.entity.SecDictionary;
@ -38,11 +40,15 @@ public class CommonServiceImpl implements CommonService {
@Resource
private SecRegionMapper regionMapper;
@Resource
private RedisUtil redisUtil;
@Resource
private SecDictionaryMapper dicMapper;
private Map<String, Map<String, SecDictionary>> dicCache = new HashMap<String,Map<String, SecDictionary>>();
@CreateCache(name = "cities:", cacheType = CacheType.REMOTE)
private Cache<Long, SecRegion> citiesCache;
@CreateCache(name = "region:", cacheType = CacheType.REMOTE)
@ -53,11 +59,30 @@ public class CommonServiceImpl implements CommonService {
private Cache<Long,List<SecRegion>> communityCache;
@CreateCache(name = "regionSingle:", cacheType = CacheType.REMOTE)
private Cache<Long, SecRegion> singleRegionCache;
@Override
public Map<String,Map<String, SecDictionary>> getDictionaries() {
refreshDic();
return dicCache;
public Map<String, List<SecDictionary>> getDictionaries() {
Object dictionary = redisUtil.get("SEC_DICTIONARY");
if (dictionary == null) {
Map<String,List<SecDictionary>> secDictionaryCache = new HashMap<>();
SecDictionaryExample example = new SecDictionaryExample();
example.createCriteria().andStatusEqualTo(1);
example.setOrderByClause(" sort_id asc ");
List<SecDictionary> dicList = dicMapper.selectByExample(example);
for(SecDictionary dic : dicList) {
List<SecDictionary> dictionaries = secDictionaryCache.get(dic.getCodeType());
if(dictionaries != null) {
List<SecDictionary> list = secDictionaryCache.get(dic.getCodeType());
list.add(dic);
} else {
List<SecDictionary> list = new ArrayList<>();
list.add(dic);
secDictionaryCache.put(dic.getCodeType(), list);
}
}
return secDictionaryCache;
}
return (Map<String, List<SecDictionary>>)dictionary;
}
/**
@ -117,26 +142,6 @@ public class CommonServiceImpl implements CommonService {
return sd;
}
@Override
public SecDictionary mappingSysName(String codeType, String codeName) {
refreshDic();
if(StringUtils.isBlank(codeType)){
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
Map<String, SecDictionary> m = dicCache.get(codeType);
if (null == m) {
return null;
}
for(Map.Entry<String, SecDictionary> entry : m.entrySet()){
String mapKey = entry.getKey();
SecDictionary mapValue = entry.getValue();
if (mapValue.getCodeName().equals(codeName)) {
return mapValue;
}
}
return null;
}
/**
* 根据codeType获取该类的所有字典数据
*
@ -253,15 +258,16 @@ public class CommonServiceImpl implements CommonService {
example.createCriteria().andStatusEqualTo(1).andParentIdIsNull();
return regionMapper.selectByExample(example);
}
private void refreshRegion(){
if (System.currentTimeMillis() - regionLastReadTime < READ_STEP) {
return;
}
if (regionLock.isLocked()) { //说明有线程已经在刷数据了
if (null != dicCache && dicCache.size() > 0) { //如果有数据说明已经初始化过了,直接返回老数据
private void refreshRegion() {
if (regionsCache.get(500000L) != null) {
return;
}
if (regionLock.isLocked()) { // 说明有线程已经在刷数据了
if (null != regionsCache) { //如果有数据说明已经初始化过了,直接返回老数据
return;
}
while (null == dicCache || dicCache.size()<1) { //说明初始化刷数据 等待10毫秒
while (null == regionsCache) { //说明初始化刷数据 等待10毫秒
try {
Thread.sleep(10);
//此处是否需要添加一个超时机制?
@ -283,7 +289,6 @@ public class CommonServiceImpl implements CommonService {
}
}
}
private void getRegionFromDB(){
SecRegionExample example = new SecRegionExample();
example.createCriteria().andStatusEqualTo(1).andParentIdIsNull();
@ -309,37 +314,6 @@ public class CommonServiceImpl implements CommonService {
}
regionLastReadTime = System.currentTimeMillis();
}
/* private void getRegionFromDB(){
SecRegionExample example = new SecRegionExample();
example.createCriteria().andStatusEqualTo(1).andParentIdIsNull();
citiesCache = regionMapper.selectByExample(example);
for(SecRegion city : citiesCache){//市
singleRegionCache.put(city.getRegionId(), city);
List<SecRegion> regions = getRegions(city.getRegionId());
regionsCache.put(city.getRegionId(),regions);
for(SecRegion region : regions){//区
singleRegionCache.put(region.getRegionId(), region);
List<SecRegion> streets = getRegions(region.getRegionId());
streetCache.put(region.getRegionId(), streets);
for(SecRegion street : streets){
singleRegionCache.put(street.getRegionId(), street);
List<SecRegion> communities = getRegions(street.getRegionId());
communityCache.put(street.getRegionId(),communities);
for (SecRegion community : communities){
singleRegionCache.put(community.getRegionId(),community);
}
}
}
}
regionLastReadTime = System.currentTimeMillis();
}*/
@Override
public List<SecRegion> getProvinceList() {
SecRegionExample example = new SecRegionExample();
example.createCriteria().andParentIdIsNull().andStatusEqualTo(1);
return regionMapper.selectByExample(example);
}
private List<SecRegion> getRegions(Long parentId) {
SecRegionExample example = new SecRegionExample();
@ -422,28 +396,6 @@ public class CommonServiceImpl implements CommonService {
return regionMapper.selectByPrimaryKey(regionId);
}
@Override
public List<SecRegion> findByName(String name) {
SecRegionExample example = new SecRegionExample();
example.createCriteria().andStatusEqualTo(1).andRegionNameEqualTo(name);
return regionMapper.selectByExample(example);
}
@Override
public SecRegion getParentByRegion(Long regionId) {
SecRegion secRegion = getRegionsById(regionId);
if (secRegion != null && secRegion.getParentId() != null) {
while (true) {
secRegion = getRegionsById(secRegion.getParentId());
if (secRegion.getParentId() == null) {
return secRegion;
}
}
}
return secRegion;
}
@Override
public Boolean findValue(String codeType, String codeValue) {
SecDictionaryExample example = new SecDictionaryExample();
@ -460,22 +412,4 @@ public class CommonServiceImpl implements CommonService {
example.createCriteria().andCodeTypeEqualTo(codeType);
return dicMapper.selectByExample(example);
}
@Override
public void updateDictionary(SecDictionary secDictionary) {
dicMapper.updateByPrimaryKeySelective(secDictionary);
}
@Override
public SecRegion getRegionsByName(String regionName) {
SecRegionExample example = new SecRegionExample();
example.createCriteria().andRegionNameLike("%" + regionName + "%");
List<SecRegion> list = regionMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
}

@ -0,0 +1,36 @@
package com.hfkj.sysenum.gas;
/**
* 加油站员工状态
* @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;
}
}
Loading…
Cancel
Save