提交 fe77c2e3 作者: zhenjie

Merge branch 'develop'

......@@ -88,7 +88,7 @@ jobs:
{
"msgtype": "markdown",
"markdown": {
"content": "### GitHub构建并推送镜像失败 \n
"content": "### `GitHub构建并推送镜像失败` \n
> - 提交人: ${{github.actor}} \n
> - 提交信息: ${{github.event.head_commit.message}} \n
> - 提交到仓库: ${{github.repository}} \n
......
......@@ -88,7 +88,7 @@ jobs:
{
"msgtype": "markdown",
"markdown": {
"content": "### GitHub构建并推送镜像失败 \n
"content": "### `GitHub构建并推送镜像失败` \n
> - 提交人: ${{github.actor}} \n
> - 提交信息: ${{github.event.head_commit.message}} \n
> - 提交到仓库: ${{github.repository}} \n
......
......@@ -14,4 +14,4 @@ patches:
images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/oms
newTag: afb7ddf2776b53bdcbb4f14def897363ec3e8e5d
newTag: ce4d28ea571f7394271384ad94b0f7a773fdc8a3
......@@ -14,7 +14,9 @@
<name>oms</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Hoxton.SR6</spring-cloud.version>
<springfox.version>2.9.2</springfox.version>
<spring-cloud-alibaba-seata.version>2.2.1.RELEASE</spring-cloud-alibaba-seata.version>
</properties>
<dependencies>
<dependency>
......@@ -44,6 +46,16 @@
<artifactId>easypoi-base</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<!-- 使用okhttp-feign-连接池技术 -->
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-okhttp</artifactId>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-web</artifactId>
......@@ -135,6 +147,93 @@
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.10</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.28</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-base</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-web</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-annotation</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.1.3</version>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.10.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
<version>3.13.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
......
......@@ -2,8 +2,10 @@ package com.mmc.oms;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableFeignClients(basePackages = "com.mmc.oms.feign")
public class OmsApplication {
public static void main(String[] args) {
......
......@@ -59,7 +59,6 @@ public class UserAddressController extends BaseController{
@ApiOperation(value = "根据id查询地址")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserAddressDTO.class) })
@ApiIgnore
@GetMapping("getUserAddressInfo")
public UserAddressDTO getUserAddressInfo(@RequestParam Integer userAddressId){
return userAddressService.getUserAddressInfo(userAddressId);
......
......@@ -59,8 +59,15 @@ public class UserAddressDO implements Serializable {
@ApiModelProperty(value = "逻辑删除")
private List<Integer> isDeleteds;
public UserAddressDO(Integer userAccountId, Integer type) {
@ApiModelProperty(value = "标识;0是后台管理 100客户端 小程序")
private Integer flag;
@ApiModelProperty(value = "市code编码")
private String districtCode;
public UserAddressDO(Integer userAccountId, Integer type,Integer flag) {
this.userAccountId = userAccountId;
this.type = type;
this.flag = flag;
}
}
package com.mmc.oms.feign;
import com.mmc.oms.model.dto.mall.*;
import com.mmc.oms.model.qo.mall.MallOrderGoodsInfoQO;
import com.mmc.oms.model.qo.mall.ProductSpecPriceQO;
//import org.springframework.cloud.openfeign.FeignClient;
import com.mmc.oms.common.result.ResultBody;
import com.mmc.oms.feign.hystrix.PmsAppApiHystrix;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author: zj
* @Date: 2023/6/5 15:18
*/
//@FeignClient(url = "${pms.url}", name = "pms-svc", fallback = PmsAppApiHystrix.class)
@FeignClient(url = "${pms.url}", name = "pms-svc", fallback = PmsAppApiHystrix.class)
public interface PmsAppApi {
@PostMapping("/pms/goods/fillGoodsInfo")
List<MallGoodsShopCarDTO> fillGoodsInfo(@RequestBody List<MallGoodsShopCarDTO> param, @RequestHeader("token") String token);
@PostMapping("/pms/goods/feignListProdGoodsSkuInfo")
List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(@RequestBody MallOrderGoodsInfoQO mallOrderGoodsInfoQO, @RequestHeader("token") String token);
@PostMapping("/pms/goods/feignListIndstGoodsSkuInfo")
List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(@RequestBody MallOrderGoodsInfoQO mallOrderGoodsInfoQO, @RequestHeader("token") String token);
@PostMapping("/pms/goods/feignListProductSpecPrice")
List<MallProductSpecPriceDTO> feignListProductSpecPrice(@RequestBody ProductSpecPriceQO productSpecPriceQO, @RequestHeader("token") String token);
@GetMapping("/pms/goods/feignGetUnitPriceByTag")
public ProductSpecPriceDTO feignGetUnitPriceByTag(@RequestParam(value = "specId")Integer specId,
@RequestParam(value = "tagId")Integer tagId, @RequestHeader("token") String token);
@GetMapping("lease/goods/feignLeaseGoodsInfoByAddressId")
public ResultBody feignLeaseGoodsInfoByAddressId(@RequestParam Integer id);
}
package com.mmc.oms.feign.config;
import com.mmc.oms.feign.hystrix.PmsAppApiHystrix;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
///**
// * @author: zj
// * @Date: 2023/5/18 18:21
// */
//@ComponentScan(basePackages = "com.mmc.oms.feign")
//@Configuration
//public class FeignConfiguration {
//
// @Bean(name = "workServiceHystrix")
// public WorkServiceHystrix workServiceHystrixApi() {
// return new WorkServiceHystrix();
// }
//}
/**
* @author: zj
* @Date: 2023/5/18 18:21
*/
@ComponentScan(basePackages = "com.mmc.oms.feign")
@Configuration
public class FeignConfiguration {
@Bean(name = "pmsAppApiHystrix")
public PmsAppApiHystrix PmsAppApi() {
return new PmsAppApiHystrix();
}
}
package com.mmc.oms.feign.hystrix;
import com.alibaba.fastjson.JSONObject;
import com.mmc.oms.common.result.ResultBody;
import com.mmc.oms.feign.PmsAppApi;
import com.mmc.oms.model.dto.mall.*;
import com.mmc.oms.model.qo.mall.MallOrderGoodsInfoQO;
import com.mmc.oms.model.qo.mall.ProductSpecPriceQO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
......@@ -16,32 +14,8 @@ import java.util.List;
@Slf4j
public class PmsAppApiHystrix implements PmsAppApi {
@Override
public List<MallGoodsShopCarDTO> fillGoodsInfo(List<MallGoodsShopCarDTO> param, String token) {
log.info("熔断:MallGoodsClientHystrix.fillGoodsInfo==error==>param:{}", JSONObject.toJSONString(param));
return null;
}
@Override
public List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO, String token) {
log.info("熔断:MallGoodsClientHystrix.feignListProdGoodsSkuInfo==error==>param:{}", JSONObject.toJSONString(mallOrderGoodsInfoQO));
return null;
}
@Override
public List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO, String token) {
log.info("熔断:MallGoodsClientHystrix.feignListIndstGoodsSkuInfo==error==>param:{}", JSONObject.toJSONString(mallOrderGoodsInfoQO));
return null;
}
@Override
public List<MallProductSpecPriceDTO> feignListProductSpecPrice(ProductSpecPriceQO productSpecPriceQO, String token) {
log.info("熔断:MallGoodsClientHystrix.feignListProductSpecPrice==error==>param:{}", JSONObject.toJSONString(productSpecPriceQO));
return null;
}
@Override
public ProductSpecPriceDTO feignGetUnitPriceByTag(Integer specId, Integer tagId, String token) {
log.info("熔断:MallGoodsClientHystrix.feignGetUnitPriceByTag==error==>param:{}",specId,tagId);
public ResultBody feignLeaseGoodsInfoByAddressId(Integer id) {
log.info("熔断:PmsAppApiHystrix.feignLeaseGoodsInfoByAddressId==error==>param:{}",id);
return null;
}
}
......@@ -39,4 +39,8 @@ public class UserAddressDTO implements Serializable {
@ApiModelProperty(value = "使用类型;0默认,1普通")
private Integer type;
@ApiModelProperty(value = "市code编码")
private String districtCode;
}
......@@ -54,4 +54,7 @@ public class UserAddressQO implements Serializable {
@ApiModelProperty(value = "逻辑删除")
private List<Integer> isDeleteds;
@ApiModelProperty(value = "标识;0:PC,100:小程序",hidden = true)
private Integer flag;
}
......@@ -53,4 +53,7 @@ public class UserAddressVO implements Serializable {
@ApiModelProperty(value = "使用类型;0默认,1普通")
@NotNull(message = "类型不能为空",groups = {Insert.class})
private Integer type;
@ApiModelProperty(value = "市code编码")
private String districtCode;
}
......@@ -3,15 +3,18 @@ package com.mmc.oms.service.Impl;
import com.mmc.oms.common.result.ResultBody;
import com.mmc.oms.dao.UserAddressDao;
import com.mmc.oms.entity.mall.UserAddressDO;
import com.mmc.oms.feign.PmsAppApi;
import com.mmc.oms.model.dto.mall.UserAddressDTO;
import com.mmc.oms.model.dto.user.BaseAccountDTO;
import com.mmc.oms.model.qo.mall.UserAddressQO;
import com.mmc.oms.model.vo.mall.UserAddressVO;
import com.mmc.oms.service.UserAddressService;
import com.mmc.oms.util.BeanCopyUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
......@@ -20,36 +23,51 @@ import java.util.stream.Collectors;
* @Date: 2023/6/7 10:15
*/
@Service
@Slf4j
public class UserAddressServiceImpl implements UserAddressService {
@Autowired
private UserAddressDao userAddressDao;
@Autowired
private PmsAppApi pmsAppApi;
@Override
public ResultBody insert(UserAddressVO param, BaseAccountDTO currentAccount) {
// 如果之前有默认的话,就要修改为非默认
isDefault(param, currentAccount.getUserAccountId());
isDefault(param, currentAccount);
UserAddressDO userAddressDO = BeanCopyUtils.properties(param, new UserAddressDO());
userAddressDO.setUserAccountId(currentAccount.getUserAccountId());
userAddressDO.setFlag(currentAccount.getPortType());
userAddressDao.insert(userAddressDO);
return ResultBody.success();
}
private void isDefault(UserAddressVO param, Integer userAccountId) {
private void isDefault(UserAddressVO param, BaseAccountDTO currentAccount) {
if(param.getType()!=null && param.getType().equals(0)){
userAddressDao.update(new UserAddressDO(userAccountId,1));
userAddressDao.update(new UserAddressDO(currentAccount.getUserAccountId(),1,currentAccount.getPortType()));
}
}
@Override
public ResultBody update(UserAddressVO param, BaseAccountDTO currentAccount) {
isDefault(param,currentAccount.getUserAccountId());
isDefault(param,currentAccount);
userAddressDao.removeById(param.getId());
userAddressDao.insert(BeanCopyUtils.properties(param, new UserAddressDO()));
UserAddressDO userAddressDO = BeanCopyUtils.properties(param, new UserAddressDO());
userAddressDO.setFlag(currentAccount.getPortType());
userAddressDO.setUserAccountId(currentAccount.getUserAccountId());
userAddressDao.insert(userAddressDO);
return ResultBody.success();
}
@Override
public ResultBody deleteById(Integer id) {
ResultBody resultBody = pmsAppApi.feignLeaseGoodsInfoByAddressId(id);
if (resultBody == null || !resultBody.getCode().equals("200")) {
log.error("远程调用失败:返回数据为null=====>UserAddressServiceImpl.deleteById=====>param{}",id);
return ResultBody.error("服务器异常,请稍后重试!");
}
int count = (int)resultBody.getResult();
if (count > 0) {
return ResultBody.error("有商品绑定该地址,不可删除!");
}
userAddressDao.removeById(id);
return ResultBody.success();
}
......@@ -64,6 +82,7 @@ public class UserAddressServiceImpl implements UserAddressService {
@Override
public ResultBody<List<UserAddressDTO>> selectList(UserAddressQO param, BaseAccountDTO currentAccount) {
param.setUserAccountId(currentAccount.getUserAccountId());
param.setFlag(currentAccount.getPortType());
UserAddressDO userAddressDO = BeanCopyUtils.properties(param, new UserAddressDO());
List<UserAddressDO> list = userAddressDao.selectList(userAddressDO);
List<UserAddressDTO> collect = list.stream().map(item -> BeanCopyUtils.properties(item, new UserAddressDTO())).collect(Collectors.toList());
......
......@@ -17,13 +17,13 @@
<!-- 基本字段 -->
<sql id="Base_Column_List">
id,user_account_id,take_name,take_phone,take_region,take_address,`type`,created_time,updated_time
id,user_account_id,take_name,take_phone,take_region,take_address,`type`,created_time,updated_time,flag,district_code
</sql>
<!-- 新增所有列 -->
<insert id="insert" keyProperty="id" useGeneratedKeys="true" parameterType="com.mmc.oms.entity.mall.UserAddressDO">
insert into user_address(user_account_id, take_name, take_phone, take_region, take_address,`type`)
values (#{userAccountId}, #{takeName}, #{takePhone}, #{takeRegion}, #{takeAddress},#{type})
insert into user_address(user_account_id, take_name, take_phone, take_region, take_address,`type`,flag,district_code)
values (#{userAccountId}, #{takeName}, #{takePhone}, #{takeRegion}, #{takeAddress},#{type},#{flag},#{districtCode})
</insert>
<!-- 通过主键修改数据 -->
......@@ -51,13 +51,16 @@
<if test="isDeleted != null">
is_deleted = #{isDeleted},
</if>
<if test="districtCode != null">
district_code = #{districtCode}
</if>
</set>
<where>
<if test="id !=null">
and id = #{id}
</if>
<if test="userAccountId != null">
and user_account_id = #{userAccountId}
and user_account_id = #{userAccountId} and flag = #{flag}
</if>
</where>
</update>
......@@ -113,6 +116,9 @@
#{isDeleted}
</foreach>
</if>
<if test="flag != null">
and flag = #{flag}
</if>
</where>
order by type ,created_time desc
</select>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论