Explorar o código

Merge remote-tracking branch 'origin/master'

LiFei %!s(int64=3) %!d(string=hai) anos
pai
achega
797d96efa2

+ 79 - 0
happy-cloud-auth/src/main/java/org/jeecg/modules/api/controller/HlwDutyApplyController.java

@@ -0,0 +1,79 @@
+package org.jeecg.modules.api.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.modules.auth.entity.OauthApplication;
+import org.jeecg.modules.auth.service.AuthService;
+import org.jeecg.modules.feign.client.HlwDutyApplyServiceClient;
+import org.jeecg.modules.util.CryptTool;
+import org.jeecg.modules.util.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+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;
+
+/**
+ * @Author: lifei
+ * @Date: Create in 2020/6/9 9:35
+ * @Description:
+ */
+@Slf4j
+@RestController
+@RequestMapping("/oauth/hlwDutyApply")
+@Api(tags = {"完税接口"})
+public class HlwDutyApplyController {
+
+    @Autowired
+    private AuthService authService;
+
+    @Autowired
+    private HlwDutyApplyServiceClient hlwDutyApplyServiceClient;
+
+    /**
+     * 完税列表
+     *
+     * @param json
+     * @return
+     */
+    @AutoLog(value = "完税列表")
+    @ApiOperation(value = "完税列表", notes = "完税列表")
+    @PostMapping(value = "/list")
+    public Result<?> list(@RequestBody String json) {
+        log.info("json========{}", json);
+        //数据解密
+        json = CryptTool.decode(json);
+        JSONObject jsonObject = JSONObject.parseObject(json);
+        //获取应用信息
+        OauthApplication oauthApplication = authService.getApplication(SecurityUtils.getClient());
+        jsonObject.put("applicationId", oauthApplication.getApplicationId());
+        Result<?> result = hlwDutyApplyServiceClient.list(jsonObject);
+        return result;
+    }
+
+    /**
+     * 完税人员明细
+     *
+     * @param json
+     * @return
+     */
+    @AutoLog(value = "完税人员明细")
+    @ApiOperation(value = "完税人员明细", notes = "完税人员明细")
+    @PostMapping(value = "/userList")
+    public Result<?> subcontractorList(@RequestBody String json) {
+        log.info("json========{}", json);
+        //数据解密
+        json = CryptTool.decode(json);
+        JSONObject jsonObject = JSONObject.parseObject(json);
+        //获取应用信息
+        OauthApplication oauthApplication = authService.getApplication(SecurityUtils.getClient());
+        jsonObject.put("applicationId", oauthApplication.getApplicationId());
+        Result<?> result = hlwDutyApplyServiceClient.userList(jsonObject);
+        return result;
+    }
+
+}

+ 40 - 0
happy-cloud-auth/src/main/java/org/jeecg/modules/feign/client/HlwDutyApplyServiceClient.java

@@ -0,0 +1,40 @@
+package org.jeecg.modules.feign.client;
+
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.ServiceNameConstants;
+import org.jeecg.modules.feign.client.factory.HlwDutyApplyServiceClientFallbackFactory;
+import org.jeecg.modules.feign.client.factory.HlwUserServiceClientFallbackFactory;
+import org.jeecg.modules.feign.client.fallback.HlwDutyApplyServiceClientFallbackImpl;
+import org.jeecg.modules.feign.client.fallback.HlwUserServiceClientFallbackImpl;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.PostMapping;
+
+/**
+ * @Author: lifei
+ * @Date: Create in 2020/7/8 9:16
+ * @Description: 企业管理远程调用
+ */
+@Component
+@FeignClient(contextId = "hlwDutyApplyServiceClient", value = ServiceNameConstants.WISDOM_SERVICE, fallback = HlwDutyApplyServiceClientFallbackImpl.class, fallbackFactory = HlwDutyApplyServiceClientFallbackFactory.class)
+public interface HlwDutyApplyServiceClient {
+
+    /**
+     * 用户列表
+     *
+     * @param jsonObject
+     * @return
+     */
+    @PostMapping(value = "/wisdom/hlwDutyApply/api/list")
+    Result<?> list(JSONObject jsonObject);
+
+    /**
+     * 用户服务商列表
+     *
+     * @param jsonObject
+     * @return
+     */
+    @PostMapping(value = "/wisdom/hlwDutyApply/api/userList")
+    Result<?> userList(JSONObject jsonObject);
+}

