提交 fe77c2e3 作者: zhenjie

Merge branch 'develop'

...@@ -88,7 +88,7 @@ jobs: ...@@ -88,7 +88,7 @@ jobs:
{ {
"msgtype": "markdown", "msgtype": "markdown",
"markdown": { "markdown": {
"content": "### GitHub构建并推送镜像失败 \n "content": "### `GitHub构建并推送镜像失败` \n
> - 提交人: ${{github.actor}} \n > - 提交人: ${{github.actor}} \n
> - 提交信息: ${{github.event.head_commit.message}} \n > - 提交信息: ${{github.event.head_commit.message}} \n
> - 提交到仓库: ${{github.repository}} \n > - 提交到仓库: ${{github.repository}} \n
......
...@@ -88,7 +88,7 @@ jobs: ...@@ -88,7 +88,7 @@ jobs:
{ {
"msgtype": "markdown", "msgtype": "markdown",
"markdown": { "markdown": {
"content": "### GitHub构建并推送镜像失败 \n "content": "### `GitHub构建并推送镜像失败` \n
> - 提交人: ${{github.actor}} \n > - 提交人: ${{github.actor}} \n
> - 提交信息: ${{github.event.head_commit.message}} \n > - 提交信息: ${{github.event.head_commit.message}} \n
> - 提交到仓库: ${{github.repository}} \n > - 提交到仓库: ${{github.repository}} \n
......
...@@ -14,4 +14,4 @@ patches: ...@@ -14,4 +14,4 @@ patches:
images: images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG - name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/oms newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/oms
newTag: afb7ddf2776b53bdcbb4f14def897363ec3e8e5d newTag: ce4d28ea571f7394271384ad94b0f7a773fdc8a3
...@@ -14,7 +14,9 @@ ...@@ -14,7 +14,9 @@
<name>oms</name> <name>oms</name>
<description>Demo project for Spring Boot</description> <description>Demo project for Spring Boot</description>
<properties> <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> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
...@@ -44,6 +46,16 @@ ...@@ -44,6 +46,16 @@
<artifactId>easypoi-base</artifactId> <artifactId>easypoi-base</artifactId>
<version>4.1.0</version> <version>4.1.0</version>
</dependency> </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> <dependency>
<groupId>cn.afterturn</groupId> <groupId>cn.afterturn</groupId>
<artifactId>easypoi-web</artifactId> <artifactId>easypoi-web</artifactId>
...@@ -135,6 +147,93 @@ ...@@ -135,6 +147,93 @@
</dependency> </dependency>
</dependencies> </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> <build>
<plugins> <plugins>
......
...@@ -2,8 +2,10 @@ package com.mmc.oms; ...@@ -2,8 +2,10 @@ package com.mmc.oms;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication @SpringBootApplication
@EnableFeignClients(basePackages = "com.mmc.oms.feign")
public class OmsApplication { public class OmsApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -59,7 +59,6 @@ public class UserAddressController extends BaseController{ ...@@ -59,7 +59,6 @@ public class UserAddressController extends BaseController{
@ApiOperation(value = "根据id查询地址") @ApiOperation(value = "根据id查询地址")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserAddressDTO.class) }) @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserAddressDTO.class) })
@ApiIgnore
@GetMapping("getUserAddressInfo") @GetMapping("getUserAddressInfo")
public UserAddressDTO getUserAddressInfo(@RequestParam Integer userAddressId){ public UserAddressDTO getUserAddressInfo(@RequestParam Integer userAddressId){
return userAddressService.getUserAddressInfo(userAddressId); return userAddressService.getUserAddressInfo(userAddressId);
......
...@@ -59,8 +59,15 @@ public class UserAddressDO implements Serializable { ...@@ -59,8 +59,15 @@ public class UserAddressDO implements Serializable {
@ApiModelProperty(value = "逻辑删除") @ApiModelProperty(value = "逻辑删除")
private List<Integer> isDeleteds; 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.userAccountId = userAccountId;
this.type = type; this.type = type;
this.flag = flag;
} }
} }
package com.mmc.oms.feign; package com.mmc.oms.feign;
import com.mmc.oms.model.dto.mall.*; import com.mmc.oms.common.result.ResultBody;
import com.mmc.oms.model.qo.mall.MallOrderGoodsInfoQO; import com.mmc.oms.feign.hystrix.PmsAppApiHystrix;
import com.mmc.oms.model.qo.mall.ProductSpecPriceQO; import org.springframework.cloud.openfeign.FeignClient;
//import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* @author: zj * @author: zj
* @Date: 2023/6/5 15:18 * @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 { public interface PmsAppApi {
@PostMapping("/pms/goods/fillGoodsInfo") @GetMapping("lease/goods/feignLeaseGoodsInfoByAddressId")
List<MallGoodsShopCarDTO> fillGoodsInfo(@RequestBody List<MallGoodsShopCarDTO> param, @RequestHeader("token") String token); public ResultBody feignLeaseGoodsInfoByAddressId(@RequestParam Integer id);
@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);
} }
package com.mmc.oms.feign.config; package com.mmc.oms.feign.config;
import com.mmc.oms.feign.hystrix.PmsAppApiHystrix;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
///** /**
// * @author: zj * @author: zj
// * @Date: 2023/5/18 18:21 * @Date: 2023/5/18 18:21
// */ */
//@ComponentScan(basePackages = "com.mmc.oms.feign") @ComponentScan(basePackages = "com.mmc.oms.feign")
//@Configuration @Configuration
//public class FeignConfiguration { public class FeignConfiguration {
//
// @Bean(name = "workServiceHystrix") @Bean(name = "pmsAppApiHystrix")
// public WorkServiceHystrix workServiceHystrixApi() { public PmsAppApiHystrix PmsAppApi() {
// return new WorkServiceHystrix(); return new PmsAppApiHystrix();
// } }
//}
}
package com.mmc.oms.feign.hystrix; 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.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 lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List; import java.util.List;
...@@ -16,32 +14,8 @@ import java.util.List; ...@@ -16,32 +14,8 @@ import java.util.List;
@Slf4j @Slf4j
public class PmsAppApiHystrix implements PmsAppApi { public class PmsAppApiHystrix implements PmsAppApi {
@Override @Override
public List<MallGoodsShopCarDTO> fillGoodsInfo(List<MallGoodsShopCarDTO> param, String token) { public ResultBody feignLeaseGoodsInfoByAddressId(Integer id) {
log.info("熔断:MallGoodsClientHystrix.fillGoodsInfo==error==>param:{}", JSONObject.toJSONString(param)); log.info("熔断:PmsAppApiHystrix.feignLeaseGoodsInfoByAddressId==error==>param:{}",id);
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);
return null; return null;
} }
} }
...@@ -39,4 +39,8 @@ public class UserAddressDTO implements Serializable { ...@@ -39,4 +39,8 @@ public class UserAddressDTO implements Serializable {
@ApiModelProperty(value = "使用类型;0默认,1普通") @ApiModelProperty(value = "使用类型;0默认,1普通")
private Integer type; private Integer type;
@ApiModelProperty(value = "市code编码")
private String districtCode;
} }
...@@ -54,4 +54,7 @@ public class UserAddressQO implements Serializable { ...@@ -54,4 +54,7 @@ public class UserAddressQO implements Serializable {
@ApiModelProperty(value = "逻辑删除") @ApiModelProperty(value = "逻辑删除")
private List<Integer> isDeleteds; private List<Integer> isDeleteds;
@ApiModelProperty(value = "标识;0:PC,100:小程序",hidden = true)
private Integer flag;
} }
...@@ -53,4 +53,7 @@ public class UserAddressVO implements Serializable { ...@@ -53,4 +53,7 @@ public class UserAddressVO implements Serializable {
@ApiModelProperty(value = "使用类型;0默认,1普通") @ApiModelProperty(value = "使用类型;0默认,1普通")
@NotNull(message = "类型不能为空",groups = {Insert.class}) @NotNull(message = "类型不能为空",groups = {Insert.class})
private Integer type; private Integer type;
@ApiModelProperty(value = "市code编码")
private String districtCode;
} }
...@@ -3,15 +3,18 @@ package com.mmc.oms.service.Impl; ...@@ -3,15 +3,18 @@ package com.mmc.oms.service.Impl;
import com.mmc.oms.common.result.ResultBody; import com.mmc.oms.common.result.ResultBody;
import com.mmc.oms.dao.UserAddressDao; import com.mmc.oms.dao.UserAddressDao;
import com.mmc.oms.entity.mall.UserAddressDO; 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.mall.UserAddressDTO;
import com.mmc.oms.model.dto.user.BaseAccountDTO; import com.mmc.oms.model.dto.user.BaseAccountDTO;
import com.mmc.oms.model.qo.mall.UserAddressQO; import com.mmc.oms.model.qo.mall.UserAddressQO;
import com.mmc.oms.model.vo.mall.UserAddressVO; import com.mmc.oms.model.vo.mall.UserAddressVO;
import com.mmc.oms.service.UserAddressService; import com.mmc.oms.service.UserAddressService;
import com.mmc.oms.util.BeanCopyUtils; import com.mmc.oms.util.BeanCopyUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -20,36 +23,51 @@ import java.util.stream.Collectors; ...@@ -20,36 +23,51 @@ import java.util.stream.Collectors;
* @Date: 2023/6/7 10:15 * @Date: 2023/6/7 10:15
*/ */
@Service @Service
@Slf4j
public class UserAddressServiceImpl implements UserAddressService { public class UserAddressServiceImpl implements UserAddressService {
@Autowired @Autowired
private UserAddressDao userAddressDao; private UserAddressDao userAddressDao;
@Autowired
private PmsAppApi pmsAppApi;
@Override @Override
public ResultBody insert(UserAddressVO param, BaseAccountDTO currentAccount) { public ResultBody insert(UserAddressVO param, BaseAccountDTO currentAccount) {
// 如果之前有默认的话,就要修改为非默认 // 如果之前有默认的话,就要修改为非默认
isDefault(param, currentAccount.getUserAccountId()); isDefault(param, currentAccount);
UserAddressDO userAddressDO = BeanCopyUtils.properties(param, new UserAddressDO()); UserAddressDO userAddressDO = BeanCopyUtils.properties(param, new UserAddressDO());
userAddressDO.setUserAccountId(currentAccount.getUserAccountId()); userAddressDO.setUserAccountId(currentAccount.getUserAccountId());
userAddressDO.setFlag(currentAccount.getPortType());
userAddressDao.insert(userAddressDO); userAddressDao.insert(userAddressDO);
return ResultBody.success(); 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)){ if(param.getType()!=null && param.getType().equals(0)){
userAddressDao.update(new UserAddressDO(userAccountId,1)); userAddressDao.update(new UserAddressDO(currentAccount.getUserAccountId(),1,currentAccount.getPortType()));
} }
} }
@Override @Override
public ResultBody update(UserAddressVO param, BaseAccountDTO currentAccount) { public ResultBody update(UserAddressVO param, BaseAccountDTO currentAccount) {
isDefault(param,currentAccount.getUserAccountId()); isDefault(param,currentAccount);
userAddressDao.removeById(param.getId()); 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(); return ResultBody.success();
} }
@Override @Override
public ResultBody deleteById(Integer id) { 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); userAddressDao.removeById(id);
return ResultBody.success(); return ResultBody.success();
} }
...@@ -64,6 +82,7 @@ public class UserAddressServiceImpl implements UserAddressService { ...@@ -64,6 +82,7 @@ public class UserAddressServiceImpl implements UserAddressService {
@Override @Override
public ResultBody<List<UserAddressDTO>> selectList(UserAddressQO param, BaseAccountDTO currentAccount) { public ResultBody<List<UserAddressDTO>> selectList(UserAddressQO param, BaseAccountDTO currentAccount) {
param.setUserAccountId(currentAccount.getUserAccountId()); param.setUserAccountId(currentAccount.getUserAccountId());
param.setFlag(currentAccount.getPortType());
UserAddressDO userAddressDO = BeanCopyUtils.properties(param, new UserAddressDO()); UserAddressDO userAddressDO = BeanCopyUtils.properties(param, new UserAddressDO());
List<UserAddressDO> list = userAddressDao.selectList(userAddressDO); List<UserAddressDO> list = userAddressDao.selectList(userAddressDO);
List<UserAddressDTO> collect = list.stream().map(item -> BeanCopyUtils.properties(item, new UserAddressDTO())).collect(Collectors.toList()); List<UserAddressDTO> collect = list.stream().map(item -> BeanCopyUtils.properties(item, new UserAddressDTO())).collect(Collectors.toList());
......
...@@ -17,13 +17,13 @@ ...@@ -17,13 +17,13 @@
<!-- 基本字段 --> <!-- 基本字段 -->
<sql id="Base_Column_List"> <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> </sql>
<!-- 新增所有列 --> <!-- 新增所有列 -->
<insert id="insert" keyProperty="id" useGeneratedKeys="true" parameterType="com.mmc.oms.entity.mall.UserAddressDO"> <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`) 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}) values (#{userAccountId}, #{takeName}, #{takePhone}, #{takeRegion}, #{takeAddress},#{type},#{flag},#{districtCode})
</insert> </insert>
<!-- 通过主键修改数据 --> <!-- 通过主键修改数据 -->
...@@ -51,13 +51,16 @@ ...@@ -51,13 +51,16 @@
<if test="isDeleted != null"> <if test="isDeleted != null">
is_deleted = #{isDeleted}, is_deleted = #{isDeleted},
</if> </if>
<if test="districtCode != null">
district_code = #{districtCode}
</if>
</set> </set>
<where> <where>
<if test="id !=null"> <if test="id !=null">
and id = #{id} and id = #{id}
</if> </if>
<if test="userAccountId != null"> <if test="userAccountId != null">
and user_account_id = #{userAccountId} and user_account_id = #{userAccountId} and flag = #{flag}
</if> </if>
</where> </where>
</update> </update>
...@@ -113,6 +116,9 @@ ...@@ -113,6 +116,9 @@
#{isDeleted} #{isDeleted}
</foreach> </foreach>
</if> </if>
<if test="flag != null">
and flag = #{flag}
</if>
</where> </where>
order by type ,created_time desc order by type ,created_time desc
</select> </select>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论