From c0b4ed31f27cea01c20ce02169ec49298b145dc0 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 2 Aug 2022 16:48:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bweb/controller/HighGasController.java | 45 ++++++ .../bweb/controller/SecUserController.java | 21 +++ .../hai/dao/HighMerchantStoreMapperExt.java | 42 ++++- .../hai/model/GasSelfBuiltStationModel.java | 150 ++++++++++++++++++ .../hai/service/HighMerchantStoreService.java | 7 + .../impl/HighMerchantStoreServiceImpl.java | 6 + .../hai/service/impl/SecUserServiceImpl.java | 18 ++- 7 files changed, 280 insertions(+), 9 deletions(-) create mode 100644 hai-service/src/main/java/com/hai/model/GasSelfBuiltStationModel.java diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java b/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java index e82379b1..bcf286f4 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java @@ -728,6 +728,51 @@ public class HighGasController { } } + @RequestMapping(value="/getGasSelfBuiltStationList",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询油站列表") + public ResponseData getGasSelfBuiltStationList(@RequestParam(name = "companyId", required = false) Long companyId, + @RequestParam(name = "merId", required = false) Long merId, + @RequestParam(name = "gasName", required = false) String gasName, + @RequestParam(name = "prestoreType", required = false) String prestoreType, + @RequestParam(name = "amountsEarlyWarningStatus", required = false) Boolean amountsEarlyWarningStatus, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize) { + try { + Map param = new HashMap<>(); + param.put("gasName", gasName); + param.put("prestoreType", prestoreType); + param.put("amountsEarlyWarningStatus", amountsEarlyWarningStatus); + + UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); + if (userInfoModel == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + + if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { + param.put("companyId", userInfoModel.getBsCompany().getId()); + param.put("merId", merId); + + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) { + param.put("merId", merId); + + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type2.getType())) { + param.put("merId", userInfoModel.getMerchant().getId()); + + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(merchantStoreService.getGasSelfBuiltStationList(param))); + + } catch (Exception e) { + log.error("HighGasController -> getGasPriceDetail() error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/refuelingOrderRefund",method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "订单退款") diff --git a/hai-bweb/src/main/java/com/bweb/controller/SecUserController.java b/hai-bweb/src/main/java/com/bweb/controller/SecUserController.java index 6a87f752..59093901 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/SecUserController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/SecUserController.java @@ -12,12 +12,14 @@ import com.hai.common.utils.ResponseMsgUtil; import com.hai.entity.BsOrganization; import com.hai.entity.SecRole; import com.hai.entity.SecUser; +import com.hai.entity.SecUserLabel; import com.hai.model.ResponseData; import com.hai.model.SecUserModel; import com.hai.model.UserInfoModel; import com.hai.model.UserTreeModel; import com.hai.service.BsOrganizationService; import com.hai.service.SecRoleService; +import com.hai.service.SecUserLabelService; import com.hai.service.SecUserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -30,7 +32,9 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; import java.util.Date; +import java.util.List; @Controller @RequestMapping(value = "/secUser") @@ -51,6 +55,8 @@ public class SecUserController { @Resource private SecRoleService secRoleService; + @Resource + private SecUserLabelService userLabelService; @RequestMapping(value="/sendUserPass",method = RequestMethod.POST) @ResponseBody @@ -227,6 +233,21 @@ public class SecUserController { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } SecUser user = secUserService.findById(userId); + if (user != null) { + List labelList = userLabelService.getLabelByUser(user.getId()); + List labelIdArray = new ArrayList<>(); + List labelNameArray = new ArrayList<>(); + + for (SecUserLabel label : labelList) { + labelIdArray.add(label.getLabelId()); + } + user.setLabelIdArray(labelIdArray); + + for (SecUserLabel label : labelList) { + labelNameArray.add(label.getLabelName()); + } + user.setLabelNameArray(labelNameArray); + } SecRole role = secRoleService.getRoleByUserId(userId); user.setRoleId(role.getId()); return ResponseMsgUtil.success(user); diff --git a/hai-service/src/main/java/com/hai/dao/HighMerchantStoreMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighMerchantStoreMapperExt.java index 877bb902..856a2a5d 100644 --- a/hai-service/src/main/java/com/hai/dao/HighMerchantStoreMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighMerchantStoreMapperExt.java @@ -1,7 +1,47 @@ package com.hai.dao; +import com.hai.model.GasSelfBuiltStationModel; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; +import java.util.Map; + /** * mapper扩展类 */ public interface HighMerchantStoreMapperExt { -} \ No newline at end of file + + @Select({ + "" + }) + List selectGasSelfBuiltStationList(@Param("param") Map param); +} diff --git a/hai-service/src/main/java/com/hai/model/GasSelfBuiltStationModel.java b/hai-service/src/main/java/com/hai/model/GasSelfBuiltStationModel.java new file mode 100644 index 00000000..d487ee4b --- /dev/null +++ b/hai-service/src/main/java/com/hai/model/GasSelfBuiltStationModel.java @@ -0,0 +1,150 @@ +package com.hai.model; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 加油自建站模型 + * @author hurui + */ +public class GasSelfBuiltStationModel { + + private Long storeId; + private Long storeMerId; + private String storeMerName; + + private Long companyId; + private String companyName; + + private Long regionId; + private String regionName; + + private String storeKey; + private String storeName; + private String storeAddress; + private Integer storePrestoreType; + private BigDecimal amounts; + private BigDecimal amountsEarlyWarning; + private Integer amountsEarlyWarningStatus; + private Date storeCreateTime; + + public Long getStoreId() { + return storeId; + } + + public void setStoreId(Long storeId) { + this.storeId = storeId; + } + + public Long getStoreMerId() { + return storeMerId; + } + + public void setStoreMerId(Long storeMerId) { + this.storeMerId = storeMerId; + } + + public String getStoreMerName() { + return storeMerName; + } + + public void setStoreMerName(String storeMerName) { + this.storeMerName = storeMerName; + } + + public Long getCompanyId() { + return companyId; + } + + public void setCompanyId(Long companyId) { + this.companyId = companyId; + } + + public String getCompanyName() { + return companyName; + } + + public void setCompanyName(String companyName) { + this.companyName = companyName; + } + + public Long getRegionId() { + return regionId; + } + + public void setRegionId(Long regionId) { + this.regionId = regionId; + } + + public String getRegionName() { + return regionName; + } + + public void setRegionName(String regionName) { + this.regionName = regionName; + } + + public String getStoreKey() { + return storeKey; + } + + public void setStoreKey(String storeKey) { + this.storeKey = storeKey; + } + + public String getStoreName() { + return storeName; + } + + public void setStoreName(String storeName) { + this.storeName = storeName; + } + + public String getStoreAddress() { + return storeAddress; + } + + public void setStoreAddress(String storeAddress) { + this.storeAddress = storeAddress; + } + + public Integer getStorePrestoreType() { + return storePrestoreType; + } + + public void setStorePrestoreType(Integer storePrestoreType) { + this.storePrestoreType = storePrestoreType; + } + + public BigDecimal getAmounts() { + return amounts; + } + + public void setAmounts(BigDecimal amounts) { + this.amounts = amounts; + } + + public BigDecimal getAmountsEarlyWarning() { + return amountsEarlyWarning; + } + + public void setAmountsEarlyWarning(BigDecimal amountsEarlyWarning) { + this.amountsEarlyWarning = amountsEarlyWarning; + } + + public Integer getAmountsEarlyWarningStatus() { + return amountsEarlyWarningStatus; + } + + public void setAmountsEarlyWarningStatus(Integer amountsEarlyWarningStatus) { + this.amountsEarlyWarningStatus = amountsEarlyWarningStatus; + } + + public Date getStoreCreateTime() { + return storeCreateTime; + } + + public void setStoreCreateTime(Date storeCreateTime) { + this.storeCreateTime = storeCreateTime; + } +} diff --git a/hai-service/src/main/java/com/hai/service/HighMerchantStoreService.java b/hai-service/src/main/java/com/hai/service/HighMerchantStoreService.java index 58f3fcf3..9723586f 100644 --- a/hai-service/src/main/java/com/hai/service/HighMerchantStoreService.java +++ b/hai-service/src/main/java/com/hai/service/HighMerchantStoreService.java @@ -2,6 +2,7 @@ package com.hai.service; import com.github.pagehelper.PageInfo; import com.hai.entity.HighMerchantStore; +import com.hai.model.GasSelfBuiltStationModel; import com.hai.model.HighMerchantStoreModel; import java.util.List; @@ -98,4 +99,10 @@ public interface HighMerchantStoreService { **/ List getStoreListByLongitude(Map map); + /** + * 查询自建站 油站 + * @param map + * @return + */ + List getGasSelfBuiltStationList(Map map); } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java index d0808b72..98b101df 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java @@ -9,6 +9,7 @@ import com.hai.common.utils.MD5Util; import com.hai.config.SpPrinterConfig; import com.hai.dao.HighMerchantStoreMapper; import com.hai.entity.*; +import com.hai.model.GasSelfBuiltStationModel; import com.hai.model.HighMerchantStoreModel; import com.hai.service.HighMerchantStoreAccountService; import com.hai.service.HighMerchantStoreService; @@ -239,5 +240,10 @@ public class HighMerchantStoreServiceImpl implements HighMerchantStoreService { return collect; } + @Override + public List getGasSelfBuiltStationList(Map map) { + return highMerchantStoreMapper.selectGasSelfBuiltStationList(map); + } + } diff --git a/hai-service/src/main/java/com/hai/service/impl/SecUserServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/SecUserServiceImpl.java index d6000a75..9fadc622 100644 --- a/hai-service/src/main/java/com/hai/service/impl/SecUserServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/SecUserServiceImpl.java @@ -71,14 +71,16 @@ public class SecUserServiceImpl implements SecUserService { organization.setManagerPhone(user.getTelephone()); bsOrganizationMapper.updateByPrimaryKey(organization); } - for (Long labelId : user.getLabelIdArray()) { - String labelName = commonService.getDictionaryCodeName("USER_LABEL", labelId.toString()); - if (labelName != null) { - SecUserLabel label = new SecUserLabel(); - label.setUserId(user.getId()); - label.setLabelId(labelId); - label.setLabelName(labelName); - userLabelService.edit(label); + if (user.getLabelIdArray() != null) { + for (Long labelId : user.getLabelIdArray()) { + String labelName = commonService.getDictionaryCodeName("USER_LABEL", labelId.toString()); + if (labelName != null) { + SecUserLabel label = new SecUserLabel(); + label.setUserId(user.getId()); + label.setLabelId(labelId); + label.setLabelName(labelName); + userLabelService.edit(label); + } } } }