+ 22 - 0
happy-cloud-auth/src/main/java/org/jeecg/modules/feign/client/factory/HlwDutyApplyServiceClientFallbackFactory.java

@@ -0,0 +1,22 @@
+package org.jeecg.modules.feign.client.factory;
+
+import feign.hystrix.FallbackFactory;
+import org.jeecg.modules.feign.client.HlwDutyApplyServiceClient;
+import org.jeecg.modules.feign.client.fallback.HlwDutyApplyServiceClientFallbackImpl;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Author: lifei
+ * @Date: Create in 2020/6/8 9:29
+ * @Description:
+ */
+@Component
+public class HlwDutyApplyServiceClientFallbackFactory implements FallbackFactory<HlwDutyApplyServiceClient> {
+
+    @Override
+    public HlwDutyApplyServiceClientFallbackImpl create(Throwable throwable) {
+        HlwDutyApplyServiceClientFallbackImpl fallback = new HlwDutyApplyServiceClientFallbackImpl();
+        fallback.setCause(throwable);
+        return fallback;
+    }
+}

+ 34 - 0
happy-cloud-auth/src/main/java/org/jeecg/modules/feign/client/fallback/HlwDutyApplyServiceClientFallbackImpl.java

@@ -0,0 +1,34 @@
+package org.jeecg.modules.feign.client.fallback;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.feign.client.HlwDutyApplyServiceClient;
+import org.jeecg.modules.feign.client.HlwUserServiceClient;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Author: lifei
+ * @Date: Create in 2020/6/8 9:27
+ * @Description:
+ */
+@Slf4j
+@Component
+public class HlwDutyApplyServiceClientFallbackImpl implements HlwDutyApplyServiceClient {
+    @Setter
+    private Throwable cause;
+
+
+    @Override
+    public Result<?> list(JSONObject jsonObject) {
+        return Result.error("查询完税列表失败");
+    }
+
+
+    @Override
+    public Result<?> userList(JSONObject jsonObject) {
+        return Result.error("查询完税人员明细失败");
+    }
+
+}

+ 104 - 0
happy-cloud-wisdom/happy-cloud-wisdom-biz/src/main/java/org/jeecg/modules/api/controller/HlwDutyApplyApiController.java

@@ -0,0 +1,104 @@
+package org.jeecg.modules.api.controller;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.modules.hlwinvoice.entity.HlwDutyApply;
+import org.jeecg.modules.hlwinvoice.service.IHlwDutyApplyService;
+import org.jeecg.modules.hlwpayment.entity.HlwPaymentDetail;
+import org.springframework.beans.factory.annotation.Autowired;
+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 java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description: 完税证明
+ * @Author: jeecg-boot
+ * @Date: 2020-07-20
+ * @Version: V1.0
+ */
+@Api(tags = "完税证明")
+@RestController
+@RequestMapping("/wisdom/hlwDutyApply/api")
+@Slf4j
+public class HlwDutyApplyApiController extends JeecgController<HlwDutyApply, IHlwDutyApplyService> {
+
+    @Autowired
+    private IHlwDutyApplyService hlwDutyApplyService;
+
+    /**
+     * 完税列表
+     *
+     * @param jsonObject
+     * @return
+     */
+    @AutoLog(value = "完税列表")
+    @ApiOperation(value = "完税列表", notes = "完税列表")
+    @PostMapping(value = "/list")
+    public Result<?> list(@RequestBody JSONObject jsonObject) {
+        Integer applicationId = jsonObject.getInteger("applicationId");
+        //获取请求参数
+        Integer pageNo = jsonObject.getInteger("pageNo");
+        Integer pageSize = jsonObject.getInteger("pageSize");
+        String applyMonth = jsonObject.getString("applyMonth");
+        String subcontractorName = jsonObject.getString("subcontractorName");
+        Integer dutyStatus = jsonObject.getInteger("dutyStatus");
+        JSONArray jsonArray = jsonObject.getJSONArray("companyCodeList");
+        List<String> companyCodeList = new ArrayList<>();
+        for (int i = 0; i < jsonArray.size(); i++) {
+            companyCodeList.add(jsonArray.get(i).toString());
+        }
+        HlwDutyApply hlwDutyApply = new HlwDutyApply();
+        hlwDutyApply.setApplyMonth(applyMonth);
+        hlwDutyApply.setSubcontractorName(subcontractorName);
+        hlwDutyApply.setDutyStatus(dutyStatus);
+        Page<HlwDutyApply> page = new Page<HlwDutyApply>(pageNo, pageSize);
+        Page<HlwDutyApply> pageList = hlwDutyApplyService.findDutyApplyApiList(page, companyCodeList, hlwDutyApply, applicationId);
+        List<HlwDutyApply> applyList = pageList.getRecords();
+        pageList.setRecords(applyList);
+        return Result.ok(pageList);
+    }
+
+
+    /**
+     * 完税人员明细
+     *
+     * @param jsonObject
+     * @return
+     */
+    @AutoLog(value = "完税人员明细")
+    @ApiOperation(value = "完税人员明细", notes = "完税人员明细")
+    @PostMapping(value = "/userList")
+    public Result<?> userList(@RequestBody JSONObject jsonObject) {
+        Integer applicationId = jsonObject.getInteger("applicationId");
+        //获取请求参数
+        Integer pageNo = jsonObject.getInteger("pageNo");
+        Integer pageSize = jsonObject.getInteger("pageSize");
+        String applyMonth = jsonObject.getString("applyMonth");
+        Integer companyId = jsonObject.getInteger("companyId");
+        Integer subcontractorId = jsonObject.getInteger("subcontractorId");
+        Integer cpId = jsonObject.getInteger("cpId");
+        HlwDutyApply hlwDutyApply = new HlwDutyApply();
+        hlwDutyApply.setApplyMonth(applyMonth);
+        hlwDutyApply.setCompanyId(companyId);
+        hlwDutyApply.setSubcontractorId(subcontractorId);
+        hlwDutyApply.setCpId(cpId);
+        hlwDutyApply.setApplicationId(applicationId);
+        Page<HlwPaymentDetail> page = new Page<HlwPaymentDetail>(pageNo, pageSize);
+        Page<HlwPaymentDetail> pageList = hlwDutyApplyService.findDutyUserApiList(page, hlwDutyApply);
+        List<HlwPaymentDetail> applyList = pageList.getRecords();
+        pageList.setRecords(applyList);
+        return Result.ok(pageList);
+    }
+
+}

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

