parent
cba8461bae
commit
f81db55f71
@ -0,0 +1,11 @@ |
||||
package com.dxhy.order.consumer.dao; |
||||
|
||||
import com.dxhy.order.consumer.modules.bespoke.model.sk.SkOrderInfo; |
||||
|
||||
public interface SkOrderInfoMapper { |
||||
|
||||
//插入订单信息
|
||||
int insertSkOrderInfo(SkOrderInfo skOrderInfo); |
||||
|
||||
SkOrderInfo checkOrderExist(String xsddm); |
||||
} |
@ -0,0 +1,9 @@ |
||||
package com.dxhy.order.consumer.dao; |
||||
|
||||
import com.dxhy.order.consumer.modules.bespoke.model.sk.SkOrderItemInfo; |
||||
|
||||
public interface SkOrderItemInfoMapper { |
||||
|
||||
//插入订单详情
|
||||
int insertSkOrderItemInfo(SkOrderItemInfo skOrderItemInfo); |
||||
} |
@ -0,0 +1,16 @@ |
||||
package com.dxhy.order.consumer.dao; |
||||
|
||||
import com.dxhy.order.consumer.modules.bespoke.model.req.ReqParam; |
||||
import com.dxhy.order.consumer.modules.bespoke.model.sk.SkOrderInfo; |
||||
import com.dxhy.order.consumer.modules.bespoke.model.sk.SkOrderItemInfo; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface SkOrderMapper { |
||||
|
||||
//查询订单头信息
|
||||
List<SkOrderInfo> findOrderHeadList(ReqParam reqParam); |
||||
|
||||
//查询订单明细信息
|
||||
List<SkOrderItemInfo> findOrderDetailList(String xsddm); |
||||
} |
@ -0,0 +1,14 @@ |
||||
package com.dxhy.order.consumer.dao; |
||||
|
||||
import com.dxhy.order.consumer.modules.bespoke.model.req.ReqParam; |
||||
import com.dxhy.order.consumer.modules.bespoke.model.yy.YyOrderInfo; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface YyOrderInfoMapper { |
||||
|
||||
//插入订单
|
||||
int insertYyOrderInfo(YyOrderInfo yyOrderInfo); |
||||
|
||||
YyOrderInfo checkOrderExist(String cdlcode); |
||||
} |
@ -0,0 +1,9 @@ |
||||
package com.dxhy.order.consumer.dao; |
||||
|
||||
import com.dxhy.order.consumer.modules.bespoke.model.yy.YyOrderItemInfo; |
||||
|
||||
public interface YyOrderItemInfoMapper { |
||||
|
||||
//插入订单明细
|
||||
int insertYyOrderItemInfo(YyOrderItemInfo yyOrderItemInfo); |
||||
} |
@ -0,0 +1,16 @@ |
||||
package com.dxhy.order.consumer.dao; |
||||
|
||||
import com.dxhy.order.consumer.modules.bespoke.model.req.ReqParam; |
||||
import com.dxhy.order.consumer.modules.bespoke.model.yy.YyOrderInfo; |
||||
import com.dxhy.order.consumer.modules.bespoke.model.yy.YyOrderItemInfo; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface YyOrderMapper { |
||||
|
||||
//订单读取
|
||||
List<YyOrderInfo> findOrderHeadList(ReqParam reqParam); |
||||
|
||||
//订单明细读取
|
||||
List<YyOrderItemInfo> findOrderDetailList(String cdlcode); |
||||
} |
@ -0,0 +1,25 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.config; |
||||
|
||||
import com.dxhy.order.consumer.modules.bespoke.constant.ServiceEnmu; |
||||
import org.springframework.beans.factory.InitializingBean; |
||||
import org.springframework.stereotype.Component; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
@Component |
||||
public class ServiceConfig implements InitializingBean { |
||||
|
||||
private static Map<String,String> serviceMap; |
||||
|
||||
@Override |
||||
public void afterPropertiesSet() throws Exception { |
||||
serviceMap = new HashMap<>(); |
||||
for (ServiceEnmu value : ServiceEnmu.values()) { |
||||
serviceMap.put(value.getNsrsbh(),value.getService()); |
||||
} |
||||
} |
||||
|
||||
public static String getService(String nsrsbh){ |
||||
return serviceMap.get(nsrsbh); |
||||
} |
||||
} |
@ -0,0 +1,15 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.config.datasource.annotation; |
||||
|
||||
import java.lang.annotation.*; |
||||
|
||||
/** |
||||
* 多数据源注解 |
||||
*/ |
||||
|
||||
@Target({ElementType.METHOD, ElementType.TYPE}) |
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
@Documented |
||||
@Inherited |
||||
public @interface DataSource { |
||||
String value() default ""; |
||||
} |
@ -0,0 +1,72 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.config.datasource.aspect; |
||||
|
||||
|
||||
import com.dxhy.order.consumer.modules.bespoke.config.datasource.annotation.DataSource; |
||||
import com.dxhy.order.consumer.modules.bespoke.config.datasource.config.DynamicContextHolder; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.commons.lang3.ObjectUtils; |
||||
import org.aspectj.lang.ProceedingJoinPoint; |
||||
import org.aspectj.lang.annotation.Around; |
||||
import org.aspectj.lang.annotation.Aspect; |
||||
import org.aspectj.lang.annotation.Pointcut; |
||||
import org.aspectj.lang.reflect.MethodSignature; |
||||
import org.springframework.core.Ordered; |
||||
import org.springframework.core.annotation.AnnotationUtils; |
||||
import org.springframework.core.annotation.Order; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.util.Objects; |
||||
|
||||
/** |
||||
* 多数据源,切面处理类 |
||||
*/ |
||||
@Aspect |
||||
@Component |
||||
@Order(Ordered.HIGHEST_PRECEDENCE) |
||||
@Slf4j |
||||
public class DataSourceAspect { |
||||
|
||||
@Pointcut("@annotation(com.dxhy.order.consumer.modules.bespoke.config.datasource.annotation.DataSource) " |
||||
+ "|| @within(com.dxhy.order.consumer.modules.bespoke.config.datasource.annotation.DataSource)") |
||||
public void dataSourcePointCut() { |
||||
|
||||
} |
||||
|
||||
@Around("dataSourcePointCut()") |
||||
public Object around(ProceedingJoinPoint point) throws Throwable { |
||||
DataSource dataSource = getDataSource(point); |
||||
|
||||
if (ObjectUtils.isNotEmpty(dataSource)) |
||||
{ |
||||
log.info("切换数据源:{}", dataSource.value()); |
||||
DynamicContextHolder.push(dataSource.value()); |
||||
} |
||||
|
||||
try |
||||
{ |
||||
return point.proceed(); |
||||
} |
||||
finally |
||||
{ |
||||
// 销毁数据源 在执行方法之后
|
||||
DynamicContextHolder.poll(); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 获取需要切换的数据源 |
||||
*/ |
||||
public DataSource getDataSource(ProceedingJoinPoint point) |
||||
{ |
||||
MethodSignature signature = (MethodSignature) point.getSignature(); |
||||
DataSource dataSource = AnnotationUtils.findAnnotation(signature.getMethod(), DataSource.class); |
||||
if (Objects.nonNull(dataSource)) |
||||
{ |
||||
return dataSource; |
||||
} |
||||
|
||||
return AnnotationUtils.findAnnotation(signature.getDeclaringType(), DataSource.class); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,55 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.config.datasource.config; |
||||
|
||||
import com.dxhy.management.common.constant.ConfigureConstant; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import java.util.ArrayDeque; |
||||
import java.util.Deque; |
||||
|
||||
/** |
||||
* 多数据源上下文 |
||||
*/ |
||||
@Slf4j |
||||
public class DynamicContextHolder { |
||||
private static final ThreadLocal<Deque<String>> CONTEXT_HOLDER = ThreadLocal.withInitial(() -> new ArrayDeque()); |
||||
|
||||
/** |
||||
* 获得当前线程数据源 |
||||
* |
||||
* 数据源名称 |
||||
*/ |
||||
public static String peek() { |
||||
return CONTEXT_HOLDER.get().peek(); |
||||
} |
||||
|
||||
/** |
||||
* 设置当前线程数据源 |
||||
* |
||||
* @param dataSource |
||||
* 数据源名称 |
||||
*/ |
||||
public static void push(String dataSource) { |
||||
DynamicContextHolder.poll(); |
||||
String s = dataSource.split("_")[0]; |
||||
if (StringUtils.isNotBlank(s)) { |
||||
log.debug("获取当前数据源:" + dataSource); |
||||
CONTEXT_HOLDER.get().push(dataSource); |
||||
} else { |
||||
log.debug("获取当前数据源:" + dataSource); |
||||
CONTEXT_HOLDER.get().push(ConfigureConstant.MAIN); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 清空当前线程数据源 |
||||
*/ |
||||
public static void poll() { |
||||
Deque<String> deque = CONTEXT_HOLDER.get(); |
||||
deque.poll(); |
||||
if (deque.isEmpty()) { |
||||
CONTEXT_HOLDER.remove(); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,15 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.config.datasource.config; |
||||
|
||||
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; |
||||
|
||||
/** |
||||
* 多数据源 |
||||
*/ |
||||
public class DynamicDataSource extends AbstractRoutingDataSource { |
||||
|
||||
@Override |
||||
protected Object determineCurrentLookupKey() { |
||||
return DynamicContextHolder.peek(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,53 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.config.datasource.config; |
||||
|
||||
import com.dxhy.order.consumer.modules.bespoke.config.datasource.properties.DataSourceProperties; |
||||
import com.dxhy.order.consumer.modules.bespoke.config.datasource.properties.DynamicDataSourceProperties; |
||||
import com.zaxxer.hikari.HikariDataSource; |
||||
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import javax.annotation.Resource; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 配置多数据源 |
||||
*/ |
||||
@Configuration |
||||
@EnableConfigurationProperties(DynamicDataSourceProperties.class) |
||||
public class DynamicDataSourceConfig { |
||||
@Resource |
||||
private DynamicDataSourceProperties properties; |
||||
|
||||
@Bean |
||||
@ConfigurationProperties(prefix = "spring.datasource") |
||||
public DataSourceProperties dataSourceProperties() { |
||||
return new DataSourceProperties(); |
||||
} |
||||
|
||||
@Bean |
||||
public DynamicDataSource dynamicDataSource(DataSourceProperties dataSourceProperties) { |
||||
|
||||
DynamicDataSource dynamicDataSource = new DynamicDataSource(); |
||||
dynamicDataSource.setTargetDataSources(getDynamicDataSource()); |
||||
|
||||
// 默认数据源
|
||||
HikariDataSource defaultDataSource = DynamicDataSourceFactory.buildHikariDataSource(dataSourceProperties); |
||||
dynamicDataSource.setDefaultTargetDataSource(defaultDataSource); |
||||
|
||||
return dynamicDataSource; |
||||
} |
||||
|
||||
private Map<Object, Object> getDynamicDataSource() { |
||||
Map<String, DataSourceProperties> dataSourcePropertiesMap = properties.getDatasource(); |
||||
Map<Object, Object> targetDataSources = new HashMap<>(dataSourcePropertiesMap.size()); |
||||
dataSourcePropertiesMap.forEach((k, v) -> { |
||||
HikariDataSource hikariDataSource = DynamicDataSourceFactory.buildHikariDataSource(v); |
||||
targetDataSources.put(k, hikariDataSource); |
||||
}); |
||||
|
||||
return targetDataSources; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,28 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.config.datasource.config; |
||||
|
||||
import com.dxhy.order.consumer.modules.bespoke.config.datasource.properties.DataSourceProperties; |
||||
import com.zaxxer.hikari.HikariDataSource; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
|
||||
/** |
||||
* hikariDataSource |
||||
* |
||||
*/ |
||||
@Component |
||||
public class DynamicDataSourceFactory { |
||||
|
||||
public static HikariDataSource buildHikariDataSource(DataSourceProperties properties) { |
||||
|
||||
HikariDataSource hikariDataSource = new HikariDataSource(); |
||||
// 设置数据库基本信息
|
||||
hikariDataSource.setJdbcUrl(properties.getUrl()); |
||||
hikariDataSource.setDriverClassName(properties.getDriverClassName()); |
||||
hikariDataSource.setUsername(properties.getUsername()); |
||||
hikariDataSource.setPassword(properties.getPassword()); |
||||
|
||||
return hikariDataSource; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,18 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.config.datasource.properties; |
||||
|
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
|
||||
/** |
||||
* 多数据源属性 |
||||
* |
||||
*/ |
||||
@Getter |
||||
@Setter |
||||
public class DataSourceProperties { |
||||
|
||||
private String driverClassName; |
||||
private String url; |
||||
private String username; |
||||
private String password; |
||||
} |
@ -0,0 +1,23 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.config.datasource.properties; |
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
|
||||
import java.util.LinkedHashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 多数据源属性 |
||||
* |
||||
*/ |
||||
@ConfigurationProperties(prefix = "dynamic") |
||||
public class DynamicDataSourceProperties { |
||||
private Map<String, DataSourceProperties> datasource = new LinkedHashMap<>(); |
||||
|
||||
public Map<String, DataSourceProperties> getDatasource() { |
||||
return datasource; |
||||
} |
||||
|
||||
public void setDatasource(Map<String, DataSourceProperties> datasource) { |
||||
this.datasource = datasource; |
||||
} |
||||
} |
@ -0,0 +1,34 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.constant; |
||||
|
||||
public enum ServiceEnmu { |
||||
|
||||
YYSERVICE("Z","yyOrderService"), |
||||
SKSERVICE("P","skOrderServiceImpl"); |
||||
|
||||
private final String nsrsbh; |
||||
private final String service; |
||||
|
||||
private ServiceEnmu(String nsrsbh, String service) { |
||||
this.nsrsbh = nsrsbh; |
||||
this.service = service; |
||||
} |
||||
|
||||
|
||||
public static String getServiceName(String nsrsbh){ |
||||
String service = YYSERVICE.service; |
||||
for (ServiceEnmu value : ServiceEnmu.values()) { |
||||
if (nsrsbh.equals(value.getNsrsbh())){ |
||||
service = value.getService(); |
||||
} |
||||
} |
||||
return service; |
||||
} |
||||
|
||||
public String getNsrsbh() { |
||||
return this.nsrsbh; |
||||
} |
||||
|
||||
public String getService() { |
||||
return this.service; |
||||
} |
||||
} |
@ -0,0 +1,78 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.controller; |
||||
|
||||
import cn.hutool.core.date.DateUtil; |
||||
import com.alibaba.fastjson2.JSON; |
||||
import com.dxhy.base.common.model.R; |
||||
import com.dxhy.management.common.constant.ConfigureConstant; |
||||
import com.dxhy.order.baseservice.annotation.SysLog; |
||||
import com.dxhy.order.baseservice.constant.OrderValidateEnum; |
||||
import com.dxhy.order.consumer.modules.bespoke.config.datasource.config.DynamicContextHolder; |
||||
import com.dxhy.order.consumer.modules.bespoke.model.req.ReqParam; |
||||
import com.dxhy.order.consumer.modules.bespoke.service.OrderHandleService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.springframework.web.bind.annotation.PostMapping; |
||||
import org.springframework.web.bind.annotation.RequestBody; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
|
||||
@Slf4j |
||||
@RestController |
||||
@Api(value = "订单信息", tags = {"订单模块"}) |
||||
@RequestMapping(value = "/bespoke/order") |
||||
public class OrderHandleController { |
||||
|
||||
private static final String LOGGER_MSG = "(读入订单控制层)"; |
||||
|
||||
@Resource |
||||
private OrderHandleService orderHandleService; |
||||
|
||||
|
||||
/** |
||||
* ebs订单读入 |
||||
* |
||||
* @return |
||||
*/ |
||||
@ApiOperation(value = "订单读入", notes = "订单读入") |
||||
@PostMapping("/orderRead") |
||||
@SysLog(operation = "订单读入订单列表", operationDesc = "订单读入订单列表", key = "订单读入订单列表") |
||||
public R readEbsOrder(@RequestBody ReqParam reqParam) { |
||||
|
||||
log.info("{}订单读入请求参数:{}", LOGGER_MSG, JSON.toJSONString(reqParam)); |
||||
if (StringUtils.isNotBlank(reqParam.getStartTime()) |
||||
&& StringUtils.isNotBlank(reqParam.getEndTime())) { |
||||
Date starttime = DateUtil.parseDate(reqParam.getStartTime()); |
||||
Date endtime = DateUtil.parseDate(reqParam.getEndTime()); |
||||
if (starttime.after(endtime)) { |
||||
log.error("{}开始时间不能大于结束时间", LOGGER_MSG); |
||||
return R.error(OrderValidateEnum.ORDER_TIME_ERROR.getKey(), |
||||
OrderValidateEnum.ORDER_TIME_ERROR.getMessage()); |
||||
} |
||||
} |
||||
|
||||
if (StringUtils.isBlank(reqParam.getNsrsbh())) { |
||||
log.error("{},请求税号为空!", LOGGER_MSG); |
||||
return R.error(OrderValidateEnum.TAXCODE_ISNULL.getKey(), OrderValidateEnum.TAXCODE_ISNULL.getMessage()); |
||||
} |
||||
if (StringUtils.isBlank(reqParam.getEntId())){ |
||||
log.error("{},请求企业id为空!", LOGGER_MSG); |
||||
return R.error(OrderValidateEnum.ENTID_ISNULL.getKey(), OrderValidateEnum.ENTID_ISNULL.getMessage()); |
||||
} |
||||
|
||||
try { |
||||
return orderHandleService.readOrder(reqParam); |
||||
}catch (Exception e){ |
||||
log.error("{}订单读入异常", LOGGER_MSG, e); |
||||
DynamicContextHolder.push(ConfigureConstant.MAIN); |
||||
return R.error("订单读入异常,请联系运维人员"); |
||||
} |
||||
|
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,64 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.model.req; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Data |
||||
public class ReqParam { |
||||
|
||||
/* |
||||
* 纳税人识别号 |
||||
*/ |
||||
private String nsrsbh; |
||||
|
||||
/* |
||||
* 企业id |
||||
*/ |
||||
private String entId; |
||||
|
||||
/* |
||||
* 开始时间 |
||||
*/ |
||||
private String startTime; |
||||
|
||||
/* |
||||
* 结束时间 |
||||
*/ |
||||
private String endTime; |
||||
|
||||
/* |
||||
* 发票类型 |
||||
*/ |
||||
private String invoiceType; |
||||
|
||||
|
||||
/* |
||||
* 页码 |
||||
*/ |
||||
private String currPage; |
||||
|
||||
/* |
||||
* 每页条数 |
||||
*/ |
||||
private String pageSize; |
||||
|
||||
|
||||
/** |
||||
* 读入时间 |
||||
*/ |
||||
private String readTimeStart; |
||||
|
||||
/** |
||||
* 读入时间结束 |
||||
*/ |
||||
private String readTimeEnd; |
||||
|
||||
/** |
||||
* 订单号 |
||||
*/ |
||||
private String ddh; |
||||
|
||||
//凭证号
|
||||
private String pzh; |
||||
} |
@ -0,0 +1,79 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.model.sk; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.util.Date; |
||||
|
||||
@Data |
||||
public class SkOrderInfo { |
||||
/** |
||||
* 订单id |
||||
*/ |
||||
private String id; |
||||
/** |
||||
* 纳税人识别号 |
||||
*/ |
||||
private String nsrsbh; |
||||
/** |
||||
* 企业id |
||||
*/ |
||||
private String entId; |
||||
|
||||
/** |
||||
* 订单状态 |
||||
*/ |
||||
private String status; |
||||
/** |
||||
* 订单编号 |
||||
*/ |
||||
private String xsddm; |
||||
/** |
||||
* 发票类型 |
||||
*/ |
||||
private String fplx; |
||||
/** |
||||
* 购买方纳税人识别号 |
||||
*/ |
||||
private String khswdjh; |
||||
/** |
||||
* 购买方名称 |
||||
*/ |
||||
private String khmc; |
||||
/** |
||||
* 购买方地址、电话 |
||||
*/ |
||||
private String khdz; |
||||
/** |
||||
* 购买方开户行、账号 |
||||
*/ |
||||
private String khyh; |
||||
/** |
||||
* 含税金额 |
||||
*/ |
||||
private String hsje; |
||||
/** |
||||
* 税额 |
||||
*/ |
||||
private String se; |
||||
|
||||
/** |
||||
* 明细数量 |
||||
*/ |
||||
private String detailCount; |
||||
|
||||
|
||||
/** |
||||
* 客户系统日期 |
||||
*/ |
||||
private String kprq; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 修改时间 |
||||
*/ |
||||
private Date updateTime; |
||||
} |
@ -0,0 +1,58 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.model.sk; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.util.Date; |
||||
|
||||
@Data |
||||
public class SkOrderItemInfo { |
||||
/** |
||||
* id |
||||
*/ |
||||
private String id; |
||||
/** |
||||
* order_id |
||||
*/ |
||||
private String orderId; |
||||
/** |
||||
* 项目名称 |
||||
*/ |
||||
private String cpmc; |
||||
/** |
||||
* 规格型号 |
||||
*/ |
||||
private String xh; |
||||
/** |
||||
* 单位 |
||||
*/ |
||||
private String cpdw; |
||||
/** |
||||
* 数量 |
||||
*/ |
||||
private String cpsl; |
||||
/** |
||||
* 单价 |
||||
*/ |
||||
private String hsdj; |
||||
/** |
||||
* 金额 |
||||
*/ |
||||
private String hsje; |
||||
/** |
||||
* 税率 |
||||
*/ |
||||
private String sl; |
||||
/** |
||||
* 税额 |
||||
*/ |
||||
private String se; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
/** |
||||
* 修改时间 |
||||
*/ |
||||
private Date updateTime; |
||||
} |
@ -0,0 +1,82 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.model.yy; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.util.Date; |
||||
|
||||
@Data |
||||
public class YyOrderInfo { |
||||
/** |
||||
* id |
||||
*/ |
||||
private String id; |
||||
/** |
||||
* 纳税人识别号 |
||||
*/ |
||||
private String nsrsbh; |
||||
/** |
||||
* 组织id |
||||
*/ |
||||
private String entId; |
||||
/** |
||||
* 订单状态 |
||||
*/ |
||||
private String status; |
||||
|
||||
/** |
||||
* 订单明细数量 |
||||
*/ |
||||
private String detailCount; |
||||
|
||||
/** |
||||
* 合计金额 |
||||
*/ |
||||
private String hsje; |
||||
|
||||
/** |
||||
* 税额 |
||||
*/ |
||||
private String se; |
||||
/** |
||||
* 发票类型 |
||||
*/ |
||||
private String cvouchtype; |
||||
/** |
||||
* 客户税号 |
||||
*/ |
||||
private String ccusregcode; |
||||
/** |
||||
* 客户名称 |
||||
*/ |
||||
private String ccusname; |
||||
/** |
||||
* 客户地址、电话 |
||||
*/ |
||||
private String ccusaddress; |
||||
/** |
||||
* 银行、账户 |
||||
*/ |
||||
private String branchaccount; |
||||
/** |
||||
* 订单编号 |
||||
*/ |
||||
private String cdlcode; |
||||
/** |
||||
* 凭证号 |
||||
*/ |
||||
private String cpznum; |
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 修改时间 |
||||
*/ |
||||
private Date updateTime; |
||||
|
||||
/** |
||||
* 订单日期 |
||||
*/ |
||||
private Date cdldate; |
||||
} |
@ -0,0 +1,62 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.model.yy; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.util.Date; |
||||
|
||||
@Data |
||||
public class YyOrderItemInfo { |
||||
/** |
||||
* id |
||||
*/ |
||||
private String id; |
||||
/** |
||||
* 订单id |
||||
*/ |
||||
private String orderId; |
||||
/** |
||||
* 项目名称 |
||||
*/ |
||||
private String cinvname; |
||||
/** |
||||
* 规格型号 |
||||
*/ |
||||
private String cinvstd; |
||||
/** |
||||
* 计量单位 |
||||
*/ |
||||
private String ccomunitname; |
||||
/** |
||||
* 数量 |
||||
*/ |
||||
private String iquantity; |
||||
/** |
||||
* 单价 |
||||
*/ |
||||
private String iunitprice; |
||||
/** |
||||
* 金额 |
||||
*/ |
||||
private String isum; |
||||
/** |
||||
* 税率 |
||||
*/ |
||||
private String itaxrate; |
||||
/** |
||||
* 税额 |
||||
*/ |
||||
private String itax; |
||||
/** |
||||
* 备注 |
||||
*/ |
||||
private String remark; |
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 修改时间 |
||||
*/ |
||||
private Date updateTime; |
||||
} |
@ -0,0 +1,13 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.service; |
||||
|
||||
import com.dxhy.base.common.model.R; |
||||
import com.dxhy.order.consumer.modules.bespoke.model.req.ReqParam; |
||||
|
||||
public interface OrderHandleService { |
||||
/** |
||||
* 订单读入 |
||||
* @param reqParam |
||||
* @return |
||||
*/ |
||||
R readOrder(ReqParam reqParam); |
||||
} |
@ -0,0 +1,10 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.service; |
||||
|
||||
import com.dxhy.base.common.model.R; |
||||
import com.dxhy.order.consumer.modules.bespoke.model.req.ReqParam; |
||||
|
||||
public interface OrderService { |
||||
|
||||
//订单读入
|
||||
R orderRead(ReqParam reqParam); |
||||
} |
@ -0,0 +1,19 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.service.impl; |
||||
|
||||
import cn.hutool.extra.spring.SpringUtil; |
||||
import com.dxhy.base.common.model.R; |
||||
import com.dxhy.order.consumer.modules.bespoke.config.ServiceConfig; |
||||
import com.dxhy.order.consumer.modules.bespoke.model.req.ReqParam; |
||||
import com.dxhy.order.consumer.modules.bespoke.service.OrderHandleService; |
||||
import com.dxhy.order.consumer.modules.bespoke.service.OrderService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@Service |
||||
public class OrderHandleServiceImpl implements OrderHandleService { |
||||
@Override |
||||
public R readOrder(ReqParam reqParam) { |
||||
//获取对应服务bean
|
||||
OrderService orderService = SpringUtil.getBean(ServiceConfig.getService(reqParam.getNsrsbh()), OrderService.class); |
||||
return orderService.orderRead(reqParam); |
||||
} |
||||
} |
@ -0,0 +1,106 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.service.impl; |
||||
|
||||
import com.alibaba.fastjson2.JSON; |
||||
import com.dxhy.base.common.model.R; |
||||
import com.dxhy.base.thirdservice.module.base.service.BaseService; |
||||
import com.dxhy.management.common.constant.ConfigureConstant; |
||||
import com.dxhy.order.consumer.dao.SkOrderInfoMapper; |
||||
import com.dxhy.order.consumer.dao.SkOrderItemInfoMapper; |
||||
import com.dxhy.order.consumer.dao.SkOrderMapper; |
||||
import com.dxhy.order.consumer.modules.bespoke.config.datasource.config.DynamicContextHolder; |
||||
import com.dxhy.order.consumer.modules.bespoke.model.req.ReqParam; |
||||
import com.dxhy.order.consumer.modules.bespoke.model.sk.SkOrderInfo; |
||||
import com.dxhy.order.consumer.modules.bespoke.model.sk.SkOrderItemInfo; |
||||
import com.dxhy.order.consumer.modules.bespoke.service.OrderHandleService; |
||||
import com.dxhy.order.consumer.modules.bespoke.service.OrderService; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.commons.collections4.CollectionUtils; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
@Slf4j |
||||
@Service("skOrderServiceImpl") |
||||
public class SkOrderServiceImpl implements OrderService { |
||||
|
||||
@Resource |
||||
private SkOrderInfoMapper skOrderInfoMapper; |
||||
|
||||
@Resource |
||||
private SkOrderItemInfoMapper skOrderItemInfoMapper; |
||||
|
||||
@Resource |
||||
private SkOrderMapper skOrderMapper; |
||||
|
||||
@Resource |
||||
private BaseService baseService; |
||||
|
||||
// 订单读入
|
||||
@Override |
||||
public R orderRead(ReqParam reqParam) { |
||||
|
||||
|
||||
DynamicContextHolder.push(reqParam.getNsrsbh()); |
||||
List<SkOrderInfo> skOrderInfoList = skOrderMapper.findOrderHeadList(reqParam); |
||||
log.debug("查询到订单数据:{}", JSON.toJSONString(skOrderInfoList)); |
||||
|
||||
int count = ConfigureConstant.INT_0; |
||||
if (CollectionUtils.isNotEmpty(skOrderInfoList)) { |
||||
for (SkOrderInfo skOrderInfo : skOrderInfoList) { |
||||
|
||||
DynamicContextHolder.push(reqParam.getNsrsbh()); |
||||
List<SkOrderItemInfo> skOrderItemInfoList = skOrderMapper.findOrderDetailList(skOrderInfo.getXsddm()); |
||||
log.debug("查询到订单明细数据:{}", JSON.toJSONString(skOrderItemInfoList)); |
||||
|
||||
if (CollectionUtils.isNotEmpty(skOrderItemInfoList)) { |
||||
DynamicContextHolder.push(ConfigureConstant.MAIN); |
||||
count+= saveOrder(skOrderInfo, skOrderItemInfoList, reqParam); |
||||
|
||||
} |
||||
|
||||
} |
||||
} |
||||
return R.ok("成功读取" + count + "条订单数据"); |
||||
} |
||||
|
||||
@Transactional |
||||
public int saveOrder(SkOrderInfo skOrderInfo, List<SkOrderItemInfo> skOrderItemInfoList, ReqParam reqParam) { |
||||
|
||||
//校验订单信息是否存在
|
||||
SkOrderInfo skOrderInfoExist = skOrderInfoMapper.checkOrderExist(skOrderInfo.getXsddm()); |
||||
if (skOrderInfoExist != null){ |
||||
log.debug("订单信息已存在,订单编号:{}", skOrderInfoExist.getXsddm()); |
||||
return ConfigureConstant.INT_0; |
||||
} |
||||
String orderId = baseService.getGenerateShotKey(); |
||||
Date now = new Date(); |
||||
|
||||
BigDecimal hsje = new BigDecimal(ConfigureConstant.STRING_0); |
||||
BigDecimal se = new BigDecimal(ConfigureConstant.STRING_0); |
||||
for (SkOrderItemInfo skOrderItemInfo : skOrderItemInfoList) { |
||||
hsje = hsje.add(new BigDecimal(skOrderItemInfo.getHsje())); |
||||
se = se.add(new BigDecimal(skOrderItemInfo.getSe())); |
||||
skOrderItemInfo.setId(baseService.getGenerateShotKey()); |
||||
skOrderItemInfo.setOrderId(orderId); |
||||
skOrderItemInfo.setCreateTime(now); |
||||
skOrderItemInfo.setUpdateTime(now); |
||||
skOrderItemInfoMapper.insertSkOrderItemInfo(skOrderItemInfo); |
||||
} |
||||
|
||||
skOrderInfo.setId(orderId); |
||||
skOrderInfo.setNsrsbh(reqParam.getNsrsbh()); |
||||
skOrderInfo.setEntId(reqParam.getEntId()); |
||||
skOrderInfo.setStatus(ConfigureConstant.STRING_0); |
||||
skOrderInfo.setDetailCount(String.valueOf(skOrderItemInfoList.size())); |
||||
skOrderInfo.setCreateTime(now); |
||||
skOrderInfo.setHsje(hsje.setScale(ConfigureConstant.INT_2).toPlainString()); |
||||
skOrderInfo.setSe(se.setScale(ConfigureConstant.INT_2).toPlainString()); |
||||
skOrderInfoMapper.insertSkOrderInfo(skOrderInfo); |
||||
|
||||
return ConfigureConstant.INT_1; |
||||
} |
||||
} |
@ -0,0 +1,104 @@ |
||||
package com.dxhy.order.consumer.modules.bespoke.service.impl; |
||||
|
||||
import com.alibaba.fastjson2.JSON; |
||||
import com.dxhy.base.common.model.R; |
||||
import com.dxhy.base.thirdservice.module.base.service.BaseService; |
||||
import com.dxhy.management.common.constant.ConfigureConstant; |
||||
import com.dxhy.order.consumer.dao.YyOrderInfoMapper; |
||||
import com.dxhy.order.consumer.dao.YyOrderItemInfoMapper; |
||||
import com.dxhy.order.consumer.dao.YyOrderMapper; |
||||
import com.dxhy.order.consumer.modules.bespoke.config.datasource.config.DynamicContextHolder; |
||||
import com.dxhy.order.consumer.modules.bespoke.model.req.ReqParam; |
||||
import com.dxhy.order.consumer.modules.bespoke.model.yy.YyOrderInfo; |
||||
import com.dxhy.order.consumer.modules.bespoke.model.yy.YyOrderItemInfo; |
||||
import com.dxhy.order.consumer.modules.bespoke.service.OrderService; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.commons.collections4.CollectionUtils; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
@Slf4j |
||||
@Service("yyOrderService") |
||||
public class YyOrderServiceImpl implements OrderService { |
||||
|
||||
@Resource |
||||
private YyOrderMapper yyOrderMapper; |
||||
|
||||
@Resource |
||||
private YyOrderInfoMapper yyOrderInfoMapper; |
||||
|
||||
@Resource |
||||
private YyOrderItemInfoMapper yyOrderItemInfoMapper; |
||||
|
||||
@Resource |
||||
private BaseService baseService; |
||||
|
||||
//订单读入
|
||||
@Override |
||||
public R orderRead(ReqParam reqParam) { |
||||
|
||||
int count = ConfigureConstant.INT_0; |
||||
|
||||
DynamicContextHolder.push(reqParam.getNsrsbh()); |
||||
List<YyOrderInfo> yyOrderInfoList = yyOrderMapper.findOrderHeadList(reqParam); |
||||
log.debug("查询到订单数据:{}", JSON.toJSONString(yyOrderInfoList)); |
||||
|
||||
if (CollectionUtils.isNotEmpty(yyOrderInfoList)){ |
||||
|
||||
for (YyOrderInfo yyOrderInfo : yyOrderInfoList) { |
||||
|
||||
DynamicContextHolder.push(reqParam.getNsrsbh()); |
||||
List<YyOrderItemInfo> yyOrderItemInfoList = yyOrderMapper.findOrderDetailList(yyOrderInfo.getCdlcode()); |
||||
log.debug("查询到订单明细数据:{}", JSON.toJSONString(yyOrderItemInfoList)); |
||||
|
||||
if (CollectionUtils.isNotEmpty(yyOrderItemInfoList)){ |
||||
DynamicContextHolder.push(ConfigureConstant.MAIN); |
||||
count+= saveOrder(yyOrderInfo, yyOrderItemInfoList, reqParam); |
||||
|
||||
} |
||||
} |
||||
} |
||||
return R.ok("成功读取"+count+"条订单数据"); |
||||
} |
||||
|
||||
@Transactional |
||||
public int saveOrder(YyOrderInfo yyOrderInfo, List<YyOrderItemInfo> yyOrderItemInfoList, ReqParam reqParam) { |
||||
|
||||
YyOrderInfo checkOrderExist = yyOrderInfoMapper.checkOrderExist(yyOrderInfo.getCdlcode()); |
||||
if (checkOrderExist != null){ |
||||
log.debug("订单已存在,订单编号:{}", yyOrderInfo.getCdlcode()); |
||||
return ConfigureConstant.INT_0; |
||||
} |
||||
String orderId = baseService.getGenerateShotKey(); |
||||
Date now = new Date(); |
||||
|
||||
BigDecimal hsje = new BigDecimal(ConfigureConstant.STRING_0); |
||||
BigDecimal se = new BigDecimal(ConfigureConstant.STRING_0); |
||||
for (YyOrderItemInfo yyOrderItemInfo : yyOrderItemInfoList) { |
||||
hsje = hsje.add(new BigDecimal(yyOrderItemInfo.getIsum())); |
||||
se = se.add(new BigDecimal(yyOrderItemInfo.getItax())); |
||||
yyOrderItemInfo.setId(baseService.getGenerateShotKey()); |
||||
yyOrderItemInfo.setOrderId(orderId); |
||||
yyOrderItemInfo.setCreateTime(now); |
||||
yyOrderItemInfo.setUpdateTime(now); |
||||
yyOrderItemInfoMapper.insertYyOrderItemInfo(yyOrderItemInfo); |
||||
} |
||||
yyOrderInfo.setId(orderId); |
||||
yyOrderInfo.setNsrsbh(reqParam.getNsrsbh()); |
||||
yyOrderInfo.setCreateTime(now); |
||||
yyOrderInfo.setUpdateTime(now); |
||||
yyOrderInfo.setStatus(ConfigureConstant.STRING_0); |
||||
yyOrderInfo.setEntId(reqParam.getEntId()); |
||||
yyOrderInfo.setDetailCount(String.valueOf(yyOrderItemInfoList.size())); |
||||
yyOrderInfo.setHsje(hsje.add(se).setScale(ConfigureConstant.INT_2).toPlainString()); |
||||
yyOrderInfo.setSe(se.setScale(ConfigureConstant.INT_2).toPlainString()); |
||||
yyOrderInfoMapper.insertYyOrderInfo(yyOrderInfo); |
||||
|
||||
return ConfigureConstant.INT_1; |
||||
} |
||||
} |
@ -0,0 +1,136 @@ |
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.dxhy.order.consumer.dao.SkOrderInfoMapper"> |
||||
<resultMap type="com.dxhy.order.consumer.modules.bespoke.model.sk.SkOrderInfo" id="SkOrderInfoResult"> |
||||
<result property="id" column="id"/> |
||||
<result property="nsrsbh" column="nsrsbh"/> |
||||
<result property="entId" column="ent_id"/> |
||||
<result property="status" column="status"/> |
||||
<result property="xsddm" column="xsddm"/> |
||||
<result property="fplx" column="fplx"/> |
||||
<result property="khswdjh" column="khswdjh"/> |
||||
<result property="khmc" column="khmc"/> |
||||
<result property="khdz" column="khdz"/> |
||||
<result property="khyh" column="khyh"/> |
||||
<result property="hsje" column="hsje"/> |
||||
<result property="se" column="se"/> |
||||
<result property="detailCount" column="detail_count"/> |
||||
<result property="createTime" column="create_time"/> |
||||
<result property="updateTime" column="update_time"/> |
||||
<result property="kprq" column="kprq"/> |
||||
</resultMap> |
||||
|
||||
<sql id="selectSkOrderInfoVo"> |
||||
select id, nsrsbh, ent_id, status, xsddm, fplx, khswdjh, khmc, khdz, khyh, hsje, se, detail_count, create_time, update_time, kprq from sk_order_info |
||||
</sql> |
||||
|
||||
<insert id="insertSkOrderInfo" parameterType="com.dxhy.order.consumer.modules.bespoke.model.sk.SkOrderInfo"> |
||||
insert into sk_order_info |
||||
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
<if test="id != null"> |
||||
id, |
||||
</if> |
||||
<if test="nsrsbh != null and nsrsbh != ''"> |
||||
nsrsbh, |
||||
</if> |
||||
<if test="entId != null"> |
||||
ent_id, |
||||
</if> |
||||
<if test="status != null"> |
||||
status, |
||||
</if> |
||||
<if test="xsddm != null"> |
||||
xsddm, |
||||
</if> |
||||
<if test="fplx != null"> |
||||
fplx, |
||||
</if> |
||||
<if test="khswdjh != null"> |
||||
khswdjh, |
||||
</if> |
||||
<if test="khmc != null"> |
||||
khmc, |
||||
</if> |
||||
<if test="khdz != null"> |
||||
khdz, |
||||
</if> |
||||
<if test="khyh != null"> |
||||
khyh, |
||||
</if> |
||||
<if test="hsje != null"> |
||||
hsje, |
||||
</if> |
||||
<if test="se != null"> |
||||
se, |
||||
</if> |
||||
<if test="detailCount != null"> |
||||
detail_count, |
||||
</if> |
||||
<if test="createTime != null"> |
||||
create_time, |
||||
</if> |
||||
<if test="updateTime != null"> |
||||
update_time, |
||||
</if> |
||||
<if test="kprq != null"> |
||||
kprq, |
||||
</if> |
||||
</trim> |
||||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
<if test="id != null"> |
||||
#{id}, |
||||
</if> |
||||
<if test="nsrsbh != null and nsrsbh != ''"> |
||||
#{nsrsbh}, |
||||
</if> |
||||
<if test="entId != null"> |
||||
#{entId}, |
||||
</if> |
||||
<if test="status != null"> |
||||
#{status}, |
||||
</if> |
||||
<if test="xsddm != null"> |
||||
#{xsddm}, |
||||
</if> |
||||
<if test="fplx != null"> |
||||
#{fplx}, |
||||
</if> |
||||
<if test="khswdjh != null"> |
||||
#{khswdjh}, |
||||
</if> |
||||
<if test="khmc != null"> |
||||
#{khmc}, |
||||
</if> |
||||
<if test="khdz != null"> |
||||
#{khdz}, |
||||
</if> |
||||
<if test="khyh != null"> |
||||
#{khyh}, |
||||
</if> |
||||
<if test="hsje != null"> |
||||
#{hsje}, |
||||
</if> |
||||
<if test="se != null"> |
||||
#{se}, |
||||
</if> |
||||
<if test="detailCount != null"> |
||||
#{detailCount}, |
||||
</if> |
||||
<if test="createTime != null"> |
||||
#{createTime}, |
||||
</if> |
||||
<if test="updateTime != null"> |
||||
#{updateTime}, |
||||
</if> |
||||
<if test="kprq != null"> |
||||
#{kprq}, |
||||
</if> |
||||
</trim> |
||||
</insert> |
||||
|
||||
<select id="checkOrderExist" parameterType="java.lang.String" resultMap="SkOrderInfoResult"> |
||||
<include refid="selectSkOrderInfoVo"/> |
||||
where xsddm = #{xsddm} |
||||
and status = '0' |
||||
</select> |
||||
</mapper> |
@ -0,0 +1,98 @@ |
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.dxhy.order.consumer.dao.SkOrderItemInfoMapper"> |
||||
<resultMap type="com.dxhy.order.consumer.modules.bespoke.model.sk.SkOrderItemInfo" id="SkOrderItemInfoResult"> |
||||
<result property="id" column="id"/> |
||||
<result property="orderId" column="order_id"/> |
||||
<result property="cpmc" column="cpmc"/> |
||||
<result property="xh" column="xh"/> |
||||
<result property="cpdw" column="cpdw"/> |
||||
<result property="cpsl" column="cpsl"/> |
||||
<result property="hsdj" column="hsdj"/> |
||||
<result property="hsje" column="hsje"/> |
||||
<result property="sl" column="sl"/> |
||||
<result property="se" column="se"/> |
||||
<result property="createTime" column="create_time"/> |
||||
<result property="updateTime" column="update_time"/> |
||||
</resultMap> |
||||
|
||||
<insert id="insertSkOrderItemInfo" parameterType="com.dxhy.order.consumer.modules.bespoke.model.sk.SkOrderItemInfo"> |
||||
insert into sk_order_item_info |
||||
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
<if test="id != null"> |
||||
id, |
||||
</if> |
||||
<if test="orderId != null and orderId != ''"> |
||||
order_id, |
||||
</if> |
||||
<if test="cpmc != null"> |
||||
cpmc, |
||||
</if> |
||||
<if test="xh != null"> |
||||
xh, |
||||
</if> |
||||
<if test="cpdw != null"> |
||||
cpdw, |
||||
</if> |
||||
<if test="cpsl != null"> |
||||
cpsl, |
||||
</if> |
||||
<if test="hsdj != null"> |
||||
hsdj, |
||||
</if> |
||||
<if test="hsje != null"> |
||||
hsje, |
||||
</if> |
||||
<if test="sl != null"> |
||||
sl, |
||||
</if> |
||||
<if test="se != null"> |
||||
se, |
||||
</if> |
||||
<if test="createTime != null"> |
||||
create_time, |
||||
</if> |
||||
<if test="updateTime != null"> |
||||
update_time, |
||||
</if> |
||||
</trim> |
||||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
<if test="id != null"> |
||||
#{id}, |
||||
</if> |
||||
<if test="orderId != null and orderId != ''"> |
||||
#{orderId}, |
||||
</if> |
||||
<if test="cpmc != null"> |
||||
#{cpmc}, |
||||
</if> |
||||
<if test="xh != null"> |
||||
#{xh}, |
||||
</if> |
||||
<if test="cpdw != null"> |
||||
#{cpdw}, |
||||
</if> |
||||
<if test="cpsl != null"> |
||||
#{cpsl}, |
||||
</if> |
||||
<if test="hsdj != null"> |
||||
#{hsdj}, |
||||
</if> |
||||
<if test="hsje != null"> |
||||
#{hsje}, |
||||
</if> |
||||
<if test="sl != null"> |
||||
#{sl}, |
||||
</if> |
||||
<if test="se != null"> |
||||
#{se}, |
||||
</if> |
||||
<if test="createTime != null"> |
||||
#{createTime}, |
||||
</if> |
||||
<if test="updateTime != null"> |
||||
#{updateTime}, |
||||
</if> |
||||
</trim> |
||||
</insert> |
||||
</mapper> |
@ -0,0 +1,36 @@ |
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.dxhy.order.consumer.dao.SkOrderMapper"> |
||||
|
||||
<select id="findOrderHeadList" resultType="com.dxhy.order.consumer.modules.bespoke.model.sk.SkOrderInfo" parameterType="com.dxhy.order.consumer.modules.bespoke.model.req.ReqParam"> |
||||
select fplx, |
||||
xsddm, |
||||
khmc, |
||||
khdz, |
||||
khswdjh, |
||||
khyh, |
||||
kprq, |
||||
bz |
||||
from v_invoice_head_fp |
||||
<where> |
||||
<if test="ddh != null and ddh != ''"> |
||||
and xsddm = #{ddh} |
||||
</if> |
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''"> |
||||
and kprq between #{startTime} and #{endTime} |
||||
</if> |
||||
</where> |
||||
</select> |
||||
|
||||
<select id="findOrderDetailList" resultType="com.dxhy.order.consumer.modules.bespoke.model.sk.SkOrderItemInfo" parameterType="java.lang.String"> |
||||
select cpmc, |
||||
cpdw, |
||||
cpsl, |
||||
hsdj, |
||||
hsje, |
||||
sl, |
||||
xh |
||||
from v_invoice_detail_fp |
||||
where xsddm = #{xsddm} |
||||
</select> |
||||
</mapper> |
@ -0,0 +1,143 @@ |
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.dxhy.order.consumer.dao.YyOrderInfoMapper"> |
||||
<resultMap type="com.dxhy.order.consumer.modules.bespoke.model.yy.YyOrderInfo" id="YyOrderInfoResult"> |
||||
<result property="id" column="id"/> |
||||
<result property="nsrsbh" column="nsrsbh"/> |
||||
<result property="entId" column="ent_id"/> |
||||
<result property="status" column="status"/> |
||||
<result property="detailCount" column="detail_count"/> |
||||
<result property="hsje" column="hsje"/> |
||||
<result property="se" column="se"/> |
||||
<result property="cvouchtype" column="cvouchtype"/> |
||||
<result property="ccusregcode" column="ccusregcode"/> |
||||
<result property="ccusname" column="ccusname"/> |
||||
<result property="ccusaddress" column="ccusaddress"/> |
||||
<result property="branchaccount" column="branchaccount"/> |
||||
<result property="cdlcode" column="cdlcode"/> |
||||
<result property="cpznum" column="cpznum"/> |
||||
<result property="createTime" column="create_time"/> |
||||
<result property="updateTime" column="update_time"/> |
||||
<result property="cdldate" column="cdldate"/> |
||||
</resultMap> |
||||
|
||||
<sql id="selectYyOrderInfoVo"> |
||||
select id, nsrsbh, ent_id, status, detail_count, hsje, se, cvouchtype, ccusregcode, ccusname, ccusaddress, branchaccount, cdlcode, cpznum, create_time, update_time, cdldate from yy_order_info |
||||
</sql> |
||||
|
||||
<insert id="insertYyOrderInfo" parameterType="com.dxhy.order.consumer.modules.bespoke.model.yy.YyOrderInfo"> |
||||
insert into yy_order_info |
||||
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
<if test="id != null"> |
||||
id, |
||||
</if> |
||||
<if test="nsrsbh != null"> |
||||
nsrsbh, |
||||
</if> |
||||
<if test="entId != null"> |
||||
ent_id, |
||||
</if> |
||||
<if test="status != null"> |
||||
status, |
||||
</if> |
||||
<if test="detailCount != null"> |
||||
detail_count, |
||||
</if> |
||||
<if test="hsje != null"> |
||||
hsje, |
||||
</if> |
||||
<if test="se != null"> |
||||
se, |
||||
</if> |
||||
<if test="cvouchtype != null"> |
||||
cvouchtype, |
||||
</if> |
||||
<if test="ccusregcode != null"> |
||||
ccusregcode, |
||||
</if> |
||||
<if test="ccusname != null"> |
||||
ccusname, |
||||
</if> |
||||
<if test="ccusaddress != null"> |
||||
ccusaddress, |
||||
</if> |
||||
<if test="branchaccount != null"> |
||||
branchaccount, |
||||
</if> |
||||
<if test="cdlcode != null"> |
||||
cdlcode, |
||||
</if> |
||||
<if test="cpznum != null"> |
||||
cpznum, |
||||
</if> |
||||
<if test="createTime != null"> |
||||
create_time, |
||||
</if> |
||||
<if test="updateTime != null"> |
||||
update_time, |
||||
</if> |
||||
<if test="cdldate != null"> |
||||
cdldate, |
||||
</if> |
||||
</trim> |
||||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
<if test="id != null"> |
||||
#{id}, |
||||
</if> |
||||
<if test="nsrsbh != null"> |
||||
#{nsrsbh}, |
||||
</if> |
||||
<if test="entId != null"> |
||||
#{entId}, |
||||
</if> |
||||
<if test="status != null"> |
||||
#{status}, |
||||
</if> |
||||
<if test="detailCount != null"> |
||||
#{detailCount}, |
||||
</if> |
||||
<if test="hsje != null"> |
||||
#{hsje}, |
||||
</if> |
||||
<if test="se != null"> |
||||
#{se}, |
||||
</if> |
||||
<if test="cvouchtype != null"> |
||||
#{cvouchtype}, |
||||
</if> |
||||
<if test="ccusregcode != null"> |
||||
#{ccusregcode}, |
||||
</if> |
||||
<if test="ccusname != null"> |
||||
#{ccusname}, |
||||
</if> |
||||
<if test="ccusaddress != null"> |
||||
#{ccusaddress}, |
||||
</if> |
||||
<if test="branchaccount != null"> |
||||
#{branchaccount}, |
||||
</if> |
||||
<if test="cdlcode != null"> |
||||
#{cdlcode}, |
||||
</if> |
||||
<if test="cpznum != null"> |
||||
#{cpznum}, |
||||
</if> |
||||
<if test="createTime != null"> |
||||
#{createTime}, |
||||
</if> |
||||
<if test="updateTime != null"> |
||||
#{updateTime}, |
||||
</if> |
||||
<if test="cdldate != null"> |
||||
#{cdldate}, |
||||
</if> |
||||
</trim> |
||||
</insert> |
||||
|
||||
<select id="checkOrderExist" parameterType="java.lang.String" resultMap="YyOrderInfoResult"> |
||||
<include refid="selectYyOrderInfoVo"/> |
||||
where cdlcode = #{cdlcode} |
||||
and status = '0' |
||||
</select> |
||||
</mapper> |
@ -0,0 +1,105 @@ |
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.dxhy.order.consumer.dao.YyOrderItemInfoMapper"> |
||||
<resultMap type="com.dxhy.order.consumer.modules.bespoke.model.yy.YyOrderItemInfo" id="YyOrderItemInfoResult"> |
||||
<result property="id" column="id"/> |
||||
<result property="orderId" column="order_id"/> |
||||
<result property="cinvname" column="cinvname"/> |
||||
<result property="cinvstd" column="cinvstd"/> |
||||
<result property="ccomunitname" column="ccomunitname"/> |
||||
<result property="iquantity" column="iquantity"/> |
||||
<result property="iunitprice" column="iunitprice"/> |
||||
<result property="isum" column="isum"/> |
||||
<result property="itaxrate" column="itaxrate"/> |
||||
<result property="itax" column="itax"/> |
||||
<result property="remark" column="remark"/> |
||||
<result property="createTime" column="create_time"/> |
||||
<result property="updateTime" column="update_time"/> |
||||
</resultMap> |
||||
|
||||
<insert id="insertYyOrderItemInfo" parameterType="com.dxhy.order.consumer.modules.bespoke.model.yy.YyOrderItemInfo"> |
||||
insert into yy_order_item_info |
||||
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
<if test="id != null"> |
||||
id, |
||||
</if> |
||||
<if test="orderId != null and orderId != ''"> |
||||
order_id, |
||||
</if> |
||||
<if test="cinvname != null"> |
||||
cinvname, |
||||
</if> |
||||
<if test="cinvstd != null"> |
||||
cinvstd, |
||||
</if> |
||||
<if test="ccomunitname != null"> |
||||
ccomunitname, |
||||
</if> |
||||
<if test="iquantity != null"> |
||||
iquantity, |
||||
</if> |
||||
<if test="iunitprice != null"> |
||||
iunitprice, |
||||
</if> |
||||
<if test="isum != null"> |
||||
isum, |
||||
</if> |
||||
<if test="itaxrate != null"> |
||||
itaxrate, |
||||
</if> |
||||
<if test="itax != null"> |
||||
itax, |
||||
</if> |
||||
<if test="remark != null"> |
||||
remark, |
||||
</if> |
||||
<if test="createTime != null"> |
||||
create_time, |
||||
</if> |
||||
<if test="updateTime != null"> |
||||
update_time, |
||||
</if> |
||||
</trim> |
||||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
<if test="id != null"> |
||||
#{id}, |
||||
</if> |
||||
<if test="orderId != null and orderId != ''"> |
||||
#{orderId}, |
||||
</if> |
||||
<if test="cinvname != null"> |
||||
#{cinvname}, |
||||
</if> |
||||
<if test="cinvstd != null"> |
||||
#{cinvstd}, |
||||
</if> |
||||
<if test="ccomunitname != null"> |
||||
#{ccomunitname}, |
||||
</if> |
||||
<if test="iquantity != null"> |
||||
#{iquantity}, |
||||
</if> |
||||
<if test="iunitprice != null"> |
||||
#{iunitprice}, |
||||
</if> |
||||
<if test="isum != null"> |
||||
#{isum}, |
||||
</if> |
||||
<if test="itaxrate != null"> |
||||
#{itaxrate}, |
||||
</if> |
||||
<if test="itax != null"> |
||||
#{itax}, |
||||
</if> |
||||
<if test="remark != null"> |
||||
#{remark}, |
||||
</if> |
||||
<if test="createTime != null"> |
||||
#{createTime}, |
||||
</if> |
||||
<if test="updateTime != null"> |
||||
#{updateTime}, |
||||
</if> |
||||
</trim> |
||||
</insert> |
||||
</mapper> |
@ -0,0 +1,40 @@ |
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.dxhy.order.consumer.dao.YyOrderMapper"> |
||||
|
||||
<select id="findOrderHeadList" resultType="com.dxhy.order.consumer.modules.bespoke.model.yy.YyOrderInfo" parameterType="com.dxhy.order.consumer.modules.bespoke.model.req.ReqParam"> |
||||
select cvouchtype, |
||||
ccusregcode, |
||||
ccusname, |
||||
ccusaddress, |
||||
branchaccount, |
||||
cdlcode, |
||||
cdldate, |
||||
cpznum |
||||
from v_invoice_head |
||||
<where> |
||||
<if test="ddh != null and ddh != ''"> |
||||
and cdlcode = #{ddh} |
||||
</if> |
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''"> |
||||
and cdldate between #{startTime} and #{endTime} |
||||
</if> |
||||
<if test="pzh != null and pzh != ''"> |
||||
and cpznum = #{pzh} |
||||
</if> |
||||
</where> |
||||
</select> |
||||
|
||||
<select id="findOrderDetailList" resultType="com.dxhy.order.consumer.modules.bespoke.model.yy.YyOrderItemInfo" parameterType="java.lang.String"> |
||||
select cinvname, |
||||
cinvstd, |
||||
ccomunitname, |
||||
iquantity, |
||||
iunitprice, |
||||
isum, |
||||
itaxrate, |
||||
itax |
||||
from v_invoice_detail |
||||
where cdlcode = #{xsddm} |
||||
</select> |
||||
</mapper> |
Loading…
Reference in new issue