修改页面和接口
This commit is contained in:
parent
9a2097a7fa
commit
8ea7d365f9
|
@ -1,9 +1,11 @@
|
|||
package com.cyx.web.base.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.cyx.common.core.controller.BaseController;
|
||||
import com.cyx.common.core.domain.AjaxResult;
|
||||
import com.cyx.common.core.domain.entity.SysUser;
|
||||
import com.cyx.common.json.JSONObject;
|
||||
import com.cyx.common.utils.DateUtils;
|
||||
import com.cyx.web.base.domain.TAmentAdvancedDept;
|
||||
import com.cyx.web.base.domain.TAmentAdvancedParty;
|
||||
import com.cyx.web.base.domain.TAmentPartyAffairs;
|
||||
|
@ -18,8 +20,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/base/index")
|
||||
|
@ -34,13 +40,13 @@ public class BigScreenController extends BaseController {
|
|||
|
||||
/**
|
||||
* 所有统计
|
||||
*
|
||||
* @param am
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/groupAll")
|
||||
@ResponseBody
|
||||
public AjaxResult groupAll(TAmentPartyAffairs am)
|
||||
{
|
||||
public AjaxResult groupAll(TAmentPartyAffairs am) {
|
||||
SysUser u = getSysUser();
|
||||
am.setDeptId(u.getDeptId());
|
||||
List<Map<String, Object>> list = partyAffairsService.groupAll(am);
|
||||
|
@ -49,13 +55,13 @@ public class BigScreenController extends BaseController {
|
|||
|
||||
/**
|
||||
* 党务及意识形态
|
||||
*
|
||||
* @param am
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/dwysxt")
|
||||
@ResponseBody
|
||||
public AjaxResult dwysxt(TAmentPartyAffairs am)
|
||||
{
|
||||
public AjaxResult dwysxt(TAmentPartyAffairs am) {
|
||||
SysUser u = getSysUser();
|
||||
am.setDeptId(u.getDeptId());
|
||||
List<Map<String, Object>> list = partyAffairsService.dwysxt(am);
|
||||
|
@ -64,13 +70,13 @@ public class BigScreenController extends BaseController {
|
|||
|
||||
/**
|
||||
* 党风廉政建设
|
||||
*
|
||||
* @param am
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/dflzjs")
|
||||
@ResponseBody
|
||||
public AjaxResult dflzjs(TAmentPartyAffairs am)
|
||||
{
|
||||
public AjaxResult dflzjs(TAmentPartyAffairs am) {
|
||||
SysUser u = getSysUser();
|
||||
am.setDeptId(u.getDeptId());
|
||||
List<Map<String, Object>> list = partyAffairsService.dflzjs(am);
|
||||
|
@ -79,13 +85,13 @@ public class BigScreenController extends BaseController {
|
|||
|
||||
/**
|
||||
* 日常考核指标
|
||||
*
|
||||
* @param am
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/rckhzb")
|
||||
@ResponseBody
|
||||
public AjaxResult rckhzb(TAmentPartyAffairs am)
|
||||
{
|
||||
public AjaxResult rckhzb(TAmentPartyAffairs am) {
|
||||
SysUser u = getSysUser();
|
||||
am.setDeptId(u.getDeptId());
|
||||
List<Map<String, Object>> list = partyAffairsService.rckhzb(am);
|
||||
|
@ -94,13 +100,13 @@ public class BigScreenController extends BaseController {
|
|||
|
||||
/**
|
||||
* 季度考核指标
|
||||
*
|
||||
* @param am
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/ndkhbz")
|
||||
@ResponseBody
|
||||
public AjaxResult ndkhbz(TAmentPartyAffairs am)
|
||||
{
|
||||
public AjaxResult ndkhbz(TAmentPartyAffairs am) {
|
||||
SysUser u = getSysUser();
|
||||
am.setDeptId(u.getDeptId());
|
||||
List<Map<String, Object>> list = partyAffairsService.ndkhbz(am);
|
||||
|
@ -109,13 +115,13 @@ public class BigScreenController extends BaseController {
|
|||
|
||||
/**
|
||||
* 部门完成情况
|
||||
*
|
||||
* @param am
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/bmwcqk")
|
||||
@ResponseBody
|
||||
public AjaxResult bmwcqk(TAmentPartyAffairs am)
|
||||
{
|
||||
public AjaxResult bmwcqk(TAmentPartyAffairs am) {
|
||||
SysUser u = getSysUser();
|
||||
am.setDeptId(u.getDeptId());
|
||||
List<Map<String, Object>> list = partyAffairsService.bmwcqk(am);
|
||||
|
@ -127,31 +133,70 @@ public class BigScreenController extends BaseController {
|
|||
|
||||
@PostMapping("/tradeEcharts")
|
||||
@ResponseBody
|
||||
public AjaxResult tradeEcharts(TAmentTrade tAmentTrade)
|
||||
{
|
||||
int yearCount = 0;
|
||||
double yearMoney = 0.0000;
|
||||
public AjaxResult tradeEcharts(TAmentTrade tAmentTrade) {
|
||||
AtomicInteger yearCount = new AtomicInteger();
|
||||
AtomicReference<Double> yearMoney = new AtomicReference<>(0.0000);
|
||||
int monthCount = 0;
|
||||
double monthMoney = 0.0000;
|
||||
JSONObject object = new JSONObject();
|
||||
List<Map<String, Object>> list = tAmentTradeService.tradeEcharts(tAmentTrade);
|
||||
Map<String, String> tradeMap = new TreeMap<>();
|
||||
JSONArray typeArray = new JSONArray();
|
||||
JSONArray dataArray = new JSONArray();
|
||||
String month = DateUtils.parseDateToStr("YYYY-MM", new Date());
|
||||
list.forEach(l -> {
|
||||
typeArray.add(l.get("type"));
|
||||
JSONArray array = JSONArray.parseArray("[" + l.get("json").toString() + "]");
|
||||
array.forEach(a -> {
|
||||
Map<String, Object> m = (Map<String, Object>) a;
|
||||
tradeMap.put(m.get("label").toString(), m.get("label").toString());
|
||||
yearCount.addAndGet(Integer.parseInt(m.get("count").toString()));
|
||||
yearMoney.updateAndGet(v -> new Double((double) (v + Double.parseDouble(m.get("trade").toString()))));
|
||||
});
|
||||
});
|
||||
// 所有小分类
|
||||
for (Map.Entry<String, String> entry : tradeMap.entrySet()) {
|
||||
JSONObject object1 = new JSONObject();
|
||||
object1.put("name", entry.getKey());
|
||||
JSONArray array1 = new JSONArray();
|
||||
// 三个大分类
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
yearCount+=Integer.parseInt(list.get(i).get("count").toString());
|
||||
yearMoney+=Double.parseDouble(list.get(i).get("trade").toString());
|
||||
String month1 = list.get(i).get("month").toString();
|
||||
JSONArray array = JSONArray.parseArray("[" + list.get(i).get("json").toString() + "]");
|
||||
AtomicInteger count = new AtomicInteger();
|
||||
AtomicReference<Double> trade = new AtomicReference<>(0.0);
|
||||
array.forEach(a -> {
|
||||
Map<String, Object> m = (Map<String, Object>) a;
|
||||
if (entry.getKey().equals(m.get("label").toString()) && month1.equals(month)) {
|
||||
count.set(Integer.parseInt(m.get("count").toString()));
|
||||
trade.set(Double.parseDouble(m.get("trade").toString()));
|
||||
}
|
||||
object.put("list",list);
|
||||
});
|
||||
monthCount += count.get();
|
||||
monthMoney += trade.get();
|
||||
array1.add(trade.get());
|
||||
}
|
||||
object1.put("array", array1);
|
||||
dataArray.add(object1);
|
||||
}
|
||||
object.put("monthCount", monthCount);
|
||||
object.put("monthMoney", monthMoney);
|
||||
object.put("yearCount", yearCount);
|
||||
object.put("yearMoney", yearMoney);
|
||||
object.put("type", typeArray);
|
||||
object.put("data", dataArray);
|
||||
return AjaxResult.success(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* 先进成员
|
||||
*
|
||||
* @param pa
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/advanceParity")
|
||||
@ResponseBody
|
||||
public AjaxResult advanceParity(TAmentAdvancedParty pa)
|
||||
{
|
||||
public AjaxResult advanceParity(TAmentAdvancedParty pa) {
|
||||
SysUser u = getSysUser();
|
||||
List<Map<String, Object>> list = advancedPartyService.advanceParity(pa);
|
||||
return AjaxResult.success(list);
|
||||
|
@ -159,13 +204,13 @@ public class BigScreenController extends BaseController {
|
|||
|
||||
/**
|
||||
* 先进部门
|
||||
*
|
||||
* @param dept
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/advanceDept")
|
||||
@ResponseBody
|
||||
public AjaxResult advanceDept(TAmentAdvancedDept dept)
|
||||
{
|
||||
public AjaxResult advanceDept(TAmentAdvancedDept dept) {
|
||||
SysUser u = getSysUser();
|
||||
List<Map<String, Object>> list = advancedDeptService.advanceDept(dept);
|
||||
return AjaxResult.success(list);
|
||||
|
|
|
@ -34,15 +34,19 @@
|
|||
<select id="tradeEcharts" resultType="map">
|
||||
SELECT
|
||||
month_of 'month',
|
||||
type,
|
||||
ROUND( sum( trade_mony ), 4 ) trade,
|
||||
SUM( trade_count ) count
|
||||
SUM( trade_count ) count,
|
||||
GROUP_CONCAT( '{"label":"', trade_type, '","trade":', trade_mony, ',"count":', trade_count, '}' ) json
|
||||
FROM
|
||||
t_ament_trade
|
||||
WHERE
|
||||
month_of LIKE CONCAT( '%', DATE_FORMAT( NOW(), '%Y' ), '%' )
|
||||
GROUP BY
|
||||
month_of
|
||||
ORDER BY month_of desc
|
||||
month_of,
|
||||
type
|
||||
ORDER BY
|
||||
month_of DESC
|
||||
</select>
|
||||
|
||||
<insert id="insertTAmentTrade" parameterType="TAmentTrade" useGeneratedKeys="true" keyProperty="id">
|
||||
|
|
Loading…
Reference in New Issue