main
parent
02d6ac5a96
commit
c1bca2d667
@ -0,0 +1,238 @@ |
|||||||
|
package com.bweb.controller.item; |
||||||
|
|
||||||
|
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.EnItem; |
||||||
|
import com.hfkj.model.ResponseData; |
||||||
|
import com.hfkj.model.SecUserSessionObject; |
||||||
|
import com.hfkj.service.item.EnItemService; |
||||||
|
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.Date; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@Controller |
||||||
|
@RequestMapping(value="/enItem") |
||||||
|
@Api(value="项目管理") |
||||||
|
public class EnItemController { |
||||||
|
|
||||||
|
Logger log = LoggerFactory.getLogger(EnItemController.class); |
||||||
|
@Resource |
||||||
|
private UserCenter userCenter; |
||||||
|
@Resource |
||||||
|
private EnItemService enItemService; |
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value="/create",method = RequestMethod.POST) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "创建项目") |
||||||
|
public ResponseData create(@RequestBody EnItem body) { |
||||||
|
try { |
||||||
|
if (body == null |
||||||
|
|| StringUtils.isBlank(body.getContactInfo()) |
||||||
|
|| StringUtils.isBlank(body.getProjectAddress()) |
||||||
|
|| StringUtils.isBlank(body.getProjectLeader()) |
||||||
|
|| StringUtils.isBlank(body.getProjectName()) |
||||||
|
) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||||
|
} |
||||||
|
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||||
|
if (sessionModel == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
|
||||||
|
body.setUpdateTime(new Date()); |
||||||
|
body.setCreateTime(new Date()); |
||||||
|
body.setCreateUser(sessionModel.getAccount().getId()); |
||||||
|
body.setStatus(2); |
||||||
|
body.setCreateUserName(sessionModel.getAccount().getUserName()); |
||||||
|
enItemService.create(body); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success("操作成功"); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/update",method = RequestMethod.POST) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "修改项目") |
||||||
|
public ResponseData update(@RequestBody EnItem body) { |
||||||
|
try { |
||||||
|
if (body == null |
||||||
|
|| body.getId() == null |
||||||
|
|| StringUtils.isBlank(body.getContactInfo()) |
||||||
|
|| StringUtils.isBlank(body.getProjectAddress()) |
||||||
|
|| StringUtils.isBlank(body.getProjectLeader()) |
||||||
|
|| StringUtils.isBlank(body.getProjectName()) |
||||||
|
) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||||
|
} |
||||||
|
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||||
|
if (sessionModel == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
|
||||||
|
Map<String , Object > map = new HashMap<>(); |
||||||
|
|
||||||
|
map.put("id",body.getId()); |
||||||
|
map.put("createUser" , sessionModel.getAccount().getId()); |
||||||
|
|
||||||
|
EnItem enItem = enItemService.queryDetailByMap(map); |
||||||
|
if (enItem == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "项目不存在"); |
||||||
|
} |
||||||
|
|
||||||
|
enItem.setContactInfo(body.getContactInfo()); |
||||||
|
enItem.setProjectAddress(body.getProjectAddress()); |
||||||
|
enItem.setProjectLeader(body.getProjectLeader()); |
||||||
|
enItem.setProjectName(body.getProjectName()); |
||||||
|
enItem.setUpdateTime(new Date()); |
||||||
|
enItem.setUpdateUser(sessionModel.getAccount().getId()); |
||||||
|
enItem.setUpdateUserName(sessionModel.getAccount().getUserName()); |
||||||
|
enItemService.update(enItem); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success("操作成功"); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/updateStatus",method = RequestMethod.POST) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "修改状态") |
||||||
|
public ResponseData updateStatus(@RequestBody EnItem body) { |
||||||
|
try { |
||||||
|
if (body == null |
||||||
|
|| body.getId() == null |
||||||
|
|| body.getStatus() == null |
||||||
|
) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||||
|
} |
||||||
|
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||||
|
if (sessionModel == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
|
||||||
|
Map<String , Object > map = new HashMap<>(); |
||||||
|
|
||||||
|
map.put("id",body.getId()); |
||||||
|
map.put("createUser" , sessionModel.getAccount().getId()); |
||||||
|
|
||||||
|
EnItem enItem = enItemService.queryDetailByMap(map); |
||||||
|
if (enItem == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "项目不存在"); |
||||||
|
} |
||||||
|
|
||||||
|
enItem.setStatus(body.getStatus()); |
||||||
|
enItem.setUpdateTime(new Date()); |
||||||
|
enItem.setUpdateUser(sessionModel.getAccount().getId()); |
||||||
|
enItem.setUpdateUserName(sessionModel.getAccount().getUserName()); |
||||||
|
enItemService.update(enItem); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success("操作成功"); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/deleteItem",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "删除") |
||||||
|
public ResponseData deleteGoods(@RequestParam(value = "id" , required = false) Long id) { |
||||||
|
try { |
||||||
|
|
||||||
|
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||||
|
if (sessionModel == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
|
||||||
|
Map<String , Object > map = new HashMap<>(); |
||||||
|
|
||||||
|
map.put("id",id); |
||||||
|
map.put("createUser" , sessionModel.getAccount().getId()); |
||||||
|
|
||||||
|
EnItem enItem = enItemService.queryDetailByMap(map); |
||||||
|
if (enItem == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "项目不存在"); |
||||||
|
} |
||||||
|
|
||||||
|
enItemService.delete(id , false); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success("删除成功"); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value="/queryDetail",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "查询详情") |
||||||
|
public ResponseData queryDetail(@RequestParam(value = "id" , required = false) Long id) { |
||||||
|
try { |
||||||
|
|
||||||
|
return ResponseMsgUtil.success(enItemService.queryDetail(id)); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/queryList",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "查询项目列表") |
||||||
|
public ResponseData queryList(@RequestParam(value = "contactInfo" , required = false) String contactInfo, |
||||||
|
@RequestParam(value = "projectAddress" , required = false) String projectAddress, |
||||||
|
@RequestParam(value = "status" , required = false) Integer status, |
||||||
|
@RequestParam(value = "projectLeader" , required = false) String projectLeader, |
||||||
|
@RequestParam(value = "projectName" , required = false) String projectName, |
||||||
|
@RequestParam(value = "pageNum" , required = true) Integer pageNum, |
||||||
|
@RequestParam(value = "pageSize" , required = true) Integer pageSize) { |
||||||
|
try { |
||||||
|
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||||
|
if (sessionModel == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
|
||||||
|
Map<String,Object> param = new HashMap<>(); |
||||||
|
param.put("contactInfo", contactInfo); |
||||||
|
param.put("projectAddress", projectAddress); |
||||||
|
param.put("projectLeader", projectLeader); |
||||||
|
param.put("projectName", projectName); |
||||||
|
param.put("status", status); |
||||||
|
param.put("createUser", sessionModel.getAccount().getId()); |
||||||
|
|
||||||
|
PageHelper.startPage(pageNum, pageSize); |
||||||
|
return ResponseMsgUtil.success(new PageInfo<>(enItemService.getList(param))); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,262 @@ |
|||||||
|
package com.bweb.controller.item; |
||||||
|
|
||||||
|
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.MathConfig; |
||||||
|
import com.hfkj.entity.EnItem; |
||||||
|
import com.hfkj.entity.EnItemSegments; |
||||||
|
import com.hfkj.entity.EnOilDepots; |
||||||
|
import com.hfkj.model.ResponseData; |
||||||
|
import com.hfkj.model.SecUserSessionObject; |
||||||
|
import com.hfkj.service.item.EnItemSegmentsService; |
||||||
|
import com.hfkj.service.item.EnOilDepotsService; |
||||||
|
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.math.BigDecimal; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@Controller |
||||||
|
@RequestMapping(value="/enItemSegments") |
||||||
|
@Api(value="项目段管理") |
||||||
|
public class EnItemSegmentsController { |
||||||
|
|
||||||
|
Logger log = LoggerFactory.getLogger(EnItemController.class); |
||||||
|
@Resource |
||||||
|
private UserCenter userCenter; |
||||||
|
@Resource |
||||||
|
private EnItemSegmentsService enItemSegmentsService; |
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value="/create",method = RequestMethod.POST) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "创建项目段") |
||||||
|
public ResponseData create(@RequestBody EnItemSegments body) { |
||||||
|
try { |
||||||
|
if (body == null |
||||||
|
|| body.getItemId() == null |
||||||
|
|| body.getOilDepotId() == null |
||||||
|
|| body.getLatitude() == null |
||||||
|
|| body.getLongitude() == null |
||||||
|
|| StringUtils.isBlank(body.getContactInfo()) |
||||||
|
|| StringUtils.isBlank(body.getAddress()) |
||||||
|
|| StringUtils.isBlank(body.getSegmentName()) |
||||||
|
|| StringUtils.isBlank(body.getPerson()) |
||||||
|
) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||||
|
} |
||||||
|
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||||
|
|
||||||
|
if (sessionModel == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
|
||||||
|
body.setUpdateTime(new Date()); |
||||||
|
body.setCreateTime(new Date()); |
||||||
|
body.setCreateUser(sessionModel.getAccount().getId()); |
||||||
|
body.setStatus(2); |
||||||
|
body.setCreateUserName(sessionModel.getAccount().getUserName()); |
||||||
|
enItemSegmentsService.create(body); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success("操作成功"); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/update",method = RequestMethod.POST) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "修改油库") |
||||||
|
public ResponseData update(@RequestBody EnItemSegments body) { |
||||||
|
try { |
||||||
|
if (body == null |
||||||
|
|| body.getId() == null |
||||||
|
|| body.getItemId() == null |
||||||
|
|| body.getOilDepotId() == null |
||||||
|
|| body.getLatitude() == null |
||||||
|
|| body.getLongitude() == null |
||||||
|
|| StringUtils.isBlank(body.getContactInfo()) |
||||||
|
|| StringUtils.isBlank(body.getAddress()) |
||||||
|
|| StringUtils.isBlank(body.getSegmentName()) |
||||||
|
|| StringUtils.isBlank(body.getPerson()) |
||||||
|
) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||||
|
} |
||||||
|
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||||
|
|
||||||
|
if (sessionModel == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
Map<String , Object > map = new HashMap<>(); |
||||||
|
|
||||||
|
map.put("id",body.getId()); |
||||||
|
map.put("createUser" , sessionModel.getAccount().getId()); |
||||||
|
|
||||||
|
EnItemSegments enItemSegments = enItemSegmentsService.queryDetailByMap(map); |
||||||
|
|
||||||
|
if (enItemSegments == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "项目段不存在"); |
||||||
|
} |
||||||
|
|
||||||
|
enItemSegments.setItemId(body.getItemId()); |
||||||
|
enItemSegments.setOilDepotId(body.getOilDepotId()); |
||||||
|
enItemSegments.setLatitude(body.getLatitude()); |
||||||
|
enItemSegments.setLongitude(body.getLongitude()); |
||||||
|
enItemSegments.setContactInfo(body.getContactInfo()); |
||||||
|
enItemSegments.setAddress(body.getAddress()); |
||||||
|
enItemSegments.setSegmentName(body.getSegmentName()); |
||||||
|
enItemSegments.setPerson(body.getPerson()); |
||||||
|
enItemSegments.setUpdateTime(new Date()); |
||||||
|
enItemSegments.setUpdateTime(new Date()); |
||||||
|
enItemSegments.setUpdateUser(sessionModel.getAccount().getId()); |
||||||
|
enItemSegments.setUpdateUserName(sessionModel.getAccount().getUserName()); |
||||||
|
enItemSegmentsService.update(enItemSegments); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success("操作成功"); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/updateStatus",method = RequestMethod.POST) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "修改状态") |
||||||
|
public ResponseData updateStatus(@RequestBody EnItem body) { |
||||||
|
try { |
||||||
|
if (body == null |
||||||
|
|| body.getId() == null |
||||||
|
|| body.getStatus() == null |
||||||
|
) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||||
|
} |
||||||
|
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||||
|
if (sessionModel == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
|
||||||
|
Map<String , Object > map = new HashMap<>(); |
||||||
|
|
||||||
|
map.put("id",body.getId()); |
||||||
|
map.put("createUser" , sessionModel.getAccount().getId()); |
||||||
|
|
||||||
|
EnItemSegments enItemSegments = enItemSegmentsService.queryDetailByMap(map); |
||||||
|
|
||||||
|
if (enItemSegments == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "项目段不存在"); |
||||||
|
} |
||||||
|
|
||||||
|
enItemSegments.setStatus(body.getStatus()); |
||||||
|
enItemSegments.setUpdateTime(new Date()); |
||||||
|
enItemSegments.setUpdateUser(sessionModel.getAccount().getId()); |
||||||
|
enItemSegments.setUpdateUserName(sessionModel.getAccount().getUserName()); |
||||||
|
enItemSegmentsService.update(enItemSegments); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success("操作成功"); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value="/deleteItem",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "删除") |
||||||
|
public ResponseData deleteGoods(@RequestParam(value = "id" , required = false) Long id) { |
||||||
|
try { |
||||||
|
|
||||||
|
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||||
|
if (sessionModel == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
|
||||||
|
Map<String , Object > map = new HashMap<>(); |
||||||
|
|
||||||
|
map.put("id",id); |
||||||
|
map.put("createUser" , sessionModel.getAccount().getId()); |
||||||
|
|
||||||
|
EnItemSegments enItemSegments = enItemSegmentsService.queryDetailByMap(map); |
||||||
|
if (enItemSegments == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "油库不存在"); |
||||||
|
} |
||||||
|
|
||||||
|
enItemSegmentsService.delete(id , false); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success("删除成功"); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value="/queryDetail",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "查询详情") |
||||||
|
public ResponseData queryDetail(@RequestParam(value = "id" , required = false) Long id) { |
||||||
|
try { |
||||||
|
|
||||||
|
return ResponseMsgUtil.success(enItemSegmentsService.queryDetail(id)); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/queryList",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "查询项目列表") |
||||||
|
public ResponseData queryList(@RequestParam(value = "itemId" , required = false) Long itemId, |
||||||
|
@RequestParam(value = "oilDepotId" , required = false) Long oilDepotId, |
||||||
|
@RequestParam(value = "segmentName" , required = false) String segmentName, |
||||||
|
@RequestParam(value = "address" , required = false) String address, |
||||||
|
@RequestParam(value = "status" , required = false) Integer status, |
||||||
|
@RequestParam(value = "person" , required = false) String person, |
||||||
|
@RequestParam(value = "contactInfo" , required = false) String contactInfo, |
||||||
|
@RequestParam(value = "pageNum" , required = true) Integer pageNum, |
||||||
|
@RequestParam(value = "pageSize" , required = true) Integer pageSize) { |
||||||
|
try { |
||||||
|
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||||
|
if (sessionModel == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
|
||||||
|
Map<String,Object> param = new HashMap<>(); |
||||||
|
param.put("contactInfo", contactInfo); |
||||||
|
param.put("itemId", itemId); |
||||||
|
param.put("oilDepotId", oilDepotId); |
||||||
|
param.put("segmentName", segmentName); |
||||||
|
param.put("person", person); |
||||||
|
param.put("status", status); |
||||||
|
param.put("createUser", sessionModel.getAccount().getId()); |
||||||
|
|
||||||
|
PageHelper.startPage(pageNum, pageSize); |
||||||
|
return ResponseMsgUtil.success(new PageInfo<>(enItemSegmentsService.getList(param))); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,260 @@ |
|||||||
|
package com.bweb.controller.item; |
||||||
|
|
||||||
|
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.MathConfig; |
||||||
|
import com.hfkj.entity.EnItem; |
||||||
|
import com.hfkj.entity.EnOilDepots; |
||||||
|
import com.hfkj.model.ResponseData; |
||||||
|
import com.hfkj.model.SecUserSessionObject; |
||||||
|
import com.hfkj.service.item.EnOilDepotsService; |
||||||
|
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.math.BigDecimal; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@Controller |
||||||
|
@RequestMapping(value="/enOilDepots") |
||||||
|
@Api(value="项目油管管理") |
||||||
|
public class EnOilDepotsController { |
||||||
|
|
||||||
|
Logger log = LoggerFactory.getLogger(EnOilDepotsController.class); |
||||||
|
@Resource |
||||||
|
private UserCenter userCenter; |
||||||
|
@Resource |
||||||
|
private EnOilDepotsService enOilDepotsService; |
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value="/create",method = RequestMethod.POST) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "创建油库") |
||||||
|
public ResponseData create(@RequestBody EnOilDepots body) { |
||||||
|
try { |
||||||
|
if (body == null |
||||||
|
|| body.getItemId() == null |
||||||
|
|| body.getLatitude() == null |
||||||
|
|| body.getLongitude() == null |
||||||
|
|| body.getWarningLevel() == null |
||||||
|
|| StringUtils.isBlank(body.getContactInfo()) |
||||||
|
|| StringUtils.isBlank(body.getOilDepotName()) |
||||||
|
|| StringUtils.isBlank(body.getContactPerson()) |
||||||
|
) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||||
|
} |
||||||
|
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||||
|
|
||||||
|
if (sessionModel == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
|
||||||
|
body.setUpdateTime(new Date()); |
||||||
|
body.setOilDepotNo(MathConfig.generateEncoding(9)); |
||||||
|
body.setCreateTime(new Date()); |
||||||
|
body.setCreateUser(sessionModel.getAccount().getId()); |
||||||
|
body.setStatus(2); |
||||||
|
body.setCapacity(BigDecimal.ZERO); |
||||||
|
body.setCurrentStock(BigDecimal.ZERO); |
||||||
|
body.setCreateUserName(sessionModel.getAccount().getUserName()); |
||||||
|
enOilDepotsService.create(body); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success("操作成功"); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/update",method = RequestMethod.POST) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "修改油库") |
||||||
|
public ResponseData update(@RequestBody EnOilDepots body) { |
||||||
|
try { |
||||||
|
if (body == null |
||||||
|
|| body.getId() == null |
||||||
|
|| body.getItemId() == null |
||||||
|
|| body.getLatitude() == null |
||||||
|
|| body.getLongitude() == null |
||||||
|
|| body.getWarningLevel() == null |
||||||
|
|| StringUtils.isBlank(body.getContactInfo()) |
||||||
|
|| StringUtils.isBlank(body.getOilDepotName()) |
||||||
|
|| StringUtils.isBlank(body.getContactPerson()) |
||||||
|
) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||||
|
} |
||||||
|
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||||
|
|
||||||
|
if (sessionModel == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
Map<String , Object > map = new HashMap<>(); |
||||||
|
|
||||||
|
map.put("id",body.getId()); |
||||||
|
map.put("createUser" , sessionModel.getAccount().getId()); |
||||||
|
|
||||||
|
EnOilDepots enOilDepots = enOilDepotsService.queryDetailByMap(map); |
||||||
|
|
||||||
|
if (enOilDepots == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "油库不存在"); |
||||||
|
} |
||||||
|
|
||||||
|
enOilDepots.setItemId(body.getItemId()); |
||||||
|
enOilDepots.setLatitude(body.getLatitude()); |
||||||
|
enOilDepots.setLongitude(body.getLongitude()); |
||||||
|
enOilDepots.setContactInfo(body.getContactInfo()); |
||||||
|
enOilDepots.setWarningLevel(body.getWarningLevel()); |
||||||
|
enOilDepots.setOilDepotName(body.getOilDepotName()); |
||||||
|
enOilDepots.setContactPerson(body.getContactPerson()); |
||||||
|
enOilDepots.setUpdateTime(new Date()); |
||||||
|
enOilDepots.setUpdateTime(new Date()); |
||||||
|
enOilDepots.setUpdateUser(sessionModel.getAccount().getId()); |
||||||
|
enOilDepots.setUpdateUserName(sessionModel.getAccount().getUserName()); |
||||||
|
enOilDepotsService.update(enOilDepots); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success("操作成功"); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/updateStatus",method = RequestMethod.POST) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "修改状态") |
||||||
|
public ResponseData updateStatus(@RequestBody EnItem body) { |
||||||
|
try { |
||||||
|
if (body == null |
||||||
|
|| body.getId() == null |
||||||
|
|| body.getStatus() == null |
||||||
|
) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||||
|
} |
||||||
|
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||||
|
if (sessionModel == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
|
||||||
|
Map<String , Object > map = new HashMap<>(); |
||||||
|
|
||||||
|
map.put("id",body.getId()); |
||||||
|
map.put("createUser" , sessionModel.getAccount().getId()); |
||||||
|
|
||||||
|
EnOilDepots enOilDepots = enOilDepotsService.queryDetailByMap(map); |
||||||
|
|
||||||
|
if (enOilDepots == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "油库不存在"); |
||||||
|
} |
||||||
|
|
||||||
|
enOilDepots.setStatus(body.getStatus()); |
||||||
|
enOilDepots.setUpdateTime(new Date()); |
||||||
|
enOilDepots.setUpdateUser(sessionModel.getAccount().getId()); |
||||||
|
enOilDepots.setUpdateUserName(sessionModel.getAccount().getUserName()); |
||||||
|
enOilDepotsService.update(enOilDepots); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success("操作成功"); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value="/deleteItem",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "删除") |
||||||
|
public ResponseData deleteGoods(@RequestParam(value = "id" , required = false) Long id) { |
||||||
|
try { |
||||||
|
|
||||||
|
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||||
|
if (sessionModel == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
|
||||||
|
Map<String , Object > map = new HashMap<>(); |
||||||
|
|
||||||
|
map.put("id",id); |
||||||
|
map.put("createUser" , sessionModel.getAccount().getId()); |
||||||
|
|
||||||
|
EnOilDepots enOilDepots = enOilDepotsService.queryDetailByMap(map); |
||||||
|
if (enOilDepots == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "油库不存在"); |
||||||
|
} |
||||||
|
|
||||||
|
enOilDepotsService.delete(id , false); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success("删除成功"); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value="/queryDetail",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "查询详情") |
||||||
|
public ResponseData queryDetail(@RequestParam(value = "id" , required = false) Long id) { |
||||||
|
try { |
||||||
|
|
||||||
|
return ResponseMsgUtil.success(enOilDepotsService.queryDetail(id)); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/queryList",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "查询项目列表") |
||||||
|
public ResponseData queryList(@RequestParam(value = "itemId" , required = false) Long itemId, |
||||||
|
@RequestParam(value = "oilDepotNo" , required = false) String oilDepotNo, |
||||||
|
@RequestParam(value = "oilDepotName" , required = false) String oilDepotName, |
||||||
|
@RequestParam(value = "status" , required = false) Integer status, |
||||||
|
@RequestParam(value = "contactPerson" , required = false) String contactPerson, |
||||||
|
@RequestParam(value = "contactInfo" , required = false) String contactInfo, |
||||||
|
@RequestParam(value = "pageNum" , required = true) Integer pageNum, |
||||||
|
@RequestParam(value = "pageSize" , required = true) Integer pageSize) { |
||||||
|
try { |
||||||
|
SecUserSessionObject sessionModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||||
|
if (sessionModel == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
|
||||||
|
Map<String,Object> param = new HashMap<>(); |
||||||
|
param.put("contactInfo", contactInfo); |
||||||
|
param.put("itemId", itemId); |
||||||
|
param.put("oilDepotNo", oilDepotNo); |
||||||
|
param.put("oilDepotName", oilDepotName); |
||||||
|
param.put("contactPerson", contactPerson); |
||||||
|
param.put("status", status); |
||||||
|
param.put("createUser", sessionModel.getAccount().getId()); |
||||||
|
|
||||||
|
PageHelper.startPage(pageNum, pageSize); |
||||||
|
return ResponseMsgUtil.success(new PageInfo<>(enOilDepotsService.getList(param))); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1,80 +0,0 @@ |
|||||||
package com.bweb.controller.student; |
|
||||||
|
|
||||||
import com.hfkj.common.exception.ErrorCode; |
|
||||||
import com.hfkj.common.exception.ErrorHelp; |
|
||||||
import com.hfkj.common.exception.SysCode; |
|
||||||
import com.hfkj.common.security.SessionObject; |
|
||||||
import com.hfkj.common.security.UserCenter; |
|
||||||
import com.hfkj.common.utils.ResponseMsgUtil; |
|
||||||
import com.hfkj.entity.StudentItem; |
|
||||||
import com.hfkj.model.ResponseData; |
|
||||||
import com.hfkj.service.student.StudentItemService; |
|
||||||
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.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.annotation.Resource; |
|
||||||
import java.util.Date; |
|
||||||
|
|
||||||
@RestController |
|
||||||
@RequestMapping(value="/studentItem") |
|
||||||
@Api(value="学生项目") |
|
||||||
public class StudentItemController { |
|
||||||
Logger log = LoggerFactory.getLogger(StudentItemController.class); |
|
||||||
@Resource |
|
||||||
private UserCenter userCenter; |
|
||||||
@Resource |
|
||||||
private StudentItemService studentItemService; |
|
||||||
|
|
||||||
@RequestMapping(value="/create",method = RequestMethod.POST) |
|
||||||
@ResponseBody |
|
||||||
@ApiOperation(value = "创建学生项目") |
|
||||||
public ResponseData create(@RequestBody StudentItem body) { |
|
||||||
try { |
|
||||||
if (body == null |
|
||||||
|| StringUtils.isBlank(body.getName()) |
|
||||||
|| body.getItemType() == null |
|
||||||
|| body.getGradeType() == null |
|
||||||
|| body.getSportsType() == null |
|
||||||
|
|
||||||
) { |
|
||||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
||||||
} |
|
||||||
SessionObject sessionModel = userCenter.getSessionModel(SessionObject.class); |
|
||||||
if (sessionModel == null) { |
|
||||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
|
||||||
} |
|
||||||
|
|
||||||
body.setCreateTime(new Date()); |
|
||||||
body.setUpdateTime(new Date()); |
|
||||||
studentItemService.create(body); |
|
||||||
|
|
||||||
return ResponseMsgUtil.success("操作成功"); |
|
||||||
|
|
||||||
} catch (Exception e) { |
|
||||||
log.error("error!",e); |
|
||||||
return ResponseMsgUtil.exception(e); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value="/delete",method = RequestMethod.GET) |
|
||||||
@ResponseBody |
|
||||||
@ApiOperation(value = "删除") |
|
||||||
public ResponseData delete(@RequestParam(value = "id" , required = false) Long id) { |
|
||||||
try { |
|
||||||
|
|
||||||
studentItemService.delete(id , false); |
|
||||||
|
|
||||||
return ResponseMsgUtil.success("删除成功"); |
|
||||||
|
|
||||||
} catch (Exception e) { |
|
||||||
log.error("error!",e); |
|
||||||
return ResponseMsgUtil.exception(e); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,10 @@ |
|||||||
|
package com.hfkj.config; |
||||||
|
|
||||||
|
public class MathConfig { |
||||||
|
|
||||||
|
public static String generateEncoding(int length) { |
||||||
|
long ts = System.currentTimeMillis(); |
||||||
|
int random = (int)(Math.random() * 1000); |
||||||
|
return (ts + "" + random).substring(0, length); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,67 @@ |
|||||||
|
package com.hfkj.service.item; |
||||||
|
|
||||||
|
import com.hfkj.entity.EnItemSegments; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
public interface EnItemSegmentsService { |
||||||
|
|
||||||
|
/** |
||||||
|
* @MethodName create |
||||||
|
* @Description: 创建 |
||||||
|
* @param enItemSegments |
||||||
|
* @Author: Sum1Dream |
||||||
|
* @Date: 2025/7/1 下午4:40 |
||||||
|
*/ |
||||||
|
void create(EnItemSegments enItemSegments); |
||||||
|
|
||||||
|
/** |
||||||
|
* @MethodName update |
||||||
|
* @Description: 更新 |
||||||
|
* @param enItemSegments |
||||||
|
* @Author: Sum1Dream |
||||||
|
* @Date: 2025/7/1 下午4:41 |
||||||
|
*/ |
||||||
|
void update(EnItemSegments enItemSegments); |
||||||
|
|
||||||
|
/** |
||||||
|
* @MethodName delete |
||||||
|
* @Description: 删除 |
||||||
|
* @param id |
||||||
|
* @param fullDelete |
||||||
|
* @Author: Sum1Dream |
||||||
|
* @Date: 2025/7/1 下午4:41 |
||||||
|
*/ |
||||||
|
void delete(Long id , Boolean fullDelete); |
||||||
|
|
||||||
|
/** |
||||||
|
* @MethodName queryDetail |
||||||
|
* @Description: 查询详情 |
||||||
|
* @param id |
||||||
|
* @return: com.hfkj.entity.EnItemSegments |
||||||
|
* @Author: Sum1Dream |
||||||
|
* @Date: 2025/7/1 下午4:41 |
||||||
|
*/ |
||||||
|
EnItemSegments queryDetail(Long id); |
||||||
|
|
||||||
|
/** |
||||||
|
* @MethodName queryDetailByMap |
||||||
|
* @Description: 根据map查询详情 |
||||||
|
* @param map |
||||||
|
* @return: com.hfkj.entity.EnItemSegments |
||||||
|
* @Author: Sum1Dream |
||||||
|
* @Date: 2025/7/1 下午4:41 |
||||||
|
*/ |
||||||
|
EnItemSegments queryDetailByMap(Map<String , Object> map); |
||||||
|
|
||||||
|
/** |
||||||
|
* @MethodName getList |
||||||
|
* @Description: 查询列表 |
||||||
|
* @param map |
||||||
|
* @return: java.util.List<com.hfkj.entity.EnItemSegments> |
||||||
|
* @Author: Sum1Dream |
||||||
|
* @Date: 2025/7/1 下午4:41 |
||||||
|
*/ |
||||||
|
List<EnItemSegments> getList(Map<String , Object> map); |
||||||
|
} |
@ -0,0 +1,70 @@ |
|||||||
|
package com.hfkj.service.item; |
||||||
|
|
||||||
|
import com.hfkj.entity.EnItem; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
public interface EnItemService { |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author Sum1Dream |
||||||
|
* @Name create |
||||||
|
* @Description // 创建
|
||||||
|
* @Date 15:12 2024/4/19 |
||||||
|
* @Param GoodsBrand |
||||||
|
* @return void |
||||||
|
*/ |
||||||
|
void create(EnItem enItem); |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author Sum1Dream |
||||||
|
* @Name update |
||||||
|
* @Description // 修改
|
||||||
|
* @Date 15:12 2024/4/19 |
||||||
|
* @Param GoodsBrand |
||||||
|
* @return void |
||||||
|
*/ |
||||||
|
void update(EnItem enItem); |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author Sum1Dream |
||||||
|
* @Name delete |
||||||
|
* @Description // 删除
|
||||||
|
* @Date 15:12 2024/4/19 |
||||||
|
* @Param id |
||||||
|
* @return void |
||||||
|
*/ |
||||||
|
void delete(Long id , Boolean fullDelete); |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author Sum1Dream |
||||||
|
* @Name queryDetail |
||||||
|
* @Description // 查询详情
|
||||||
|
* @Date 15:12 2024/4/19 |
||||||
|
* @Param id |
||||||
|
* @return com.hfkj.entity.GoodsBrand |
||||||
|
*/ |
||||||
|
EnItem queryDetail(Long id); |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author Sum1Dream |
||||||
|
* @Name queryDetailByMap |
||||||
|
* @Description // 根据多条件查询详情
|
||||||
|
* @Date 15:12 2024/4/19 |
||||||
|
* @Param map |
||||||
|
* @return com.hfkj.entity.GoodsBrand |
||||||
|
*/ |
||||||
|
EnItem queryDetailByMap(Map<String , Object> map); |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author Sum1Dream |
||||||
|
* @Name getList |
||||||
|
* @Description // 查询列表
|
||||||
|
* @Date 15:12 2024/4/19 |
||||||
|
* @Param map |
||||||
|
* @return java.util.List<com.hfkj.entity.GoodsBrand> |
||||||
|
*/ |
||||||
|
List<EnItem> getList(Map<String , Object> map); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,70 @@ |
|||||||
|
package com.hfkj.service.item; |
||||||
|
|
||||||
|
import com.hfkj.entity.EnOilDepots; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
public interface EnOilDepotsService { |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* @MethodName create |
||||||
|
* @Description: 新增 |
||||||
|
* @param enOilDepots |
||||||
|
* @Author: Sum1Dream |
||||||
|
* @Date: 2025/7/1 下午2:14 |
||||||
|
*/ |
||||||
|
void create(EnOilDepots enOilDepots); |
||||||
|
|
||||||
|
/** |
||||||
|
* @MethodName update |
||||||
|
* @Description: 修改 |
||||||
|
* @param enOilDepots |
||||||
|
* @Author: Sum1Dream |
||||||
|
* @Date: 2025/7/1 下午2:14 |
||||||
|
*/ |
||||||
|
void update(EnOilDepots enOilDepots); |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* @MethodName delete |
||||||
|
* @Description: 删除 |
||||||
|
* @param id |
||||||
|
* @param fullDelete |
||||||
|
* @Author: Sum1Dream |
||||||
|
* @Date: 2025/7/1 下午2:14 |
||||||
|
*/ |
||||||
|
void delete(Long id , Boolean fullDelete); |
||||||
|
|
||||||
|
/** |
||||||
|
* @MethodName queryDetail |
||||||
|
* @Description: 查询详情 |
||||||
|
* @param id |
||||||
|
* @return: com.hfkj.entity.EnOilDepots |
||||||
|
* @Author: Sum1Dream |
||||||
|
* @Date: 2025/7/1 下午2:15 |
||||||
|
*/ |
||||||
|
EnOilDepots queryDetail(Long id); |
||||||
|
|
||||||
|
/** |
||||||
|
* @MethodName queryDetailByMap |
||||||
|
* @Description: 根据map查询详情 |
||||||
|
* @param map |
||||||
|
* @return: com.hfkj.entity.EnOilDepots |
||||||
|
* @Author: Sum1Dream |
||||||
|
* @Date: 2025/7/1 下午2:16 |
||||||
|
*/ |
||||||
|
EnOilDepots queryDetailByMap(Map<String , Object> map); |
||||||
|
|
||||||
|
/** |
||||||
|
* @MethodName getList |
||||||
|
* @Description: 查询列表 |
||||||
|
* @param map |
||||||
|
* @return: java.util.List<com.hfkj.entity.EnOilDepots> |
||||||
|
* @Author: Sum1Dream |
||||||
|
* @Date: 2025/7/1 下午2:16 |
||||||
|
*/ |
||||||
|
List<EnOilDepots> getList(Map<String , Object> map); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,125 @@ |
|||||||
|
package com.hfkj.service.item.impl; |
||||||
|
|
||||||
|
import com.hfkj.dao.EnItemSegmentsMapper; |
||||||
|
import com.hfkj.entity.EnItem; |
||||||
|
import com.hfkj.entity.EnItemSegments; |
||||||
|
import com.hfkj.entity.EnItemSegmentsExample; |
||||||
|
import com.hfkj.service.item.EnItemSegmentsService; |
||||||
|
import org.apache.commons.collections4.MapUtils; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.util.Collections; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@Service("enItemSegmentsService") |
||||||
|
public class EnItemSegmentsServiceImpl implements EnItemSegmentsService { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private EnItemSegmentsMapper enItemSegmentsMapper; |
||||||
|
|
||||||
|
@Override |
||||||
|
public void create(EnItemSegments enItemSegments) { |
||||||
|
enItemSegmentsMapper.insert(enItemSegments); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void update(EnItemSegments enItemSegments) { |
||||||
|
enItemSegmentsMapper.updateByPrimaryKey(enItemSegments); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void delete(Long id, Boolean fullDelete) { |
||||||
|
if (fullDelete) { |
||||||
|
enItemSegmentsMapper.deleteByPrimaryKey(id); |
||||||
|
} else { |
||||||
|
EnItemSegments enItemSegments = queryDetail(id); |
||||||
|
enItemSegments.setStatus(0); |
||||||
|
enItemSegments.setUpdateTime(new Date()); |
||||||
|
update(enItemSegments); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public EnItemSegments queryDetail(Long id) { |
||||||
|
return enItemSegmentsMapper.selectByPrimaryKey(id); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public EnItemSegments queryDetailByMap(Map<String, Object> map) { |
||||||
|
EnItemSegmentsExample example = new EnItemSegmentsExample(); |
||||||
|
EnItemSegmentsExample.Criteria criteria = example.createCriteria(); |
||||||
|
|
||||||
|
if (MapUtils.getLong(map, "itemId") != null) { |
||||||
|
criteria.andItemIdEqualTo(MapUtils.getLong(map, "itemId")); |
||||||
|
} |
||||||
|
if (MapUtils.getLong(map , "oilDepotId") != null) { |
||||||
|
criteria.andOilDepotIdEqualTo(MapUtils.getLong(map, "oilDepotId")); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "segmentName"))) { |
||||||
|
criteria.andSegmentNameLike("%"+MapUtils.getString(map, "segmentName")+"%"); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "address"))) { |
||||||
|
criteria.andAddressLike("%"+MapUtils.getString(map, "address")+"%"); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "person"))) { |
||||||
|
criteria.andPersonLike("%"+MapUtils.getString(map, "person")+"%"); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "contactInfo"))) { |
||||||
|
criteria.andContactInfoLike("%"+MapUtils.getString(map, "contactInfo")+"%"); |
||||||
|
} |
||||||
|
if (MapUtils.getLong(map, "createUser") != null) { |
||||||
|
criteria.andCreateUserEqualTo(MapUtils.getLong(map, "createUser")); |
||||||
|
} |
||||||
|
if (MapUtils.getInteger(map, "status") != null) { |
||||||
|
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); |
||||||
|
}else { |
||||||
|
criteria.andStatusNotEqualTo(0); |
||||||
|
} |
||||||
|
if (MapUtils.getLong(map , "id") != null) { |
||||||
|
criteria.andIdEqualTo(MapUtils.getLong(map , "id")); |
||||||
|
} |
||||||
|
|
||||||
|
List<EnItemSegments> list = enItemSegmentsMapper.selectByExample(example); |
||||||
|
|
||||||
|
return list.isEmpty()?null:list.get(0); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<EnItemSegments> getList(Map<String, Object> map) { |
||||||
|
EnItemSegmentsExample example = new EnItemSegmentsExample(); |
||||||
|
EnItemSegmentsExample.Criteria criteria = example.createCriteria(); |
||||||
|
|
||||||
|
if (MapUtils.getLong(map, "itemId") != null) { |
||||||
|
criteria.andItemIdEqualTo(MapUtils.getLong(map, "itemId")); |
||||||
|
} |
||||||
|
if (MapUtils.getLong(map , "oilDepotId") != null) { |
||||||
|
criteria.andOilDepotIdEqualTo(MapUtils.getLong(map, "oilDepotId")); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "segmentName"))) { |
||||||
|
criteria.andSegmentNameLike("%"+MapUtils.getString(map, "segmentName")+"%"); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "address"))) { |
||||||
|
criteria.andAddressLike("%"+MapUtils.getString(map, "address")+"%"); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "person"))) { |
||||||
|
criteria.andPersonLike("%"+MapUtils.getString(map, "person")+"%"); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "contactInfo"))) { |
||||||
|
criteria.andContactInfoLike("%"+MapUtils.getString(map, "contactInfo")+"%"); |
||||||
|
} |
||||||
|
if (MapUtils.getLong(map, "createUser") != null) { |
||||||
|
criteria.andCreateUserEqualTo(MapUtils.getLong(map, "createUser")); |
||||||
|
} |
||||||
|
if (MapUtils.getInteger(map, "status") != null) { |
||||||
|
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); |
||||||
|
}else { |
||||||
|
criteria.andStatusNotEqualTo(0); |
||||||
|
} |
||||||
|
|
||||||
|
return enItemSegmentsMapper.selectByExample(example); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,118 @@ |
|||||||
|
package com.hfkj.service.item.impl; |
||||||
|
|
||||||
|
import com.hfkj.dao.EnItemMapper; |
||||||
|
import com.hfkj.entity.EnItem; |
||||||
|
import com.hfkj.entity.EnItemExample; |
||||||
|
import com.hfkj.service.item.EnItemService; |
||||||
|
import org.apache.commons.collections4.MapUtils; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.util.Collections; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@Service("enItemService") |
||||||
|
public class EnItemServiceImpl implements EnItemService { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private EnItemMapper enItemMapper; |
||||||
|
|
||||||
|
@Override |
||||||
|
public void create(EnItem enItem) { |
||||||
|
enItemMapper.insert(enItem); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void update(EnItem enItem) { |
||||||
|
enItemMapper.updateByPrimaryKey(enItem); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void delete(Long id, Boolean fullDelete) { |
||||||
|
if (fullDelete) { |
||||||
|
enItemMapper.deleteByPrimaryKey(id); |
||||||
|
} else { |
||||||
|
EnItem enItem = queryDetail(id); |
||||||
|
enItem.setStatus(0); |
||||||
|
enItem.setUpdateTime(new Date()); |
||||||
|
update(enItem); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public EnItem queryDetail(Long id) { |
||||||
|
return enItemMapper.selectByPrimaryKey(id); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public EnItem queryDetailByMap(Map<String, Object> map) { |
||||||
|
EnItemExample example = new EnItemExample(); |
||||||
|
EnItemExample.Criteria criteria = example.createCriteria(); |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "contactInfo"))) { |
||||||
|
criteria.andContactInfoLike("%"+MapUtils.getString(map, "contactInfo")+"%"); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "projectAddress"))) { |
||||||
|
criteria.andProjectAddressLike("%"+MapUtils.getString(map, "projectAddress")+"%"); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "projectLeader"))) { |
||||||
|
criteria.andProjectLeaderLike("%"+MapUtils.getString(map, "projectLeader")+"%"); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "projectName"))) { |
||||||
|
criteria.andProjectNameLike("%"+MapUtils.getString(map, "projectName")+"%"); |
||||||
|
} |
||||||
|
if (MapUtils.getLong(map, "createUser") != null) { |
||||||
|
|
||||||
|
criteria.andCreateUserEqualTo(MapUtils.getLong(map, "createUser")); |
||||||
|
} |
||||||
|
if (MapUtils.getInteger(map, "status") != null) { |
||||||
|
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); |
||||||
|
}else { |
||||||
|
criteria.andStatusNotEqualTo(0); |
||||||
|
} |
||||||
|
if (MapUtils.getLong(map , "id") != null) { |
||||||
|
criteria.andIdEqualTo(MapUtils.getLong(map , "id")); |
||||||
|
} |
||||||
|
example.setOrderByClause("create_time desc"); |
||||||
|
|
||||||
|
List<EnItem> enItems = enItemMapper.selectByExample(example); |
||||||
|
|
||||||
|
return enItems.isEmpty() ? null : enItems.get(0); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<EnItem> getList(Map<String, Object> map) { |
||||||
|
EnItemExample example = new EnItemExample(); |
||||||
|
EnItemExample.Criteria criteria = example.createCriteria(); |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "contactInfo"))) { |
||||||
|
criteria.andContactInfoLike("%"+MapUtils.getString(map, "contactInfo")+"%"); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "projectAddress"))) { |
||||||
|
criteria.andProjectAddressLike("%"+MapUtils.getString(map, "projectAddress")+"%"); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "projectLeader"))) { |
||||||
|
criteria.andProjectLeaderLike("%"+MapUtils.getString(map, "projectLeader")+"%"); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "projectName"))) { |
||||||
|
criteria.andProjectNameLike("%"+MapUtils.getString(map, "projectName")+"%"); |
||||||
|
} |
||||||
|
if (MapUtils.getLong(map, "createUser") != null) { |
||||||
|
|
||||||
|
criteria.andCreateUserEqualTo(MapUtils.getLong(map, "createUser")); |
||||||
|
} |
||||||
|
if (MapUtils.getInteger(map, "status") != null) { |
||||||
|
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); |
||||||
|
}else { |
||||||
|
criteria.andStatusNotEqualTo(0); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
example.setOrderByClause("create_time desc"); |
||||||
|
|
||||||
|
return enItemMapper.selectByExample(example); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,117 @@ |
|||||||
|
package com.hfkj.service.item.impl; |
||||||
|
|
||||||
|
import com.hfkj.dao.EnOilDepotsMapper; |
||||||
|
import com.hfkj.entity.EnOilDepots; |
||||||
|
import com.hfkj.entity.EnOilDepotsExample; |
||||||
|
import com.hfkj.service.item.EnOilDepotsService; |
||||||
|
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("enOilDepotsService") |
||||||
|
public class EnOilDepotsServiceImpl implements EnOilDepotsService { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private EnOilDepotsMapper enOilDepotsMapper; |
||||||
|
|
||||||
|
@Override |
||||||
|
public void create(EnOilDepots enOilDepots) { |
||||||
|
enOilDepotsMapper.insert(enOilDepots); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void update(EnOilDepots enOilDepots) { |
||||||
|
enOilDepotsMapper.updateByPrimaryKey(enOilDepots); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void delete(Long id, Boolean fullDelete) { |
||||||
|
if (fullDelete) { |
||||||
|
enOilDepotsMapper.deleteByPrimaryKey(id); |
||||||
|
} else { |
||||||
|
EnOilDepots enOilDepots = queryDetail(id); |
||||||
|
enOilDepots.setStatus(0); |
||||||
|
enOilDepots.setUpdateTime(new Date()); |
||||||
|
update(enOilDepots); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public EnOilDepots queryDetail(Long id) { |
||||||
|
return enOilDepotsMapper.selectByPrimaryKey(id); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public EnOilDepots queryDetailByMap(Map<String, Object> map) { |
||||||
|
EnOilDepotsExample example = new EnOilDepotsExample(); |
||||||
|
EnOilDepotsExample.Criteria criteria = example.createCriteria(); |
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "contactInfo"))) { |
||||||
|
criteria.andContactInfoLike("%"+MapUtils.getString(map, "contactInfo")+"%"); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "oilDepotNo"))) { |
||||||
|
criteria.andOilDepotNoLike("%"+MapUtils.getString(map, "oilDepotNo")+"%"); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "oilDepotName"))) { |
||||||
|
criteria.andOilDepotNameLike("%"+MapUtils.getString(map, "oilDepotName")+"%"); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "contactPerson"))) { |
||||||
|
criteria.andContactPersonLike("%"+MapUtils.getString(map, "contactPerson")+"%"); |
||||||
|
} |
||||||
|
if (MapUtils.getLong(map, "itemId") != null) { |
||||||
|
criteria.andItemIdEqualTo(MapUtils.getLong(map, "itemId")); |
||||||
|
} |
||||||
|
if (MapUtils.getLong(map, "createUser") != null) { |
||||||
|
criteria.andCreateUserEqualTo(MapUtils.getLong(map, "createUser")); |
||||||
|
} |
||||||
|
if (MapUtils.getInteger(map, "status") != null) { |
||||||
|
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); |
||||||
|
}else { |
||||||
|
criteria.andStatusNotEqualTo(0); |
||||||
|
} |
||||||
|
if (MapUtils.getLong(map , "id") != null) { |
||||||
|
criteria.andIdEqualTo(MapUtils.getLong(map , "id")); |
||||||
|
} |
||||||
|
|
||||||
|
List<EnOilDepots> list = enOilDepotsMapper.selectByExample(example); |
||||||
|
|
||||||
|
return list.isEmpty() ? null : list.get(0); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<EnOilDepots> getList(Map<String, Object> map) { |
||||||
|
EnOilDepotsExample example = new EnOilDepotsExample(); |
||||||
|
EnOilDepotsExample.Criteria criteria = example.createCriteria(); |
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "contactInfo"))) { |
||||||
|
criteria.andContactInfoLike("%"+MapUtils.getString(map, "contactInfo")+"%"); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "oilDepotNo"))) { |
||||||
|
criteria.andOilDepotNoLike("%"+MapUtils.getString(map, "oilDepotNo")+"%"); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "oilDepotName"))) { |
||||||
|
criteria.andOilDepotNameLike("%"+MapUtils.getString(map, "oilDepotName")+"%"); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "contactPerson"))) { |
||||||
|
criteria.andContactPersonLike("%"+MapUtils.getString(map, "contactPerson")+"%"); |
||||||
|
} |
||||||
|
if (MapUtils.getLong(map, "itemId") != null) { |
||||||
|
criteria.andItemIdEqualTo(MapUtils.getLong(map, "itemId")); |
||||||
|
} |
||||||
|
if (MapUtils.getLong(map, "createUser") != null) { |
||||||
|
criteria.andCreateUserEqualTo(MapUtils.getLong(map, "createUser")); |
||||||
|
} |
||||||
|
if (MapUtils.getInteger(map, "status") != null) { |
||||||
|
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); |
||||||
|
}else { |
||||||
|
criteria.andStatusNotEqualTo(0); |
||||||
|
} |
||||||
|
|
||||||
|
return enOilDepotsMapper.selectByExample(example); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue