Jelajahi Sumber

Merge remote-tracking branch 'origin/master'

ZhangWenQiang 5 tahun lalu
induk
melakukan
8ca7e6d349

+ 3 - 3
happy-cloud-wisdom/happy-cloud-wisdom-biz/src/main/java/org/jeecg/modules/hlwinvoice/controller/HlwInvoiceController.java

@@ -44,7 +44,7 @@ import org.jeecg.common.aspect.annotation.AutoLog;
  */
 @Api(tags="hlw_invoice")
 @RestController
-@RequestMapping("/hlwinvoice/hlwInvoice")
+@RequestMapping("/wisdom/hlwInvoice")
 @Slf4j
 public class HlwInvoiceController extends JeecgController<HlwInvoice, IHlwInvoiceService> {
 	@Autowired
@@ -68,7 +68,7 @@ public class HlwInvoiceController extends JeecgController<HlwInvoice, IHlwInvoic
 								   HttpServletRequest req) {
 		QueryWrapper<HlwInvoice> queryWrapper = QueryGenerator.initQueryWrapper(hlwInvoice, req.getParameterMap());
 		Page<HlwInvoice> page = new Page<HlwInvoice>(pageNo, pageSize);
-		IPage<HlwInvoice> pageList = hlwInvoiceService.page(page, queryWrapper);
+		Page<HlwInvoice> pageList = hlwInvoiceService.queryPageList(page, hlwInvoice, queryWrapper);
 		return Result.ok(pageList);
 	}
 	
@@ -82,7 +82,7 @@ public class HlwInvoiceController extends JeecgController<HlwInvoice, IHlwInvoic
 	@ApiOperation(value="hlw_invoice-添加", notes="hlw_invoice-添加")
 	@PostMapping(value = "/add")
 	public Result<?> add(@RequestBody HlwInvoice hlwInvoice) {
-		hlwInvoiceService.save(hlwInvoice);
+		hlwInvoiceService.saveHlwInvoice(hlwInvoice);
 		return Result.ok("添加成功!");
 	}
 	

+ 48 - 0
happy-cloud-wisdom/happy-cloud-wisdom-biz/src/main/java/org/jeecg/modules/hlwinvoice/entity/HlwInvoice.java

@@ -4,11 +4,15 @@ import java.io.Serializable;
 import java.io.UnsupportedEncodingException;
 import java.util.Date;
 import java.math.BigDecimal;
+import java.util.List;
+
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import org.jeecg.modules.hlwpayment.entity.HlwPayment;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.jeecg.common.aspect.annotation.Dict;
@@ -60,4 +64,48 @@ public class HlwInvoice implements Serializable {
 	@Excel(name = "上传者", width = 15)
     @ApiModelProperty(value = "上传者")
     private java.lang.String uploadBy;
+
+    /**
+     * 开票选择的idlist
+     */
+    @TableField(exist = false)
+    private List<Integer> idsList;
+
+    /**
+     * 付款企业
+     */
+    @TableField(exist = false)
+    private String companyName;
+
+    /**
+     * 收款服务商
+     */
+    @TableField(exist = false)
+    private String subcontractorName;
+
+
+    /**
+     * 应用名称
+     */
+    @TableField(exist = false)
+    private String applicationName;
+
+    /**
+     * 付款单号
+     */
+    @TableField(exist = false)
+    private String paymentCode;
+
+    /**
+     * 是否通过平台
+     */
+    @TableField(exist = false)
+    private Integer isThroughPlatform;
+
+    /**
+     * 文件前缀
+     */
+    @TableField(exist = false)
+    private java.lang.String filePathPrefix;
+
 }

+ 4 - 0
happy-cloud-wisdom/happy-cloud-wisdom-biz/src/main/java/org/jeecg/modules/hlwinvoice/mapper/HlwInvoiceMapper.java

@@ -2,6 +2,9 @@ package org.jeecg.modules.hlwinvoice.mapper;
 
 import java.util.List;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.hlwinvoice.entity.HlwInvoice;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -14,4 +17,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface HlwInvoiceMapper extends BaseMapper<HlwInvoice> {
 
+    List<HlwInvoice> queryPageList(Page<HlwInvoice> page, @Param("hlwInvoice") HlwInvoice hlwInvoice, @Param(Constants.WRAPPER)QueryWrapper<HlwInvoice> queryWrapper);
 }

+ 28 - 4
happy-cloud-wisdom/happy-cloud-wisdom-biz/src/main/java/org/jeecg/modules/hlwinvoice/mapper/xml/HlwInvoiceMapper.xml

@@ -25,15 +25,39 @@
         WHERE a.id = #{id}
     </select>
 
-    <select id="findList" resultType="org.jeecg.modules.hlwinvoice.entity.HlwInvoice" >
+    <select id="queryPageList" resultType="org.jeecg.modules.hlwinvoice.entity.HlwInvoice" >
         SELECT