@@ -33,4 +33,8 @@ public interface HlwDutyApplyMapper extends BaseMapper<HlwDutyApply> {
     HlwDutyApply getApply(@Param("hlwDutyApply") HlwDutyApply hlwDutyApply);
 
     List<HlwDutyApply> findDutyApplyList(@Param("hlwDutyApply") HlwDutyApply hlwDutyApply);
+
+    List<HlwDutyApply> findDutyApplyApiList(Page<HlwDutyApply> page, @Param("companyCodeList") List<String> companyCodeList, @Param("hlwDutyApply") HlwDutyApply hlwDutyApply, @Param("applicationId") Integer applicationId);
+
+    List<HlwPaymentDetail> findDutyUserApiList(Page<HlwPaymentDetail> page, @Param("hlwDutyApply") HlwDutyApply hlwDutyApply);
 }

+ 165 - 0
happy-cloud-wisdom/happy-cloud-wisdom-biz/src/main/java/org/jeecg/modules/hlwinvoice/mapper/xml/HlwDutyApplyMapper.xml

@@ -422,4 +422,169 @@
 		GROUP BY a.duty_apply_id
 	</select>
 
+    <!--api-->
+    <select id="findDutyApplyApiList" resultType="org.jeecg.modules.hlwinvoice.entity.HlwDutyApply" >
+        SELECT
+        t.*
+        FROM
+        (
+        SELECT
+        DATE_FORMAT(a.apply_time,'%Y-%m') AS "applyMonth",
+        sum(a.amount) AS "sumAmount",
+        a.id AS "id",
+        a.duty_paid_id AS "dutyPaidId",
+        a.apply_time AS "applyTime",
+        a.apply_by AS "applyBy",
+        app.application_name AS "applicationName",
+        pay.payment_code AS "paymentCode",
+        com.company_name AS "companyName",
+        pay.is_through_platform AS "isThroughPlatform",
+        sub.name AS "subcontractorName",
+        com.id AS "companyId",
+        sub.id AS "subcontractorId",
+        cs.cp_name AS "cpName",
+        pay.cp_id AS "cpId",
+        pay.application_id AS "applicationId",
+        hdp.tax_payment_receipt AS "taxPaymentReceipt",
+        hdp.upload_time AS "uploadTime"
+        FROM
+        hlw_duty_apply a
+        LEFT JOIN (SELECT payment_id,duty_apply_id from hlw_payment_detail group by duty_apply_id) as pd ON pd.duty_apply_id = a.id
+        LEFT JOIN hlw_payment pay ON pay.id = pd.payment_id
+        LEFT JOIN hlw_application_setting app ON app.id = pay.application_id
+        LEFT JOIN hlw_subcontractor sub ON sub.id = pay.subcontractor_id
+        LEFT JOIN hlw_company com ON com.id = pay.company_id
+        LEFT JOIN hlw_cp_setting cs ON cs.id = pay.cp_id
+        LEFT JOIN hlw_duty_paid hdp ON hdp.id = a.duty_paid_id
+        <where>
+            pay.application_id = #{applicationId}
+            <if test="companyCodeList != null and companyCodeList.size() != 0">
+                and com.company_code in
+                <foreach collection="companyCodeList" index="index" item="code" open="(" separator="," close=")">
+                    #{code}
+                </foreach>
+            </if>
+            and pay.cp_id IS NULL
+            <if test="hlwDutyApply.applyMonth != null and hlwDutyApply.applyMonth != ''">
+                and DATE_FORMAT(a.apply_time, '%Y%m') = DATE_FORMAT(#{hlwDutyApply.applyMonth}, '%Y%m')
+            </if>
+            <if test="hlwDutyApply.subcontractorName != null and hlwDutyApply.subcontractorName != ''">
+                and sub.name like concat(concat('%',#{hlwDutyApply.subcontractorName}),'%')
+            </if>
+            <if test="hlwDutyApply.dutyStatus != null">
+                <if test="hlwDutyApply.dutyStatus == 0">
+                    and a.duty_paid_id is null
+                </if>
+                <if test="hlwDutyApply.dutyStatus == 1">
+                    and a.duty_paid_id is not null
+                </if>
+            </if>
+        </where>
+        GROUP BY
+        EXTRACT(YEAR_MONTH FROM a.apply_time),
+        pay.company_id,
+        pay.subcontractor_id,
+        pay.application_id
+        UNION ALL
+        SELECT
+        DATE_FORMAT(a.apply_time,'%Y-%m') AS "applyMonth",
+        sum(a.amount) AS "sumAmount",
+        a.id AS "id",
+        a.duty_paid_id AS "dutyPaidId",
+        a.apply_time AS "applyTime",
+        a.apply_by AS "applyBy",
+        app.application_name AS "applicationName",
+        pay.payment_code AS "paymentCode",
+        com.company_name AS "companyName",
+        pay.is_through_platform AS "isThroughPlatform",
+        sub.name AS "subcontractorName",
+        com.id AS "companyId",
+        sub.id AS "subcontractorId",
+        cs.cp_name AS "cpName",
+        pay.cp_id AS "cpId",
+        pay.application_id AS "applicationId",
+        hdp.tax_payment_receipt AS "taxPaymentReceipt",
+        hdp.upload_time AS "uploadTime"
+        FROM
+        hlw_duty_apply a
+        LEFT JOIN (SELECT payment_id,duty_apply_id from hlw_payment_detail group by duty_apply_id) as pd ON pd.duty_apply_id = a.id
+        LEFT JOIN hlw_payment pay ON pay.id = pd.payment_id
+        LEFT JOIN hlw_application_setting app ON app.id = pay.application_id
+        LEFT JOIN hlw_subcontractor sub ON sub.id = pay.subcontractor_id
+        LEFT JOIN hlw_company com ON com.id = pay.company_id
+        LEFT JOIN hlw_cp_setting cs ON cs.id = pay.cp_id
+        LEFT JOIN hlw_duty_paid hdp ON hdp.id = a.duty_paid_id
+        <where>
+            pay.application_id = #{applicationId}
+            <if test="companyCodeList != null and companyCodeList.size() != 0">
+                and com.company_code in
+                <foreach collection="companyCodeList" index="index" item="code" open="(" separator="," close=")">
+                    #{code}
+                </foreach>
+            </if>
+            and pay.cp_id IS NOT NULL
+            <if test="hlwDutyApply.applyMonth != null and hlwDutyApply.applyMonth != ''">
+                and DATE_FORMAT(a.apply_time, '%Y%m') = DATE_FORMAT(#{hlwDutyApply.applyMonth}, '%Y%m')
+            </if>
+            <if test="hlwDutyApply.subcontractorName != null and hlwDutyApply.subcontractorName != ''">
+                and sub.name like concat(concat('%',#{hlwDutyApply.subcontractorName}),'%')
+            </if>
+            <if test="hlwDutyApply.dutyStatus != null">
+                <if test="hlwDutyApply.dutyStatus == 0">
+                    and a.duty_paid_id is null
+                </if>
+                <if test="hlwDutyApply.dutyStatus == 1">
+                    and a.duty_paid_id is not null
+                </if>
+            </if>
+        </where>
+        GROUP BY
+        EXTRACT(YEAR_MONTH FROM a.apply_time),
+        pay.company_id,
+        pay.subcontractor_id,
+        pay.application_id,
+        pay.cp_id
+        ) t
+        ORDER BY t.applyTime DESC, t.id ASC
+    </select>
+
+    <select id="findDutyUserApiList" resultType="org.jeecg.modules.hlwpayment.entity.HlwPaymentDetail">
+        SELECT
+        a.id AS "id",
+        a.user_name AS "userName",
+        a.phone AS "phone",
+        a.idcard_number AS "idcardNumber",
+        a.card_number AS "cardNumber",
+        a.bnkflg AS "bnkflg",
+        a.eacbnk AS "eacbnk",
+        a.rcveaa AS "rcveaa",
+        a.net_payment AS "netPayment"
+        FROM hlw_payment_detail a
+        LEFT JOIN hlw_duty_apply hda ON hda.id = a.duty_apply_id
+        LEFT JOIN hlw_payment pay ON pay.id = a.payment_id
+        LEFT JOIN hlw_application_setting app ON app.id = pay.application_id
+        LEFT JOIN hlw_subcontractor sub ON sub.id = pay.subcontractor_id
+        LEFT JOIN hlw_company com ON com.id = pay.company_id
+        <where>
+            <if test="hlwDutyApply.applyMonth != null and hlwDutyApply.applyMonth != ''">
+                and DATE_FORMAT(hda.apply_time, '%Y%m') = DATE_FORMAT(#{hlwDutyApply.applyMonth}, '%Y%m')
+            </if>
+            <if test="hlwDutyApply.companyId != null">
+                and pay.company_id = #{hlwDutyApply.companyId}
+            </if>
+            <if test="hlwDutyApply.subcontractorId != null">
+                and pay.subcontractor_id = #{hlwDutyApply.subcontractorId}
+            </if>
+            <if test="hlwDutyApply.applicationId != null">
+                and pay.application_id = #{hlwDutyApply.applicationId}
+            </if>
+            <if test="hlwDutyApply.cpId != null">
+                and pay.cp_id = #{hlwDutyApply.cpId}
+            </if>
+        </where>
+        ORDER BY
+        a.update_time DESC,
+        a.id ASC
+    </select>
+
 </mapper>

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

@@ -31,4 +31,8 @@ public interface IHlwDutyApplyService extends IService<HlwDutyApply> {
     HlwDutyApply getApply(HlwDutyApply hlwDutyApply);
 
     List<HlwDutyApply> findDutyApplyList(HlwDutyApply hlwDutyApply);
+
+    Page<HlwDutyApply> findDutyApplyApiList(Page<HlwDutyApply> page, List<String> companyCodeList, HlwDutyApply hlwDutyApply, Integer applicationId);
+
+    Page<HlwPaymentDetail> findDutyUserApiList(Page<HlwPaymentDetail> page, HlwDutyApply hlwDutyApply);
 }

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

@@ -60,4 +60,15 @@ public class HlwDutyApplyServiceImpl extends ServiceImpl<HlwDutyApplyMapper, Hlw
     public List<HlwDutyApply> findDutyApplyList(HlwDutyApply hlwDutyApply) {
         return baseMapper.findDutyApplyList(hlwDutyApply);
     }
+
+
+    @Override
+    public Page<HlwDutyApply> findDutyApplyApiList(Page<HlwDutyApply> page, List<String> companyCodeList, HlwDutyApply hlwDutyApply, Integer applicationId) {
+        return page.setRecords(baseMapper.findDutyApplyApiList(page, companyCodeList, hlwDutyApply, applicationId));
+    }
+
+    @Override
+    public Page<HlwPaymentDetail> findDutyUserApiList(Page<HlwPaymentDetail> page, HlwDutyApply hlwDutyApply) {
+        return page.setRecords(baseMapper.findDutyUserApiList(page, hlwDutyApply));
+    }
 }