Commit 2274904d authored by hezhen's avatar hezhen

Merge branch 'dev' of http://113.105.137.151:22280/youjj/cloud-platform into dev

parents f7d7ead2 dedd4f3c
......@@ -65,6 +65,7 @@ public class AppShareholderDetailDTO {
* 操作指令
* 1:信息修改
* 2:股权变动
* 3:再次购买此前抛售的股权
*/
private Integer changeState;
......
......@@ -17,6 +17,7 @@ import com.google.common.collect.Lists;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import com.xxfc.platform.vehicle.pojo.CompanyDetail;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -95,14 +96,14 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
Integer companyId = Integer.valueOf(company);
if (!(companyId != null && companyId > 0))
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "分公司不存在");
RestResponse<BranchCompany> branchCompany = vehicleFeign.get(companyId);
CompanyDetail branchCompany = vehicleFeign.getCompanyDetail(companyId).getData();
if (branchCompany.getData() == null) {
if (branchCompany == null) {
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "分公司不存在");
}
appShareholderDetailDTO.setCompanyId(companyId);
appShareholderDetailDTO.setCompanyName(branchCompany.getData().getName());
Integer positionId = branchCompany.getData().getId().equals(1) ? HEADQUARTERS_SHAREHOLDER : BRANCH_HEADQUARTERS_SHAREHOLDER;
appShareholderDetailDTO.setCompanyName(branchCompany.getName());
Integer positionId = branchCompany.getId().equals(1) ? HEADQUARTERS_SHAREHOLDER : BRANCH_HEADQUARTERS_SHAREHOLDER;
//用户表更改其身份
Integer userId = 0;
//登陆表查询用户手机号
......@@ -129,7 +130,7 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
Integer id = appShareholderDetailDTO.getId() == null ? 0 : appShareholderDetailDTO.getId();
BeanUtils.copyProperties(appShareholderDetailDTO, appShareholderDetail);
appShareholderDetail.setPositionId(positionId);
appShareholderDetailDTO.setUserId(userId);
appShareholderDetail.setUserId(userId);
// insertSelective(appShareholderDetail);
addUserFindId(appShareholderDetail);
//插入记录表
......@@ -163,8 +164,19 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
BeanUtils.copyProperties(appShareholderDetailDTO, appShareholderDetail);
//信息修改
if (appShareholderDetailDTO.getChangeState().equals(1)) {
if (appShareholderDetailDTO.getCompanyList() == null) {
for (String company : appShareholderDetailDTO.getCompanyList()) {
Integer companyId = Integer.valueOf(company);
appShareholderDetail.setCompanyId(companyId);
CompanyDetail branchCompany = vehicleFeign.getCompanyDetail(companyId).getData();
String companyName = branchCompany.getName();
appShareholderDetail.setCompanyName(companyName);
updateSelectiveById(appShareholderDetail);
// updateById(appShareholderDetail);
}
} else {
updateSelectiveById(appShareholderDetail);
}
//退股操作
} else if (appShareholderDetailDTO.getChangeState().equals(2)) {
if (appShareholderDetailDTO.getCompanyList() == null) {
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "请传入需要退股的公司");
......@@ -177,20 +189,80 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
}
for (String company : appShareholderDetailDTO.getCompanyList()) {
Integer companyId = Integer.valueOf(company);
appShareholderDetail.setIsQuit(SHAREHOLDERDE_IS_FALSE);
updateSelectiveById(appShareholderDetail);
AppShareholderDetail updAppShareholderDetail = selectById(appShareholderDetail);
RestResponse<BranchCompany> branchCompany = vehicleFeign.get(companyId);
String companyName = branchCompany.getData().getName();
//更新股东表 持股状态改为已退股
mapper.updShareHolderIsQuit(appShareholderDetailDTO.getPhone(), companyId, 1);
AppShareholderDetail updAppShareholderDetail = selectById(appShareholderDetailDTO);
//查询股东表,是否为总部股东
Integer oldPositionId = null;
oldPositionId = mapper.selectShareHolderByUserIdOrPhone(updAppShareholderDetail.getUserId(), updAppShareholderDetail.getPhone());
CompanyDetail branchCompany = vehicleFeign.getCompanyDetail(companyId).getData();
String companyName = branchCompany.getName();
updAppShareholderDetail.setCompanyName(companyName);
//用户表更改其身份
Integer userId = 0;
//登陆表查询用户手机号
AppUserLogin userLogin = loginBiz.checkeUserLogin(appShareholderDetailDTO.getPhone());
if (userLogin != null) {
userId = userLogin.getId();
//离职更新用户表身份
if (oldPositionId == null) {
detailBiz.updateUserPositionByUserId(userId, 6);
} else {
detailBiz.updateUserPositionByUserId(userId, oldPositionId);
}
}
//插入记录表
appShareholderDetailChangeRecordBiz.addAppShareholderDetailChangeRecord(updAppShareholderDetail, updUserId, SHAREHOLDERDE_IS_FALSE);
}
//复股操作
} else if (appShareholderDetailDTO.getChangeState().equals(3)) {
if (appShareholderDetailDTO.getPhone() == null) {
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "请输入股东号码");
}
if (appShareholderDetailDTO.getCompanyList() == null) {
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "请输入复股公司");
}
for (String company : appShareholderDetailDTO.getCompanyList()) {
Integer companyId = Integer.valueOf(company);
AppShareholderDetail updAppShareholderDetail = selectById(appShareholderDetail);
//查询股东表,是否为总部股东
Integer oldPositionId = mapper.selectShareHolderByUserIdOrPhone(updAppShareholderDetail.getUserId(), updAppShareholderDetail.getPhone());
//用户表更改其身份
Integer userId = 0;
//登陆表查询用户手机号
AppUserLogin userLogin = loginBiz.checkeUserLogin(appShareholderDetailDTO.getPhone());
if (userLogin != null) {
userId = userLogin.getId();
//关联查询detail表 获取身份
AppUserDetail appUserDetail = detailBiz.checkeIsAppUser(userId);
CompanyDetail branchCompany = vehicleFeign.getCompanyDetail(companyId).getData();
Integer positionId = branchCompany.getId().equals(1) ? HEADQUARTERS_SHAREHOLDER : BRANCH_HEADQUARTERS_SHAREHOLDER;
if (oldPositionId == null) {
detailBiz.updateUserPositionByUserId(userId, positionId);
} else {
if (!(appUserDetail.getPositionId().equals(1))) {
if (oldPositionId > positionId) {
detailBiz.updateUserPositionByUserId(userId, positionId);
} else {
detailBiz.updateUserPositionByUserId(userId, oldPositionId);
}
}
}
}
appShareholderDetail.setIsQuit(SHAREHOLDERDE_IS_TRUE);
//修改
mapper.updShareHolderIsQuit(appShareholderDetailDTO.getPhone(), companyId, 0);
//updateSelectiveById(appShareholderDetail);
appShareholderDetailChangeRecordBiz.addAppShareholderDetailChangeRecord(updAppShareholderDetail, updUserId, SHAREHOLDERDE_IS_TRUE);
}
}
return ObjectRestResponse.succ();
}
/**
* 分页查询
*/
......@@ -373,7 +445,7 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
Integer id = appShareholderDetailDTO.getId() == null ? 0 : appShareholderDetailDTO.getId();
BeanUtils.copyProperties(appShareholderDetailDTO, appShareholderDetail);
appShareholderDetail.setPositionId(positionId);
appShareholderDetailDTO.setUserId(userId);
appShareholderDetail.setUserId(userId);
addUserFindId(appShareholderDetail);
//插入记录表
appShareholderDetailChangeRecordBiz.addAppShareholderDetailChangeRecord(appShareholderDetail, operatorId, SHAREHOLDERDE_IS_TRUE);
......@@ -413,4 +485,5 @@ public class AppShareholderDetailBiz extends BaseBiz<AppShareholderDetailMapper,
result.put("exist", exist - total);
return result;
}
}
......@@ -41,13 +41,13 @@ public class AppShareholderDetailChangeRecordBiz extends BaseBiz<AppShareholderD
* 查询员工信息变更记录表
*/
public List<AppShareholderDetailChangeRecord> findShareholderChangeRecord(AppShareholderDetail appShareholderDetail) {
Example example = new Example(AppShareholderDetailChangeRecord.class);
/* Example example = new Example(AppShareholderDetailChangeRecord.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("userId", appShareholderDetail.getId());
if (appShareholderDetail.getPhone() != null) {
criteria.andEqualTo("phone", appShareholderDetail.getPhone());
}
List<AppShareholderDetailChangeRecord > list = mapper.selectByExample(example);
}*/
List<AppShareholderDetailChangeRecord> list = mapper.selectAppshareholderUserOrPhoneOrUserId(appShareholderDetail.getId(), appShareholderDetail.getPhone());
return list;
}
}
......@@ -191,9 +191,10 @@ public class AppUserPositionChangeRecordBiz extends BaseBiz<AppUserPositionChang
*/
public List<AppUserPositionChangeRecordDTO> findPositionChangeRecord(AppUserPositionTemp userPositionTemp) {
Example example = new Example(AppUserPositionChangeRecord.class);
example.createCriteria().andEqualTo("phone", userPositionTemp.getPhone());
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("userId", userPositionTemp.getId());
if (userPositionTemp.getId() != null) {
example.createCriteria().andEqualTo("userId", userPositionTemp.getId());
criteria.andEqualTo("phone", userPositionTemp.getPhone());
}
List<AppUserPositionChangeRecord> list = selectByExample(example);
List<AppUserPositionChangeRecordDTO> listAppUserPositionChangeRecordDTO = new ArrayList<>();
......
package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.entity.AppShareholderDetailChangeRecord;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
public interface AppShareholderDetailChangeRecordMapper extends Mapper<AppShareholderDetailChangeRecord> {
List<AppShareholderDetailChangeRecord> selectAppshareholderUserOrPhoneOrUserId(@Param("userId") Integer userId, @Param("phone") String phone);
}
......@@ -23,4 +23,10 @@ public interface AppShareholderDetailMapper extends Mapper<AppShareholderDetail>
@Param("positionId") Integer positionId,
@Param("companyId") Integer companyId);
void updShareHolderIsQuit(@Param("phone") String phone, @Param("companyId") Integer companyId,@Param("isQuit") Integer isQuit);
Integer selectMaxShareHolderByUserIdOrPhone(
@Param("phone") String phone,
@Param("userId") Integer userId);
}
<?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.github.wxiaoqi.security.admin.mapper.AppShareholderDetailChangeRecordMapper">
<resultMap id="appShareholderDetailMap" type="com.github.wxiaoqi.security.admin.entity.AppShareholderDetailChangeRecord">
<resultMap id="appShareholderDetailMap"
type="com.github.wxiaoqi.security.admin.entity.AppShareholderDetailChangeRecord">
<result property="id" column="id"/>
<result property="companyName" column="company_name"/>
<result property="userId" column="user_id"/>
......@@ -13,6 +14,20 @@
<result property="relTime" column="rel_time"/>
</resultMap>
<select id="selectAppshareholderUserOrPhoneOrUserId"
resultType="com.github.wxiaoqi.security.admin.entity.AppShareholderDetailChangeRecord">
SELECT *from
app_shareholder_detail_change_record
WHERE
1=1
<if test="userId!=null">
and user_id=#{userId}
</if>
<if test="phone!=null">
or phone=#{phone}
</if>
ORDER BY crt_time DESC
</select>
</mapper>
......@@ -14,6 +14,38 @@
<result property="positionId" column="position_id"/>
</resultMap>
<select id="selectMaxShareHolderByUserIdOrPhone" resultType="java.lang.Integer">
select max(`position_id`) from `app_shareholder_detail` where `is_quit`=0
<choose>
<when test="userId != null and (phone == null or phone != '')">
and `user_id`=#{userId}
</when>
<when test="phone != null and phone != '' and userId == null">
and `phone`=#{phone}
</when>
<otherwise>
and `user_id`=#{userId}
</otherwise>
</choose>
</select>
<select id="updShareHolderIsQuit" resultType="com.github.wxiaoqi.security.admin.entity.AppShareholderDetail">
UPDATE `app_shareholder_detail`
SET
<if test="isQuit!=null">
`is_quit`=#{isQuit}
</if>
WHERE
1 = 1
<if test="phone!=null">
and `phone`=#{phone}
</if>
<if test="companyId!=null">
and `company_id`=#{companyId}
</if>
</select>
<select id="selectShareHolderByUserIdOrPhone" resultType="java.lang.Integer">
select min(`position_id`) from `app_shareholder_detail` where `is_quit`=0
<choose>
......
......@@ -330,4 +330,16 @@ public class BaseOrder implements Serializable {
@ApiModelProperty(value = "上级公司员工id")
@Column(name = "parent_position_id")
private Integer parentPositionId;
/**
* 是否开票
*/
@Column(name = "invoice_status")
private Integer invoiceStatus;
/**
* 开票记录Id
*/
@Column(name = "invoice_id")
private Integer invoiceId;
}
package com.xxfc.platform.order.entity;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;
@Table(name = "order_e_invoice")
@Data
public class OrderInvoice {
/**
* 主键
*/
@Id
private Integer id;
/**
* 发票类型:1--租房车;2--房车游;3--会员
*/
private Integer type;
/**
* 订单ids,逗号分隔
*/
@Column(name = "order_ids")
private String orderIds;
/**
* 发票抬头类型:1--企业单位;2--个人/非企业单位
*/
@Column(name = "title_type")
private Integer titleType;
/**
* 抬头名称
*/
@Column(name = "title_name")
private String titleName;
/**
* 税号
*/
@Column(name = "tax_code")
private String taxCode;
/**
* 发票内容-备注说明
*/
@Column(name = "content_remark")
private String contentRemark;
/**
* 发票内容-地址和电话
*/
@Column(name = "content_contact")
private String contentContact;
/**
* 发票内容-开户行和账号
*/
@Column(name = "content_account")
private String contentAccount;
/**
* 发票方
*/
private String drawer;
/**
* 金额
*/
private BigDecimal amount;
/**
* 接收方式:1--邮件
*/
@Column(name = "receive_type")
private Integer receiveType;
/**
* 接收方式内容
*/
@Column(name = "receive_content")
private String receiveContent;
/**
* 创建时间
*/
@Column(name = "crt_time")
private Long crtTime;
/**
* 更新时间
*/
@Column(name = "upd_time")
private Long updTime;
/**
* 创建者id
*/
@Column(name = "user_id")
private Integer userId;
/**
* 更新者id
*/
@Column(name = "user_upd")
private Integer userUpd;
/**
* 更多内容
*/
private String extend;
}
\ No newline at end of file
......@@ -38,4 +38,9 @@ public class QueryOrderDTO extends PageParam {
private Integer type;
private String multiTypes;
/**
* 开票状态,0未开票,1已开票
*/
private Integer invoiceStatus;
}
\ No newline at end of file
......@@ -799,6 +799,20 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
sendQueue(orderMQDTO, sign);
}
public ObjectRestResponse updateBaseOrder(BaseOrder baseOrder) {
if(baseOrder.getId() == null) {
return ObjectRestResponse.paramIsEmpty();
}
BaseOrder oldValue = mapper.selectByPrimaryKey(baseOrder.getId());
if (oldValue == null) {
return ObjectRestResponse.createFailedResult(ResCode.ORDER_IS_NOT_EXIST.getCode(), ResCode.ORDER_IS_NOT_EXIST.getDesc());
}
BeanUtil.copyProperties(baseOrder, oldValue, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
updateSelectiveByIdReT(oldValue);
return ObjectRestResponse.succ();
}
@Override
public void updateSelectiveById(BaseOrder entity) {
super.updateSelectiveById(entity);
......
package com.xxfc.platform.order.biz;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderInvoice;
import com.xxfc.platform.order.mapper.OrderInvoiceMapper;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import javax.servlet.http.HttpServletRequest;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* 订单发票记录
*/
@Service
@Slf4j
public class OrderInvoiceBiz extends BaseBiz<OrderInvoiceMapper, OrderInvoice> {
@Autowired
BaseOrderBiz baseOrderBiz;
@Autowired
UserFeign userFeign;
@Autowired
HttpServletRequest request;
/**
* 添加发票记录
* @return
*/
@Transactional
public ObjectRestResponse add(OrderInvoice orderInvoice) {
AppUserDTO appUserDTO = userFeign.userDetailByToken(request.getHeader("Authorization")).getData();
if (appUserDTO == null) {
return ObjectRestResponse.createFailedResult(ResultCode.RSTOKEN_EXPIRED_CODE, ResultCode.getMsg(ResultCode.RSTOKEN_EXPIRED_CODE));
}
if (orderInvoice == null || StringUtils.isBlank(orderInvoice.getOrderIds())) {
return ObjectRestResponse.paramIsEmpty();
}
String[] orderIdArray = orderInvoice.getOrderIds().split(",");
if (orderIdArray.length > 0) {
for (int a = 0; a <= orderIdArray.length - 1; a ++) {
String orderId = StringUtils.isBlank(orderIdArray[a])? "0" : orderIdArray[a];
BaseOrder baseOrder = baseOrderBiz.selectById(Integer.parseInt(orderId));
if (baseOrder == null) {
return ObjectRestResponse.createFailedResult(ResCode.ORDER_IS_NOT_EXIST.getCode(), ResCode.ORDER_IS_NOT_EXIST.getDesc() + ", 订单Id = " + orderId);
}
//查询是否已开票
OrderInvoice oldValue = selectByUserIdAndOrderId(appUserDTO.getUserid(), Integer.parseInt(orderId)).getData();
if (oldValue == null) { //不存在就添加
orderInvoice.setUserId(appUserDTO.getUserid());
insertSelectiveRe(orderInvoice);
log.info("添加发票记录成功: {}", orderInvoice);
OrderInvoice newValue = selectByUserIdAndOrderId(appUserDTO.getUserid(), Integer.parseInt(orderId)).getData();
if(newValue != null) {
baseOrder.setInvoiceStatus(1);
baseOrder.setInvoiceId(newValue.getId());
baseOrderBiz.updateBaseOrder(baseOrder);
} else {
return ObjectRestResponse.createFailedResult(ResultCode.DB_OPERATION_FAIL_CODE, ResultCode.getMsg(ResultCode.DB_OPERATION_FAIL_CODE));
}
} else {//已开票
log.info("该订单已经开票, {}", orderId);
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "该订单已经开票: orderId = " + orderId);
}
}
}
return ObjectRestResponse.succ();
}
/**
* 根据orderIds字符串查询对应的发票记录
* @param orderIds
* @return
*/
public ObjectRestResponse<List<OrderInvoice>> selectByIds(String orderIds) {
AppUserDTO appUserDTO = userFeign.userDetailByToken(request.getHeader("Authorization")).getData();
if (appUserDTO == null) {
return ObjectRestResponse.createFailedResult(ResultCode.RSTOKEN_EXPIRED_CODE, ResultCode.getMsg(ResultCode.RSTOKEN_EXPIRED_CODE));
}
if (StringUtils.isBlank(orderIds)) {
return ObjectRestResponse.paramIsEmpty();
}
Set<OrderInvoice> set = new HashSet<>();
String[] orderIdArray = orderIds.split(",");
if (orderIdArray.length > 0) {
for (int a = 0; a <= orderIdArray.length -1; a++) {
OrderInvoice orderInvoice = selectByUserIdAndOrderId(appUserDTO.getUserid(), Integer.parseInt(orderIdArray[a])).getData();
if(orderInvoice != null) {
set.add(orderInvoice);
}
}
}
return ObjectRestResponse.succ(set);
}
/**
* 获取用户的发票记录列表
* @return
*/
public ObjectRestResponse<List<OrderInvoice>> selectByToken(Integer type) {
AppUserDTO appUserDTO = userFeign.userDetailByToken(request.getHeader("Authorization")).getData();
if (appUserDTO == null) {
return ObjectRestResponse.createFailedResult(ResultCode.RSTOKEN_EXPIRED_CODE, ResultCode.getMsg(ResultCode.RSTOKEN_EXPIRED_CODE));
}
Example example = new Example(OrderInvoice.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("userId", appUserDTO.getUserid());
if (type != null) {
criteria.andEqualTo("type", type);
}
return ObjectRestResponse.succ(mapper.selectByExample(example));
}
/**
* 根据用户Id获取用户发票记录
* @param userId
* @return
*/
public ObjectRestResponse<List<OrderInvoice>> selectByUserId(Integer userId, Integer type) {
Example example = new Example(OrderInvoice.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("userId", userId);
if (type != null) {
criteria.andEqualTo("type", type);
}
return ObjectRestResponse.succ(mapper.selectByExample(example));
}
public ObjectRestResponse<OrderInvoice> selectByUserIdAndOrderId(Integer userId, Integer orderId) {
return ObjectRestResponse.succ(mapper.selectByUserIdAndOrderId(new OrderInvoice(){{
setUserId(userId);
setOrderIds(orderId + "");
}}));
}
}
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.OrderInvoice;
import tk.mybatis.mapper.common.Mapper;
public interface OrderInvoiceMapper extends Mapper<OrderInvoice> {
OrderInvoice selectByUserIdAndOrderId(OrderInvoice orderInvoice);
}
\ No newline at end of file
......@@ -19,11 +19,11 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.order.biz.*;
import com.xxfc.platform.order.biz.inner.OrderCancelBiz;
import com.xxfc.platform.order.biz.inner.OrderMsgBiz;
import com.xxfc.platform.order.contant.enumerate.*;
import com.xxfc.platform.order.contant.enumerate.CrosstownTypeEnum;
import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum;
import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.mqhandler.RabbitProduct;
import com.xxfc.platform.order.pojo.account.OrderAccountDeduction;
import com.xxfc.platform.order.pojo.account.OrderAccountDetail;
import com.xxfc.platform.order.pojo.dto.OrderDTO;
import com.xxfc.platform.order.pojo.mq.OrderMQDTO;
import com.xxfc.platform.order.pojo.order.CancelOrderDTO;
......@@ -58,7 +58,6 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
......@@ -482,4 +481,10 @@ public class BaseOrderController extends CommonBaseController implements UserRes
return ObjectRestResponse.succ();
//ObjectRestResponse.succ(baseOrderBiz.selectBaeOrderByOrderIds(orderIds));
}
@RequestMapping(value = "/updateOrder", method = RequestMethod.POST)
public ObjectRestResponse updateOrder(@RequestBody BaseOrder baseOrder) {
return baseOrderBiz.updateBaseOrder(baseOrder);
}
}
package com.xxfc.platform.order.rest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.order.biz.OrderInvoiceBiz;
import com.xxfc.platform.order.entity.OrderInvoice;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 发票记录
*/
@RestController
@RequestMapping(value = "/order/invoice")
public class OrderInvoiceController extends BaseController<OrderInvoiceBiz, OrderInvoice> {
@PostMapping(value = "/add")
public ObjectRestResponse add(@RequestBody OrderInvoice orderInvoice) {
return baseBiz.add(orderInvoice);
}
@GetMapping(value = "selectByOrderIds")
public ObjectRestResponse<List<OrderInvoice>> selectByOrderIds(String orderIds) {
return baseBiz.selectByIds(orderIds);
}
@GetMapping(value = "selectByType")
public ObjectRestResponse<List<OrderInvoice>> selectByToken(Integer type) {
return baseBiz.selectByToken(type);
}
@GetMapping(value = "getByUser")
public ObjectRestResponse<List<OrderInvoice>> selectByUserId(Integer userId, Integer type) {
return baseBiz.selectByUserId(userId, type);
}
}
......@@ -37,6 +37,6 @@
<!-- </table>-->
<!-- <table tableName="branch_company_stock_info" domainObjectName="BranchCompanyStockInfo"></table>-->
<!-- <table tableName="branch_company_stock_apply_info" domainObjectName="BranchCompanyStockApplyInfo"></table>-->
<table tableName="deposit_refund_record" domainObjectName="DepositRefundRecord"></table>
<table tableName="order_e_invoice" domainObjectName="OrderInvoice"></table>
</context>
</generatorConfiguration>
\ No newline at end of file
......@@ -3,28 +3,6 @@
<mapper namespace="com.xxfc.platform.order.mapper.BaseOrderMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.xxfc.platform.order.entity.BaseOrder" id="baseOrderMap">
<result property="id" column="id"/>
<result property="no" column="no"/>
<result property="type" column="type"/>
<result property="detailId" column="detail_id"/>
<result property="status" column="status"/>
<result property="productAmount" column="product_amount"/>
<result property="orderAmount" column="order_amount"/>
<result property="detailJson" column="detail_json"/>
<result property="thirdType" column="third_type"/>
<result property="outTradeNo" column="out_trade_no"/>
<result property="crtTime" column="crt_time"/>
<result property="crtUser" column="crt_user"/>
<result property="crtName" column="crt_name"/>
<result property="crtHost" column="crt_host"/>
<result property="updTime" column="upd_time"/>
<result property="updUser" column="upd_user"/>
<result property="updName" column="upd_name"/>
<result property="updHost" column="upd_host"/>
</resultMap>
<resultMap type="com.xxfc.platform.order.pojo.order.OrderPageVO" id="orderPageMap">
<result javaType="Integer" column="type" property="type"></result>
<discriminator javaType="Integer" column="type">
......@@ -90,6 +68,9 @@
<if test="type != null">
and type = #{type}
</if>
<if test="invoiceStatus != null">
and invoice_status = #{invoiceStatus}
</if>
<if test="hasMemberRight != null">
and has_member_right = #{hasMemberRight}
</if>
......
<?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.xxfc.platform.order.mapper.OrderInvoiceMapper" >
<select id="selectByUserIdAndOrderId" parameterType="com.xxfc.platform.order.entity.OrderInvoice" resultType="com.xxfc.platform.order.entity.OrderInvoice">
select * from order_e_invoice where user_id = #{userId} and order_ids like concat("%", #{orderIds}, "%")
</select>
</mapper>
\ No newline at end of file
......@@ -18,6 +18,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -54,6 +55,17 @@ public class VehicleModelController extends CommonBaseController {
return objectRestResponse;
}
@ApiOperation("车型详情")
@GetMapping(value = "/detail")
@IgnoreUserToken
public ObjectRestResponse<VModelDetailVO> getDetails(@RequestParam("id") @ApiParam("车型名称") Integer id) {
ObjectRestResponse<VModelDetailVO> objectRestResponse = vehicleFeign.detailByParam(BeanUtil.beanToMap(new VehicleModel(){{
setId(id);
}}, false, true));
objectRestResponse.getData().setUccnCataList(initUccnCataCollect(objectRestResponse.getData().getConfig()));
return objectRestResponse;
}
/**
* 车型列表查
*
......
......@@ -2,24 +2,17 @@ package com.xxfc.platform.universal.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.constant.RestCode;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
import com.xxfc.platform.universal.constant.VideoConstant;
import com.xxfc.platform.universal.dto.ImgDTO;
import com.xxfc.platform.universal.dto.UploadImgDTO;
import com.xxfc.platform.universal.service.FileUploadService;
import com.xxfc.platform.universal.service.UploadService;
import com.xxfc.platform.universal.service.UploadZipService;
import com.xxfc.platform.universal.utils.ImgBase64Util;
import com.xxfc.platform.universal.utils.PublicMsg;
import com.xxfc.platform.universal.vo.Ueditor;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
......@@ -27,7 +20,6 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -172,6 +164,9 @@ public class UploadController{
@RequestMapping(value="/app/unauth/ueditor", method = RequestMethod.POST)
public Ueditor imgUpload(MultipartFile upfile) throws Exception {
Ueditor ueditor = new Ueditor();
if (upfile == null) {
return ueditor;
}
ueditor.setUrl(uploadService.uploadFile(upfile,"admin"));
ueditor.setOriginal(upfile.getOriginalFilename());
ueditor.setState("SUCCESS");
......
......@@ -211,6 +211,6 @@ public interface VehicleFeign {
@GetMapping("/branchCompany/company_info")
Map<Integer, String> findCompanyMap();
@RequestMapping(value ="/branchCompany/{id}",method = RequestMethod.GET)
RestResponse<BranchCompany> get(@PathVariable Integer id);
/* @RequestMapping(value ="/branchCompany/{id}",method = RequestMethod.GET)
RestResponse<BranchCompany> get(@PathVariable Integer id);*/
}
package com.xxfc.platform.vehicle.pojo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.HashMap;
import java.util.Map;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class VehicleExcelVo {
private static Map<Integer, String> map = new HashMap();
static {
map.put(1, "正常运行");
map.put(3, "报废");
map.put(4, "出车");
map.put(6, "维修");
map.put(7, "保养");
map.put(8, "上牌");
}
/**
* 车牌号,空字符串-没有
......@@ -34,7 +51,21 @@ public class VehicleExcelVo {
/**
* 停靠分支机构(名)
*/
private String parkBranchCompanyName;
/**
* 车辆状态: 1-正常运行 2-维修 3-报废
*/
private Integer status;
/**
* 所属人 名称
*/
private String belongToName;
public String getStatus() {
return map.get(status);
}
}
package com.xxfc.platform.vehicle.pojo;
import com.sun.org.apache.xpath.internal.operations.Bool;
import lombok.Data;
import java.util.Date;
......@@ -138,6 +139,9 @@ public class VehiclePageQueryVo {
*/
private Integer modelId;
/**
* 判断是否需要下载
*/
private boolean download;
}
......@@ -67,8 +67,8 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
try {
if (StringUtils.isNotBlank(vehiclePageQueryVoJson)){
vehiclePageQueryVo = JSON.parseObject(vehiclePageQueryVoJson, VehiclePageQueryVo.class);
vehiclePageQueryVo.setDownload(true);
}
if (userDTO.getDataAll() == 2) {
List<Integer> companyList = vehicleBiz.dataCompany(userDTO.getDataZone(), userDTO.getDataCompany());
return getByPageNotAllData(vehiclePageQueryVo, companyList);
......@@ -85,11 +85,22 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
public List<VehicleExcelVo> getList(String vehiclePageQueryVoJson, UserDTO userDTO) throws Exception {
List<ResultVehicleVo> resultVehicleVoList = getResultVehicleVoList(vehiclePageQueryVoJson, userDTO);
ArrayList<VehicleExcelVo> arrayList = Lists.newArrayList();
resultVehicleVoList.parallelStream().forEach(result->{
resultVehicleVoList.stream().forEach(result->{
try {
VehicleExcelVo vehicleExcelVo = new VehicleExcelVo();
BeanUtilsBean.getInstance().copyProperties(vehicleExcelVo,result);
arrayList.add(vehicleExcelVo);
Integer belongTo = result.getBelongTo();
if (belongTo!=null&& belongTo==1) {
System.out.println(belongTo);
}
VehicleExcelVo build = VehicleExcelVo.builder()
.code(result.getCode())
.numberPlate(result.getNumberPlate())
.parkBranchCompanyName(result.getParkBranchCompanyName())
.status(result.getStatus())
.useTypeName(result.getUseTypeName())
.vehicleType(result.getVehicleType())
.belongToName(result.getBelongTo()!=null&&result.getBelongTo()==1?"欣新房车有限公司":result.getBelongToName())
.build();
arrayList.add(build);
} catch (Exception e) {
log.error(e.getMessage());
log.error(e.getMessage(), e);
......
......@@ -50,13 +50,18 @@ public class VehicleInformationDownloadController extends BaseController<Vehicle
if (userDTO == null) {
throw new BaseException("token已失效");
}
List<VehicleExcelVo> rows = baseBiz.getList(vehiclePageQueryVoJson, userDTO);
ExcelWriter writer = ExcelUtil.getWriter(true);
writer.addHeaderAlias("numberPlate", "车牌号");
writer.addHeaderAlias("code", "车辆编码");
writer.addHeaderAlias("vehicleType", "车型");
writer.addHeaderAlias("useTypeName", "用途");
writer.addHeaderAlias("numberPlate", "车牌号");
writer.addHeaderAlias("status", "车辆状态");
writer.addHeaderAlias("vehicleType", "车辆品牌");
writer.addHeaderAlias("parkBranchCompanyName", "停靠分公司");
writer.addHeaderAlias("useTypeName", "用途");
writer.addHeaderAlias("belongToName", "托管人");
// 一次性写出内容,使用默认样式,强制输出标题
writer.write(rows, true);
//response为HttpServletResponse对象
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment