提交 642dfd27 作者: zhenjie

Merge branch 'develop'

...@@ -18,4 +18,4 @@ patches: ...@@ -18,4 +18,4 @@ patches:
images: images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG - name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/pms newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/pms
newTag: ca19a936c153a8b533fbfe359cd6ae36e37ad991 newTag: 16203e068976be09d2b4a8e92d31218ba49b7e64
...@@ -17,7 +17,6 @@ import com.mmc.pms.service.lease.LeaseGoodsService; ...@@ -17,7 +17,6 @@ import com.mmc.pms.service.lease.LeaseGoodsService;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -87,9 +86,8 @@ public class LeaseGoodsController extends BaseController { ...@@ -87,9 +86,8 @@ public class LeaseGoodsController extends BaseController {
@ApiOperation(value = "feign-根据地址id查询是否有商品绑定") @ApiOperation(value = "feign-根据地址id查询是否有商品绑定")
@GetMapping("feignLeaseGoodsInfoByAddressId") @GetMapping("feignLeaseGoodsInfoByAddressId")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = LeaseGoodsVO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@ApiIgnore public ResultBody feignLeaseGoodsInfoByAddressId(@RequestParam Integer id) {
public Integer feignLeaseGoodsInfoByAddressId(@RequestParam Integer id) {
return leaseGoodsService.feignLeaseGoodsInfoByAddressId(id); return leaseGoodsService.feignLeaseGoodsInfoByAddressId(id);
} }
} }
...@@ -71,5 +71,9 @@ public interface LeaseGoodsDao { ...@@ -71,5 +71,9 @@ public interface LeaseGoodsDao {
void removeWareInfo(List<Integer> list); void removeWareInfo(List<Integer> list);
Integer feignLeaseGoodsInfoByAddressId(Integer id); int feignLeaseGoodsInfoByAddressId(Integer id);
int countLeaseGoodsByApp(LeaseGoodsQO param);
List<LeaseGoodsDO> listLeaseGoodsByApp(LeaseGoodsQO param);
} }
...@@ -27,5 +27,5 @@ public interface LeaseGoodsService { ...@@ -27,5 +27,5 @@ public interface LeaseGoodsService {
ResultBody batchRemoveWareInfo(List<Integer> list); ResultBody batchRemoveWareInfo(List<Integer> list);
Integer feignLeaseGoodsInfoByAddressId(Integer id); ResultBody feignLeaseGoodsInfoByAddressId(Integer id);
} }
...@@ -121,24 +121,36 @@ public class LeaseGoodsServiceImpl implements LeaseGoodsService { ...@@ -121,24 +121,36 @@ public class LeaseGoodsServiceImpl implements LeaseGoodsService {
@Override @Override
public ResultBody leaseGoodsList(LeaseGoodsQO param, LoginSuccessDTO loginSuccessDTO) { public ResultBody leaseGoodsList(LeaseGoodsQO param, LoginSuccessDTO loginSuccessDTO) {
if (loginSuccessDTO == null || loginSuccessDTO.getRoleInfo().getSuperAdmin().equals(1)) { if (loginSuccessDTO != null && loginSuccessDTO.getRoleInfo().getSuperAdmin().equals(1)) {
// 小程序和超级管理员获取所有商品信息 // 超级管理员获取所有商品信息
return ResultBody.success(getLeaseGoodsInfo(param)); return ResultBody.success(getLeaseGoodsInfo(param, 1));
} else { } else if (loginSuccessDTO != null && !loginSuccessDTO.getRoleInfo().getSuperAdmin().equals(1)) {
// 非超级管理员获取自家的商品信息 // 非超级管理员获取自家的商品信息
param.setUserAccountId(loginSuccessDTO.getUserAccountId()); param.setUserAccountId(loginSuccessDTO.getUserAccountId());
return ResultBody.success(getLeaseGoodsInfo(param)); return ResultBody.success(getLeaseGoodsInfo(param, 1));
} else {
return ResultBody.success(getLeaseGoodsInfo(param, 0));
} }
} }
private PageResult getLeaseGoodsInfo(LeaseGoodsQO param) { private PageResult getLeaseGoodsInfo(LeaseGoodsQO param, Integer type) {
int count = leaseGoodsDao.countLeaseGoods(param); int count;
if (type.equals(1)) {
count = leaseGoodsDao.countLeaseGoods(param);
} else {
count = leaseGoodsDao.countLeaseGoodsByApp(param);
}
if (count == 0) { if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count); return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
} }
Integer pageNo = param.getPageNo(); Integer pageNo = param.getPageNo();
param.buildCurrentPage(); param.buildCurrentPage();
List<LeaseGoodsDO> leaseGoodsDOList = leaseGoodsDao.listLeaseGoods(param); List<LeaseGoodsDO> leaseGoodsDOList;
if (type.equals(1)) {
leaseGoodsDOList = leaseGoodsDao.listLeaseGoods(param);
} else {
leaseGoodsDOList = leaseGoodsDao.listLeaseGoodsByApp(param);
}
// 转成vo // 转成vo
List<LeaseGoodsVO> leaseGoodsVOList = leaseGoodsDOList.stream().map(LeaseGoodsDO::buildLeaseGoodsVO) List<LeaseGoodsVO> leaseGoodsVOList = leaseGoodsDOList.stream().map(LeaseGoodsDO::buildLeaseGoodsVO)
.skip(param.getPageNo()).limit(param.getPageSize()).collect(Collectors.toList()); .skip(param.getPageNo()).limit(param.getPageSize()).collect(Collectors.toList());
...@@ -147,7 +159,7 @@ public class LeaseGoodsServiceImpl implements LeaseGoodsService { ...@@ -147,7 +159,7 @@ public class LeaseGoodsServiceImpl implements LeaseGoodsService {
List<CompanyInfoVO> companyInfoVOS = userAppApi.listCompanyInfoByBUIds(userIds); List<CompanyInfoVO> companyInfoVOS = userAppApi.listCompanyInfoByBUIds(userIds);
leaseGoodsVOList = leaseGoodsVOList.stream().peek(d -> { leaseGoodsVOList = leaseGoodsVOList.stream().peek(d -> {
for (CompanyInfoVO companyInfoVO : companyInfoVOS) { for (CompanyInfoVO companyInfoVO : companyInfoVOS) {
if (companyInfoVO.getBackUserAccountId().equals(d.getUserAccountId())){ if (companyInfoVO.getBackUserAccountId().equals(d.getUserAccountId())) {
d.setCompanyName(companyInfoVO.getCompanyName()); d.setCompanyName(companyInfoVO.getCompanyName());
break; break;
} }
...@@ -190,7 +202,7 @@ public class LeaseGoodsServiceImpl implements LeaseGoodsService { ...@@ -190,7 +202,7 @@ public class LeaseGoodsServiceImpl implements LeaseGoodsService {
} }
@Override @Override
public Integer feignLeaseGoodsInfoByAddressId(Integer id) { public ResultBody feignLeaseGoodsInfoByAddressId(Integer id) {
return leaseGoodsDao.feignLeaseGoodsInfoByAddressId(id); return ResultBody.success(leaseGoodsDao.feignLeaseGoodsInfoByAddressId(id));
} }
} }
...@@ -141,7 +141,10 @@ ...@@ -141,7 +141,10 @@
logistics_company = #{logisticsCompany}, logistics_company = #{logisticsCompany},
</if> </if>
<if test="modeOfDelivery != null"> <if test="modeOfDelivery != null">
mode_of_delivery = #{modeOfDelivery} mode_of_delivery = #{modeOfDelivery},
</if>
<if test="showPrice != null">
show_price = #{showPrice}
</if> </if>
</set> </set>
where id = #{id} where id = #{id}
...@@ -416,4 +419,72 @@ ...@@ -416,4 +419,72 @@
where ship_address = #{id} where ship_address = #{id}
or return_address = #{id} or return_address = #{id}
</select> </select>
<select id="countLeaseGoodsByApp" resultType="java.lang.Integer">
select count(*) from lease_goods
<where>
shelf_status = 1
<if test="tradeName != null and tradeName != ''">
and (trade_name LIKE CONCAT('%',#{tradeName},'%'))
</if>
<if test="productTypeId != null">
and product_type_id = #{productTypeId}
</if>
<if test="brandInfoId != null">
and brand_info_id = #{brandInfoId}
</if>
<if test="userAccountId != null">
and user_account_id = #{userAccountId}
</if>
<if test="districtCode != null and districtCode != ''">
and district_code = #{districtCode}
</if>
</where>
</select>
<select id="listLeaseGoodsByApp" resultMap="leaseGoodsMap">
SELECT
lg.id,
lg.trade_name,
lg.product_type_id,
lg.shelf_status,
lg.selling_point,
lg.product_param,
lg.user_account_id,
lg.show_price,
lg.min_lease_term,
lg.max_lease_term,
lg.create_time,
lgr.id resourceId,
lgr.type,
lgr.url,
lps.cash_pledge,
lps.three_days_rental,
lps.seven_days_rental,
lps.thirty_days_rental,
lps.ninety_days_rental,
lps.max_days_rental,
lps.stock
FROM
lease_goods lg
LEFT JOIN lease_goods_resources lgr ON lgr.lease_goods_id = lg.id
LEFT JOIN lease_price_stock lps ON lps.lease_goods_id = lg.id
<where>
shelf_status = 1
<if test="tradeName != null and tradeName != ''">
and (lg.trade_name LIKE CONCAT('%',#{tradeName},'%'))
</if>
<if test="productTypeId != null">
and lg.product_type_id = #{productTypeId}
</if>
<if test="brandInfoId != null">
and lg.brand_info_id = #{brandInfoId}
</if>
<if test="userAccountId != null">
and lg.user_account_id = #{userAccountId}
</if>
<if test="districtCode != null and districtCode != ''">
and district_code = #{districtCode}
</if>
</where>
order by lg.shelf_status DESC, lg.sort DESC
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论