Commit ddedcb87 authored by 周健威's avatar 周健威

Merge remote-tracking branch 'origin/dev-chw' into dev-chw

parents d24022e1 bcc28dea
package com.github.wxiaoqi.security.admin.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
@Data
@Table(name = "branch_company_give")
public class BranchCompanyGive {
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键id")
private Long id;
@Column(name = "user_id")
@ApiModelProperty("用户id")
private Integer userId;
@Column(name = "company_id")
@ApiModelProperty("公司id")
private Integer companyId;
@Column(name = "is_del")
@ApiModelProperty("是否删除:0-正常;1-删除")
private Integer isDel;
}
\ No newline at end of file
package com.github.wxiaoqi.security.admin.biz;
import com.github.wxiaoqi.security.admin.entity.BranchCompany;
import com.github.wxiaoqi.security.admin.entity.BranchCompanyGive;
import com.github.wxiaoqi.security.admin.mapper.BranchCompanyGiveMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
@Service
@Slf4j
public class BranchCompanyGiveBiz extends BaseBiz<BranchCompanyGiveMapper, BranchCompanyGive>{
@Autowired
BranchCompanyBiz branchCompanyBiz;
public void addOrUpdGive(BranchCompanyGive branchCompanyGive){
Integer isDel = branchCompanyGive.getIsDel() == null ? 0 : branchCompanyGive.getIsDel();
BranchCompanyGive branchCompanyGive1 = getUserCompanyGive(branchCompanyGive);
if (branchCompanyGive1 == null){
insertSelectiveRe(branchCompanyGive);
}else {
updateSelectiveById(branchCompanyGive);
}
Integer companyId = branchCompanyGive.getCompanyId();
BranchCompany branchCompany1 = branchCompanyBiz.selectById(companyId);
if (branchCompany1 != null){
BranchCompany branchCompany=new BranchCompany();
branchCompany.setId(companyId);
if (isDel == 1){
branchCompany.setGiveNum(branchCompany1.getGiveNum()-1);
}else {
branchCompany.setGiveNum(branchCompany1.getGiveNum()+1);
}
branchCompanyBiz.addOrUpd(branchCompany);
}
}
public BranchCompanyGive getUserCompanyGive(BranchCompanyGive branchCompanyGive) {
Example example = new Example(BranchCompanyGive.class);
example.createCriteria().andEqualTo("userId", branchCompanyGive.getUserId()).andEqualTo("companyId", branchCompanyGive.getCompanyId()).andEqualTo("isDel", 0);
List<BranchCompanyGive> list = mapper.selectByExample(example);
if (list != null && list.size() != 0) {
return list.get(0);
}
return null;
}
}
package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.entity.BranchCompanyGive;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper;
public interface BranchCompanyGiveMapper extends Mapper<BranchCompanyGive>, SelectByIdListMapper<BranchCompanyGive,Long> {
}
\ No newline at end of file
package com.github.wxiaoqi.security.admin.rest;
import com.github.wxiaoqi.security.admin.biz.BranchCompanyBiz;
import com.github.wxiaoqi.security.admin.biz.BranchCompanyGiveBiz;
import com.github.wxiaoqi.security.admin.dto.CompanySearchDTO;
import com.github.wxiaoqi.security.admin.entity.BranchCompanyGive;
import com.github.wxiaoqi.security.admin.entity.CompanyInfo;
import com.github.wxiaoqi.security.admin.vo.CompanySearchVO;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.RequiredArgsConstructor;
......@@ -12,6 +17,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author Administrator
*/
......@@ -23,6 +30,10 @@ import org.springframework.web.bind.annotation.*;
public class AppBranchCompanyController extends BaseController<BranchCompanyBiz> {
@Autowired
BranchCompanyGiveBiz branchCompanyGiveBiz;
......@@ -42,4 +53,54 @@ public class AppBranchCompanyController extends BaseController<BranchCompanyBiz>
return ObjectRestResponse.succ( baseBiz.search(companySearchDTO));
}
@GetMapping("app/unauth/info")
@ApiModelProperty("店铺信息")
@IgnoreUserToken
public ObjectRestResponse info(CompanySearchDTO companySearchDTO) {
if (companySearchDTO.getId() == null || companySearchDTO.getId() == 0){
List<Integer> companyIds = getBusinessUserCompanyIds();
if (companyIds != null && companyIds.size() > 0){
companySearchDTO.setId(companyIds.get(0));
}
}
List<CompanySearchVO> list = baseBiz.getList(companySearchDTO);
if (list.size() == 0){
throw new BaseException("店铺不存在", ResultCode.FAILED_CODE);
}
return ObjectRestResponse.succ(list.get(0));
}
@GetMapping("checkGive")
@ApiModelProperty("检查点赞")
public ObjectRestResponse checkGive(BranchCompanyGive branchCompanyGive) {
branchCompanyGive.setUserId(getCurrentUserIdInt());
BranchCompanyGive userCompanyGive = branchCompanyGiveBiz.getUserCompanyGive(branchCompanyGive);
boolean flag=false;
if (userCompanyGive != null ){
flag=true;
}
return ObjectRestResponse.succ(flag);
}
@PostMapping("doGive")
@ApiModelProperty("点赞")
public ObjectRestResponse doGive(@RequestBody BranchCompanyGive branchCompanyGive) {
branchCompanyGive.setUserId(getCurrentUserIdInt());
branchCompanyGiveBiz.addOrUpdGive(branchCompanyGive);
return ObjectRestResponse.succ();
}
@PostMapping("canelGive")
@ApiModelProperty("取消点赞")
public ObjectRestResponse canelGive(@RequestBody BranchCompanyGive branchCompanyGive) {
branchCompanyGive.setUserId(getCurrentUserIdInt());
branchCompanyGive.setIsDel(1);
branchCompanyGiveBiz.addOrUpdGive(branchCompanyGive);
return ObjectRestResponse.succ();
}
}
......@@ -2,8 +2,12 @@ package com.github.wxiaoqi.security.admin.rest;
import com.github.wxiaoqi.security.admin.biz.*;
import com.github.wxiaoqi.security.admin.dto.CompanySearchDTO;
import com.github.wxiaoqi.security.admin.entity.CompanyInfo;
import com.github.wxiaoqi.security.admin.vo.CompanySearchVO;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.RequiredArgsConstructor;
......@@ -11,6 +15,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author Administrator
*/
......@@ -42,4 +48,8 @@ public class AppCompanyInfoController extends BaseController<CompanyInfoApplyBiz
}
......@@ -24,6 +24,13 @@ public class VehicleVO extends Vehicle {
@ApiModelProperty("所属店铺名称")
private String companyName;
@ApiModelProperty("所属店铺联系人")
private String companyLeader;
@ApiModelProperty("所属店铺联系电话")
private String companyLeaderContact;
@ApiModelProperty("经营店铺名称")
private String manageCompanyName;
......
......@@ -1777,6 +1777,10 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
return mapper.countByCompamyId(companyId);
}
public int setState(String vehicleId,Integer state){
return mapper.setState(vehicleId,state);
}
......
......@@ -6,6 +6,7 @@ import com.xxfc.platform.vehicle.entity.Area;
import com.xxfc.platform.vehicle.entity.VehicleManageApply;
import com.xxfc.platform.vehicle.mapper.VehicleManageApplyMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
......@@ -15,6 +16,10 @@ import java.util.List;
public class VehicleManageApplyBiz extends BaseBiz<VehicleManageApplyMapper, VehicleManageApply> {
@Autowired
VehicleBiz vehicleBiz;
public List<VehicleManageApply> getManageApply(VehicleManageApply vehicleManageApply){
......@@ -40,4 +45,15 @@ public class VehicleManageApplyBiz extends BaseBiz<VehicleManageApplyMapper, Veh
}
public void applyManage(VehicleManageApply vehicleManageApply){
Integer type = vehicleManageApply.getType() == null ? 1 : vehicleManageApply.getType();
if (type == 2){
vehicleBiz.setState(vehicleManageApply.getVehicleId(),2);
}
}
}
......@@ -8,6 +8,7 @@ import com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto;
import com.xxfc.platform.vehicle.pojo.vo.UsableVeicleVO;
import com.xxfc.platform.vehicle.pojo.vo.VehicleVO;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.data.repository.query.Param;
import tk.mybatis.mapper.common.Mapper;
......@@ -75,4 +76,8 @@ public interface VehicleMapper extends Mapper<Vehicle> {
List<VehicleBookRecordVO2> calendarPriceList(@Param("commpanyId") Integer commpanyId);
@Update("update vehicle set state=#{state} WHERE id=#{vehicleId} ")
int setState(@Param("vehicleId")String vehicleId,@Param("state")Integer state);
}
\ No newline at end of file
......@@ -1305,7 +1305,8 @@
v.*,
b.cn_name as brandName,
c.`name` categoryName,
bc.`name` as companyName,
bc.`leader` as companyLeader,
bc.`leader_contact_info` as companyLeaderContact,
bc1.`name` as manageCompanyName,
bc2.`name` as parkCompanyName
FROM vehicle v
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment