提交代码

dev-discount
胡锐 3 years ago
parent 8853512488
commit 1945eb4eb1
  1. 8
      hai-bweb/src/main/java/com/bweb/controller/HighTyAgentPriceController.java
  2. 2
      hai-service/src/main/java/com/hai/service/HighTyAgentService.java
  3. 2
      hai-service/src/main/java/com/hai/service/HighTySalesmanService.java
  4. 40
      hai-service/src/main/java/com/hai/service/impl/HighTyAgentServiceImpl.java
  5. 40
      hai-service/src/main/java/com/hai/service/impl/HighTySalesmanServiceImpl.java

@ -13,6 +13,7 @@ import com.hai.model.ResponseData;
import com.hai.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -123,12 +124,7 @@ public class HighTyAgentPriceController {
// 价格
HighTyAgentPrice priceRate = tyAgentPriceService.getDetail(station.getId(), price.getOilNo().toString());
if (priceRate == null) {
HighGasDiscountOilPrice oilNo = gasDiscountOilPriceService.getDetailByOilNo(price.getOilNo().toString());
if (oilNo == null) {
oilPriceMap.put("priceRate", 0);
} else {
oilPriceMap.put("priceRate", oilNo.getPriceRate());
}
oilPriceMap.put("priceRate", MapUtils.getLong(oilPriceMap, "lowPrice"));
} else {
oilPriceMap.put("priceRate", priceRate.getPriceRate());
}

@ -21,7 +21,7 @@ public interface HighTyAgentService {
* 增加代理商
* @param tyAgent
*/
void addAgent(HighTyAgent tyAgent);
void addAgent(HighTyAgent tyAgent) throws Exception;
/**
* 修改代理商

@ -20,7 +20,7 @@ public interface HighTySalesmanService {
* 增加业务员
* @param tySalesman
*/
void addSalesman(HighTySalesman tySalesman);
void addSalesman(HighTySalesman tySalesman) throws Exception;
/**
* 修改业务员

@ -52,29 +52,25 @@ public class HighTyAgentServiceImpl implements HighTyAgentService {
@Override
@Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW)
public void addAgent(HighTyAgent tyAgent) {
try {
if (secUserService.findByPhone(tyAgent.getAgentPhone()) != null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "手机号已存在,请更换");
}
editTyAgent(tyAgent);
SecUser secUser = new SecUser();
secUser.setUserName(tyAgent.getAgentName());
secUser.setLoginName(tyAgent.getAgentPhone());
secUser.setPassword(MD5Util.encode("123456".getBytes()));
secUser.setAdminFlag(1);
secUser.setStatus(1);
secUser.setRoleId(7L);
secUser.setObjectType(UserObjectTypeEnum.type6.getType());
secUser.setObjectId(tyAgent.getId());
secUser.setCreateTime(new Date());
secUser.setUpdateTime(new Date());
secUserService.addUser(secUser);
} catch (Exception e) {
e.printStackTrace();
public void addAgent(HighTyAgent tyAgent) throws Exception {
if (secUserService.findByPhone(tyAgent.getAgentPhone()) != null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "手机号已存在,请更换");
}
editTyAgent(tyAgent);
SecUser secUser = new SecUser();
secUser.setUserName(tyAgent.getAgentName());
secUser.setLoginName(tyAgent.getAgentPhone());
secUser.setPassword(MD5Util.encode("123456".getBytes()));
secUser.setAdminFlag(1);
secUser.setStatus(1);
secUser.setRoleId(7L);
secUser.setObjectType(UserObjectTypeEnum.type6.getType());
secUser.setObjectId(tyAgent.getId());
secUser.setCreateTime(new Date());
secUser.setUpdateTime(new Date());
secUserService.addUser(secUser);
}
@Override

@ -52,31 +52,29 @@ public class HighTySalesmanServiceImpl implements HighTySalesmanService {
}
@Override
public void addSalesman(HighTySalesman tySalesman) {
try {
if (secUserService.findByPhone(tySalesman.getSalesmanPhone()) != null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "手机号已存在,请更换");
}
editTySalesman(tySalesman);
SecUser secUser = new SecUser();
secUser.setUserName(tySalesman.getSalesmanName());
secUser.setLoginName(tySalesman.getSalesmanPhone());
secUser.setPassword(MD5Util.encode("123456".getBytes()));
secUser.setAdminFlag(1);
secUser.setStatus(1);
secUser.setRoleId(8L);
secUser.setObjectType(UserObjectTypeEnum.type7.getType());
secUser.setObjectId(tySalesman.getId());
secUser.setCreateTime(new Date());
secUser.setUpdateTime(new Date());
secUserService.addUser(secUser);
} catch (Exception e) {
e.printStackTrace();
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void addSalesman(HighTySalesman tySalesman) throws Exception {
if (secUserService.findByLoginName(tySalesman.getSalesmanPhone()) != null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "在系统中此联系电话已存在,请更换");
}
editTySalesman(tySalesman);
SecUser secUser = new SecUser();
secUser.setUserName(tySalesman.getSalesmanName());
secUser.setLoginName(tySalesman.getSalesmanPhone());
secUser.setPassword(MD5Util.encode("123456".getBytes()));
secUser.setAdminFlag(1);
secUser.setStatus(1);
secUser.setRoleId(8L);
secUser.setObjectType(UserObjectTypeEnum.type7.getType());
secUser.setObjectId(tySalesman.getId());
secUser.setCreateTime(new Date());
secUser.setUpdateTime(new Date());
secUserService.addUser(secUser);
}
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void updateSalesman(HighTySalesman tySalesman) {
// 查询账户
SecUser account = secUserService.getMainAccount(UserObjectTypeEnum.type7.getType(), tySalesman.getId());

Loading…
Cancel
Save