-        <include refid="hlwInvoiceColumns"/>
+		a.id AS "id",
+		a.amount AS "amount",
+		a.invoice_number AS "invoiceNumber",
+		a.invoice AS "invoice",
+		a.sys_org_code AS "sysOrgCode",
+		a.upload_time AS "uploadTime",
+		a.upload_by AS "uploadBy",
+		case when hp.is_through_platform=1 then hce.cp_name else hc.company_name end as "companyName",
+		hp.is_through_platform AS "isThroughPlatform",
+		hs.name AS "subcontractorName",
+		ha.application_name AS "applicationName",
+		ha.file_path_prefix as "filePathPrefix",
+		hp.payment_code AS "paymentCode"
         FROM hlw_invoice a
-        <include refid="hlwInvoiceJoins"/>
+		left join hlw_payment hp on hp.invoice_id=a.id
+		left join hlw_application_setting ha on ha.id=hp.application_id
+		left join hlw_company hc on hc.id=hp.company_id
+		inner join hlw_cp_setting hce
+		left join hlw_subcontractor hs on hs.id=hp.subcontractor_id
         <where>
-
+			1=1
+			<if test="hlwInvoice.invoiceNumber != null and hlwInvoice.invoiceNumber !=''">
+				and a.invoice_number like concat(concat('%',#{hlwPayment.invoiceNumber}),'%')
+			</if>
+			<if test="hlwInvoice.companyName != null and hlwInvoice.companyName !=''">
+				and (hc.company_name like concat(concat('%',#{hlwInvoice.companyName}),'%') or hce.cp_name like concat(concat('%',#{hlwInvoice.companyName}),'%'))
+			</if>
 
         </where>
+		group by a.id
+		order by a.upload_time desc ,a.id asc
     </select>
 
     <insert id="saveInvoice">

+ 5 - 0
happy-cloud-wisdom/happy-cloud-wisdom-biz/src/main/java/org/jeecg/modules/hlwinvoice/service/IHlwInvoiceService.java

@@ -1,5 +1,7 @@
 package org.jeecg.modules.hlwinvoice.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.jeecg.modules.hlwinvoice.entity.HlwInvoice;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -11,4 +13,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IHlwInvoiceService extends IService<HlwInvoice> {
 
+    void saveHlwInvoice(HlwInvoice hlwInvoice);
+
+    Page<HlwInvoice> queryPageList(Page<HlwInvoice> page, HlwInvoice hlwInvoice, QueryWrapper<HlwInvoice> queryWrapper);
 }

+ 32 - 0
happy-cloud-wisdom/happy-cloud-wisdom-biz/src/main/java/org/jeecg/modules/hlwinvoice/service/impl/HlwInvoiceServiceImpl.java

@@ -1,11 +1,21 @@
 package org.jeecg.modules.hlwinvoice.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.modules.hlwinvoice.entity.HlwInvoice;
 import org.jeecg.modules.hlwinvoice.mapper.HlwInvoiceMapper;
 import org.jeecg.modules.hlwinvoice.service.IHlwInvoiceService;
+import org.jeecg.modules.hlwpayment.entity.HlwPayment;
+import org.jeecg.modules.hlwpayment.service.IHlwPaymentService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
 
 /**
  * @Description: hlw_invoice
@@ -15,5 +25,27 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  */
 @Service
 public class HlwInvoiceServiceImpl extends ServiceImpl<HlwInvoiceMapper, HlwInvoice> implements IHlwInvoiceService {
+    @Autowired
+    private IHlwPaymentService hlwPaymentService;
+
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void saveHlwInvoice(HlwInvoice hlwInvoice) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        hlwInvoice.setUploadTime(new Date());
+        hlwInvoice.setUploadBy(user.getUsername());
+        save(hlwInvoice);
+        for (int i = 0; i <hlwInvoice.getIdsList().size() ; i++) {
+            HlwPayment hlwPayment=hlwPaymentService.getById(hlwInvoice.getIdsList().get(i));
+            hlwPayment.setInvoiceId(hlwInvoice.getId());
+            hlwPaymentService.updateById(hlwPayment);
+        }
+    }
+
 
+    @Override
+    public Page<HlwInvoice> queryPageList(Page<HlwInvoice> page, HlwInvoice hlwInvoice, QueryWrapper<HlwInvoice> queryWrapper) {
+        return page.setRecords(baseMapper.queryPageList(page,hlwInvoice,queryWrapper));
+    }
 }

+ 1 - 1
happy-cloud-wisdom/happy-cloud-wisdom-biz/src/main/java/org/jeecg/modules/hlwpayment/entity/HlwPayment.java

@@ -311,6 +311,6 @@ public class HlwPayment implements Serializable {
      * 开票选择的idlist
      */
     @TableField(exist = false)
-    List<Integer> idsList;
+    private List<Integer> idsList;
 
 }